40675af7f8f94e91d9fd8be6465bb0ac203ab9a4
[libc-test] / src / api / netdb.c
1 #include <netdb.h>
2 #define T(t) (t*)0;
3 #define F(t,n) {t *y = &x.n;}
4 #define C(n) switch(n){case n:;}
5 static void f()
6 {
7 T(uint32_t)
8 T(socklen_t)
9 C(IPPORT_RESERVED)
10 {
11 struct hostent x;
12 F(char*, h_name)
13 F(char**, h_aliases)
14 F(int, h_addrtype)
15 F(int, h_length)
16 F(char**, h_addr_list)
17 }
18 {
19 struct netent x;
20 F(char*, n_name)
21 F(char**, n_aliases)
22 F(int, n_addrtype)
23 F(uint32_t, n_net)
24 }
25 {
26 struct protoent x;
27 F(char*, p_name)
28 F(char**, p_aliases)
29 F(int, p_proto)
30 }
31 {
32 struct servent x;
33 F(char*, s_name)
34 F(char**, s_aliases)
35 F(int, s_port)
36 F(char*, s_proto)
37 }
38 {
39 struct addrinfo x;
40 F(int, ai_flags)
41 F(int, ai_family)
42 F(int, ai_socktype)
43 F(int, ai_protocol)
44 F(socklen_t, ai_addrlen)
45 F(struct sockaddr*, ai_addr)
46 F(char*, ai_canonname)
47 F(struct addrinfo*, ai_next)
48 }
49 C(AI_PASSIVE)
50 C(AI_CANONNAME)
51 C(AI_NUMERICHOST)
52 C(AI_NUMERICSERV)
53 C(AI_V4MAPPED)
54 C(AI_ALL)
55 C(AI_ADDRCONFIG)
56 C(NI_NOFQDN)
57 C(NI_NUMERICHOST)
58 C(NI_NAMEREQD)
59 C(NI_NUMERICSERV)
60 C(NI_NUMERICSCOPE)
61 C(NI_DGRAM)
62 C(EAI_AGAIN)
63 C(EAI_BADFLAGS)
64 C(EAI_FAIL)
65 C(EAI_FAMILY)
66 C(EAI_MEMORY)
67 C(EAI_NONAME)
68 C(EAI_SERVICE)
69 C(EAI_SOCKTYPE)
70 C(EAI_SYSTEM)
71 C(EAI_OVERFLOW)
72 void(*p_endhostent)(void) = endhostent;
73 void(*p_endnetent)(void) = endnetent;
74 void(*p_endprotoent)(void) = endprotoent;
75 void(*p_endservent)(void) = endservent;
76 const char*(*p_gai_strerror)(int) = gai_strerror;
77 struct hostent*(*p_gethostent)(void) = gethostent;
78 struct netent*(*p_getnetbyaddr)(uint32_t,int) = getnetbyaddr;
79 struct netent*(*p_getnetbyname)(const char*) = getnetbyname;
80 struct netent*(*p_getnetent)(void) = getnetent;
81 struct protoent*(*p_getprotobyname)(const char*) = getprotobyname;
82 struct protoent*(*p_getprotobynumber)(int) = getprotobynumber;
83 struct protoent*(*p_getprotoent)(void) = getprotoent;
84 struct servent*(*p_getservbyname)(const char*,const char*) = getservbyname;
85 struct servent*(*p_getservbyport)(int,const char*) = getservbyport;
86 struct servent*(*p_getservent)(void) = getservent;
87 void(*p_sethostent)(int) = sethostent;
88 void(*p_setnetent)(int) = setnetent;
89 void(*p_setprotoent)(int) = setprotoent;
90 void(*p_setservent)(int) = setservent;
91 }
92 #include <sys/socket.h>
93 static void g()
94 {
95 void(*p_freeaddrinfo)(struct addrinfo*) = freeaddrinfo;
96 int(*p_getaddrinfo)(const char*restrict,const char*restrict,const struct addrinfo*restrict,struct addrinfo**restrict) = getaddrinfo;
97 int(*p_getnameinfo)(const struct sockaddr*restrict,socklen_t,char*restrict,socklen_t,char*restrict,socklen_t,int) = getnameinfo;
98 }