minor changes
[libogc.git] / lwbt / bt.h
blobd0ed63af8e3b21dda88665ee5cf2eab4342a4bf5
1 /**
2 * \addtogroup uip
3 * @{
4 */
6 /**
7 * \file
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
24 * are met:
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
32 * written permission.
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.
51 #ifndef __BT_H__
52 #define __BT_H__
54 #include "btopt.h"
55 #include "btarch.h"
57 #define ERR_OK 0
58 #define ERR_MEM -1
59 #define ERR_BUF -2
60 #define ERR_ABRT -3
61 #define ERR_RST -4
62 #define ERR_CLSD -5
63 #define ERR_CONN -6
64 #define ERR_VAL -7
65 #define ERR_ARG -8
66 #define ERR_RTE -9
67 #define ERR_USE -10
68 #define ERR_IF -11
69 #define ERR_PKTSIZE -17
71 #define PROTO_ICMP 1
72 #define PROTO_TCP 6
73 #define PROTO_UDP 17
75 /* Headezes. */
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 */
84 /**
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.
91 * \hideinitializer
93 #ifndef HTONS
94 # if BYTE_ORDER == BIG_ENDIAN
95 # define HTONS(n) (n)
96 # else /* BYTE_ORDER == BIG_ENDIAN */
97 # define HTONS(n) ((((u16_t)((n) & 0xff)) << 8) | (((n) & 0xff00) >> 8))
98 # endif /* BYTE_ORDER == BIG_ENDIAN */
99 #endif /* HTONS */
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.
109 #ifndef htons
110 u16_t htons(u16_t val);
111 #endif /* htons */
113 /** @} */
115 #endif /* __UIP_H__ */
118 /** @} */