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