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

Dependencies:   mbed

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?

UserRevisionLine numberNew contents of line
mbedalvaro 0:f76708a93fb3 1 /*
mbedalvaro 0:f76708a93fb3 2 * Redistribution and use in source and binary forms, with or without modification,
mbedalvaro 0:f76708a93fb3 3 * are permitted provided that the following conditions are met:
mbedalvaro 0:f76708a93fb3 4 *
mbedalvaro 0:f76708a93fb3 5 * 1. Redistributions of source code must retain the above copyright notice,
mbedalvaro 0:f76708a93fb3 6 * this list of conditions and the following disclaimer.
mbedalvaro 0:f76708a93fb3 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbedalvaro 0:f76708a93fb3 8 * this list of conditions and the following disclaimer in the documentation
mbedalvaro 0:f76708a93fb3 9 * and/or other materials provided with the distribution.
mbedalvaro 0:f76708a93fb3 10 * 3. The name of the author may not be used to endorse or promote products
mbedalvaro 0:f76708a93fb3 11 * derived from this software without specific prior written permission.
mbedalvaro 0:f76708a93fb3 12 *
mbedalvaro 0:f76708a93fb3 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbedalvaro 0:f76708a93fb3 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbedalvaro 0:f76708a93fb3 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbedalvaro 0:f76708a93fb3 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbedalvaro 0:f76708a93fb3 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbedalvaro 0:f76708a93fb3 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbedalvaro 0:f76708a93fb3 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbedalvaro 0:f76708a93fb3 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbedalvaro 0:f76708a93fb3 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbedalvaro 0:f76708a93fb3 22 * OF SUCH DAMAGE.
mbedalvaro 0:f76708a93fb3 23 *
mbedalvaro 0:f76708a93fb3 24 * This file is part of the lwIP TCP/IP stack.
mbedalvaro 0:f76708a93fb3 25 *
mbedalvaro 0:f76708a93fb3 26 * Author: Simon Goldschmidt
mbedalvaro 0:f76708a93fb3 27 *
mbedalvaro 0:f76708a93fb3 28 */
mbedalvaro 0:f76708a93fb3 29 #ifndef __LWIP_NETDB_H__
mbedalvaro 0:f76708a93fb3 30 #define __LWIP_NETDB_H__
mbedalvaro 0:f76708a93fb3 31
mbedalvaro 0:f76708a93fb3 32 #include "lwip/opt.h"
mbedalvaro 0:f76708a93fb3 33
mbedalvaro 0:f76708a93fb3 34 #if LWIP_DNS && LWIP_SOCKET
mbedalvaro 0:f76708a93fb3 35
mbedalvaro 0:f76708a93fb3 36 #include <stddef.h> /* for size_t */
mbedalvaro 0:f76708a93fb3 37
mbedalvaro 0:f76708a93fb3 38 #include "lwip/inet.h"
mbedalvaro 0:f76708a93fb3 39 #include "lwip/sockets.h"
mbedalvaro 0:f76708a93fb3 40
mbedalvaro 0:f76708a93fb3 41 /* some rarely used options */
mbedalvaro 0:f76708a93fb3 42 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
mbedalvaro 0:f76708a93fb3 43 #define LWIP_DNS_API_DECLARE_H_ERRNO 1
mbedalvaro 0:f76708a93fb3 44 #endif
mbedalvaro 0:f76708a93fb3 45
mbedalvaro 0:f76708a93fb3 46 #ifndef LWIP_DNS_API_DEFINE_ERRORS
mbedalvaro 0:f76708a93fb3 47 #define LWIP_DNS_API_DEFINE_ERRORS 1
mbedalvaro 0:f76708a93fb3 48 #endif
mbedalvaro 0:f76708a93fb3 49
mbedalvaro 0:f76708a93fb3 50 #ifndef LWIP_DNS_API_DECLARE_STRUCTS
mbedalvaro 0:f76708a93fb3 51 #define LWIP_DNS_API_DECLARE_STRUCTS 1
mbedalvaro 0:f76708a93fb3 52 #endif
mbedalvaro 0:f76708a93fb3 53
mbedalvaro 0:f76708a93fb3 54 #if LWIP_DNS_API_DEFINE_ERRORS
mbedalvaro 0:f76708a93fb3 55 /** Errors used by the DNS API functions, h_errno can be one of them */
mbedalvaro 0:f76708a93fb3 56 #define EAI_NONAME 200
mbedalvaro 0:f76708a93fb3 57 #define EAI_SERVICE 201
mbedalvaro 0:f76708a93fb3 58 #define EAI_FAIL 202
mbedalvaro 0:f76708a93fb3 59 #define EAI_MEMORY 203
mbedalvaro 0:f76708a93fb3 60
mbedalvaro 0:f76708a93fb3 61 #define HOST_NOT_FOUND 210
mbedalvaro 0:f76708a93fb3 62 #define NO_DATA 211
mbedalvaro 0:f76708a93fb3 63 #define NO_RECOVERY 212
mbedalvaro 0:f76708a93fb3 64 #define TRY_AGAIN 213
mbedalvaro 0:f76708a93fb3 65 #endif /* LWIP_DNS_API_DEFINE_ERRORS */
mbedalvaro 0:f76708a93fb3 66
mbedalvaro 0:f76708a93fb3 67 #if LWIP_DNS_API_DECLARE_STRUCTS
mbedalvaro 0:f76708a93fb3 68 struct hostent {
mbedalvaro 0:f76708a93fb3 69 char *h_name; /* Official name of the host. */
mbedalvaro 0:f76708a93fb3 70 char **h_aliases; /* A pointer to an array of pointers to alternative host names,
mbedalvaro 0:f76708a93fb3 71 terminated by a null pointer. */
mbedalvaro 0:f76708a93fb3 72 int h_addrtype; /* Address type. */
mbedalvaro 0:f76708a93fb3 73 int h_length; /* The length, in bytes, of the address. */
mbedalvaro 0:f76708a93fb3 74 char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
mbedalvaro 0:f76708a93fb3 75 network byte order) for the host, terminated by a null pointer. */
mbedalvaro 0:f76708a93fb3 76 #define h_addr h_addr_list[0] /* for backward compatibility */
mbedalvaro 0:f76708a93fb3 77 };
mbedalvaro 0:f76708a93fb3 78
mbedalvaro 0:f76708a93fb3 79 struct addrinfo {
mbedalvaro 0:f76708a93fb3 80 int ai_flags; /* Input flags. */
mbedalvaro 0:f76708a93fb3 81 int ai_family; /* Address family of socket. */
mbedalvaro 0:f76708a93fb3 82 int ai_socktype; /* Socket type. */
mbedalvaro 0:f76708a93fb3 83 int ai_protocol; /* Protocol of socket. */
mbedalvaro 0:f76708a93fb3 84 socklen_t ai_addrlen; /* Length of socket address. */
mbedalvaro 0:f76708a93fb3 85 struct sockaddr *ai_addr; /* Socket address of socket. */
mbedalvaro 0:f76708a93fb3 86 char *ai_canonname; /* Canonical name of service location. */
mbedalvaro 0:f76708a93fb3 87 struct addrinfo *ai_next; /* Pointer to next in list. */
mbedalvaro 0:f76708a93fb3 88 };
mbedalvaro 0:f76708a93fb3 89 #endif /* LWIP_DNS_API_DECLARE_STRUCTS */
mbedalvaro 0:f76708a93fb3 90
mbedalvaro 0:f76708a93fb3 91 #if LWIP_DNS_API_DECLARE_H_ERRNO
mbedalvaro 0:f76708a93fb3 92 /* application accessable error code set by the DNS API functions */
mbedalvaro 0:f76708a93fb3 93 extern int h_errno;
mbedalvaro 0:f76708a93fb3 94 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/
mbedalvaro 0:f76708a93fb3 95
mbedalvaro 0:f76708a93fb3 96 struct hostent *lwip_gethostbyname(const char *name);
mbedalvaro 0:f76708a93fb3 97 int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
mbedalvaro 0:f76708a93fb3 98 size_t buflen, struct hostent **result, int *h_errnop);
mbedalvaro 0:f76708a93fb3 99 void lwip_freeaddrinfo(struct addrinfo *ai);
mbedalvaro 0:f76708a93fb3 100 int lwip_getaddrinfo(const char *nodename,
mbedalvaro 0:f76708a93fb3 101 const char *servname,
mbedalvaro 0:f76708a93fb3 102 const struct addrinfo *hints,
mbedalvaro 0:f76708a93fb3 103 struct addrinfo **res);
mbedalvaro 0:f76708a93fb3 104
mbedalvaro 0:f76708a93fb3 105 #if LWIP_COMPAT_SOCKETS
mbedalvaro 0:f76708a93fb3 106 #define gethostbyname(name) lwip_gethostbyname(name)
mbedalvaro 0:f76708a93fb3 107 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
mbedalvaro 0:f76708a93fb3 108 lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
mbedalvaro 0:f76708a93fb3 109 #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
mbedalvaro 0:f76708a93fb3 110 #define getaddrinfo(nodname, servname, hints, res) \
mbedalvaro 0:f76708a93fb3 111 lwip_getaddrinfo(nodname, servname, hints, res)
mbedalvaro 0:f76708a93fb3 112 #endif /* LWIP_COMPAT_SOCKETS */
mbedalvaro 0:f76708a93fb3 113
mbedalvaro 0:f76708a93fb3 114 #endif /* LWIP_DNS && LWIP_SOCKET */
mbedalvaro 0:f76708a93fb3 115
mbedalvaro 0:f76708a93fb3 116 #endif /* __LWIP_NETDB_H__ */