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: |
| 37 | WeightsPathStretchTag(); |
| 38 | WeightsPathStretchTag(const WeightsPathStretchTag &o); |
| 39 | WeightsPathStretchTag &operator = (const WeightsPathStretchTag &o); |
| 40 | |
| 41 | bool operator == (WeightsPathStretchTag const &o) const; |
| 42 | |
| 43 | static TypeId GetTypeId(void); |
| 44 | virtual TypeId GetInstanceTypeId(void) const; |
| 45 | |
| 46 | virtual uint32_t GetSerializedSize(void) const; |
| 47 | virtual void Serialize(TagBuffer i) const; |
| 48 | virtual void Deserialize(TagBuffer i); |
| 49 | virtual void Print(std::ostream &os) const; |
| 50 | |
| 51 | void AddNewHop(uint32_t weight); |
| 52 | uint32_t GetValue(); |
| 53 | |
| 54 | private: |
| 55 | uint32_t m_weightPathStretch; |
| 56 | }; |
| 57 | |
| 58 | class DelaysPathStretchTag : public Tag |
| 59 | { |
| 60 | public: |
| 61 | DelaysPathStretchTag(); |
| 62 | //PathSplicingPathTag(const PathSplicingPathTag &o); |
| 63 | //PathSplicingPathTag &operator = (const PathSplicingPathTag &o); |
| 64 | |
| 65 | //bool operator == (PathSplicingPathTag const &o) const; |
| 66 | |
| 67 | static TypeId GetTypeId(void); |
| 68 | virtual TypeId GetInstanceTypeId(void) const; |
| 69 | |
| 70 | virtual uint32_t GetSerializedSize(void) const; |
| 71 | virtual void Serialize(TagBuffer i) const; |
| 72 | virtual void Deserialize(TagBuffer i); |
| 73 | virtual void Print(std::ostream &os) const; |
| 74 | |
| 75 | int GetNHops(); |
| 76 | void AddNewHop(double delay); |
| 77 | int GetCurrentHop(); |
| 78 | void RemoveCurrentHop(); |
| 79 | //void RandomizeTags(UniformVariable &rand, uint32_t max); |
| 80 | |
| 81 | private: |
| 82 | std::list<double> m_delays; |
| 83 | }; |
| 84 | |
| 85 | |
| 86 | } // namespace ns3 |
| 87 | |
| 88 | |
| 89 | #endif /* PATH_STRETCH_TAG_H */ |