kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
|
Abstraction for an XML-RPC server. More...
#include <XmlRpcServer.hpp>
Public Member Functions | |
XmlRpcServer (uint16_t listen_port) | |
Create an XML-RPC server which listens on all interfaces on the given port. More... | |
XmlRpcServer (const struct sockaddr *sa, socklen_t sa_len) | |
Create an XML-RPC server listening on the interfaces and ports as specified by the given sockaddr object. More... | |
XmlRpcServer (const XmlRpcServer &)=delete | |
XmlRpcServer & | operator= (const XmlRpcServer &)=delete |
XmlRpcServer (XmlRpcServer &&)=delete | |
XmlRpcServer & | operator= (XmlRpcServer &&)=delete |
~XmlRpcServer () | |
void | start () |
Start the XML-RPC server. More... | |
void | stop () |
Stop the XML-RPC server. More... | |
void | register_method_handler (std::string_view name, std::function< std::optional< std::string >(const std::string &)> handler) |
Register a method handler. More... | |
Abstraction for an XML-RPC server.
This class represents an abstraction for interacting with an underlying XML-RPC server library.
After initialization, the server needs to be provided with method handlers. These can be registered by specifying a name and function pointer to register_method_handler()
. When an RPC call is received, the server unpacks the parameters and calls the specified method handler. The return value of the function (if defined) is then packed into the RPC result. If no return value exists, nil is returned.
Exceptions occuring during execution of a method handler result in the RPC result indicating an error.
Definition at line 30 of file XmlRpcServer.hpp.
|
explicit |
Create an XML-RPC server which listens on all interfaces on the given port.
Definition at line 86 of file XmlRpcServer.cpp.
aai::XmlRpcServer::XmlRpcServer | ( | const struct sockaddr * | sa, |
socklen_t | sa_len | ||
) |
Create an XML-RPC server listening on the interfaces and ports as specified by the given sockaddr object.
Definition at line 90 of file XmlRpcServer.cpp.
|
delete |
|
delete |
aai::XmlRpcServer::~XmlRpcServer | ( | ) |
Definition at line 94 of file XmlRpcServer.cpp.
|
delete |
|
delete |
void aai::XmlRpcServer::register_method_handler | ( | std::string_view | name, |
std::function< std::optional< std::string >(const std::string &)> | handler | ||
) |
Register a method handler.
This function registers the specified function as handler for the method with the given name. This function template does not support arbitrary handler method signatures. Compiler errors may indicate that a certain handler method signature is not supported.
Definition at line 120 of file XmlRpcServer.cpp.
void aai::XmlRpcServer::start | ( | ) |
Start the XML-RPC server.
This function starts the XML-RPC server in a separate thread. It can be terminated by calling stop().
Definition at line 100 of file XmlRpcServer.cpp.
void aai::XmlRpcServer::stop | ( | ) |
Stop the XML-RPC server.
Definition at line 111 of file XmlRpcServer.cpp.