Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 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 CCNX_CONSUMER_CBR_H |
| 23 | #define CCNX_CONSUMER_CBR_H |
| 24 | |
| 25 | #include "ccnx-consumer.h" |
| 26 | |
| 27 | namespace ns3 |
| 28 | { |
| 29 | |
| 30 | /** |
| 31 | * @ingroup ccnx |
| 32 | * \brief CCNx application for sending out Interest packets at a "constant" rate (Poisson process) |
| 33 | */ |
| 34 | class CcnxConsumerCbr: public CcnxConsumer |
| 35 | { |
| 36 | public: |
| 37 | static TypeId GetTypeId (); |
| 38 | |
| 39 | /** |
| 40 | * \brief Default constructor |
| 41 | * Sets up randomizer function and packet sequence number |
| 42 | */ |
| 43 | CcnxConsumerCbr (); |
Alexander Afanasyev | 59e6771 | 2012-02-07 11:49:34 -0800 | [diff] [blame] | 44 | virtual ~CcnxConsumerCbr (); |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 45 | |
| 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 | |
| 57 | protected: |
| 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 Afanasyev | 59e6771 | 2012-02-07 11:49:34 -0800 | [diff] [blame] | 63 | |
| 64 | void |
| 65 | SetRandomize (const std::string &value); |
| 66 | |
| 67 | std::string |
| 68 | GetRandomize () const; |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 69 | |
| 70 | private: |
Alexander Afanasyev | b7ad232 | 2012-01-17 22:54:49 -0800 | [diff] [blame] | 71 | // void |
| 72 | // UpdateMean (); |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 73 | |
Alexander Afanasyev | b7ad232 | 2012-01-17 22:54:49 -0800 | [diff] [blame] | 74 | // virtual void |
| 75 | // SetPayloadSize (uint32_t payload); |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 76 | |
Alexander Afanasyev | b7ad232 | 2012-01-17 22:54:49 -0800 | [diff] [blame] | 77 | // void |
| 78 | // SetDesiredRate (DataRate rate); |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 79 | |
Alexander Afanasyev | b7ad232 | 2012-01-17 22:54:49 -0800 | [diff] [blame] | 80 | // DataRate |
| 81 | // GetDesiredRate () const; |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 82 | |
| 83 | protected: |
Alexander Afanasyev | b7ad232 | 2012-01-17 22:54:49 -0800 | [diff] [blame] | 84 | double m_frequency; // Frequency of interest packets (in hertz) |
Alexander Afanasyev | 59e6771 | 2012-02-07 11:49:34 -0800 | [diff] [blame] | 85 | bool m_firstTime; |
| 86 | RandomVariable *m_random; |
| 87 | std::string m_randomType; |
Alexander Afanasyev | 029d38d | 2012-01-09 13:50:50 -0800 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | } // namespace ns3 |
| 91 | |
| 92 | #endif |