22 #ifndef G_NET_ADDRESS6__H
23 #define G_NET_ADDRESS6__H
40 typedef sockaddr general_type ;
41 typedef sockaddr_in6 specific_type ;
42 typedef sockaddr_storage storage_type ;
44 { specific_type specific ; general_type general ; storage_type storage ; } ;
47 explicit Address6(
const std::string & ) ;
48 Address6(
const std::string & ,
const std::string & ) ;
49 Address6(
const std::string & ,
unsigned int ) ;
50 Address6(
unsigned int port ,
int ) ;
51 Address6(
const sockaddr * addr , socklen_t len ) ;
55 static unsigned short family() ;
56 const sockaddr * address()
const ;
57 sockaddr * address() ;
58 static socklen_t length() ;
59 unsigned long scopeId()
const ;
60 unsigned int port()
const ;
61 void setPort(
unsigned int port ) ;
63 static bool validString(
const std::string & , std::string * =
nullptr ) ;
64 static bool validStrings(
const std::string & ,
const std::string & , std::string * =
nullptr ) ;
65 static bool validPort(
unsigned int port ) ;
66 static bool validData(
const sockaddr * addr , socklen_t len ) ;
68 bool same(
const Address6 & other )
const ;
69 bool sameHostPart(
const Address6 & other )
const ;
70 bool isLoopback()
const ;
71 bool isLocal( std::string & )
const ;
73 std::string displayString()
const ;
74 std::string hostPartString()
const ;
80 static const char * setAddress(
union_type & ,
const std::string & ) ;
81 static const char * setHostAddress(
union_type & ,
const std::string & ) ;
82 static const char * setPort(
union_type & ,
unsigned int ) ;
83 static const char * setPort(
union_type & ,
const std::string & ) ;
84 static bool sameAddr( const ::in6_addr & a , const ::in6_addr & b ) ;
85 static void setZone(
union_type & ,
unsigned int ) ;
Used by GNet::Address6 to cast between sockaddr and sockaddr_in6.
std::vector< std::string > StringArray
A std::vector of std::strings.
A 'sockaddr' wrapper class for IPv6 addresses.