Skip to content
Commits on Source (2)
......@@ -6,7 +6,7 @@ verify_ssl = true
[dev-packages]
[packages]
cython = "*"
Cython = "*"
jupyter = "*"
numpy = "*"
pandas = "*"
......@@ -14,6 +14,7 @@ matplotlib = "*"
ruamel-yaml = "*"
scikit-learn = "*"
graphviz = "*"
prrt = {editable = true, path = "."}
[requires]
python_version = "3.6"
This diff is collapsed.
......@@ -121,6 +121,8 @@ cdef extern from "proto/socket.h":
cdef PrrtSocket* PrrtSocket_create(const uint32_t maximum_payload_size, const uint32_t target_delay)
int PrrtSocket_bind(PrrtSocket *sock_ptr, const_char *ipAddress, const uint16_t port)
bint PrrtSocket_enable_hardware_timestamping(PrrtSocket *s, const_char *interface_name)
int PrrtSocket_close(const PrrtSocket *sock_ptr)
int PrrtSocket_connect(PrrtSocket *sock_ptr, const_char *host, const uint16_t port)
int PrrtSocket_send_sync(PrrtSocket *sock_ptr, const uint8_t *data, const size_t data_len)
......@@ -186,4 +188,3 @@ cdef extern from "util/pipe.h":
cdef extern from "util/mpsc_queue.h":
ctypedef struct MPSCQueue:
pass
......@@ -173,12 +173,14 @@ cdef class PrrtSocket:
cdef cprrt.PrrtSocket* _c_socket
_epoch = datetime.datetime.utcfromtimestamp(0)
def __cinit__(self, address, maximum_payload_size = 1400, target_delay = 1, thread_pinning = False):
def __cinit__(self, address, maximum_payload_size = 1400, target_delay = 1, thread_pinning = False, hardware_timestamping_interface=None):
host, port = address
target_delay_us = target_delay * 1000**2
self._c_socket = cprrt.PrrtSocket_create(maximum_payload_size, target_delay_us)
if thread_pinning:
cprrt.PrrtSocket_enable_thread_pinning(self._c_socket)
if hardware_timestamping_interface is not None:
cprrt.PrrtSocket_enable_hardware_timestamping(self._c_socket, hardware_timestamping_interface.encode("UTF-8"))
h_errno = cprrt.PrrtSocket_bind(self._c_socket, host.encode("utf8"), port)
if h_errno != 0:
# PrrtSocket_bind calls PrrtSocket_close on error
......