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-local-info-tag.cc
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 #include "ndn-local-info-tag.h"
22 #include <ns3/ndn-face.h>
23 
24 namespace ns3 {
25 namespace ndn {
26 
27 LocalInfoTag::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 
38 {
39 }
40 
41 
42 TypeId
43 LocalInfoTag::GetTypeId ()
44 {
45  static TypeId tid = TypeId("ns3::ndn::LocalInfo")
46  .SetParent<Tag>()
47  ;
48  return tid;
49 }
50 
51 TypeId
52 LocalInfoTag::GetInstanceTypeId () const
53 {
54  return LocalInfoTag::GetTypeId ();
55 }
56 
57 uint32_t
58 LocalInfoTag::GetSerializedSize () const
59 {
60  return sizeof (uint32_t);
61 }
62 
63 void
64 LocalInfoTag::Serialize (TagBuffer i) const
65 {
66  i.WriteU32 (m_faceId);
67 }
68 
69 void
70 LocalInfoTag::Deserialize (TagBuffer i)
71 {
72  m_faceId = i.ReadU32 ();
73 }
74 
75 void
76 LocalInfoTag::Print (std::ostream &os) const
77 {
78  os << m_faceId;
79 }
80 
81 } // namespace ndn
82 } // namespace ns3
LocalInfoTag(Ptr< Face > inFace)
Constructor.