Dependencies:   mbed

Dependents:   TCP

Committer:
slowness
Date:
Tue Sep 06 18:05:46 2011 +0000
Revision:
0:58c3d014a4e7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
slowness 0:58c3d014a4e7 1 /*
slowness 0:58c3d014a4e7 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
slowness 0:58c3d014a4e7 3 * All rights reserved.
slowness 0:58c3d014a4e7 4 *
slowness 0:58c3d014a4e7 5 * Redistribution and use in source and binary forms, with or without modification,
slowness 0:58c3d014a4e7 6 * are permitted provided that the following conditions are met:
slowness 0:58c3d014a4e7 7 *
slowness 0:58c3d014a4e7 8 * 1. Redistributions of source code must retain the above copyright notice,
slowness 0:58c3d014a4e7 9 * this list of conditions and the following disclaimer.
slowness 0:58c3d014a4e7 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
slowness 0:58c3d014a4e7 11 * this list of conditions and the following disclaimer in the documentation
slowness 0:58c3d014a4e7 12 * and/or other materials provided with the distribution.
slowness 0:58c3d014a4e7 13 * 3. The name of the author may not be used to endorse or promote products
slowness 0:58c3d014a4e7 14 * derived from this software without specific prior written permission.
slowness 0:58c3d014a4e7 15 *
slowness 0:58c3d014a4e7 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
slowness 0:58c3d014a4e7 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
slowness 0:58c3d014a4e7 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
slowness 0:58c3d014a4e7 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
slowness 0:58c3d014a4e7 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
slowness 0:58c3d014a4e7 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
slowness 0:58c3d014a4e7 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
slowness 0:58c3d014a4e7 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
slowness 0:58c3d014a4e7 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
slowness 0:58c3d014a4e7 25 * OF SUCH DAMAGE.
slowness 0:58c3d014a4e7 26 *
slowness 0:58c3d014a4e7 27 * This file is part of the lwIP TCP/IP stack.
slowness 0:58c3d014a4e7 28 *
slowness 0:58c3d014a4e7 29 * Author: Adam Dunkels <adam@sics.se>
slowness 0:58c3d014a4e7 30 *
slowness 0:58c3d014a4e7 31 */
slowness 0:58c3d014a4e7 32 #ifndef __LWIP_INET_H__
slowness 0:58c3d014a4e7 33 #define __LWIP_INET_H__
slowness 0:58c3d014a4e7 34
slowness 0:58c3d014a4e7 35 #include "lwip/opt.h"
slowness 0:58c3d014a4e7 36 #include "lwip/def.h"
slowness 0:58c3d014a4e7 37 #include "lwip/ip_addr.h"
slowness 0:58c3d014a4e7 38
slowness 0:58c3d014a4e7 39 #ifdef __cplusplus
slowness 0:58c3d014a4e7 40 extern "C" {
slowness 0:58c3d014a4e7 41 #endif
slowness 0:58c3d014a4e7 42
slowness 0:58c3d014a4e7 43 /* For compatibility with BSD code */
slowness 0:58c3d014a4e7 44 struct in_addr {
slowness 0:58c3d014a4e7 45 u32_t s_addr;
slowness 0:58c3d014a4e7 46 };
slowness 0:58c3d014a4e7 47
slowness 0:58c3d014a4e7 48 /** 255.255.255.255 */
slowness 0:58c3d014a4e7 49 #define INADDR_NONE IPADDR_NONE
slowness 0:58c3d014a4e7 50 /** 127.0.0.1 */
slowness 0:58c3d014a4e7 51 #define INADDR_LOOPBACK IPADDR_LOOPBACK
slowness 0:58c3d014a4e7 52 /** 0.0.0.0 */
slowness 0:58c3d014a4e7 53 #define INADDR_ANY IPADDR_ANY
slowness 0:58c3d014a4e7 54 /** 255.255.255.255 */
slowness 0:58c3d014a4e7 55 #define INADDR_BROADCAST IPADDR_BROADCAST
slowness 0:58c3d014a4e7 56
slowness 0:58c3d014a4e7 57 /* Definitions of the bits in an Internet address integer.
slowness 0:58c3d014a4e7 58
slowness 0:58c3d014a4e7 59 On subnets, host and network parts are found according to
slowness 0:58c3d014a4e7 60 the subnet mask, not these masks. */
slowness 0:58c3d014a4e7 61 #define IN_CLASSA(a) IP_CLASSA(a)
slowness 0:58c3d014a4e7 62 #define IN_CLASSA_NET IP_CLASSA_NET
slowness 0:58c3d014a4e7 63 #define IN_CLASSA_NSHIFT IP_CLASSA_NSHIFT
slowness 0:58c3d014a4e7 64 #define IN_CLASSA_HOST IP_CLASSA_HOST
slowness 0:58c3d014a4e7 65 #define IN_CLASSA_MAX IP_CLASSA_MAX
slowness 0:58c3d014a4e7 66
slowness 0:58c3d014a4e7 67 #define IN_CLASSB(b) IP_CLASSB(b)
slowness 0:58c3d014a4e7 68 #define IN_CLASSB_NET IP_CLASSB_NET
slowness 0:58c3d014a4e7 69 #define IN_CLASSB_NSHIFT IP_CLASSB_NSHIFT
slowness 0:58c3d014a4e7 70 #define IN_CLASSB_HOST IP_CLASSB_HOST
slowness 0:58c3d014a4e7 71 #define IN_CLASSB_MAX IP_CLASSB_MAX
slowness 0:58c3d014a4e7 72
slowness 0:58c3d014a4e7 73 #define IN_CLASSC(c) IP_CLASSC(c)
slowness 0:58c3d014a4e7 74 #define IN_CLASSC_NET IP_CLASSC_NET
slowness 0:58c3d014a4e7 75 #define IN_CLASSC_NSHIFT IP_CLASSC_NSHIFT
slowness 0:58c3d014a4e7 76 #define IN_CLASSC_HOST IP_CLASSC_HOST
slowness 0:58c3d014a4e7 77 #define IN_CLASSC_MAX IP_CLASSC_MAX
slowness 0:58c3d014a4e7 78
slowness 0:58c3d014a4e7 79 #define IN_CLASSD(d) IP_CLASSD(d)
slowness 0:58c3d014a4e7 80 #define IN_CLASSD_NET IP_CLASSD_NET /* These ones aren't really */
slowness 0:58c3d014a4e7 81 #define IN_CLASSD_NSHIFT IP_CLASSD_NSHIFT /* net and host fields, but */
slowness 0:58c3d014a4e7 82 #define IN_CLASSD_HOST IP_CLASSD_HOST /* routing needn't know. */
slowness 0:58c3d014a4e7 83 #define IN_CLASSD_MAX IP_CLASSD_MAX
slowness 0:58c3d014a4e7 84
slowness 0:58c3d014a4e7 85 #define IN_MULTICAST(a) IP_MULTICAST(a)
slowness 0:58c3d014a4e7 86
slowness 0:58c3d014a4e7 87 #define IN_EXPERIMENTAL(a) IP_EXPERIMENTAL(a)
slowness 0:58c3d014a4e7 88 #define IN_BADCLASS(a) IP_BADCLASS(a)
slowness 0:58c3d014a4e7 89
slowness 0:58c3d014a4e7 90 #define IN_LOOPBACKNET IP_LOOPBACKNET
slowness 0:58c3d014a4e7 91
slowness 0:58c3d014a4e7 92 #define inet_addr_from_ipaddr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
slowness 0:58c3d014a4e7 93 #define inet_addr_to_ipaddr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
slowness 0:58c3d014a4e7 94 /* ATTENTION: the next define only works because both s_addr and ip_addr_t are an u32_t effectively! */
slowness 0:58c3d014a4e7 95 #define inet_addr_to_ipaddr_p(target_ipaddr_p, source_inaddr) ((target_ipaddr_p) = (ip_addr_t*)&((source_inaddr)->s_addr))
slowness 0:58c3d014a4e7 96
slowness 0:58c3d014a4e7 97 /* directly map this to the lwip internal functions */
slowness 0:58c3d014a4e7 98 #define inet_addr(cp) ipaddr_addr(cp)
slowness 0:58c3d014a4e7 99 #define inet_aton(cp, addr) ipaddr_aton(cp, (ip_addr_t*)addr)
slowness 0:58c3d014a4e7 100 #define inet_ntoa(addr) ipaddr_ntoa((ip_addr_t*)&(addr))
slowness 0:58c3d014a4e7 101 #define inet_ntoa_r(addr, buf, buflen) ipaddr_ntoa_r((ip_addr_t*)&(addr), buf, buflen)
slowness 0:58c3d014a4e7 102
slowness 0:58c3d014a4e7 103 #ifdef __cplusplus
slowness 0:58c3d014a4e7 104 }
slowness 0:58c3d014a4e7 105 #endif
slowness 0:58c3d014a4e7 106
slowness 0:58c3d014a4e7 107 #endif /* __LWIP_INET_H__ */