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