libnl: Extended Match

libnl 3.7.0

Modules | Functions
Extended Match
Routing Library (libnl-route) » Traffic Control » Classifiers

## 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_ops * | rtnl_ematch_lookup_ops (int kind)
| Lookup ematch module by identification number. More...
struct rtnl_ematch_ops * | rtnl_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

  ops | Module 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

  kind | Module 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_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

  name | Name 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.

## ◆ 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

  parent | parent ematch object
  child | ematch 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

  ematch | ematch object

Definition at line 143 of file ematch.c.

## ◆ rtnl_ematch_tree_alloc()

struct rtnl_ematch_tree* rtnl_ematch_tree_alloc | ( | uint16_t | progid | ) |

Allocate ematch tree object.

Parameters

  progid | program id

Definition at line 242 of file ematch.c.

Referenced by 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

  tree | ematch tree object

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

Definition at line 274 of file ematch.c.

## ◆ rtnl_ematch_tree_clone()

struct rtnl_ematch_tree* rtnl_ematch_tree_clone | ( | struct rtnl_ematch_tree * | src | ) |

Clone ematch tree object.

Parameters

  src | ematch 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

  tree | ematch tree object
  ematch | ematch 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_parse_nested().

Here is the call graph for this function: