Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/lwip/inet.h need to be fixed.

0001 /*
0002  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
0003  * All rights reserved. 
0004  * 
0005  * Redistribution and use in source and binary forms, with or without modification, 
0006  * are permitted provided that the following conditions are met:
0007  *
0008  * 1. Redistributions of source code must retain the above copyright notice,
0009  *    this list of conditions and the following disclaimer.
0010  * 2. Redistributions in binary form must reproduce the above copyright notice,
0011  *    this list of conditions and the following disclaimer in the documentation
0012  *    and/or other materials provided with the distribution.
0013  * 3. The name of the author may not be used to endorse or promote products
0014  *    derived from this software without specific prior written permission. 
0015  *
0016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
0017  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
0018  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
0019  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
0020  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
0021  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
0022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
0023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
0024  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
0025  * OF SUCH DAMAGE.
0026  *
0027  * This file is part of the lwIP TCP/IP stack.
0028  * 
0029  * Author: Adam Dunkels <adam@sics.se>
0030  *
0031  */
0032 #ifndef __LWIP_INET_H__
0033 #define __LWIP_INET_H__
0034 
0035 #include "lwip/opt.h"
0036 
0037 #ifdef __cplusplus
0038 extern "C" {
0039 #endif
0040 
0041 /* For compatibility with BSD code */
0042 struct in_addr {
0043   u32_t s_addr;
0044 };
0045 
0046 #define INADDR_NONE         ((u32_t)0xffffffffUL)  /* 255.255.255.255 */
0047 #define INADDR_LOOPBACK     ((u32_t)0x7f000001UL)  /* 127.0.0.1 */
0048 #define INADDR_ANY          ((u32_t)0x00000000UL)  /* 0.0.0.0 */
0049 #define INADDR_BROADCAST    ((u32_t)0xffffffffUL)  /* 255.255.255.255 */
0050 
0051 u32_t inet_addr(const char *cp);
0052 int inet_aton(const char *cp, struct in_addr *addr);
0053 char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */
0054 
0055 #ifdef htons
0056 #undef htons
0057 #endif /* htons */
0058 #ifdef htonl
0059 #undef htonl
0060 #endif /* htonl */
0061 #ifdef ntohs
0062 #undef ntohs
0063 #endif /* ntohs */
0064 #ifdef ntohl
0065 #undef ntohl
0066 #endif /* ntohl */
0067 
0068 #ifndef LWIP_PLATFORM_BYTESWAP
0069 #define LWIP_PLATFORM_BYTESWAP 0
0070 #endif
0071 
0072 #if BYTE_ORDER == BIG_ENDIAN
0073 #define htons(x) (x)
0074 #define ntohs(x) (x)
0075 #define htonl(x) (x)
0076 #define ntohl(x) (x)
0077 #else /* BYTE_ORDER != BIG_ENDIAN */
0078 #ifdef LWIP_PREFIX_BYTEORDER_FUNCS
0079 /* workaround for naming collisions on some platforms */
0080 #define htons lwip_htons
0081 #define ntohs lwip_ntohs
0082 #define htonl lwip_htonl
0083 #define ntohl lwip_ntohl
0084 #endif /* LWIP_PREFIX_BYTEORDER_FUNCS */
0085 #if LWIP_PLATFORM_BYTESWAP
0086 #define htons(x) LWIP_PLATFORM_HTONS(x)
0087 #define ntohs(x) LWIP_PLATFORM_HTONS(x)
0088 #define htonl(x) LWIP_PLATFORM_HTONL(x)
0089 #define ntohl(x) LWIP_PLATFORM_HTONL(x)
0090 #else /* LWIP_PLATFORM_BYTESWAP */
0091 u16_t htons(u16_t x);
0092 u16_t ntohs(u16_t x);
0093 u32_t htonl(u32_t x);
0094 u32_t ntohl(u32_t x);
0095 #endif /* LWIP_PLATFORM_BYTESWAP */
0096 
0097 #endif /* BYTE_ORDER == BIG_ENDIAN */
0098 
0099 #ifdef __cplusplus
0100 }
0101 #endif
0102 
0103 #endif /* __LWIP_INET_H__ */