forked from cisco/ns3-rmcat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrmcat-sender.h
97 lines (80 loc) · 3.04 KB
/
rmcat-sender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/******************************************************************************
* Copyright 2016-2017 Cisco Systems, Inc. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
******************************************************************************/
/**
* @file
* Sender application interface for rmcat ns3 module.
*
* @version 0.1.1
* @author Jiantao Fu
* @author Sergio Mena
* @author Xiaoqing Zhu
*/
#ifndef RMCAT_SENDER_H
#define RMCAT_SENDER_H
#include "rmcat-constants.h"
#include "ns3/syncodecs.h"
#include "ns3/sender-based-controller.h"
#include "ns3/socket.h"
#include "ns3/application.h"
#include <memory>
namespace ns3 {
class RmcatSender: public Application
{
public:
RmcatSender ();
virtual ~RmcatSender ();
void PauseResume (bool pause);
void SetCodec (std::shared_ptr<syncodecs::Codec> codec);
void SetCodecType (SyncodecType codecType);
void SetController (std::shared_ptr<rmcat::SenderBasedController> controller);
void SetRinit (float Rinit);
void SetRmin (float Rmin);
void SetRmax (float Rmax);
void Setup (Ipv4Address dest_ip, uint16_t dest_port);
private:
virtual void StartApplication ();
virtual void StopApplication ();
void EnqueuePacket ();
void SendPacket (uint64_t usSlept);
void SendOverSleep (uint32_t bytesToSend);
void RecvPacket (Ptr<Socket> socket);
void CalcBufferParams (uint64_t nowUs);
private:
std::shared_ptr<syncodecs::Codec> m_codec;
std::shared_ptr<rmcat::SenderBasedController> m_controller;
Ipv4Address m_destIP;
uint16_t m_destPort;
float m_initBw;
float m_minBw;
float m_maxBw;
bool m_paused;
uint32_t m_ssrc;
uint16_t m_sequence;
uint32_t m_rtpTsOffset;
Ptr<Socket> m_socket;
EventId m_enqueueEvent;
EventId m_sendEvent;
EventId m_sendOversleepEvent;
float m_fps; // frames-per-second
double m_rVin; //bps
double m_rSend; //bps
std::deque<uint32_t> m_rateShapingBuf;
uint32_t m_rateShapingBytes;
uint64_t m_nextSendTstmpUs;
};
}
#endif /* RMCAT_SENDER_H */