blob: cfa2126768239a9ee2c361f1a3bef689b222fbfd [file] [log] [blame]
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -08004 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08005 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -08007 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08008 * ndnSIM is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080011 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080012 * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080015 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080016 * You should have received a copy of the GNU General Public License along with
17 * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080019
Alexander Afanasyev0c395372014-12-20 15:54:02 -080020#include "ndn-fw-hop-count-tag.hpp"
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080021
22namespace ns3 {
23namespace ndn {
24
25TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080026FwHopCountTag::GetTypeId()
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080027{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080028 static TypeId tid =
29 TypeId("ns3::ndn::FwHopCountTag").SetParent<Tag>().AddConstructor<FwHopCountTag>();
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080030 return tid;
31}
32
33TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080034FwHopCountTag::GetInstanceTypeId() const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080035{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080036 return FwHopCountTag::GetTypeId();
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080037}
38
39uint32_t
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080040FwHopCountTag::GetSerializedSize() const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080041{
42 return sizeof(uint32_t);
43}
44
45void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080046FwHopCountTag::Serialize(TagBuffer i) const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080047{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080048 i.WriteU32(m_hopCount);
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080049}
50
51void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080052FwHopCountTag::Deserialize(TagBuffer i)
53{
54 m_hopCount = i.ReadU32();
55}
56
57void
58FwHopCountTag::Print(std::ostream& os) const
Alexander Afanasyev1a0fff62013-01-19 14:29:51 -080059{
60 os << m_hopCount;
61}
62
63} // namespace ndn
64} // namespace ns3