NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-fw-hop-count-tag.h
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 
33 class FwHopCountTag : public Tag
34 {
35 public:
36  static TypeId
37  GetTypeId (void);
38 
42  FwHopCountTag () : m_hopCount (0) { };
43 
48 
52  void
53  Increment () { m_hopCount ++; }
54 
58  uint32_t
59  Get () const { return m_hopCount; }
60 
62  // from ObjectBase
64  virtual TypeId
65  GetInstanceTypeId () const;
66 
68  // from Tag
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
void Increment()
Increment hop count.
FwHopCountTag()
Default constructor.
uint32_t Get() const
Get value of hop count.
Packet tag that is used to track hop count for Interest-Data pairs.