diff --git a/prrt/prrt.pyx b/prrt/prrt.pyx index 808886939bfc91745ec74dc59ddabb2ce485bbfc..65402be5c4b3a8476efc2755c7ae86994e448038 100644 --- a/prrt/prrt.pyx +++ b/prrt/prrt.pyx @@ -126,18 +126,35 @@ cdef class PrrtSocket: cprrt.PrrtSocket_enable_thread_pinning(self._c_socket) cprrt.PrrtSocket_bind(self._c_socket, host.encode("utf8"), port) - property plr_fwd: + + # Channel Properties + property data_rate_btl_fwd: def __get__(self): - return cprrt.PrrtSocket_get_plr_fwd(self._c_socket) + return cprrt.PrrtSocket_get_btlbw_fwd(self._c_socket) - property thread_pinning: + property data_rate_btl_back: def __get__(self): - return cprrt.PrrtSocket_uses_thread_pinning(self._c_socket) + return cprrt.PrrtSocket_get_btlbw_back(self._c_socket) + + property rtt_prop_fwd: + def __get__(self): + return cprrt.PrrtSocket_get_rtprop_fwd(self._c_socket) * 0.000001 + + property loss_rate_fwd: + def __get__(self): + return cprrt.PrrtSocket_get_plr_fwd(self._c_socket) + # Application Properties property target_delay: def __get__(self): return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "targetdelay") * 0.000001 + + # Protocol configuration + property thread_pinning: + def __get__(self): + return cprrt.PrrtSocket_uses_thread_pinning(self._c_socket) + property app_queue_size: def __get__(self): return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "app_queue_size") @@ -145,10 +162,6 @@ cdef class PrrtSocket: def __set__(self, value): cprrt.PrrtSocket_set_sock_opt(self._c_socket, "app_queue_size", value) - property rtt_fwd: - def __get__(self): - return cprrt.PrrtSocket_get_rtprop_fwd(self._c_socket) * 0.000001 - property coding_configuration: def __get__(self): cdef cprrt.PrrtCodingConfiguration *params = cprrt.PrrtSocket_get_coding_parameters(self._c_socket) @@ -162,22 +175,17 @@ cdef class PrrtSocket: n_cycle[i] = x cprrt.PrrtSocket_set_coding_parameters(self._c_socket, params.k, params.n, c, n_cycle) - property delivery_rate_fwd: - def __get__(self): - return cprrt.PrrtSocket_get_delivery_rate_fwd(self._c_socket) - - property btlbw_fwd: - def __get__(self): - return cprrt.PrrtSocket_get_btlbw_fwd(self._c_socket) + # Sending + def connect(self, address): + host, port = address + cdef bytes encodedHost = host.encode("utf-8") + cprrt.PrrtSocket_connect(self._c_socket, encodedHost, port) - property btlbw_back: - def __get__(self): - return cprrt.PrrtSocket_get_btlbw_back(self._c_socket) + def send(self, data): + cprrt.PrrtSocket_send(self._c_socket, data, len(data)) - property app_limited: - def __get__(self): - return cprrt.PrrtSocket_get_app_limited(self._c_socket) + # Receiving def recv(self): cdef char buffer[65536] cdef int32_t len @@ -239,13 +247,11 @@ cdef class PrrtSocket: len = cprrt.PrrtSocket_receive_ordered_timedwait(self._c_socket, buffer, &addr, time_window_us, &deadline_timespec) return buffer[:len], sockaddr_to_addr_and_port(addr) - def connect(self, address): - host, port = address - cdef bytes encodedHost = host.encode("utf-8") - cprrt.PrrtSocket_connect(self._c_socket, encodedHost, port) - def send(self, data): - cprrt.PrrtSocket_send(self._c_socket, data, len(data)) + # Internals + property app_limited: + def __get__(self): + return cprrt.PrrtSocket_get_app_limited(self._c_socket) def __dealloc__(self): if self._c_socket != NULL: