VR-Link API Documentation for DIS
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
24 {
26  DtInetIpv6_Interface = 1, // AKA node-local
28  DtInetIpv6_Subnet = 3, // MS only, not in RFC3513
29  DtInetIpv6_AdminLocal = 4, // in RFC3513, but not used in Linux
33 };
34 
38 {
39 public:
40 
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 
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 
189 
192 
197 
199 
200 };
201 // end of class DtInetAddr
202 
203 #ifdef DtUSE_UTILITIES_NAMESPACE
204 }
205 #endif
206 

Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)