Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 1 | /* |
| 2 | * arpping .h |
| 3 | */ |
| 4 | |
| 5 | #ifndef ARPPING_H |
| 6 | #define ARPPING_H |
| 7 | |
| 8 | #include <netinet/if_ether.h> |
| 9 | #include <net/if_arp.h> |
| 10 | #include <net/if.h> |
| 11 | #include <netinet/in.h> |
| 12 | |
| 13 | struct arpMsg { |
Glenn L McGrath | 3f79300 | 2004-03-05 14:25:49 +0000 | [diff] [blame] | 14 | /* Ethernet header */ |
| 15 | u_char h_dest[6]; /* destination ether addr */ |
| 16 | u_char h_source[6]; /* source ether addr */ |
| 17 | u_short h_proto; /* packet type ID field */ |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 18 | |
Glenn L McGrath | 3f79300 | 2004-03-05 14:25:49 +0000 | [diff] [blame] | 19 | /* ARP packet */ |
Eric Andersen | ad95373 | 2004-01-30 23:45:53 +0000 | [diff] [blame] | 20 | uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */ |
| 21 | uint16_t ptype; /* protocol type (must be ETH_P_IP) */ |
| 22 | uint8_t hlen; /* hardware address length (must be 6) */ |
| 23 | uint8_t plen; /* protocol address length (must be 4) */ |
| 24 | uint16_t operation; /* ARP opcode */ |
| 25 | uint8_t sHaddr[6]; /* sender's hardware address */ |
| 26 | uint8_t sInaddr[4]; /* sender's IP address */ |
| 27 | uint8_t tHaddr[6]; /* target's hardware address */ |
| 28 | uint8_t tInaddr[4]; /* target's IP address */ |
| 29 | uint8_t pad[18]; /* pad for min. Ethernet payload (60 bytes) */ |
Bernhard Reutner-Fischer | 86f5c99 | 2006-01-22 22:55:11 +0000 | [diff] [blame] | 30 | } ATTRIBUTE_PACKED; |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 31 | |
| 32 | /* function prototypes */ |
Eric Andersen | ad95373 | 2004-01-30 23:45:53 +0000 | [diff] [blame] | 33 | int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface); |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 34 | |
| 35 | #endif |