Typed IPC channel operating over UNIX Domain Datagram Sockets. Provides boundary-preserving, discrete event transmission with zero packet fragmentation.
More...
#include <UdsChannel.hpp>
|
| void | close () noexcept |
| | Close the socket connection and unlink socket file if server.
|
| |
| bool | connect (const std::string &serverPath, const std::string &clientPath="") noexcept |
| | Connect as a client to a server socket path.
|
| |
| bool | isOpen () const noexcept |
| | Check if socket is open.
|
| |
| bool | listen (const std::string &socketPath, bool nonBlocking=true) noexcept |
| | Start listening as an IPC server on a filesystem socket path.
|
| |
| template<typename EventType > |
| bool | post (EventType &&event) noexcept |
| | Post a typed event over the socket to the remote receiver.
|
| |
| template<typename SinkType > |
| std::size_t | pumpInto (const SinkType &sink, std::size_t maxEvents=0) |
| | Drain incoming UNIX domain socket events into a target event sink.
|
| |
| DomainSocket & | socket () noexcept |
| | Access underlying DomainSocket instance.
|
| |
| bool | tryPop (EventVariant &outEvent) noexcept |
| | Try popping one pending datagram event from the socket (non-blocking).
|
| |
| | UdsChannel ()=default |
| |
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
class corium::ipc::UdsChannel< EventVariant, MaxPacketSize >
Typed IPC channel operating over UNIX Domain Datagram Sockets. Provides boundary-preserving, discrete event transmission with zero packet fragmentation.
- Template Parameters
-
| EventVariant | Supported event variant list (must be trivially copyable or POD). |
| MaxPacketSize | Maximum serialized datagram packet buffer size (default 512 bytes). |
◆ UdsChannel()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
◆ close()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
Close the socket connection and unlink socket file if server.
◆ connect()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
| bool corium::ipc::UdsChannel< EventVariant, MaxPacketSize >::connect |
( |
const std::string & |
serverPath, |
|
|
const std::string & |
clientPath = "" |
|
) |
| |
|
inlinenoexcept |
Connect as a client to a server socket path.
- Parameters
-
| serverPath | Server destination socket path. |
| clientPath | Optional client socket path for bidirectional reply. |
- Returns
- true on success, false otherwise.
◆ isOpen()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
◆ listen()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
| bool corium::ipc::UdsChannel< EventVariant, MaxPacketSize >::listen |
( |
const std::string & |
socketPath, |
|
|
bool |
nonBlocking = true |
|
) |
| |
|
inlinenoexcept |
Start listening as an IPC server on a filesystem socket path.
- Parameters
-
| socketPath | Filesystem path (e.g. "/tmp/corium_control.sock"). |
| nonBlocking | If true, enables non-blocking mode for non-waiting event loop polling. |
- Returns
- true on success, false otherwise.
◆ post()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
template<typename EventType >
Post a typed event over the socket to the remote receiver.
- Template Parameters
-
- Parameters
-
- Returns
- true if datagram sent, false on socket error.
◆ pumpInto()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
template<typename SinkType >
| std::size_t corium::ipc::UdsChannel< EventVariant, MaxPacketSize >::pumpInto |
( |
const SinkType & |
sink, |
|
|
std::size_t |
maxEvents = 0 |
|
) |
| |
|
inline |
Drain incoming UNIX domain socket events into a target event sink.
- Template Parameters
-
| SinkType | Target EventSink or compatible sink. |
- Parameters
-
| sink | Target sink instance. |
| maxEvents | Maximum events to drain (0 = drain all pending). |
- Returns
- Number of events successfully transferred into local runtime.
◆ socket()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
◆ tryPop()
template<typename EventVariant = DefaultEvents, std::size_t MaxPacketSize = 512>
Try popping one pending datagram event from the socket (non-blocking).
- Parameters
-
| outEvent | Reference populated with received event variant. |
- Returns
- true if an event was received, false if socket has no pending datagrams.
The documentation for this class was generated from the following file: