Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::SocketAddress Struct Reference

Family-neutral native socket address. More...

#include <Socket.h>

Public Types

enum class  UnixNamespace {
  Unnamed ,
  Pathname ,
  Abstract
}
 

Public Member Functions

 SocketAddress (const SocketIPAddress &ipAddress)
 
Result fromUnixPath (StringSpan path)
 Builds a filesystem-named Unix-domain address.
 
Result fromUnixAbstractName (Span< const char > name)
 Builds a Linux abstract-namespace Unix-domain address.
 
SocketFlags::AddressFamily getAddressFamily () const
 
uint32_t sizeOfHandle () const
 
bool isValid () const
 
Result getIPAddress (SocketIPAddress &output) const
 Extracts an IP address when this address contains IPv4 or IPv6.
 
Result getUnixName (Span< const char > &output, UnixNamespace &unixNamespace) const
 Returns a view into the inline Unix-domain name storage.
 

Public Attributes

AlignedStorage< 128 > handle = {}
 Handle to native OS representation of the socket address.
 
uint32_t nativeSize = 0
 

Detailed Description

Family-neutral native socket address.

Stores IPv4, IPv6, or Unix-domain addresses inline without exposing platform socket headers.

Member Function Documentation

◆ fromUnixAbstractName()

Result SC::SocketAddress::fromUnixAbstractName ( Span< const char > name)

Builds a Linux abstract-namespace Unix-domain address.

Note
Returns an unsupported result on platforms other than Linux.

◆ fromUnixPath()

Result SC::SocketAddress::fromUnixPath ( StringSpan path)

Builds a filesystem-named Unix-domain address.

◆ getIPAddress()

Result SC::SocketAddress::getIPAddress ( SocketIPAddress & output) const

Extracts an IP address when this address contains IPv4 or IPv6.

◆ getUnixName()

Result SC::SocketAddress::getUnixName ( Span< const char > & output,
UnixNamespace & unixNamespace ) const

Returns a view into the inline Unix-domain name storage.

Member Data Documentation

◆ handle

AlignedStorage<128> SC::SocketAddress::handle = {}

Handle to native OS representation of the socket address.


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