oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ove::Address Class Reference

Lightweight wrapper around ove_sockaddr_t. More...

#include <net.hpp>

Public Member Functions

 Address ()
 Default-constructs a zeroed address.
 
uint16_t port () const
 Returns the port in host byte order.
 
Addressset_port (uint16_t p)
 Sets the port, returning a reference for chaining.
 

Static Public Member Functions

static Address ipv4 (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint16_t port)
 Creates an IPv4 address from individual octets and a port.
 

Public Attributes

ove_sockaddr_t raw
 The underlying C sockaddr.
 

Detailed Description

Lightweight wrapper around ove_sockaddr_t.

A copyable value type that holds an IP address and port. Use the ipv4() factory to construct from individual octets, or access the raw member directly for advanced use.

Member Function Documentation

◆ ipv4()

static Address ove::Address::ipv4 ( uint8_t  a,
uint8_t  b,
uint8_t  c,
uint8_t  d,
uint16_t  port 
)
inlinestatic

Creates an IPv4 address from individual octets and a port.

Parameters
[in]aFirst octet.
[in]bSecond octet.
[in]cThird octet.
[in]dFourth octet.
[in]portPort number in host byte order.
Returns
A fully initialised Address.

◆ port()

uint16_t ove::Address::port ( ) const
inline

Returns the port in host byte order.

Returns
Port number.

◆ set_port()

Address & ove::Address::set_port ( uint16_t  p)
inline

Sets the port, returning a reference for chaining.

Fluent-builder style, matching NetIfConfig. Useful when an Address was constructed without a port (e.g. from a DNS resolution result) and you want to attach one inline.

auto a = ove::Address::ipv4(192, 168, 0, 1, 0).set_port(8080);
static Address ipv4(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint16_t port)
Creates an IPv4 address from individual octets and a port.
Definition net.hpp:54
Address & set_port(uint16_t p)
Sets the port, returning a reference for chaining.
Definition net.hpp:82
Parameters
[in]pPort number in host byte order.

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