Blame libnetlink.h

Packit Service 26469c
#ifndef __LIBNETLINK_H__
Packit Service 26469c
#define __LIBNETLINK_H__ 1
Packit Service 26469c
Packit Service 26469c
#include <asm/types.h>
Packit Service 26469c
/* needed by netlink.h, should be in there */
Packit Service 26469c
#include <arpa/inet.h>
Packit Service 26469c
#include <linux/netlink.h>
Packit Service 26469c
#include <linux/rtnetlink.h>
Packit Service 26469c
Packit Service 26469c
struct rtnl_handle
Packit Service 26469c
{
Packit Service 26469c
	int			fd;
Packit Service 26469c
	struct sockaddr_nl	local;
Packit Service 26469c
	struct sockaddr_nl	peer;
Packit Service 26469c
	__u32			seq;
Packit Service 26469c
	__u32			dump;
Packit Service 26469c
};
Packit Service 26469c
Packit Service 26469c
extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
Packit Service 26469c
extern int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions, int protocol);
Packit Service 26469c
extern void rtnl_close(struct rtnl_handle *rth);
Packit Service 26469c
extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type);
Packit Service 26469c
extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len);
Packit Service 26469c
Packit Service 26469c
typedef int (*rtnl_filter_t)(const struct sockaddr_nl *,
Packit Service 26469c
			     struct nlmsghdr *n, void *);
Packit Service 26469c
extern int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter,
Packit Service 26469c
			    void *arg1,
Packit Service 26469c
			    rtnl_filter_t junk,
Packit Service 26469c
			    void *arg2);
Packit Service 26469c
extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
Packit Service 26469c
		     unsigned groups, struct nlmsghdr *answer,
Packit Service 26469c
		     rtnl_filter_t junk,
Packit Service 26469c
		     void *jarg);
Packit Service 26469c
extern int rtnl_send(struct rtnl_handle *rth, const char *buf, int);
Packit Service 26469c
Packit Service 26469c
Packit Service 26469c
extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
Packit Service 26469c
extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen);
Packit Service 26469c
extern int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len);
Packit Service 26469c
extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
Packit Service 26469c
extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, const void *data, int alen);
Packit Service 26469c
Packit Service 26469c
extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
Packit Service 26469c
extern int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int len);
Packit Service 26469c
Packit Service 26469c
#define parse_rtattr_nested(tb, max, rta) \
Packit Service 26469c
	(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
Packit Service 26469c
Packit Service 26469c
extern int rtnl_listen(struct rtnl_handle *, rtnl_filter_t handler,
Packit Service 26469c
		       void *jarg);
Packit Service 26469c
extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
Packit Service 26469c
		       void *jarg);
Packit Service 26469c
Packit Service 26469c
#define NLMSG_TAIL(nmsg) \
Packit Service 26469c
	((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
Packit Service 26469c
Packit Service 26469c
#ifndef IFA_RTA
Packit Service 26469c
#define IFA_RTA(r) \
Packit Service 26469c
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
Packit Service 26469c
#endif
Packit Service 26469c
#ifndef IFA_PAYLOAD
Packit Service 26469c
#define IFA_PAYLOAD(n)	NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
Packit Service 26469c
#endif
Packit Service 26469c
Packit Service 26469c
#ifndef IFLA_RTA
Packit Service 26469c
#define IFLA_RTA(r) \
Packit Service 26469c
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
Packit Service 26469c
#endif
Packit Service 26469c
#ifndef IFLA_PAYLOAD
Packit Service 26469c
#define IFLA_PAYLOAD(n)	NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
Packit Service 26469c
#endif
Packit Service 26469c
Packit Service 26469c
#ifndef NDA_RTA
Packit Service 26469c
#define NDA_RTA(r) \
Packit Service 26469c
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
Packit Service 26469c
#endif
Packit Service 26469c
#ifndef NDA_PAYLOAD
Packit Service 26469c
#define NDA_PAYLOAD(n)	NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
Packit Service 26469c
#endif
Packit Service 26469c
Packit Service 26469c
#ifndef NDTA_RTA
Packit Service 26469c
#define NDTA_RTA(r) \
Packit Service 26469c
	((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndtmsg))))
Packit Service 26469c
#endif
Packit Service 26469c
#ifndef NDTA_PAYLOAD
Packit Service 26469c
#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
Packit Service 26469c
#endif
Packit Service 26469c
Packit Service 26469c
#endif /* __LIBNETLINK_H__ */
Packit Service 26469c