Create a network and mask from a CIDR formatted address string.
Synopsis
Declared in <folly/IPAddress.h>
static
CIDRNetwork
createNetwork(
StringPiece ipSlashCidr,
int defaultCidr = ‐1,
bool mask = true);
Description
Same as tryCreateNetwork() but throws on error.
Throws IPAddressFormatException if ipSlashCidr is not a valid CIDR‐formatted address.
Return Value
pair with IPAddress network and uint8_t mask
Parameters
Name |
Description |
ipSlashCidr |
IP/CIDR formatted string to split. |
defaultCidr |
Default value if no /N is specified (if ‐1, uses /32 for IPv4 and /128 for IPv6). |
mask |
Whether to apply the mask on the address, e.g. 192.168.13.46/24 => 192.168.13.0/24. |
Created with MrDocs