Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
0066be49
Commit
0066be49
authored
6 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python: add more bindings for SockAddr
parent
592ed4ee
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
python/opendht.pyx
+6
-0
6 additions, 0 deletions
python/opendht.pyx
python/opendht_cpp.pxd
+3
-0
3 additions, 0 deletions
python/opendht_cpp.pxd
python/tools/pingpong.py
+1
-1
1 addition, 1 deletion
python/tools/pingpong.py
with
10 additions
and
1 deletion
python/opendht.pyx
+
6
−
0
View file @
0066be49
...
@@ -139,6 +139,12 @@ cdef class SockAddr(object):
...
@@ -139,6 +139,12 @@ cdef class SockAddr(object):
return
self
.
_addr
.
setPort
(
port
)
return
self
.
_addr
.
setPort
(
port
)
def
setFamily
(
SockAddr
self
,
cpp
.
sa_family_t
af
):
def
setFamily
(
SockAddr
self
,
cpp
.
sa_family_t
af
):
return
self
.
_addr
.
setFamily
(
af
)
return
self
.
_addr
.
setFamily
(
af
)
def
isLoopback
(
SockAddr
self
):
return
self
.
_addr
.
isLoopback
()
def
isPrivate
(
SockAddr
self
):
return
self
.
_addr
.
isPrivate
()
def
isUnspecified
(
SockAddr
self
):
return
self
.
_addr
.
isUnspecified
()
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
toString
().
decode
()
return
self
.
toString
().
decode
()
def
__repr__
(
self
):
def
__repr__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
python/opendht_cpp.pxd
+
3
−
0
View file @
0066be49
...
@@ -77,6 +77,9 @@ cdef extern from "opendht/sockaddr.h" namespace "dht":
...
@@ -77,6 +77,9 @@ cdef extern from "opendht/sockaddr.h" namespace "dht":
void
setPort
(
in_port_t
p
)
void
setPort
(
in_port_t
p
)
sa_family_t
getFamily
()
const
sa_family_t
getFamily
()
const
void
setFamily
(
sa_family_t
f
)
void
setFamily
(
sa_family_t
f
)
bool
isLoopback
()
const
bool
isPrivate
()
const
bool
isUnspecified
()
const
ctypedef
vector
[
uint8_t
]
Blob
ctypedef
vector
[
uint8_t
]
Blob
...
...
This diff is collapsed.
Click to expand it.
python/tools/pingpong.py
+
1
−
1
View file @
0066be49
...
@@ -51,7 +51,7 @@ def ping(node, h):
...
@@ -51,7 +51,7 @@ def ping(node, h):
def
pong
(
node
,
h
):
def
pong
(
node
,
h
):
print
(
node
.
getNodeId
().
decode
(),
"
got ping
"
,
h
,
i
)
print
(
node
.
getNodeId
().
decode
(),
"
got ping
"
,
h
,
i
)
loop
.
call_soon_threadsafe
(
ping
,
node
,
h
)
;
loop
.
call_soon_threadsafe
(
ping
,
node
,
h
)
return
True
return
True
ping_node
.
listen
(
loc_ping
,
lambda
v
:
pong
(
pong_node
,
loc_pong
))
ping_node
.
listen
(
loc_ping
,
lambda
v
:
pong
(
pong_node
,
loc_pong
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment