migrate substitution keywords to SVN
[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 <ddk/ntddk.h>
28 #include <stdio.h>
29
30 #define NDEBUG
31 #include <debug.h>
32 /* FUNCTIONS *****************************************************************/
33
34 /* Borrow this from some headers... */
35 typedef struct
36 {
37 union
38 {
39 struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
40 struct { USHORT s_w1,s_w2; } S_un_w;
41 ULONG S_addr;
42 } S_un;
43 } in_addr;
44
45 typedef struct
46 {
47 union
48 {
49 UCHAR _S6_u8[16];
50 USHORT _S6_u16[8];
51 ULONG _S6_u32[4];
52 } S6_un;
53 } in6_addr;
54
55
56 /*
57 * @implemented
58 */
59 LPSTR
60 STDCALL
61 RtlIpv4AddressToStringA(
62 PULONG IP,
63 LPSTR Buffer
64 )
65 {
66 in_addr addr;
67 addr.S_un.S_addr = *IP;
68 return Buffer + sprintf(Buffer, "%u.%u.%u.%u", addr.S_un.S_un_b.s_b1,
69 addr.S_un.S_un_b.s_b2,
70 addr.S_un.S_un_b.s_b3,
71 addr.S_un.S_un_b.s_b4);
72 }
73
74 /*
75 * @unimplemented
76 */
77 NTSTATUS
78 STDCALL
79 RtlIpv4AddressToStringExA(
80 PULONG IP,
81 PULONG Port,
82 LPSTR Buffer,
83 PULONG MaxSize
84 )
85 {
86 UNIMPLEMENTED;
87 return STATUS_NOT_IMPLEMENTED;
88 }
89
90 /*
91 * @implemented
92 */
93 LPWSTR
94 STDCALL
95 RtlIpv4AddressToStringW(
96 PULONG IP,
97 LPWSTR Buffer
98 )
99 {
100 in_addr addr;
101 addr.S_un.S_addr = *IP;
102 return Buffer + swprintf(Buffer, L"%u.%u.%u.%u", addr.S_un.S_un_b.s_b1,
103 addr.S_un.S_un_b.s_b2,
104 addr.S_un.S_un_b.s_b3,
105 addr.S_un.S_un_b.s_b4);
106 }
107
108 /*
109 * @unimplemented
110 */
111 NTSTATUS
112 STDCALL
113 RtlIpv4AddressToStringExW(
114 PULONG IP,
115 PULONG Port,
116 LPWSTR Buffer,
117 PULONG MaxSize
118 )
119 {
120 UNIMPLEMENTED;
121 return STATUS_NOT_IMPLEMENTED;
122 }
123
124 /*
125 * @unimplemented
126 */
127 NTSTATUS
128 STDCALL
129 RtlIpv4StringToAddressA(
130 IN LPSTR IpString,
131 IN ULONG Base,
132 OUT PVOID PtrToIpAddr,
133 OUT ULONG IpAddr
134 )
135 {
136 UNIMPLEMENTED;
137 return STATUS_NOT_IMPLEMENTED;
138 }
139
140 /*
141 * @unimplemented
142 */
143 NTSTATUS
144 STDCALL
145 RtlIpv4StringToAddressExA(
146 IN LPSTR IpString,
147 IN ULONG Base,
148 OUT PULONG IpAddr,
149 OUT PULONG Port
150 )
151 {
152 UNIMPLEMENTED;
153 return STATUS_NOT_IMPLEMENTED;
154 }
155
156 /*
157 * @unimplemented
158 */
159 NTSTATUS
160 STDCALL
161 RtlIpv4StringToAddressW(
162 IN LPWSTR IpString,
163 IN ULONG Base,
164 OUT PVOID PtrToIpAddr,
165 OUT ULONG IpAddr
166 )
167 {
168 UNIMPLEMENTED;
169 return STATUS_NOT_IMPLEMENTED;
170 }
171
172 /*
173 * @unimplemented
174 */
175 NTSTATUS
176 STDCALL
177 RtlIpv4StringToAddressExW(
178 IN LPWSTR IpString,
179 IN ULONG Base,
180 OUT PULONG IpAddr,
181 OUT PULONG Port
182 )
183 {
184 UNIMPLEMENTED;
185 return STATUS_NOT_IMPLEMENTED;
186 }
187
188 /*
189 * @unimplemented
190 */
191 NTSTATUS
192 STDCALL
193 RtlIpv6AddressToStringA(
194 PULONG IP,
195 LPSTR Buffer
196 )
197 {
198 UNIMPLEMENTED;
199 return STATUS_NOT_IMPLEMENTED;
200 }
201
202 /*
203 * @unimplemented
204 */
205 NTSTATUS
206 STDCALL
207 RtlIpv6AddressToStringExA(
208 PULONG IP,
209 PULONG Port,
210 LPSTR Buffer,
211 PULONG MaxSize
212 )
213 {
214 UNIMPLEMENTED;
215 return STATUS_NOT_IMPLEMENTED;
216 }
217
218 /*
219 * @unimplemented
220 */
221 NTSTATUS
222 STDCALL
223 RtlIpv6AddressToStringW(
224 PULONG IP,
225 LPWSTR Buffer
226 )
227 {
228 UNIMPLEMENTED;
229 return STATUS_NOT_IMPLEMENTED;
230 }
231
232 /*
233 * @unimplemented
234 */
235 NTSTATUS
236 STDCALL
237 RtlIpv6AddressToStringExW(
238 PULONG IP,
239 PULONG Port,
240 LPWSTR Buffer,
241 PULONG MaxSize
242 )
243 {
244 UNIMPLEMENTED;
245 return STATUS_NOT_IMPLEMENTED;
246 }
247
248 /*
249 * @unimplemented
250 */
251 NTSTATUS
252 STDCALL
253 RtlIpv6StringToAddressA(
254 IN LPSTR IpString,
255 IN ULONG Base,
256 OUT PVOID PtrToIpAddr,
257 OUT ULONG IpAddr
258 )
259 {
260 UNIMPLEMENTED;
261 return STATUS_NOT_IMPLEMENTED;
262 }
263
264 /*
265 * @unimplemented
266 */
267 NTSTATUS
268 STDCALL
269 RtlIpv6StringToAddressExA(
270 IN LPSTR IpString,
271 IN ULONG Base,
272 OUT PULONG IpAddr,
273 OUT PULONG Port
274 )
275 {
276 UNIMPLEMENTED;
277 return STATUS_NOT_IMPLEMENTED;
278 }
279
280 /*
281 * @unimplemented
282 */
283 NTSTATUS
284 STDCALL
285 RtlIpv6StringToAddressW(
286 IN LPWSTR IpString,
287 IN ULONG Base,
288 OUT PVOID PtrToIpAddr,
289 OUT ULONG IpAddr
290 )
291 {
292 UNIMPLEMENTED;
293 return STATUS_NOT_IMPLEMENTED;
294 }
295
296 /*
297 * @unimplemented
298 */
299 NTSTATUS
300 STDCALL
301 RtlIpv6StringToAddressExW(
302 IN LPWSTR IpString,
303 IN ULONG Base,
304 OUT PULONG IpAddr,
305 OUT PULONG Port
306 )
307 {
308 UNIMPLEMENTED;
309 return STATUS_NOT_IMPLEMENTED;
310 }
311
312
313 /* EOF */