A transport that uses a Unix stream socket for communication.
More...
#include <ndn-cxx/transport/unix-transport.hpp>
|
| | UnixTransport (const std::string &unixSocket) |
| |
| | ~UnixTransport () override |
| |
| void | close () override |
| | Close the connection.
|
| |
| void | connect (boost::asio::io_context &ioCtx, ReceiveCallback receiveCallback) override |
| | Asynchronously open the connection.
|
| |
| State | getState () const noexcept |
| | Return the current state of the transport.
|
| |
| void | pause () override |
| | Pause the transport, canceling all pending operations.
|
| |
| void | resume () override |
| | Resume the transport.
|
| |
| void | send (const Block &wire) override |
| | Send a TLV block through the transport.
|
| |
|
| static shared_ptr< UnixTransport > | create (const std::string &uri) |
| | Create transport with parameters defined in URI.
|
| |
A transport that uses a Unix stream socket for communication.
Definition at line 41 of file unix-transport.hpp.
◆ ReceiveCallback
◆ State
| Enumerator |
|---|
| CLOSED | |
| CONNECTING | |
| RUNNING | |
| PAUSED | |
Definition at line 47 of file transport.hpp.
◆ UnixTransport()
| ndn::UnixTransport::UnixTransport |
( |
const std::string & |
unixSocket | ) |
|
|
explicit |
◆ ~UnixTransport()
| ndn::UnixTransport::~UnixTransport |
( |
| ) |
|
|
overridedefault |
◆ close()
| void ndn::UnixTransport::close |
( |
| ) |
|
|
overridevirtual |
◆ connect()
| void ndn::UnixTransport::connect |
( |
boost::asio::io_context & |
ioCtx, |
|
|
ReceiveCallback |
receiveCallback |
|
) |
| |
|
overridevirtual |
Asynchronously open the connection.
- Parameters
-
| ioCtx | io_context to create socket on |
| receiveCallback | callback function when a TLV block is received; must not be empty |
- Exceptions
-
| boost::system::system_error | connection cannot be established |
Reimplemented from ndn::Transport.
Definition at line 75 of file unix-transport.cpp.
◆ create()
| shared_ptr< UnixTransport > ndn::UnixTransport::create |
( |
const std::string & |
uri | ) |
|
|
static |
Create transport with parameters defined in URI.
- Exceptions
-
Definition at line 69 of file unix-transport.cpp.
◆ getState()
| State ndn::Transport::getState |
( |
| ) |
const |
|
inlinenoexceptinherited |
Return the current state of the transport.
Definition at line 103 of file transport.hpp.
◆ pause()
| void ndn::UnixTransport::pause |
( |
| ) |
|
|
overridevirtual |
Pause the transport, canceling all pending operations.
- Postcondition
- the receive callback will not be invoked
- Note
- This operation has no effect if the transport has been paused, or when the connection is being established.
Implements ndn::Transport.
Definition at line 104 of file unix-transport.cpp.
◆ resume()
| void ndn::UnixTransport::resume |
( |
| ) |
|
|
overridevirtual |
Resume the transport.
- Postcondition
- the receive callback will be invoked
- Note
- This operation has no effect if the transport is not paused, or when the connection is being established.
Implements ndn::Transport.
Definition at line 113 of file unix-transport.cpp.
◆ send()
| void ndn::UnixTransport::send |
( |
const Block & |
block | ) |
|
|
overridevirtual |
◆ setState()
| void ndn::Transport::setState |
( |
State |
state | ) |
|
|
inlineprotectednoexceptinherited |
◆ m_ioCtx
| boost::asio::io_context* ndn::Transport::m_ioCtx = nullptr |
|
protectedinherited |
◆ m_receiveCallback