summaryrefslogtreecommitdiffstats
path: root/include/libnftables/ruleset.h
blob: 1ec3059f122d2dba18174603d554a376eb2358e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef _LIBNFTABLES_RULESET_H_
#define _LIBNFTABLES_RULESET_H_

#include <stdio.h>

#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>

#include <libnftables/common.h>

#ifdef __cplusplus
extern "C" {
#endif

struct nft_ruleset;

struct nft_ruleset *nft_ruleset_alloc(void);
void nft_ruleset_free(struct nft_ruleset *r);

enum {
	NFT_RULESET_ATTR_TABLELIST = 0,
	NFT_RULESET_ATTR_CHAINLIST,
	NFT_RULESET_ATTR_SETLIST,
	NFT_RULESET_ATTR_RULELIST,
};

bool nft_ruleset_attr_is_set(const struct nft_ruleset *r, uint16_t attr);
void nft_ruleset_attr_unset(struct nft_ruleset *r, uint16_t attr);
void nft_ruleset_attr_set(struct nft_ruleset *r, uint16_t attr, void *data);
const void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr);

int nft_ruleset_parse(struct nft_ruleset *rs, enum nft_parse_type type, const char *data);
int nft_ruleset_snprintf(char *buf, size_t size, const struct nft_ruleset *rs, uint32_t type, uint32_t flags);
int nft_ruleset_fprintf(FILE *fp, const struct nft_ruleset *rs, uint32_t type, uint32_t flags);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* _LIBNFTABLES_RULESET_H_ */