kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
XmlRpcServer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <memory>
5#include <optional>
6#include <string>
7#include <string_view>
8
9#include <sys/socket.h>
10#include <sys/types.h>
11
12namespace aai
13{
14struct XmlRpcServerPrivate;
15
31{
32public:
36 explicit XmlRpcServer(uint16_t listen_port);
41 XmlRpcServer(const struct sockaddr* sa, socklen_t sa_len);
42 XmlRpcServer(const XmlRpcServer&) = delete;
47
54 void start();
58 void stop();
59
67 void register_method_handler(std::string_view name,
68 std::function<std::optional<std::string>(const std::string&)>
69 handler);
70
71private:
72 std::unique_ptr<XmlRpcServerPrivate> priv{nullptr};
73};
74} // namespace aai
Abstraction for an XML-RPC server.
XmlRpcServer(XmlRpcServer &&)=delete
XmlRpcServer & operator=(XmlRpcServer &&)=delete
XmlRpcServer(uint16_t listen_port)
Create an XML-RPC server which listens on all interfaces on the given port.
XmlRpcServer & operator=(const XmlRpcServer &)=delete
void register_method_handler(std::string_view name, std::function< std::optional< std::string >(const std::string &)> handler)
Register a method handler.
void stop()
Stop the XML-RPC server.
XmlRpcServer(const XmlRpcServer &)=delete
void start()
Start the XML-RPC server.