1 #ifndef __LIBGENL_H__
2 #define __LIBGENL_H__
3 
4 #include "libnetlink.h"
5 
6 #define GENL_REQUEST(_req, _bufsiz, _family, _hdrsiz, _ver, _cmd, _flags) \
7 struct {								\
8 	struct nlmsghdr		n;					\
9 	struct genlmsghdr	g;					\
10 	char			buf[NLMSG_ALIGN(_hdrsiz) + (_bufsiz)];	\
11 } _req = {								\
12 	.n = {								\
13 		.nlmsg_type = (_family),				\
14 		.nlmsg_flags = (_flags),				\
15 		.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN + (_hdrsiz)),	\
16 	},								\
17 	.g = {								\
18 		.cmd = (_cmd),						\
19 		.version = (_ver),					\
20 	},								\
21 }
22 
23 extern int genl_resolve_family(struct rtnl_handle *grth, const char *family);
24 extern int genl_init_handle(struct rtnl_handle *grth, const char *family,
25 			    int *genl_family);
26 
27 #endif /* __LIBGENL_H__ */
28