VR-Link API Documentation for DIS
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vlutil
vlInetAddr.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 1992-2010 VT MAK
3
** All rights reserved.
4
*********************************************************************/
8
#pragma once
9
10
#include <
vlutil/vlInet.h
>
11
#include <
vlutil/vlInetAddrUtils.h
>
12
#include <
vlutil/vlString.h
>
13
#include <
vlutil/vlUtilTypes.h
>
14
15
#ifdef DtUSE_UTILITIES_NAMESPACE
16
namespace
DtUSE_UTILITIES_NAMESPACE
17
{
18
#endif
19
20
// Ref. RFC3513
22
enum
DtInetIpv6Scope
23
{
24
DtInetIpv6_Unspecified
,
25
DtInetIpv6_Interface
= 1,
// AKA node-local
26
DtInetIpv6_LinkLocal
= 2,
27
DtInetIpv6_Subnet
= 3,
// MS only, not in RFC3513
28
DtInetIpv6_AdminLocal
= 4,
// in RFC3513, but not used in Linux
29
DtInetIpv6_SiteLocal
= 5,
30
DtInetIpv6_OrgLocal
= 8,
31
DtInetIpv6_Global
= 14
32
};
33
36
class
DT_DLL_VLUTIL
DtInetAddr
37
{
38
public
:
39
42
DtInetAddr
(
DtInetUtils::DtInetAddrFamily
family =
DtInetUtils::DtInetAddrFamily_IPv4
);
43
50
DtInetAddr
(
const
DtString
& addrString,
const
DtString
& netmaskString =
""
);
51
DtInetAddr
(
const
char
* addrString,
const
char
* netmaskString = NULL );
53
58
DtInetAddr
(
const
struct
sockaddr_in& addr,
DtU32
netmask = 0 );
59
DtInetAddr
(
const
DtU32
addr,
DtU32
netmask = 0 );
61
63
DtInetAddr
(
const
struct
sockaddr_in6& addr,
DtU32
prefixLen = 0 );
64
67
DtInetAddr
(
const
struct
sockaddr_storage& addr,
DtU32
prefixLen = 0 );
68
72
DtInetAddr
(
const
DtU128
& addr,
DtInetUtils::DtInetAddrFamily
family,
73
DtU32
prefixLen = 0);
74
77
DtInetAddr
(
void
* boostAsioIpAddress );
78
80
virtual
~
DtInetAddr
( );
81
83
DtInetAddr
(
const
DtInetAddr
& orig );
84
86
DtInetAddr
& operator=(
const
DtInetAddr
& orig);
87
91
virtual
DtString
toDtString(
bool
useShortForm =
false
)
const
;
92
94
virtual
DtInetUtils::DtInetAddrFamily
family()
const
;
95
98
virtual
bool
isIPv4()
const
;
99
virtual
bool
isIPv6()
const
;
101
104
virtual
void
setNetmask(
DtU32
mask );
105
109
virtual
DtU32
netmask()
const
;
110
112
virtual
void
setPrefixLen(
DtU64
prefixLen );
113
115
virtual
DtU64
prefix()
const
;
116
118
virtual
bool
isMulticast()
const
;
119
121
virtual
bool
isBroadcast()
const
;
122
124
virtual
bool
isLoopback()
const
;
125
128
virtual
bool
isAnyAddr()
const
;
129
132
virtual
const
DtInetAddr
* getBroadcastAddr();
133
135
virtual
const
DtInetAddr
* getLoopbackAddr();
136
140
virtual
int
toSockaddr(
struct
sockaddr_in* s )
const
;
141
virtual
int
toSockaddr(
struct
sockaddr_in6* s )
const
;
143
145
virtual
void
toAddrStorage(
struct
sockaddr_storage* addrStor )
const
;
146
148
virtual
DtU128
toU128()
const
;
149
152
virtual
DtU32
toULong()
const
;
153
155
virtual
void
setScope(
DtInetIpv6Scope
scopeId );
156
159
virtual
DtInetIpv6Scope
scope()
const
;
160
164
virtual
void
* boostAddress();
165
virtual
const
void
* boostAddress()
const
;
166
169
friend
DT_DLL_VLUTIL
bool
operator==
(
const
DtInetAddr
& addr1,
const
DtInetAddr
& addr2 );
170
friend
DT_DLL_VLUTIL
bool
operator!=
(
const
DtInetAddr
& addr1,
const
DtInetAddr
& addr2 );
171
friend
DT_DLL_VLUTIL
bool
operator<
(
const
DtInetAddr
& addr1,
const
DtInetAddr
& addr2 );
172
friend
DT_DLL_VLUTIL
bool
operator>
(
const
DtInetAddr
& addr1,
const
DtInetAddr
& addr2 );
174
175
static
const
DtInetAddr
& inaddrAny(
DtInetUtils::DtInetAddrFamily
family =
DtInetUtils::DtInetAddrFamily_IPv4
);
176
static
const
DtInetAddr
& loopbackAddress(
DtInetUtils::DtInetAddrFamily
family =
DtInetUtils::DtInetAddrFamily_IPv4
);
177
178
protected
:
179
void
init();
180
void
initFromStrings(
const
char
* addrString,
const
char
* netmaskString);
181
182
protected
:
183
184
#ifdef DtDIAGNOSTIC
185
DtString
myAddressStr;
186
#endif
187
189
void
*
myAddr
;
190
191
DtU64
myIpv4Netmask
;
192
DtU64
myPrefixLen
;
193
194
DtInetAddr
*
myBroadcastAddr
;
195
DtInetAddr
*
myLoopbackAddr
;
196
197
bool
myIsBroadcast
;
198
bool
myIsMulticast
;
199
bool
myIsLoopback
;
200
bool
myIsAnyAddr
;
201
202
DtInetIpv6Scope
myIpv6ScopeId
;
203
204
};
205
// end of class DtInetAddr
206
207
#ifdef DtUSE_UTILITIES_NAMESPACE
208
}
209
#endif
210
Document ID: Generated on Mon Jun 22 21:18:40 EDT 2020 from SVN revision 213785
Copyright © 2005-2018 MAK Technologies. All Rights Reserved (
www.mak.com
)