1#ifndef NDNPH_APP_SEGMENT_CONSUMER_HPP
2#define NDNPH_APP_SEGMENT_CONSUMER_HPP
4#include "../face/packet-handler.hpp"
5#include "../keychain/null.hpp"
6#include "../port/clock/port.hpp"
80 std::copy(content.begin(), content.end(), &
output[
length]);
133 if (
m_cb !=
nullptr) {
154template<
typename SegmentConvention = convention::Segment,
size_t regionCap = 1024>
172 Interest interest = region.template create<Interest>();
Consumer of segmented object, using a stop-and-wait algorithm.
Definition segment-consumer.hpp:155
bool processData(Data data) final
Override to receive Data packets.
Definition segment-consumer.hpp:178
void loop() final
Override to be invoked periodically.
Definition segment-consumer.hpp:160
Data packet.
Definition data.hpp:136
bool getIsFinalBlock() const
Definition data.hpp:164
tlv::Value getContent() const
Definition data.hpp:172
bool verify(const PublicKey &key) const
Verify the packet with a public key.
Definition data.hpp:263
Network layer face.
Definition face.hpp:12
Interest packet.
Definition interest.hpp:284
void setName(const Name &v)
Definition interest.hpp:288
Name.
Definition name.hpp:14
Name append(Region ®ion, const C &... comps) const
Append a sequence of components.
Definition name.hpp:183
static const NullKey & get()
Definition null.hpp:22
Helper to keep track an outgoing pending Interest.
Definition packet-handler.hpp:125
bool expired() const
Determine if the pending Interest has expired / timed out.
Definition packet-handler.hpp:208
bool match(const Data &data, const Interest &interest) const
Check Interest-Data match.
Definition packet-handler.hpp:182
void expireNow()
Set expire time to now.
Definition packet-handler.hpp:203
bool send(const Packet &interest, int timeout, Arg &&... arg)
Send an Interest.
Definition packet-handler.hpp:141
Base class to receive packets from Face.
Definition packet-handler.hpp:10
Public key.
Definition public-key.hpp:9
Destination and context of saving accumulated payload.
Definition segment-consumer.hpp:59
size_t limit
Definition segment-consumer.hpp:87
size_t length
Definition segment-consumer.hpp:88
bool isCompleted
Definition segment-consumer.hpp:89
SaveDest(uint8_t *output, size_t limit)
Definition segment-consumer.hpp:61
static void accumulate(void *self0, uint64_t, Data data)
Definition segment-consumer.hpp:65
uint8_t * output
Definition segment-consumer.hpp:86
bool hasError
Definition segment-consumer.hpp:90
Definition segment-consumer.hpp:10
SegmentConsumerBase(Face &face, Options opts)
Constructor.
Definition segment-consumer.hpp:27
void setSegmentCallback(SegmentCallback cb, void *ctx)
Assign SegmentCallback.
Definition segment-consumer.hpp:53
SegmentCallback m_cb
Definition segment-consumer.hpp:140
bool isRunning() const
Determine whether fetching is in progress (not completed or failed).
Definition segment-consumer.hpp:127
void(*)(void *ctx, uint64_t segment, Data data) SegmentCallback
Callback upon segment arrival.
Definition segment-consumer.hpp:46
void * m_cbCtx
Definition segment-consumer.hpp:141
void invokeCallback(Data data)
Definition segment-consumer.hpp:132
Options m_opts
Definition segment-consumer.hpp:139
Name m_prefix
Definition segment-consumer.hpp:142
int m_retxRemain
Definition segment-consumer.hpp:145
bool m_running
Definition segment-consumer.hpp:146
void saveTo(SaveDest &dest)
Save content to destination.
Definition segment-consumer.hpp:100
SegmentConsumerBase(Face &face)
Definition segment-consumer.hpp:32
uint64_t m_segment
Definition segment-consumer.hpp:143
void start(Name prefix)
Start fetching content under given prefix.
Definition segment-consumer.hpp:109
OutgoingPendingInterest m_pending
Definition segment-consumer.hpp:144
void stop()
Stop fetching.
Definition segment-consumer.hpp:122
Region with statically allocated memory.
Definition region.hpp:143
#define NDNPH_ASSERT(x)
Definition common.hpp:30
Definition segment-consumer.hpp:12
int retxLimit
Maximum retransmission of an Interest, not counting initial Interest.
Definition segment-consumer.hpp:16
int retxDelay
Delay in milliseconds before retransmission.
Definition segment-consumer.hpp:19
const PublicKey & verifier
Definition segment-consumer.hpp:13