Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 24 | #include "ccnx-app.h" |
Alexander Afanasyev | 19426ef | 2011-11-23 20:55:28 -0800 | [diff] [blame] | 25 | #include "ns3/random-variable.h" |
| 26 | #include "ns3/ccnx-name-components.h" |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 27 | |
| 28 | namespace ns3 |
| 29 | { |
| 30 | |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 31 | class CcnxConsumer: public CcnxApp |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 32 | { |
| 33 | public: |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 34 | static TypeId GetTypeId (); |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 35 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 36 | CcnxConsumer (); |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 37 | |
| 38 | void OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject, |
| 39 | const Ptr<const Packet> &payload); |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 40 | |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 41 | protected: |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 42 | // from CcnxApp |
| 43 | virtual void |
| 44 | StartApplication (); |
| 45 | |
| 46 | virtual void |
| 47 | StopApplication (); |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 48 | |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 49 | private: |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 50 | //helpers |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 51 | void SendPacket (); |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 52 | |
| 53 | private: |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 54 | UniformVariable m_rand; |
| 55 | uint32_t m_seq; |
| 56 | EventId m_sendEvent; // Eventid of pending "send packet" event |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 57 | |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 58 | Time m_offTime; |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 59 | CcnxNameComponents m_interestName; |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 60 | Time m_interestLifeTime; |
| 61 | int32_t m_minSuffixComponents; |
| 62 | int32_t m_maxSuffixComponents; |
| 63 | bool m_childSelector; |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 64 | CcnxNameComponents m_exclude; |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 65 | }; |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 66 | |
| 67 | } // namespace ns3 |
| 68 | |
Ilya Moiseenko | 8196d2e | 2011-08-29 13:03:22 -0700 | [diff] [blame] | 69 | #endif |