blob: 8f84a5b62d4d9694f1e2f5b3af0427f5f8267d3f [file] [log] [blame]
Alexander Afanasyev029d38d2012-01-09 13:50:50 -08001/* -*- 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 CCNX_CONSUMER_CBR_H
23#define CCNX_CONSUMER_CBR_H
24
25#include "ccnx-consumer.h"
26
27namespace ns3
28{
29
30/**
31 * @ingroup ccnx
32 * \brief CCNx application for sending out Interest packets at a "constant" rate (Poisson process)
33 */
34class CcnxConsumerCbr: public CcnxConsumer
35{
36public:
37 static TypeId GetTypeId ();
38
39 /**
40 * \brief Default constructor
41 * Sets up randomizer function and packet sequence number
42 */
43 CcnxConsumerCbr ();
Alexander Afanasyev59e67712012-02-07 11:49:34 -080044 virtual ~CcnxConsumerCbr ();
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080045
46 // From CcnxApp
47 // virtual void
48 // OnInterest (const Ptr<const CcnxInterestHeader> &interest);
49
50 // virtual void
51 // OnNack (const Ptr<const CcnxInterestHeader> &interest);
52
53 // virtual void
54 // OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
55 // const Ptr<const Packet> &payload);
56
57protected:
58 /**
59 * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
60 */
61 virtual void
62 ScheduleNextPacket ();
Alexander Afanasyev59e67712012-02-07 11:49:34 -080063
64 void
65 SetRandomize (const std::string &value);
66
67 std::string
68 GetRandomize () const;
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080069
70private:
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080071 // void
72 // UpdateMean ();
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080073
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080074 // virtual void
75 // SetPayloadSize (uint32_t payload);
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080076
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080077 // void
78 // SetDesiredRate (DataRate rate);
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080079
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080080 // DataRate
81 // GetDesiredRate () const;
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080082
83protected:
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080084 double m_frequency; // Frequency of interest packets (in hertz)
Alexander Afanasyev59e67712012-02-07 11:49:34 -080085 bool m_firstTime;
86 RandomVariable *m_random;
87 std::string m_randomType;
Alexander Afanasyev029d38d2012-01-09 13:50:50 -080088};
89
90} // namespace ns3
91
92#endif