Kea  1.9.9-git
isc::asiolink::DummySocket Class Reference

The DummySocket class is a concrete derived class of IOSocket that is not associated with any real socket. More...

+ Inheritance diagram for isc::asiolink::DummySocket:

Public Member Functions

 DummySocket (const int protocol)
 Constructor from the protocol number. More...
 
virtual int getNative () const
 A dummy derived method of IOSocket::getNative(). More...
 
virtual int getProtocol () const
 Return the transport protocol of the socket. More...
 

Additional Inherited Members

Detailed Description

The DummySocket class is a concrete derived class of IOSocket that is not associated with any real socket.

This main purpose of this class is tests, where it may be desirable to instantiate an IOSocket object without involving system resource allocation such as real network sockets.

Definition at line 20 of file io_socket.cc.

Constructor & Destructor Documentation

isc::asiolink::DummySocket::DummySocket ( const int  protocol)
inline

Constructor from the protocol number.

The protocol must validly identify a standard network protocol. For example, to specify TCP protocol must be IPPROTO_TCP.

Parameters
protocolThe network protocol number for the socket.

Definition at line 31 of file io_socket.cc.

Member Function Documentation

virtual int isc::asiolink::DummySocket::getNative ( ) const
inlinevirtual

A dummy derived method of IOSocket::getNative().

This version of method always returns -1 as the object is not associated with a real (native) socket.

Implements isc::asiolink::IOSocket.

Definition at line 37 of file io_socket.cc.

virtual int isc::asiolink::DummySocket::getProtocol ( ) const
inlinevirtual

Return the transport protocol of the socket.

Currently, it returns IPPROTO_UDP for UDP sockets, and IPPROTO_TCP for TCP sockets.

This method never throws an exception.

Returns
IPPROTO_UDP for UDP sockets
IPPROTO_TCP for TCP sockets

Implements isc::asiolink::IOSocket.

Definition at line 39 of file io_socket.cc.


The documentation for this class was generated from the following file: