CNDP  22.08.0
cnet_protosw.h File Reference
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include "cnet_const.h"

Go to the source code of this file.

Functions

CNDP_API struct protosw_entry * cnet_protosw_add (const char *name, uint16_t domain, uint16_t type, uint16_t proto)
 Add protocol information to the list of protocol switch list. More...
 
CNDP_API struct protosw_entry * cnet_protosw_find (uint16_t domain, uint16_t type, uint16_t proto)
 Find a protocol entry in the protocol switch list. More...
 
CNDP_API void cnet_protosw_dump (struct stk_s *stk)
 Dump out the list of protocol switch values. More...
 
CNDP_API int cnet_ipproto_set (uint8_t ipproto, struct protosw_entry *psw)
 Set the IP proto value in the given protosw_entry pointer. More...
 
CNDP_API struct protosw_entry * cnet_ipproto_get (uint8_t ipproto)
 Get the protosw_entry to locate using the IP proto type. More...
 
CNDP_API struct protosw_entry * cnet_protosw_find_by_proto (uint8_t proto)
 Find a protocol switch entry using the IP proto type. More...
 

Detailed Description

CNET Ptotocol switch routines.

Definition in file cnet_protosw.h.

Function Documentation

◆ cnet_protosw_add()

CNDP_API struct protosw_entry* cnet_protosw_add ( const char *  name,
uint16_t  domain,
uint16_t  type,
uint16_t  proto 
)

Add protocol information to the list of protocol switch list.

Parameters
nameThe number of protocol name to add.
domainThe domain of the protocol to add.
typeThe type of protocol to add.
protoThe proto type value to add.
Returns
NULL on error or a pointer to a protocol switch entry.

◆ cnet_protosw_find()

CNDP_API struct protosw_entry* cnet_protosw_find ( uint16_t  domain,
uint16_t  type,
uint16_t  proto 
)

Find a protocol entry in the protocol switch list.

Parameters
domainThe domain to search for in the list.
typeThe type of protocol.
protoThe proto type value.
Returns
NULL on error or a pointer to a protocol switch entry.

◆ cnet_protosw_dump()

CNDP_API void cnet_protosw_dump ( struct stk_s *  stk)

Dump out the list of protocol switch values.

Parameters
stkThe stack instance to be dumped.
Returns
N/A

◆ cnet_ipproto_set()

CNDP_API int cnet_ipproto_set ( uint8_t  ipproto,
struct protosw_entry *  psw 
)

Set the IP proto value in the given protosw_entry pointer.

Parameters
ipprotoThe IP proto type value to be set in the structure.
pswThe protosw_entry structure pointer.
Returns
-1 on error or 0 on success

◆ cnet_ipproto_get()

CNDP_API struct protosw_entry* cnet_ipproto_get ( uint8_t  ipproto)

Get the protosw_entry to locate using the IP proto type.

Parameters
ipprotoThe IP proto type value to be set in the structure.
Returns
NULL on error or a pointer to a protocol switch entry.

◆ cnet_protosw_find_by_proto()

CNDP_API struct protosw_entry* cnet_protosw_find_by_proto ( uint8_t  proto)

Find a protocol switch entry using the IP proto type.

Parameters
protoThe IP proto type value to be set in the structure.
Returns
NULL on error or a pointer to a protocol switch entry.