~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to system/include/net/netinet/in.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#endif
8
8
 
9
9
#include <arpa/inet.h>
 
10
#include <stdint.h>
10
11
 
11
12
enum {
12
13
    IPPROTO_IP = 0,
13
 
#define IPPROTO_IP IPPROTO_IP
14
 
    IPPROTO_TCP = 1,
15
 
#define IPPROTO_TCP IPPROTO_TCP
16
 
    IPPROTO_UDP = 2,
17
 
#define IPPROTO_UDP IPPROTO_UDP
 
14
#define IPPROTO_IP              IPPROTO_IP
 
15
    IPPROTO_HOPOPTS = 0,
 
16
#define IPPROTO_HOPOPTS         IPPROTO_HOPOPTS
 
17
    IPPROTO_ICMP = 1,
 
18
#define IPPROTO_ICMP            IPPROTO_ICMP
 
19
    IPPROTO_IGMP = 2,
 
20
#define IPPROTO_IGMP            IPPROTO_IGMP
 
21
    IPPROTO_IPIP = 4,
 
22
#define IPPROTO_IPIP            IPPROTO_IPIP
 
23
    IPPROTO_TCP = 6,
 
24
#define IPPROTO_TCP             IPPROTO_TCP
 
25
    IPPROTO_EGP = 8,
 
26
#define IPPROTO_EGP             IPPROTO_EGP
 
27
    IPPROTO_PUP = 12,
 
28
#define IPPROTO_PUP             IPPROTO_PUP
 
29
    IPPROTO_UDP = 17,
 
30
#define IPPROTO_UDP             IPPROTO_UDP
 
31
    IPPROTO_IDP = 22,
 
32
#define IPPROTO_IDP             IPPROTO_IDP
 
33
    IPPROTO_TP = 29,
 
34
#define IPPROTO_TP              IPPROTO_TP
 
35
    IPPROTO_DCCP = 33,
 
36
#define IPPROTO_DCCP            IPPROTO_DCCP
 
37
    IPPROTO_IPV6 = 41,
 
38
#define IPPROTO_IPV6            IPPROTO_IPV6
 
39
    IPPROTO_ROUTING = 43,
 
40
#define IPPROTO_ROUTING         IPPROTO_ROUTING
 
41
    IPPROTO_FRAGMENT = 44,
 
42
#define IPPROTO_FRAGMENT        IPPROTO_FRAGMENT
 
43
    IPPROTO_RSVP = 46,
 
44
#define IPPROTO_RSVP            IPPROTO_RSVP
 
45
    IPPROTO_GRE = 47,
 
46
#define IPPROTO_GRE             IPPROTO_GRE
 
47
    IPPROTO_ESP = 50,
 
48
#define IPPROTO_ESP             IPPROTO_ESP
 
49
    IPPROTO_AH = 51,
 
50
#define IPPROTO_AH              IPPROTO_AH
 
51
    IPPROTO_ICMPV6 = 58,
 
52
#define IPPROTO_ICMPV6          IPPROTO_ICMPV6
 
53
    IPPROTO_NONE = 59,
 
54
#define IPPROTO_NONE            IPPROTO_NONE
 
55
    IPPROTO_DSTOPTS = 60,
 
56
#define IPPROTO_DSTOPTS         IPPROTO_DSTOPTS
 
57
    IPPROTO_MTP = 92,
 
58
#define IPPROTO_MTP             IPPROTO_MTP
 
59
    IPPROTO_ENCAP = 98,
 
60
#define IPPROTO_ENCAP           IPPROTO_ENCAP
 
61
    IPPROTO_PIM = 103,
 
62
#define IPPROTO_PIM             IPPROTO_PIM
 
63
    IPPROTO_COMP = 108,
 
64
#define IPPROTO_COMP            IPPROTO_COMP
 
65
    IPPROTO_SCTP = 132,
 
66
#define IPPROTO_SCTP            IPPROTO_SCTP
 
67
    IPPROTO_UDPLITE = 136,
 
68
#define IPPROTO_UDPLITE         IPPROTO_UDPLITE
 
69
    IPPROTO_RAW = 255,
 
70
#define IPPROTO_RAW             IPPROTO_RAW
18
71
    IPPROTO_MAX
19
72
};
20
73
 
21
74
#define INET_ADDRSTRLEN 16
 
75
#define INET6_ADDRSTRLEN 46
22
76
 
23
77
#define INADDR_ANY 0
 
78
#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
24
79
 
25
80
struct in_addr {
26
81
  unsigned long s_addr;
34
89
};
35
90
 
36
91
struct in6_addr {
37
 
  unsigned char s6_addr[16];
 
92
  union {
 
93
    uint8_t _s6_addr8[16];
 
94
    uint16_t _s6_addr16[8];
 
95
    uint32_t _s6_addr32[4];
 
96
  } _u;
 
97
#define s6_addr _u._s6_addr8
 
98
#define s6_addr16 _u._s6_addr16
 
99
#define s6_addr32 _u._s6_addr32
38
100
};
39
101
 
 
102
extern const struct in6_addr in6addr_any;
 
103
extern const struct in6_addr in6addr_loopback;
 
104
extern const struct in6_addr in6addr_linklocal_allnodes;
 
105
extern const struct in6_addr in6addr_linklocal_allrouters;
 
106
extern const struct in6_addr in6addr_interfacelocal_allnodes;
 
107
extern const struct in6_addr in6addr_interfacelocal_allrouters;
 
108
extern const struct in6_addr in6addr_sitelocal_allrouters;
 
109
 
 
110
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
 
111
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
 
112
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
 
113
        { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
 
114
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
 
115
        { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
 
116
 
40
117
struct sockaddr_in6 {
41
 
  short           sin6_family;
42
 
  short           sin6_port;
 
118
  int             sin6_family;
 
119
  unsigned short  sin6_port;
43
120
  int             sin6_flowinfo;
44
121
  struct in6_addr sin6_addr;
45
122
  int             sin6_scope_id;
50
127
  struct in_addr imr_interface;
51
128
};
52
129
 
 
130
#define IP_PMTUDISC_DONT          0
 
131
#define IP_PMTUDISC_WANT          1
 
132
#define IP_PMTUDISC_DO            2
 
133
#define IP_PMTUDISC_PROBE         3
 
134
 
53
135
#define IP_MULTICAST_IF 32
54
136
#define IP_MULTICAST_TTL 33
55
137
#define IP_MULTICAST_LOOP 34
70
152
#define IP_MULTICAST_ALL 49
71
153
#define IP_UNICAST_IF 50
72
154
 
 
155
/*
 
156
 * Tests for IPv6 address types
 
157
 */
 
158
 
 
159
#define IN6_IS_ADDR_LINKLOCAL(addr) \
 
160
        (((addr)->s6_addr32[0] & htonl(0xffc00000)) == htonl(0xfe800000))
 
161
 
 
162
#define IN6_IS_ADDR_LOOPBACK(addr) \
 
163
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
 
164
         ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] == htonl(1)))
 
165
 
 
166
#define IN6_IS_ADDR_MULTICAST(addr) \
 
167
        ((addr)->s6_addr8[0] == 0xff)
 
168
        
 
169
#define IN6_IS_ADDR_SITELOCAL(addr) \
 
170
        (((addr)->s6_addr32[0] & htonl(0xffc00000)) == htonl(0xfec00000))
 
171
 
 
172
#define IN6_IS_ADDR_UNSPECIFIED(addr) \
 
173
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
 
174
         ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] == 0))
 
175
 
 
176
#define IN6_IS_ADDR_V4COMPAT(addr) \
 
177
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
 
178
         ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] & ~htonl(1)))
 
179
 
 
180
#define IN6_IS_ADDR_V4MAPPED(addr) \
 
181
        (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
 
182
         ((addr)->s6_addr32[2] == htonl(0xffff)))
 
183
 
 
184
#define IN6_ARE_ADDR_EQUAL(addr1, addr2) \
 
185
        (((addr1)->s6_addr32[0] == (addr2)->s6_addr32[0]) && \
 
186
         ((addr1)->s6_addr32[1] == (addr2)->s6_addr32[1]) && \
 
187
         ((addr1)->s6_addr32[2] == (addr2)->s6_addr32[2]) && \
 
188
         ((addr1)->s6_addr32[3] == (addr2)->s6_addr32[3]))
 
189
 
 
190
/*
 
191
 * IPv6 Multicast scoping.  The scope is stored
 
192
 * in the bottom 4 bits of the second byte of the
 
193
 * multicast address.
 
194
 */
 
195
                     /* 0x0 */  /* reserved */
 
196
#define IN6_NODE_LOCAL  0x1     /* node-local scope */
 
197
#define IN6_LINK_LOCAL  0x2     /* link-local scope */
 
198
                     /* 0x3 */  /* (unassigned) */
 
199
                     /* 0x4 */  /* (unassigned) */
 
200
#define IN6_SITE_LOCAL  0x5     /* site-local scope */
 
201
                     /* 0x6 */  /* (unassigned) */
 
202
                     /* 0x7 */  /* (unassigned) */
 
203
#define IN6_ORG_LOCAL   0x8     /* organization-local scope */
 
204
                     /* 0x9 */  /* (unassigned) */
 
205
                     /* 0xA */  /* (unassigned) */
 
206
                     /* 0xB */  /* (unassigned) */
 
207
                     /* 0xC */  /* (unassigned) */
 
208
                     /* 0xD */  /* (unassigned) */
 
209
#define IN6_GLOBAL      0xE     /* global scope */
 
210
                     /* 0xF */  /* reserved */
 
211
 
 
212
#define IN6_MSCOPE(addr)        ((addr)->s6_addr8[1] & 0x0f)
 
213
 
 
214
#define IN6_IS_ADDR_MC_NODELOCAL(addr) \
 
215
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_NODE_LOCAL))
 
216
#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
 
217
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_LINK_LOCAL))
 
218
#define IN6_IS_ADDR_MC_SITELOCAL(addr) \
 
219
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_SITE_LOCAL))
 
220
#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
 
221
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_ORG_LOCAL))
 
222
#define IN6_IS_ADDR_MC_GLOBAL(addr) \
 
223
        (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_GLOBAL))
 
224
 
73
225
#ifdef __cplusplus
74
226
}
75
227
#endif