blob: 027bdfefbcb765a5437dfdeb542196281d15ae64 [file] [log] [blame]
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -08001/* -*- 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
Alexander Afanasyev0c395372014-12-20 15:54:02 -080021#include "ndn-fw-hop-count-tag.hpp"
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080022
23namespace ns3 {
24namespace ndn {
25
26TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080027FwHopCountTag::GetTypeId()
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080028{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080029 static TypeId tid =
30 TypeId("ns3::ndn::FwHopCountTag").SetParent<Tag>().AddConstructor<FwHopCountTag>();
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080031 return tid;
32}
33
34TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080035FwHopCountTag::GetInstanceTypeId() const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080036{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080037 return FwHopCountTag::GetTypeId();
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080038}
39
40uint32_t
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080041FwHopCountTag::GetSerializedSize() const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080042{
43 return sizeof(uint32_t);
44}
45
46void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080047FwHopCountTag::Serialize(TagBuffer i) const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080048{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080049 i.WriteU32(m_hopCount);
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080050}
51
52void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080053FwHopCountTag::Deserialize(TagBuffer i)
54{
55 m_hopCount = i.ReadU32();
56}
57
58void
59FwHopCountTag::Print(std::ostream& os) const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080060{
61 os << m_hopCount;
62}
63
64} // namespace ndn
65} // namespace ns3