#include "rtl.h" -> #include <rtl.h>
[reactos.git] / reactos / lib / rtl / network.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2003 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id$
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS system libraries
23 * PURPOSE: Network Address Translation implementation
24 * FILE: lib/rtl/network.c
25 */
26
27 #include <rtl.h>
28
29 #define NDEBUG
30 #include <debug.h>
31 /* FUNCTIONS *****************************************************************/
32
33 /* Borrow this from some headers... */
34 typedef struct
35 {
36 union
37 {
38 struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
39 struct { USHORT s_w1,s_w2; } S_un_w;
40 ULONG S_addr;
41 } S_un;
42 } in_addr;
43
44 typedef struct
45 {
46 union
47 {
48 UCHAR _S6_u8[16];
49 USHORT _S6_u16[8];
50 ULONG _S6_u32[4];
51 } S6_un;
52 } in6_addr;
53
54
55 /*
56 * @implemented
57 */
58 LPSTR
59 STDCALL
60 RtlIpv4AddressToStringA(
61 PULONG IP,
62 LPSTR Buffer
63 )
64 {
65 in_addr addr;
66 addr.S_un.S_addr = *IP;
67 return Buffer + sprintf(Buffer, "%u.%u.%u.%u", addr.S_un.S_un_b.s_b1,
68 addr.S_un.S_un_b.s_b2,
69 addr.S_un.S_un_b.s_b3,
70 addr.S_un.S_un_b.s_b4);
71 }
72
73 /*
74 * @unimplemented
75 */
76 NTSTATUS
77 STDCALL
78 RtlIpv4AddressToStringExA(
79 PULONG IP,
80 PULONG Port,
81 LPSTR Buffer,
82 PULONG MaxSize
83 )
84 {
85 UNIMPLEMENTED;
86 return STATUS_NOT_IMPLEMENTED;
87 }
88
89 /*
90 * @implemented
91 */
92 LPWSTR
93 STDCALL
94 RtlIpv4AddressToStringW(
95 PULONG IP,
96 LPWSTR Buffer
97 )
98 {
99 in_addr addr;
100 addr.S_un.S_addr = *IP;
101 return Buffer + swprintf(Buffer, L"%u.%u.%u.%u", addr.S_un.S_un_b.s_b1,
102 addr.S_un.S_un_b.s_b2,
103 addr.S_un.S_un_b.s_b3,
104 addr.S_un.S_un_b.s_b4);
105 }
106
107 /*
108 * @unimplemented
109 */
110 NTSTATUS
111 STDCALL
112 RtlIpv4AddressToStringExW(
113 PULONG IP,
114 PULONG Port,
115 LPWSTR Buffer,
116 PULONG MaxSize
117 )
118 {
119 UNIMPLEMENTED;
120 return STATUS_NOT_IMPLEMENTED;
121 }
122
123 /*
124 * @unimplemented
125 */
126 NTSTATUS
127 STDCALL
128 RtlIpv4StringToAddressA(
129 IN LPSTR IpString,
130 IN ULONG Base,
131 OUT PVOID PtrToIpAddr,
132 OUT ULONG IpAddr
133 )
134 {
135 UNIMPLEMENTED;
136 return STATUS_NOT_IMPLEMENTED;
137 }
138
139 /*
140 * @unimplemented
141 */
142 NTSTATUS
143 STDCALL
144 RtlIpv4StringToAddressExA(
145 IN LPSTR IpString,
146 IN ULONG Base,
147 OUT PULONG IpAddr,
148 OUT PULONG Port
149 )
150 {
151 UNIMPLEMENTED;
152 return STATUS_NOT_IMPLEMENTED;
153 }
154
155 /*
156 * @unimplemented
157 */
158 NTSTATUS
159 STDCALL
160 RtlIpv4StringToAddressW(
161 IN LPWSTR IpString,
162 IN ULONG Base,
163 OUT PVOID PtrToIpAddr,
164 OUT ULONG IpAddr
165 )
166 {
167 UNIMPLEMENTED;
168 return STATUS_NOT_IMPLEMENTED;
169 }
170
171 /*
172 * @unimplemented
173 */
174 NTSTATUS
175 STDCALL
176 RtlIpv4StringToAddressExW(
177 IN LPWSTR IpString,
178 IN ULONG Base,
179 OUT PULONG IpAddr,
180 OUT PULONG Port
181 )
182 {
183 UNIMPLEMENTED;
184 return STATUS_NOT_IMPLEMENTED;
185 }
186
187 /*
188 * @unimplemented
189 */
190 NTSTATUS
191 STDCALL
192 RtlIpv6AddressToStringA(
193 PULONG IP,
194 LPSTR Buffer
195 )
196 {
197 UNIMPLEMENTED;
198 return STATUS_NOT_IMPLEMENTED;
199 }
200
201 /*
202 * @unimplemented
203 */
204 NTSTATUS
205 STDCALL
206 RtlIpv6AddressToStringExA(
207 PULONG IP,
208 PULONG Port,
209 LPSTR Buffer,
210 PULONG MaxSize
211 )
212 {
213 UNIMPLEMENTED;
214 return STATUS_NOT_IMPLEMENTED;
215 }
216
217 /*
218 * @unimplemented
219 */
220 NTSTATUS
221 STDCALL
222 RtlIpv6AddressToStringW(
223 PULONG IP,
224 LPWSTR Buffer
225 )
226 {
227 UNIMPLEMENTED;
228 return STATUS_NOT_IMPLEMENTED;
229 }
230
231 /*
232 * @unimplemented
233 */
234 NTSTATUS
235 STDCALL
236 RtlIpv6AddressToStringExW(
237 PULONG IP,
238 PULONG Port,
239 LPWSTR Buffer,
240 PULONG MaxSize
241 )
242 {
243 UNIMPLEMENTED;
244 return STATUS_NOT_IMPLEMENTED;
245 }
246
247 /*
248 * @unimplemented
249 */
250 NTSTATUS
251 STDCALL
252 RtlIpv6StringToAddressA(
253 IN LPSTR IpString,
254 IN ULONG Base,
255 OUT PVOID PtrToIpAddr,
256 OUT ULONG IpAddr
257 )
258 {
259 UNIMPLEMENTED;
260 return STATUS_NOT_IMPLEMENTED;
261 }
262
263 /*
264 * @unimplemented
265 */
266 NTSTATUS
267 STDCALL
268 RtlIpv6StringToAddressExA(
269 IN LPSTR IpString,
270 IN ULONG Base,
271 OUT PULONG IpAddr,
272 OUT PULONG Port
273 )
274 {
275 UNIMPLEMENTED;
276 return STATUS_NOT_IMPLEMENTED;
277 }
278
279 /*
280 * @unimplemented
281 */
282 NTSTATUS
283 STDCALL
284 RtlIpv6StringToAddressW(
285 IN LPWSTR IpString,
286 IN ULONG Base,
287 OUT PVOID PtrToIpAddr,
288 OUT ULONG IpAddr
289 )
290 {
291 UNIMPLEMENTED;
292 return STATUS_NOT_IMPLEMENTED;
293 }
294
295 /*
296 * @unimplemented
297 */
298 NTSTATUS
299 STDCALL
300 RtlIpv6StringToAddressExW(
301 IN LPWSTR IpString,
302 IN ULONG Base,
303 OUT PULONG IpAddr,
304 OUT PULONG Port
305 )
306 {
307 UNIMPLEMENTED;
308 return STATUS_NOT_IMPLEMENTED;
309 }
310
311
312 /* EOF */