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