f5058b6aa71310cc7b92864d5b474a9eb3ce20c6
[openwrt-10.03/.git] / package / broadcom-wl / src / driver / proto / bcmarp.h
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  * $Id$
13  */
14
15 #ifndef _bcmarp_h_
16 #define _bcmarp_h_
17
18 /* enable structure packing */
19 #if defined(__GNUC__)
20 #define PACKED  __attribute__((packed))
21 #else
22 #pragma pack(1)
23 #define PACKED
24 #endif
25
26 #define ARP_OPC_OFFSET          6               /* option code offset */
27 #define ARP_SRC_ETH_OFFSET      8               /* src h/w address offset */
28 #define ARP_SRC_IP_OFFSET       14              /* src IP address offset */
29 #define ARP_TGT_ETH_OFFSET      18              /* target h/w address offset */
30 #define ARP_TGT_IP_OFFSET       24              /* target IP address offset */
31
32 #define ARP_OPC_REQUEST         1               /* ARP request */
33 #define ARP_OPC_REPLY           2               /* ARP reply */
34
35 #define ARP_DATA_LEN            28              /* ARP data length */
36
37 struct bcmarp {
38         uint16  htype;                          /* Header type (1 = ethernet) */
39         uint16  ptype;                          /* Protocol type (0x800 = IP) */
40         uint8   hlen;                           /* Hardware address length (Eth = 6) */
41         uint8   plen;                           /* Protocol address length (IP = 4) */
42         uint16  oper;                           /* ARP_OPC_... */
43         uint8   src_eth[ETHER_ADDR_LEN];        /* Source hardware address */
44         uint8   src_ip[IPV4_ADDR_LEN];          /* Source protocol address (not aligned) */
45         uint8   dst_eth[ETHER_ADDR_LEN];        /* Destination hardware address */
46         uint8   dst_ip[IPV4_ADDR_LEN];          /* Destination protocol address */
47 } PACKED;
48
49 /* Ethernet header + Arp message */
50 struct bcmetharp {
51         struct ether_header     eh;
52         struct bcmarp   arp;
53 } PACKED;
54
55 #undef PACKED
56 #if !defined(__GNUC__)
57 #pragma pack()
58 #endif
59
60 #endif  /* !defined(_bcmarp_h_) */