Bunch of rule JSON stuff.

This commit is contained in:
Adam Ierymenko 2016-08-15 18:49:50 -07:00
parent 3cb2e1197f
commit bd15262e54
2 changed files with 427 additions and 40 deletions

View file

@ -300,6 +300,19 @@ struct InetAddress : public sockaddr_storage
*/
inline unsigned int netmaskBits() const throw() { return port(); }
/**
* @return True if netmask bits is valid for the address type
*/
inline bool netmaskBitsValid() const
{
const unsigned int n = port();
switch(ss_family) {
case AF_INET: return (n <= 32);
case AF_INET6: return (n <= 128);
}
return false;
}
/**
* Alias for port()
*