2 * \defgroup uiparch Architecture specific uIP functions
\r
5 * The functions in the architecture specific module implement the IP
\r
6 * check sum and 32-bit additions.
\r
8 * The IP checksum calculation is the most computationally expensive
\r
9 * operation in the TCP/IP stack and it therefore pays off to
\r
10 * implement this in efficient assembler. The purpose of the uip-arch
\r
11 * module is to let the checksum functions to be implemented in
\r
12 * architecture specific assembler.
\r
18 * Declarations of architecture specific functions.
\r
19 * \author Adam Dunkels <adam@dunkels.com>
\r
23 * Copyright (c) 2001, Adam Dunkels.
\r
24 * All rights reserved.
\r
26 * Redistribution and use in source and binary forms, with or without
\r
27 * modification, are permitted provided that the following conditions
\r
29 * 1. Redistributions of source code must retain the above copyright
\r
30 * notice, this list of conditions and the following disclaimer.
\r
31 * 2. Redistributions in binary form must reproduce the above copyright
\r
32 * notice, this list of conditions and the following disclaimer in the
\r
33 * documentation and/or other materials provided with the distribution.
\r
34 * 3. The name of the author may not be used to endorse or promote
\r
35 * products derived from this software without specific prior
\r
36 * written permission.
\r
38 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
\r
39 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
\r
40 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
41 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
\r
42 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
\r
44 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
45 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
46 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
47 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
48 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
50 * This file is part of the uIP TCP/IP stack.
\r
52 * $Id: uip_arch.h,v 1.1.2.2 2003/10/06 15:10:22 adam Exp $
\r
56 #ifndef __UIP_ARCH_H__
\r
57 #define __UIP_ARCH_H__
\r
62 * Carry out a 32-bit addition.
\r
64 * Because not all architectures for which uIP is intended has native
\r
65 * 32-bit arithmetic, uIP uses an external C function for doing the
\r
66 * required 32-bit additions in the TCP protocol processing. This
\r
67 * function should add the two arguments and place the result in the
\r
68 * global variable uip_acc32.
\r
70 * \note The 32-bit integer pointed to by the op32 parameter and the
\r
71 * result in the uip_acc32 variable are in network byte order (big
\r
74 * \param op32 A pointer to a 4-byte array representing a 32-bit
\r
75 * integer in network byte order (big endian).
\r
77 * \param op16 A 16-bit integer in host byte order.
\r
79 void uip_add32(u8_t *op32, u16_t op16);
\r
82 * Calculate the Internet checksum over a buffer.
\r
84 * The Internet checksum is the one's complement of the one's
\r
85 * complement sum of all 16-bit words in the buffer.
\r
89 * \note This function is not called in the current version of uIP,
\r
90 * but future versions might make use of it.
\r
92 * \param buf A pointer to the buffer over which the checksum is to be
\r
95 * \param len The length of the buffer over which the checksum is to
\r
98 * \return The Internet checksum of the buffer.
\r
100 u16_t uip_chksum(u16_t *buf, u16_t len);
\r
103 * Calculate the IP header checksum of the packet header in uip_buf.
\r
105 * The IP header checksum is the Internet checksum of the 20 bytes of
\r
108 * \return The IP header checksum of the IP header in the uip_buf
\r
111 u16_t uip_ipchksum(void);
\r
114 * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
\r
116 * The TCP checksum is the Internet checksum of data contents of the
\r
117 * TCP segment, and a pseudo-header as defined in RFC793.
\r
119 * \note The uip_appdata pointer that points to the packet data may
\r
120 * point anywhere in memory, so it is not possible to simply calculate
\r
121 * the Internet checksum of the contents of the uip_buf buffer.
\r
123 * \return The TCP checksum of the TCP segment in uip_buf and pointed
\r
124 * to by uip_appdata.
\r
126 u16_t uip_tcpchksum(void);
\r
130 #endif /* __UIP_ARCH_H__ */
\r