1 #ifndef NDNPH_FACE_FACE_HPP
2 #define NDNPH_FACE_FACE_HPP
4 #include "../packet/lp.hpp"
32 , m_transport(transport) {
85 return m_currentPacketInfo;
92 template<
typename Packet>
96 class ScopedCurrentPacketInfo {
100 m_face.m_currentPacketInfo = π
103 ~ScopedCurrentPacketInfo() {
104 m_face.m_currentPacketInfo =
nullptr;
111 static void transportRx(
void*
self,
const uint8_t* pkt,
size_t pktLen, uint64_t endpointId) {
112 reinterpret_cast<Face*
>(
self)->transportRx(pkt, pktLen, endpointId);
115 void transportRx(
const uint8_t* pkt,
size_t pktLen, uint64_t endpointId);
117 template<
typename Packet,
typename H =
bool (PacketHandler::*)(Packet)>
118 bool process(H processPacket, Packet packet);
121 using OwnRegion = StaticRegion<2048>;
122 std::unique_ptr<OwnRegion> m_ownRegion;
124 lp::Fragmenter* m_frag =
nullptr;
125 lp::Reassembler* m_reass =
nullptr;
126 PacketHandler* m_handler =
nullptr;
127 const PacketInfo* m_currentPacketInfo =
nullptr;
132 #define NDNPH_FACE_FACE_HPP_END
133 #include "face-impl.inc"
Network layer face.
Definition: face.hpp:12
void setReassembler(lp::Reassembler &reass)
Enable NDNLPv2 reassembly.
Definition: face.hpp:64
void setFragmenter(lp::Fragmenter &frag)
Enable NDNLPv2 fragmentation.
Definition: face.hpp:53
Transport & getTransport() const
Access the underlying transport.
Definition: face.hpp:42
Face(Region ®ion, Transport &transport)
Constructor.
Definition: face.hpp:30
const PacketInfo * getCurrentPacketInfo() const
Definition: face.hpp:84
void loop()
Process periodical events.
bool removeHandler(PacketHandler &h)
Remove a packet handler.
bool addHandler(PacketHandler &h, int8_t prio=0)
Add a packet handler.
Face(Transport &transport)
Definition: face.hpp:36
bool send(Region ®ion, const Packet &packet, PacketInfo pi)
Synchronously transmit a packet.
Base class to receive packets from Face.
Definition: packet-handler.hpp:10
Region-based memory allocator thats owns memory of NDNph objects.
Definition: region.hpp:9
Base class of an object associated with a Region.
Definition: region.hpp:182
Region & region
Definition: region.hpp:194
NDNLPv2 fragmenter.
Definition: lp.hpp:196
PIT token field.
Definition: lp.hpp:35
NDNLPv2 fragmenter.
Definition: lp.hpp:471
Base class of low-level transport.
Definition: transport.hpp:10
void setRxCallback(RxCallback cb, void *ctx)
Set incoming packet callback.
Definition: transport.hpp:27
transport::Transport Transport
Definition: transport.hpp:95
lp::PitToken pitToken
Definition: face.hpp:16
uint64_t endpointId
Definition: face.hpp:15