22 #ifndef NDN_CONSUMER_H
23 #define NDN_CONSUMER_H
26 #include "ns3/random-variable.h"
27 #include "ns3/ndn-name.h"
28 #include "ns3/nstime.h"
29 #include "ns3/data-rate.h"
30 #include "ns3/ndn-rtt-estimator.h"
35 #include <boost/multi_index_container.hpp>
36 #include <boost/multi_index/tag.hpp>
37 #include <boost/multi_index/ordered_index.hpp>
38 #include <boost/multi_index/member.hpp>
50 static TypeId GetTypeId ();
64 OnNack (Ptr<const Interest> interest);
67 OnData (Ptr<const Data> contentObject);
145 struct RetxSeqsContainer :
146 public std::set<uint32_t> { };
148 RetxSeqsContainer m_retxSeqs;
155 SeqTimeout (uint32_t _seq, Time _time) : seq (_seq), time (_time) { }
164 class i_timestamp { };
171 struct SeqTimeoutsContainer :
172 public boost::multi_index::multi_index_container<
174 boost::multi_index::indexed_by<
175 boost::multi_index::ordered_unique<
176 boost::multi_index::tag<i_seq>,
177 boost::multi_index::member<SeqTimeout, uint32_t, &SeqTimeout::seq>
179 boost::multi_index::ordered_non_unique<
180 boost::multi_index::tag<i_timestamp>,
181 boost::multi_index::member<SeqTimeout, Time, &SeqTimeout::time>
186 SeqTimeoutsContainer m_seqTimeouts;
188 SeqTimeoutsContainer m_seqLastDelay;
189 SeqTimeoutsContainer m_seqFullDelay;
190 std::map<uint32_t, uint32_t> m_seqRetxCounts;
192 TracedCallback<Ptr<App> , uint32_t ,
193 Time , int32_t > m_lastRetransmittedInterestDataDelay;
194 TracedCallback<Ptr<App> , uint32_t ,
196 int32_t > m_firstInterestDataDelay;
NDN application for sending out Interest packets.
virtual void OnTimeout(uint32_t sequenceNumber)
Timeout event.
Consumer()
Default constructor Sets up randomizer function and packet sequence number.
Name m_interestName
NDN Name of the Interest (use Name)
virtual void ScheduleNextPacket()=0
Constructs the Interest packet and sends it using a callback to the underlying NDN protocol...
UniformVariable m_rand
nonce generator
Time m_retxTimer
Currently estimated retransmission timer.
EventId m_sendEvent
EventId of pending "send packet" event.
virtual void OnData(Ptr< const Data > contentObject)
Method that will be called every time new Data arrives.
EventId m_retxEvent
Event to check whether or not retransmission should be performed.
Base class that all NDN applications should be derived from.
Ptr< RttEstimator > m_rtt
RTT estimator.
Time GetRetxTimer() const
Returns the frequency of checking the retransmission timeouts.
void CheckRetxTimeout()
Checks if the packet need to be retransmitted becuase of retransmission timer expiration.
uint32_t m_seqMax
maximum number of sequence number
Time m_offTime
Time interval between packets.
void SendPacket()
Actually send packet.
virtual void WillSendOutInterest(uint32_t sequenceNumber)
An event that is fired just before an Interest packet is actually send out (send is inevitable) ...
virtual void StartApplication()
Called at time specified by Start.
uint32_t m_seq
currently requested sequence number
virtual void StopApplication()
Called at time specified by Stop.
Time m_interestLifeTime
LifeTime for interest packet.
void SetRetxTimer(Time retxTimer)
Modifies the frequency of checking the retransmission timeouts.
virtual void OnNack(Ptr< const Interest > interest)
Method that will be called every time new NACK arrives.