A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
service-flow-manager.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007,2008, 2009 INRIA, UDcast
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7
* Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
8
*/
9
10
#include "
service-flow-manager.h
"
11
12
#include "
bs-net-device.h
"
13
#include "
bs-uplink-scheduler.h
"
14
#include "
connection-manager.h
"
15
#include "
service-flow-record.h
"
16
#include "
service-flow.h
"
17
#include "
ss-manager.h
"
18
#include "
ss-net-device.h
"
19
#include "
ss-record.h
"
20
#include "
ss-scheduler.h
"
21
#include "
wimax-connection.h
"
22
#include "
wimax-net-device.h
"
23
24
#include "ns3/buffer.h"
25
#include "ns3/enum.h"
26
#include "ns3/log.h"
27
#include "ns3/node.h"
28
#include "ns3/packet.h"
29
#include "ns3/pointer.h"
30
#include "ns3/simulator.h"
31
32
#include <stdint.h>
33
34
namespace
ns3
35
{
36
37
NS_LOG_COMPONENT_DEFINE
(
"ServiceFlowManager"
);
38
39
NS_OBJECT_ENSURE_REGISTERED
(ServiceFlowManager);
40
41
TypeId
42
ServiceFlowManager::GetTypeId
()
43
{
44
static
TypeId
tid =
TypeId
(
"ns3::ServiceFlowManager"
).
SetParent
<
Object
>().SetGroupName(
"Wimax"
);
45
return
tid;
46
}
47
48
ServiceFlowManager::ServiceFlowManager
()
49
{
50
m_serviceFlows
=
new
std::vector<ServiceFlow*>;
51
}
52
53
ServiceFlowManager::~ServiceFlowManager
()
54
{
55
}
56
57
void
58
ServiceFlowManager::DoDispose
()
59
{
60
for
(
auto
iter =
m_serviceFlows
->begin(); iter !=
m_serviceFlows
->end(); ++iter)
61
{
62
delete
(*iter);
63
}
64
m_serviceFlows
->clear();
65
delete
m_serviceFlows
;
66
}
67
68
void
69
ServiceFlowManager::AddServiceFlow
(
ServiceFlow
* serviceFlow)
70
{
71
m_serviceFlows
->push_back(serviceFlow);
72
}
73
74
ServiceFlow
*
75
ServiceFlowManager::DoClassify
(
Ipv4Address
srcAddress,
76
Ipv4Address
dstAddress,
77
uint16_t srcPort,
78
uint16_t dstPort,
79
uint8_t proto,
80
ServiceFlow::Direction
dir
)
const
81
{
82
for
(
auto
iter =
m_serviceFlows
->begin(); iter !=
m_serviceFlows
->end(); ++iter)
83
{
84
if
((*iter)->GetDirection() ==
dir
)
85
{
86
if
((*iter)->CheckClassifierMatch(srcAddress, dstAddress, srcPort, dstPort, proto))
87
{
88
return
*iter;
89
}
90
}
91
}
92
return
nullptr
;
93
}
94
95
ServiceFlow
*
96
ServiceFlowManager::GetServiceFlow
(
uint32_t
sfid)
const
97
{
98
for
(
auto
iter =
m_serviceFlows
->begin(); iter !=
m_serviceFlows
->end(); ++iter)
99
{
100
if
((*iter)->GetSfid() == sfid)
101
{
102
return
*iter;
103
}
104
}
105
106
NS_LOG_DEBUG
(
"GetServiceFlow: service flow not found!"
);
107
return
nullptr
;
108
}
109
110
ServiceFlow
*
111
ServiceFlowManager::GetServiceFlow
(
Cid
cid)
const
112
{
113
for
(
auto
iter =
m_serviceFlows
->begin(); iter !=
m_serviceFlows
->end(); ++iter)
114
{
115
if
((*iter)->GetCid() == cid.
GetIdentifier
())
116
{
117
return
*iter;
118
}
119
}
120
121
NS_LOG_DEBUG
(
"GetServiceFlow: service flow not found!"
);
122
return
nullptr
;
123
}
124
125
std::vector<ServiceFlow*>
126
ServiceFlowManager::GetServiceFlows
(
ServiceFlow::SchedulingType
schedulingType)
const
127
{
128
std::vector<ServiceFlow*> tmpServiceFlows;
129
for
(
auto
iter =
m_serviceFlows
->begin(); iter !=
m_serviceFlows
->end(); ++iter)
130
{
131
if
(((*iter)->GetSchedulingType() == schedulingType) ||
132
(schedulingType ==
ServiceFlow::SF_TYPE_ALL
))
133
{
134
tmpServiceFlows.push_back(*iter);
135
}
136
}
137
return
tmpServiceFlows;
138
}
139
140
bool
141
ServiceFlowManager::AreServiceFlowsAllocated
()
142
{
143
return
AreServiceFlowsAllocated
(
m_serviceFlows
);
144
}
145
146
bool
147
ServiceFlowManager::AreServiceFlowsAllocated
(std::vector<ServiceFlow*>* serviceFlowVector)
148
{
149
return
AreServiceFlowsAllocated
(*serviceFlowVector);
150
}
151
152
bool
153
ServiceFlowManager::AreServiceFlowsAllocated
(std::vector<ServiceFlow*> serviceFlowVector)
154
{
155
for
(
auto
iter = serviceFlowVector.begin(); iter != serviceFlowVector.end(); ++iter)
156
{
157
if
(!(*iter)->GetIsEnabled())
158
{
159
return
false
;
160
}
161
}
162
return
true
;
163
}
164
165
ServiceFlow
*
166
ServiceFlowManager::GetNextServiceFlowToAllocate
()
167
{
168
for
(
auto
iter =
m_serviceFlows
->begin(); iter !=
m_serviceFlows
->end(); ++iter)
169
{
170
if
(!(*iter)->GetIsEnabled())
171
{
172
return
*iter;
173
}
174
}
175
return
nullptr
;
176
}
177
178
uint32_t
179
ServiceFlowManager::GetNrServiceFlows
()
const
180
{
181
return
m_serviceFlows
->size();
182
}
183
184
}
// namespace ns3
bs-net-device.h
bs-uplink-scheduler.h
ns3::Cid
Cid class.
Definition
cid.h:26
ns3::Cid::GetIdentifier
uint16_t GetIdentifier() const
Definition
cid.cc:34
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::ServiceFlow
This class implements service flows as described by the IEEE-802.16 standard.
Definition
service-flow.h:32
ns3::ServiceFlow::SchedulingType
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition
service-flow.h:51
ns3::ServiceFlow::SF_TYPE_ALL
@ SF_TYPE_ALL
Definition
service-flow.h:58
ns3::ServiceFlow::Direction
Direction
Direction enumeration.
Definition
service-flow.h:36
ns3::ServiceFlowManager::GetNextServiceFlowToAllocate
ServiceFlow * GetNextServiceFlowToAllocate()
Definition
service-flow-manager.cc:166
ns3::ServiceFlowManager::DoClassify
ServiceFlow * DoClassify(Ipv4Address SrcAddress, Ipv4Address DstAddress, uint16_t SrcPort, uint16_t DstPort, uint8_t Proto, ServiceFlow::Direction dir) const
Definition
service-flow-manager.cc:75
ns3::ServiceFlowManager::AddServiceFlow
void AddServiceFlow(ServiceFlow *serviceFlow)
Add service flow function.
Definition
service-flow-manager.cc:69
ns3::ServiceFlowManager::GetServiceFlow
ServiceFlow * GetServiceFlow(uint32_t sfid) const
Get service flow by flow id.
Definition
service-flow-manager.cc:96
ns3::ServiceFlowManager::GetServiceFlows
std::vector< ServiceFlow * > GetServiceFlows(ServiceFlow::SchedulingType schedulingType) const
Get service flows function.
Definition
service-flow-manager.cc:126
ns3::ServiceFlowManager::ServiceFlowManager
ServiceFlowManager()
Definition
service-flow-manager.cc:48
ns3::ServiceFlowManager::GetNrServiceFlows
uint32_t GetNrServiceFlows() const
Definition
service-flow-manager.cc:179
ns3::ServiceFlowManager::~ServiceFlowManager
~ServiceFlowManager() override
Definition
service-flow-manager.cc:53
ns3::ServiceFlowManager::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
service-flow-manager.cc:42
ns3::ServiceFlowManager::DoDispose
void DoDispose() override
Destructor implementation.
Definition
service-flow-manager.cc:58
ns3::ServiceFlowManager::AreServiceFlowsAllocated
bool AreServiceFlowsAllocated()
Definition
service-flow-manager.cc:141
ns3::ServiceFlowManager::m_serviceFlows
std::vector< ServiceFlow * > * m_serviceFlows
the service flows
Definition
service-flow-manager.h:119
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
connection-manager.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:257
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
service-flow-manager.h
service-flow-record.h
service-flow.h
ss-manager.h
ss-net-device.h
ss-record.h
ss-scheduler.h
dir
std::string dir
Definition
tcp-bbr-example.cc:57
wimax-connection.h
wimax-net-device.h
src
wimax
model
service-flow-manager.cc
Generated on Fri Nov 8 2024 13:59:09 for ns-3 by
1.11.0