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 36 of file SocketAddress.h.

Member Typedef Documentation

◆ Super

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

Definition at line 38 of file SocketAddress.h.

Constructor & Destructor Documentation

◆ SocketAddress() [1/3]

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

Definition at line 35 of file SocketAddress.cpp.

36 : Super(AF_UNIX, offsetof(sockaddr_un, sun_path)) {
37 }
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 39 of file SocketAddress.cpp.

40 : SocketAddress() {
42 }
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 44 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 70 of file SocketAddress.cpp.

70 {
71 return sunPath;
72 }

◆ init()

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

Definition at line 49 of file SocketAddress.cpp.

49 {
50 if (sunPath.length() < sizeof(sockAddr.sun_path)) {
51 const std::size_t len = sunPath.length();
52 std::memcpy(sockAddr.sun_path, sunPath.data(), len);
53 sockAddr.sun_path[len] = 0;
54 sockAddrLen = static_cast<SockLen>(offsetof(sockaddr_un, sun_path) + len + 1);
55 } else {
57 core::socket::STATE_FATAL,
58 "Unix-Domain error sun-path to long: Lenght is = " + std::to_string(sunPath.length()) +
59 ", should be: " + std::to_string(sizeof(sockAddr.sun_path) - 1),
60 EINVAL);
61 }
62 }

◆ setSunPath()

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

Definition at line 64 of file SocketAddress.cpp.

64 {
65 this->sunPath = sunPath;
66
67 return *this;
68 }

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 74 of file SocketAddress.cpp.

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

Member Data Documentation

◆ sunPath

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

Definition at line 53 of file SocketAddress.h.


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