PcapPlusPlus
24.09
|
#include <IpAddress.h>
Public Member Functions | |
IPv4Network (const IPv4Address &address) | |
IPv4Network (const IPv4Address &address, uint8_t prefixLen) | |
IPv4Network (const IPv4Address &address, const std::string &netmask) | |
IPv4Network (const std::string &addressAndNetmask) | |
uint8_t | getPrefixLen () const |
std::string | getNetmask () const |
IPv4Address | getNetworkPrefix () const |
IPv4Address | getLowestAddress () const |
IPv4Address | getHighestAddress () const |
uint64_t | getTotalAddressCount () const |
bool | includes (const IPv4Address &address) const |
bool | includes (const IPv4Network &network) const |
std::string | toString () const |
A class representing IPv4 network definition
|
inlineexplicit |
A constructor that creates an instance of the class out of an address and a full prefix length, essentially making a network of consisting of only 1 address.
address | An address representing the network prefix. |
pcpp::IPv4Network::IPv4Network | ( | const IPv4Address & | address, |
uint8_t | prefixLen | ||
) |
A constructor that creates an instance of the class out of an address representing the network prefix and a prefix length
address | An address representing the network prefix. If the address is invalid std::invalid_argument exception is thrown |
prefixLen | A number between 0 and 32 representing the prefix length. |
std::invalid_argument | Prefix length is out of acceptable range. |
pcpp::IPv4Network::IPv4Network | ( | const IPv4Address & | address, |
const std::string & | netmask | ||
) |
A constructor that creates an instance of the class out of an address representing the network prefix and a netmask
address | An address representing the network prefix. If the address is invalid std::invalid_argument exception is thrown |
netmask | A string representing a netmask in the format of X.X.X.X, for example: 255.255.0.0. Please notice that netmasks that start with zeros are invalid, for example: 0.0.255.255. The only netmask starting with zeros that is valid is 0.0.0.0. |
std::invalid_argument | The provided netmask is invalid. |
pcpp::IPv4Network::IPv4Network | ( | const std::string & | addressAndNetmask | ) |
A constructor that creates an instance of the class out of a string representing the network prefix and a prefix length or a netmask
addressAndNetmask | A string in one of these formats:
|
std::invalid_argument | The provided string does not represent a valid address and netmask format. |
IPv4Address pcpp::IPv4Network::getHighestAddress | ( | ) | const |
IPv4Address pcpp::IPv4Network::getLowestAddress | ( | ) | const |
|
inline |
|
inline |
uint8_t pcpp::IPv4Network::getPrefixLen | ( | ) | const |
uint64_t pcpp::IPv4Network::getTotalAddressCount | ( | ) | const |
bool pcpp::IPv4Network::includes | ( | const IPv4Address & | address | ) | const |
address | An IPv4 address |
bool pcpp::IPv4Network::includes | ( | const IPv4Network & | network | ) | const |
network | An IPv4 network |
std::string pcpp::IPv4Network::toString | ( | ) | const |