~ubuntu-branches/ubuntu/trusty/emscripten/trusty-proposed

« back to all changes in this revision

Viewing changes to system/include/libc/netdb.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140119141240-jg1l42cc158j59tn
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _NETDB_H
 
2
#define _NETDB_H
 
3
 
 
4
#ifdef __cplusplus
 
5
extern "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
 
 
16
struct 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 */
 
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
 
 
57
int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
 
58
void freeaddrinfo (struct addrinfo *);
 
59
int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
 
60
const char *gai_strerror(int);
 
61
 
 
62
 
 
63
/* Legacy functions follow (marked OBsolete in SUS) */
 
64
 
 
65
struct netent
 
66
{
 
67
        char *n_name;
 
68
        char **n_aliases;
 
69
        int n_addrtype;
 
70
        uint32_t n_net;
 
71
};
 
72
 
 
73
struct 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
 
 
83
struct servent
 
84
{
 
85
        char *s_name;
 
86
        char **s_aliases;
 
87
        int s_port;
 
88
        char *s_proto;
 
89
};
 
90
 
 
91
struct protoent
 
92
{
 
93
        char *p_name;
 
94
        char **p_aliases;
 
95
        int p_proto;
 
96
};
 
97
 
 
98
void sethostent (int);
 
99
void endhostent (void);
 
100
struct hostent *gethostent (void);
 
101
 
 
102
void setnetent (int);
 
103
void endnetent (void);
 
104
struct netent *getnetent (void);
 
105
struct netent *getnetbyaddr (uint32_t, int);
 
106
struct netent *getnetbyname (const char *);
 
107
 
 
108
void setservent (int);
 
109
void endservent (void);
 
110
struct servent *getservent (void);
 
111
struct servent *getservbyname (const char *, const char *);
 
112
struct servent *getservbyport (int, const char *);
 
113
 
 
114
void setprotoent (int);
 
115
void endprotoent (void);
 
116
struct protoent *getprotoent (void);
 
117
struct protoent *getprotobyname (const char *);
 
118
struct 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)
 
123
struct hostent *gethostbyname (const char *);
 
124
struct hostent *gethostbyaddr (const void *, socklen_t, int);
 
125
#ifdef __GNUC__
 
126
__attribute__((const))
 
127
#endif
 
128
int *__h_errno_location(void);
 
129
#define h_errno (*__h_errno_location())
 
130
#define HOST_NOT_FOUND 1
 
131
#define TRY_AGAIN      2
 
132
#define NO_RECOVERY    3
 
133
#define NO_DATA        4
 
134
#endif
 
135
 
 
136
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 
137
const char *hstrerror(int);
 
138
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
 
139
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
 
140
struct hostent *gethostbyname2(const char *, int);
 
141
int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
 
142
int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
 
143
int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
 
144
#define EAI_NODATA     -5
 
145
#define EAI_ADDRFAMILY -9
 
146
#define EAI_INPROGRESS -100
 
147
#define EAI_CANCELED   -101
 
148
#define EAI_NOTCANCELED -102
 
149
#define EAI_ALLDONE    -103
 
150
#define EAI_INTR       -104
 
151
#define EAI_IDN_ENCODE -105
 
152
#define NI_MAXHOST 255
 
153
#define NI_MAXSERV 32
 
154
#endif
 
155
 
 
156
 
 
157
#ifdef __cplusplus
 
158
}
 
159
#endif
 
160
 
 
161
#endif