Kea 2.7.5
client_connection.h
Go to the documentation of this file.
1// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef CLIENT_CONNECTION_H
8#define CLIENT_CONNECTION_H
9
10#include <asiolink/io_service.h>
11#include <cc/json_feed.h>
12#include <boost/shared_ptr.hpp>
13#include <functional>
14
15namespace isc {
16namespace config {
17
18class ClientConnectionImpl;
19
71public:
72
75
76
78 struct SocketPath {
79 explicit SocketPath(const std::string& socket_path)
80 : socket_path_(socket_path) { }
81
82 std::string socket_path_;
83 };
84
87 explicit ControlCommand(const std::string control_command)
88 : control_command_(control_command) { }
89
90 std::string control_command_;
91 };
92
94 struct Timeout {
95 explicit Timeout(const long timeout)
96 : timeout_(timeout) { }
97
99 };
100
102
105 typedef std::function<void(const boost::system::error_code& ec,
107
111 explicit ClientConnection(const asiolink::IOServicePtr& io_service);
112
143 void start(const SocketPath& socket_path, const ControlCommand& command,
144 Handler handler, const Timeout& timeout = Timeout(5000));
145
146private:
147
149 boost::shared_ptr<ClientConnectionImpl> impl_;
150
151};
152
154typedef boost::shared_ptr<ClientConnection> ClientConnectionPtr;
155
156} // end of namespace config
157} // end of namespace isc
158
159#endif // CLIENT_CONNECTION_H
Represents client side connection over the unix domain socket.
std::function< void(const boost::system::error_code &ec, const ConstJSONFeedPtr &feed) Handler)
Type of the callback invoked when the communication with the server is complete or an error has occur...
ClientConnection(const asiolink::IOServicePtr &io_service)
Constructor.
void start(const SocketPath &socket_path, const ControlCommand &command, Handler handler, const Timeout &timeout=Timeout(5000))
Starts asynchronous transaction with a remote endpoint.
boost::shared_ptr< const JSONFeed > ConstJSONFeedPtr
Pointer to the const JSONFeed.
Definition json_feed.h:27
boost::shared_ptr< ClientConnection > ClientConnectionPtr
Type of the pointer to the ClientConnection object.
Defines the logger used by the top-level component of kea-lfc.
ControlCommand(const std::string control_command)
SocketPath(const std::string &socket_path)