blob: 59a06d7d30e3f8f1155a669a8cd76d96e675981e [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 ();
44
45 // From CcnxApp
46 // virtual void
47 // OnInterest (const Ptr<const CcnxInterestHeader> &interest);
48
49 // virtual void
50 // OnNack (const Ptr<const CcnxInterestHeader> &interest);
51
52 // virtual void
53 // OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
54 // const Ptr<const Packet> &payload);
55
56protected:
57 /**
58 * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
59 */
60 virtual void
61 ScheduleNextPacket ();
62
63private:
64 void
65 UpdateMean ();
66
67 virtual void
68 SetPayloadSize (uint32_t payload);
69
70 void
71 SetDesiredRate (DataRate rate);
72
73 DataRate
74 GetDesiredRate () const;
75
76protected:
77 ExponentialVariable m_randExp; // packet inter-arrival time generation (Poisson process)
78 DataRate m_desiredRate; // Desired data packet rate
79};
80
81} // namespace ns3
82
83#endif