5G-LENA nr-v4.0
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
traffic-generator-ngmn-voip.h
1// Copyright (c) 2022 CTTC
2// Copyright (c) 2023 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3//
4// SPDX-License-Identifier: GPL-2.0-only
5
6#ifndef TRAFFIC_GENERATOR_NGMN_VOIP
7#define TRAFFIC_GENERATOR_NGMN_VOIP
8
9#include "traffic-generator.h"
10
11#include "ns3/random-variable-stream.h"
12
13namespace ns3
14{
15
16class Address;
17class Socket;
18
44{
45 public:
50 static TypeId GetTypeId();
51
53
55
56 enum VoipState
57 {
58 INACTIVE_STATE,
59 ACTIVE_STATE
60 };
61
70 int64_t AssignStreams(int64_t stream) override;
71
72 protected:
73 void DoDispose() override;
74 void DoInitialize() override;
75
76 private:
77 /*
78 * @brief Inherited from Application base class.
79 * In its implementation it calculates the transition probabilities between
80 * active and inactive VOIP states
81 * // Called at time specified by Start by the DoInitialize method
82 */
83 void StartApplication() override;
84 void StopApplication() override;
85
86 /*
87 * @brief Updates the model state (ACTIVE/INACTIVE).
88 * The model is assumed updated at the speech encoder frame rate R=1/T,
89 * where T is the encoder frame duration (typically, 20ms)
90 */
91 void UpdateState();
92
96 void GenerateNextPacketBurstSize() override;
97
102 uint32_t GetNextPacketSize() const override;
103
108 Time GetNextPacketTime() const override;
109
110 Ptr<UniformRandomVariable> m_fromActiveToInactive;
111 Ptr<UniformRandomVariable> m_fromInactiveToActive;
112
113 uint32_t m_encoderFrameLength{0};
114 uint32_t m_meanTalkSpurtDuration{0};
115 double m_voiceActivityFactor{0.0};
116 uint32_t m_activePayload{0};
117 uint32_t m_SIDPeriodicity{0};
118 uint32_t m_SIDPayload{0};
119 VoipState m_state{INACTIVE_STATE};
120 EventId m_updateState;
121 double m_a{0.0};
122 double m_c{0.0};
123};
124
125} // namespace ns3
126
127#endif /* TRAFFIC_GENERATOR_NGMN_VOIP */
int64_t AssignStreams(int64_t stream) override
static TypeId GetTypeId()
Get the type ID.