mbed OS5

Fork of UIPEthernet by Zoltan Hudak

Committer:
hudakz
Date:
Sat Dec 20 11:10:40 2014 +0000
Revision:
3:5b17e4656dd0
Child:
8:4acb22344932
02 Name clash with "Ethernet" fixed for LPC1768

Who changed what in which revision?

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