| 1 | /* |
| 2 | * Copyright 2007, Broadcom Corporation |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; |
| 6 | * the contents of this file may not be disclosed to third parties, copied |
| 7 | * or duplicated in any form, in whole or in part, without the prior |
| 8 | * written permission of Broadcom Corporation. |
| 9 | * |
| 10 | * Fundamental constants relating to ARP Protocol |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef _bcmarp_h_ |
| 15 | #define _bcmarp_h_ |
| 16 | |
| 17 | /* enable structure packing */ |
| 18 | #if defined(__GNUC__) |
| 19 | #define PACKED __attribute__((packed)) |
| 20 | #else |
| 21 | #pragma pack(1) |
| 22 | #define PACKED |
| 23 | #endif |
| 24 | |
| 25 | #define ARP_OPC_OFFSET 6 /* option code offset */ |
| 26 | #define ARP_SRC_ETH_OFFSET 8 /* src h/w address offset */ |
| 27 | #define ARP_SRC_IP_OFFSET 14 /* src IP address offset */ |
| 28 | #define ARP_TGT_ETH_OFFSET 18 /* target h/w address offset */ |
| 29 | #define ARP_TGT_IP_OFFSET 24 /* target IP address offset */ |
| 30 | |
| 31 | #define ARP_OPC_REQUEST 1 /* ARP request */ |
| 32 | #define ARP_OPC_REPLY 2 /* ARP reply */ |
| 33 | |
| 34 | #define ARP_DATA_LEN 28 /* ARP data length */ |
| 35 | |
| 36 | struct bcmarp { |
| 37 | uint16 htype; /* Header type (1 = ethernet) */ |
| 38 | uint16 ptype; /* Protocol type (0x800 = IP) */ |
| 39 | uint8 hlen; /* Hardware address length (Eth = 6) */ |
| 40 | uint8 plen; /* Protocol address length (IP = 4) */ |
| 41 | uint16 oper; /* ARP_OPC_... */ |
| 42 | uint8 src_eth[ETHER_ADDR_LEN]; /* Source hardware address */ |
| 43 | uint8 src_ip[IPV4_ADDR_LEN]; /* Source protocol address (not aligned) */ |
| 44 | uint8 dst_eth[ETHER_ADDR_LEN]; /* Destination hardware address */ |
| 45 | uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination protocol address */ |
| 46 | } PACKED; |
| 47 | |
| 48 | /* Ethernet header + Arp message */ |
| 49 | struct bcmetharp { |
| 50 | struct ether_header eh; |
| 51 | struct bcmarp arp; |
| 52 | } PACKED; |
| 53 | |
| 54 | #undef PACKED |
| 55 | #if !defined(__GNUC__) |
| 56 | #pragma pack() |
| 57 | #endif |
| 58 | |
| 59 | #endif /* !defined(_bcmarp_h_) */ |
| 60 | |