1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2007 University of Washington |
|
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 |
|
19 #ifndef FQ_CODEL_H |
|
20 #define FQ_CODEL_H |
|
21 |
|
22 #include <map> |
|
23 #include "ns3/random-variable.h" |
|
24 #include "ns3/linux-list.h" |
|
25 #include "ns3/boolean.h" |
|
26 #include "ns3/packet.h" |
|
27 #include "ns3/queue.h" |
|
28 #include "ns3/codel-queue.h" |
|
29 |
|
30 namespace ns3 { |
|
31 |
|
32 class TraceContainer; |
|
33 |
|
34 class Fq_CoDelSlot { |
|
35 public: |
|
36 friend class CoDelQueue; |
|
37 |
|
38 // static TypeId GetTypeId (void); |
|
39 Fq_CoDelSlot (); |
|
40 |
|
41 virtual ~Fq_CoDelSlot(); |
|
42 |
|
43 struct list_head flowchain; |
|
44 |
|
45 Ptr<CoDelQueue> q; |
|
46 int deficit; |
|
47 uint32_t backlog; |
|
48 int h; |
|
49 }; |
|
50 |
|
51 /** |
|
52 * \ingroup queue |
|
53 */ |
|
54 class Fq_CoDelQueue : public Queue { |
|
55 public: |
|
56 static TypeId GetTypeId (void); |
|
57 /** |
|
58 * \brief Fq_CoDelQueue Constructor |
|
59 */ |
|
60 Fq_CoDelQueue (); |
|
61 |
|
62 virtual ~Fq_CoDelQueue(); |
|
63 |
|
64 private: |
|
65 virtual bool DoEnqueue (Ptr<Packet> p); |
|
66 virtual Ptr<Packet> DoDequeue (void); |
|
67 virtual Ptr<const Packet> DoPeek (void) const; |
|
68 |
|
69 std::size_t hash(Ptr<Packet> p); |
|
70 // only mutable so we can get a reference out of here in Peek() |
|
71 mutable std::map<int, Fq_CoDelSlot * > m_ht; |
|
72 mutable struct list_head m_new_flows; |
|
73 mutable struct list_head m_old_flows; |
|
74 uint32_t m_divisor; |
|
75 uint32_t m_buckets; |
|
76 uint32_t m_peturbInterval; |
|
77 bool m_headmode; |
|
78 mutable size_t pcounter; |
|
79 UniformVariable psource; |
|
80 mutable uint32_t peturbation; |
|
81 uint32_t m_quantum; |
|
82 uint32_t backlog; |
|
83 }; |
|
84 |
|
85 } // namespace ns3 |
|
86 |
|
87 #endif /* FQ_CODEL_H */ |
|