-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharp.h
44 lines (40 loc) · 1.62 KB
/
arp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//********************************************************************************************
//
// File : arp.h implement for Address Resolution Protocol
//
//********************************************************************************************
#define ARP_PACKET_LEN 28
#define ARP_OPCODE_REQUEST_V 0x0001
#define ARP_OPCODE_REQUEST_H_V 0x00
#define ARP_OPCODE_REQUEST_L_V 0x01
#define ARP_OPCODE_REPLY_V 0x0002
#define ARP_OPCODE_REPLY_H_V 0x00
#define ARP_OPCODE_REPLY_L_V 0x02
#define ARP_HARDWARE_TYPE_H_V 0x00
#define ARP_HARDWARE_TYPE_L_V 0x01
#define ARP_PROTOCOL_H_V 0x08
#define ARP_PROTOCOL_L_V 0x00
#define ARP_HARDWARE_SIZE_V 0x06
#define ARP_PROTOCOL_SIZE_V 0x04
#define ARP_HARDWARE_TYPE_H_P 0x0E
#define ARP_HARDWARE_TYPE_L_P 0x0F
#define ARP_PROTOCOL_H_P 0x10
#define ARP_PROTOCOL_L_P 0x11
#define ARP_HARDWARE_SIZE_P 0x12
#define ARP_PROTOCOL_SIZE_P 0x13
#define ARP_OPCODE_H_P 0x14
#define ARP_OPCODE_L_P 0x15
#define ARP_SRC_MAC_P 0x16
#define ARP_SRC_IP_P 0x1C
#define ARP_DST_MAC_P 0x20
#define ARP_DST_IP_P 0x26
//********************************************************************************************
//
// Prototype function
//
//********************************************************************************************
extern void arp_generate_packet ( BYTE *rxtx_buffer, BYTE *dest_mac, BYTE *dest_ip );
extern void arp_send_request ( BYTE *rxtx_buffer, BYTE *dest_ip );
extern void arp_send_reply ( BYTE *rxtx_buffer, BYTE *dest_mac );
extern BYTE arp_packet_is_arp ( BYTE *rxtx_buffer, WORD_BYTES opcode );
extern BYTE arp_who_is ( BYTE *rxtx_buffer, BYTE *dest_mac, BYTE *dest_ip );