1 #ifndef NDNPH_FACE_TRANSPORT_TRACER_HPP
2 #define NDNPH_FACE_TRANSPORT_TRACER_HPP
4 #include "../core/log.hpp"
18 virtual void log(
char direction,
const uint8_t* pkt,
size_t pktLen, uint64_t endpointId) {
24 void handleRx(
const uint8_t* pkt,
size_t pktLen, uint64_t endpointId)
override {
25 log(
'>', pkt, pktLen, endpointId);
29 bool doSend(
const uint8_t* pkt,
size_t pktLen, uint64_t endpointId)
override {
30 log(
'<', pkt, pktLen, endpointId);
31 return inner.
send(pkt, pktLen, endpointId);
Print trace logs for each incoming and outgoing packet.
Definition: transport-tracer.hpp:11
virtual void log(char direction, const uint8_t *pkt, size_t pktLen, uint64_t endpointId)
Definition: transport-tracer.hpp:18
Tracer(Transport &inner, const char *category="transport")
Definition: transport-tracer.hpp:13
const char * category
Definition: transport-tracer.hpp:35
Wrap another transport.
Definition: transport.hpp:61
Transport & inner
Definition: transport.hpp:90
Base class of low-level transport.
Definition: transport.hpp:10
bool send(const uint8_t *pkt, size_t pktLen, uint64_t endpointId=0)
Synchronously transmit a packet.
Definition: transport.hpp:33
void invokeRxCallback(const uint8_t *pkt, size_t pktLen, uint64_t endpointId=0)
Invoke incoming packet callback for a received packet.
Definition: transport.hpp:39
#define NDNPH_LOG_LINE(category, fmt,...)
Log a message with "\n".
Definition: log.hpp:50