mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2024-12-04 09:13:33 +00:00
python: add send and receive functions to Socket class
Adding class methods send_auto_complete() and recvmsgs() that call their swig capi equivalent function. Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
6726895133
commit
b9284bcded
@ -241,6 +241,21 @@ class Socket(object):
|
||||
else:
|
||||
return ret
|
||||
|
||||
def send_auto_complete(self, msg):
|
||||
if not isinstance(msg, Message):
|
||||
raise Exception('must provide Message instance')
|
||||
ret = capi.nl_send_auto_complete(self._sock, msg._msg)
|
||||
if ret < 0:
|
||||
raise Exception('send_auto_complete failed: ret=%d' % ret)
|
||||
return ret
|
||||
|
||||
def recvmsgs(self, recv_cb):
|
||||
if not isinstance(recv_cb, Callback):
|
||||
raise Exception('must provide Callback instance')
|
||||
ret = capi.nl_recvmsgs(self._sock, recv_cb._cb)
|
||||
if ret < 0:
|
||||
raise Exception('recvmsg failed: ret=%d' % ret)
|
||||
|
||||
_sockets = {}
|
||||
|
||||
def lookup_socket(protocol):
|
||||
|
Loading…
Reference in New Issue
Block a user