Adapted to Lora Semtech + Nucleo

Dependencies:   DebugLib

Dependents:   LoRaWAN-lmic-app LoRaWAN-lmic-app LoRaWAN-test-10secs LoRaPersonalizedDeviceForEverynet ... more

Fork of lwip_ppp_ethernet by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers netdb.h Source File

netdb.h

00001 /*
00002  * Redistribution and use in source and binary forms, with or without modification, 
00003  * are permitted provided that the following conditions are met:
00004  *
00005  * 1. Redistributions of source code must retain the above copyright notice,
00006  *    this list of conditions and the following disclaimer.
00007  * 2. Redistributions in binary form must reproduce the above copyright notice,
00008  *    this list of conditions and the following disclaimer in the documentation
00009  *    and/or other materials provided with the distribution.
00010  * 3. The name of the author may not be used to endorse or promote products
00011  *    derived from this software without specific prior written permission. 
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
00014  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00015  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00016  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00017  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00018  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00019  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00020  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00021  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00022  * OF SUCH DAMAGE.
00023  *
00024  * This file is part of the lwIP TCP/IP stack.
00025  * 
00026  * Author: Simon Goldschmidt
00027  *
00028  */
00029 #ifndef __LWIP_NETDB_H__
00030 #define __LWIP_NETDB_H__
00031 
00032 #include "lwip/opt.h"
00033 
00034 #if LWIP_DNS && LWIP_SOCKET
00035 
00036 #include <stddef.h> /* for size_t */
00037 
00038 #include "lwip/inet.h"
00039 #include "lwip/sockets.h"
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 /* some rarely used options */
00046 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
00047 #define LWIP_DNS_API_DECLARE_H_ERRNO 1
00048 #endif
00049 
00050 #ifndef LWIP_DNS_API_DEFINE_ERRORS
00051 #define LWIP_DNS_API_DEFINE_ERRORS 1
00052 #endif
00053 
00054 #ifndef LWIP_DNS_API_DECLARE_STRUCTS
00055 #define LWIP_DNS_API_DECLARE_STRUCTS 1
00056 #endif
00057 
00058 #if LWIP_DNS_API_DEFINE_ERRORS
00059 /** Errors used by the DNS API functions, h_errno can be one of them */
00060 #define EAI_NONAME      200
00061 #define EAI_SERVICE     201
00062 #define EAI_FAIL        202
00063 #define EAI_MEMORY      203
00064 
00065 #define HOST_NOT_FOUND  210
00066 #define NO_DATA         211
00067 #define NO_RECOVERY     212
00068 #define TRY_AGAIN       213
00069 #endif /* LWIP_DNS_API_DEFINE_ERRORS */
00070 
00071 #if LWIP_DNS_API_DECLARE_STRUCTS
00072 struct hostent {
00073     char  *h_name;      /* Official name of the host. */
00074     char **h_aliases;   /* A pointer to an array of pointers to alternative host names,
00075                            terminated by a null pointer. */
00076     int    h_addrtype;  /* Address type. */
00077     int    h_length;    /* The length, in bytes, of the address. */
00078     char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
00079                            network byte order) for the host, terminated by a null pointer. */
00080 #define h_addr h_addr_list[0] /* for backward compatibility */
00081 };
00082 
00083 struct addrinfo {
00084     int               ai_flags;      /* Input flags. */
00085     int               ai_family;     /* Address family of socket. */
00086     int               ai_socktype;   /* Socket type. */
00087     int               ai_protocol;   /* Protocol of socket. */
00088     socklen_t         ai_addrlen;    /* Length of socket address. */
00089     struct sockaddr  *ai_addr;       /* Socket address of socket. */
00090     char             *ai_canonname;  /* Canonical name of service location. */
00091     struct addrinfo  *ai_next;       /* Pointer to next in list. */
00092 };
00093 #endif /* LWIP_DNS_API_DECLARE_STRUCTS */
00094 
00095 #if LWIP_DNS_API_DECLARE_H_ERRNO
00096 /* application accessable error code set by the DNS API functions */
00097 extern int h_errno;
00098 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/
00099 
00100 struct hostent *lwip_gethostbyname(const char *name);
00101 int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
00102                 size_t buflen, struct hostent **result, int *h_errnop);
00103 void lwip_freeaddrinfo(struct addrinfo *ai);
00104 int lwip_getaddrinfo(const char *nodename,
00105        const char *servname,
00106        const struct addrinfo *hints,
00107        struct addrinfo **res);
00108 
00109 #if LWIP_COMPAT_SOCKETS
00110 #define gethostbyname(name) lwip_gethostbyname(name)
00111 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
00112        lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
00113 #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
00114 #define getaddrinfo(nodname, servname, hints, res) \
00115        lwip_getaddrinfo(nodname, servname, hints, res)
00116 #endif /* LWIP_COMPAT_SOCKETS */
00117 
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121 
00122 #endif /* LWIP_DNS && LWIP_SOCKET */
00123 
00124 #endif /* __LWIP_NETDB_H__ */