22#ifndef SOCKET_ADDRESS_H
23#define SOCKET_ADDRESS_H
26#include "nsapi_types.h"
27#include "mbed_toolchain.h"
65 SocketAddress(
const void *bytes, nsapi_version_t version, uint16_t port = 0);
155 explicit operator bool()
const;
178 mutable std::unique_ptr<char[]> _ip_address;
Common interface that is shared between network devices.
void set_addr(const nsapi_addr_t &addr)
Set the raw IP address.
const void * get_ip_bytes() const
Get the raw IP bytes.
SocketAddress & operator=(const SocketAddress &addr)
Copy address from another SocketAddress.
SocketAddress(const char *addr, uint16_t port=0)
Create a SocketAddress from an IP address and port.
uint16_t get_port() const
Get the port.
~SocketAddress()=default
Destructor.
const char * get_ip_address() const
Get the human-readable IP address.
bool set_ip_address(const char *addr)
Set the IP address.
void set_port(uint16_t port)
Set the port.
SocketAddress(const void *bytes, nsapi_version_t version, uint16_t port=0)
Create a SocketAddress from raw IP bytes, IP version, and port.
friend bool operator==(const SocketAddress &a, const SocketAddress &b)
Compare two addresses for equality.
nsapi_addr_t get_addr() const
Get the raw IP address.
SocketAddress(const SocketAddress &addr)
Create a SocketAddress from another SocketAddress.
constexpr SocketAddress()=default
Create an unspecified SocketAddress.
nsapi_version_t get_ip_version() const
Get the IP address version.
SocketAddress(const nsapi_addr_t &addr, uint16_t port=0)
Create a SocketAddress from a raw IP address and port.
void set_ip_bytes(const void *bytes, nsapi_version_t version)
Set the raw IP bytes and IP version.
friend bool operator!=(const SocketAddress &a, const SocketAddress &b)
Compare two addresses for equality.
IP address structure for passing IP addresses by value.
nsapi_version_t version
IP version.
uint8_t bytes[16]
IP address The raw bytes of the IP address stored in big-endian format.