27 #include <ndn-cxx/lp/tags.hpp> 35 : nReassembling(reassembler)
40 : allowLocalFields(false)
41 , allowFragmentation(false)
42 , allowReassembly(false)
57 GenericLinkService::doSendInterest(
const Interest& interest)
61 encodeLpFields(interest, lpPacket);
63 this->sendNetPacket(std::move(lpPacket));
67 GenericLinkService::doSendData(
const Data& data)
71 encodeLpFields(data, lpPacket);
73 this->sendNetPacket(std::move(lpPacket));
77 GenericLinkService::doSendNack(
const lp::Nack& nack)
82 encodeLpFields(nack, lpPacket);
84 this->sendNetPacket(std::move(lpPacket));
92 if (incomingFaceIdTag !=
nullptr) {
98 if (congestionMarkTag !=
nullptr) {
103 if (hopCountTag !=
nullptr) {
112 GenericLinkService::sendNetPacket(
lp::Packet&& pkt)
114 std::vector<lp::Packet> frags;
126 frags.push_back(pkt);
129 if (frags.size() > 1) {
131 this->assignSequences(frags);
136 BOOST_ASSERT(frags.size() > 0);
143 if (mtu !=
MTU_UNLIMITED && tp.packet.size() >
static_cast<size_t>(mtu)) {
153 GenericLinkService::assignSequence(
lp::Packet& pkt)
159 GenericLinkService::assignSequences(std::vector<lp::Packet>& pkts)
161 std::for_each(pkts.begin(), pkts.end(), bind(&GenericLinkService::assignSequence,
this, _1));
181 bool isReassembled =
false;
184 std::tie(isReassembled, netPkt, firstPkt) = m_reassembler.
receiveFragment(packet.remoteEndpoint,
187 this->decodeNetPacket(netPkt, firstPkt);
197 GenericLinkService::decodeNetPacket(
const Block& netPkt,
const lp::Packet& firstPkt)
200 switch (netPkt.
type()) {
203 this->decodeNack(netPkt, firstPkt);
206 this->decodeInterest(netPkt, firstPkt);
210 this->decodeData(netPkt, firstPkt);
225 GenericLinkService::decodeInterest(
const Block& netPkt,
const lp::Packet& firstPkt)
231 auto interest = make_shared<Interest>(netPkt);
266 GenericLinkService::decodeData(
const Block& netPkt,
const lp::Packet& firstPkt)
271 auto data = make_shared<Data>(netPkt);
312 GenericLinkService::decodeNack(
const Block& netPkt,
const lp::Packet& firstPkt)
LpFragmenter::Options fragmenterOptions
options for fragmentation
void setTag(shared_ptr< T > tag) const
set a tag item
signal::Signal< LpReassembler, Transport::EndpointId, size_t > beforeTimeout
signals before a partial packet is dropped due to timeout
shared_ptr< T > getTag() const
get a tag item
bool allowReassembly
enables reassembly
#define NFD_LOG_FACE_TRACE(msg)
Log a message at TRACE level.
bool allowLocalFields
enables encoding of IncomingFaceId, and decoding of NextHopFaceId and CachePolicy ...
Packet & set(const typename FIELD::ValueType &value)
remove all occurrences of FIELD, and add a FIELD with value
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
Base class to store tag information (e.g., inside Interest and Data packets)
Packet & add(const typename FIELD::ValueType &value)
add a FIELD with value
Nack & setHeader(const NackHeader &header)
const Transport * getTransport() const
stores a packet along with the remote endpoint
PacketCounter nReassemblyTimeouts
count of dropped partial network-layer packets due to reassembly timeout
Class representing a wire element of NDN-TLV packet format.
represents an Interest packet
const NackHeader & getHeader() const
void sendPacket(Transport::Packet &&packet)
sends a lower-layer packet via Transport
GenericLinkServiceCounters(const LpReassembler &reassembler)
represents a Network Nack
provides a tag type for simple types
FIELD::ValueType get(size_t index=0) const
PacketCounter nOutOverMtu
count of outgoing LpPackets dropped due to exceeding MTU limit
Copyright (c) 2011-2015 Regents of the University of California.
void receiveNack(const lp::Nack &nack)
delivers received Nack to forwarding
reassembles fragmented network-layer packets
counters provided by GenericLinkService
Options that control the behavior of GenericLinkService.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
void receiveData(const Data &data)
delivers received Data to forwarding
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Fast encoding or block size estimation.
std::tuple< bool, Block, lp::Packet > receiveFragment(Transport::EndpointId remoteEndpoint, const lp::Packet &packet)
adds received fragment to buffer
PacketCounter nInNetInvalid
count of invalid reassembled network-layer packets dropped
std::tuple< bool, std::vector< lp::Packet > > fragmentPacket(const lp::Packet &packet, size_t mtu)
fragments a network-layer packet into link-layer packets
LpReassembler::Options reassemblerOptions
options for reassembly
#define NFD_LOG_INIT(name)
GenericLinkService(const Options &options=Options())
const Interest & getInterest() const
represents an error in TLV encoding or decoding
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.
PacketCounter nInLpInvalid
count of invalid LpPackets dropped before reassembly
void receiveInterest(const Interest &interest)
delivers received Interest to forwarding
PacketCounter nFragmentationErrors
count of failed fragmentations
bool allowFragmentation
enables fragmentation