libnl  3.2.3
Extended Match

Modules

 Simple packet data comparison
 Metadata Match
 N-Byte Comparison
 Text Search

Functions

int ematch_parse (void *, char **, struct nl_list_head *)
int rtnl_ematch_parse_expr (const char *expr, char **errp, struct rtnl_ematch_tree **result)
char * rtnl_ematch_offset2txt (uint8_t layer, uint16_t offset, char *buf, size_t len)
char * rtnl_ematch_opnd2txt (uint8_t opnd, char *buf, size_t len)

Module API

int rtnl_ematch_register (struct rtnl_ematch_ops *ops)
 Register ematch module.
struct rtnl_ematch_opsrtnl_ematch_lookup_ops (int kind)
 Lookup ematch module by identification number.
struct rtnl_ematch_opsrtnl_ematch_lookup_ops_by_name (const char *name)
 Lookup ematch module by name.

Match

struct rtnl_ematch * rtnl_ematch_alloc (void)
 Allocate ematch object.
int rtnl_ematch_add_child (struct rtnl_ematch *parent, struct rtnl_ematch *child)
 Add ematch to the end of the parent's list of children.
void rtnl_ematch_unlink (struct rtnl_ematch *ematch)
 Remove ematch from the list of ematches it is linked to.
void rtnl_ematch_free (struct rtnl_ematch *ematch)
int rtnl_ematch_set_ops (struct rtnl_ematch *ematch, struct rtnl_ematch_ops *ops)
int rtnl_ematch_set_kind (struct rtnl_ematch *ematch, uint16_t kind)
int rtnl_ematch_set_name (struct rtnl_ematch *ematch, const char *name)
void rtnl_ematch_set_flags (struct rtnl_ematch *ematch, uint16_t flags)
void rtnl_ematch_unset_flags (struct rtnl_ematch *ematch, uint16_t flags)
uint16_t rtnl_ematch_get_flags (struct rtnl_ematch *ematch)
void * rtnl_ematch_data (struct rtnl_ematch *ematch)

Tree

struct rtnl_ematch_tree * rtnl_ematch_tree_alloc (uint16_t progid)
 Allocate ematch tree object.
void rtnl_ematch_tree_free (struct rtnl_ematch_tree *tree)
 Free ematch tree object.
void rtnl_ematch_tree_add (struct rtnl_ematch_tree *tree, struct rtnl_ematch *ematch)
 Add ematch object to the end of the ematch tree.
int rtnl_ematch_parse_attr (struct nlattr *attr, struct rtnl_ematch_tree **result)
 Parse ematch netlink attributes.
void rtnl_ematch_tree_dump (struct rtnl_ematch_tree *tree, struct nl_dump_params *p)
int rtnl_ematch_fill_attr (struct nl_msg *msg, int attrid, struct rtnl_ematch_tree *tree)

Function Documentation

int rtnl_ematch_register ( struct rtnl_ematch_ops ops)

Register ematch module.

Parameters:
opsModule operations.

This function must be called by each ematch module at initialization time. It registers the calling module as available module.

Returns:
0 on success or a negative error code.

Definition at line 45 of file ematch.c.

References rtnl_ematch_lookup_ops().

+ Here is the call graph for this function:

struct rtnl_ematch_ops* rtnl_ematch_lookup_ops ( int  kind) [read]

Lookup ematch module by identification number.

Parameters:
kindModule kind.

Searches the list of registered ematch modules for match and returns it.

Returns:
Module operations or NULL if not found.

Definition at line 65 of file ematch.c.

Referenced by rtnl_ematch_parse_attr(), and rtnl_ematch_register().

+ Here is the caller graph for this function:

struct rtnl_ematch_ops* rtnl_ematch_lookup_ops_by_name ( const char *  name) [read]

Lookup ematch module by name.

Parameters:
nameName of ematch module.

Searches the list of registered ematch modules for a match and returns it.

Returns:
Module operations or NULL if not fuond.

Definition at line 84 of file ematch.c.

struct rtnl_ematch* rtnl_ematch_alloc ( void  ) [read]

Allocate ematch object.

Allocates and initializes an ematch object.

Returns:
New ematch object or NULL.

Definition at line 108 of file ematch.c.

Referenced by rtnl_ematch_parse_attr().

+ Here is the caller graph for this function:

int rtnl_ematch_add_child ( struct rtnl_ematch *  parent,
struct rtnl_ematch *  child 
)

Add ematch to the end of the parent's list of children.

Parameters:
parentparent ematch object
childematch object to be added to parent

The parent must be a container ematch.

Definition at line 130 of file ematch.c.

void rtnl_ematch_unlink ( struct rtnl_ematch *  ematch)

Remove ematch from the list of ematches it is linked to.

Parameters:
ematchematch object

Definition at line 148 of file ematch.c.

struct rtnl_ematch_tree* rtnl_ematch_tree_alloc ( uint16_t  progid) [read]

Allocate ematch tree object.

Parameters:
progidprogram id

Definition at line 247 of file ematch.c.

Referenced by rtnl_ematch_parse_attr().

+ Here is the caller graph for this function:

void rtnl_ematch_tree_free ( struct rtnl_ematch_tree *  tree)

Free ematch tree object.

Parameters:
treeematch tree object

This function frees the ematch tree and all ematches attached to it.

Definition at line 279 of file ematch.c.

Referenced by rtnl_ematch_parse_attr().

+ Here is the caller graph for this function:

void rtnl_ematch_tree_add ( struct rtnl_ematch_tree *  tree,
struct rtnl_ematch *  ematch 
)

Add ematch object to the end of the ematch tree.

Parameters:
treeematch tree object
ematchematch object to add

Definition at line 295 of file ematch.c.

int rtnl_ematch_parse_attr ( struct nlattr *  attr,
struct rtnl_ematch_tree **  result 
)

Parse ematch netlink attributes.

Returns:
0 on success or a negative error code.

Definition at line 339 of file ematch.c.

References nla_data(), nla_for_each_nested, nla_len(), nla_parse_nested(), nla_total_size(), rtnl_ematch_alloc(), rtnl_ematch_lookup_ops(), rtnl_ematch_tree_alloc(), and rtnl_ematch_tree_free().

+ Here is the call graph for this function: