uIP 1.0 based webserver for LPC1114 + ENC28J60

Dependencies:   mbed TMP102

Committer:
ban4jp
Date:
Mon Jun 30 16:00:08 2014 +0000
Revision:
3:a2715e9c7737
Parent:
0:685224d2f66d
backported from Contiki 2.7

Who changed what in which revision?

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