| 1 |
#ifndef _EXPR_OPS_H_ |
| 2 |
#define _EXPR_OPS_H_ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
#include "internal.h" |
| 6 |
|
| 7 |
struct nlattr; |
| 8 |
struct nlmsghdr; |
| 9 |
struct nftnl_expr; |
| 10 |
|
| 11 |
struct attr_policy { |
| 12 |
uint32_t maxlen; |
| 13 |
}; |
| 14 |
|
| 15 |
struct expr_ops { |
| 16 |
const char *name; |
| 17 |
uint32_t alloc_len; |
| 18 |
int nftnl_max_attr; |
| 19 |
struct attr_policy *attr_policy; |
| 20 |
void (*init)(const struct nftnl_expr *e); |
| 21 |
void (*free)(const struct nftnl_expr *e); |
| 22 |
int (*set)(struct nftnl_expr *e, uint16_t type, const void *data, uint32_t data_len); |
| 23 |
const void *(*get)(const struct nftnl_expr *e, uint16_t type, uint32_t *data_len); |
| 24 |
int (*parse)(struct nftnl_expr *e, struct nlattr *attr); |
| 25 |
void (*build)(struct nlmsghdr *nlh, const struct nftnl_expr *e); |
| 26 |
int (*output)(char *buf, size_t len, uint32_t flags, const struct nftnl_expr *e); |
| 27 |
}; |
| 28 |
|
| 29 |
struct expr_ops *nftnl_expr_ops_lookup(const char *name); |
| 30 |
|
| 31 |
#define nftnl_expr_data(ops) (void *)ops->data |
| 32 |
|
| 33 |
#endif |