wut  v1.7.0
Wii U Toolchain
netdb.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdint.h>
3 #include <sys/socket.h>
4 
5 extern int h_errno;
6 
7 struct hostent
8 {
9  char *h_name;
10  char **h_aliases;
12  int h_length;
13  char **h_addr_list;
14 #define h_addr h_addr_list[0]
15 };
16 
17 struct servent
18 {
19  char *s_name;
20  char **s_aliases;
21  int s_port;
22  char *s_proto;
23 };
24 
25 struct addrinfo
26 {
27  int ai_flags;
28  int ai_family;
32  char *ai_canonname;
33  struct sockaddr *ai_addr;
34  struct addrinfo *ai_next;
35 };
36 
37 #define NETDB_INTERNAL -1
38 #define NETDB_SUCCESS 0
39 #define HOST_NOT_FOUND 1
40 #define TRY_AGAIN 2
41 #define NO_RECOVERY 3
42 #define NO_DATA 4
43 #define NO_ADDRESS NO_DATA
44 
45 #define EAI_ADDRFAMILY 1
46 #define EAI_AGAIN 2
47 #define EAI_BADFLAGS 3
48 #define EAI_FAIL 4
49 #define EAI_FAMILY 5
50 #define EAI_MEMORY 6
51 #define EAI_NODATA 7
52 #define EAI_NONAME 8
53 #define EAI_SERVICE 9
54 #define EAI_SOCKTYPE 10
55 #define EAI_SYSTEM 11
56 #define EAI_BADHINTS 12
57 #define EAI_PROTOCOL 13
58 #define EAI_OVERFLOW 14
59 #define EAI_MAX 15
60 
61 #define NI_MAXHOST 1025
62 #define NI_MAXSERV 32
63 
64 // nsysnet only implements NI_NOFQDN, NI_NUMERICHOST and NI_NUMERICSERV
65 #define NI_NOFQDN 0x0001
66 #define NI_NUMERICHOST 0x0002
67 #define NI_NAMEREQD 0x0004
68 #define NI_NUMERICSERV 0x0008
69 #define NI_DGRAM 0x0010
70 #define NI_NUMERICSCOPE 0x0020
71 
72 // nsysnet only implements AI_PASSIVE, AI_CANONNAME and AI_NUMERICHOST
73 #define AI_PASSIVE 0x0001
74 #define AI_CANONNAME 0x0002
75 #define AI_NUMERICHOST 0x0004
76 #define AI_V4MAPPED 0x0008
77 #define AI_ALL 0x0010
78 #define AI_ADDRCONFIG 0x0020
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 struct hostent *
85 gethostbyname(const char *name);
86 
87 struct hostent *
88 gethostbyaddr(const void *addr,
89  socklen_t len,
90  int type);
91 
92 struct hostent *
93 gethostent(void);
94 
95 struct servent *
96 getservbyname(const char *name,
97  const char *proto);
98 
99 struct servent *
100 getservbyport(int port,
101  const char *proto);
102 
103 struct servent *
105 
106 int
107 getaddrinfo(const char *node,
108  const char *service,
109  const struct addrinfo *hints,
110  struct addrinfo **res);
111 
112 void
113 freeaddrinfo(struct addrinfo *res);
114 
115 int
116 getnameinfo(const struct sockaddr *addr,
117  socklen_t addrlen,
118  char *host,
119  socklen_t hostlen,
120  char *serv,
121  socklen_t servlen,
122  int flags);
123 
124 const char *
125 gai_strerror(int ecode);
126 
127 #ifdef __cplusplus
128 }
129 #endif
char ** h_addr_list
Definition: netdb.h:13
struct servent * getservbyport(int port, const char *proto)
struct sockaddr * ai_addr
Definition: netdb.h:33
socklen_t ai_addrlen
Definition: netdb.h:31
int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
int ai_socktype
Definition: netdb.h:29
int h_errno
char * h_name
Definition: netdb.h:9
void freeaddrinfo(struct addrinfo *res)
const char * gai_strerror(int ecode)
int ai_family
Definition: netdb.h:28
struct hostent * gethostent(void)
char * s_proto
Definition: netdb.h:22
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
struct hostent * gethostbyaddr(const void *addr, socklen_t len, int type)
struct hostent * gethostbyname(const char *name)
int s_port
Definition: netdb.h:21
int ai_protocol
Definition: netdb.h:30
char * s_name
Definition: netdb.h:19
char ** s_aliases
Definition: netdb.h:20
int h_addrtype
Definition: netdb.h:11
int ai_flags
Definition: netdb.h:27
char * ai_canonname
Definition: netdb.h:32
int h_length
Definition: netdb.h:12
struct servent * getservbyname(const char *name, const char *proto)
struct addrinfo * ai_next
Definition: netdb.h:34
char ** h_aliases
Definition: netdb.h:10
struct servent * getservent(void)
Definition: netdb.h:26
Definition: netdb.h:8
Definition: netdb.h:18
uint32_t socklen_t
Definition: socket.h:56