blob: 55bdace5e90a0c3efe4085a3e76484d83102de77 [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
Alexander Afanasyev0c395372014-12-20 15:54:02 -080026#include "ns3/ndn-app.hpp"
27#include "ns3/ndn-name.hpp"
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080028
29namespace ns3 {
30
31/**
32 * @brief A dumb requester application
33 *
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080034 * This app keeps requesting every second the same content object
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080035 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080036class DumbRequester : public ndn::App {
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080037public:
38 // register NS-3 type "DumbRequester"
39 static TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080040 GetTypeId();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080041
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080042 DumbRequester();
43
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080044 // (overridden from ndn::App) Processing upon start of the application
45 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080046 StartApplication();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080047
48 // (overridden from ndn::App) Processing when application is stopped
49 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080050 StopApplication();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080051
52 // (overridden from ndn::App) Callback that will be called when Data arrives
53 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080054 OnData(Ptr<const ndn::Data> contentObject);
55
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080056private:
57 void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080058 SendInterest();
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080059
60private:
61 bool m_isRunning;
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070062 ndn::Name m_name;
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080063};
64
65} // namespace ns3
66
67#endif // DUMB_REQUESTER_H_