ソースの整理中ですが、利用はできます。

Dependencies:   EthernetInterface HttpServer TextLCD mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
yueee_yt
Date:
Wed Mar 12 04:19:54 2014 +0000
Revision:
0:7766f6712673
???????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yueee_yt 0:7766f6712673 1 /*
yueee_yt 0:7766f6712673 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
yueee_yt 0:7766f6712673 3 * All rights reserved.
yueee_yt 0:7766f6712673 4 *
yueee_yt 0:7766f6712673 5 * Redistribution and use in source and binary forms, with or without modification,
yueee_yt 0:7766f6712673 6 * are permitted provided that the following conditions are met:
yueee_yt 0:7766f6712673 7 *
yueee_yt 0:7766f6712673 8 * 1. Redistributions of source code must retain the above copyright notice,
yueee_yt 0:7766f6712673 9 * this list of conditions and the following disclaimer.
yueee_yt 0:7766f6712673 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
yueee_yt 0:7766f6712673 11 * this list of conditions and the following disclaimer in the documentation
yueee_yt 0:7766f6712673 12 * and/or other materials provided with the distribution.
yueee_yt 0:7766f6712673 13 * 3. The name of the author may not be used to endorse or promote products
yueee_yt 0:7766f6712673 14 * derived from this software without specific prior written permission.
yueee_yt 0:7766f6712673 15 *
yueee_yt 0:7766f6712673 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
yueee_yt 0:7766f6712673 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
yueee_yt 0:7766f6712673 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
yueee_yt 0:7766f6712673 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
yueee_yt 0:7766f6712673 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
yueee_yt 0:7766f6712673 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
yueee_yt 0:7766f6712673 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
yueee_yt 0:7766f6712673 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
yueee_yt 0:7766f6712673 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
yueee_yt 0:7766f6712673 25 * OF SUCH DAMAGE.
yueee_yt 0:7766f6712673 26 *
yueee_yt 0:7766f6712673 27 * This file is part of the lwIP TCP/IP stack.
yueee_yt 0:7766f6712673 28 *
yueee_yt 0:7766f6712673 29 * Author: Adam Dunkels <adam@sics.se>
yueee_yt 0:7766f6712673 30 *
yueee_yt 0:7766f6712673 31 */
yueee_yt 0:7766f6712673 32 #ifndef __LWIP_DEF_H__
yueee_yt 0:7766f6712673 33 #define __LWIP_DEF_H__
yueee_yt 0:7766f6712673 34
yueee_yt 0:7766f6712673 35 /* arch.h might define NULL already */
yueee_yt 0:7766f6712673 36 #include "lwip/arch.h"
yueee_yt 0:7766f6712673 37 #include "lwip/opt.h"
yueee_yt 0:7766f6712673 38
yueee_yt 0:7766f6712673 39 #ifdef __cplusplus
yueee_yt 0:7766f6712673 40 extern "C" {
yueee_yt 0:7766f6712673 41 #endif
yueee_yt 0:7766f6712673 42
yueee_yt 0:7766f6712673 43 #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y))
yueee_yt 0:7766f6712673 44 #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y))
yueee_yt 0:7766f6712673 45
yueee_yt 0:7766f6712673 46 #ifndef NULL
yueee_yt 0:7766f6712673 47 #define NULL ((void *)0)
yueee_yt 0:7766f6712673 48 #endif
yueee_yt 0:7766f6712673 49
yueee_yt 0:7766f6712673 50 /** Get the absolute difference between 2 u32_t values (correcting overflows)
yueee_yt 0:7766f6712673 51 * 'a' is expected to be 'higher' (without overflow) than 'b'. */
yueee_yt 0:7766f6712673 52 #define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1)))
yueee_yt 0:7766f6712673 53
yueee_yt 0:7766f6712673 54 /* Endianess-optimized shifting of two u8_t to create one u16_t */
yueee_yt 0:7766f6712673 55 #if BYTE_ORDER == LITTLE_ENDIAN
yueee_yt 0:7766f6712673 56 #define LWIP_MAKE_U16(a, b) ((a << 8) | b)
yueee_yt 0:7766f6712673 57 #else
yueee_yt 0:7766f6712673 58 #define LWIP_MAKE_U16(a, b) ((b << 8) | a)
yueee_yt 0:7766f6712673 59 #endif
yueee_yt 0:7766f6712673 60
yueee_yt 0:7766f6712673 61 #ifndef LWIP_PLATFORM_BYTESWAP
yueee_yt 0:7766f6712673 62 #define LWIP_PLATFORM_BYTESWAP 0
yueee_yt 0:7766f6712673 63 #endif
yueee_yt 0:7766f6712673 64
yueee_yt 0:7766f6712673 65 #ifndef LWIP_PREFIX_BYTEORDER_FUNCS
yueee_yt 0:7766f6712673 66 /* workaround for naming collisions on some platforms */
yueee_yt 0:7766f6712673 67
yueee_yt 0:7766f6712673 68 #ifdef htons
yueee_yt 0:7766f6712673 69 #undef htons
yueee_yt 0:7766f6712673 70 #endif /* htons */
yueee_yt 0:7766f6712673 71 #ifdef htonl
yueee_yt 0:7766f6712673 72 #undef htonl
yueee_yt 0:7766f6712673 73 #endif /* htonl */
yueee_yt 0:7766f6712673 74 #ifdef ntohs
yueee_yt 0:7766f6712673 75 #undef ntohs
yueee_yt 0:7766f6712673 76 #endif /* ntohs */
yueee_yt 0:7766f6712673 77 #ifdef ntohl
yueee_yt 0:7766f6712673 78 #undef ntohl
yueee_yt 0:7766f6712673 79 #endif /* ntohl */
yueee_yt 0:7766f6712673 80
yueee_yt 0:7766f6712673 81 #define htons(x) lwip_htons(x)
yueee_yt 0:7766f6712673 82 #define ntohs(x) lwip_ntohs(x)
yueee_yt 0:7766f6712673 83 #define htonl(x) lwip_htonl(x)
yueee_yt 0:7766f6712673 84 #define ntohl(x) lwip_ntohl(x)
yueee_yt 0:7766f6712673 85 #endif /* LWIP_PREFIX_BYTEORDER_FUNCS */
yueee_yt 0:7766f6712673 86
yueee_yt 0:7766f6712673 87 #if BYTE_ORDER == BIG_ENDIAN
yueee_yt 0:7766f6712673 88 #define lwip_htons(x) (x)
yueee_yt 0:7766f6712673 89 #define lwip_ntohs(x) (x)
yueee_yt 0:7766f6712673 90 #define lwip_htonl(x) (x)
yueee_yt 0:7766f6712673 91 #define lwip_ntohl(x) (x)
yueee_yt 0:7766f6712673 92 #define PP_HTONS(x) (x)
yueee_yt 0:7766f6712673 93 #define PP_NTOHS(x) (x)
yueee_yt 0:7766f6712673 94 #define PP_HTONL(x) (x)
yueee_yt 0:7766f6712673 95 #define PP_NTOHL(x) (x)
yueee_yt 0:7766f6712673 96 #else /* BYTE_ORDER != BIG_ENDIAN */
yueee_yt 0:7766f6712673 97 #if LWIP_PLATFORM_BYTESWAP
yueee_yt 0:7766f6712673 98 #define lwip_htons(x) LWIP_PLATFORM_HTONS(x)
yueee_yt 0:7766f6712673 99 #define lwip_ntohs(x) LWIP_PLATFORM_HTONS(x)
yueee_yt 0:7766f6712673 100 #define lwip_htonl(x) LWIP_PLATFORM_HTONL(x)
yueee_yt 0:7766f6712673 101 #define lwip_ntohl(x) LWIP_PLATFORM_HTONL(x)
yueee_yt 0:7766f6712673 102 #else /* LWIP_PLATFORM_BYTESWAP */
yueee_yt 0:7766f6712673 103 u16_t lwip_htons(u16_t x);
yueee_yt 0:7766f6712673 104 u16_t lwip_ntohs(u16_t x);
yueee_yt 0:7766f6712673 105 u32_t lwip_htonl(u32_t x);
yueee_yt 0:7766f6712673 106 u32_t lwip_ntohl(u32_t x);
yueee_yt 0:7766f6712673 107 #endif /* LWIP_PLATFORM_BYTESWAP */
yueee_yt 0:7766f6712673 108
yueee_yt 0:7766f6712673 109 /* These macros should be calculated by the preprocessor and are used
yueee_yt 0:7766f6712673 110 with compile-time constants only (so that there is no little-endian
yueee_yt 0:7766f6712673 111 overhead at runtime). */
yueee_yt 0:7766f6712673 112 #define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
yueee_yt 0:7766f6712673 113 #define PP_NTOHS(x) PP_HTONS(x)
yueee_yt 0:7766f6712673 114 #define PP_HTONL(x) ((((x) & 0xff) << 24) | \
yueee_yt 0:7766f6712673 115 (((x) & 0xff00) << 8) | \
yueee_yt 0:7766f6712673 116 (((x) & 0xff0000UL) >> 8) | \
yueee_yt 0:7766f6712673 117 (((x) & 0xff000000UL) >> 24))
yueee_yt 0:7766f6712673 118 #define PP_NTOHL(x) PP_HTONL(x)
yueee_yt 0:7766f6712673 119
yueee_yt 0:7766f6712673 120 #endif /* BYTE_ORDER == BIG_ENDIAN */
yueee_yt 0:7766f6712673 121
yueee_yt 0:7766f6712673 122 #ifdef __cplusplus
yueee_yt 0:7766f6712673 123 }
yueee_yt 0:7766f6712673 124 #endif
yueee_yt 0:7766f6712673 125
yueee_yt 0:7766f6712673 126 #endif /* __LWIP_DEF_H__ */
yueee_yt 0:7766f6712673 127