Mercurial > projects > ldc
comparison tango/tango/stdc/posix/netinet/in_.d @ 132:1700239cab2e trunk
[svn r136] MAJOR UNSTABLE UPDATE!!!
Initial commit after moving to Tango instead of Phobos.
Lots of bugfixes...
This build is not suitable for most things.
author | lindquist |
---|---|
date | Fri, 11 Jan 2008 17:57:40 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
1 /** | |
2 * D header file for POSIX. | |
3 * | |
4 * Copyright: Public Domain | |
5 * License: Public Domain | |
6 * Authors: Sean Kelly | |
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition | |
8 */ | |
9 module tango.stdc.posix.netinet.in_; | |
10 | |
11 private import tango.stdc.posix.config; | |
12 public import tango.stdc.inttypes : uint32_t, uint16_t; | |
13 public import tango.stdc.posix.arpa.inet; | |
14 | |
15 extern (C): | |
16 | |
17 // | |
18 // Required | |
19 // | |
20 /* | |
21 NOTE: The following must must be defined in tango.stdc.posix.arpa.inet to break | |
22 a circular import: in_port_t, in_addr_t, struct in_addr, INET_ADDRSTRLEN. | |
23 | |
24 in_port_t | |
25 in_addr_t | |
26 | |
27 sa_family_t | |
28 uint8_t // from tango.stdc.inttypes | |
29 uint32_t // from tango.stdc.inttypes | |
30 | |
31 struct in_addr | |
32 { | |
33 in_addr_t s_addr; | |
34 } | |
35 | |
36 struct sockaddr_in | |
37 { | |
38 sa_family_t sin_family; | |
39 in_port_t sin_port; | |
40 in_addr sin_addr; | |
41 } | |
42 | |
43 IPPROTO_IP | |
44 IPPROTO_ICMP | |
45 IPPROTO_TCP | |
46 IPPROTO_UDP | |
47 | |
48 INADDR_ANY | |
49 INADDR_BROADCAST | |
50 | |
51 INET_ADDRSTRLEN | |
52 | |
53 htonl() // from tango.stdc.posix.arpa.inet | |
54 htons() // from tango.stdc.posix.arpa.inet | |
55 ntohl() // from tango.stdc.posix.arpa.inet | |
56 ntohs() // from tango.stdc.posix.arpa.inet | |
57 */ | |
58 | |
59 version( linux ) | |
60 { | |
61 alias ushort sa_family_t; | |
62 | |
63 private const __SOCK_SIZE__ = 16; | |
64 | |
65 struct sockaddr_in | |
66 { | |
67 sa_family_t sin_family; | |
68 in_port_t sin_port; | |
69 in_addr sin_addr; | |
70 | |
71 /* Pad to size of `struct sockaddr'. */ | |
72 ubyte[__SOCK_SIZE__ - sa_family_t.sizeof - | |
73 in_port_t.sizeof - in_addr.sizeof] __pad; | |
74 } | |
75 | |
76 enum | |
77 { | |
78 IPPROTO_IP = 0, | |
79 IPPROTO_ICMP = 1, | |
80 IPPROTO_TCP = 6, | |
81 IPPROTO_UDP = 17 | |
82 } | |
83 | |
84 const c_ulong INADDR_ANY = 0x00000000; | |
85 const c_ulong INADDR_BROADCAST = 0xffffffff; | |
86 } | |
87 else version( darwin ) | |
88 { | |
89 | |
90 } | |
91 | |
92 | |
93 // | |
94 // IPV6 (IP6) | |
95 // | |
96 /* | |
97 NOTE: The following must must be defined in tango.stdc.posix.arpa.inet to break | |
98 a circular import: INET6_ADDRSTRLEN. | |
99 | |
100 uint8_t[16] s6_addr; | |
101 | |
102 struct sockaddr_in6 | |
103 { | |
104 sa_family_t sin6_family; | |
105 in_port_t sin6_port; | |
106 uint32_t sin6_flowinfo; | |
107 in6_addr sin6_addr; | |
108 uint32_t sin6_scope_id; | |
109 } | |
110 | |
111 extern in6_addr in6addr_any; | |
112 extern in6_addr in6addr_loopback; | |
113 | |
114 struct ipv6_mreq | |
115 { | |
116 in6_addr ipv6mr_multiaddr; | |
117 uint ipv6mr_interface; | |
118 } | |
119 | |
120 IPPROTO_IPV6 | |
121 | |
122 INET6_ADDRSTRLEN | |
123 | |
124 IPV6_JOIN_GROUP | |
125 IPV6_LEAVE_GROUP | |
126 IPV6_MULTICAST_HOPS | |
127 IPV6_MULTICAST_IF | |
128 IPV6_MULTICAST_LOOP | |
129 IPV6_UNICAST_HOPS | |
130 IPV6_V6ONLY | |
131 | |
132 // macros | |
133 int IN6_IS_ADDR_UNSPECIFIED(in6_addr*) | |
134 int IN6_IS_ADDR_LOOPBACK(in6_addr*) | |
135 int IN6_IS_ADDR_MULTICAST(in6_addr*) | |
136 int IN6_IS_ADDR_LINKLOCAL(in6_addr*) | |
137 int IN6_IS_ADDR_SITELOCAL(in6_addr*) | |
138 int IN6_IS_ADDR_V4MAPPED(in6_addr*) | |
139 int IN6_IS_ADDR_V4COMPAT(in6_addr*) | |
140 int IN6_IS_ADDR_MC_NODELOCAL(in6_addr*) | |
141 int IN6_IS_ADDR_MC_LINKLOCAL(in6_addr*) | |
142 int IN6_IS_ADDR_MC_SITELOCAL(in6_addr*) | |
143 int IN6_IS_ADDR_MC_ORGLOCAL(in6_addr*) | |
144 int IN6_IS_ADDR_MC_GLOBAL(in6_adddr*) | |
145 */ | |
146 | |
147 | |
148 // | |
149 // Raw Sockets (RS) | |
150 // | |
151 /* | |
152 IPPROTO_RAW | |
153 */ |