blob: 644871fb9c11b9ba62b1e0c308e3079bbd8ea42e [file] [log] [blame]
Ilya Moiseenko1a8be032012-01-18 12:51:09 -08001/* -*- 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
26namespace ns3 {
27
28class Node;
29class Packet;
30
31//#define PATH_SPLICING_MAX_N_HOPS 38
32//#define PATH_SPLICING_MAX_SLICE_INDEX 16
33
34class WeightsPathStretchTag : public Tag
35{
36public:
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080037 struct NodeWeightPair
38 {
39 NodeWeightPair () : node (0), weight (0) { }
40 NodeWeightPair (Ptr<Node> _node, uint32_t _weight) : node (_node), weight (_weight) { }
Ilya Moiseenko1a8be032012-01-18 12:51:09 -080041
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080042 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 Afanasyev6bff0df2012-01-19 17:51:52 -080055 uint64_t
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080056 GetTotalWeight () const;
57
58 Ptr<Node>
59 GetSourceNode () const;
60
Alexander Afanasyev6bff0df2012-01-19 17:51:52 -080061 Ptr<Node>
62 GetDestinationNode () const;
63
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080064 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 Moiseenko1a8be032012-01-18 12:51:09 -080081private:
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080082 std::list<NodeWeightPair> m_infos;
Ilya Moiseenko1a8be032012-01-18 12:51:09 -080083};
84
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080085// class DelaysPathStretchTag : public Tag
86// {
87// public:
88// DelaysPathStretchTag();
Ilya Moiseenko1a8be032012-01-18 12:51:09 -080089
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080090// static TypeId GetTypeId(void);
91// virtual TypeId GetInstanceTypeId(void) const;
Ilya Moiseenko1a8be032012-01-18 12:51:09 -080092
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080093// 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 Moiseenko1a8be032012-01-18 12:51:09 -080097
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080098// int GetNHops();
99// void AddNewHop(double delay);
100// int GetCurrentHop();
101// void RemoveCurrentHop();
102// //void RandomizeTags(UniformVariable &rand, uint32_t max);
Ilya Moiseenko1a8be032012-01-18 12:51:09 -0800103
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800104// private:
105// //PathSplicingPathTag(const PathSplicingPathTag &o);
106// //PathSplicingPathTag &operator = (const PathSplicingPathTag &o);
Ilya Moiseenko1a8be032012-01-18 12:51:09 -0800107
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800108// //bool operator == (PathSplicingPathTag const &o) const;
109
110// private:
111// std::list<double> m_delays;
112// };
Ilya Moiseenko1a8be032012-01-18 12:51:09 -0800113
114
115} // namespace ns3
116
117
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800118#endif /* PATH_STRETCH_TAG_H */