21#include <boost/shared_ptr.hpp>
187 void openSockets(
const uint16_t family,
const uint16_t port,
188 const bool use_bcast =
true);
211 void use(
const uint16_t family,
const std::string& iface_name);
249 const std::string& socket_type_name);
253 return (socket_type_);
314 re_detect_ = re_detect;
321 service_socket_require_all_ = require_all;
328 return (service_socket_require_all_);
335 service_sockets_retry_wait_time_ = interval;
342 return (service_sockets_retry_wait_time_);
349 service_sockets_max_retries_ = max_retries;
356 return (service_sockets_max_retries_);
363 return (reconnect_ctl_);
383 const bool use_bcast =
true);
399 static bool multipleAddressesPerInterfaceActive();
412 void setState(
const uint16_t family,
const bool inactive,
413 const bool loopback_inactive)
const;
425 void setIfaceAddrsState(
const uint16_t family,
const bool active,
436 static void socketOpenErrorHandler(
const std::string& errmsg);
454 static std::pair<bool, bool> openSocketsForFamily(
const uint16_t family,
456 const bool can_use_bcast,
457 const bool skip_opened);
481 const uint16_t family,
const uint16_t port,
482 const bool can_use_bcast,
bool skip_opened)
const;
485 typedef std::set<std::string> IfaceSet;
492 typedef std::multimap<std::string, asiolink::IOAddress> ExplicitAddressMap;
496 ExplicitAddressMap address_map_;
509 bool service_socket_require_all_;
512 uint32_t service_sockets_retry_wait_time_;
515 uint32_t service_sockets_max_retries_;
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static const char * ALL_IFACES_KEYWORD
Keyword used to enable all interfaces.
void closeSockets() const
Convenience function which closes all open sockets.
std::string socketTypeToText() const
Returns the socket type in the textual format.
void update(CfgIface &other)
Update runtime mutable members.
void setReDetect(bool re_detect)
Set the re-detect flag.
void setServiceSocketsRetryWaitTime(uint32_t interval)
Set the socket service binding retry interval between attempts.
void reset()
Puts the interface configuration into default state.
uint32_t getServiceSocketsRetryWaitTime() const
Indicates the socket service binding retry interval between attempts.
util::ReconnectCtlPtr getReconnectCtl() const
Get the reconnect controller.
OutboundIface getOutboundIface() const
Returns outbound interface selection mode.
SocketType getSocketType() const
Returns DHCP socket type used by the server.
SocketType
Socket type used by the DHCPv4 server.
@ SOCKET_UDP
Datagram socket, i.e. IP/UDP socket.
@ SOCKET_RAW
Raw socket, used for direct DHCPv4 traffic.
bool getServiceSocketsRequireAll() const
Indicates that Kea must successfully bind all socket services on init.
bool operator!=(const CfgIface &other) const
Inequality operator.
void openSockets(const uint16_t family, const uint16_t port, const bool use_bcast=true)
Tries to open sockets on selected interfaces.
static OutboundIface textToOutboundIface(const std::string &txt)
Converts text to outbound interface selection mode.
void use(const uint16_t family, const std::string &iface_name)
Select interface to be used to receive DHCP traffic.
bool equals(const CfgIface &other) const
Compares two CfgIface objects for equality.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void setServiceSocketsRequireAll(bool require_all)
Set flag that Kea must successfully bind all socket services on init.
std::string outboundTypeToText() const
Returns outbound interface selection mode as string.
void setOutboundIface(const OutboundIface &outbound_iface)
Sets outbound interface selection mode.
void setServiceSocketsMaxRetries(uint32_t max_retries)
Set a maximum number of service sockets bind attempts.
SocketType textToSocketType(const std::string &socket_type_name) const
Converts the socket type in the textual format to the type represented by the SocketType.
OutboundIface
Indicates how outbound interface is selected for relayed traffic.
@ USE_ROUTING
Server uses routing to determine the right interface to send response.
@ SAME_AS_INBOUND
Server sends responses over the same interface on which queries are received.
bool operator==(const CfgIface &other) const
Equality operator.
static OpenSocketsFailedCallback open_sockets_failed_callback_
Optional callback function to invoke if all retries of the opening sockets fail.
void useSocketType(const uint16_t family, const SocketType &socket_type)
Sets the specified socket type to be used by the server.
std::function< void(util::ReconnectCtlPtr)> OpenSocketsFailedCallback
Represents a callback invoked if all retries of the opening sockets fail.
uint32_t getServiceSocketsMaxRetries() const
Indicates the maximum number of service sockets bind attempts.
void triggerOpenSocketsWithRetry(const uint16_t family, const uint16_t port, const bool use_bcast=true)
Trigger the reopen sockets with retry mechanism.
DuplicateAddress(const char *file, size_t line, const char *what)
DuplicateIfaceName(const char *file, size_t line, const char *what)
Represents a single network interface.
InvalidIfaceName(const char *file, size_t line, const char *what)
InvalidSocketType(const char *file, size_t line, const char *what)
NoSuchAddress(const char *file, size_t line, const char *what)
NoSuchIface(const char *file, size_t line, const char *what)
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< const CfgIface > ConstCfgIfacePtr
A pointer to the const CfgIface.
boost::shared_ptr< CfgIface > CfgIfacePtr
A pointer to the CfgIface .
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.