5464284cf77fd897a2bead4cd68f6e6fa48b02e0
[openwrt/svn-archive/archive.git] / package / broadcom-wl / src / driver / proto / bcmudp.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 UDP Protocol
11 *
12 * $Id$
13 */
14
15 #ifndef _bcmudp_h_
16 #define _bcmudp_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 /* UDP header */
27 #define UDP_DEST_PORT_OFFSET 2 /* UDP dest port offset */
28 #define UDP_LEN_OFFSET 4 /* UDP length offset */
29 #define UDP_CHKSUM_OFFSET 6 /* UDP body checksum offset */
30
31 #define UDP_HDR_LEN 8 /* UDP header length */
32 #define UDP_PORT_LEN 2 /* UDP port length */
33
34 /* These fields are stored in network order */
35 struct bcmudp_hdr
36 {
37 uint16 src_port; /* Source Port Address */
38 uint16 dst_port; /* Destination Port Address */
39 uint16 len; /* Number of bytes in datagram including header */
40 uint16 chksum; /* entire datagram checksum with pseudoheader */
41 } PACKED;
42
43 #undef PACKED
44 #if !defined(__GNUC__)
45 #pragma pack()
46 #endif
47
48 #endif /* #ifndef _bcmudp_h_ */