blob: 0091c25b0a631699baaf84bf658f139d8584f560 [file] [log] [blame]
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011-2012 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21// dumb-requester.h
22
23#ifndef DUMB_REQUESTER_H_
24#define DUMB_REQUESTER_H_
25
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070026#include "ns3/ndnSIM/model/ndn-common.hpp"
27
Alexander Afanasyev0c395372014-12-20 15:54:02 -080028#include "ns3/ndn-app.hpp"
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080029
30namespace ns3 {
31
32/**
33 * @brief A dumb requester application
34 *
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080035 * This app keeps requesting every second the same content object
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080036 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080037class DumbRequester : public ndn::App {
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080038public:
39 // register NS-3 type "DumbRequester"
40 static TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080041 GetTypeId();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080042
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080043 DumbRequester();
44
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080045 // (overridden from ndn::App) Processing upon start of the application
46 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080047 StartApplication();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080048
49 // (overridden from ndn::App) Processing when application is stopped
50 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080051 StopApplication();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080052
53 // (overridden from ndn::App) Callback that will be called when Data arrives
54 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080055 OnData(Ptr<const ndn::Data> contentObject);
56
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080057private:
58 void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080059 SendInterest();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080060
61private:
62 bool m_isRunning;
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070063 ndn::Name m_name;
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080064};
65
66} // namespace ns3
67
68#endif // DUMB_REQUESTER_H_