libnl 3.7.0
Command Line Interface API

These modules provide an interface for text based applications. More...

Modules

 Addresses
 
 Classifiers
 
 Connection Tracking
 
 Expectation Tracking
 
 
 Neighbour
 
 Queueing Disciplines
 
 Routing
 
 Routing Rules
 
 Traffic Classes
 
 Traffic Control
 

Functions

uint32_t nl_cli_parse_u32 (const char *arg)
 Parse a text based 32 bit unsigned integer argument. More...
 
void nl_cli_print_version (void)
 
void nl_cli_fatal (int err, const char *fmt,...)
 Print error message and quit application. More...
 
int nl_cli_connect (struct nl_sock *sk, int protocol)
 
struct nl_sock * nl_cli_alloc_socket (void)
 
struct nl_addr * nl_cli_addr_parse (const char *str, int family)
 
int nl_cli_parse_dumptype (const char *str)
 
int nl_cli_confirm (struct nl_object *obj, struct nl_dump_params *params, int default_yes)
 
struct nl_cache * nl_cli_alloc_cache (struct nl_sock *sock, const char *name, int(*ac)(struct nl_sock *, struct nl_cache **))
 
struct nl_cache * nl_cli_alloc_cache_flags (struct nl_sock *sock, const char *name, unsigned int flags, int(*ac)(struct nl_sock *, struct nl_cache **, unsigned int))
 
void nl_cli_load_module (const char *prefix, const char *name)
 

Detailed Description

These modules provide an interface for text based applications.

The functions provided are wrappers for their libnl equivalent with added error handling. The functions check for allocation failures, invalid input, and unknown types and will print error messages accordingly via nl_cli_fatal().

Function Documentation

◆ nl_cli_parse_u32()

uint32_t nl_cli_parse_u32 ( const char *  arg)

Parse a text based 32 bit unsigned integer argument.

Parameters
argInteger in text form.

Tries to convert the number provided in arg to a uint32_t. Will call nl_cli_fatal() if the conversion fails.

Returns
32bit unsigned integer.

Definition at line 36 of file utils.c.

References nl_cli_fatal().

+ Here is the call graph for this function:

◆ nl_cli_print_version()

void nl_cli_print_version ( void  )

Definition at line 49 of file utils.c.

◆ nl_cli_fatal()

void nl_cli_fatal ( int  err,
const char *  fmt,
  ... 
)

Print error message and quit application.

Parameters
errError code.
fmtError message.

Prints the formatted error message to stderr and quits the application using the provided error code.

Definition at line 71 of file utils.c.

Referenced by nl_cli_parse_u32().

+ Here is the caller graph for this function:

◆ nl_cli_connect()

int nl_cli_connect ( struct nl_sock *  sk,
int  protocol 
)

Definition at line 108 of file utils.c.

◆ nl_cli_alloc_socket()

struct nl_sock * nl_cli_alloc_socket ( void  )

Definition at line 119 of file utils.c.

◆ nl_cli_addr_parse()

struct nl_addr * nl_cli_addr_parse ( const char *  str,
int  family 
)

Definition at line 129 of file utils.c.

◆ nl_cli_parse_dumptype()

int nl_cli_parse_dumptype ( const char *  str)

Definition at line 141 of file utils.c.

◆ nl_cli_confirm()

int nl_cli_confirm ( struct nl_object *  obj,
struct nl_dump_params params,
int  default_yes 
)

Definition at line 155 of file utils.c.

◆ nl_cli_alloc_cache()

struct nl_cache * nl_cli_alloc_cache ( struct nl_sock *  sock,
const char *  name,
int(*)(struct nl_sock *, struct nl_cache **)  ac 
)

Definition at line 189 of file utils.c.

◆ nl_cli_alloc_cache_flags()

struct nl_cache * nl_cli_alloc_cache_flags ( struct nl_sock *  sock,
const char *  name,
unsigned int  flags,
int(*)(struct nl_sock *, struct nl_cache **, unsigned int)  ac 
)

Definition at line 204 of file utils.c.

◆ nl_cli_load_module()

void nl_cli_load_module ( const char *  prefix,
const char *  name 
)

Definition at line 221 of file utils.c.