Loading...
Searching...
No Matches
satellite-request-manager.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd.
4 * Copyright (c) 2018 CNES
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Author: Jani Puttonen <jani.puttonen@magister.fi>
20 * Author: Mathias Ettinger <mettinger@toulouse.viveris.com>
21 */
22
23#ifndef SATELLITE_REQUEST_MANAGER_H_
24#define SATELLITE_REQUEST_MANAGER_H_
25
27#include "satellite-enums.h"
29#include "satellite-node-info.h"
30#include "satellite-queue.h"
31
32#include "ns3/callback.h"
33#include "ns3/object.h"
34
35#include <deque>
36#include <map>
37#include <stdint.h>
38#include <string>
39#include <utility>
40#include <vector>
41
42namespace ns3
43{
44
53class SatRequestManager : public Object
54{
55 public:
60
64 virtual ~SatRequestManager();
65
66 void Initialize(Ptr<SatLowerLayerServiceConf> llsConf, Time superFrameDuration);
67
71 static TypeId GetTypeId(void);
72
76 virtual void DoDispose();
77
81 typedef Callback<SatQueue::QueueStats_t, bool> QueueCallback;
82
89 typedef Callback<bool, Ptr<SatControlMessage>, const Address&> SendCtrlCallback;
90
95 typedef Callback<bool> CtrlMsgTxPossibleCallback;
96
101 typedef Callback<bool> LogonMsgTxPossibleCallback;
102
106 typedef std::vector<std::deque<std::pair<Time, uint32_t>>> PendingRbdcRequestsContainer_t;
107
113 void ReceiveQueueEvent(SatQueue::QueueEvent_t event, uint8_t rcIndex);
114
120 void AddQueueCallback(uint8_t rcIndex, SatRequestManager::QueueCallback cb);
121
127
134
141
146 void SetGwAddress(Mac48Address address);
147
152 void SetNodeInfo(Ptr<SatNodeInfo> nodeInfo);
153
168 void CnoUpdated(uint32_t satId,
169 uint32_t beamId,
170 Address sourceMac,
171 Address gwId,
172 double cno,
173 bool isSatelliteMac);
174
181 void AssignedDaResources(uint8_t rcIndex, uint32_t bytes);
182
189 typedef void (*CapacityRequestTraceCallback)(Time time,
190 Mac48Address address,
191 Ptr<SatCrMessage> message);
192
205 typedef void (*CapacityRequestTraceLogCallback)(std::string traceLog);
206
211 typedef void (*RbdcTraceCallback)(uint32_t requestSize);
212
217 typedef void (*VbdcTraceCallback)(uint32_t requestSize);
218
223 typedef void (*AvbdcTraceCallback)(uint32_t requestSize);
224
230 void SendHandoverRecommendation(uint32_t satId, uint32_t beamId);
231
235 void SendLogonMessage();
236
241 void SetHeaderOffsetVbdc(double headerOffsetVbcd);
242
243 private:
244 typedef std::map<uint8_t, QueueCallback> CallbackContainer_t;
245
251
256 void DoEvaluation();
257
264 uint32_t DoRbdc(uint8_t rc, const SatQueue::QueueStats_t& stats);
265
272 uint32_t DoRbdcLegacy(uint8_t rc, const SatQueue::QueueStats_t& stats);
273
282 const SatQueue::QueueStats_t& stats,
283 uint32_t& rcVbdcBytes);
284
293 const SatQueue::QueueStats_t& stats,
294 uint32_t& rcVbdcBytes);
295
302 uint32_t GetVbdcBytes(uint8_t rc, const SatQueue::QueueStats_t& stats);
303
310 uint32_t GetAvbdcBytes(uint8_t rc, const SatQueue::QueueStats_t& stats);
311
317
323 uint32_t GetPendingRbdcSumKbps(uint8_t rc);
324
330 void UpdatePendingRbdcCounters(uint8_t rc, uint32_t kbps);
331
337
342
347 void UpdatePendingVbdcCounters(uint8_t rc);
348
354 void SendCapacityRequest(Ptr<SatCrMessage> crMsg);
355
359 void SendCnoReport();
360
365
370 void Reset(uint8_t rc);
371
380 uint16_t GetQuantizedRbdcValue(uint8_t index, uint16_t reqRbdcKbps) const;
381
390 uint16_t GetQuantizedVbdcValue(uint8_t index, uint16_t reqVbdcBytes) const;
391
396
401
407
413
417 Mac48Address m_gwAddress;
418
422 Mac48Address m_satAddress;
423
428 double m_lastCno;
429
435
440 Ptr<SatLowerLayerServiceConf> m_llsConf;
441
446
451
456
461
467
474
479
486
490 std::vector<uint32_t> m_pendingVbdcBytes;
491
495 std::vector<Time> m_previousEvaluationTime;
496
500 Ptr<SatNodeInfo> m_nodeInfo;
501
505 std::vector<uint32_t> m_assignedDaResourcesBytes;
506
511
516
523
524 uint32_t m_numValues;
525 static const uint32_t m_rbdcScalingFactors[4];
526 static const uint32_t m_vbdcScalingFactors[4];
527
531 TracedCallback<Time, Mac48Address, Ptr<SatCrMessage>> m_crTrace;
532
536 TracedCallback<std::string> m_crTraceLog;
537
544 TracedCallback<uint32_t> m_rbdcTrace;
545 TracedCallback<uint32_t> m_vbdcTrace;
546 TracedCallback<uint32_t> m_aVbdcTrace;
547
552
557
563};
564
565} // namespace ns3
566
567#endif /* SATELLITE_REQUEST_MANAGER_H_ */
SatCapacityAllocationCategory_t
Definition for different types of Capacity Request (CR) messages.
Time m_superFrameDuration
Superframe duration used for updating the volume backlog persistence.
double m_overEstimationFactor
Over-estimation factor used for estimating a bit more resources than there are in the buffers.
SatEnums::RbdcCapacityRequestAlgorithm_t m_rbdcCapacityRequestAlgorithm
The RBDC capacity algorithm to use.
void(* CapacityRequestTraceCallback)(Time time, Mac48Address address, Ptr< SatCrMessage > message)
Callback signature for CrTrace trace source.
void(* AvbdcTraceCallback)(uint32_t requestSize)
Callback signature for AvbdcTrace trace source.
SatEnums::SatCapacityAllocationCategory_t DoVbdcLegacy(uint8_t rc, const SatQueue::QueueStats_t &stats, uint32_t &rcVbdcBytes)
Legacy algorithm to do VBDC calculation for a RC.
void Reset(uint8_t rc)
Reset RC index counters.
SendCtrlCallback m_ctrlCallback
Callback to send control messages.
PendingRbdcRequestsContainer_t m_pendingRbdcRequestsKbps
Key = RC index Value -> Key = Time when the request was sent Value -> Value = Requested bitrate or by...
void AssignedDaResources(uint8_t rcIndex, uint32_t bytes)
Sat UT MAC informs that certain amount of resources have been received in TBTP.
TracedCallback< uint32_t > m_aVbdcTrace
double m_lastSatelliteCno
The last received user link C/N0 information from lower layer in linear format.
void SetLogonMsgTxPossibleCallback(SatRequestManager::LogonMsgTxPossibleCallback cb)
Set the callback to check the possibility of sending a control message.
TracedCallback< std::string > m_crTraceLog
Trace callback used for CR tracing.
void SendLogonMessage()
Send a logon message to the gateway.
Ptr< SatLowerLayerServiceConf > m_llsConf
Lower layer services conf pointer, which holds the configurations for RCs and capacity allocation cat...
static TypeId GetTypeId(void)
inherited from Object
void ReceiveQueueEvent(SatQueue::QueueEvent_t event, uint8_t rcIndex)
Receive a queue event.
void RemoveOldEntriesFromPendingRbdcContainer(uint8_t rc)
Clean-up the pending RBDC container from old samples.
void Initialize(Ptr< SatLowerLayerServiceConf > llsConf, Time superFrameDuration)
Mac48Address m_gwAddress
GW address.
uint32_t GetVbdcBytes(uint8_t rc, const SatQueue::QueueStats_t &stats)
Calculate the needed VBDC bytes for a RC.
LogonMsgTxPossibleCallback m_logonMsgTxPossibleCallback
Callback to check from MAC if a logon msg may be transmitted in the near future.
uint16_t GetQuantizedRbdcValue(uint8_t index, uint16_t reqRbdcKbps) const
The RBDC value is signalled with 8 bits, which means that to be able to signal larger than 256 values...
void UpdatePendingRbdcCounters(uint8_t rc, uint32_t kbps)
Update the pending RBDC counters with new request information.
Callback< SatQueue::QueueStats_t, bool > QueueCallback
Callback to fetch queue statistics.
void(* VbdcTraceCallback)(uint32_t requestSize)
Callback signature for VbdcTrace trace source.
SatEnums::VbdcCapacityRequestAlgorithm_t m_vbdcCapacityRequestAlgorithm
The VBDC capacity algorithm to use.
void UpdatePendingVbdcCounters()
Update pending VBDC counters for all RCs.
Ptr< SatNodeInfo > m_nodeInfo
Node information.
virtual ~SatRequestManager()
Destructor for SatRequestManager.
uint32_t GetPendingRbdcSumKbps(uint8_t rc)
Calculate the pending RBDC requests related to a specific RC.
Callback< bool > CtrlMsgTxPossibleCallback
Callback to check whether control msg transmission is possible.
void DoPeriodicalEvaluation()
Periodically check the buffer status and whether a new CR is needed to be sent.
void SetCtrlMsgTxPossibleCallback(SatRequestManager::CtrlMsgTxPossibleCallback cb)
Set the callback to check the possibility of sending a control message.
SatEnums::SatCapacityAllocationCategory_t DoVbdc(uint8_t rc, const SatQueue::QueueStats_t &stats, uint32_t &rcVbdcBytes)
Do VBDC calculation for a RC.
static const uint32_t m_rbdcScalingFactors[4]
std::vector< uint32_t > m_pendingVbdcBytes
Pending VBDC counter for each RC index.
Mac48Address m_satAddress
SAT address.
void SetNodeInfo(Ptr< SatNodeInfo > nodeInfo)
Set the node info of this UT.
virtual void DoDispose()
Dispose of this class instance.
TracedCallback< uint32_t > m_rbdcTrace
Traced callbacks for all sent RBDC and VBDC capacity requests.
void SendCnoReport()
Send the C/N0 report message via txCallback to SatNetDevice.
void(* CapacityRequestTraceLogCallback)(std::string traceLog)
Callback signature for CrLogTrace trace source.
void ResetAssignedResources()
Reset the assigned resources counter.
uint32_t GetAvbdcBytes(uint8_t rc, const SatQueue::QueueStats_t &stats)
Calculate the needed AVBDC bytes for a RC.
uint16_t GetQuantizedVbdcValue(uint8_t index, uint16_t reqVbdcBytes) const
The RBDC value is signalled with 8 bits, which means that to be able to signal larger than 256 values...
double m_gainValueK
Gain value K for the RBDC calculation.
Callback< bool, Ptr< SatControlMessage >, const Address & > SendCtrlCallback
Control message sending callback.
void DoEvaluation()
Do evaluation of the buffer status and decide whether or not to send CRs.
uint32_t DoRbdcLegacy(uint8_t rc, const SatQueue::QueueStats_t &stats)
Legacy algorithm to do RBDC calculation for a RC.
void AddQueueCallback(uint8_t rcIndex, SatRequestManager::QueueCallback cb)
Add a callback to fetch queue statistics.
EventId m_cnoReportEvent
Event id for the C/NO report.
uint32_t DoRbdc(uint8_t rc, const SatQueue::QueueStats_t &stats)
Do RBDC calculation for a RC.
static const uint32_t m_vbdcScalingFactors[4]
Time m_rttEstimate
Round trip time estimate.
TracedCallback< Time, Mac48Address, Ptr< SatCrMessage > > m_crTrace
Trace callback used for CR tracing.
std::vector< std::deque< std::pair< Time, uint32_t > > > PendingRbdcRequestsContainer_t
Container for the pending RBDC requests.
TracedCallback< uint32_t > m_vbdcTrace
std::vector< uint32_t > m_assignedDaResourcesBytes
Dedicated assignments received within the previous superframe.
Time m_lastVbdcCrSent
Time when the last CR including VBDC request was sent.
double m_lastCno
The last received on E2E C/N0 information from lower layer in linear format.
Time m_cnoReportInterval
Interval to send C/N0 report.
void(* RbdcTraceCallback)(uint32_t requestSize)
Callback signature for RbdcTrace trace source.
void SetGwAddress(Mac48Address address)
Set the GW address needed for CR transmission.
bool m_forcedAvbdcUpdate
Flag indicating that UT should send a forced AVBDC request, since the volume backlog persistence shal...
void SendCapacityRequest(Ptr< SatCrMessage > crMsg)
Send the capacity request control msg via txCallback to SatNetDevice.
Time m_evaluationInterval
Interval to do the periodical CR evaluation.
double m_headerOffsetVbcd
Additional VBDC to add to take into account E2E header in regenerative LINK or NETWORK,...
bool m_enableOnDemandEvaluation
Enable on demand / ad hoc CR evaluation.
void CheckForVolumeBacklogPersistence()
Check whether VBDC volume backlog persistence shall expire and whether UT should update request by AV...
void SetHeaderOffsetVbdc(double headerOffsetVbcd)
Update the value of header offset.
CtrlMsgTxPossibleCallback m_ctrlMsgTxPossibleCallback
Callback to check from MAC if a control msg may be transmitted in the near future.
SatRequestManager()
Default constructor.
void CnoUpdated(uint32_t satId, uint32_t beamId, Address sourceMac, Address gwId, double cno, bool isSatelliteMac)
Update C/N0 information from lower layer.
void SetCtrlMsgCallback(SatRequestManager::SendCtrlCallback cb)
Set the control message sending callback.
CallbackContainer_t m_queueCallbacks
The queue enque/deque rate getter callback.
void SendHandoverRecommendation(uint32_t satId, uint32_t beamId)
Send a handover recommendation message to the gateway.
std::map< uint8_t, QueueCallback > CallbackContainer_t
std::vector< Time > m_previousEvaluationTime
Time when CR evaluation was previously done.
Callback< bool > LogonMsgTxPossibleCallback
Callback to check whether logon msg transmission is possible.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
QueueStats_t definition for passing queue related statistics to any interested modules.