E-MailRelay
Public Types | Public Member Functions | Static Public Member Functions | List of all members
GNet::AddressLocal Class Reference

A 'sockaddr' wrapper class for local-domain addresses. More...

#include <gaddresslocal.h>

Public Types

using sockaddr_type = sockaddr_un
 

Public Member Functions

 AddressLocal (unsigned int)
 
 AddressLocal (std::string_view)
 
 AddressLocal (unsigned int port, int)
 
 AddressLocal (const sockaddr *addr, socklen_t len)
 
const sockaddr * address () const
 
sockaddr * address ()
 
socklen_t length () const noexcept
 
unsigned long scopeId (unsigned long default_=0UL) const
 
unsigned int port () const
 
void setPort (unsigned int port)
 
bool setZone (std::string_view ipv6_zone_name_or_scope_id)
 
void setScopeId (unsigned long ipv6_scope_id)
 
bool same (const AddressLocal &other, bool ipv6_compare_with_scope=false) const
 
bool sameHostPart (const AddressLocal &other) const
 
bool isLoopback () const
 
bool isLocal (std::string &) const
 
bool isLinkLocal () const
 
bool isUniqueLocal () const
 
bool isMulticast () const
 
bool isAny () const
 
unsigned int bits () const
 
std::string displayString (bool ipv6_with_scope=false) const
 
std::string hostPartString () const
 
std::string queryString () const
 
G::StringArray wildcards () const
 

Static Public Member Functions

static int domain () noexcept
 
static unsigned short af () noexcept
 
static bool validString (std::string_view, std::string *=nullptr)
 
static bool validStrings (std::string_view, std::string_view, std::string *=nullptr)
 
static bool validPort (unsigned int port)
 
static bool validData (const sockaddr *addr, socklen_t len)
 
static bool format (const std::string &)
 

Detailed Description

A 'sockaddr' wrapper class for local-domain addresses.

Use "netcat -U" or "socat" to connect to local-domain sockets, eg:

$ nc -U -C /run/cmd.s # nc.openbsd, not nc.traditional
$ socat -d tcp-listen:8080,fork unix:/run/cmd.s

Definition at line 55 of file gaddresslocal.h.

Member Typedef Documentation

◆ sockaddr_type

using GNet::AddressLocal::sockaddr_type = sockaddr_un

Definition at line 58 of file gaddresslocal.h.

Constructor & Destructor Documentation

◆ AddressLocal() [1/4]

GNet::AddressLocal::AddressLocal ( unsigned int  )
explicit

Definition at line 42 of file gaddresslocal_none.cpp.

◆ AddressLocal() [2/4]

GNet::AddressLocal::AddressLocal ( std::string_view  host_part)
explicit

Definition at line 57 of file gaddresslocal_none.cpp.

◆ AddressLocal() [3/4]

GNet::AddressLocal::AddressLocal ( unsigned int  port,
int   
)

Definition at line 47 of file gaddresslocal_none.cpp.

◆ AddressLocal() [4/4]

GNet::AddressLocal::AddressLocal ( const sockaddr *  addr,
socklen_t  len 
)

Definition at line 52 of file gaddresslocal_none.cpp.

Member Function Documentation

◆ address() [1/2]

sockaddr * GNet::AddressLocal::address ( )

Definition at line 143 of file gaddresslocal_none.cpp.

◆ address() [2/2]

const sockaddr * GNet::AddressLocal::address ( ) const

Definition at line 138 of file gaddresslocal_none.cpp.

◆ af()

unsigned short GNet::AddressLocal::af ( )
staticnoexcept

Definition at line 24 of file gaddresslocal_none.cpp.

◆ bits()

unsigned int GNet::AddressLocal::bits ( ) const

Definition at line 193 of file gaddresslocal_none.cpp.

◆ displayString()

std::string GNet::AddressLocal::displayString ( bool  ipv6_with_scope = false) const

Definition at line 80 of file gaddresslocal_none.cpp.

◆ domain()

int GNet::AddressLocal::domain ( )
staticnoexcept

Definition at line 29 of file gaddresslocal_none.cpp.

◆ format()

bool GNet::AddressLocal::format ( const std::string &  )
static

Definition at line 158 of file gaddresslocal_none.cpp.

◆ hostPartString()

std::string GNet::AddressLocal::hostPartString ( ) const

Definition at line 85 of file gaddresslocal_none.cpp.

◆ isAny()

bool GNet::AddressLocal::isAny ( ) const

Definition at line 188 of file gaddresslocal_none.cpp.

◆ isLinkLocal()

bool GNet::AddressLocal::isLinkLocal ( ) const

Definition at line 173 of file gaddresslocal_none.cpp.

◆ isLocal()

bool GNet::AddressLocal::isLocal ( std::string &  ) const

Definition at line 163 of file gaddresslocal_none.cpp.

◆ isLoopback()

bool GNet::AddressLocal::isLoopback ( ) const

Definition at line 168 of file gaddresslocal_none.cpp.

◆ isMulticast()

bool GNet::AddressLocal::isMulticast ( ) const

Definition at line 183 of file gaddresslocal_none.cpp.

◆ isUniqueLocal()

bool GNet::AddressLocal::isUniqueLocal ( ) const

Definition at line 178 of file gaddresslocal_none.cpp.

◆ length()

socklen_t GNet::AddressLocal::length ( ) const
noexcept

Definition at line 148 of file gaddresslocal_none.cpp.

◆ port()

unsigned int GNet::AddressLocal::port ( ) const

Definition at line 128 of file gaddresslocal_none.cpp.

◆ queryString()

std::string GNet::AddressLocal::queryString ( ) const

Definition at line 90 of file gaddresslocal_none.cpp.

◆ same()

bool GNet::AddressLocal::same ( const AddressLocal other,
bool  ipv6_compare_with_scope = false 
) const

Definition at line 118 of file gaddresslocal_none.cpp.

◆ sameHostPart()

bool GNet::AddressLocal::sameHostPart ( const AddressLocal other) const

Definition at line 123 of file gaddresslocal_none.cpp.

◆ scopeId()

unsigned long GNet::AddressLocal::scopeId ( unsigned long  default_ = 0UL) const

Definition at line 133 of file gaddresslocal_none.cpp.

◆ setPort()

void GNet::AddressLocal::setPort ( unsigned int  port)

Definition at line 62 of file gaddresslocal_none.cpp.

◆ setScopeId()

void GNet::AddressLocal::setScopeId ( unsigned long  ipv6_scope_id)

Definition at line 71 of file gaddresslocal_none.cpp.

◆ setZone()

bool GNet::AddressLocal::setZone ( std::string_view  ipv6_zone_name_or_scope_id)

Definition at line 66 of file gaddresslocal_none.cpp.

◆ validData()

bool GNet::AddressLocal::validData ( const sockaddr *  addr,
socklen_t  len 
)
static

Definition at line 95 of file gaddresslocal_none.cpp.

◆ validPort()

bool GNet::AddressLocal::validPort ( unsigned int  port)
static

Definition at line 113 of file gaddresslocal_none.cpp.

◆ validString()

bool GNet::AddressLocal::validString ( std::string_view  path,
std::string *  reason_p = nullptr 
)
static

Definition at line 100 of file gaddresslocal_none.cpp.

◆ validStrings()

bool GNet::AddressLocal::validStrings ( std::string_view  host_part,
std::string_view  ,
std::string *  reason_p = nullptr 
)
static

Definition at line 107 of file gaddresslocal_none.cpp.

◆ wildcards()

G::StringArray GNet::AddressLocal::wildcards ( ) const

Definition at line 153 of file gaddresslocal_none.cpp.


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