ManagedRoute, which applies C++ RAII to injected routes. Move RoutingTable to attic.
This commit is contained in:
parent
4446dbde5e
commit
b90e66f7c7
8 changed files with 726 additions and 86 deletions
|
@ -231,7 +231,6 @@ struct InetAddress : public sockaddr_storage
|
|||
* @param port Port, 0 to 65535
|
||||
*/
|
||||
inline void setPort(unsigned int port)
|
||||
throw()
|
||||
{
|
||||
switch(ss_family) {
|
||||
case AF_INET:
|
||||
|
@ -243,6 +242,25 @@ struct InetAddress : public sockaddr_storage
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if this network/netmask route describes a default route (e.g. 0.0.0.0/0)
|
||||
*/
|
||||
inline bool isDefaultRoute()
|
||||
{
|
||||
switch(ss_family) {
|
||||
case AF_INET:
|
||||
return ( (reinterpret_cast<struct sockaddr_in *>(this)->sin_addr.s_addr == 0) && (reinterpret_cast<struct sockaddr_in *>(this)->sin_port == 0) );
|
||||
case AF_INET6:
|
||||
const uint8_t *ipb = reinterpret_cast<const uint8_t *>(reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_addr.s6_addr);
|
||||
for(int i=0;i<16;++i) {
|
||||
if (ipb[i])
|
||||
return false;
|
||||
}
|
||||
return (reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_port == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ASCII IP/port format representation
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue