mirror of
https://github.com/openharmony/third_party_libnl.git
synced 2026-07-20 23:45:55 -04:00
522cf98fc2
The callback functionality only worked for regular Python
functions. With this patch it also allows the callback
to be a class method (bounded or unbounded) as show in
example below.
class test_class(object):
def my_callback(self, msg, arg):
print('handling %s' % str(msg))
s = netlink.core.Socket()
testobj = test_class()
netlink.capi.py_nl_cb_set(cb, netlink.capi.NL_CB_VALID,
netlink.capi.NL_CB_CUSTOM,
test_class.my_callback, testobj)
netlink.capi.py_nl_cb_err(cb, netlink.capi.NL_CB_CUSTOM,
test_class.my_callback, s)
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
*************************************************************************** NOTE: The python wrapper is experimental and may or may not work. *************************************************************************** For the brave: (requires an installed libnl) - $ python ./setup.py build - $ sudo python ./setup.py install