diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2018-08-23 13:42:31 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2024-09-06 09:08:10 -0400 |
commit | 955d4077aac621697246bcb20a854ba97e37c519 (patch) | |
tree | dfc5dbe7cb27946571fd4352f29cf33491fa8816 /src/interfaces | |
parent | 4da20434d4d68b7933e39aca36faa6fd2264cc45 (diff) |
multiprocess: Add IPC connectAddress and listenAddress methods
Allow listening on and connecting to unix sockets.
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/ipc.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/interfaces/ipc.h b/src/interfaces/ipc.h index 963649fc9a..fb340552c5 100644 --- a/src/interfaces/ipc.h +++ b/src/interfaces/ipc.h @@ -41,6 +41,11 @@ class Init; //! to make other proxy objects calling other remote interfaces. It can also //! destroy the initial interfaces::Init object to close the connection and //! shut down the spawned process. +//! +//! When connecting to an existing process, the steps are similar to spawning a +//! new process, except a socket is created instead of a socketpair, and +//! destroying an Init interface doesn't end the process, since there can be +//! multiple connections. class Ipc { public: @@ -54,6 +59,17 @@ public: //! true. If this is not a spawned child process, return false. virtual bool startSpawnedProcess(int argc, char* argv[], int& exit_status) = 0; + //! Connect to a socket address and make a client interface proxy object + //! using provided callback. connectAddress returns an interface pointer if + //! the connection was established, returns null if address is empty ("") or + //! disabled ("0") or if a connection was refused but not required ("auto"), + //! and throws an exception if there was an unexpected error. + virtual std::unique_ptr<Init> connectAddress(std::string& address) = 0; + + //! Connect to a socket address and make a client interface proxy object + //! using provided callback. Throws an exception if there was an error. + virtual void listenAddress(std::string& address) = 0; + //! Add cleanup callback to remote interface that will run when the //! interface is deleted. template<typename Interface> |