comparison druntime/import/stdc/posix/arpa/inet.d @ 760:6f33b427bfd1

Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 12 Nov 2008 00:19:18 +0100
parents
children
comparison
equal deleted inserted replaced
759:d3eb054172f9 760:6f33b427bfd1
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 stdc.posix.arpa.inet;
10
11 private import stdc.posix.config;
12 public import stdc.inttypes : uint32_t, uint16_t;
13 public import stdc.posix.sys.socket : socklen_t;
14
15 extern (C):
16
17 //
18 // Required
19 //
20 /*
21 in_port_t // from stdc.posix.netinet.in_
22 in_addr_t // from stdc.posix.netinet.in_
23
24 struct in_addr // from stdc.posix.netinet.in_
25 INET_ADDRSTRLEN // from stdc.posix.netinet.in_
26
27 uint32_t // from stdc.inttypes
28 uint16_t // from stdc.inttypes
29
30 uint32_t htonl(uint32_t);
31 uint16_t htons(uint16_t);
32 uint32_t ntohl(uint32_t);
33 uint16_t ntohs(uint16_t);
34
35 in_addr_t inet_addr(in char*);
36 char* inet_ntoa(in_addr);
37 // per spec: const char* inet_ntop(int, const void*, char*, socklen_t);
38 char* inet_ntop(int, in void*, char*, socklen_t);
39 int inet_pton(int, in char*, void*);
40 */
41
42 version( linux )
43 {
44 alias uint16_t in_port_t;
45 alias uint32_t in_addr_t;
46
47 struct in_addr
48 {
49 in_addr_t s_addr;
50 }
51
52 const INET_ADDRSTRLEN = 16;
53
54 uint32_t htonl(uint32_t);
55 uint16_t htons(uint16_t);
56 uint32_t ntohl(uint32_t);
57 uint16_t ntohs(uint16_t);
58
59 in_addr_t inet_addr(in char*);
60 char* inet_ntoa(in_addr);
61 char* inet_ntop(int, in void*, char*, socklen_t);
62 int inet_pton(int, in char*, void*);
63 }
64 else version( darwin )
65 {
66 alias uint16_t in_port_t; // TODO: verify
67 alias uint32_t in_addr_t; // TODO: verify
68
69 struct in_addr
70 {
71 in_addr_t s_addr;
72 }
73
74 const INET_ADDRSTRLEN = 16;
75
76 uint32_t htonl(uint32_t);
77 uint16_t htons(uint16_t);
78 uint32_t ntohl(uint32_t);
79 uint16_t ntohs(uint16_t);
80
81 in_addr_t inet_addr(in char*);
82 char* inet_ntoa(in_addr);
83 char* inet_ntop(int, in void*, char*, socklen_t);
84 int inet_pton(int, in char*, void*);
85 }
86 else version( freebsd )
87 {
88 alias uint16_t in_port_t; // TODO: verify
89 alias uint32_t in_addr_t; // TODO: verify
90
91 struct in_addr
92 {
93 in_addr_t s_addr;
94 }
95
96 const INET_ADDRSTRLEN = 16;
97
98 uint32_t htonl(uint32_t);
99 uint16_t htons(uint16_t);
100 uint32_t ntohl(uint32_t);
101 uint16_t ntohs(uint16_t);
102
103 in_addr_t inet_addr(in char*);
104 char* inet_ntoa(in_addr);
105 char* inet_ntop(int, in void*, char*, socklen_t);
106 int inet_pton(int, in char*, void*);
107 }
108
109 //
110 // IPV6 (IP6)
111 //
112 /*
113 INET6_ADDRSTRLEN // from stdc.posix.netinet.in_
114 */
115
116 version( linux )
117 {
118 const INET6_ADDRSTRLEN = 46;
119 }
120 else version( darwin )
121 {
122 const INET6_ADDRSTRLEN = 46;
123 }
124 else version( freebsd )
125 {
126 const INET6_ADDRSTRLEN = 46;
127 }