Low-level RAII abstraction for UNIX Domain Datagram Sockets (AF_UNIX / SOCK_DGRAM). Provides discrete, boundary-preserving, zero-fragmentation message passing.
More...
#include <DomainSocket.hpp>
Low-level RAII abstraction for UNIX Domain Datagram Sockets (AF_UNIX / SOCK_DGRAM). Provides discrete, boundary-preserving, zero-fragmentation message passing.
◆ DomainSocket() [1/3]
| corium::ipc::DomainSocket::DomainSocket |
( |
| ) |
|
|
defaultnoexcept |
◆ ~DomainSocket()
| corium::ipc::DomainSocket::~DomainSocket |
( |
| ) |
|
|
inline |
◆ DomainSocket() [2/3]
| corium::ipc::DomainSocket::DomainSocket |
( |
const DomainSocket & |
| ) |
|
|
delete |
◆ DomainSocket() [3/3]
| corium::ipc::DomainSocket::DomainSocket |
( |
DomainSocket && |
other | ) |
|
|
inlinenoexcept |
◆ bind()
| bool corium::ipc::DomainSocket::bind |
( |
const std::string & |
socketPath | ) |
|
|
inlinenoexcept |
Bind socket to a filesystem path as a receiving server.
- Parameters
-
| socketPath | Filesystem path for the socket (e.g. "/tmp/corium_daemon.sock"). |
- Returns
- true on success, false otherwise.
◆ close()
| void corium::ipc::DomainSocket::close |
( |
| ) |
|
|
inlinenoexcept |
Close socket and unlink bound file if server.
◆ connect()
| bool corium::ipc::DomainSocket::connect |
( |
const std::string & |
socketPath, |
|
|
const std::string & |
clientPath = "" |
|
) |
| |
|
inlinenoexcept |
Connect to a destination socket as a client.
- Parameters
-
| socketPath | Filesystem path of the target server socket. |
| clientPath | Optional path to bind this client for bidirectional responses. |
- Returns
- true on success, false otherwise.
◆ isOpen()
| bool corium::ipc::DomainSocket::isOpen |
( |
| ) |
const |
|
inlinenoexcept |
Check if socket descriptor is open.
◆ nativeHandle()
| int corium::ipc::DomainSocket::nativeHandle |
( |
| ) |
const |
|
inlinenoexcept |
Access underlying OS file descriptor.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ receive()
| int corium::ipc::DomainSocket::receive |
( |
void * |
buffer, |
|
|
std::size_t |
maxLength |
|
) |
| |
|
inlinenoexcept |
Receive datagram packet from socket.
- Parameters
-
| buffer | Destination buffer. |
| maxLength | Maximum bytes to receive. |
- Returns
- Number of bytes received, or -1 on error/EWOULDBLOCK.
◆ send()
| int corium::ipc::DomainSocket::send |
( |
const void * |
buffer, |
|
|
std::size_t |
length |
|
) |
| |
|
inlinenoexcept |
Send datagram packet over the connected socket.
- Parameters
-
| buffer | Pointer to payload. |
| length | Payload length in bytes. |
- Returns
- Number of bytes sent, or -1 on error.
◆ setNonBlocking()
| void corium::ipc::DomainSocket::setNonBlocking |
( |
bool |
nonBlocking | ) |
|
|
inlinenoexcept |
Set socket non-blocking mode.
The documentation for this class was generated from the following file: