20#include <boost/foreach.hpp>
21#include <boost/scoped_ptr.hpp>
22#include <boost/bind.hpp>
30#include <netinet/in.h>
33#include <sys/select.h>
36#define FD_COPY(orig, copy) \
38 memmove(copy, orig, sizeof(fd_set)); \
64 :
name_(name), ifindex_(ifindex), mac_len_(0), hardware_type_(0),
65 flag_loopback_(false), flag_up_(false), flag_running_(false),
66 flag_multicast_(false), flag_broadcast_(false), flags_(0),
67 inactive4_(false), inactive6_(false)
91 if ((family != AF_INET) && (family != AF_INET6)) {
93 <<
" specified when requested to close all sockets"
94 <<
" which belong to this family");
98 SocketCollection::iterator sock =
sockets_.begin();
100 if (sock->family_ == family) {
103 close(sock->sockfd_);
105 if (sock->fallbackfd_ >= 0) {
106 close(sock->fallbackfd_);
131 for (
int i = 0; i <
mac_len_; i++) {
133 tmp << static_cast<int>(
mac_[i]);
144 <<
" was detected to have link address of length "
145 << len <<
", but maximum supported length is "
150 memcpy(
mac_, mac, len);
155 for (AddressCollection::iterator a =
addrs_.begin();
157 if (a->get() == addr) {
166 list<SocketInfo>::iterator sock =
sockets_.begin();
168 if (sock->sockfd_ == sockfd) {
171 if (sock->fallbackfd_ >= 0) {
172 close(sock->fallbackfd_);
186 allow_loopback_(false) {
193 }
catch (
const std::exception& ex) {
204 }
catch (
const std::exception& ex) {
211 if (a.
get() == addr) {
213 <<
" already defined on the " <<
name_ <<
" interface.");
226 if (addr.
get().isV4()) {
227 address = addr.
get();
238 if (address == addr.
get()) {
252 for (AddressCollection::iterator addr_it =
addrs_.begin();
253 addr_it !=
addrs_.end(); ++addr_it) {
254 if (address == addr_it->get()) {
260 " found on the interface " <<
getName());
265 for (AddressCollection::iterator addr_it =
addrs_.begin();
266 addr_it !=
addrs_.end(); ++addr_it) {
287 iface->closeSockets();
293 dhcp_receiver_->stop();
296 dhcp_receiver_.reset();
313 return (packet_filter_->isDirectResponseSupported());
335 callbacks_.push_back(x);
340 for (SocketCallbackInfoContainer::iterator s = callbacks_.begin();
341 s != callbacks_.end(); ++s) {
342 if (s->socket_ == socketfd) {
357 if (!packet_filter) {
370 "it is not allowed to set new packet"
371 <<
" filter when there are open IPv4 sockets - need"
372 <<
" to close them first");
375 packet_filter_ = packet_filter;
380 if (!packet_filter) {
388 "it is not allowed to set new packet"
389 <<
" filter when there are open IPv6 sockets - need"
390 <<
" to close them first");
393 packet_filter6_ = packet_filter;
400 BOOST_FOREACH(
SocketInfo sock, iface->getSockets()) {
416 BOOST_FOREACH(
SocketInfo sock, iface->getSockets()) {
419 if (sock.
addr_ == addr) {
427 if (addr == a.
get()) {
440 const string v4addr(
"127.0.0.1"), v6addr(
"::1");
446 if (if_nametoindex(
"lo") > 0) {
449 }
else if (if_nametoindex(
"lo0") > 0) {
455 "Interface detection on this OS is not supported.");
458 IfacePtr iface(
new Iface(ifaceName, if_nametoindex(ifaceName.c_str())));
459 iface->flag_up_ =
true;
460 iface->flag_running_ =
true;
466 iface->flag_loopback_ =
false;
467 iface->flag_multicast_ =
true;
468 iface->flag_broadcast_ =
true;
469 iface->setHWType(HWTYPE_ETHERNET);
485 if (iface->inactive4_) {
496 if (iface->flag_loopback_ && !allow_loopback_) {
498 "must not open socket on the loopback"
499 " interface " << iface->getName());
504 if (!iface->flag_up_) {
506 "the interface " << iface->getName()
511 if (!iface->flag_running_) {
513 "the interface " << iface->getName()
514 <<
" is not running");
519 if (!iface->getAddress4(out_address)) {
521 "the interface " << iface->getName()
522 <<
" has no usable IPv4 addresses configured");
536 if (iface->flag_broadcast_ && use_bcast) {
552 "Binding socket to an interface is not"
553 " supported on this OS; therefore only"
554 " one socket listening to broadcast traffic"
555 " can be opened. Sockets will not be opened"
556 " on remaining interfaces");
566 "failed to open socket on interface "
567 << iface->getName() <<
", reason: "
581 openSocket(iface->getName(), addr.
get(), port,
false,
false);
584 "failed to open socket on interface "
585 << iface->getName() <<
", reason: "
611 if (iface->inactive6_) {
622 if (iface->flag_loopback_ && !allow_loopback_) {
624 "must not open socket on the loopback"
625 " interface " << iface->getName());
628 }
else if (!iface->flag_up_) {
630 "the interface " << iface->getName()
633 }
else if (!iface->flag_running_) {
635 "the interface " << iface->getName()
636 <<
" is not running");
649 "Failed to open unicast socket on interface "
650 << iface->getName() <<
", reason: "
662 if (!addr.
get().isV6()) {
671 if (!addr.
get().isV6LinkLocal()){
678 if (openMulticastSocket(*iface, addr, port, error_handler)) {
708 dhcp_receiver_->start(boost::bind(&IfaceMgr::receiveDHCP4Packets,
this));
719 dhcp_receiver_->start(boost::bind(&IfaceMgr::receiveDHCP6Packets,
this));
732 out <<
"Detected interface " << iface->getFullName()
733 <<
", hwtype=" << iface->getHWType()
734 <<
", mac=" << iface->getPlainMac();
735 out <<
", flags=" << hex << iface->flags_ << dec <<
"("
736 << (iface->flag_loopback_?
"LOOPBACK ":
"")
737 << (iface->flag_up_?
"UP ":
"")
738 << (iface->flag_running_?
"RUNNING ":
"")
739 << (iface->flag_multicast_?
"MULTICAST ":
"")
740 << (iface->flag_broadcast_?
"BROADCAST ":
"")
742 out <<
" " << addrs.size() <<
" addr(s):";
745 out <<
" " << addr.
get().toText();
754 if (iface->getIndex() == ifindex)
764 if (iface->getName() == ifname)
779 iface->clearUnicasts();
784 const uint16_t port,
const bool receive_bcast,
785 const bool send_bcast) {
791 return openSocket4(*iface, addr, port, receive_bcast, send_bcast);
793 }
else if (addr.
isV6()) {
794 return openSocket6(*iface, addr, port, receive_bcast);
804 const uint8_t family) {
807 if ((iface->getFullName() != ifname) &&
808 (iface->getName() != ifname)) {
815 Iface::AddressCollection::iterator addr_it = addrs.begin();
816 while (addr_it != addrs.end()) {
817 if (addr_it->get().getFamily() == family) {
820 return (
openSocket(iface->getName(), *addr_it, port,
false));
826 if (addr_it == addrs.end()) {
828 std::string family_name(
"AF_INET");
829 if (family == AF_INET6) {
830 family_name =
"AF_INET6";
834 << ifname <<
", port: " << port <<
", address "
835 " family: " << family_name);
844 const uint16_t port) {
854 if (a.
get() == addr) {
857 return (
openSocket(iface->getName(), a, port,
false));
867 const uint16_t port) {
870 IOAddress local_address(getLocalAddress(remote_addr, port));
878IfaceMgr::getLocalAddress(
const IOAddress& remote_addr,
const uint16_t port) {
880 boost::scoped_ptr<const UDPEndpoint>
882 (UDPEndpoint::create(IPPROTO_UDP, remote_addr, port)));
883 if (!remote_endpoint) {
888 boost::asio::io_service io_service;
889 boost::asio::ip::udp::socket sock(io_service);
891 boost::system::error_code err_code;
894 if (remote_addr.
isV4() &&
907 sock.open(boost::asio::ip::udp::v4(), err_code);
909 const char* errstr = strerror(errno);
913 sock.set_option(boost::asio::socket_base::broadcast(
true), err_code);
921 sock.connect(remote_endpoint->getASIOEndpoint(), err_code);
928 boost::asio::ip::udp::socket::endpoint_type local_endpoint =
929 sock.local_endpoint();
930 boost::asio::ip::address local_address(local_endpoint.address());
941 const uint16_t port,
const bool receive_bcast,
942 const bool send_bcast) {
945 SocketInfo info = packet_filter_->openSocket(iface, addr, port,
946 receive_bcast, send_bcast);
957 << pkt->getIface() <<
") specified.");
961 return (packet_filter6_->send(*iface,
getSocket(*pkt), pkt));
970 << pkt->getIface() <<
") specified.");
974 return (packet_filter_->send(*iface,
getSocket(*pkt).sockfd_, pkt));
987 if (timeout_usec >= 1000000) {
989 " one million microseconds");
998 if (!callbacks_.empty()) {
1016 struct timeval select_timeout;
1018 select_timeout.tv_sec = timeout_sec;
1019 select_timeout.tv_usec = timeout_usec;
1021 select_timeout.tv_sec = 0;
1022 select_timeout.tv_usec = 0;
1028 int result = select(maxfd + 1, &sockets, NULL, NULL, &select_timeout);
1033 }
else if (result < 0) {
1041 if (errno == EINTR) {
1052 string msg = dhcp_receiver_->getLastError();
1059 if (!FD_ISSET(s.
socket_, &sockets)) {
1087 if (timeout_usec >= 1000000) {
1089 " one million microseconds");
1091 boost::scoped_ptr<SocketInfo> candidate;
1101 BOOST_FOREACH(iface,
ifaces_) {
1102 BOOST_FOREACH(
SocketInfo s, iface->getSockets()) {
1112 if (!callbacks_.empty()) {
1119 struct timeval select_timeout;
1120 select_timeout.tv_sec = timeout_sec;
1121 select_timeout.tv_usec = timeout_usec;
1126 int result = select(maxfd + 1, &sockets, NULL, NULL, &select_timeout);
1132 }
else if (result < 0) {
1140 if (errno == EINTR) {
1149 if (!FD_ISSET(s.
socket_, &sockets)) {
1166 BOOST_FOREACH(iface,
ifaces_) {
1167 BOOST_FOREACH(
SocketInfo s, iface->getSockets()) {
1168 if (FD_ISSET(s.
sockfd_, &sockets)) {
1184 return (packet_filter_->receive(*iface, *candidate));
1202 FD_SET(fd, sockets);
1211 if (timeout_usec >= 1000000) {
1213 " one million microseconds");
1216 boost::scoped_ptr<SocketInfo> candidate;
1226 BOOST_FOREACH(
SocketInfo s, iface->getSockets()) {
1236 if (!callbacks_.empty()) {
1243 struct timeval select_timeout;
1244 select_timeout.tv_sec = timeout_sec;
1245 select_timeout.tv_usec = timeout_usec;
1250 int result = select(maxfd + 1, &sockets, NULL, NULL, &select_timeout);
1256 }
else if (result < 0) {
1264 if (errno == EINTR) {
1273 if (!FD_ISSET(s.
socket_, &sockets)) {
1291 BOOST_FOREACH(
SocketInfo s, iface->getSockets()) {
1292 if (FD_ISSET(s.
sockfd_, &sockets)) {
1306 return (packet_filter6_->receive(*candidate));
1312 if (timeout_usec >= 1000000) {
1314 " one million microseconds");
1323 if (!callbacks_.empty()) {
1342 struct timeval select_timeout;
1344 select_timeout.tv_sec = timeout_sec;
1345 select_timeout.tv_usec = timeout_usec;
1347 select_timeout.tv_sec = 0;
1348 select_timeout.tv_usec = 0;
1354 int result = select(maxfd + 1, &sockets, NULL, NULL, &select_timeout);
1359 }
else if (result < 0) {
1367 if (errno == EINTR) {
1378 string msg = dhcp_receiver_->getLastError();
1385 if (!FD_ISSET(s.
socket_, &sockets)) {
1412IfaceMgr::receiveDHCP4Packets() {
1423 BOOST_FOREACH(iface,
ifaces_) {
1424 BOOST_FOREACH(
SocketInfo s, iface->getSockets()) {
1435 if (dhcp_receiver_->shouldTerminate()) {
1446 int result = select(maxfd + 1, &rd_set, 0, 0, 0);
1449 if (dhcp_receiver_->shouldTerminate()) {
1457 }
else if (result < 0) {
1459 if (errno != EINTR) {
1461 dhcp_receiver_->setError(strerror(errno));
1471 BOOST_FOREACH(iface,
ifaces_) {
1472 BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
1473 if (FD_ISSET(s.sockfd_, &sockets)) {
1474 receiveDHCP4Packet(*iface, s);
1476 if (dhcp_receiver_->shouldTerminate()) {
1487IfaceMgr::receiveDHCP6Packets() {
1498 BOOST_FOREACH(iface,
ifaces_) {
1499 BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
1501 if (s.addr_.isV6()) {
1510 if (dhcp_receiver_->shouldTerminate()) {
1521 int result = select(maxfd + 1, &rd_set, 0, 0, 0);
1524 if (dhcp_receiver_->shouldTerminate()) {
1531 }
else if (result < 0) {
1533 if (errno != EINTR) {
1535 dhcp_receiver_->setError(strerror(errno));
1545 BOOST_FOREACH(iface,
ifaces_) {
1546 BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
1547 if (FD_ISSET(s.sockfd_, &sockets)) {
1548 receiveDHCP6Packet(s);
1550 if (dhcp_receiver_->shouldTerminate()) {
1560IfaceMgr::receiveDHCP4Packet(Iface& iface,
const SocketInfo& socket_info) {
1563 int result = ioctl(socket_info.sockfd_, FIONREAD, &len);
1566 dhcp_receiver_->setError(strerror(errno));
1577 pkt = packet_filter_->receive(iface, socket_info);
1578 }
catch (
const std::exception& ex) {
1579 dhcp_receiver_->setError(strerror(errno));
1581 dhcp_receiver_->setError(
"packet filter receive() failed");
1591IfaceMgr::receiveDHCP6Packet(
const SocketInfo& socket_info) {
1594 int result = ioctl(socket_info.sockfd_, FIONREAD, &len);
1597 dhcp_receiver_->setError(strerror(errno));
1608 pkt = packet_filter6_->receive(socket_info);
1609 }
catch (
const std::exception& ex) {
1610 dhcp_receiver_->setError(ex.what());
1612 dhcp_receiver_->setError(
"packet filter receive() failed");
1631 Iface::SocketCollection::const_iterator candidate = socket_collection.end();
1633 Iface::SocketCollection::const_iterator s;
1634 for (s = socket_collection.begin(); s != socket_collection.end(); ++s) {
1639 if (s->family_ != AF_INET6) {
1644 if (s->addr_.isV6Multicast()) {
1651 return (s->sockfd_);
1655 if (candidate == socket_collection.end()) {
1662 s->addr_.isV6LinkLocal()) ||
1664 !s->addr_.isV6LinkLocal()) ) {
1670 if (candidate != socket_collection.end()) {
1671 return (candidate->sockfd_);
1675 <<
" does not have any suitable IPv6 sockets open.");
1681 if (iface == NULL) {
1689 Iface::SocketCollection::const_iterator candidate = socket_collection.end();
1690 Iface::SocketCollection::const_iterator s;
1691 for (s = socket_collection.begin(); s != socket_collection.end(); ++s) {
1692 if (s->family_ == AF_INET) {
1697 if (candidate == socket_collection.end()) {
1703 if (candidate == socket_collection.end()) {
1705 <<
" does not have any suitable IPv4 sockets open.");
1708 return (*candidate);
1715 " while DHCP receiver thread is running");
1718 bool enable_queue =
false;
1719 if (queue_control) {
1730 if (family == AF_INET) {
1731 packet_queue_mgr4_->createPacketQueue(queue_control);
1733 packet_queue_mgr6_->createPacketQueue(queue_control);
1737 if (family == AF_INET) {
1738 packet_queue_mgr4_->destroyPacketQueue();
1740 packet_queue_mgr6_->destroyPacketQueue();
1744 return(enable_queue);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown if a function is called in a prohibited way.
A generic exception that is thrown when a function is not implemented.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
A generic exception that is thrown when an unexpected error condition occurs.
The IOAddress class represents an IP addresses (version agnostic)
bool isV6() const
Convenience function to check for an IPv6 address.
bool isV4() const
Convenience function to check for an IPv4 address.
bool isV6LinkLocal() const
checks whether and address is IPv6 and is link-local
The UDPEndpoint class is a concrete derived class of IOEndpoint that represents an endpoint of a UDP ...
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
IfaceMgr exception thrown thrown when interface detection fails.
void clearIfaces()
Removes detected interfaces.
static void addFDtoSet(int fd, int &maxfd, fd_set *sockets)
Convenience method for adding an descriptor to a set.
void deleteExternalSocket(int socketfd)
Deletes external socket.
Pkt6Ptr receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec=0)
Receive IPv6 packets indirectly or data from external sockets.
bool openSockets6(const uint16_t port=DHCP6_SERVER_PORT, IfaceMgrErrorMsgCallback error_handler=0)
Opens IPv6 sockets on detected interfaces.
int openSocket(const std::string &ifname, const isc::asiolink::IOAddress &addr, const uint16_t port, const bool receive_bcast=false, const bool send_bcast=false)
Opens UDP/IP socket and binds it to address, interface and port.
int openSocketFromAddress(const isc::asiolink::IOAddress &addr, const uint16_t port)
Opens UDP/IP socket and binds to address specified.
void printIfaces(std::ostream &out=std::cout)
Debugging method that prints out all available interfaces.
int openSocket4(Iface &iface, const isc::asiolink::IOAddress &addr, const uint16_t port, const bool receive_bcast=false, const bool send_bcast=false)
Opens IPv4 socket.
void setPacketFilter(const PktFilterPtr &packet_filter)
Set packet filter object to handle sending and receiving DHCPv4 messages.
int openSocketFromIface(const std::string &ifname, const uint16_t port, const uint8_t family)
Opens UDP/IP socket and binds it to interface specified.
Pkt6Ptr receive6(uint32_t timeout_sec, uint32_t timeout_usec=0)
Receive IPv4 packets or data from external sockets.
uint16_t getSocket(const isc::dhcp::Pkt6 &pkt)
Return most suitable socket for transmitting specified IPv6 packet.
IfaceCollection ifaces_
List of available interfaces.
void startDHCPReceiver(const uint16_t family)
Starts DHCP packet receiver.
void clearUnicasts()
Clears unicast addresses on all interfaces.
void detectIfaces()
Detects network interfaces.
bool openSockets4(const uint16_t port=DHCP4_SERVER_PORT, const bool use_bcast=true, IfaceMgrErrorMsgCallback error_handler=0)
Opens IPv4 sockets on detected interfaces.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
bool isDHCPReceiverRunning() const
Returns true if there is a receiver exists and its thread is currently running.
bool hasOpenSocket(const uint16_t family) const
Checks if there is at least one socket of the specified family open.
virtual ~IfaceMgr()
Destructor.
boost::function< void()> SocketCallback
Defines callback used when data is received over external sockets.
int openSocket6(Iface &iface, const isc::asiolink::IOAddress &addr, uint16_t port, const bool join_multicast)
Opens IPv6 socket.
bool configureDHCPPacketQueue(const uint16_t family, data::ConstElementPtr queue_control)
Configures DHCP packet queue.
void stubDetectIfaces()
Stub implementation of network interface detection.
int openSocketFromRemoteAddress(const isc::asiolink::IOAddress &remote_addr, const uint16_t port)
Opens UDP/IP socket to be used to connect to remote address.
Pkt6Ptr receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec=0)
Receive IPv6 packets directly or data from external sockets.
bool isDirectResponseSupported() const
Check if packet be sent directly to the client having no address.
void addExternalSocket(int socketfd, SocketCallback callback)
Adds external socket and a callback.
void addInterface(const IfacePtr &iface)
Adds an interface to list of known interfaces.
IfaceMgr()
Protected constructor.
IfacePtr getIface(int ifindex)
Returns interface specified interface index.
bool send(const Pkt6Ptr &pkt)
Sends an IPv6 packet.
Pkt4Ptr receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec=0)
Receive IPv4 packets indirectly or data from external sockets.
void closeSockets()
Closes all open sockets.
PacketQueue6Ptr getPacketQueue6()
Fetches the DHCPv6 receiver packet queue.
static const IfaceMgrPtr & instancePtr()
Returns pointer to the sole instance of the interface manager.
void deleteAllExternalSockets()
Deletes all external sockets.
void stopDHCPReceiver()
Stops the DHCP packet receiver.
Pkt4Ptr receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec=0)
Receive IPv4 packets directly or data from external sockets.
PacketQueue4Ptr getPacketQueue4()
Fetches the DHCPv4 receiver packet queue.
Pkt4Ptr receive4(uint32_t timeout_sec, uint32_t timeout_usec=0)
Receive IPv4 packets or data from external sockets.
IfaceMgr exception thrown when there is no suitable interface.
Represents a single network interface.
std::string getPlainMac() const
Returns link-layer address a plain text.
size_t mac_len_
Length of link-layer address (usually 6).
AddressCollection addrs_
List of assigned addresses.
std::string getFullName() const
Returns full interface name as "ifname/ifindex" string.
std::string name_
Network interface name.
util::OptionalValue< asiolink::IOAddress > Address
Address type.
SocketCollection sockets_
Socket used to send data.
const AddressCollection & getAddresses() const
Returns all addresses available on an interface.
void setActive(const isc::asiolink::IOAddress &address, const bool active)
Activates or deactivates address for the interface.
std::string getName() const
Returns interface name.
bool delAddress(const isc::asiolink::IOAddress &addr)
Deletes an address from an interface.
bool hasAddress(const isc::asiolink::IOAddress &address) const
Check if the interface has the specified address assigned.
void setMac(const uint8_t *mac, size_t macLen)
Sets MAC address of the interface.
bool delSocket(uint16_t sockfd)
Closes socket.
std::list< Address > AddressCollection
Type that defines list of addresses.
std::list< SocketInfo > SocketCollection
Type that holds a list of socket information.
static const unsigned int MAX_MAC_LEN
Maximum MAC address length (Infiniband uses 20 bytes)
void addUnicast(const isc::asiolink::IOAddress &addr)
Adds unicast the server should listen on.
unsigned int countActive4() const
Returns a number of activated IPv4 addresses on the interface.
uint8_t mac_[MAX_MAC_LEN]
Link-layer address.
void addAddress(const isc::asiolink::IOAddress &addr)
Adds an address to an interface.
void closeSockets()
Closes all open sockets on interface.
void addSocket(const SocketInfo &sock)
Adds socket descriptor to an interface.
int ifindex_
Interface index (a value that uniquely identifies an interface).
Iface(const std::string &name, int ifindex)
Iface constructor.
AddressCollection unicasts_
List of unicast addresses the server should listen on.
bool getAddress4(isc::asiolink::IOAddress &address) const
Returns IPv4 address assigned to the interface.
Exception thrown when invalid packet filter object specified.
Exception thrown when it is not allowed to set new Packet Filter.
Packet Queue Manager for DHPCv4 servers.
Packet Queue Manager for DHPCv6 servers.
Represents DHCPv4 packet.
Represents a DHCPv6 packet.
A DHCPv6 packet handling class using datagram sockets.
Packet handling class using AF_INET socket family.
const isc::asiolink::IOAddress & getLocalAddr() const
Returns local IP address.
const isc::asiolink::IOAddress & getRemoteAddr() const
Returns remote IP address.
std::string getIface() const
Returns interface name.
Exception thrown when a call to select is interrupted by a signal.
IfaceMgr exception thrown thrown when socket opening or configuration failed.
IfaceMgr exception thrown when there is no suitable socket found.
IfaceMgr exception thrown thrown when error occurred during reading data from socket.
Simple class representing an optional value.
T get() const
Retrieves the actual value.
bool isSpecified() const
Checks if the value is specified or unspecified.
Provides a thread and controls for monitoring its activities.
#define DHCP_IPV4_BROADCAST_ADDRESS
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define FD_COPY(orig, copy)
#define IFACEMGR_ERROR(ex_type, handler, stream)
A macro which handles an error in IfaceMgr.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< IfaceMgr > IfaceMgrPtr
Type definition for the pointer to the IfaceMgr.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< PktFilter > PktFilterPtr
Pointer to a PktFilter object.
boost::shared_ptr< Iface > IfacePtr
boost::function< void(const std::string &errmsg)> IfaceMgrErrorMsgCallback
This type describes the callback function invoked when error occurs in the IfaceMgr.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
boost::shared_ptr< PktFilter6 > PktFilter6Ptr
Pointer to a PktFilter object.
Wrappers for thread related functionality.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Keeps callback information for external sockets.
SocketCallback callback_
A callback that will be called when data arrives over socket_.
int socket_
Socket descriptor of the external socket.
Holds information about socket.
isc::asiolink::IOAddress addr_
uint16_t family_
socket port
Indicate if an OptionalValue is is specified or not.