Botan 3.14.1
Crypto and TLS for C&
Botan::Cert_Extension::IPAddressBlocks::IPAddress< V > Class Template Referencefinal

#include <x509_ext.h>

Public Member Functions

 IPAddress (const Address &addr)
 IPAddress (std::span< const uint8_t > v)
 operator Address () const
std::array< uint8_t, Length > to_bytes () const
std::array< uint8_t, Length > value () const

Friends

class IPAddressBlocks
IPAddress< V > operator+ (IPAddress< V > lhs, size_t rhs)
std::strong_ordering operator<=> (const IPAddress< V > lhs, const IPAddress< V > &rhs)
bool operator== (const IPAddress< V > &lhs, const IPAddress< V > &rhs)

Detailed Description

template<Version V>
class Botan::Cert_Extension::IPAddressBlocks::IPAddress< V >

An IP address of the given version

In a future major release this will become an alias of IPv4Address or IPv6Address. Use to_bytes and the conversions to/from IPv4Address and IPv6Address to write code that works with both.

TODO(Botan4) remove this type

Definition at line 1038 of file x509_ext.h.

Constructor & Destructor Documentation

◆ IPAddress() [1/2]

template<Version V>
Botan::Cert_Extension::IPAddressBlocks::IPAddress< V >::IPAddress ( std::span< const uint8_t > v)
explicit

Definition at line 2563 of file x509_ext.cpp.

2563: m_value(from_bytes(v).m_value) {}

Referenced by IPAddressBlocks, operator+, operator<=>, and operator==.

◆ IPAddress() [2/2]

template<Version V>
Botan::Cert_Extension::IPAddressBlocks::IPAddress< V >::IPAddress ( const Address & addr)
inlineexplicit

Create from an IPv4Address (for IPv4) or IPv6Address (for IPv6)

Definition at line 1050 of file x509_ext.h.

1050: m_value(addr.to_bytes()) {}
std::array< uint8_t, Length > to_bytes() const
Definition x509_ext.h:1060

References to_bytes().

Member Function Documentation

◆ operator Address()

template<Version V>
Botan::Cert_Extension::IPAddressBlocks::IPAddress< V >::operator Address ( ) const
inline

Convert to IPv4Address or IPv6Address

Definition at line 1066 of file x509_ext.h.

1066{ return Address(m_value); }

◆ to_bytes()

template<Version V>
std::array< uint8_t, Length > Botan::Cert_Extension::IPAddressBlocks::IPAddress< V >::to_bytes ( ) const
inline

Return the address as bytes, network-byte-order

Definition at line 1060 of file x509_ext.h.

1060{ return m_value; }

Referenced by IPAddress().

◆ value()

template<Version V>
std::array< uint8_t, Length > Botan::Cert_Extension::IPAddressBlocks::IPAddress< V >::value ( ) const
inline

Return the address as bytes, network-byte-order

Definition at line 1055 of file x509_ext.h.

1055{ return m_value; }

References value().

Referenced by value().

◆ IPAddressBlocks

template<Version V>
friend class IPAddressBlocks
friend

Definition at line 1069 of file x509_ext.h.

References IPAddress(), and IPAddressBlocks.

Referenced by IPAddressBlocks.

◆ operator+

template<Version V>
IPAddress< V > operator+ ( IPAddress< V > lhs,
size_t rhs )
friend

Definition at line 1078 of file x509_ext.h.

1078 {
1079 // we only really need to be able to compute +1, so this is fine
1080 for(size_t i = 0; i < rhs; i++) {
1081 lhs = lhs.successor();
1082 }
1083 return lhs;
1084 }

References IPAddress().

◆ operator<=>

template<Version V>
std::strong_ordering operator<=> ( const IPAddress< V > lhs,
const IPAddress< V > & rhs )
friend

Definition at line 1086 of file x509_ext.h.

1086 =>(const IPAddress<V> lhs, const IPAddress<V>& rhs) {
1087 for(size_t i = 0; i < Length; i++) {
1088 if(lhs.m_value[i] < rhs.m_value[i]) {
1090 } else if(lhs.m_value[i] > rhs.m_value[i]) {
1092 }
1093 }
1095 }

References IPAddress().

◆ operator==

template<Version V>
bool operator== ( const IPAddress< V > & lhs,
const IPAddress< V > & rhs )
friend

Definition at line 1097 of file x509_ext.h.

1097 {
1098 return lhs.m_value == rhs.m_value;
1099 }

References IPAddress().


The documentation for this class was generated from the following files: