QXmpp Version: 0.9.3
Loading...
Searching...
No Matches
QXmppRtcpPacket.h
1/*
2 * Copyright (C) 2008-2014 The QXmpp developers
3 *
4 * Author:
5 * Jeremy Lainé
6 *
7 * Source:
8 * https://github.com/qxmpp-project/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24#ifndef QXMPPRTCPPACKET_H
25#define QXMPPRTCPPACKET_H
26
27#include <QSharedDataPointer>
28
29#include "QXmppGlobal.h"
30
31class QXmppRtcpPacketPrivate;
32class QXmppRtcpReceiverReport;
33class QXmppRtcpReceiverReportPrivate;
34class QXmppRtcpSenderInfo;
35class QXmppRtcpSenderInfoPrivate;
36class QXmppRtcpSourceDescription;
37class QXmppRtcpSourceDescriptionPrivate;
38
42
43class QXMPP_EXPORT QXmppRtcpPacket
44{
45public:
46 enum Type {
47 SenderReport = 200,
48 ReceiverReport = 201,
49 SourceDescription = 202,
50 Goodbye = 203,
51 };
52
53 QXmppRtcpPacket();
54 QXmppRtcpPacket(const QXmppRtcpPacket &other);
55 ~QXmppRtcpPacket();
56
57 bool decode(const QByteArray &ba);
58 QByteArray encode() const;
59
60 bool read(QDataStream &stream);
61 void write(QDataStream &stream) const;
62
63 QString goodbyeReason() const;
64 void setGoodbyeReason(const QString &goodbyeReason);
65
66 QList<quint32> goodbyeSsrcs() const;
67 void setGoodbyeSsrcs(const QList<quint32> &goodbyeSsrcs);
68
69 QList<QXmppRtcpReceiverReport> receiverReports() const;
70 void setReceiverReports(const QList<QXmppRtcpReceiverReport> &reports);
71
72 QXmppRtcpSenderInfo senderInfo() const;
73 void setSenderInfo(const QXmppRtcpSenderInfo &senderInfo);
74
75 QList<QXmppRtcpSourceDescription> sourceDescriptions() const;
76 void setSourceDescriptions(const QList<QXmppRtcpSourceDescription> &descriptions);
77
78 quint32 ssrc() const;
79 void setSsrc(quint32 ssrc);
80
81 quint8 type() const;
82 void setType(quint8 type);
83
84private:
85 QSharedDataPointer<QXmppRtcpPacketPrivate> d;
86};
87
89
90class QXMPP_EXPORT QXmppRtcpReceiverReport
91{
92public:
93 QXmppRtcpReceiverReport();
94 QXmppRtcpReceiverReport(const QXmppRtcpReceiverReport &other);
95 ~QXmppRtcpReceiverReport();
96
97 quint32 dlsr() const;
98 void setDlsr(quint32 dlsr);
99
100 quint8 fractionLost() const;
101 void setFractionLost(quint8 fractionLost);
102
103 quint32 jitter() const;
104 void setJitter(quint32 jitter);
105
106 quint32 lsr() const;
107 void setLsr(quint32 lsr);
108
109 quint32 ssrc() const;
110 void setSsrc(quint32 ssrc);
111
112 quint32 totalLost() const;
113 void setTotalLost(quint32 totalLost);
114
115private:
116 friend class QXmppRtcpPacket;
117 QSharedDataPointer<QXmppRtcpReceiverReportPrivate> d;
118};
119
121
122class QXMPP_EXPORT QXmppRtcpSenderInfo
123{
124public:
125 QXmppRtcpSenderInfo();
126 QXmppRtcpSenderInfo(const QXmppRtcpSenderInfo &other);
127 ~QXmppRtcpSenderInfo();
128
129 quint64 ntpStamp() const;
130 void setNtpStamp(quint64 ntpStamp);
131
132 quint32 rtpStamp() const;
133 void setRtpStamp(quint32 rtpStamp);
134
135 quint32 octetCount() const;
136 void setOctetCount(quint32 count);
137
138 quint32 packetCount() const;
139 void setPacketCount(quint32 count);
140
141private:
142 friend class QXmppRtcpPacket;
143 QSharedDataPointer<QXmppRtcpSenderInfoPrivate> d;
144};
145
147
148class QXMPP_EXPORT QXmppRtcpSourceDescription
149{
150public:
151 QXmppRtcpSourceDescription();
152 QXmppRtcpSourceDescription(const QXmppRtcpSourceDescription &other);
153 ~QXmppRtcpSourceDescription();
154
155 QString cname() const;
156 void setCname(const QString &name);
157
158 QString name() const;
159 void setName(const QString &name);
160
161 quint32 ssrc() const;
162 void setSsrc(const quint32 ssrc);
163
164private:
165 friend class QXmppRtcpPacket;
166 QSharedDataPointer<QXmppRtcpSourceDescriptionPrivate> d;
167};
168
169#endif