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 (const std::string &)
 
 AddressLocal (const std::string &, const std::string &)
 
 AddressLocal (const std::string &, unsigned int)
 
 AddressLocal (unsigned int port, int)
 
 AddressLocal (const sockaddr *addr, socklen_t len, bool ipv6_scope_id_fixup=false)
 
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 (const std::string &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 isAny () const
 
unsigned int bits () const
 
std::string displayString (bool ipv6_with_scope=false) const
 
std::string hostPartString (bool raw=false) 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 (const std::string &, std::string *=nullptr)
 
static bool validStrings (const std::string &, const std::string &, 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
$ socat -d tcp-listen:8080,fork unix:/run/cmd.s

Definition at line 54 of file gaddresslocal.h.

Member Typedef Documentation

◆ sockaddr_type

using GNet::AddressLocal::sockaddr_type = sockaddr_un

Definition at line 57 of file gaddresslocal.h.

Constructor & Destructor Documentation

◆ AddressLocal() [1/6]

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

Definition at line 76 of file gaddresslocal_unix.cpp.

◆ AddressLocal() [2/6]

GNet::AddressLocal::AddressLocal ( const std::string &  display_string)
explicit

Definition at line 114 of file gaddresslocal_unix.cpp.

◆ AddressLocal() [3/6]

GNet::AddressLocal::AddressLocal ( const std::string &  host_part,
const std::string &   
)

Definition at line 109 of file gaddresslocal_unix.cpp.

◆ AddressLocal() [4/6]

GNet::AddressLocal::AddressLocal ( const std::string &  host_part,
unsigned int   
)

Definition at line 100 of file gaddresslocal_unix.cpp.

◆ AddressLocal() [5/6]

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

Definition at line 81 of file gaddresslocal_unix.cpp.

◆ AddressLocal() [6/6]

GNet::AddressLocal::AddressLocal ( const sockaddr *  addr,
socklen_t  len,
bool  ipv6_scope_id_fixup = false 
)

Definition at line 86 of file gaddresslocal_unix.cpp.

Member Function Documentation

◆ address() [1/2]

sockaddr * GNet::AddressLocal::address ( )

Definition at line 220 of file gaddresslocal_unix.cpp.

◆ address() [2/2]

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

Definition at line 215 of file gaddresslocal_unix.cpp.

◆ af()

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

Definition at line 58 of file gaddresslocal_unix.cpp.

◆ bits()

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

Definition at line 265 of file gaddresslocal_unix.cpp.

◆ displayString()

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

Definition at line 145 of file gaddresslocal_unix.cpp.

◆ domain()

int GNet::AddressLocal::domain ( )
staticnoexcept

Definition at line 63 of file gaddresslocal_unix.cpp.

◆ format()

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

Definition at line 235 of file gaddresslocal_unix.cpp.

◆ hostPartString()

std::string GNet::AddressLocal::hostPartString ( bool  raw = false) const

Definition at line 151 of file gaddresslocal_unix.cpp.

◆ isAny()

bool GNet::AddressLocal::isAny ( ) const

Definition at line 260 of file gaddresslocal_unix.cpp.

◆ isLinkLocal()

bool GNet::AddressLocal::isLinkLocal ( ) const

Definition at line 250 of file gaddresslocal_unix.cpp.

◆ isLocal()

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

Definition at line 240 of file gaddresslocal_unix.cpp.

◆ isLoopback()

bool GNet::AddressLocal::isLoopback ( ) const

Definition at line 245 of file gaddresslocal_unix.cpp.

◆ isUniqueLocal()

bool GNet::AddressLocal::isUniqueLocal ( ) const

Definition at line 255 of file gaddresslocal_unix.cpp.

◆ length()

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

Definition at line 225 of file gaddresslocal_unix.cpp.

◆ port()

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

Definition at line 205 of file gaddresslocal_unix.cpp.

◆ queryString()

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

Definition at line 156 of file gaddresslocal_unix.cpp.

◆ same()

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

Definition at line 191 of file gaddresslocal_unix.cpp.

◆ sameHostPart()

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

Definition at line 200 of file gaddresslocal_unix.cpp.

◆ scopeId()

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

Definition at line 210 of file gaddresslocal_unix.cpp.

◆ setPort()

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

Definition at line 119 of file gaddresslocal_unix.cpp.

◆ setScopeId()

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

Definition at line 128 of file gaddresslocal_unix.cpp.

◆ setZone()

bool GNet::AddressLocal::setZone ( const std::string &  ipv6_zone_name_or_scope_id)

Definition at line 123 of file gaddresslocal_unix.cpp.

◆ validData()

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

Definition at line 161 of file gaddresslocal_unix.cpp.

◆ validPort()

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

Definition at line 186 of file gaddresslocal_unix.cpp.

◆ validString()

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

Definition at line 166 of file gaddresslocal_unix.cpp.

◆ validStrings()

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

Definition at line 180 of file gaddresslocal_unix.cpp.

◆ wildcards()

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

Definition at line 230 of file gaddresslocal_unix.cpp.


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