CNDP  22.08.0
cnet.h File Reference
#include <cne_version.h>
#include <cne_log.h>
#include <cne_per_thread.h>
#include <cne_cycles.h>
#include <cnet_const.h>
#include <cne_atomic.h>
#include <stdint.h>
#include <cne_common.h>
#include <uid.h>

Go to the source code of this file.

Enumerations

enum  { CNET_PUNT_ENABLED = 0x0001 , CNET_TCP_ENABLED = 0x0002 }
 

Functions

struct cnet * cnet_get (void)
 Get the current cnet structure pointer. More...
 
CNDP_API int cnet_lock (void)
 Lock the cnet structure. More...
 
CNDP_API void cnet_unlock (void)
 Lock the cnet structure data. More...
 
CNDP_API int cnet_preload (char **libs, int cnt, int flag)
 preload shared libraries for CNDP and CNET. More...
 
CNDP_API struct cnet * cnet_config_create (uint32_t num_chnls, uint32_t num_routes)
 Configure and create the base cnet structure using a couple params. More...
 
CNDP_API struct cnet * cnet_create (void)
 Create cnet structure and use default value, will call cnet_config_create(). More...
 
CNDP_API void cnet_stop (void)
 Stop and free resources of the cnet structure. More...
 
CNDP_API void cnet_dump (void)
 Dump out the CNET structure information. More...
 
CNDP_API int cnet_add_cli_cmds (void)
 Called to initialize the CLI commands for the CNET structure. More...
 

Detailed Description

CNET configuration routines.

Definition in file cnet.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CNET_PUNT_ENABLED 

Enable Punting packets to Linux stack

CNET_TCP_ENABLED 

Enable TCP packet processing

Definition at line 54 of file cnet.h.

Function Documentation

◆ cnet_get()

struct cnet* cnet_get ( void  )

Get the current cnet structure pointer.

Returns
Pointer to struct cnet* or NULL on error.

◆ cnet_lock()

CNDP_API int cnet_lock ( void  )

Lock the cnet structure.

Returns
0 on error or 1 on success

◆ cnet_unlock()

CNDP_API void cnet_unlock ( void  )

Lock the cnet structure data.

Returns
N/A

◆ cnet_preload()

CNDP_API int cnet_preload ( char **  libs,
int  cnt,
int  flag 
)

preload shared libraries for CNDP and CNET.

Parameters
libsAn array of shared library names or directories to load into memory.
cntThe number of entries in the libs array.
flagThe flag values to be used when loading the libraries.
Returns
-1 on error or 0 on success

◆ cnet_config_create()

CNDP_API struct cnet* cnet_config_create ( uint32_t  num_chnls,
uint32_t  num_routes 
)

Configure and create the base cnet structure using a couple params.

Parameters
num_chnlsThe number of channels allowed in the system. If zero use the default value.
num_routesThe number of routes to allowed in the system. If zero use the default value.
Returns
NULL on failure or pointer to cnet structure created.

◆ cnet_create()

CNDP_API struct cnet* cnet_create ( void  )

Create cnet structure and use default value, will call cnet_config_create().

Returns
NULL on failure or pointer to cnet structure created.
Examples
examples/cnet-graph/cnet-graph.c, and examples/cnet-quic/cnet-quic.c.

◆ cnet_stop()

CNDP_API void cnet_stop ( void  )

Stop and free resources of the cnet structure.

Returns
N/A
Examples
examples/cnet-graph/cnet-graph.c, and examples/cnet-quic/cnet-quic.c.

◆ cnet_dump()

CNDP_API void cnet_dump ( void  )

Dump out the CNET structure information.

Returns
N/A

◆ cnet_add_cli_cmds()

CNDP_API int cnet_add_cli_cmds ( void  )

Called to initialize the CLI commands for the CNET structure.

Returns
-1 on failure or 0 on success
Examples
examples/cnet-graph/cnet-graph.c, and examples/cnet-quic/cnet-quic.c.