libctru  v2.4.1
netdb.h
1 #pragma once
2 
3 #include <netinet/in.h>
4 
5 #define HOST_NOT_FOUND 1
6 #define NO_DATA 2
7 #define NO_ADDRESS NO_DATA
8 #define NO_RECOVERY 3
9 #define TRY_AGAIN 4
10 
11 struct hostent {
12  char *h_name; /* official name of host */
13  char **h_aliases; /* alias list */
14  uint16_t h_addrtype; /* host address type */
15  uint16_t h_length; /* length of address */
16  char **h_addr_list; /* list of addresses from name server */
17 };
18 #define h_addr h_addr_list[0] /* for backward compatibility */
19 
20 #define AI_PASSIVE 0x01
21 #define AI_CANONNAME 0x02
22 #define AI_NUMERICHOST 0x04
23 #define AI_NUMERICSERV 0x00 /* probably 0x08 but services names are never resolved */
24 
25 // doesn't apply to 3ds
26 #define AI_ADDRCONFIG 0x00
27 
28 
29 #define NI_MAXHOST 1025
30 #define NI_MAXSERV 32
31 
32 #define NI_NOFQDN 0x01
33 #define NI_NUMERICHOST 0x02
34 #define NI_NAMEREQD 0x04
35 #define NI_NUMERICSERV 0x00 /* probably 0x08 but services names are never resolved */
36 #define NI_DGRAM 0x00 /* probably 0x10 but services names are never resolved */
37 
38 #define EAI_FAMILY (-303)
39 #define EAI_MEMORY (-304)
40 #define EAI_NONAME (-305)
41 #define EAI_SOCKTYPE (-307)
42 
43 struct addrinfo {
44  int ai_flags;
45  int ai_family;
46  int ai_socktype;
47  int ai_protocol;
48  socklen_t ai_addrlen;
49  char *ai_canonname;
50  struct sockaddr *ai_addr;
51  struct addrinfo *ai_next;
52 };
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58  extern int h_errno;
59  struct hostent* gethostbyname(const char *name);
60  struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type);
61  void herror(const char *s);
62  const char* hstrerror(int err);
63 
64  int getnameinfo(const struct sockaddr *sa, socklen_t salen,
65  char *host, socklen_t hostlen,
66  char *serv, socklen_t servlen, int flags);
67 
68  int getaddrinfo(const char *node, const char *service,
69  const struct addrinfo *hints,
70  struct addrinfo **res);
71 
72  void freeaddrinfo(struct addrinfo *ai);
73 
74  const char *gai_strerror(int ecode);
75 #ifdef __cplusplus
76 }
77 #endif
Definition: netdb.h:43
Definition: netdb.h:11
Definition: socket.h:52