Classes | |
class | ConnectionInfo |
A Transport::ConnectionInfo is a base class for connection information used by subclasses of Transport. More... | |
Public Types | |
typedef func_lib::function< void()> | OnConnected |
Public Member Functions | |
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 () |
Check if this transport is async where 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 processEvents() will use elementListener. More... | |
virtual void | send (const uint8_t *data, size_t dataLength) |
Send data to the host. More... | |
void | send (const std::vector< uint8_t > &data) |
virtual void | processEvents ()=0 |
Process any data to receive. More... | |
virtual bool | getIsConnected () |
virtual void | close () |
Close the connection. More... | |
|
virtual |
Close the connection.
This base class implementation does nothing, but your derived class can override.
Reimplemented in ndn::AsyncTcpTransport, ndn::TcpTransport, ndn::AsyncUnixTransport, ndn::UdpTransport, and ndn::UnixTransport.
|
virtual |
Connect according to the info in ConnectionInfo, and processEvents() will use elementListener.
connectionInfo | A reference to an object of a subclass of 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 in ndn::AsyncTcpTransport, ndn::TcpTransport, ndn::AsyncUnixTransport, ndn::UdpTransport, and ndn::UnixTransport.
|
virtual |
Check if this transport is async where connect needs to use the onConnected callback.
Reimplemented in ndn::AsyncTcpTransport, ndn::TcpTransport, ndn::AsyncUnixTransport, ndn::UdpTransport, and ndn::UnixTransport.
|
virtual |
Determine whether this transport connecting according to connectionInfo is to a node on the current machine.
This affects the processing of Face.registerPrefix(): if the NFD is local, registration occurs with the '/localhost/nfd...' prefix; if non-local, the library will attempt to use remote prefix registration using '/localhop/nfd...'
connectionInfo | A ConnectionInfo with the host to check. |
Reimplemented in ndn::AsyncTcpTransport, ndn::TcpTransport, ndn::AsyncUnixTransport, ndn::UdpTransport, and ndn::UnixTransport.
|
pure virtual |
Process any data to receive.
For each element received, call elementListener.onReceivedElement. This is non-blocking and will return immediately if there is no data to receive. You should normally not call this directly since it is called by Face.processEvents.
This | may throw an exception for reading data or in the callback for processing the data. If you call this from an main event loop, you may want to catch and log/disregard all exceptions. |
Implemented in ndn::AsyncTcpTransport, ndn::TcpTransport, ndn::AsyncUnixTransport, ndn::UdpTransport, and ndn::UnixTransport.
|
virtual |
Send data to the host.
data | A pointer to the buffer of data to send. |
dataLength | The number of bytes in data. |
Reimplemented in ndn::AsyncTcpTransport, ndn::AsyncUnixTransport, ndn::TcpTransport, ndn::UdpTransport, and ndn::UnixTransport.