15#include <boost/lexical_cast.hpp>
19#include <sys/socket.h>
20#include <netinet/in.h>
29 const unsigned short port)
31 if (protocol == IPPROTO_UDP) {
33 }
else if (protocol == IPPROTO_TCP) {
37 "IOEndpoint creation attempt for unsupported protocol: " <<
51 return (!
operator==(other));
56 if (endpoint.getFamily() == AF_INET6) {
57 os <<
"[" << endpoint.getAddress() <<
"]";
62 os << endpoint.getAddress();
64 os <<
":" << boost::lexical_cast<string>(endpoint.getPort());
The IOAddress class represents an IP addresses (version agnostic)
The IOEndpoint class is an abstract base class to represent a communication endpoint.
bool operator!=(const IOEndpoint &other) const
static const IOEndpoint * create(const int protocol, const IOAddress &address, const unsigned short port)
A polymorphic factory of endpoint from address and port.
virtual short getFamily() const =0
Returns the address family of the endpoint.
virtual IOAddress getAddress() const =0
Returns the address of the endpoint.
bool operator==(const IOEndpoint &other) const
virtual short getProtocol() const =0
Returns the protocol number of the endpoint (TCP, UDP...)
virtual uint16_t getPort() const =0
Returns the port of the endpoint.
An exception that is thrown if an error occurs within the IO module.
The TCPEndpoint class is a concrete derived class of IOEndpoint that represents an endpoint of a TCP ...
The UDPEndpoint class is a concrete derived class of IOEndpoint that represents an endpoint of a UDP ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A wrapper interface for the ASIO library.
std::ostream & operator<<(std::ostream &os, const IOAddress &address)
Insert the IOAddress as a string into stream.
Defines the logger used by the top-level component of kea-lfc.