![]() |
Bitcoin Core 31.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 (mp::Stream stream)=0 |
| Return Init interface that forwards requests over given connection stream. More... | |
| virtual void | listen (mp::SocketId listen_fd, interfaces::Init &init)=0 |
| Listen for connections on provided socket id, accept them, and handle requests on accepted connections. More... | |
| virtual void | serve (interfaces::Init &init, const std::function< mp::Stream()> &make_stream)=0 |
| Handle requests from a stream provided by the make_stream callback, forwarding them to the provided Init interface. More... | |
| virtual mp::Stream | makeStream (mp::SocketId socket)=0 |
| Make stream object from socket id. More... | |
| virtual void | disconnectIncoming ()=0 |
| Disconnect any incoming connections that are still connected. 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 22 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 connection stream.
Socket communication is handled on a background thread.
|
pure virtual |
Disconnect any incoming connections that are still connected.
|
pure virtual |
Listen for connections on provided socket id, accept them, and handle requests on accepted connections.
This method doesn't block, and performs I/O on a background thread.
|
pure virtual |
Make stream object from socket id.
|
pure virtual |
Handle requests from a stream provided by the make_stream callback, forwarding them to the provided Init interface.
Socket communication is handled on the current thread, and this call blocks until the socket is closed. A callback is used to specify the stream because this method initializes the event loop and it may not be possible to create the stream before the event loop is initialized.