NetBurner 3.1
arp.h
Go to the documentation of this file.
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef _NB_ARP_H
6 #define _NB_ARP_H
7 
17 #include <buffers.h>
18 #include <nettypes.h>
19 #include <stdio.h>
20 
21 /*
22  ******************************************************************************
23  *
24  * Runtime Libraries Routine Prototypes
25  *
26  ******************************************************************************
27  */
28 
34 void ShowArp();
35 
43 void fShowArp(FILE *fp);
44 
58 BOOL GetArpMacFromIp(IPADDR4 ip, MACADR &ma);
59 
71 void sendGratuitousArp(int interfaceNumber, IPADDR4 ip);
72 
73 /*INTERNAL FUNCTIONS */
74 void processArp(PoolPtr p, PEFRAME pF);
75 
76 void AddCheckArp(MACADR *ma, IPADDR4 ip, int ifnum);
77 void DeleteArpFromIp(IPADDR4 ip);
78 
79 void RouteOut(PEFRAME pf, IPADDR4 ip, PoolPtr p);
80 void RouteOutVia(PEFRAME pf, IPADDR4 ipfrom, IPADDR4 ipto, PoolPtr p, int intf);
81 
82 void AgeArp();
83 void AddStaticArp(MACADR *ma, IPADDR ip, int ifnum);
84 
85 void InitializeArp();
86 
87 BOOL IsMyAddressUsedArpDetect(uint16_t timeout, int interface = 0);
88 
89 int GetProperInterface4(IPADDR4 dst);
90 
91 /*******************************************************************************
92  *
93  * Data Structures
94  *
95  *******************************************************************************/
96 
97 /*******************************************************************************
98 
99  Address Resolution Protocol (ARP) Packet Structure
100 
101  hard_Type - Hardware type (HTYPE)
102  prot_Type - Protocol type (PTYPE)
103  hard_size - Hardware length (HLEN)
104 
105  theMac - Interface ethernet MAC address
106  Notes:
107  Should not change data sizes and always add to the end to avoid breaking
108  use for interface configuration.
109 
110  *******************************************************************************/
111 typedef struct
112 {
113  beuint16_t hard_Type;
114  beuint16_t prot_Type;
115  uint8_t hard_size;
116  uint8_t prot_size;
117  beuint16_t op_code;
118  MACADR sender_phy;
119  IPADDR4 sender_Ip;
120  MACADR target_phy;
121  IPADDR4 target_Ip;
122 } __attribute__((packed)) ARP;
123 
124 typedef ARP *PARP;
125 
126 #endif
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition: ipv6_addr.h:28
void ShowArp()
Display ARP cache, output will be the stdio serial port.
Definition: arp.cpp:409
void fShowArp(FILE *fp)
Display ARP cache, output will be sent to the specified file pointer.
Definition: arp.cpp:393
NetBurner Buffers API.
BOOL GetArpMacFromIp(IPADDR4 ip, MACADR &ma)
Check to see if the specified IP address is in the ARP cache.
Definition: arp.cpp:971
void sendGratuitousArp(int interfaceNumber, IPADDR4 ip)
Send Gratuitous ARP Request.
Definition: arp.cpp:604