21#include "ns3/buffer.h"
25#include "ns3/packet.h"
26#include "ns3/pointer.h"
27#include "ns3/simulator.h"
39 m_maxDsaRspRetries(100)
101std::vector<ServiceFlow*>
124 SSRecord* ssRecord = bs->GetSSManager()->GetSSRecord(cid);
125 if (ssRecord ==
nullptr)
127 NS_LOG_INFO(
"SS not registered with the BS CID:" << cid);
133 ssRecord->AddServiceFlow(serviceFlow);
135 bs->GetUplinkScheduler()->SetupServiceFlow(ssRecord, serviceFlow);
140 if (ssRecord->GetDsaRspRetries() == 0)
142 dsaRsp =
CreateDsaRsp(serviceFlow, ssRecord->GetSfTransactionId());
143 p->AddHeader(dsaRsp);
144 ssRecord->SetDsaRsp(dsaRsp);
150 p->AddHeader(ssRecord->GetDsaRsp());
154 NS_LOG_DEBUG(
"Service flows could not be initialized!");
158 ssRecord->IncrementDsaRspRetries();
181 SSRecord* ssRecord = bs->GetSSManager()->GetSSRecord(cid);
183 NS_LOG_INFO(
"BsServiceFlowManager: Processing DSA-REQ...");
184 if (ssRecord->GetSfTransactionId() != 0)
189 "Error while processing DSA request:the received transaction ID is not expected");
197 transportConnection = BsConManager->CreateConnection(
Cid::TRANSPORT);
199 transportConnection->SetServiceFlow(serviceFlow);
206 NS_LOG_INFO(
"BsServiceFlowManager: Creating a new Service flow: SFID = "
207 << serviceFlow->
GetSfid() <<
" CID = " << serviceFlow->
GetCid());
216 serviceFlow->CopyParametersFrom(sf);
220 serviceFlow->SetConnection(multicastConnection);
222 serviceFlow->SetIsEnabled(
true);
224 serviceFlow->SetIsMulticast(
true);
225 serviceFlow->SetModulation(modulation);
226 bs->GetUplinkScheduler()->SetupServiceFlow(
nullptr, serviceFlow);
239 NS_LOG_INFO(
"No service Flow. Could not connect.");
247 SSRecord* ssRecord = bs->GetSSManager()->GetSSRecord(cid);
254 ssRecord->SetDsaRspRetries(0);
255 ssRecord->SetSfTransactionId(0);
260 ssRecord->SetAreServiceFlowsAllocated(
true);
ServiceFlow * GetServiceFlow(uint32_t sfid) const
uint8_t m_maxDsaRspRetries
maximum number of DSA response retries
void AllocateServiceFlows(const DsaReq &dsaReq, Cid cid)
allocate service flows
void DoDispose() override
Destructor implementation.
~BsServiceFlowManager() override
Cid m_inuseScheduleDsaRspCid
in use schedule DSA response CID
void AddMulticastServiceFlow(ServiceFlow sf, WimaxPhy::ModulationType modulation)
add a multicast service flow
Ptr< WimaxNetDevice > m_device
the device
void ScheduleDsaRsp(ServiceFlow *serviceFlow, Cid cid)
Create DSA response function.
@ CONFIRMATION_CODE_SUCCESS
void ProcessDsaAck(const DsaAck &dsaAck, Cid cid)
process a DSA-ACK message
std::vector< ServiceFlow * > GetServiceFlows(ServiceFlow::SchedulingType schedulingType) const
static TypeId GetTypeId()
Register this type.
void AddServiceFlow(ServiceFlow *serviceFlow)
Add a new service flow.
uint8_t GetMaxDsaRspRetries() const
void SetMaxDsaRspRetries(uint8_t maxDsaRspRetries)
set the maximum Dynamic ServiceFlow Add (DSA) retries
DsaRsp CreateDsaRsp(const ServiceFlow *serviceFlow, uint16_t transactionId)
Create DSA response function.
EventId m_dsaAckTimeoutEvent
DSA ack timeout event.
EventId GetDsaAckTimeoutEvent() const
BsServiceFlowManager(Ptr< BaseStationNetDevice > device)
Constructor.
uint32_t m_sfidIndex
SFID index.
ServiceFlow * ProcessDsaReq(const DsaReq &dsaReq, Cid cid)
process a DSA-Req message
static Cid InitialRanging()
This class implements the DSA-ACK message described by "IEEE Standard forLocal and metropolitan area ...
uint16_t GetTransactionId() const
Get transaction ID field.
This class implements the DSA-REQ message described by "IEEE Standard forLocal and metropolitan area ...
ServiceFlow GetServiceFlow() const
uint16_t GetTransactionId() const
This class implements the DSA-RSP message described by "IEEE Standard forLocal and metropolitan area ...
void SetConfirmationCode(uint16_t confirmationCode)
set the confirmation code
void SetServiceFlow(ServiceFlow sf)
specify a service flow to be requested by this message
void SetTransactionId(uint16_t transactionId)
set the transaction ID
An identifier for simulation events.
bool IsPending() const
This method is syntactic sugar for !IsExpired().
Mac Management messages Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43.
Smart pointer class similar to boost::intrusive_ptr.
This class is used by the base station to store some information related to subscriber station in the...
This class implements service flows as described by the IEEE-802.16 standard.
uint32_t GetSfid() const
Get SFID.
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
void SetConvergenceSublayerParam(CsParameters csparam)
Set convergence sublayer parameters.
uint16_t GetCid() const
Get CID.
void CopyParametersFrom(ServiceFlow sf)
Copy parameters from another service flow.
void SetUnsolicitedGrantInterval(uint16_t unsolicitedGrantInterval)
Set unsolicited grant interval.
void SetUnsolicitedPollingInterval(uint16_t unsolicitedPollingInterval)
Set unsolicited polling interval.
void SetType(Type type)
Set type of service flow.
Direction GetDirection() const
Get direction.
CsParameters GetConvergenceSublayerParam() const
Get convergence sublayer.
void SetIsEnabled(bool isEnabled)
Set is enabled flag.
The same service flow manager class serves both for BS and SS though some functions are exclusive to ...
void AddServiceFlow(ServiceFlow *serviceFlow)
Add service flow function.
ServiceFlow * GetServiceFlow(uint32_t sfid) const
Get service flow by flow id.
std::vector< ServiceFlow * > GetServiceFlows(ServiceFlow::SchedulingType schedulingType) const
Get service flows function.
void DoDispose() override
Destructor implementation.
bool AreServiceFlowsAllocated()
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
ModulationType
ModulationType enumeration.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.