blob: 06ed812b7d7d79ff31f690ca0718f4e12413fda9 [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
26#include "ns3/ndn-app.h"
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070027#include "ns3/ndn-name.h"
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080028
29namespace ns3 {
30
31/**
32 * @brief A dumb requester application
33 *
34 * This app keeps requesting every second the same content object
35 */
36class DumbRequester : public ndn::App
37{
38public:
39 // register NS-3 type "DumbRequester"
40 static TypeId
41 GetTypeId ();
42
43 DumbRequester ();
44
45 // (overridden from ndn::App) Processing upon start of the application
46 virtual void
47 StartApplication ();
48
49 // (overridden from ndn::App) Processing when application is stopped
50 virtual void
51 StopApplication ();
52
53 // (overridden from ndn::App) Callback that will be called when Data arrives
54 virtual void
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070055 OnContentObject (const Ptr<const ndn::ContentObject> &contentObject,
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080056 Ptr<Packet> payload);
57
58private:
59 void
60 SendInterest ();
61
62private:
63 bool m_isRunning;
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070064 ndn::Name m_name;
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080065};
66
67} // namespace ns3
68
69#endif // DUMB_REQUESTER_H_