AsyncUnixTransport extends Transport for async communication over a Unix socket using Boost's asio io_service. More...
#include <async-unix-transport.hpp>
Classes | |
| class | ConnectionInfo |
| An AsyncUnixTransport::ConnectionInfo extends Transport::ConnectionInfo to hold the file path of the Unix socket. More... | |
Public Member Functions | |
| AsyncUnixTransport (boost::asio::io_service &ioService) | |
| Create an AsyncUnixTransport in the unconnected state. More... | |
| virtual bool | isLocal (const Transport::ConnectionInfo &connectionInfo) |
| Determine whether this transport connecting according to connectionInfo is to a node on the current machine. More... | |
| virtual bool | isAsync () |
| Override to return true since connect needs to use the onConnected callback. More... | |
| virtual void | connect (const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener, const OnConnected &onConnected) |
| Connect according to the info in connectionInfo, and use elementListener. More... | |
| virtual void | send (const uint8_t *data, size_t dataLength) |
| Send data to the host. More... | |
| virtual void | processEvents () |
| Do nothing since the asio io_service reads the socket. | |
| virtual bool | getIsConnected () |
| virtual void | close () |
| Close the connection to the host. | |
Public Member Functions inherited from ndn::Transport | |
| void | send (const std::vector< uint8_t > &data) |
Additional Inherited Members | |
Public Types inherited from ndn::Transport | |
| typedef func_lib::function< void()> | OnConnected |
AsyncUnixTransport extends Transport for async communication over a Unix socket using Boost's asio io_service.
This only uses asio for communication. To make this thread-safe, you must dispatch calls to send(), etc. to the io_service, as is done by ThreadsafeFace. To use this, you do not need to call processEvents.
| ndn::AsyncUnixTransport::AsyncUnixTransport | ( | boost::asio::io_service & | ioService | ) |
Create an AsyncUnixTransport in the unconnected state.
This will use the ioService to create the connection and communicate asynchronously.
| ioService | The asio io_service. It is the responsibility of the application to start and stop the service. |
|
virtual |
Connect according to the info in connectionInfo, and use elementListener.
To be thread-safe, this must be called from a dispatch to the ioService which was given to the constructor, as is done by ThreadsafeFace.
| connectionInfo | A reference to an AsyncTcpTransport::ConnectionInfo. |
| elementListener | Not a shared_ptr because we assume that it will remain valid during the life of this object. |
| onConnected | This calls onConnected() when the connection is established. |
Reimplemented from ndn::Transport.
|
virtual |
Override to return true since connect needs to use the onConnected callback.
Reimplemented from ndn::Transport.
|
virtual |
Determine whether this transport connecting according to connectionInfo is to a node on the current machine.
Unix transports are always local.
| connectionInfo | This is ignored. |
Reimplemented from ndn::Transport.
|
virtual |
Send data to the host.
To be thread-safe, this must be called from a dispatch to the ioService which was given to the constructor, as is done by ThreadsafeFace.
| data | A pointer to the buffer of data to send. |
| dataLength | The number of bytes in data. |
Reimplemented from ndn::Transport.
1.8.9.1