diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/Makefile.am | 3 | ||||
-rw-r--r-- | python/doc/Makefile.am | 8 | ||||
-rw-r--r-- | python/examples/Makefile.am | 6 | ||||
-rw-r--r-- | python/netlink/Makefile.am | 11 | ||||
-rw-r--r-- | python/netlink/capi.i | 20 | ||||
-rw-r--r-- | python/netlink/genl/Makefile.am | 5 | ||||
-rw-r--r-- | python/netlink/genl/capi.i | 8 | ||||
-rw-r--r-- | python/netlink/route/Makefile.am | 14 | ||||
-rw-r--r-- | python/netlink/utils.h | 2 | ||||
-rw-r--r-- | python/setup.py.in | 4 | ||||
-rw-r--r-- | python/tests/Makefile.am | 5 |
11 files changed, 32 insertions, 54 deletions
diff --git a/python/Makefile.am b/python/Makefile.am deleted file mode 100644 index a1a3426e..00000000 --- a/python/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -# -*- Makefile -*- - -SUBDIRS = doc examples netlink tests diff --git a/python/doc/Makefile.am b/python/doc/Makefile.am deleted file mode 100644 index a2fe6f2b..00000000 --- a/python/doc/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -# -*- Makefile -*- - -EXTRA_DIST = \ - conf.py \ - core.rst \ - index.rst \ - route_addr.rst \ - route.rst diff --git a/python/examples/Makefile.am b/python/examples/Makefile.am deleted file mode 100644 index 1cea5e2d..00000000 --- a/python/examples/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -# -*- Makefile -*- - -EXTRA_DIST = \ - iface.py \ - nl80211.py \ - wiphy.py diff --git a/python/netlink/Makefile.am b/python/netlink/Makefile.am deleted file mode 100644 index 1f6eaf8f..00000000 --- a/python/netlink/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -# -*- Makefile -*- - -SUBDIRS = route genl - -EXTRA_DIST = \ - capi.i \ - fixes.h \ - __init__.py \ - core.py \ - util.py \ - utils.h diff --git a/python/netlink/capi.i b/python/netlink/capi.i index e5d8a536..98f4e33e 100644 --- a/python/netlink/capi.i +++ b/python/netlink/capi.i @@ -9,13 +9,15 @@ #include <netlink/attr.h> #include <net/if.h> -#define DEBUG +/* enable define below to get swig api debug messages */ +/*#define DEBUG*/ #include "utils.h" %} %include <stdint.i> %include <cstring.i> %include <cpointer.i> +%include <exception.i> %inline %{ struct nl_dump_params *alloc_dump_params(void) @@ -186,6 +188,9 @@ extern void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups); extern int nl_socket_set_buffer_size(struct nl_sock *, int, int); extern void nl_socket_set_cb(struct nl_sock *, struct nl_cb *); +extern int nl_socket_add_membership(struct nl_sock *, int); +extern int nl_socket_drop_membership(struct nl_sock *, int); + extern int nl_send_auto_complete(struct nl_sock *, struct nl_msg *); extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *); @@ -808,6 +813,19 @@ extern void *nla_data(struct nlattr *); %typemap(out) void *; extern int nla_type(const struct nlattr *); +%typemap(in) (int, const void *) { + $1 = Py_SIZE($input); + if (PyByteArray_Check($input)) { + $2 = ($2_ltype)PyByteArray_AsString($input); + } else if (PyString_Check($input)) { + $2 = ($2_ltype)PyString_AsString($input); + } else + SWIG_exception(SWIG_TypeError, + "pointer must be bytearray or string."); +} +extern int nla_put(struct nl_msg *, int, int, const void *); +%typemap(in) const void *; + /* Integer attribute */ extern uint8_t nla_get_u8(struct nlattr *); extern int nla_put_u8(struct nl_msg *, int, uint8_t); diff --git a/python/netlink/genl/Makefile.am b/python/netlink/genl/Makefile.am deleted file mode 100644 index 9e309047..00000000 --- a/python/netlink/genl/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# -*- Makefile -*- - -EXTRA_DIST = \ - capi.i \ - __init__.py diff --git a/python/netlink/genl/capi.i b/python/netlink/genl/capi.i index 069e617e..fbf448fd 100644 --- a/python/netlink/genl/capi.i +++ b/python/netlink/genl/capi.i @@ -36,8 +36,16 @@ extern void genl_family_set_maxattr(struct genl_family *, uint32_t); extern int genl_family_add_op(struct genl_family *, int, int); extern int genl_family_add_grp(struct genl_family *, uint32_t , const char *); +/* #include <linux/genetlink.h> */ +struct genlmsghdr { + uint8_t cmd; + uint8_t version; + uint16_t reserved; +}; + /* #include <netlink/genl/genl.h> */ extern int genl_connect(struct nl_sock *); +extern struct genlmsghdr *genlmsg_hdr(struct nlmsghdr *); extern void *genlmsg_put(struct nl_msg *, uint32_t, uint32_t, int, int, int, uint8_t, uint8_t); diff --git a/python/netlink/route/Makefile.am b/python/netlink/route/Makefile.am deleted file mode 100644 index ef714f45..00000000 --- a/python/netlink/route/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -# -*- Makefile -*- - -EXTRA_DIST = \ - capi.i \ - __init__.py \ - address.py \ - link.py \ - tc.py \ - links/__init__.py \ - links/dummy.py \ - links/inet.py \ - links/vlan.py \ - qdisc/__init__.py \ - qdisc/htb.py diff --git a/python/netlink/utils.h b/python/netlink/utils.h index 7836c307..3ec2fb54 100644 --- a/python/netlink/utils.h +++ b/python/netlink/utils.h @@ -30,7 +30,7 @@ static inline void list_del(struct list_head *entry, struct list_head *prev) #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + const __typeof__( ((type *)0)->member ) *__mptr = (ptr);\ (type *)( (char *)__mptr - offsetof(type,member) );}) #ifdef DEBUG diff --git a/python/setup.py.in b/python/setup.py.in index 346c770f..0cd35d09 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -35,6 +35,10 @@ setup(name = 'netlink', description = 'Python wrapper for netlink protocols', author = 'Thomas Graf', author_email = 'tgraf@suug.ch', + url = 'http://www.infradead.org/~tgr/libnl/', + license = 'LGPL 2', + platforms = 'linux2', + long_description = 'Experimental python bindings for libnl', ext_modules = [netlink_capi, route_capi, genl_capi], package_dir = {'': '@srcdir@'}, packages = ['netlink', 'netlink.genl', 'netlink.route', diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am deleted file mode 100644 index 15f77fa4..00000000 --- a/python/tests/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ - -# -*- Makefile -*- - -EXTRA_DIST = \ - test-create-bridge.py |