|
Packit |
c5a612 |
#ifndef _NFTABLES_MNL_H_
|
|
Packit |
c5a612 |
#define _NFTABLES_MNL_H_
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
#include <list.h>
|
|
Packit |
c5a612 |
#include <netlink.h>
|
|
Packit |
c5a612 |
#include <rule.h>
|
|
Packit |
c5a612 |
#include <libmnl/libmnl.h>
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct mnl_socket *nft_mnl_socket_open(void);
|
|
Packit |
c5a612 |
struct mnl_socket *nft_mnl_socket_reopen(struct mnl_socket *nf_sock);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
uint32_t mnl_seqnum_alloc(uint32_t *seqnum);
|
|
Packit |
c5a612 |
uint32_t mnl_genid_get(struct netlink_ctx *ctx);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct mnl_err {
|
|
Packit |
c5a612 |
struct list_head head;
|
|
Packit |
c5a612 |
int err;
|
|
Packit |
c5a612 |
uint32_t seqnum;
|
|
Packit |
c5a612 |
};
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
void mnl_err_list_free(struct mnl_err *err);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_batch *mnl_batch_init(void);
|
|
Packit |
c5a612 |
bool mnl_batch_ready(struct nftnl_batch *batch);
|
|
Packit |
c5a612 |
void mnl_batch_reset(struct nftnl_batch *batch);
|
|
Packit |
c5a612 |
uint32_t mnl_batch_begin(struct nftnl_batch *batch, uint32_t seqnum);
|
|
Packit |
c5a612 |
void mnl_batch_end(struct nftnl_batch *batch, uint32_t seqnum);
|
|
Packit |
c5a612 |
int mnl_batch_talk(struct netlink_ctx *ctx, struct list_head *err_list,
|
|
Packit |
c5a612 |
uint32_t num_cmds);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_rule_add(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_rule_del(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
int mnl_nft_rule_replace(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_rule_list *mnl_nft_rule_dump(struct netlink_ctx *ctx,
|
|
Packit |
c5a612 |
int family);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_chain_add(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_chain_del(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
int mnl_nft_chain_rename(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
const struct chain *chain);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_chain_list *mnl_nft_chain_dump(struct netlink_ctx *ctx,
|
|
Packit |
c5a612 |
int family);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_table_add(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_table_del(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_table_list *mnl_nft_table_dump(struct netlink_ctx *ctx,
|
|
Packit |
c5a612 |
int family);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_set_add(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_set_del(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_set_list *mnl_nft_set_dump(struct netlink_ctx *ctx, int family,
|
|
Packit |
c5a612 |
const char *table);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_setelem_add(struct netlink_ctx *ctx, const struct set *set,
|
|
Packit |
c5a612 |
const struct expr *expr, unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_setelem_del(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
int mnl_nft_setelem_flush(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
int mnl_nft_setelem_get(struct netlink_ctx *ctx, struct nftnl_set *nls);
|
|
Packit |
c5a612 |
struct nftnl_set *mnl_nft_setelem_get_one(struct netlink_ctx *ctx,
|
|
Packit |
c5a612 |
struct nftnl_set *nls);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_obj_list *mnl_nft_obj_dump(struct netlink_ctx *ctx, int family,
|
|
Packit |
c5a612 |
const char *table,
|
|
Packit |
c5a612 |
const char *name, uint32_t type,
|
|
Packit |
c5a612 |
bool dump, bool reset);
|
|
Packit |
c5a612 |
int mnl_nft_obj_add(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_obj_del(struct netlink_ctx *ctx, const struct cmd *cmd, int type);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
struct nftnl_flowtable_list *
|
|
Packit |
c5a612 |
mnl_nft_flowtable_dump(struct netlink_ctx *ctx, int family, const char *table);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_flowtable_add(struct netlink_ctx *ctx, const struct cmd *cmd,
|
|
Packit |
c5a612 |
unsigned int flags);
|
|
Packit |
c5a612 |
int mnl_nft_flowtable_del(struct netlink_ctx *ctx, const struct cmd *cmd);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int mnl_nft_event_listener(struct mnl_socket *nf_sock, unsigned int debug_mask,
|
|
Packit |
c5a612 |
struct output_ctx *octx,
|
|
Packit |
c5a612 |
int (*cb)(const struct nlmsghdr *nlh, void *data),
|
|
Packit |
c5a612 |
void *cb_data);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
int nft_mnl_talk(struct netlink_ctx *ctx, const void *data, unsigned int len,
|
|
Packit |
c5a612 |
int (*cb)(const struct nlmsghdr *nlh, void *data),
|
|
Packit |
c5a612 |
void *cb_data);
|
|
Packit |
c5a612 |
|
|
Packit |
c5a612 |
#endif /* _NFTABLES_MNL_H_ */
|