Base class to receive packets from Face.
More...
#include <packet-handler.hpp>
Inherited by esp8266ndn::UnixTime, ndnph::PingClient, ndnph::PingServer, ndnph::SegmentConsumerBase, ndnph::SegmentProducerBase, ndnph::ndncert::client::Client, ndnph::ndncert::server::Server, ndnph::rdr::RdrMetadataConsumer, and ndnph::rdr::RdrMetadataProducer.
|
virtual | ~PacketHandler () |
| Remove handler from Face. More...
|
|
Face * | getFace () const |
|
const PacketInfo * | getCurrentPacketInfo () const |
| Retrieve information about current processing packet. More...
|
|
template<typename Packet > |
bool | send (Region ®ion, const Packet &packet, PacketInfo pi={}) |
| Synchronously transmit a packet. More...
|
|
template<typename Packet , typename... PacketInfoModifier> |
bool | send (Region ®ion, const Packet &packet, const PacketInfoModifier &... pim) |
| Synchronously transmit a packet. More...
|
|
template<typename Packet , typename... Arg, typename = typename std::enable_if< !std::is_base_of<Region, typename std::decay<Packet>::type>::value>::type> |
bool | send (const Packet &packet, Arg &&... arg) |
| Synchronously transmit a packet. More...
|
|
template<typename... Arg> |
bool | reply (Arg &&... arg) |
| Synchronously transmit a packet in reply to current processing packet. More...
|
|
Base class to receive packets from Face.
◆ PacketInfo
◆ PacketHandler() [1/2]
ndnph::PacketHandler::PacketHandler |
( |
| ) |
|
|
explicitdefault |
Construct without adding to Face.
◆ PacketHandler() [2/2]
ndnph::PacketHandler::PacketHandler |
( |
Face & |
face, |
|
|
int8_t |
prio = 0 |
|
) |
| |
|
inlineexplicit |
Construct and add handler to Face.
◆ ~PacketHandler()
virtual ndnph::PacketHandler::~PacketHandler |
( |
| ) |
|
|
inlineprotectedvirtual |
Remove handler from Face.
◆ getCurrentPacketInfo()
const PacketInfo* ndnph::PacketHandler::getCurrentPacketInfo |
( |
| ) |
const |
|
inlineprotected |
Retrieve information about current processing packet.
- Precondition
- one of processInterest, processData, or processNack is executing.
◆ getFace()
Face* ndnph::PacketHandler::getFace |
( |
| ) |
const |
|
inlineprotected |
◆ loop()
virtual void ndnph::PacketHandler::loop |
( |
| ) |
|
|
inlineprivatevirtual |
Override to be invoked periodically.
◆ processData()
virtual bool ndnph::PacketHandler::processData |
( |
Data |
| ) |
|
|
inlineprivatevirtual |
Override to receive Data packets.
- Return values
-
true | packet has been accepted by this handler. |
false | packet is not accepted, and should go to the next handler. |
◆ processInterest()
virtual bool ndnph::PacketHandler::processInterest |
( |
Interest |
| ) |
|
|
inlineprivatevirtual |
Override to receive Interest packets.
- Return values
-
true | packet has been accepted by this handler. |
false | packet is not accepted, and should go to the next handler. |
◆ processNack()
virtual bool ndnph::PacketHandler::processNack |
( |
Nack |
| ) |
|
|
inlineprivatevirtual |
Override to receive Nack packets.
- Return values
-
true | packet has been accepted by this handler. |
false | packet is not accepted, and should go to the next handler. |
◆ reply()
template<typename... Arg>
bool ndnph::PacketHandler::reply |
( |
Arg &&... |
arg | ) |
|
|
inlineprotected |
Synchronously transmit a packet in reply to current processing packet.
- Precondition
- one of processInterest, processData, or processNack is executing.
- Parameters
-
arg | either `Region&, const Packet&` or `const Packet&`. |
This is most useful in processInterest, replying a Data or Nack carrying the PIT token of current Interest to the endpointId of current Interest.
◆ send() [1/3]
template<typename Packet , typename... Arg, typename = typename std::enable_if< !std::is_base_of<Region, typename std::decay<Packet>::type>::value>::type>
bool ndnph::PacketHandler::send |
( |
const Packet & |
packet, |
|
|
Arg &&... |
arg |
|
) |
| |
|
inlineprotected |
Synchronously transmit a packet.
- Template Parameters
-
Packet | Interest, Data, their signed variants, or Nack. |
Arg | either a sequence of `PacketInfoModifier` or `PacketInfo`. |
send(interest, WithEndpointId(4688));
send(interest, WithPitToken(0x013CA61E013F0B7A), WithEndpointId(4688));
send(interest, myPacketInfo);
bool send(Region ®ion, const Packet &packet, PacketInfo pi={})
Synchronously transmit a packet.
Definition: packet-handler.hpp:49
◆ send() [2/3]
template<typename Packet , typename... PacketInfoModifier>
bool ndnph::PacketHandler::send |
( |
Region & |
region, |
|
|
const Packet & |
packet, |
|
|
const PacketInfoModifier &... |
pim |
|
) |
| |
|
inlineprotected |
Synchronously transmit a packet.
- Template Parameters
-
Packet | Interest, Data, their signed variants, or Nack. |
PacketInfoModifier | WithEndpointId or WithPitToken |
◆ send() [3/3]
template<typename Packet >
bool ndnph::PacketHandler::send |
( |
Region & |
region, |
|
|
const Packet & |
packet, |
|
|
PacketInfo |
pi = {} |
|
) |
| |
|
inlineprotected |
Synchronously transmit a packet.
- Template Parameters
-
Packet | Interest, Data, their signed variants, or Nack. |
- Parameters
-
region | where to allocate temporary memory for packet encoding. |
- Returns
- whether success.
The documentation for this class was generated from the following file: