23 for (
auto const& iface : ifaces_list->listValue()) {
24 std::string iface_name = iface->stringValue();
26 cfg_iface->use(protocol_, iface_name);
28 }
catch (
const std::exception& ex) {
30 << ex.what() <<
" (" << iface->getPosition() <<
")");
36 : protocol_(protocol), test_mode_(test_mode) {
44 bool re_detect =
getBoolean(ifaces_config,
"re-detect");
45 cfg->setReDetect(re_detect);
46 if (re_detect && !test_mode_) {
51 bool socket_type_specified =
false;
52 for (
auto const& element : ifaces_config->mapValue()) {
54 if (element.first ==
"re-detect") {
58 if (element.first ==
"interfaces") {
63 if (element.first ==
"dhcp-socket-type") {
64 if (protocol_ == AF_INET) {
65 cfg->useSocketType(AF_INET, element.second->stringValue());
66 socket_type_specified =
true;
70 "dhcp-socket-type is not supported in DHCPv6");
74 if (element.first ==
"outbound-interface") {
75 if (protocol_ == AF_INET) {
78 cfg->setOutboundIface(type);
82 "outbound-interface is not supported in DHCPv6");
86 if (element.first ==
"service-sockets-require-all") {
87 cfg->setServiceSocketsRequireAll(element.second->boolValue());
91 if (element.first ==
"service-sockets-retry-wait-time") {
92 cfg->setServiceSocketsRetryWaitTime(
static_cast<uint32_t
>(element.second->intValue()));
96 if (element.first ==
"service-sockets-max-retries") {
97 cfg->setServiceSocketsMaxRetries(
static_cast<uint32_t
>(element.second->intValue()));
101 if (element.first ==
"user-context") {
102 cfg->setContext(element.second);
111 << element.first <<
"'");
112 }
catch (
const std::exception& ex) {
115 << element.second->getPosition() <<
")");
122 if (!socket_type_specified && (protocol_ == AF_INET) ) {
124 .arg(cfg->socketTypeToText());
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
static OutboundIface textToOutboundIface(const std::string &txt)
Converts text to outbound interface selection mode.
OutboundIface
Indicates how outbound interface is selected for relayed traffic.
To be removed. Please use ConfigError instead.
void clearIfaces()
Removes detected interfaces.
void detectIfaces(bool update_only=false)
Detects network interfaces.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
void parse(const CfgIfacePtr &config, const isc::data::ConstElementPtr &values)
Parses content of the "interfaces-config".
IfacesConfigParser(const uint16_t protocol, bool test_mode)
Constructor.
void parseInterfacesList(const CfgIfacePtr &cfg_iface, isc::data::ConstElementPtr ifaces_list)
parses interfaces-list structure
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
boost::shared_ptr< const Element > ConstElementPtr
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
boost::shared_ptr< CfgIface > CfgIfacePtr
A pointer to the CfgIface .
const isc::log::MessageID DHCPSRV_CFGMGR_SOCKET_TYPE_DEFAULT
Defines the logger used by the top-level component of kea-lfc.