![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
Interface providing access to interprocess-communication (IPC) functionality. More...
#include <ipc.h>
Public Member Functions | |
| virtual | ~Ipc ()=default |
| virtual std::unique_ptr< Init > | spawnProcess (const char *exe_name)=0 |
| Spawn a child process returning pointer to its Init interface. | |
| virtual bool | startSpawnedProcess (int argc, char *argv[], int &exit_status)=0 |
| If this is a spawned process, block and handle requests from the parent process by forwarding them to this process's Init interface, then return true. | |
| virtual std::unique_ptr< Init > | connectAddress (std::string &address)=0 |
| Connect to a socket address and return a pointer to its Init interface. | |
| virtual void | listenAddress (std::string &address)=0 |
| Listen on a socket address exposing this process's init interface to clients. | |
| virtual void | disconnectIncoming ()=0 |
| Disconnect any incoming connections that are still connected. | |
| template<typename Interface > | |
| void | addCleanup (Interface &iface, std::function< void()> cleanup) |
| Add cleanup callback to remote interface that will run when the interface is deleted. | |
| virtual ipc::Context & | context ()=0 |
| IPC context struct accessor (see struct definition for more description). | |
Protected Member Functions | |
| virtual void | addCleanup (std::type_index type, void *iface, std::function< void()> cleanup)=0 |
| Internal implementation of public addCleanup method (above) as a type-erased virtual function, since template functions can't be virtual. | |
Interface providing access to interprocess-communication (IPC) functionality.
The IPC implementation is responsible for establishing connections between a controlling process and a process being controlled. When a connection is established, the process being controlled returns an interfaces::Init pointer to the controlling process, which the controlling process can use to get access to other interfaces and functionality.
When spawning a new process, the steps are:
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.
|
virtualdefault |
|
protectedpure virtual |
Internal implementation of public addCleanup method (above) as a type-erased virtual function, since template functions can't be virtual.
|
pure virtual |
Connect to a socket address and return a pointer to its Init interface.
Returns a non-null 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.
|
pure virtual |
IPC context struct accessor (see struct definition for more description).
Disconnect any incoming connections that are still connected.
Listen on a socket address exposing this process's init interface to clients.
Throws an exception if there was an error.
Spawn a child process returning pointer to its Init interface.
|
pure virtual |
If this is a spawned process, block and handle requests from the parent process by forwarding them to this process's Init interface, then return true.
If this is not a spawned child process, return false.