Kea 2.7.5
|
The TCPEndpoint
class is a concrete derived class of IOEndpoint
that represents an endpoint of a TCP packet.
More...
#include <tcp_endpoint.h>
Constructors and Destructor. | |
TCPEndpoint () | |
Default Constructor. | |
TCPEndpoint (const IOAddress &address, const unsigned short port) | |
Constructor from a pair of address and port. | |
TCPEndpoint (boost::asio::ip::tcp::endpoint &asio_endpoint) | |
Constructor from an ASIO TCP endpoint. | |
TCPEndpoint (const boost::asio::ip::tcp::endpoint &asio_endpoint) | |
Constructor from an ASIO TCP endpoint. | |
virtual | ~TCPEndpoint () |
The destructor. | |
virtual IOAddress | getAddress () const |
Returns the address of the endpoint. | |
virtual const struct sockaddr & | getSockAddr () const |
Returns the address of the endpoint in the form of sockaddr structure. | |
virtual uint16_t | getPort () const |
Returns the port of the endpoint. | |
virtual short | getProtocol () const |
Returns the protocol number of the endpoint (TCP, UDP...) | |
virtual short | getFamily () const |
Returns the address family of the endpoint. | |
const boost::asio::ip::tcp::endpoint & | getASIOEndpoint () const |
boost::asio::ip::tcp::endpoint & | getASIOEndpoint () |
Additional Inherited Members | |
Public Member Functions inherited from isc::asiolink::IOEndpoint | |
virtual | ~IOEndpoint () |
The destructor. | |
bool | operator== (const IOEndpoint &other) const |
bool | operator!= (const IOEndpoint &other) const |
Static Public Member Functions inherited from isc::asiolink::IOEndpoint | |
static const IOEndpoint * | create (const int protocol, const IOAddress &address, const unsigned short port) |
A polymorphic factory of endpoint from address and port. | |
Protected Member Functions inherited from isc::asiolink::IOEndpoint | |
IOEndpoint () | |
The default constructor. | |
The TCPEndpoint
class is a concrete derived class of IOEndpoint
that represents an endpoint of a TCP packet.
Other notes about TCPEndpoint
applies to this class, too.
Definition at line 23 of file tcp_endpoint.h.
|
inline |
Default Constructor.
Creates an internal endpoint. This is expected to be set by some external call.
Definition at line 34 of file tcp_endpoint.h.
|
inline |
Constructor from a pair of address and port.
address | The IP address of the endpoint. |
port | The TCP port number of the endpoint. |
Definition at line 43 of file tcp_endpoint.h.
|
inline |
Constructor from an ASIO TCP endpoint.
This constructor is designed to be an efficient wrapper for the corresponding ASIO class, tcp::endpoint
.
asio_endpoint | The ASIO representation of the TCP endpoint. |
Definition at line 56 of file tcp_endpoint.h.
|
inline |
Constructor from an ASIO TCP endpoint.
This constructor is designed to be an efficient wrapper for the corresponding ASIO class, tcp::endpoint
.
asio_endpoint | The ASIO representation of the TCP endpoint. |
Definition at line 66 of file tcp_endpoint.h.
|
inlinevirtual |
The destructor.
Definition at line 72 of file tcp_endpoint.h.
|
inlinevirtual |
Returns the address of the endpoint.
This method returns an IOAddress object corresponding to this
endpoint.
Note that the return value is a real object, not a reference or a pointer.
This is aligned with the interface of the ASIO counterpart: the address()
method of ip::xxx::endpoint
classes returns an ip::address
object.
This also means handling the address of an endpoint using this method can be expensive. If the address information is necessary in a performance sensitive context and there's a more efficient interface for that purpose, it's probably better to avoid using this method.
This method never throws an exception.
IOAddress
object corresponding to the endpoint. Implements isc::asiolink::IOEndpoint.
Definition at line 75 of file tcp_endpoint.h.
|
inline |
Definition at line 100 of file tcp_endpoint.h.
|
inline |
Definition at line 97 of file tcp_endpoint.h.
Referenced by isc::asiolink::TCPSocket< C >::asyncReceive(), and isc::asiolink::TLSSocket< C >::asyncReceive().
|
inlinevirtual |
Returns the address family of the endpoint.
Implements isc::asiolink::IOEndpoint.
Definition at line 91 of file tcp_endpoint.h.
|
inlinevirtual |
Returns the port of the endpoint.
Implements isc::asiolink::IOEndpoint.
Definition at line 83 of file tcp_endpoint.h.
|
inlinevirtual |
Returns the protocol number of the endpoint (TCP, UDP...)
Implements isc::asiolink::IOEndpoint.
Definition at line 87 of file tcp_endpoint.h.
|
inlinevirtual |
Returns the address of the endpoint in the form of sockaddr structure.
The actual instance referenced by the returned value of this method is of per address family structure: For IPv4 (AF_INET), it's sockaddr_in
; for IPv6 (AF_INET6), it's sockaddr_in6
. The corresponding port and address members of the underlying structure will be set in the network byte order.
This method is "redundant" in that all information to construct the sockaddr
is available via the other "get" methods. It is still defined for performance sensitive applications that need to get the address information, such as for address based access control at a high throughput. Internally it is implemented with minimum overhead such as data copy (this is another reason why this method returns a reference).
As a tradeoff, this method is more fragile; it assumes that the underlying ASIO implementation stores the address information in the form of sockaddr
and it can be accessed in an efficient way. This is the case as of this writing, but if the underlying implementation changes this method may become much slower or its interface may have to be changed, too.
It is therefore discouraged for normal applications to use this method. Unless the application is very performance sensitive, it should use the other "get" method to retrieve specific information of the endpoint.
The returned reference is only valid while the corresponding IOEndpoint
is valid. Once it's destructed the reference will become invalid.
None |
sockaddr
structure corresponding to the endpoint. Implements isc::asiolink::IOEndpoint.
Definition at line 79 of file tcp_endpoint.h.