|
Botan 3.13.0
Crypto and TLS for C&
|
#include <ipv4_address.h>
Public Member Functions | |
| uint32_t | address () const |
| The address as a 32-bit big-endian integer. | |
| IPv4Address (uint32_t ip) | |
| IPv4Address | operator& (const IPv4Address &other) const |
| auto | operator<=> (const IPv4Address &) const =default |
| std::optional< size_t > | prefix_length () const |
| std::array< uint8_t, 4 > | to_bytes () const |
| The address as four bytes, network-byte-order. | |
| std::string | to_string () const |
| Dotted-decimal form, e.g. "10.0.0.1". | |
| uint32_t | value () const |
| The address as a 32-bit big-endian integer. | |
Static Public Member Functions | |
| static std::optional< IPv4Address > | from_string (std::string_view str) |
| static IPv4Address | host_mask () |
| static IPv4Address | netmask (size_t bits) |
IPv4 Address
Definition at line 23 of file ipv4_address.h.
|
inlineexplicit |
Create an address from its integer value
| ip | the address as a 32-bit big-endian integer |
Definition at line 29 of file ipv4_address.h.
Referenced by from_string(), host_mask(), netmask(), operator&(), and operator<=>().
|
inline |
The address as a 32-bit big-endian integer.
Definition at line 67 of file ipv4_address.h.
|
static |
Convert a dotted-decimal string to an IPv4Address
| str | the address to parse |
Definition at line 90 of file ipv4_address.cpp.
References IPv4Address().
Referenced by Botan::AlternativeName::add_attribute(), Botan::AlternativeName::AlternativeName(), Botan::IPv4Subnet::from_string(), Botan::URI::Authority::from_string(), Botan::TLS::Server_Name_Indicator::hostname_acceptable_for_sni(), Botan::NameConstraints::is_excluded(), Botan::NameConstraints::is_permitted(), Botan::GeneralName::matches(), and Botan::X509_Certificate::matches_dns_name().
|
inlinestatic |
Return the netmask matching a single host
Definition at line 48 of file ipv4_address.h.
References IPv4Address(), and netmask().
|
static |
Return an address with the leading bits set to one and the remainder zero. Throws Invalid_Argument if bits > 32.
Definition at line 99 of file ipv4_address.cpp.
References BOTAN_ARG_CHECK, and IPv4Address().
Referenced by Botan::IPv4Subnet::contains(), Botan::GeneralName::encode_into(), host_mask(), and Botan::IPv4Subnet::serialize().
|
inline |
Bitwise AND of two addresses, typically used to apply a netmask
| other | the address to AND with |
Definition at line 55 of file ipv4_address.h.
References IPv4Address().
|
default |
Order two addresses numerically
References IPv4Address().
| std::optional< size_t > Botan::IPv4Address::prefix_length | ( | ) | const |
If this value is a netmask consisting of a run of one bits followed by a run of zero bits, return the number of one bits.
Otherwise return nullopt.
Definition at line 129 of file ipv4_address.cpp.
Referenced by Botan::IPv4Subnet::from_address_and_mask().
| std::array< uint8_t, 4 > Botan::IPv4Address::to_bytes | ( | ) | const |
The address as four bytes, network-byte-order.
Definition at line 107 of file ipv4_address.cpp.
References Botan::store_be().
Referenced by to_string().
| std::string Botan::IPv4Address::to_string | ( | ) | const |
Dotted-decimal form, e.g. "10.0.0.1".
Definition at line 113 of file ipv4_address.cpp.
References to_bytes().
|
inline |
The address as a 32-bit big-endian integer.
Definition at line 64 of file ipv4_address.h.
References value().
Referenced by value().