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:
Arend van Spriel 2013-09-05 14:11:32 +02:00 committed by Thomas Graf
parent 6726895133
commit b9284bcded

View File

@ -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):