8 * Header file for the uIP TCP/IP stack.
9 * \author Adam Dunkels <adam@dunkels.com>
11 * The uIP TCP/IP stack header file contains definitions for a number
12 * of C macros that are used by uIP programs as well as internal uIP
13 * structures, TCP/IP header structures and function declarations.
19 * Copyright (c) 2001-2003, Adam Dunkels.
20 * All rights reserved.
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
25 * 1. Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
30 * 3. The name of the author may not be used to endorse or promote
31 * products derived from this software without specific prior
34 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
35 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
38 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
40 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
42 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 * This file is part of the uIP TCP/IP stack.
69 #define ERR_PKTSIZE -17
76 #define IP_HLEN 20 /* Size of IP header */
77 #define TRANSPORT_HLEN 20
79 #define UDP_HLEN 8 /* Size of UDP header */
80 #define TCP_HLEN 20 /* Size of TCP header */
81 #define IPUDP_HLEN 28 /* Size of IP + UDP header */
82 #define IPTCP_HLEN 40 /* Size of IP + TCP header */
85 * Convert 16-bit quantity from host byte order to network byte order.
87 * This macro is primarily used for converting constants from host
88 * byte order to network byte order. For converting variables to
89 * network byte order, use the htons() function instead.
94 # if BYTE_ORDER == BIG_ENDIAN
96 # else /* BYTE_ORDER == BIG_ENDIAN */
97 # define HTONS(n) ((((u16_t)((n) & 0xff)) << 8) | (((n) & 0xff00) >> 8))
98 # endif /* BYTE_ORDER == BIG_ENDIAN */
103 * Convert 16-bit quantity from host byte order to network byte order.
105 * This function is primarily used for converting variables from host
106 * byte order to network byte order. For converting constants to
107 * network byte order, use the HTONS() macro instead.
110 u16_t
htons(u16_t val
);
115 #endif /* __UIP_H__ */