SNode.C
Loading...
Searching...
No Matches
net::un::SocketAddress Class Referencefinal

#include <SocketAddress.h>

Inheritance diagram for net::un::SocketAddress:
Collaboration diagram for net::un::SocketAddress:

Public Member Functions

 SocketAddress ()
 
 SocketAddress (const std::string &sunPath)
 
 SocketAddress (const SockAddr &sockAddr, SockLen sockAddrLen)
 
void init ()
 
SocketAddresssetSunPath (const std::string &sunPath)
 
std::string getSunPath () const
 
std::string toString (bool expanded=true) const override
 
- Public Member Functions inherited from net::SocketAddress< sockaddr_un >
 SocketAddress (sa_family_t af, SockLen sockAddrLen=sizeof(SockAddr))
 
 SocketAddress (const SocketAddress &socketAddress)
 
 SocketAddress (const SockAddr &sockAddr, SockLen sockAddrLen)
 
SocketAddressoperator= (const SocketAddress &socketAddress)
 
const sockaddr & getSockAddr ()
 
const SockLengetSockAddrLen () const
 
sa_family_t getAddressFamily () const
 
- Public Member Functions inherited from core::socket::SocketAddress
virtual ~SocketAddress ()
 
virtual bool useNext ()
 

Private Types

using Super = net::SocketAddress<sockaddr_un>
 

Private Attributes

std::string sunPath
 

Additional Inherited Members

- Public Types inherited from net::SocketAddress< sockaddr_un >
using SockAddr
 
using SockLen
 
- Protected Attributes inherited from net::SocketAddress< sockaddr_un >
SockAddr sockAddr
 
SockLen sockAddrLen
 

Detailed Description

Definition at line 58 of file SocketAddress.h.

Member Typedef Documentation

◆ Super

using net::un::SocketAddress::Super = net::SocketAddress<sockaddr_un>
private

Definition at line 60 of file SocketAddress.h.

Constructor & Destructor Documentation

◆ SocketAddress() [1/3]

net::un::SocketAddress::SocketAddress ( )

Definition at line 57 of file SocketAddress.cpp.

58 : Super(AF_UNIX, offsetof(sockaddr_un, sun_path)) {
59 }
net::SocketAddress< sockaddr_un > Super

References SocketAddress().

Referenced by SocketAddress(), and SocketAddress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SocketAddress() [2/3]

net::un::SocketAddress::SocketAddress ( const std::string & sunPath)
explicit

Definition at line 61 of file SocketAddress.cpp.

62 : SocketAddress() {
64 }
SocketAddress & setSunPath(const std::string &sunPath)

References setSunPath(), and SocketAddress().

Here is the call graph for this function:

◆ SocketAddress() [3/3]

net::un::SocketAddress::SocketAddress ( const SockAddr & sockAddr,
SockLen sockAddrLen )

Definition at line 66 of file SocketAddress.cpp.

References SocketAddress().

Referenced by SocketAddress().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ getSunPath()

std::string net::un::SocketAddress::getSunPath ( ) const

Definition at line 92 of file SocketAddress.cpp.

92 {
93 return sunPath;
94 }

◆ init()

void net::un::SocketAddress::init ( )

Definition at line 71 of file SocketAddress.cpp.

71 {
72 if (sunPath.length() < sizeof(sockAddr.sun_path)) {
73 const std::size_t len = sunPath.length();
74 std::memcpy(sockAddr.sun_path, sunPath.data(), len);
75 sockAddr.sun_path[len] = 0;
76 sockAddrLen = static_cast<SockLen>(offsetof(sockaddr_un, sun_path) + len + 1);
77 } else {
79 core::socket::STATE_FATAL,
80 "Unix-Domain error sun-path to long: Lenght is = " + std::to_string(sunPath.length()) +
81 ", should be: " + std::to_string(sizeof(sockAddr.sun_path) - 1),
82 EINVAL);
83 }
84 }

◆ setSunPath()

SocketAddress & net::un::SocketAddress::setSunPath ( const std::string & sunPath)

Definition at line 86 of file SocketAddress.cpp.

86 {
87 this->sunPath = sunPath;
88
89 return *this;
90 }

Referenced by SocketAddress().

Here is the caller graph for this function:

◆ toString()

std::string net::un::SocketAddress::toString ( bool expanded = true) const
overridevirtual

Implements core::socket::SocketAddress.

Definition at line 96 of file SocketAddress.cpp.

96 {
97 return sockAddr.sun_path[0] != '\0' ? sockAddr.sun_path : std::string("@").append(sockAddr.sun_path + 1);
98 }

Member Data Documentation

◆ sunPath

std::string net::un::SocketAddress::sunPath
private

Definition at line 75 of file SocketAddress.h.


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