Kea: isc::asiolink::DummyAsioSocket< C > Class Template Reference

| Kea 3.2.0-git

isc::asiolink::DummyAsioSocket< C > Class Template Reference

The `DummyAsioSocket` class is a concrete derived class of `IOAsioSocket` that is not associated with any real socket. More...

`#include <io_asio_socket.h>`

Inheritance diagram for isc::asiolink::DummyAsioSocket< C >:
[legend]

## Public Member Functions
| DummyAsioSocket (const int protocol)
| Constructor from the protocol number.
virtual void | asyncReceive (void *, size_t, size_t, IOEndpoint *, C &)
| Receive Asynchronously.
virtual void | asyncSend (const void *, size_t, const IOEndpoint *, C &)
| Send Asynchronously.
virtual void | cancel ()
| Cancel I/O On AsioSocket.
virtual void | close ()
| Close socket.
virtual int | getNative () const
| A dummy derived method of `IOAsioSocket::getNative()`.
virtual int | getProtocol () const
| A dummy derived method of `IOAsioSocket::getProtocol()`.
bool | isOpenSynchronous () const
| Is socket opening synchronous?
virtual bool | open (const IOEndpoint *, C &)
| Open AsioSocket.
virtual bool | receiveComplete (const void *, size_t, size_t &, size_t &, size_t &, isc::util::OutputBufferPtr &)
| Checks if the data received is complete.
virtual | ~IOAsioSocket ()=default
| The destructor.
virtual bool | processReceivedData (const void *staging, size_t length, size_t &cumulative, size_t &offset, size_t &expected, isc::util::OutputBufferPtr &buff)=0
| Processes received data.
virtual | ~IOSocket ()
| The destructor.

## Additional Inherited Members
Public Types inherited from isc::asiolink::IOSocket
typedef boost::asio::socket_base::reuse_address | ReuseAddress
| Represents SO_REUSEADDR socket option.
static IOSocket & | getDummyUDPSocket ()
| Return a non-usable "dummy" UDP socket for testing.
static IOSocket & | getDummyTCPSocket ()
| Return a non-usable "dummy" TCP socket for testing.
| IOAsioSocket ()
| The default constructor.
| IOSocket ()
| The default constructor.

## Detailed Description

template<typename C>
class isc::asiolink::DummyAsioSocket< C >

The `DummyAsioSocket` class is a concrete derived class of `IOAsioSocket` that is not associated with any real socket.

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

Parameters

  C | Template parameter identifying type of the callback object.

Definition at line 286 of file io_asio_socket.h.

## Constructor & Destructor Documentation

## ◆ DummyAsioSocket()

template<typename C>

isc::asiolink::DummyAsioSocket< C >::DummyAsioSocket | ( | 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

  protocol | The network protocol number for the socket.

Definition at line 297 of file io_asio_socket.h.

## Member Function Documentation

## ◆ asyncReceive()

template<typename C>

virtual void isc::asiolink::DummyAsioSocket< C >::asyncReceive | ( | void * | ,
|  | size_t | ,
|  | size_t | ,
|  | IOEndpoint * | ,
|  | C & | )
| inlinevirtual

Receive Asynchronously.

Must be supplied as it is abstract in the base class. The parameters are unused.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 340 of file io_asio_socket.h.

## ◆ asyncSend()

template<typename C>

virtual void isc::asiolink::DummyAsioSocket< C >::asyncSend | ( | const void * | ,
|  | size_t | ,
|  | const IOEndpoint * | ,
|  | C & | )
| inlinevirtual

Send Asynchronously.

Must be supplied as it is abstract in the base class. This is unused.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 333 of file io_asio_socket.h.

## ◆ cancel()

template<typename C>

virtual void isc::asiolink::DummyAsioSocket< C >::cancel | ( |  | ) |
| inlinevirtual

Cancel I/O On AsioSocket.

Must be supplied as it is abstract in the base class.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 357 of file io_asio_socket.h.

## ◆ close()

template<typename C>

virtual void isc::asiolink::DummyAsioSocket< C >::close | ( |  | ) |
| inlinevirtual

Close socket.

Must be supplied as it is abstract in the base class.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 363 of file io_asio_socket.h.

## ◆ getNative()

template<typename C>

virtual int isc::asiolink::DummyAsioSocket< C >::getNative | ( |  | ) | const
| inlinevirtual

A dummy derived method of `IOAsioSocket::getNative()`.

Returns
  Always returns -1 as the object is not associated with a real (native) socket.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 303 of file io_asio_socket.h.

## ◆ getProtocol()

template<typename C>

virtual int isc::asiolink::DummyAsioSocket< C >::getProtocol | ( |  | ) | const
| inlinevirtual

A dummy derived method of `IOAsioSocket::getProtocol()`.

Returns
  Protocol socket was created with

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 308 of file io_asio_socket.h.

## ◆ isOpenSynchronous()

template<typename C>

bool isc::asiolink::DummyAsioSocket< C >::isOpenSynchronous | ( |  | ) | const
| inlinevirtual

Is socket opening synchronous?

Returns
  true - it is for this class.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 314 of file io_asio_socket.h.

## ◆ open()

template<typename C>

virtual bool isc::asiolink::DummyAsioSocket< C >::open | ( | const IOEndpoint * | ,
|  | C & | )
| inlinevirtual

Open AsioSocket.

A call that is a no-op on UDP sockets, this opens a connection to the system identified by the given endpoint. The endpoint and callback are unused.

Returns
  false indicating that the operation completed synchronously.

Implements isc::asiolink::IOAsioSocket< C >.

Definition at line 325 of file io_asio_socket.h.

## ◆ receiveComplete()

template<typename C>

virtual bool isc::asiolink::DummyAsioSocket< C >::receiveComplete | ( | const void * | ,
|  | size_t | ,
|  | size_t & | ,
|  | size_t & | ,
|  | size_t & | ,
|  | isc::util::OutputBufferPtr & | )
| inlinevirtual

Checks if the data received is complete.

The parameters are unused.

Returns
  Always true

Definition at line 347 of file io_asio_socket.h.

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

- io_asio_socket.h