Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Committer:
dan_ackme
Date:
Mon Oct 27 13:42:26 2014 -0700
Revision:
29:b6af04b77a56
refactored library layout

Who changed what in which revision?

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