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 | /** |
| 30 | * @brief Packet tag that is used to track hop count for Interest-Data pairs |
| 31 | */ |
| 32 | class FwHopCountTag : public Tag |
| 33 | { |
| 34 | public: |
| 35 | static TypeId |
| 36 | GetTypeId (void); |
| 37 | |
| 38 | /** |
| 39 | * @brief Default constructor |
| 40 | */ |
| 41 | FwHopCountTag () : m_hopCount (0) { }; |
| 42 | |
| 43 | /** |
| 44 | * @brief Destructor |
| 45 | */ |
| 46 | ~FwHopCountTag () { } |
| 47 | |
| 48 | /** |
| 49 | * @brief Increment hop count |
| 50 | */ |
| 51 | void |
| 52 | Increment () { m_hopCount ++; } |
| 53 | |
| 54 | /** |
| 55 | * @brief Get value of hop count |
| 56 | */ |
| 57 | uint32_t |
| 58 | Get () const { return m_hopCount; } |
| 59 | |
| 60 | //////////////////////////////////////////////////////// |
| 61 | // from ObjectBase |
| 62 | //////////////////////////////////////////////////////// |
| 63 | virtual TypeId |
| 64 | GetInstanceTypeId () const; |
| 65 | |
| 66 | //////////////////////////////////////////////////////// |
| 67 | // from Tag |
| 68 | //////////////////////////////////////////////////////// |
| 69 | |
| 70 | virtual uint32_t |
| 71 | GetSerializedSize () const; |
| 72 | |
| 73 | virtual void |
| 74 | Serialize (TagBuffer i) const; |
| 75 | |
| 76 | virtual void |
| 77 | Deserialize (TagBuffer i); |
| 78 | |
| 79 | virtual void |
| 80 | Print (std::ostream &os) const; |
| 81 | |
| 82 | private: |
| 83 | uint32_t m_hopCount; |
| 84 | }; |
| 85 | |
| 86 | } // namespace ndn |
| 87 | } // namespace ns3 |
| 88 | |
| 89 | #endif // NDN_FW_HOP_COUNT_TAG_H |