Network endpoint information (host/port or URL)
More...
#include <types.h>
|
| | endpoint_info ()=default |
| | Default constructor creates an empty endpoint.
|
| |
| | endpoint_info (const std::string &h, uint16_t p) |
| | Constructs endpoint from host and port.
|
| |
| | endpoint_info (const char *h, uint16_t p) |
| | Constructs endpoint from C-string host and port.
|
| |
| | endpoint_info (const std::string &url) |
| | Constructs endpoint from URL (port extracted if present)
|
| |
| | endpoint_info (const char *url) |
| | Constructs endpoint from C-string URL.
|
| |
| auto | is_valid () const noexcept -> bool |
| | Checks if the endpoint is valid (non-empty host)
|
| |
| auto | to_string () const -> std::string |
| | Returns string representation of the endpoint.
|
| |
| auto | operator== (const endpoint_info &other) const noexcept -> bool |
| | Equality comparison.
|
| |
| auto | operator!= (const endpoint_info &other) const noexcept -> bool |
| | Inequality comparison.
|
| |
|
| std::string | host |
| | Hostname, IP address, or full URL.
|
| |
| uint16_t | port = 0 |
| | Port number (0 if embedded in URL)
|
| |
Network endpoint information (host/port or URL)
Represents a network endpoint that can be either a host:port combination or a full URL (for protocols like WebSocket that use URLs).
Thread Safety
Immutable after construction, safe for concurrent read access.
Examples
auto ep2 = tcp_ep;
if (tcp_ep == ep2) { ... }
Network endpoint information (host/port or URL)
endpoint_info()=default
Default constructor creates an empty endpoint.
- Examples
- unified_messaging_example.cpp.
Definition at line 56 of file types.h.
◆ endpoint_info() [1/5]
| kcenon::network::unified::endpoint_info::endpoint_info |
( |
| ) |
|
|
default |
Default constructor creates an empty endpoint.
◆ endpoint_info() [2/5]
| kcenon::network::unified::endpoint_info::endpoint_info |
( |
const std::string & | h, |
|
|
uint16_t | p ) |
|
inline |
Constructs endpoint from host and port.
- Parameters
-
| h | Hostname or IP address |
| p | Port number |
Definition at line 70 of file types.h.
std::string host
Hostname, IP address, or full URL.
uint16_t port
Port number (0 if embedded in URL)
◆ endpoint_info() [3/5]
| kcenon::network::unified::endpoint_info::endpoint_info |
( |
const char * | h, |
|
|
uint16_t | p ) |
|
inline |
Constructs endpoint from C-string host and port.
- Parameters
-
| h | Hostname or IP address (C-string) |
| p | Port number |
Definition at line 77 of file types.h.
◆ endpoint_info() [4/5]
| kcenon::network::unified::endpoint_info::endpoint_info |
( |
const std::string & | url | ) |
|
|
inlineexplicit |
Constructs endpoint from URL (port extracted if present)
- Parameters
-
| url | Full URL (e.g., "wss://example.com:443/ws") |
For URL-based protocols, the host field contains the full URL and port may be 0 if embedded in the URL.
Definition at line 86 of file types.h.
◆ endpoint_info() [5/5]
| kcenon::network::unified::endpoint_info::endpoint_info |
( |
const char * | url | ) |
|
|
inlineexplicit |
Constructs endpoint from C-string URL.
- Parameters
-
Definition at line 92 of file types.h.
◆ is_valid()
| auto kcenon::network::unified::endpoint_info::is_valid |
( |
| ) |
const -> bool |
|
inlinenodiscardnoexcept |
Checks if the endpoint is valid (non-empty host)
- Returns
- true if host is not empty
Definition at line 98 of file types.h.
98{
return !
host.empty(); }
References host.
◆ operator!=()
| auto kcenon::network::unified::endpoint_info::operator!= |
( |
const endpoint_info & | other | ) |
const -> bool |
|
inlinenodiscardnoexcept |
Inequality comparison.
Definition at line 121 of file types.h.
121 {
122 return !(*this == other);
123 }
◆ operator==()
| auto kcenon::network::unified::endpoint_info::operator== |
( |
const endpoint_info & | other | ) |
const -> bool |
|
inlinenodiscardnoexcept |
Equality comparison.
Definition at line 114 of file types.h.
114 {
115 return host == other.host &&
port == other.port;
116 }
References host, and port.
◆ to_string()
| auto kcenon::network::unified::endpoint_info::to_string |
( |
| ) |
const -> std::string |
|
inlinenodiscard |
Returns string representation of the endpoint.
- Returns
- "host:port" or URL string
Definition at line 104 of file types.h.
104 {
107 }
108 return host +
":" + std::to_string(
port);
109 }
References host, and port.
◆ host
| std::string kcenon::network::unified::endpoint_info::host |
◆ port
| uint16_t kcenon::network::unified::endpoint_info::port = 0 |
The documentation for this struct was generated from the following file:
- include/kcenon/network/detail/unified/types.h