Alexander Afanasyev | 7bb3077 | 2013-06-18 10:30:58 -0700 | [diff] [blame] | 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 | #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 | |
| 27 | namespace ns3 { |
| 28 | namespace ndn { |
| 29 | |
| 30 | class Face; |
| 31 | |
| 32 | /** |
Alexander Afanasyev | 7920651 | 2013-07-27 16:49:12 -0700 | [diff] [blame] | 33 | * @ingroup ndn-fw |
Alexander Afanasyev | 7bb3077 | 2013-06-18 10:30:58 -0700 | [diff] [blame] | 34 | * @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 | */ |
| 38 | class LocalInfoTag : public Tag |
| 39 | { |
| 40 | public: |
| 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 | |
| 87 | public: |
| 88 | static const uint32_t CACHE_FACE = static_cast<uint32_t> (-1); |
| 89 | |
| 90 | private: |
| 91 | uint32_t m_faceId; |
| 92 | }; |
| 93 | |
| 94 | } // namespace ndn |
| 95 | } // namespace ns3 |
| 96 | |
| 97 | #endif // NDN_LOCAL_INFO_TAG_H |