NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-consumer-window.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011-2018 Regents of the University of California.
4  *
5  * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6  * contributors.
7  *
8  * ndnSIM is free software: you can redistribute it and/or modify it under the terms
9  * of the GNU General Public License as published by the Free Software Foundation,
10  * either version 3 of the License, or (at your option) any later version.
11  *
12  * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  * PURPOSE. See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18  **/
19 
20 #ifndef NDN_CONSUMER_WINDOW_H
21 #define NDN_CONSUMER_WINDOW_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 
25 #include "ndn-consumer.hpp"
26 #include "ns3/traced-value.h"
27 
28 namespace ns3 {
29 namespace ndn {
30 
39 class ConsumerWindow : public Consumer {
40 public:
41  static TypeId
42  GetTypeId();
43 
48 
49  // From App
50  virtual void
51  OnData(shared_ptr<const Data> contentObject);
52 
53  virtual void
54  OnTimeout(uint32_t sequenceNumber);
55 
56  virtual void
57  WillSendOutInterest(uint32_t sequenceNumber);
58 
59 public:
60  typedef std::function<void(double)> WindowTraceCallback;
61 
62 protected:
67  virtual void
69 
70 private:
71  virtual void
72  SetWindow(uint32_t window);
73 
74  uint32_t
75  GetWindow() const;
76 
77  virtual void
78  SetPayloadSize(uint32_t payload);
79 
80  uint32_t
81  GetPayloadSize() const;
82 
83  double
84  GetMaxSize() const;
85 
86  void
87  SetMaxSize(double size);
88 
89  uint32_t
90  GetSeqMax() const;
91 
92  void
93  SetSeqMax(uint32_t seqMax);
94 
95 protected:
96  uint32_t m_payloadSize; // expected payload size
97  double m_maxSize; // max size to request
98 
99  uint32_t m_initialWindow;
101 
102  TracedValue<double> m_window;
103  TracedValue<uint32_t> m_inFlight;
104 };
105 
106 } // namespace ndn
107 } // namespace ns3
108 
109 #endif // NDN_CONSUMER_WINDOW_H
ns3::ndn::ConsumerWindow::ScheduleNextPacket
virtual void ScheduleNextPacket()
Constructs the Interest packet and sends it using a callback to the underlying NDN protocol.
Definition: ndn-consumer-window.cpp:156
ns3::ndn::ConsumerWindow::GetTypeId
static TypeId GetTypeId()
Definition: ndn-consumer-window.cpp:39
ns3::ndn::ConsumerWindow::m_initialWindow
uint32_t m_initialWindow
Definition: ndn-consumer-window.hpp:99
ns3::ndn::ConsumerWindow::m_payloadSize
uint32_t m_payloadSize
Definition: ndn-consumer-window.hpp:96
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ndn-consumer.hpp
ns3::ndn::ConsumerWindow::m_setInitialWindowOnTimeout
bool m_setInitialWindowOnTimeout
Definition: ndn-consumer-window.hpp:100
ns3::ndn::ConsumerWindow::WindowTraceCallback
std::function< void(double)> WindowTraceCallback
Definition: ndn-consumer-window.hpp:60
ns3::ndn::ConsumerWindow::ConsumerWindow
ConsumerWindow()
Default constructor.
Definition: ndn-consumer-window.cpp:86
ns3::ndn::ConsumerWindow::WillSendOutInterest
virtual void WillSendOutInterest(uint32_t sequenceNumber)
An event that is fired just before an Interest packet is actually send out (send is inevitable)
Definition: ndn-consumer-window.cpp:215
ns3::ndn::ConsumerWindow::m_maxSize
double m_maxSize
Definition: ndn-consumer-window.hpp:97
ns3::ndn::Consumer
NDN application for sending out Interest packets.
Definition: ndn-consumer.hpp:49
ns3::ndn::ConsumerWindow::m_inFlight
TracedValue< uint32_t > m_inFlight
Definition: ndn-consumer-window.hpp:103
ns3::ndn::ConsumerWindow::OnTimeout
virtual void OnTimeout(uint32_t sequenceNumber)
Timeout event.
Definition: ndn-consumer-window.cpp:200
ns3::ndn::ConsumerWindow::m_window
TracedValue< double > m_window
Definition: ndn-consumer-window.hpp:102
ns3::ndn::ConsumerWindow
Ndn application for sending out Interest packets (window-based)
Definition: ndn-consumer-window.hpp:39
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ns3::ndn::ConsumerWindow::OnData
virtual void OnData(shared_ptr< const Data > contentObject)
Method that will be called every time new Data arrives.
Definition: ndn-consumer-window.cpp:186