The Pedigree Project
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
modules
system
lwip
include
lwip
lwip/netdb.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
25
/*
26
* Redistribution and use in source and binary forms, with or without modification,
27
* are permitted provided that the following conditions are met:
28
*
29
* 1. Redistributions of source code must retain the above copyright notice,
30
* this list of conditions and the following disclaimer.
31
* 2. Redistributions in binary form must reproduce the above copyright notice,
32
* this list of conditions and the following disclaimer in the documentation
33
* and/or other materials provided with the distribution.
34
* 3. The name of the author may not be used to endorse or promote products
35
* derived from this software without specific prior written permission.
36
*
37
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
38
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
39
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
40
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
41
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
45
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
46
* OF SUCH DAMAGE.
47
*
48
* This file is part of the lwIP TCP/IP stack.
49
*
50
* Author: Simon Goldschmidt
51
*
52
*/
53
#ifndef LWIP_HDR_NETDB_H
54
#define LWIP_HDR_NETDB_H
55
56
#include "
lwip/opt.h
"
57
58
#if LWIP_DNS && LWIP_SOCKET
59
60
#include "
lwip/arch.h
"
61
#include "
lwip/inet.h
"
62
#include "
lwip/sockets.h
"
63
64
#ifdef __cplusplus
65
extern
"C"
{
66
#endif
67
68
/* some rarely used options */
69
#ifndef LWIP_DNS_API_DECLARE_H_ERRNO
70
#define LWIP_DNS_API_DECLARE_H_ERRNO 1
71
#endif
72
73
#ifndef LWIP_DNS_API_DEFINE_ERRORS
74
#define LWIP_DNS_API_DEFINE_ERRORS 1
75
#endif
76
77
#ifndef LWIP_DNS_API_DEFINE_FLAGS
78
#define LWIP_DNS_API_DEFINE_FLAGS 1
79
#endif
80
81
#ifndef LWIP_DNS_API_DECLARE_STRUCTS
82
#define LWIP_DNS_API_DECLARE_STRUCTS 1
83
#endif
84
85
#if LWIP_DNS_API_DEFINE_ERRORS
86
87
#define EAI_NONAME 200
88
#define EAI_SERVICE 201
89
#define EAI_FAIL 202
90
#define EAI_MEMORY 203
91
#define EAI_FAMILY 204
92
93
#define HOST_NOT_FOUND 210
94
#define NO_DATA 211
95
#define NO_RECOVERY 212
96
#define TRY_AGAIN 213
97
#endif
/* LWIP_DNS_API_DEFINE_ERRORS */
98
99
#if LWIP_DNS_API_DEFINE_FLAGS
100
/* input flags for struct addrinfo */
101
#define AI_PASSIVE 0x01
102
#define AI_CANONNAME 0x02
103
#define AI_NUMERICHOST 0x04
104
#define AI_NUMERICSERV 0x08
105
#define AI_V4MAPPED 0x10
106
#define AI_ALL 0x20
107
#define AI_ADDRCONFIG 0x40
108
#endif
/* LWIP_DNS_API_DEFINE_FLAGS */
109
110
#if LWIP_DNS_API_DECLARE_STRUCTS
111
struct
hostent {
112
char
*h_name;
/* Official name of the host. */
113
char
**h_aliases;
/* A pointer to an array of pointers to alternative host names,
114
terminated by a null pointer. */
115
int
h_addrtype;
/* Address type. */
116
int
h_length;
/* The length, in bytes, of the address. */
117
char
**h_addr_list;
/* A pointer to an array of pointers to network addresses (in
118
network byte order) for the host, terminated by a null pointer. */
119
#define h_addr h_addr_list[0]
/* for backward compatibility */
120
};
121
122
struct
addrinfo {
123
int
ai_flags;
/* Input flags. */
124
int
ai_family;
/* Address family of socket. */
125
int
ai_socktype;
/* Socket type. */
126
int
ai_protocol;
/* Protocol of socket. */
127
socklen_t ai_addrlen;
/* Length of socket address. */
128
struct
sockaddr *ai_addr;
/* Socket address of socket. */
129
char
*ai_canonname;
/* Canonical name of service location. */
130
struct
addrinfo *ai_next;
/* Pointer to next in list. */
131
};
132
#endif
/* LWIP_DNS_API_DECLARE_STRUCTS */
133
134
#define NETDB_ELEM_SIZE (sizeof(struct addrinfo) + sizeof(struct sockaddr_storage) + DNS_MAX_NAME_LENGTH + 1)
135
136
#if LWIP_DNS_API_DECLARE_H_ERRNO
137
/* application accessible error code set by the DNS API functions */
138
extern
int
h_errno;
139
#endif
/* LWIP_DNS_API_DECLARE_H_ERRNO*/
140
141
struct
hostent *lwip_gethostbyname(
const
char
*name);
142
int
lwip_gethostbyname_r(
const
char
*name,
struct
hostent *ret,
char
*buf,
143
size_t
buflen,
struct
hostent **result,
int
*h_errnop);
144
void
lwip_freeaddrinfo(
struct
addrinfo *ai);
145
int
lwip_getaddrinfo(
const
char
*nodename,
146
const
char
*servname,
147
const
struct
addrinfo *hints,
148
struct
addrinfo **res);
149
150
#if LWIP_COMPAT_SOCKETS
151
152
#define gethostbyname(name) lwip_gethostbyname(name)
153
154
#define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
155
lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
156
157
#define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
158
159
#define getaddrinfo(nodname, servname, hints, res) \
160
lwip_getaddrinfo(nodname, servname, hints, res)
161
#endif
/* LWIP_COMPAT_SOCKETS */
162
163
#ifdef __cplusplus
164
}
165
#endif
166
167
#endif
/* LWIP_DNS && LWIP_SOCKET */
168
169
#endif
/* LWIP_HDR_NETDB_H */
opt.h
inet.h
arch.h
sockets.h
Generated on Fri Jan 24 2020 06:46:14 for The Pedigree Project by
1.8.11