da2d8f8b6088a898037418fb036865823356cef4
[openwrt.git] / package / wificonf / include / proto / bcmip.h
1 /*
2  * Copyright 2005, 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 IP Protocol
11  *
12  * $Id$
13  */
14
15 #ifndef _bcmip_h_
16 #define _bcmip_h_
17
18 /* IP header */
19 #define IPV4_VERIHL_OFFSET      0       /* version and ihl byte offset */
20 #define IPV4_TOS_OFFSET         1       /* TOS offset */
21 #define IPV4_PROT_OFFSET        9       /* protocol type offset */
22 #define IPV4_CHKSUM_OFFSET      10      /* IP header checksum offset */
23 #define IPV4_SRC_IP_OFFSET      12      /* src IP addr offset */
24 #define IPV4_DEST_IP_OFFSET     16      /* dest IP addr offset */
25
26 #define IPV4_VER_MASK   0xf0
27 #define IPV4_IHL_MASK   0x0f
28
29 #define IPV4_PROT_UDP   17      /* UDP protocol type */
30
31 #define IPV4_ADDR_LEN   4       /* IP v4 address length */
32
33 #define IPV4_VER_NUM    0x40    /* IP v4 version number */
34
35 /* NULL IP address check */
36 #define IPV4_ISNULLADDR(a)      ((((uint8 *)(a))[0] + ((uint8 *)(a))[1] + \
37                                 ((uint8 *)(a))[2] + ((uint8 *)(a))[3]) == 0)
38
39 #define IPV4_ADDR_STR_LEN       16
40
41 #endif  /* #ifndef _bcmip_h_ */
42