|
Hybrid ICN (hICN) plugin
v21.06-rc0-4-g18fa668
|
#include <portal.h>
Public Types | |
| using | ConsumerCallback = interface::Portal::ConsumerCallback |
| using | ProducerCallback = interface::Portal::ProducerCallback |
Public Member Functions | |
| Portal (asio::io_service &io_service) | |
| void | setConsumerCallback (ConsumerCallback *consumer_callback) |
| void | setProducerCallback (ProducerCallback *producer_callback) |
| TRANSPORT_ALWAYS_INLINE void | setOutputInterface (const std::string &output_interface) |
| TRANSPORT_ALWAYS_INLINE void | connect (bool is_consumer=true) |
| ~Portal () | |
| TRANSPORT_ALWAYS_INLINE uint32_t | getHash (const Name &name) |
| TRANSPORT_ALWAYS_INLINE bool | interestIsPending (const Name &name) |
| TRANSPORT_ALWAYS_INLINE void | sendInterest (Interest::Ptr &&interest, OnContentObjectCallback &&on_content_object_callback=UNSET_CALLBACK, OnInterestTimeoutCallback &&on_interest_timeout_callback=UNSET_CALLBACK) |
| TRANSPORT_ALWAYS_INLINE void | timerHandler (const std::error_code &ec, uint32_t hash, uint32_t seq) |
| TRANSPORT_ALWAYS_INLINE void | bind (const BindConfig &config) |
| TRANSPORT_ALWAYS_INLINE void | runEventsLoop () |
| TRANSPORT_ALWAYS_INLINE void | runOneEvent () |
| TRANSPORT_ALWAYS_INLINE void | sendContentObject (ContentObject &content_object) |
| TRANSPORT_ALWAYS_INLINE void | stopEventsLoop () |
| TRANSPORT_ALWAYS_INLINE void | killConnection () |
| TRANSPORT_ALWAYS_INLINE void | clear () |
| TRANSPORT_ALWAYS_INLINE void | clearOne (const Name &name) |
| TRANSPORT_ALWAYS_INLINE asio::io_service & | getIoService () |
| TRANSPORT_ALWAYS_INLINE void | registerRoute (Prefix &prefix) |
| TRANSPORT_ALWAYS_INLINE bool | isConnectedToFwd () |
Friends | |
| class | PortalConfiguration |
Portal is a opaque class which is used for sending/receiving interest/data packets over multiple kind of connector. The connector itself is defined by the template ForwarderInt, which is resolved at compile time. It is then not possible to decide at runtime what the connector will be.
The tasks performed by portal are the following:
The way of working of portal is event-based, which means that data and interests are sent/received in a asynchronous manner, and the notifications are performed through callbacks.
The portal class is not thread safe, appropriate locking is required by the users of this class.
|
inline |
This workaroung allows to initialize memory for packet buffers before any static variables that may be initialized in the io_modules. In this way static variables in modules will be destroyed before the packet memory.
|
inline |
Destructor.
|
inline |
Register a producer name to the local forwarder and optionally set the content store size in a per-face manner.
| config | - The configuration for the local forwarder binding. |
|
inline |
Clear the pending interest hash table.
|
inline |
Remove one pending interest.
|
inline |
Connect the transport to the local hicn forwarder.
| is_consumer | - Boolean specifying if the application on top of portal is a consumer or a producer. |
|
inline |
Compute name hash
|
inline |
Get a reference to the io_service object.
|
inline |
Check if there is already a pending interest for a given name.
| name | - The interest name. |
|
inline |
Check if the transport is connected to a forwarder or not
|
inline |
Disconnect the transport from the local forwarder.
|
inline |
Register a route to the local forwarder.
|
inline |
Start the event loop. This function blocks here and calls the callback set by the application upon interest/data received or timeout.
|
inline |
Run one event and return.
|
inline |
Send a data packet to the local forwarder. As opposite to sendInterest, the ownership of the content object is not transferred to the portal.
| content_object | - The data packet. |
|
inline |
Send an interest through to the local forwarder.
| interest | - The pointer to the interest. The ownership of the interest is transferred by the caller to portal. |
| on_content_object_callback | - If the caller wishes to use a different callback to be called for this interest, it can set this parameter. Otherwise ConsumerCallback::onContentObject will be used. |
| on_interest_timeout_callback | - If the caller wishes to use a different callback to be called for this interest, it can set this parameter. Otherwise ConsumerCallback::onTimeout will be used. |
|
inline |
Set the consumer callback.
| consumer_callback | - The pointer to the ConsumerCallback object. |
|
inline |
Specify the output interface to use. This method will be useful in a future scenario where the library will be able to forward packets without connecting to a local forwarder. Now it is not used.
| output_interface | - The output interface to use for forwarding/receiving packets. |
|
inline |
Set the producer callback.
| producer_callback | - The pointer to the ProducerCallback object. |
|
inline |
Stop the event loop, canceling all the pending events in the event queue.
Beware that stopping the event loop DOES NOT disconnect the transport from the local forwarder, the connector underneath will stay connected.
|
inline |
Handler fot the timer set when the interest is sent.
| ec | - Error code which says whether the timer expired or has been canceled upon data packet reception. |
| hash | - The index of the interest in the pending interest hash table. |
1.8.17