 |
Kea
1.5.0
|
Go to the documentation of this file.
12 #include <boost/foreach.hpp>
14 #include <sys/types.h>
22 IfacesConfigParser::parseInterfacesList(
const CfgIfacePtr& cfg_iface,
25 std::string iface_name = iface->stringValue();
27 cfg_iface->use(protocol_, iface_name);
29 }
catch (
const std::exception& ex) {
30 isc_throw(DhcpConfigError,
"Failed to select interface: "
31 << ex.what() <<
" (" << iface->getPosition() <<
")");
36 IfacesConfigParser::IfacesConfigParser(
const uint16_t protocol)
37 : protocol_(protocol) {
45 bool re_detect =
getBoolean(ifaces_config,
"re-detect");
46 cfg->setReDetect(re_detect);
55 bool socket_type_specified =
false;
56 BOOST_FOREACH(
ConfigPair element, ifaces_config->mapValue()) {
58 if (element.first ==
"re-detect") {
62 if (element.first ==
"interfaces") {
63 parseInterfacesList(cfg, element.second);
68 if (element.first ==
"dhcp-socket-type") {
69 if (protocol_ == AF_INET) {
70 cfg->useSocketType(AF_INET, element.second->stringValue());
71 socket_type_specified =
true;
75 "dhcp-socket-type is not supported in DHCPv6");
79 if (element.first ==
"outbound-interface") {
80 if (protocol_ == AF_INET) {
83 cfg->setOutboundIface(type);
87 "outbound-interface is not supported in DHCPv6");
91 if (element.first ==
"user-context") {
92 cfg->setContext(element.second);
101 << element.first <<
"'");
102 }
catch (
const std::exception& ex) {
105 << element.second->getPosition() <<
")");
112 if (!socket_type_specified && (protocol_ == AF_INET) ) {
114 .arg(cfg->socketTypeToText());
To be removed. Please use ConfigError instead.
void parse(const CfgIfacePtr &config, const isc::data::ConstElementPtr &values)
Parses content of the "interfaces-config".
void detectIfaces()
Detects network interfaces.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void closeSockets()
Closes all open sockets.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
std::pair< std::string, isc::data::ConstElementPtr > ConfigPair
Combination of parameter name and configuration contents.
boost::shared_ptr< const Element > ConstElementPtr
static OutboundIface textToOutboundIface(const std::string &txt)
Converts text to outbound interface selection mode.
OutboundIface
Indicates how outbound interface is selected for relayed traffic.
boost::shared_ptr< CfgIface > CfgIfacePtr
A pointer to the CfgIface .
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
void clearIfaces()
Removes detected interfaces.