libnl: /data/src/libnl3/include/netlink/route/cls/ematch.h Source File

libnl 3.10.0

ematch.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch>
4 */
5
6#ifndef NETLINK_CLS_EMATCH_H_
7#define NETLINK_CLS_EMATCH_H_
8
9#include <netlink/netlink.h>
10#include <netlink/msg.h>
11#include <netlink/route/classifier.h>
12#include <linux/pkt_cls.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/* FIXME: Should be moved to the kernel header at some point */
19#define RTNL_EMATCH_PROGID 2
20
21struct rtnl_ematch;
22struct rtnl_ematch_tree;
23
24/**
25 * Extended Match Operations
26 */
27 struct rtnl_ematch_ops
28{
29 int eo_kind;
30 const char * eo_name;
31 size_t eo_minlen;
32 size_t eo_datalen;
33
34 int (*eo_parse)(struct rtnl_ematch *, void *, size_t);
35 void (*eo_dump)(struct rtnl_ematch *,
36 struct nl_dump_params *);
37 int (*eo_fill)(struct rtnl_ematch *, struct nl_msg *);
38 void (*eo_free)(struct rtnl_ematch *);
39 struct nl_list_head eo_list;
40};
41
42extern int rtnl_ematch_register(struct rtnl_ematch_ops *);
43extern struct rtnl_ematch_ops * rtnl_ematch_lookup_ops(int);
44extern struct rtnl_ematch_ops * rtnl_ematch_lookup_ops_by_name(const char *);
45
46extern struct rtnl_ematch * rtnl_ematch_alloc(void);
47extern int rtnl_ematch_add_child(struct rtnl_ematch *,
48 struct rtnl_ematch *);
49extern void rtnl_ematch_unlink(struct rtnl_ematch *);
50extern void rtnl_ematch_free(struct rtnl_ematch *);
51
52extern void * rtnl_ematch_data(struct rtnl_ematch *);
53extern void rtnl_ematch_set_flags(struct rtnl_ematch *,
54 uint16_t);
55extern void rtnl_ematch_unset_flags(struct rtnl_ematch *,
56 uint16_t);
57extern uint16_t rtnl_ematch_get_flags(struct rtnl_ematch *);
58extern int rtnl_ematch_set_ops(struct rtnl_ematch *,
59 struct rtnl_ematch_ops *);
60extern int rtnl_ematch_set_kind(struct rtnl_ematch *,
61 uint16_t);
62extern int rtnl_ematch_set_name(struct rtnl_ematch *,
63 const char *);
64
65extern struct rtnl_ematch_tree *rtnl_ematch_tree_alloc(uint16_t);
66extern void rtnl_ematch_tree_free(struct rtnl_ematch_tree *);
67extern void rtnl_ematch_tree_add(struct rtnl_ematch_tree *,
68 struct rtnl_ematch *);
69
70extern struct rtnl_ematch_tree *rtnl_ematch_tree_clone(struct rtnl_ematch_tree *);
71
72extern int rtnl_ematch_parse_attr(struct nlattr *,
73 struct rtnl_ematch_tree **);
74extern int rtnl_ematch_fill_attr(struct nl_msg *, int,
75 struct rtnl_ematch_tree *);
76extern void rtnl_ematch_tree_dump(struct rtnl_ematch_tree *,
77 struct nl_dump_params *);
78
79
80extern int rtnl_ematch_parse_expr(const char *, char **,
81 struct rtnl_ematch_tree **);
82
83extern char * rtnl_ematch_offset2txt(uint8_t, uint16_t,
84 char *, size_t);
85extern char * rtnl_ematch_opnd2txt(uint8_t, char *, size_t);
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif
rtnl_ematch_lookup_ops
struct rtnl_ematch_ops * rtnl_ematch_lookup_ops(int)
Lookup ematch module by identification number.
Definition ematch.c:64
rtnl_ematch_tree_add
void rtnl_ematch_tree_add(struct rtnl_ematch_tree *, struct rtnl_ematch *)
Add ematch object to the end of the ematch tree.
Definition ematch.c:352
rtnl_ematch_tree_free
void rtnl_ematch_tree_free(struct rtnl_ematch_tree *)
Free ematch tree object.
Definition ematch.c:278
rtnl_ematch_tree_alloc
struct rtnl_ematch_tree * rtnl_ematch_tree_alloc(uint16_t)
Allocate ematch tree object.
Definition ematch.c:246
rtnl_ematch_alloc
struct rtnl_ematch * rtnl_ematch_alloc(void)
Allocate ematch object.
Definition ematch.c:107
rtnl_ematch_register
int rtnl_ematch_register(struct rtnl_ematch_ops *)
Register ematch module.
Definition ematch.c:44
rtnl_ematch_parse_attr
int rtnl_ematch_parse_attr(struct nlattr *, struct rtnl_ematch_tree **)
Parse ematch netlink attributes.
Definition ematch.c:396
rtnl_ematch_unlink
void rtnl_ematch_unlink(struct rtnl_ematch *)
Remove ematch from the list of ematches it is linked to.
Definition ematch.c:147
rtnl_ematch_add_child
int rtnl_ematch_add_child(struct rtnl_ematch *, struct rtnl_ematch *)
Add ematch to the end of the parent's list of children.
Definition ematch.c:129
rtnl_ematch_lookup_ops_by_name
struct rtnl_ematch_ops * rtnl_ematch_lookup_ops_by_name(const char *)
Lookup ematch module by name.
Definition ematch.c:83
rtnl_ematch_tree_clone
struct rtnl_ematch_tree * rtnl_ematch_tree_clone(struct rtnl_ematch_tree *)
Clone ematch tree object.
Definition ematch.c:332
nl_dump_params
Dumping parameters.
Definition types.h:32
nl_list_head
Definition list.h:16
rtnl_ematch_ops
Extended Match Operations.
Definition ematch.h:28