1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * COPYRIGHT:   See COPYING in the top level directory
3*c2c66affSColin Finck  * PROJECT:     ReactOS TCP/IP protocol driver
4*c2c66affSColin Finck  * FILE:        include/address.h
5*c2c66affSColin Finck  * PURPOSE:     Address manipulation prototypes
6*c2c66affSColin Finck  */
7*c2c66affSColin Finck 
8*c2c66affSColin Finck #pragma once
9*c2c66affSColin Finck 
10*c2c66affSColin Finck /*
11*c2c66affSColin Finck  * Initialize an IPv4 style address
12*c2c66affSColin Finck  * VOID AddrInitIPv4(
13*c2c66affSColin Finck  *     PIP_ADDRESS IPAddress,
14*c2c66affSColin Finck  *     IPv4_RAW_ADDRESS RawAddress)
15*c2c66affSColin Finck  */
16*c2c66affSColin Finck #define AddrInitIPv4(IPAddress, RawAddress)           \
17*c2c66affSColin Finck {                                                     \
18*c2c66affSColin Finck     (IPAddress)->Type                = IP_ADDRESS_V4; \
19*c2c66affSColin Finck     (IPAddress)->Address.IPv4Address = (RawAddress);  \
20*c2c66affSColin Finck }
21*c2c66affSColin Finck 
22*c2c66affSColin Finck #if DBG
23*c2c66affSColin Finck 
24*c2c66affSColin Finck PCHAR A2S(
25*c2c66affSColin Finck     PIP_ADDRESS Address);
26*c2c66affSColin Finck 
27*c2c66affSColin Finck #endif /* DBG */
28*c2c66affSColin Finck 
29*c2c66affSColin Finck VOID IPAddressFree(
30*c2c66affSColin Finck     PVOID Object);
31*c2c66affSColin Finck 
32*c2c66affSColin Finck BOOLEAN AddrIsUnspecified(
33*c2c66affSColin Finck     PIP_ADDRESS Address);
34*c2c66affSColin Finck 
35*c2c66affSColin Finck NTSTATUS AddrGetAddress(
36*c2c66affSColin Finck     PTRANSPORT_ADDRESS AddrList,
37*c2c66affSColin Finck     PIP_ADDRESS Address,
38*c2c66affSColin Finck     PUSHORT Port);
39*c2c66affSColin Finck 
40*c2c66affSColin Finck NTSTATUS AddrBuildAddress(
41*c2c66affSColin Finck     PTRANSPORT_ADDRESS TdiAddress,
42*c2c66affSColin Finck     PIP_ADDRESS Address,
43*c2c66affSColin Finck     PUSHORT Port);
44*c2c66affSColin Finck 
45*c2c66affSColin Finck BOOLEAN AddrIsEqual(
46*c2c66affSColin Finck     PIP_ADDRESS Address1,
47*c2c66affSColin Finck     PIP_ADDRESS Address2);
48*c2c66affSColin Finck 
49*c2c66affSColin Finck INT AddrCompare(
50*c2c66affSColin Finck     PIP_ADDRESS Address1,
51*c2c66affSColin Finck     PIP_ADDRESS Address2);
52*c2c66affSColin Finck 
53*c2c66affSColin Finck BOOLEAN AddrIsEqualIPv4(
54*c2c66affSColin Finck     PIP_ADDRESS Address1,
55*c2c66affSColin Finck     IPv4_RAW_ADDRESS Address2);
56*c2c66affSColin Finck 
57*c2c66affSColin Finck PIP_INTERFACE AddrLocateInterface(
58*c2c66affSColin Finck     PIP_ADDRESS MatchAddress);
59*c2c66affSColin Finck 
60*c2c66affSColin Finck PADDRESS_FILE AddrSearchFirst(
61*c2c66affSColin Finck     PIP_ADDRESS Address,
62*c2c66affSColin Finck     USHORT Port,
63*c2c66affSColin Finck     USHORT Protocol,
64*c2c66affSColin Finck     PAF_SEARCH SearchContext);
65*c2c66affSColin Finck 
66*c2c66affSColin Finck PADDRESS_FILE AddrSearchNext(
67*c2c66affSColin Finck     PAF_SEARCH SearchContext);
68*c2c66affSColin Finck 
69*c2c66affSColin Finck unsigned long NTAPI inet_addr(const char*);
70*c2c66affSColin Finck 
71*c2c66affSColin Finck ULONG IPv4NToHl( ULONG Address );
72*c2c66affSColin Finck 
73*c2c66affSColin Finck UINT AddrCountPrefixBits( PIP_ADDRESS Netmask );
74*c2c66affSColin Finck 
75*c2c66affSColin Finck VOID AddrWidenAddress( PIP_ADDRESS Network, PIP_ADDRESS Source,
76*c2c66affSColin Finck 		       PIP_ADDRESS Netmask );
77*c2c66affSColin Finck 
78*c2c66affSColin Finck /* EOF */
79