OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2013 Mohammed J.F. Alenazi |
| 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: Mohammed J.F. Alenazi <malenazi@ittc.ku.edu> |
| 19 * |
| 20 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
| 21 * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets |
| 22 * Information and Telecommunication Technology Center (ITTC) |
| 23 * and Department of Electrical Engineering and Computer Science |
| 24 * The University of Kansas Lawrence, KS USA. |
| 25 * |
| 26 * Work supported by King Saud University and |
| 27 * the ITTC at The University of Kansas. |
| 28 */ |
| 29 |
| 30 #ifndef EPIDEMIC_TAG_H |
| 31 #define EPIDEMIC_TAG_H |
| 32 |
| 33 |
| 34 #include <iostream> |
| 35 #include "ns3/log.h" |
| 36 #include "ns3/tag.h" |
| 37 |
| 38 |
| 39 namespace ns3 { |
| 40 namespace Epidemic { |
| 41 /** |
| 42 * Tag used by epidemic implementation |
| 43 * \ingroup epidemic |
| 44 * Tag used to differentiate between locally generated packets |
| 45 * and incoming packets in RoutingProtocol::RouteInput() function. |
| 46 */ |
| 47 |
| 48 |
| 49 |
| 50 class ControlTag : public Tag |
| 51 { |
| 52 |
| 53 public: |
| 54 /// TagType enum, two types for epidemic tags |
| 55 enum TagType |
| 56 { |
| 57 CONTROL, //!< Tagged as control message |
| 58 NOT_SET, //!< Tag is not set |
| 59 }; |
| 60 |
| 61 /// Constructor |
| 62 ControlTag (TagType o = NOT_SET) : Tag (), |
| 63 m_tag (o) |
| 64 { |
| 65 } |
| 66 |
| 67 /** |
| 68 * Get the registered TypeId for this class. |
| 69 * \return The object TypeId. |
| 70 */ |
| 71 static TypeId GetTypeId (); |
| 72 // Inherited |
| 73 TypeId GetInstanceTypeId () const; |
| 74 |
| 75 /// \returns control tag type |
| 76 TagType GetTagType () const; |
| 77 |
| 78 /** |
| 79 * Check if this ControlTag is of the indicated TagType. |
| 80 * |
| 81 * \param type The expected TagType |
| 82 * \returns true if \p type matches the TagType of this ControlTag. |
| 83 */ |
| 84 bool IsTagType (const TagType type) const; |
| 85 |
| 86 |
| 87 |
| 88 /** |
| 89 * \brief Seting epidemic tag. |
| 90 * \param tag TagType to be set. |
| 91 */ |
| 92 void SetTagType (const TagType tag); |
| 93 // Inherited |
| 94 uint32_t GetSerializedSize () const; |
| 95 void Serialize (TagBuffer i) const; |
| 96 void Deserialize (TagBuffer i); |
| 97 void Print (std::ostream &os) const; |
| 98 |
| 99 private: |
| 100 /// epidemic tag |
| 101 TagType m_tag; |
| 102 }; |
| 103 |
| 104 |
| 105 |
| 106 |
| 107 |
| 108 } //end namespace epidemic |
| 109 } //end namespace ns3 |
| 110 #endif |
OLD | NEW |