blob: 11ebc56a8fd95e1156f028855194284f09af29b1 [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
Alexander Afanasyev0c395372014-12-20 15:54:02 -080025#include "ndn-app.hpp"
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080026
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070027#include "ns3/ptr.h"
Alexander Afanasyev0c395372014-12-20 15:54:02 -080028#include "ns3/ndn-name.hpp"
29#include "ns3/ndn-data.hpp"
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070030
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070031namespace ns3 {
32namespace ndn {
Ilya Moiseenkob62c7402011-10-28 13:02:18 -070033
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070034/**
Alexander Afanasyev79206512013-07-27 16:49:12 -070035 * @ingroup ndn-apps
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070036 * @brief A simple Interest-sink applia simple Interest-sink application
37 *
38 * A simple Interest-sink applia simple Interest-sink application,
39 * which replying every incoming Interest with Data packet with a specified
40 * size and name same as in Interest.cation, which replying every incoming Interest
41 * with Data packet with a specified size and name same as in Interest.
42 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080043class Producer : public App {
Alexander Afanasyeve7221482013-07-15 18:24:37 -070044public:
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080045 static TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080046 GetTypeId(void);
Alexander Afanasyeve7221482013-07-15 18:24:37 -070047
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080048 Producer();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080049
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070050 // inherited from NdnApp
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080051 void
52 OnInterest(Ptr<const Interest> interest);
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080053
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080054protected:
55 // inherited from Application base class.
56 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080057 StartApplication(); // Called at time specified by Start
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080058
59 virtual void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080060 StopApplication(); // Called at time specified by Stop
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080061
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070062private:
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070063 Name m_prefix;
Alexander Afanasyev79606062013-07-11 00:57:28 -070064 Name m_postfix;
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080065 uint32_t m_virtualPayloadSize;
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080066 Time m_freshness;
Alexander Afanasyeve7221482013-07-15 18:24:37 -070067
68 uint32_t m_signature;
69 Name m_keyLocator;
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070070};
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080071
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070072} // namespace ndn
73} // namespace ns3
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080074
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070075#endif // NDN_PRODUCER_H