blob: e414f4e14e3289764306ca3a83df3942c1ada5b9 [file] [log] [blame]
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -07001/* -*- 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>
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080019 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070020 */
21
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070022#ifndef NDN_PRODUCER_H
23#define NDN_PRODUCER_H
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070024
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070025#include "ns3/ndnSIM/model/ndn-common.hpp"
26
Alexander Afanasyev0c395372014-12-20 15:54:02 -080027#include "ndn-app.hpp"
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080028
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070029#include "ns3/ptr.h"
Alexander Afanasyev0c395372014-12-20 15:54:02 -080030#include "ns3/ndn-name.hpp"
31#include "ns3/ndn-data.hpp"
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070032
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070033namespace ns3 {
34namespace ndn {
Ilya Moiseenkob62c7402011-10-28 13:02:18 -070035
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070036/**
Alexander Afanasyev79206512013-07-27 16:49:12 -070037 * @ingroup ndn-apps
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070038 * @brief A simple Interest-sink applia simple Interest-sink application
39 *
40 * A simple Interest-sink applia simple Interest-sink application,
41 * which replying every incoming Interest with Data packet with a specified
42 * size and name same as in Interest.cation, which replying every incoming Interest
43 * with Data packet with a specified size and name same as in Interest.
44 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080045class Producer : public App {
Alexander Afanasyeve7221482013-07-15 18:24:37 -070046public:
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080047 static TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080048 GetTypeId(void);
Alexander Afanasyeve7221482013-07-15 18:24:37 -070049
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080050 Producer();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080051
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070052 // inherited from NdnApp
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080053 void
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070054 OnInterest(shared_ptr<const Interest> interest);
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080055
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080056protected:
57 // inherited from Application base class.
58 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080059 StartApplication(); // Called at time specified by Start
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080060
61 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080062 StopApplication(); // Called at time specified by Stop
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080063
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070064private:
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070065 Name m_prefix;
Alexander Afanasyev79606062013-07-11 00:57:28 -070066 Name m_postfix;
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080067 uint32_t m_virtualPayloadSize;
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080068 Time m_freshness;
Alexander Afanasyeve7221482013-07-15 18:24:37 -070069
70 uint32_t m_signature;
71 Name m_keyLocator;
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070072};
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080073
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070074} // namespace ndn
75} // namespace ns3
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080076
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070077#endif // NDN_PRODUCER_H