Port of LwIP performed by Ralf in 2010. Not recommended for use with recent mbed libraries, but good demos of raw LwIP possible

Dependents:   LwIP_raw_API_serverExample tiny-dtls

Committer:
RodColeman
Date:
Tue Sep 18 14:41:24 2012 +0000
Revision:
0:0791c1fece8e
[mbed] converted /Eth_TCP_Wei_Server/lwip

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RodColeman 0:0791c1fece8e 1 /*
RodColeman 0:0791c1fece8e 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
RodColeman 0:0791c1fece8e 3 * All rights reserved.
RodColeman 0:0791c1fece8e 4 *
RodColeman 0:0791c1fece8e 5 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:0791c1fece8e 6 * are permitted provided that the following conditions are met:
RodColeman 0:0791c1fece8e 7 *
RodColeman 0:0791c1fece8e 8 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:0791c1fece8e 9 * this list of conditions and the following disclaimer.
RodColeman 0:0791c1fece8e 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:0791c1fece8e 11 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:0791c1fece8e 12 * and/or other materials provided with the distribution.
RodColeman 0:0791c1fece8e 13 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:0791c1fece8e 14 * derived from this software without specific prior written permission.
RodColeman 0:0791c1fece8e 15 *
RodColeman 0:0791c1fece8e 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:0791c1fece8e 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:0791c1fece8e 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:0791c1fece8e 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:0791c1fece8e 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:0791c1fece8e 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:0791c1fece8e 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:0791c1fece8e 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:0791c1fece8e 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:0791c1fece8e 25 * OF SUCH DAMAGE.
RodColeman 0:0791c1fece8e 26 *
RodColeman 0:0791c1fece8e 27 * This file is part of the lwIP TCP/IP stack.
RodColeman 0:0791c1fece8e 28 *
RodColeman 0:0791c1fece8e 29 * Author: Adam Dunkels <adam@sics.se>
RodColeman 0:0791c1fece8e 30 *
RodColeman 0:0791c1fece8e 31 */
RodColeman 0:0791c1fece8e 32 #ifndef __LWIP_INET_H__
RodColeman 0:0791c1fece8e 33 #define __LWIP_INET_H__
RodColeman 0:0791c1fece8e 34
RodColeman 0:0791c1fece8e 35 #include "lwip/opt.h"
RodColeman 0:0791c1fece8e 36
RodColeman 0:0791c1fece8e 37 #ifdef __cplusplus
RodColeman 0:0791c1fece8e 38 extern "C" {
RodColeman 0:0791c1fece8e 39 #endif
RodColeman 0:0791c1fece8e 40
RodColeman 0:0791c1fece8e 41 /* For compatibility with BSD code */
RodColeman 0:0791c1fece8e 42 struct in_addr {
RodColeman 0:0791c1fece8e 43 u32_t s_addr;
RodColeman 0:0791c1fece8e 44 };
RodColeman 0:0791c1fece8e 45
RodColeman 0:0791c1fece8e 46 #define INADDR_NONE ((u32_t)0xffffffffUL) /* 255.255.255.255 */
RodColeman 0:0791c1fece8e 47 #define INADDR_LOOPBACK ((u32_t)0x7f000001UL) /* 127.0.0.1 */
RodColeman 0:0791c1fece8e 48 #define INADDR_ANY ((u32_t)0x00000000UL) /* 0.0.0.0 */
RodColeman 0:0791c1fece8e 49 #define INADDR_BROADCAST ((u32_t)0xffffffffUL) /* 255.255.255.255 */
RodColeman 0:0791c1fece8e 50
RodColeman 0:0791c1fece8e 51 u32_t inet_addr(const char *cp);
RodColeman 0:0791c1fece8e 52 int inet_aton(const char *cp, struct in_addr *addr);
RodColeman 0:0791c1fece8e 53 char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */
RodColeman 0:0791c1fece8e 54
RodColeman 0:0791c1fece8e 55 #ifdef htons
RodColeman 0:0791c1fece8e 56 #undef htons
RodColeman 0:0791c1fece8e 57 #endif /* htons */
RodColeman 0:0791c1fece8e 58 #ifdef htonl
RodColeman 0:0791c1fece8e 59 #undef htonl
RodColeman 0:0791c1fece8e 60 #endif /* htonl */
RodColeman 0:0791c1fece8e 61 #ifdef ntohs
RodColeman 0:0791c1fece8e 62 #undef ntohs
RodColeman 0:0791c1fece8e 63 #endif /* ntohs */
RodColeman 0:0791c1fece8e 64 #ifdef ntohl
RodColeman 0:0791c1fece8e 65 #undef ntohl
RodColeman 0:0791c1fece8e 66 #endif /* ntohl */
RodColeman 0:0791c1fece8e 67
RodColeman 0:0791c1fece8e 68 #ifndef LWIP_PLATFORM_BYTESWAP
RodColeman 0:0791c1fece8e 69 #define LWIP_PLATFORM_BYTESWAP 0
RodColeman 0:0791c1fece8e 70 #endif
RodColeman 0:0791c1fece8e 71
RodColeman 0:0791c1fece8e 72 #if BYTE_ORDER == BIG_ENDIAN
RodColeman 0:0791c1fece8e 73 #define htons(x) (x)
RodColeman 0:0791c1fece8e 74 #define ntohs(x) (x)
RodColeman 0:0791c1fece8e 75 #define htonl(x) (x)
RodColeman 0:0791c1fece8e 76 #define ntohl(x) (x)
RodColeman 0:0791c1fece8e 77 #else /* BYTE_ORDER != BIG_ENDIAN */
RodColeman 0:0791c1fece8e 78 #ifdef LWIP_PREFIX_BYTEORDER_FUNCS
RodColeman 0:0791c1fece8e 79 /* workaround for naming collisions on some platforms */
RodColeman 0:0791c1fece8e 80 #define htons lwip_htons
RodColeman 0:0791c1fece8e 81 #define ntohs lwip_ntohs
RodColeman 0:0791c1fece8e 82 #define htonl lwip_htonl
RodColeman 0:0791c1fece8e 83 #define ntohl lwip_ntohl
RodColeman 0:0791c1fece8e 84 #endif /* LWIP_PREFIX_BYTEORDER_FUNCS */
RodColeman 0:0791c1fece8e 85 #if LWIP_PLATFORM_BYTESWAP
RodColeman 0:0791c1fece8e 86 #define htons(x) LWIP_PLATFORM_HTONS(x)
RodColeman 0:0791c1fece8e 87 #define ntohs(x) LWIP_PLATFORM_HTONS(x)
RodColeman 0:0791c1fece8e 88 #define htonl(x) LWIP_PLATFORM_HTONL(x)
RodColeman 0:0791c1fece8e 89 #define ntohl(x) LWIP_PLATFORM_HTONL(x)
RodColeman 0:0791c1fece8e 90 #else /* LWIP_PLATFORM_BYTESWAP */
RodColeman 0:0791c1fece8e 91 u16_t htons(u16_t x);
RodColeman 0:0791c1fece8e 92 u16_t ntohs(u16_t x);
RodColeman 0:0791c1fece8e 93 u32_t htonl(u32_t x);
RodColeman 0:0791c1fece8e 94 u32_t ntohl(u32_t x);
RodColeman 0:0791c1fece8e 95 #endif /* LWIP_PLATFORM_BYTESWAP */
RodColeman 0:0791c1fece8e 96
RodColeman 0:0791c1fece8e 97 #endif /* BYTE_ORDER == BIG_ENDIAN */
RodColeman 0:0791c1fece8e 98
RodColeman 0:0791c1fece8e 99 #ifdef __cplusplus
RodColeman 0:0791c1fece8e 100 }
RodColeman 0:0791c1fece8e 101 #endif
RodColeman 0:0791c1fece8e 102
RodColeman 0:0791c1fece8e 103 #endif /* __LWIP_INET_H__ */