]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_LPC1768_GCC_RedSuite/src/webserver/uip_arch.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / CORTEX_LPC1768_GCC_RedSuite / src / webserver / uip_arch.h
1 /**\r
2  * \addtogroup uip\r
3  * {@\r
4  */\r
5 \r
6 /**\r
7  * \defgroup uiparch Architecture specific uIP functions\r
8  * @{\r
9  *\r
10  * The functions in the architecture specific module implement the IP\r
11  * check sum and 32-bit additions.\r
12  *\r
13  * The IP checksum calculation is the most computationally expensive\r
14  * operation in the TCP/IP stack and it therefore pays off to\r
15  * implement this in efficient assembler. The purpose of the uip-arch\r
16  * module is to let the checksum functions to be implemented in\r
17  * architecture specific assembler.\r
18  *\r
19  */\r
20 \r
21 /**\r
22  * \file\r
23  * Declarations of architecture specific functions.\r
24  * \author Adam Dunkels <adam@dunkels.com>\r
25  */\r
26 \r
27 /*\r
28  * Copyright (c) 2001, Adam Dunkels.\r
29  * All rights reserved.\r
30  *\r
31  * Redistribution and use in source and binary forms, with or without\r
32  * modification, are permitted provided that the following conditions\r
33  * are met:\r
34  * 1. Redistributions of source code must retain the above copyright\r
35  *    notice, this list of conditions and the following disclaimer.\r
36  * 2. Redistributions in binary form must reproduce the above copyright\r
37  *    notice, this list of conditions and the following disclaimer in the\r
38  *    documentation and/or other materials provided with the distribution.\r
39  * 3. The name of the author may not be used to endorse or promote\r
40  *    products derived from this software without specific prior\r
41  *    written permission.\r
42  *\r
43  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
44  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
45  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
46  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
47  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
48  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
49  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
50  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
51  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
52  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
53  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
54  *\r
55  * This file is part of the uIP TCP/IP stack.\r
56  *\r
57  * $Id: uip_arch.h,v 1.2 2006/06/07 09:15:19 adam Exp $\r
58  *\r
59  */\r
60 \r
61 #ifndef __UIP_ARCH_H__\r
62 #define __UIP_ARCH_H__\r
63 \r
64 #include "uip.h"\r
65 \r
66 /**\r
67  * Carry out a 32-bit addition.\r
68  *\r
69  * Because not all architectures for which uIP is intended has native\r
70  * 32-bit arithmetic, uIP uses an external C function for doing the\r
71  * required 32-bit additions in the TCP protocol processing. This\r
72  * function should add the two arguments and place the result in the\r
73  * global variable uip_acc32.\r
74  *\r
75  * \note The 32-bit integer pointed to by the op32 parameter and the\r
76  * result in the uip_acc32 variable are in network byte order (big\r
77  * endian).\r
78  *\r
79  * \param op32 A pointer to a 4-byte array representing a 32-bit\r
80  * integer in network byte order (big endian).\r
81  *\r
82  * \param op16 A 16-bit integer in host byte order.\r
83  */\r
84 void uip_add32(u8_t *op32, u16_t op16);\r
85 \r
86 /**\r
87  * Calculate the Internet checksum over a buffer.\r
88  *\r
89  * The Internet checksum is the one's complement of the one's\r
90  * complement sum of all 16-bit words in the buffer.\r
91  *\r
92  * See RFC1071.\r
93  *\r
94  * \note This function is not called in the current version of uIP,\r
95  * but future versions might make use of it.\r
96  *\r
97  * \param buf A pointer to the buffer over which the checksum is to be\r
98  * computed.\r
99  *\r
100  * \param len The length of the buffer over which the checksum is to\r
101  * be computed.\r
102  *\r
103  * \return The Internet checksum of the buffer.\r
104  */\r
105 u16_t uip_chksum(u16_t *buf, u16_t len);\r
106 \r
107 /**\r
108  * Calculate the IP header checksum of the packet header in uip_buf.\r
109  *\r
110  * The IP header checksum is the Internet checksum of the 20 bytes of\r
111  * the IP header.\r
112  *\r
113  * \return The IP header checksum of the IP header in the uip_buf\r
114  * buffer.\r
115  */\r
116 u16_t uip_ipchksum(void);\r
117 \r
118 /**\r
119  * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.\r
120  *\r
121  * The TCP checksum is the Internet checksum of data contents of the\r
122  * TCP segment, and a pseudo-header as defined in RFC793.\r
123  *\r
124  * \note The uip_appdata pointer that points to the packet data may\r
125  * point anywhere in memory, so it is not possible to simply calculate\r
126  * the Internet checksum of the contents of the uip_buf buffer.\r
127  *\r
128  * \return The TCP checksum of the TCP segment in uip_buf and pointed\r
129  * to by uip_appdata.\r
130  */\r
131 u16_t uip_tcpchksum(void);\r
132 \r
133 u16_t uip_udpchksum(void);\r
134 \r
135 /** @} */\r
136 /** @} */\r
137 \r
138 #endif /* __UIP_ARCH_H__ */\r