Bitcoin Core 28.99.0
P2P Digital Currency
|
IPC protocol interface for calling IPC methods over sockets. More...
#include <protocol.h>
Public Member Functions | |
virtual | ~Protocol ()=default |
virtual std::unique_ptr< interfaces::Init > | connect (int fd, const char *exe_name)=0 |
Return Init interface that forwards requests over given socket descriptor. More... | |
virtual void | listen (int listen_fd, const char *exe_name, interfaces::Init &init)=0 |
Listen for connections on provided socket descriptor, accept them, and handle requests on accepted connections. More... | |
virtual void | serve (int fd, const char *exe_name, interfaces::Init &init, const std::function< void()> &ready_fn={})=0 |
Handle requests on provided socket descriptor, forwarding them to the provided Init interface. More... | |
virtual void | addCleanup (std::type_index type, void *iface, std::function< void()> cleanup)=0 |
Add cleanup callback to interface that will run when the interface is deleted. More... | |
virtual Context & | context ()=0 |
Context accessor. More... | |
IPC protocol interface for calling IPC methods over sockets.
There may be different implementations of this interface for different IPC protocols (e.g. Cap'n Proto, gRPC, JSON-RPC, or custom protocols).
Definition at line 21 of file protocol.h.
|
virtualdefault |
|
pure virtual |
Add cleanup callback to interface that will run when the interface is deleted.
|
pure virtual |
Return Init interface that forwards requests over given socket descriptor.
Socket communication is handled on a background thread.
|
pure virtual |
Listen for connections on provided socket descriptor, accept them, and handle requests on accepted connections.
This method doesn't block, and performs I/O on a background thread.
|
pure virtual |
Handle requests on provided socket descriptor, forwarding them to the provided Init interface.
Socket communication is handled on the current thread, and this call blocks until the socket is closed.
ready_fn
callback will be called after the event loop is created but before it is started. This can be useful in tests to trigger client connections from another thread as soon as the event loop is available, but should not be necessary in normal code which starts clients and servers independently.