OpenVPN 3 Core Library
|
Represents a remote IP address with IPv4/IPv6 designation. More...
#include <capture.hpp>
Public Member Functions | |
std::string | to_string () const |
Returns a string representation of the remote address. | |
bool | defined () const |
Checks if the address is defined. | |
void | validate (const std::string &title) const |
Validates the IP address format. | |
Json::Value | to_json () const |
Serializes the object to a JSON value. | |
void | from_json (const Json::Value &root, const std::string &title) |
Deserializes the object from a JSON value. | |
Public Attributes | |
std::string | address |
bool | ipv6 = false |
Represents a remote IP address with IPv4/IPv6 designation.
This class encapsulates an IP address string along with a flag indicating whether it's an IPv6 address. It provides methods for validation, serialization, and checking if the address is defined.
Definition at line 54 of file capture.hpp.
|
inline |
Checks if the address is defined.
An address is considered defined if its string representation is not empty.
true
if the address is defined, false
otherwise. Definition at line 79 of file capture.hpp.
|
inline |
Deserializes the object from a JSON value.
Populates the object's fields from the given JSON object.
root | The JSON value to deserialize from. |
title | A context string used in error messages if deserialization fails. |
Definition at line 116 of file capture.hpp.
|
inline |
Serializes the object to a JSON value.
Creates a JSON object with "address" and "ipv6" fields.
Json::Value
object representing this remote address. Definition at line 101 of file capture.hpp.
|
inline |
Returns a string representation of the remote address.
Formats the address as a string, appending " [IPv6]" suffix if the address is IPv6.
Definition at line 66 of file capture.hpp.
|
inline |
Validates the IP address format.
Uses the IP::Addr
class to validate that the address string represents a valid IPv4 or IPv6 address based on the ipv6
flag.
title | A context string used in error messages if validation fails. |
Definition at line 90 of file capture.hpp.
std::string openvpn::TunBuilderCapture::RemoteAddress::address |
Definition at line 57 of file capture.hpp.
bool openvpn::TunBuilderCapture::RemoteAddress::ipv6 = false |
Definition at line 58 of file capture.hpp.