VR-Link API Documentation for HLA 1.3
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
16
#ifdef DtUSE_UTILITIES_NAMESPACE
17
namespace
DtUSE_UTILITIES_NAMESPACE
18
{
19
#endif
20
21
// Ref. RFC3513
23
enum
DtInetIpv6Scope
24
{
25
DtInetIpv6_Unspecified
,
26
DtInetIpv6_Interface
= 1,
// AKA node-local
27
DtInetIpv6_LinkLocal
= 2,
28
DtInetIpv6_Subnet
= 3,
// MS only, not in RFC3513
29
DtInetIpv6_AdminLocal
= 4,
// in RFC3513, but not used in Linux
30
DtInetIpv6_SiteLocal
= 5,
31
DtInetIpv6_OrgLocal
= 8,
32
DtInetIpv6_Global
= 14
33
};
34
37
class
DT_DLL_VLUTIL
DtInetAddr
38
{
39
public
:
40
43
DtInetAddr
(
DtInetUtils::DtInetAddrFamily
family =
DtInetUtils::DtInetAddrFamily_IPv4
);
44
51
DtInetAddr
(
const
DtString
& addrString,
const
DtString
& netmaskString =
""
);
52
DtInetAddr
(
const
char
* addrString,
const
char
* netmaskString = NULL );
54
59
DtInetAddr
(
const
struct
sockaddr_in& addr,
DtU32
netmask = 0 );
60
DtInetAddr
(
const
DtU32
addr,
DtU32
netmask = 0 );
62
64
DtInetAddr
(
const
struct
sockaddr_in6& addr,
DtU32
prefixLen = 0 );
65
68
DtInetAddr
(
const
struct
sockaddr_storage& addr,
DtU32
prefixLen = 0 );
69
73
DtInetAddr
(
const
DtU128
& addr,
DtInetUtils::DtInetAddrFamily
family,
74
DtU32
prefixLen = 0);
75
78
DtInetAddr
(
void
* boostAsioIpAddress );
79
81
virtual
~
DtInetAddr
( );
82
84
DtInetAddr
(
const
DtInetAddr
& orig );
85
87
DtInetAddr
& operator=(
const
DtInetAddr
& orig);
88
92
virtual
DtString
toDtString(
bool
useShortForm =
false
)
const
;
93
95
virtual
DtInetUtils::DtInetAddrFamily
family()
const
;
96
99
virtual
bool
isIPv4()
const
;
100
virtual
bool
isIPv6()
const
;
102
105
virtual
void
setNetmask(
DtU32
mask );
106
110
virtual
DtU32
netmask()
const
;
111
113
virtual
void
setPrefixLen(
DtU64
prefixLen );
114
116
virtual
DtU64
prefix()
const
;
117
119
virtual
bool
isMulticast()
const
;
120
122
virtual
bool
isBroadcast()
const
;
123
125
virtual
bool
isLoopback()
const
;
126
129
virtual
bool
isAnyAddr()
const
;
130
133
virtual
const
DtInetAddr
* getBroadcastAddr();
134
136
virtual
const
DtInetAddr
* getLoopbackAddr();
137
141
virtual
int
toSockaddr(
struct
sockaddr_in* s )
const
;
142
virtual
int
toSockaddr(
struct
sockaddr_in6* s )
const
;
144
146
virtual
void
toAddrStorage(
struct
sockaddr_storage* addrStor )
const
;
147
149
virtual
DtU128
toU128()
const
;
150
153
virtual
DtU32
toULong()
const
;
154
156
virtual
void
setScope(
DtInetIpv6Scope
scopeId );
157
160
virtual
DtInetIpv6Scope
scope()
const
;
161
165
virtual
void
* boostAddress();
166
virtual
const
void
* boostAddress()
const
;
167
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 );
173
friend
DT_DLL_VLUTIL
bool
operator>
(
const
DtInetAddr
& addr1,
const
DtInetAddr
& addr2 );
175
176
static
const
DtInetAddr
& inaddrAny(
DtInetUtils::DtInetAddrFamily
family =
DtInetUtils::DtInetAddrFamily_IPv4
);
177
static
const
DtInetAddr
& loopbackAddress(
DtInetUtils::DtInetAddrFamily
family =
DtInetUtils::DtInetAddrFamily_IPv4
);
178
179
protected
:
180
void
init();
181
void
initFromStrings(
const
char
* addrString,
const
char
* netmaskString);
182
183
protected
:
185
void
*
myAddr
;
186
187
DtU64
myIpv4Netmask
;
188
DtU64
myPrefixLen
;
189
190
DtInetAddr
*
myBroadcastAddr
;
191
DtInetAddr
*
myLoopbackAddr
;
192
193
bool
myIsBroadcast
;
194
bool
myIsMulticast
;
195
bool
myIsLoopback
;
196
bool
myIsAnyAddr
;
197
198
DtInetIpv6Scope
myIpv6ScopeId
;
199
200
};
201
// end of class DtInetAddr
202
203
#ifdef DtUSE_UTILITIES_NAMESPACE
204
}
205
#endif
206
Document ID: Generated on Wed Jan 7 13:31:29 EST 2015 from SVN revision 149162
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)