Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 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: Ilya Moiseenko <iliamo@cs.ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #include "ns3/tag.h" |
| 22 | |
| 23 | #ifndef PATH_STRETCH_TAG_H |
| 24 | #define PATH_STRETCH_TAG_H |
| 25 | |
| 26 | namespace ns3 { |
| 27 | |
| 28 | class Node; |
| 29 | class Packet; |
| 30 | |
| 31 | //#define PATH_SPLICING_MAX_N_HOPS 38 |
| 32 | //#define PATH_SPLICING_MAX_SLICE_INDEX 16 |
| 33 | |
| 34 | class WeightsPathStretchTag : public Tag |
| 35 | { |
| 36 | public: |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 37 | struct NodeWeightPair |
| 38 | { |
| 39 | NodeWeightPair () : node (0), weight (0) { } |
| 40 | NodeWeightPair (Ptr<Node> _node, uint32_t _weight) : node (_node), weight (_weight) { } |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 41 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 42 | Ptr<Node> node; |
| 43 | uint32_t weight; |
| 44 | }; |
| 45 | |
| 46 | static TypeId |
| 47 | GetTypeId (); |
| 48 | |
| 49 | WeightsPathStretchTag (); |
| 50 | virtual ~WeightsPathStretchTag () { }; |
| 51 | |
| 52 | void |
| 53 | AddPathInfo (Ptr<Node> node, uint32_t weight); |
| 54 | |
Alexander Afanasyev | 6bff0df | 2012-01-19 17:51:52 -0800 | [diff] [blame] | 55 | uint64_t |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 56 | GetTotalWeight () const; |
| 57 | |
| 58 | Ptr<Node> |
| 59 | GetSourceNode () const; |
| 60 | |
Alexander Afanasyev | 6bff0df | 2012-01-19 17:51:52 -0800 | [diff] [blame] | 61 | Ptr<Node> |
| 62 | GetDestinationNode () const; |
| 63 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 64 | const std::list<NodeWeightPair> & |
| 65 | GetInfos () const |
| 66 | { return m_infos; } |
| 67 | |
| 68 | // from Tag |
| 69 | virtual uint32_t |
| 70 | GetSerializedSize (void) const; |
| 71 | |
| 72 | virtual void |
| 73 | Serialize (TagBuffer i) const; |
| 74 | |
| 75 | virtual void |
| 76 | Deserialize (TagBuffer i); |
| 77 | |
| 78 | virtual void |
| 79 | Print (std::ostream &os) const; |
| 80 | |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 81 | private: |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 82 | std::list<NodeWeightPair> m_infos; |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 83 | }; |
| 84 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 85 | // class DelaysPathStretchTag : public Tag |
| 86 | // { |
| 87 | // public: |
| 88 | // DelaysPathStretchTag(); |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 89 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 90 | // static TypeId GetTypeId(void); |
| 91 | // virtual TypeId GetInstanceTypeId(void) const; |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 92 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 93 | // virtual uint32_t GetSerializedSize(void) const; |
| 94 | // virtual void Serialize(TagBuffer i) const; |
| 95 | // virtual void Deserialize(TagBuffer i); |
| 96 | // virtual void Print(std::ostream &os) const; |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 97 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 98 | // int GetNHops(); |
| 99 | // void AddNewHop(double delay); |
| 100 | // int GetCurrentHop(); |
| 101 | // void RemoveCurrentHop(); |
| 102 | // //void RandomizeTags(UniformVariable &rand, uint32_t max); |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 103 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 104 | // private: |
| 105 | // //PathSplicingPathTag(const PathSplicingPathTag &o); |
| 106 | // //PathSplicingPathTag &operator = (const PathSplicingPathTag &o); |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 107 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 108 | // //bool operator == (PathSplicingPathTag const &o) const; |
| 109 | |
| 110 | // private: |
| 111 | // std::list<double> m_delays; |
| 112 | // }; |
Ilya Moiseenko | 1a8be03 | 2012-01-18 12:51:09 -0800 | [diff] [blame] | 113 | |
| 114 | |
| 115 | } // namespace ns3 |
| 116 | |
| 117 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 118 | #endif /* PATH_STRETCH_TAG_H */ |