CNDP  22.08.0
cnet_route4.h File Reference
#include <net/ethernet.h>
#include <stdint.h>
#include <sys/queue.h>
#include "cne_common.h"
#include "cnet_const.h"
#include "cne_inet.h"
#include "cnet_stk.h"
#include "cnet_route.h"

Go to the source code of this file.

Functions

CNDP_API int cnet_route4_create (struct cnet *cnet, uint32_t num_rules, uint32_t num_tbl8s)
 Create a IPv4 route instance. More...
 
CNDP_API int cnet_route4_destroy (struct cnet *cnet)
 Destroy the IPv4 routing instance. More...
 
CNDP_API struct rt4_entry * cnet_route4_alloc (void)
 Allocate a IPv4 route entry. More...
 
CNDP_API int cnet_route4_alloc_bulk (struct rt4_entry **rt, int n)
 Allocate a number of IPv4 route entries. More...
 
CNDP_API void cnet_route4_free (struct rt4_entry *entry)
 Free a IPv4 route entry. More...
 
CNDP_API void cnet_route4_free_bulk (struct rt4_entry **entry, int n)
 Free a bulk of IPv4 route entries. More...
 
CNDP_API void cne_route4_timer (void)
 Enable a IPv4 route entry timer to age entries. More...
 
CNDP_API int cne_route4_notify (void)
 Routine to call when a route notification is received. More...
 
CNDP_API int cnet_route4_insert (int netif_idx, struct in_addr *dst, struct in_addr *netmask, struct in_addr *gate, uint8_t metric, uint16_t timo)
 Insert IPv4 route into the routing table. More...
 
CNDP_API int cnet_route4_delete (struct in_addr *ipaddr)
 Delete a IPv4 route entry. More...
 
CNDP_API int cnet_route4_get_bulk (uint64_t *nh, struct rt4_entry **rt, int n)
 Get a bulk of route entries using the nexthop index values. More...
 
CNDP_API struct rt4_entry * cnet_route4_get (uint64_t nh)
 Return a single route entry given the nexthop index value. More...
 
CNDP_API int cnet_route4_show (void)
 Display the IPvr route entries. More...
 

Detailed Description

CNET Route routines and constants for IPv4.

Definition in file cnet_route4.h.

Function Documentation

◆ cnet_route4_create()

CNDP_API int cnet_route4_create ( struct cnet *  cnet,
uint32_t  num_rules,
uint32_t  num_tbl8s 
)

Create a IPv4 route instance.

Parameters
cnetThe cnet pointer to use for creating the routing structure.
num_rulesThe total number of rules or routes to support. If zero use default RT4_DEFAULT_NUM_RULES
num_tbl8sNumber of TBL8 entries in the FIB table to use. If zero use default RT4_DEFAULT_NUM_TBL8S
Returns
-1 on error or 0 on success.

◆ cnet_route4_destroy()

CNDP_API int cnet_route4_destroy ( struct cnet *  cnet)

Destroy the IPv4 routing instance.

Parameters
cnetThe cnet pointer to use for creating the routing structure.
Returns
-1 on error or 0 on success.

◆ cnet_route4_alloc()

CNDP_API struct rt4_entry* cnet_route4_alloc ( void  )

Allocate a IPv4 route entry.

Returns
NULL on error or pointer to struct rt4_entry.

◆ cnet_route4_alloc_bulk()

CNDP_API int cnet_route4_alloc_bulk ( struct rt4_entry **  rt,
int  n 
)

Allocate a number of IPv4 route entries.

Parameters
rtThe pointer array to use for creating the number of entries.
nThe number of entries to allocate.
Returns
-1 on error or 0 on success.

◆ cnet_route4_free()

CNDP_API void cnet_route4_free ( struct rt4_entry *  entry)

Free a IPv4 route entry.

Parameters
entryThe route entry to free.
Returns
N/A

◆ cnet_route4_free_bulk()

CNDP_API void cnet_route4_free_bulk ( struct rt4_entry **  entry,
int  n 
)

Free a bulk of IPv4 route entries.

Parameters
entryThe array of pointer to free route entries
nThe number or route entries to free.
Returns
N/A

◆ cne_route4_timer()

CNDP_API void cne_route4_timer ( void  )

Enable a IPv4 route entry timer to age entries.

Returns
N/A

◆ cne_route4_notify()

CNDP_API int cne_route4_notify ( void  )

Routine to call when a route notification is received.

Returns
-1 on error or 0 on success.

◆ cnet_route4_insert()

CNDP_API int cnet_route4_insert ( int  netif_idx,
struct in_addr *  dst,
struct in_addr *  netmask,
struct in_addr *  gate,
uint8_t  metric,
uint16_t  timo 
)

Insert IPv4 route into the routing table.

Parameters
netif_idxThe netif index to insert into the routing table.
dstThe destination IPv4 address to insert into the routing table.
netmaskThe destination IPv4 netmask.
gateThe destination IPv4 gateway address.
metricThe destination IPv4 metric.
timoThe destination IPv4 route timeout.
Returns
-1 on error or 0 on success.

◆ cnet_route4_delete()

CNDP_API int cnet_route4_delete ( struct in_addr *  ipaddr)

Delete a IPv4 route entry.

Parameters
ipaddrThe IPv4 destination address to delete.
Returns
-1 on error or 0 on success.

◆ cnet_route4_get_bulk()

CNDP_API int cnet_route4_get_bulk ( uint64_t *  nh,
struct rt4_entry **  rt,
int  n 
)

Get a bulk of route entries using the nexthop index values.

Parameters
nhThe array of nexthop index values to find the route entries
rtThe array to return the route entry pointers.
nThe number of nexthop and route entries to return.
Returns
-1 on error or 0 on success.

◆ cnet_route4_get()

CNDP_API struct rt4_entry* cnet_route4_get ( uint64_t  nh)

Return a single route entry given the nexthop index value.

Parameters
nhThe nexthop index value to be used to return the route entry.
Returns
NULL on error or pointer to found route entry

◆ cnet_route4_show()

CNDP_API int cnet_route4_show ( void  )

Display the IPvr route entries.

Returns
-1 on error or 0 on success.