Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef NDN_FW_HOP_COUNT_TAG_H |
| 22 | #define NDN_FW_HOP_COUNT_TAG_H |
| 23 | |
| 24 | #include "ns3/tag.h" |
| 25 | |
| 26 | namespace ns3 { |
| 27 | namespace ndn { |
| 28 | |
| 29 | /** |
Alexander Afanasyev | 7920651 | 2013-07-27 16:49:12 -0700 | [diff] [blame] | 30 | * @ingroup ndn-fw |
Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 31 | * @brief Packet tag that is used to track hop count for Interest-Data pairs |
| 32 | */ |
| 33 | class FwHopCountTag : public Tag |
| 34 | { |
| 35 | public: |
| 36 | static TypeId |
| 37 | GetTypeId (void); |
| 38 | |
| 39 | /** |
| 40 | * @brief Default constructor |
| 41 | */ |
| 42 | FwHopCountTag () : m_hopCount (0) { }; |
| 43 | |
| 44 | /** |
| 45 | * @brief Destructor |
| 46 | */ |
| 47 | ~FwHopCountTag () { } |
| 48 | |
| 49 | /** |
| 50 | * @brief Increment hop count |
| 51 | */ |
| 52 | void |
| 53 | Increment () { m_hopCount ++; } |
| 54 | |
| 55 | /** |
| 56 | * @brief Get value of hop count |
| 57 | */ |
| 58 | uint32_t |
| 59 | Get () const { return m_hopCount; } |
| 60 | |
| 61 | //////////////////////////////////////////////////////// |
| 62 | // from ObjectBase |
| 63 | //////////////////////////////////////////////////////// |
| 64 | virtual TypeId |
| 65 | GetInstanceTypeId () const; |
| 66 | |
| 67 | //////////////////////////////////////////////////////// |
| 68 | // from Tag |
| 69 | //////////////////////////////////////////////////////// |
| 70 | |
| 71 | virtual uint32_t |
| 72 | GetSerializedSize () const; |
| 73 | |
| 74 | virtual void |
| 75 | Serialize (TagBuffer i) const; |
| 76 | |
| 77 | virtual void |
| 78 | Deserialize (TagBuffer i); |
| 79 | |
| 80 | virtual void |
| 81 | Print (std::ostream &os) const; |
| 82 | |
| 83 | private: |
| 84 | uint32_t m_hopCount; |
| 85 | }; |
| 86 | |
| 87 | } // namespace ndn |
| 88 | } // namespace ns3 |
| 89 | |
| 90 | #endif // NDN_FW_HOP_COUNT_TAG_H |