CNDP  22.08.0
cli_map.h File Reference
#include <netinet/in.h>
#include <cne_common.h>

Go to the source code of this file.

Functions

CNDP_API struct cli_map * cli_mapping (struct cli_map *maps, int argc, char **argv)
 
CNDP_API void cli_map_show (struct cli_map *m)
 
CNDP_API void cli_maps_show (struct cli_map *maps, int argc, char **argv)
 
CNDP_API void cli_map_dump (struct cli_map *maps, int argc, char **argv)
 
CNDP_API int cli_map_list_search (const char *fmt, char *item, int index)
 

Detailed Description

String-related functions as replacement for libc equivalents

Definition in file cli_map.h.

Function Documentation

◆ cli_mapping()

CNDP_API struct cli_map* cli_mapping ( struct cli_map *  maps,
int  argc,
char **  argv 
)

Parse a string argv looking for matching mapping.

Parameters
mapsArray string points with mapping formats using a special % formats d - decimal number 32bit D - decimal number 64bit h - hexadecimal number 32 bit number H - hexadecimal number 64 bit number P - Portlist C - Corelist s - string m - MAC address format %4 - IPv4 address %6 - IPv6 address k - kvargs list of <key>=<value>[,...] strings l - list format, if constains space then quote the string first %|<fixed-list> - Fixed list of valid strings
argcNumber of arguments in argv
argvArray of command line string pointers
Returns
return pointer map entry or NULL if not found

◆ cli_map_show()

CNDP_API void cli_map_show ( struct cli_map *  m)

Dump out the map entry

Parameters
mThe cli_map structure pointer
Returns
None

◆ cli_maps_show()

CNDP_API void cli_maps_show ( struct cli_map *  maps,
int  argc,
char **  argv 
)

Show the map table entries

Parameters
mapsThe cli_map structure pointer
argcNumber of arguments in argv
argvArray of command line string pointers
Returns
None

◆ cli_map_dump()

CNDP_API void cli_map_dump ( struct cli_map *  maps,
int  argc,
char **  argv 
)

Dump out the map table entry matching the argc/argv

Parameters
mapsThe cli_map structure pointer
argcNumber of argumemts
argvList of argument strings
Returns
None

◆ cli_map_list_search()

CNDP_API int cli_map_list_search ( const char *  fmt,
char *  item,
int  index 
)

Determine index value for the list item

Parameters
fmtcli_map format string
itempointer to the item to search for in the list.
indexvalue for which list in format string to scan
Returns
-1 on error or index into list selections.