blob: b2c115ba68cc4f860d33dee03b1c5d1a115ca5f8 [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>
19 */
20
21#ifndef CCNX_CONSUMER_H
22#define CCNX_CONSUMER_H
23
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080024#include "ccnx-app.h"
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070025
26namespace ns3
27{
28
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080029class CcnxConsumer: public CcnxApp
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070030{
31public:
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070032 static TypeId GetTypeId ();
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070033
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070034 CcnxConsumer ();
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070035
36 void OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
37 const Ptr<const Packet> &payload);
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080038
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070039protected:
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080040 // from CcnxApp
41 virtual void
42 StartApplication ();
43
44 virtual void
45 StopApplication ();
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070046
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070047private:
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070048 //helpers
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070049 void SendPacket ();
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070050
51private:
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080052 UniformVariable m_rand;
53 uint32_t m_seq;
54 EventId m_sendEvent; // Eventid of pending "send packet" event
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070055
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080056 Time m_offTime;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070057 CcnxNameComponents m_interestName;
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080058 Time m_interestLifeTime;
59 int32_t m_minSuffixComponents;
60 int32_t m_maxSuffixComponents;
61 bool m_childSelector;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070062 CcnxNameComponents m_exclude;
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070063};
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070064
65} // namespace ns3
66
Ilya Moiseenko8196d2e2011-08-29 13:03:22 -070067#endif