302 void onPacketReceived(
FaceId faceId,
const uint8_t* data,
size_t len);
316 void onDataReceived(
FaceId faceId,
const Data& data);
323 void forwardInterest(
const Interest& interest,
FaceId incomingFace);
336 std::array<Face*, FORWARDER_MAX_FACES> faces_{};
337 size_t numFaces_ = 0;
342 struct PrefixRegistration {
344 InterestCallback callback;
347 std::array<PrefixRegistration, FORWARDER_MAX_PREFIXES> prefixRegs_{};
352 struct PendingInterest {
358 std::array<PendingInterest, PIT_MAX_ENTRIES> pendingInterests_{};
361 bool initialized_ =
false;
NDN Face abstract base class.
Forwarding Information Base.
Error addRoute(const Name &prefix, FaceId faceId, uint8_t cost=0)
Add a route.
Fib & fib()
Get reference to FIB (for testing)
Error addFace(Face *face)
Add a Face.
Error registerPrefix(const Name &prefix, InterestCallback callback)
Register a prefix.
ContentStore & cs()
Get reference to Content Store (for testing)
void unregisterPrefix(const Name &prefix)
Unregister a prefix.
Pit & pit()
Get reference to PIT (for testing)
void removeFace(FaceId faceId)
Remove a Face.
const Stats & stats() const
Get statistics.
Error expressInterest(const Interest &interest, DataCallback onData, TimeoutCallback onTimeout=nullptr)
Send an Interest and wait for Data.
Error putData(const Data &data)
Send Data.
Error sendInterest(const Interest &interest)
Send an Interest (without PIT registration)
Error init(size_t csMaxEntries=CS_DEFAULT_ENTRIES)
Initialize the Forwarder.
void processEvents()
Process events.
Common definitions for the NDN protocol stack.
uint16_t FaceId
Face identifier.
constexpr size_t CS_DEFAULT_ENTRIES
Default number of CS entries.
Forwarding Information Base (FIB)
std::function< void(const Interest &, FaceId)> InterestCallback
Interest receive callback.
std::function< void(const Interest &)> TimeoutCallback
Timeout callback.
constexpr size_t FORWARDER_MAX_PREFIXES
Maximum number of registerable prefixes.
std::function< void(const Data &)> DataCallback
Data receive callback.
constexpr size_t FORWARDER_MAX_FACES
Maximum number of Faces the Forwarder can manage.
constexpr uint32_t Interest
Interest packet.
Pending Interest Table (PIT)
uint32_t interestsReceived
Number of Interests received.
uint32_t cacheHits
Number of cache hits.
uint32_t cacheMisses
Number of cache misses.
uint32_t dataReceived
Number of Data received.
uint32_t interestsSent
Number of Interests sent.
uint32_t dataSent
Number of Data sent.