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