blob: ba7aa9266856f8cae77063c01bf881d4339c8ab7 [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#ifndef NDN_LOCAL_INFO_TAG_H
22#define NDN_LOCAL_INFO_TAG_H
23
24#include "ns3/tag.h"
25#include "ns3/ptr.h"
26
27namespace ns3 {
28namespace ndn {
29
30class Face;
31
32/**
Alexander Afanasyev79206512013-07-27 16:49:12 -070033 * @ingroup ndn-fw
Alexander Afanasyev7bb30772013-06-18 10:30:58 -070034 * @brief Packet tag that is used to keep information about face from which packet was received
35 *
36 * This tag may be extended later to include more information, if necessary
37 */
38class LocalInfoTag : public Tag
39{
40public:
41 static TypeId
42 GetTypeId ();
43
44 /**
45 * @brief Constructor
46 */
47 LocalInfoTag (Ptr<Face> inFace);
48
49 /**
50 * @brief Destructor
51 */
52 ~LocalInfoTag ();
53
54 /**
55 * @brief Get smart pointer to the face
56 *
57 * @returns 0 or a valid smart pointer to a face
58 */
59 uint32_t
60 Get () const
61 {
62 return m_faceId;
63 }
64
65 ////////////////////////////////////////////////////////
66 // from ObjectBase
67 ////////////////////////////////////////////////////////
68 virtual TypeId
69 GetInstanceTypeId () const;
70
71 ////////////////////////////////////////////////////////
72 // from Tag
73 ////////////////////////////////////////////////////////
74
75 virtual uint32_t
76 GetSerializedSize () const;
77
78 virtual void
79 Serialize (TagBuffer i) const;
80
81 virtual void
82 Deserialize (TagBuffer i);
83
84 virtual void
85 Print (std::ostream &os) const;
86
87public:
88 static const uint32_t CACHE_FACE = static_cast<uint32_t> (-1);
89
90private:
91 uint32_t m_faceId;
92};
93
94} // namespace ndn
95} // namespace ns3
96
97#endif // NDN_LOCAL_INFO_TAG_H