Kea: unix_command_mgr.h Source File

| Kea 3.2.0-git

unix_command_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2015-2025 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 UNIX_COMMAND_MGR_H
8#define UNIX_COMMAND_MGR_H
9
10#include <asiolink/io_service.h>
11#include <cc/data.h>
12#include <config/unix_command_config.h>
13
14#include <exceptions/exceptions.h>
15#include <boost/noncopyable.hpp>
16#include <boost/shared_ptr.hpp>
17
18namespace isc {
19namespace config {
20
22 class SocketError : public Exception {
23public:
24 SocketError(const char* file, size_t line, const char* what) :
25 isc::Exception(file, line, what) { }
26};
27
28class UnixCommandMgrImpl;
29
33 class UnixCommandMgr : public boost::noncopyable {
34public:
35
40 static UnixCommandMgr& instance();
41
47 void setIOService(const asiolink::IOServicePtr& io_service);
48
52 void setConnectionTimeout(const long timeout);
53
60 void addExternalSockets(bool use_external = true);
61
69 void openCommandSockets(const isc::data::ConstElementPtr config);
70
83 void openCommandSocket(const isc::data::ConstElementPtr config);
84
91 void closeCommandSocket(UnixSocketInfoPtr info = UnixSocketInfoPtr());
92
94 void closeCommandSockets();
95
103 int getControlSocketFD(UnixSocketInfoPtr info = UnixSocketInfoPtr());
104
105private:
106
108 UnixCommandMgr();
109
111 boost::shared_ptr<UnixCommandMgrImpl> impl_;
112};
113
114} // end of isc::config namespace
115} // end of isc namespace
116#endif
isc::Exception::Exception
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
Definition exceptions/exceptions.cc:17
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition exceptions/exceptions.cc:32
isc::config::SocketError::SocketError
SocketError(const char *file, size_t line, const char *what)
Definition unix_command_mgr.h:24
isc::config::UnixCommandMgr::instance
static UnixCommandMgr & instance()
UnixCommandMgr is a singleton class.
Definition unix_command_mgr.cc:786
isc::config::UnixCommandMgr::setIOService
void setIOService(const asiolink::IOServicePtr &io_service)
Sets IO service to be used by the unix command manager.
Definition unix_command_mgr.cc:792
isc::config::UnixCommandMgr::getControlSocketFD
int getControlSocketFD(UnixSocketInfoPtr info=UnixSocketInfoPtr())
Returns unix control socket descriptor.
Definition unix_command_mgr.cc:781
isc::config::UnixCommandMgr::openCommandSockets
void openCommandSockets(const isc::data::ConstElementPtr config)
Opens unix control socket with parameters specified in socket_info (required parameters: socket-type:...
Definition unix_command_mgr.cc:766
isc::config::UnixCommandMgr::closeCommandSockets
void closeCommandSockets()
Shuts down any open unix control sockets.
Definition unix_command_mgr.cc:776
isc::config::UnixCommandMgr::addExternalSockets
void addExternalSockets(bool use_external=true)
Use external sockets flag.
Definition unix_command_mgr.cc:802
isc::config::UnixCommandMgr::closeCommandSocket
void closeCommandSocket(UnixSocketInfoPtr info=UnixSocketInfoPtr())
Shuts down any open unix control sockets.
Definition unix_command_mgr.cc:771
isc::config::UnixCommandMgr::setConnectionTimeout
void setConnectionTimeout(const long timeout)
Override default connection timeout.
Definition unix_command_mgr.cc:797
isc::config::UnixCommandMgr::openCommandSocket
void openCommandSocket(const isc::data::ConstElementPtr config)
Opens unix control socket with parameters specified in socket_info (required parameters: socket-type:...
Definition unix_command_mgr.cc:761
data.h
exceptions.h
io_service.h
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition io_service.h:35
isc::config
Definition command_interpreter.cc:23
isc::config::UnixSocketInfoPtr
boost::shared_ptr< UnixSocketInfo > UnixSocketInfoPtr
Pointer to a UnixSocketInfo object.
Definition unix_command_config.h:152
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
unix_command_config.h