libnl 3.7.0

Modules

 Metadata Match
 
 N-Byte Comparison
 
 Simple packet data 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)
 

Tree

struct rtnl_ematch_tree * rtnl_ematch_tree_alloc (uint16_t progid)
 Allocate ematch tree object. More...
 
void rtnl_ematch_tree_free (struct rtnl_ematch_tree *tree)
 Free ematch tree object. More...
 
struct rtnl_ematch_tree * rtnl_ematch_tree_clone (struct rtnl_ematch_tree *src)
 Clone ematch tree object. More...
 
void rtnl_ematch_tree_add (struct rtnl_ematch_tree *tree, struct rtnl_ematch *ematch)
 Add ematch object to the end of the ematch tree. More...
 
int rtnl_ematch_parse_attr (struct nlattr *attr, struct rtnl_ematch_tree **result)
 Parse ematch netlink attributes. More...
 
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)
 

Module API

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

Match

struct rtnl_ematch * rtnl_ematch_alloc (void)
 Allocate ematch object. More...
 
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. More...
 
void rtnl_ematch_unlink (struct rtnl_ematch *ematch)
 Remove ematch from the list of ematches it is linked to. More...
 
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)
 

Detailed Description

Function Documentation

◆ rtnl_ematch_register()

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 40 of file ematch.c.

References rtnl_ematch_lookup_ops().

+ Here is the call graph for this function:

◆ rtnl_ematch_lookup_ops()

struct rtnl_ematch_ops * rtnl_ematch_lookup_ops ( int  kind)

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 60 of file ematch.c.

Referenced by rtnl_ematch_parse_attr(), and rtnl_ematch_register().

+ Here is the caller graph for this function:

◆ rtnl_ematch_lookup_ops_by_name()

struct rtnl_ematch_ops * rtnl_ematch_lookup_ops_by_name ( const char *  name)

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 79 of file ematch.c.

◆ rtnl_ematch_alloc()

struct rtnl_ematch * rtnl_ematch_alloc ( void  )

Allocate ematch object.

Allocates and initializes an ematch object.

Returns
New ematch object or NULL.

Definition at line 103 of file ematch.c.

Referenced by rtnl_ematch_parse_attr().

+ Here is the caller graph for this function:

◆ rtnl_ematch_add_child()

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 125 of file ematch.c.

◆ rtnl_ematch_unlink()

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 143 of file ematch.c.

◆ rtnl_ematch_free()

void rtnl_ematch_free ( struct rtnl_ematch *  ematch)

Definition at line 155 of file ematch.c.

◆ rtnl_ematch_set_ops()

int rtnl_ematch_set_ops ( struct rtnl_ematch *  ematch,
struct rtnl_ematch_ops ops 
)

Definition at line 163 of file ematch.c.

◆ rtnl_ematch_set_kind()

int rtnl_ematch_set_kind ( struct rtnl_ematch *  ematch,
uint16_t  kind 
)

Definition at line 182 of file ematch.c.

◆ rtnl_ematch_set_name()

int rtnl_ematch_set_name ( struct rtnl_ematch *  ematch,
const char *  name 
)

Definition at line 197 of file ematch.c.

◆ rtnl_ematch_set_flags()

void rtnl_ematch_set_flags ( struct rtnl_ematch *  ematch,
uint16_t  flags 
)

Definition at line 212 of file ematch.c.

◆ rtnl_ematch_unset_flags()

void rtnl_ematch_unset_flags ( struct rtnl_ematch *  ematch,
uint16_t  flags 
)

Definition at line 217 of file ematch.c.

◆ rtnl_ematch_get_flags()

uint16_t rtnl_ematch_get_flags ( struct rtnl_ematch *  ematch)

Definition at line 222 of file ematch.c.

◆ rtnl_ematch_data()

void * rtnl_ematch_data ( struct rtnl_ematch *  ematch)

Definition at line 227 of file ematch.c.

◆ rtnl_ematch_tree_alloc()

struct rtnl_ematch_tree * rtnl_ematch_tree_alloc ( uint16_t  progid)

Allocate ematch tree object.

Parameters
progidprogram id

Definition at line 242 of file ematch.c.

Referenced by rtnl_ematch_parse_attr(), and rtnl_ematch_tree_clone().

+ Here is the caller graph for this function:

◆ rtnl_ematch_tree_free()

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 274 of file ematch.c.

Referenced by rtnl_ematch_parse_attr().

+ Here is the caller graph for this function:

◆ rtnl_ematch_tree_clone()

struct rtnl_ematch_tree * rtnl_ematch_tree_clone ( struct rtnl_ematch_tree *  src)

Clone ematch tree object.

Parameters
srcematch tree object

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

Definition at line 328 of file ematch.c.

References rtnl_ematch_tree_alloc().

+ Here is the call graph for this function:

◆ rtnl_ematch_tree_add()

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 348 of file ematch.c.

◆ rtnl_ematch_parse_attr()

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 392 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:

◆ rtnl_ematch_tree_dump()

void rtnl_ematch_tree_dump ( struct rtnl_ematch_tree *  tree,
struct nl_dump_params p 
)

Definition at line 563 of file ematch.c.

◆ rtnl_ematch_fill_attr()

int rtnl_ematch_fill_attr ( struct nl_msg *  msg,
int  attrid,
struct rtnl_ematch_tree *  tree 
)

Definition at line 642 of file ematch.c.

◆ rtnl_ematch_parse_expr()

int rtnl_ematch_parse_expr ( const char *  expr,
char **  errp,
struct rtnl_ematch_tree **  result 
)

Definition at line 683 of file ematch.c.

◆ rtnl_ematch_offset2txt()

char * rtnl_ematch_offset2txt ( uint8_t  layer,
uint16_t  offset,
char *  buf,
size_t  len 
)

Definition at line 729 of file ematch.c.

◆ rtnl_ematch_opnd2txt()

char * rtnl_ematch_opnd2txt ( uint8_t  opnd,
char *  buf,
size_t  len 
)

Definition at line 744 of file ematch.c.