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