blob: d705a2a55eb7f26a5090b0fc6c1818c7cfef5655 [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 Afanasyev4aac5572012-08-09 10:49:55 -070025#include "ndn-app.h"
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080026
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070027#include "ns3/ptr.h"
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070028#include "ns3/ndn-name.h"
Alexander Afanasyev6eba36f2013-08-07 17:42:54 -070029#include "ns3/ndn-data.h"
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 Afanasyev2b4c9472012-08-09 15:00:38 -070043class Producer : public App
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070044{
Alexander Afanasyeve7221482013-07-15 18:24:37 -070045public:
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080046 static TypeId
47 GetTypeId (void);
Alexander Afanasyeve7221482013-07-15 18:24:37 -070048
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070049 Producer ();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080050
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070051 // inherited from NdnApp
Alexander Afanasyevfaa01f92013-07-10 18:34:31 -070052 void 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
57 StartApplication (); // Called at time specified by Start
58
59 virtual void
60 StopApplication (); // Called at time specified by Stop
61
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