From fac10ea799fe9b6158d74f66d6ad46536d38a545 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Wed, 18 Mar 2009 04:55:00 +0100 Subject: Initial commit --- include/netlink.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 include/netlink.h (limited to 'include/netlink.h') diff --git a/include/netlink.h b/include/netlink.h new file mode 100644 index 00000000..4849ff51 --- /dev/null +++ b/include/netlink.h @@ -0,0 +1,60 @@ +#ifndef _NETLINK_H +#define _NETLINK_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +/** + * struct netlink_ctx + * + * @msgs: message queue + * @list: list of parsed rules/chains/tables + */ +struct netlink_ctx { + struct list_head *msgs; + struct list_head list; +}; + +extern void netlink_dump_object(struct nl_object *obj); + +extern struct nfnl_nft_table *alloc_nft_table(const struct handle *h); +extern struct nfnl_nft_chain *alloc_nft_chain(const struct handle *h); +extern struct nfnl_nft_rule *alloc_nft_rule(const struct handle *h); +extern struct nfnl_nft_expr *alloc_nft_expr(int (*init)(struct nfnl_nft_expr *)); +extern struct nfnl_nft_data *alloc_nft_data(const void *data, unsigned int len); + +extern int netlink_linearize_rule(struct netlink_ctx *ctx, + struct nfnl_nft_rule *nlr, + const struct rule *rule); +extern struct rule *netlink_delinearize_rule(struct netlink_ctx *ctx, + const struct nl_object *obj); + +extern int netlink_add_rule(struct netlink_ctx *ctx, const struct handle *h, + const struct rule *rule); +extern int netlink_delete_rule(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_get_rule(struct netlink_ctx *ctx, const struct handle *h); + +extern int netlink_add_chain(struct netlink_ctx *ctx, const struct handle *h, + const struct chain *chain); +extern int netlink_delete_chain(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_get_chain(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_list_chain(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_flush_chain(struct netlink_ctx *ctx, const struct handle *h); + +extern int netlink_add_table(struct netlink_ctx *ctx, const struct handle *h, + const struct table *table); +extern int netlink_delete_table(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_get_table(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h); +extern int netlink_flush_table(struct netlink_ctx *ctx, const struct handle *h); + +#endif /* _NETLINK_H */ -- cgit v1.2.3