source: EcnlProtoTool/trunk/musl-1.1.12/include/netdb.h@ 279

Last change on this file since 279 was 279, checked in by coas-nagasima, 7 years ago

ファイルを追加、更新。

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 3.9 KB
Line 
1#ifndef _NETDB_H
2#define _NETDB_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <features.h>
9#include <netinet/in.h>
10
11#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
12#define __NEED_size_t
13#include <bits/alltypes.h>
14#endif
15
16struct addrinfo
17{
18 int ai_flags;
19 int ai_family;
20 int ai_socktype;
21 int ai_protocol;
22 socklen_t ai_addrlen;
23 struct sockaddr *ai_addr;
24 char *ai_canonname;
25 struct addrinfo *ai_next;
26};
27
28#define IPPORT_RESERVED 1024
29
30#define AI_PASSIVE 0x01
31#define AI_CANONNAME 0x02
32#define AI_NUMERICHOST 0x04
33#define AI_V4MAPPED 0x08
34#define AI_ALL 0x10
35#define AI_ADDRCONFIG 0x20
36#define AI_NUMERICSERV 0x400
37
38
39#define NI_NUMERICHOST 0x01
40#define NI_NUMERICSERV 0x02
41#define NI_NOFQDN 0x04
42#define NI_NAMEREQD 0x08
43#define NI_DGRAM 0x10
44#define NI_NUMERICSCOPE 0x100
45
46#define EAI_BADFLAGS -1
47#define EAI_NONAME -2
48#define EAI_AGAIN -3
49#define EAI_FAIL -4
50#define EAI_FAMILY -6
51#define EAI_SOCKTYPE -7
52#define EAI_SERVICE -8
53#define EAI_MEMORY -10
54#define EAI_SYSTEM -11
55#define EAI_OVERFLOW -12
56
57int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
58void freeaddrinfo (struct addrinfo *);
59int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
60const char *gai_strerror(int);
61
62
63/* Legacy functions follow (marked OBsolete in SUS) */
64
65struct netent
66{
67 char *n_name;
68 char **n_aliases;
69 int n_addrtype;
70 uint32_t n_net;
71};
72
73struct hostent
74{
75 char *h_name;
76 char **h_aliases;
77 int h_addrtype;
78 int h_length;
79 char **h_addr_list;
80};
81#define h_addr h_addr_list[0]
82
83struct servent
84{
85 char *s_name;
86 char **s_aliases;
87 int s_port;
88 char *s_proto;
89};
90
91struct protoent
92{
93 char *p_name;
94 char **p_aliases;
95 int p_proto;
96};
97
98void sethostent (int);
99void endhostent (void);
100struct hostent *gethostent (void);
101
102void setnetent (int);
103void endnetent (void);
104struct netent *getnetent (void);
105struct netent *getnetbyaddr (uint32_t, int);
106struct netent *getnetbyname (const char *);
107
108void setservent (int);
109void endservent (void);
110struct servent *getservent (void);
111struct servent *getservbyname (const char *, const char *);
112struct servent *getservbyport (int, const char *);
113
114void setprotoent (int);
115void endprotoent (void);
116struct protoent *getprotoent (void);
117struct protoent *getprotobyname (const char *);
118struct protoent *getprotobynumber (int);
119
120#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
121 || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
122 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
123struct hostent *gethostbyname (const char *);
124struct hostent *gethostbyaddr (const void *, socklen_t, int);
125int *__h_errno_location(void);
126#define h_errno (*__h_errno_location())
127#define HOST_NOT_FOUND 1
128#define TRY_AGAIN 2
129#define NO_RECOVERY 3
130#define NO_DATA 4
131#define NO_ADDRESS NO_DATA
132#endif
133
134#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
135void herror(const char *);
136const char *hstrerror(int);
137int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
138int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
139struct hostent *gethostbyname2(const char *, int);
140int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
141int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
142int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
143#define EAI_NODATA -5
144#define EAI_ADDRFAMILY -9
145#define EAI_INPROGRESS -100
146#define EAI_CANCELED -101
147#define EAI_NOTCANCELED -102
148#define EAI_ALLDONE -103
149#define EAI_INTR -104
150#define EAI_IDN_ENCODE -105
151#define NI_MAXHOST 255
152#define NI_MAXSERV 32
153#endif
154
155
156#ifdef __cplusplus
157}
158#endif
159
160#endif
Note: See TracBrowser for help on using the repository browser.