summaryrefslogtreecommitdiffstats
path: root/include/ct.h
blob: becd09c6e867adfd7942e07235c3ceb842cefcb3 (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
42
#ifndef NFTABLES_CT_H
#define NFTABLES_CT_H

/**
 * struct ct_template
 *
 * @token:	parser token for the expression
 * @dtype:	data type of the expression
 * @len:	length of the expression
 * @byteorder:	byteorder
 */
struct ct_template {
	const char		*token;
	const struct datatype	*dtype;
	enum byteorder		byteorder;
	unsigned int		len;
};

#define CT_TEMPLATE(__token, __dtype, __byteorder, __len) {	\
	.token		= (__token),				\
	.dtype		= (__dtype),				\
	.byteorder	= (__byteorder),			\
	.len		= (__len),				\
}

extern struct expr *ct_expr_alloc(const struct location *loc,
				  enum nft_ct_keys key, int8_t direction);
extern void ct_expr_update_type(struct proto_ctx *ctx, struct expr *expr);

extern struct error_record *ct_dir_parse(const struct location *loc,
					 const char *str, int8_t *dir);
extern struct error_record *ct_key_parse(const struct location *loc, const char *str,
					 unsigned int *key);
extern struct error_record *ct_objtype_parse(const struct location *loc, const char *str, int *type);

extern struct stmt *notrack_stmt_alloc(const struct location *loc);

extern const struct datatype ct_dir_type;
extern const struct datatype ct_state_type;
extern const struct datatype ct_status_type;

#endif /* NFTABLES_CT_H */