37 : socket_type_(
"unix"), socket_name_() {
39 isc_throw(DhcpConfigError,
"expected map type ("
40 << config->getPosition() <<
")");
47 "invalid type specified for parameter 'socket-type' ("
48 << socket_type->getPosition() <<
")");
50 socket_type_ = socket_type->stringValue();
51 if ((socket_type_ !=
"unix")) {
53 << socket_type_ <<
"' not 'unix'");
57 if (
config->contains(
"socket-address")) {
58 isc_throw(DhcpConfigError,
59 "parameter 'socket-address' is not supported by UNIX "
69 isc_throw(DhcpConfigError,
70 "invalid type specified for parameter 'socket-name' ("
71 << socket_name->getPosition() <<
")");
75 socket_name_ = validatePath(socket_name->stringValue());
76 } catch (
const std::exception& ex) {
101 const std::string explicit_path ) {
102 if (!socket_path_checker_ || reset) {
103 socket_path_checker_.reset(
new PathChecker(CONTROL_SOCKET_DIR,
104 "KEA_CONTROL_SOCKET_DIR"));
105 if (!explicit_path.empty()) {
106 socket_path_checker_->getPath(
true, explicit_path);
110 return (socket_path_checker_->getPath());
115 if (!socket_path_checker_) {
119 auto valid_path = socket_path_checker_->validatePath(socket_path);
122 "socket path:" << socket_path_checker_->getPath()
123 <<
" does not exist or does not have permssions = "
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static std::string getSocketPath(bool reset=false, const std::string explicit_path="")
Fetches the supported control socket path.
static mode_t getSocketPathPerms()
Fetches the required socket path permissions mask.
UnixCommandConfig(isc::data::ConstElementPtr config)
Constructor.
static const mode_t DEFAULT_SOCKET_PATH_PERMS
Defines the default permissions for unix socket parent directory.
static void setSocketPathPerms(mode_t perms=DEFAULT_SOCKET_PATH_PERMS)
Sets the required socket path permissions mask.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
static std::string validatePath(const std::string socket_path)
Validates a path against the supported path for unix control sockets.
static mode_t socket_path_perms_
Stores the default permissions for unix socket parent directory.
To be removed. Please use ConfigError instead.
Embodies a supported path against which file paths can be validated.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< PathChecker > PathCheckerPtr
Defines a pointer to a PathChecker.
Defines the logger used by the top-level component of kea-lfc.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
void setContext(const data::ConstElementPtr &ctx)
Sets user context.