3 |
* Address Resolution Protocol module for IP over Ethernet |
* Address Resolution Protocol module for IP over Ethernet |
4 |
* |
* |
5 |
* $Log$ |
* $Log$ |
6 |
|
* Revision 1.4 2002/11/08 12:54:43 proff_fs |
7 |
|
* Added includeds for bpstruct and epstruct. |
8 |
|
* Ports should update from using PACK_STRUCT_BEGIN and PACK_STRUCT_END to use these includes. |
9 |
|
* Maybe there should be an PACK_STRUCT_USE_INCLUDES ifdef around these, for ports for which PACK_STRUCT_BEGIN and PACK_STRUCT_END works nicely. |
10 |
|
* |
11 |
* Revision 1.3 2002/11/06 11:43:21 likewise |
* Revision 1.3 2002/11/06 11:43:21 likewise |
12 |
* find_arp_entry() returned 0 instead of ARP_TABLE_SIZE if full pending cache (bug #1625). |
* find_arp_entry() returned 0 instead of ARP_TABLE_SIZE if full pending cache (bug #1625). |
13 |
* |
* |
69 |
#define ARP_REPLY 2 |
#define ARP_REPLY 2 |
70 |
|
|
71 |
/* MUST be compiled with "pack structs" or equivalent! */ |
/* MUST be compiled with "pack structs" or equivalent! */ |
72 |
|
#include "arch/bpstruct.h" |
73 |
PACK_STRUCT_BEGIN |
PACK_STRUCT_BEGIN |
74 |
struct etharp_hdr { |
struct etharp_hdr { |
75 |
PACK_STRUCT_FIELD(struct eth_hdr ethhdr); |
PACK_STRUCT_FIELD(struct eth_hdr ethhdr); |
83 |
PACK_STRUCT_FIELD(struct ip_addr dipaddr); |
PACK_STRUCT_FIELD(struct ip_addr dipaddr); |
84 |
} PACK_STRUCT_STRUCT; |
} PACK_STRUCT_STRUCT; |
85 |
PACK_STRUCT_END |
PACK_STRUCT_END |
86 |
|
#include "arch/epstruct.h" |
87 |
|
|
88 |
#define ARPH_HWLEN(hdr) (NTOHS((hdr)->_hwlen_protolen) >> 8) |
#define ARPH_HWLEN(hdr) (NTOHS((hdr)->_hwlen_protolen) >> 8) |
89 |
#define ARPH_PROTOLEN(hdr) (NTOHS((hdr)->_hwlen_protolen) & 0xff) |
#define ARPH_PROTOLEN(hdr) (NTOHS((hdr)->_hwlen_protolen) & 0xff) |
92 |
#define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8)) |
#define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8)) |
93 |
#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8)) |
#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8)) |
94 |
|
|
95 |
|
#include "arch/bpstruct.h" |
96 |
PACK_STRUCT_BEGIN |
PACK_STRUCT_BEGIN |
97 |
struct ethip_hdr { |
struct ethip_hdr { |
98 |
PACK_STRUCT_FIELD(struct eth_hdr eth); |
PACK_STRUCT_FIELD(struct eth_hdr eth); |
99 |
PACK_STRUCT_FIELD(struct ip_hdr ip); |
PACK_STRUCT_FIELD(struct ip_hdr ip); |
100 |
}; |
}; |
101 |
PACK_STRUCT_END |
PACK_STRUCT_END |
102 |
|
#include "arch/epstruct.h" |
103 |
|
|
104 |
enum etharp_state { |
enum etharp_state { |
105 |
ETHARP_STATE_EMPTY, |
ETHARP_STATE_EMPTY, |