blob: bce01d3eb6d941c63d501b182089a94193ff2b83 [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 Afanasyevbd9c18e2012-11-19 15:23:41 -080029#include "ns3/ndn-content-object.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/**
35 * @brief A simple Interest-sink applia simple Interest-sink application
36 *
37 * A simple Interest-sink applia simple Interest-sink application,
38 * which replying every incoming Interest with Data packet with a specified
39 * size and name same as in Interest.cation, which replying every incoming Interest
40 * with Data packet with a specified size and name same as in Interest.
41 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070042class Producer : public App
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070043{
44public:
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080045 static TypeId
46 GetTypeId (void);
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070047
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070048 Producer ();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080049
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070050 // inherited from NdnApp
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070051 void OnInterest (const Ptr<const Interest> &interest, Ptr<Packet> packet);
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080052
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080053protected:
54 // inherited from Application base class.
55 virtual void
56 StartApplication (); // Called at time specified by Start
57
58 virtual void
59 StopApplication (); // Called at time specified by Stop
60
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070061private:
Alexander Afanasyevcfdc14f2013-03-15 14:38:44 -070062 Name m_prefix;
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080063 uint32_t m_virtualPayloadSize;
Alexander Afanasyevc3cc0b32012-12-12 18:41:20 -080064 Time m_freshness;
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070065};
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080066
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070067} // namespace ndn
68} // namespace ns3
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080069
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070070#endif // NDN_PRODUCER_H