Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PRRT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
36
Issues
36
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LARN
PRRT
Commits
a42fb197
Commit
a42fb197
authored
Jan 08, 2018
by
Andreas Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Python bindings for all receive calls.
parent
ddfe37d0
Pipeline
#1808
failed with stages
in 1 minute and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
prrt/prrt.pyx
prrt/prrt.pyx
+40
-0
No files found.
prrt/prrt.pyx
View file @
a42fb197
from
libc.stdint
cimport
uint32_t
,
uint16_t
,
uint8_t
,
int32_t
from
libc.stdlib
cimport
malloc
,
free
from
posix.time
cimport
timespec
cimport
cprrt
...
...
@@ -189,6 +190,36 @@ cdef class PrrtSocket:
len
=
cprrt
.
PrrtSocket_recv
(
self
.
_c_socket
,
<
void
*>
buffer
)
return
buffer
[:
len
]
def
receive_asap
(
self
):
cdef
char
buffer
[
65536
]
cdef
int32_t
len
with
nogil
:
len
=
cprrt
.
PrrtSocket_receive_asap
(
self
.
_c_socket
,
<
void
*>
buffer
)
return
buffer
[:
len
]
def
receive_asap_wait
(
self
):
cdef
char
buffer
[
65536
]
cdef
int32_t
len
with
nogil
:
len
=
cprrt
.
PrrtSocket_receive_asap_wait
(
self
.
_c_socket
,
<
void
*>
buffer
)
return
buffer
[:
len
]
def
receive_asap_timedwait
(
self
,
deadline
):
cdef
char
buffer
[
65536
]
cdef
int32_t
len
cdef
timespec
deadline_timespec
=
timespec
(
deadline
.
seconds
,
deadline
.
microseconds
*
1000
)
with
nogil
:
len
=
cprrt
.
PrrtSocket_receive_asap_timedwait
(
self
.
_c_socket
,
<
void
*>
buffer
,
&
deadline_timespec
)
return
buffer
[:
len
]
def
receive_ordered
(
self
,
time_window
):
cdef
char
buffer
[
65536
]
cdef
int32_t
len
cdef
uint32_t
time_window_us
=
time_window
*
(
1000
**
2
)
with
nogil
:
len
=
cprrt
.
PrrtSocket_receive_ordered
(
self
.
_c_socket
,
<
void
*>
buffer
,
time_window_us
)
return
buffer
[:
len
]
def
receive_ordered_wait
(
self
,
time_window
):
cdef
char
buffer
[
65536
]
cdef
int32_t
len
...
...
@@ -197,6 +228,15 @@ cdef class PrrtSocket:
len
=
cprrt
.
PrrtSocket_receive_ordered_wait
(
self
.
_c_socket
,
<
void
*>
buffer
,
time_window_us
)
return
buffer
[:
len
]
def
receive_ordered_timedwait
(
self
,
time_window
,
deadline
):
cdef
char
buffer
[
65536
]
cdef
int32_t
len
cdef
uint32_t
time_window_us
=
time_window
*
(
1000
**
2
)
cdef
timespec
deadline_timespec
=
timespec
(
deadline
.
seconds
,
deadline
.
microseconds
*
1000
)
with
nogil
:
len
=
cprrt
.
PrrtSocket_receive_ordered_timedwait
(
self
.
_c_socket
,
<
void
*>
buffer
,
time_window_us
,
&
deadline_timespec
)
return
buffer
[:
len
]
def
connect
(
self
,
host
,
port
):
cdef
bytes
encodedHost
=
host
.
encode
(
"utf-8"
)
cprrt
.
PrrtSocket_connect
(
self
.
_c_socket
,
encodedHost
,
port
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment