blob: 15466b450d419ec7fb7e20a902c88e41e1d3eea1 [file] [log] [blame]
Alexander Afanasyev7bb30772013-06-18 10:30:58 -07001/* -*- 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#include "ndn-local-info-tag.h"
22#include <ns3/ndn-face.h>
23
24namespace ns3 {
25namespace ndn {
26
27LocalInfoTag::LocalInfoTag (Ptr<Face> inFace)
28{
29 if (inFace != 0)
30 {
31 m_faceId = inFace->GetId ();
32 }
33 else
34 m_faceId = CACHE_FACE;
35}
36
37LocalInfoTag::~LocalInfoTag ()
38{
39}
40
41
42TypeId
43LocalInfoTag::GetTypeId ()
44{
45 static TypeId tid = TypeId("ns3::ndn::LocalInfo")
46 .SetParent<Tag>()
47 ;
48 return tid;
49}
50
51TypeId
52LocalInfoTag::GetInstanceTypeId () const
53{
54 return LocalInfoTag::GetTypeId ();
55}
56
57uint32_t
58LocalInfoTag::GetSerializedSize () const
59{
60 return sizeof (uint32_t);
61}
62
63void
64LocalInfoTag::Serialize (TagBuffer i) const
65{
66 i.WriteU32 (m_faceId);
67}
68
69void
70LocalInfoTag::Deserialize (TagBuffer i)
71{
72 m_faceId = i.ReadU32 ();
73}
74
75void
76LocalInfoTag::Print (std::ostream &os) const
77{
78 os << m_faceId;
79}
80
81} // namespace ndn
82} // namespace ns3