blob: ee6cae77eddc6bb4fa8cc4d1537e05a487498f50 [file] [log] [blame]
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -08004 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08005 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -08007 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08008 * 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.
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080011 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080012 * 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.
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080015 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080016 * 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 **/
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080019
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070020#ifndef NDN_CONSUMER_BATCHES_H
21#define NDN_CONSUMER_BATCHES_H
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080022
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070023#include "ns3/ndnSIM/model/ndn-common.hpp"
24
Alexander Afanasyev0c395372014-12-20 15:54:02 -080025#include "ndn-consumer.hpp"
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080026#include "ns3/traced-value.h"
Mickey Sweatt89046c12014-11-16 20:32:27 -080027#include "ns3/ndnSIM/utils/batches.hpp"
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080028
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070029namespace ns3 {
30namespace ndn {
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080031
32/**
Alexander Afanasyev79206512013-07-27 16:49:12 -070033 * @ingroup ndn-apps
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070034 * \brief Ndn application for sending out Interest packets in batches
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080035 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080036class ConsumerBatches : public Consumer {
37public:
38 static TypeId
39 GetTypeId();
40
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080041 /**
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080042 * \brief Default constructor
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080043 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080044 ConsumerBatches();
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080045
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080046private:
Alexander Afanasyevc3893b22012-12-11 12:22:00 -080047 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080048 StartApplication(); ///< @brief Called at time specified by Start
49
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080050 void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080051 AddBatch(uint32_t amount);
52
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080053protected:
54 /**
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080055 * \brief Constructs the Interest packet and sends it using a callback to the underlying NDN
56 * protocol
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080057 */
58 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080059 ScheduleNextPacket();
Alexander Afanasyev3476edf2012-08-14 11:26:00 -070060
61private:
62 bool m_initial;
Alexander Afanasyevc3893b22012-12-11 12:22:00 -080063
64 Batches m_batches;
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080065};
66
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070067} // namespace ndn
Alexander Afanasyevb7ad2322012-01-17 22:54:49 -080068} // namespace ns3
69
70#endif