NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-consumer-window.h
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 University of California, Los Angeles
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
19  * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
20  */
21 
22 #ifndef NDN_CONSUMER_WINDOW_H
23 #define NDN_CONSUMER_WINDOW_H
24 
25 #include "ndn-consumer.h"
26 #include "ns3/traced-value.h"
27 
28 namespace ns3 {
29 namespace ndn {
30 
38 class ConsumerWindow: public Consumer
39 {
40 public:
41  static TypeId GetTypeId ();
42 
46  ConsumerWindow ();
47 
48  // From App
49  // virtual void
50  // OnInterest (const Ptr<const Interest> &interest);
51 
52  virtual void
53  OnNack (Ptr<const Interest> interest);
54 
55  virtual void
56  OnData (Ptr<const Data> contentObject);
57 
58  virtual void
59  OnTimeout (uint32_t sequenceNumber);
60 
61  virtual void
62  WillSendOutInterest (uint32_t sequenceNumber);
63 
64 protected:
68  virtual void
70 
71 private:
72  virtual void
73  SetWindow (uint32_t window);
74 
75  uint32_t
76  GetWindow () const;
77 
78  virtual void
79  SetPayloadSize (uint32_t payload);
80 
81  uint32_t
82  GetPayloadSize () const;
83 
84  double
85  GetMaxSize () const;
86 
87  void
88  SetMaxSize (double size);
89 
90  uint32_t
91  GetSeqMax () const;
92 
93  void
94  SetSeqMax (uint32_t seqMax);
95 
96 private:
97  uint32_t m_payloadSize; // expected payload size
98  double m_maxSize; // max size to request
99 
100  uint32_t m_initialWindow;
101  bool m_setInitialWindowOnTimeout;
102 
103  TracedValue<uint32_t> m_window;
104  TracedValue<uint32_t> m_inFlight;
105 };
106 
107 } // namespace ndn
108 } // namespace ns3
109 
110 #endif
virtual void OnData(Ptr< const Data > contentObject)
Method that will be called every time new Data arrives.
NDN application for sending out Interest packets.
Definition: ndn-consumer.h:47
virtual void OnNack(Ptr< const Interest > interest)
Method that will be called every time new NACK arrives.
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 ScheduleNextPacket()
Constructs the Interest packet and sends it using a callback to the underlying NDN protocol...
virtual void OnTimeout(uint32_t sequenceNumber)
Timeout event.
Ndn application for sending out Interest packets (window-based)
ConsumerWindow()
Default constructor.