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-zipf-mandelbrot.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2012 Tsinghua University, P.R.China
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: Xiaoke Jiang <shock.jiang@gmail.com>
19  */
20 
21 
22 #ifndef NDN_CONSUMER_ZIPF_MANDELBROT_H_
23 #define NDN_CONSUMER_ZIPF_MANDELBROT_H_
24 
25 #include "ndn-consumer.h"
26 #include "ns3/ptr.h"
27 #include "ns3/log.h"
28 #include "ns3/simulator.h"
29 #include "ns3/packet.h"
30 #include "ns3/callback.h"
31 #include "ns3/string.h"
32 #include "ns3/uinteger.h"
33 #include "ns3/double.h"
34 #include "ndn-consumer-cbr.h"
35 #include "ns3/random-variable.h"
36 
37 namespace ns3 {
38 namespace ndn {
39 
48 {
49 public:
50  static TypeId GetTypeId ();
51 
58  virtual ~ConsumerZipfMandelbrot ();
59 
60  virtual void SendPacket();
61  uint32_t GetNextSeq();
62 
63 protected:
64  virtual void
66 
67 private:
68  void
69  SetNumberOfContents (uint32_t numOfContents);
70 
71  uint32_t
72  GetNumberOfContents () const;
73 
74  void
75  SetQ (double q);
76 
77  double
78  GetQ () const;
79 
80  void
81  SetS (double s);
82 
83  double
84  GetS () const;
85 
86 private:
87  uint32_t m_N; //number of the contents
88  double m_q; //q in (k+q)^s
89  double m_s; //s in (k+q)^s
90  std::vector<double> m_Pcum; //cumulative probability
91 
92  UniformVariable m_SeqRng; //RNG
93 };
94 
95 } /* namespace ndn */
96 } /* namespace ns3 */
97 #endif /* NDN_CONSUMER_ZIPF_MANDELBROT_H_ */
ConsumerZipfMandelbrot()
Default constructor Sets up randomized Number Generator (RNG) Note: m_seq of its parent class Consume...
NDN app requesting contents following Zipf-Mandelbrot Distbituion.
virtual void ScheduleNextPacket()
Constructs the Interest packet and sends it using a callback to the underlying NDN protocol...
Ndn application for sending out Interest packets at a "constant" rate (Poisson process) ...