1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *  * Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 *  * Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in
12 *    the documentation and/or other materials provided with the
13 *    distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <netdb.h>
30
31#include "header_checks.h"
32
33static void netdb_h() {
34  TYPE(struct hostent);
35  STRUCT_MEMBER(struct hostent, char*, h_name);
36  STRUCT_MEMBER(struct hostent, char**, h_aliases);
37  STRUCT_MEMBER(struct hostent, int, h_addrtype);
38  STRUCT_MEMBER(struct hostent, int, h_length);
39  STRUCT_MEMBER(struct hostent, char**, h_addr_list);
40
41  TYPE(struct netent);
42  STRUCT_MEMBER(struct netent, char*, n_name);
43  STRUCT_MEMBER(struct netent, char**, n_aliases);
44  STRUCT_MEMBER(struct netent, int, n_addrtype);
45  STRUCT_MEMBER(struct netent, uint32_t, n_net);
46
47  TYPE(uint32_t);
48
49  TYPE(struct protoent);
50  STRUCT_MEMBER(struct protoent, char*, p_name);
51  STRUCT_MEMBER(struct protoent, char**, p_aliases);
52  STRUCT_MEMBER(struct protoent, int, p_proto);
53
54
55  TYPE(struct servent);
56  STRUCT_MEMBER(struct servent, char*, s_name);
57  STRUCT_MEMBER(struct servent, char**, s_aliases);
58  STRUCT_MEMBER(struct servent, int, s_port);
59  STRUCT_MEMBER(struct servent, char*, s_proto);
60
61  MACRO(IPPORT_RESERVED);
62
63  TYPE(struct addrinfo);
64  STRUCT_MEMBER(struct addrinfo, int, ai_flags);
65  STRUCT_MEMBER(struct addrinfo, int, ai_family);
66  STRUCT_MEMBER(struct addrinfo, int, ai_socktype);
67  STRUCT_MEMBER(struct addrinfo, int, ai_protocol);
68  STRUCT_MEMBER(struct addrinfo, socklen_t, ai_addrlen);
69  STRUCT_MEMBER(struct addrinfo, struct sockaddr*, ai_addr);
70  STRUCT_MEMBER(struct addrinfo, char*, ai_canonname);
71  STRUCT_MEMBER(struct addrinfo, struct addrinfo*, ai_next);
72
73  MACRO(AI_PASSIVE);
74  MACRO(AI_CANONNAME);
75  MACRO(AI_NUMERICHOST);
76  MACRO(AI_NUMERICSERV);
77  MACRO(AI_V4MAPPED);
78  MACRO(AI_ALL);
79  MACRO(AI_ADDRCONFIG);
80
81  MACRO(NI_NOFQDN);
82  MACRO(NI_NUMERICHOST);
83  MACRO(NI_NAMEREQD);
84  MACRO(NI_NUMERICSERV);
85#if !defined(__BIONIC__) && !defined(__GLIBC__)
86  MACRO(NI_NUMERICSCOPE);
87#endif
88  MACRO(NI_DGRAM);
89
90  MACRO(EAI_AGAIN);
91  MACRO(EAI_BADFLAGS);
92  MACRO(EAI_FAIL);
93  MACRO(EAI_FAMILY);
94  MACRO(EAI_MEMORY);
95  MACRO(EAI_NONAME);
96  MACRO(EAI_SERVICE);
97  MACRO(EAI_SOCKTYPE);
98  MACRO(EAI_SYSTEM);
99  MACRO(EAI_OVERFLOW);
100
101  FUNCTION(endhostent, void (*f)(void));
102  FUNCTION(endnetent, void (*f)(void));
103  FUNCTION(endprotoent, void (*f)(void));
104  FUNCTION(endservent, void (*f)(void));
105  FUNCTION(freeaddrinfo, void (*f)(struct addrinfo*));
106  FUNCTION(gai_strerror, const char* (*f)(int));
107  FUNCTION(getaddrinfo, int (*f)(const char*, const char*, const struct addrinfo*, struct addrinfo**));
108  FUNCTION(gethostent, struct hostent* (*f)(void));
109#if defined(__BIONIC__) // Historical ABI accident.
110  FUNCTION(getnameinfo, int (*f)(const struct sockaddr*, socklen_t, char*, size_t, char*, size_t, int));
111#else
112  FUNCTION(getnameinfo, int (*f)(const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, int));
113#endif
114  FUNCTION(getnetbyaddr, struct netent* (*f)(uint32_t, int));
115  FUNCTION(getnetbyname, struct netent* (*f)(const char*));
116  FUNCTION(getnetent, struct netent* (*f)(void));
117  FUNCTION(getprotobyname, struct protoent* (*f)(const char*));
118  FUNCTION(getprotobynumber, struct protoent* (*f)(int));
119  FUNCTION(getprotoent, struct protoent* (*f)(void));
120  FUNCTION(getservbyname, struct servent* (*f)(const char*, const char*));
121  FUNCTION(getservbyport, struct servent* (*f)(int, const char*));
122  FUNCTION(getservent, struct servent* (*f)(void));
123  FUNCTION(sethostent, void (*f)(int));
124  FUNCTION(setnetent, void (*f)(int));
125  FUNCTION(setprotoent, void (*f)(int));
126  FUNCTION(setservent, void (*f)(int));
127
128  TYPE(socklen_t);
129}
130