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