UIPEthernet library for Arduino IDE, Eclipse with arduino plugin and MBED/SMeshStudio (AVR,STM32F,ESP8266,Intel ARC32,Nordic nRF51,Teensy boards,Realtek Ameba(RTL8195A,RTL8710)), ENC28j60 network chip. Compatible with Wiznet W5100 Ethernet library API. Compiled and tested on Nucleo-F302R8. Master repository is: https://github.com/UIPEthernet/UIPEthernet/

Committer:
cassyarduino
Date:
Tue Jan 23 15:08:43 2018 +0100
Revision:
39:deeb00b81cc9
Parent:
0:e3fb1267e3c3
Release: 2.0.4

Who changed what in which revision?

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