File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ unsigned int CNetAddr::GetByte(int n) const
83
83
return ip[15 -n];
84
84
}
85
85
86
+ bool CNetAddr::IsBindAny () const
87
+ {
88
+ const int cmplen = IsIPv4 () ? 4 : 16 ;
89
+ for (int i = 0 ; i < cmplen; ++i) {
90
+ if (GetByte (i)) return false ;
91
+ }
92
+
93
+ return true ;
94
+ }
95
+
86
96
bool CNetAddr::IsIPv4 () const
87
97
{
88
98
return (memcmp (ip, pchIPv4, sizeof (pchIPv4)) == 0 );
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class CNetAddr
55
55
bool SetInternal (const std::string& name);
56
56
57
57
bool SetSpecial (const std::string &strName); // for Tor addresses
58
+ bool IsBindAny () const ; // INADDR_ANY equivalent
58
59
bool IsIPv4 () const ; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
59
60
bool IsIPv6 () const ; // IPv6 address (not mapped IPv4, not Tor)
60
61
bool IsRFC1918 () const ; // IPv4 private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12)
You can’t perform that action at this time.
0 commit comments