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:
Sat Aug 23 05:39:17 2014 -0700
Revision:
17:7268f365676b
Fixes and documentation updates

Who changed what in which revision?

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