CNDP  22.08.0
cnet_arp.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2016-2022 Intel Corporation
3  */
4 
5 #ifndef __CNET_ARP_H
6 #define __CNET_ARP_H
7 
13 #include <cnet/cnet.h>
14 #include <net/cne_arp.h>
15 #include <net/cne_ip.h>
16 #include <net/ethernet.h> // for ether_addr
17 #include <stdint.h> // for uint8_t, uint16_t
18 
19 #include "cne_inet.h" // for _in_addr
20 #include "pktmbuf.h" // for pktmbuf_t
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 enum {
27  ARP_NEXT_INDEX_SHIFT = 24,
28  ARP_FIB_MAX_ENTRIES = (1UL << ARP_NEXT_INDEX_SHIFT),
29  ARP_FIB_DEFAULT_ENTRIES = 1024,
30  ARP_FIB_DEFAULT_NUM_TBL8S = (1 << 8),
31 };
32 
33 /* arp_entry.flags */
34 enum {
35  ARP_STATIC_FLAG = 0x01,
36  ARP_SEND_GRATUITOUS = 0x02
37 };
38 
39 /* ARP table format */
40 struct arp_entry {
41  uint16_t flags;
42  uint16_t netif_idx;
43  struct in_addr pa;
44  struct ether_addr ha;
45 };
46 
53 CNDP_API struct arp_entry *cnet_arp_alloc(void);
54 
61 CNDP_API void cnet_arp_free(struct arp_entry *entry);
62 
75 CNDP_API int cnet_arp_create(struct cnet *_cnet, uint32_t num_entries, uint32_t num_tbl8s);
76 
85 CNDP_API int cnet_arp_destroy(struct cnet *cnet);
86 
101 CNDP_API struct arp_entry *cnet_arp_add(int netif_idx, struct in_addr *addr, struct ether_addr *mac,
102  int perm);
103 
112 CNDP_API int cnet_arp_delete(struct in_addr *addr);
113 
120 CNDP_API int cnet_arp_show(void);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* __CNET_ARP_H */
CNDP_API struct arp_entry * cnet_arp_alloc(void)
CNDP_API void cnet_arp_free(struct arp_entry *entry)
CNDP_API struct arp_entry * cnet_arp_add(int netif_idx, struct in_addr *addr, struct ether_addr *mac, int perm)
CNDP_API int cnet_arp_create(struct cnet *_cnet, uint32_t num_entries, uint32_t num_tbl8s)
CNDP_API int cnet_arp_show(void)
CNDP_API int cnet_arp_destroy(struct cnet *cnet)
@ ARP_SEND_GRATUITOUS
Definition: cnet_arp.h:36
@ ARP_STATIC_FLAG
Definition: cnet_arp.h:35
CNDP_API int cnet_arp_delete(struct in_addr *addr)