QXmpp Version: 1.4.0
Loading...
Searching...
No Matches
QXmppJingleIq.h
1/*
2 * Copyright (C) 2008-2021 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 QXMPPJINGLEIQ_H
25#define QXMPPJINGLEIQ_H
26
27#include "QXmppIq.h"
28
29#include <QHostAddress>
30
31class QXmppJingleCandidatePrivate;
32class QXmppJingleIqContentPrivate;
33class QXmppJingleIqPrivate;
34class QXmppJinglePayloadTypePrivate;
35
39
40class QXMPP_EXPORT QXmppJinglePayloadType
41{
42public:
46
47 unsigned char channels() const;
48 void setChannels(unsigned char channels);
49
50 unsigned int clockrate() const;
51 void setClockrate(unsigned int clockrate);
52
53 unsigned char id() const;
54 void setId(unsigned char id);
55
56 unsigned int maxptime() const;
57 void setMaxptime(unsigned int maxptime);
58
59 QString name() const;
60 void setName(const QString &name);
61
62 QMap<QString, QString> parameters() const;
63 void setParameters(const QMap<QString, QString> &parameters);
64
65 unsigned int ptime() const;
66 void setPtime(unsigned int ptime);
67
69 void parse(const QDomElement &element);
70 void toXml(QXmlStreamWriter *writer) const;
72
73 QXmppJinglePayloadType &operator=(const QXmppJinglePayloadType &other);
74 bool operator==(const QXmppJinglePayloadType &other) const;
75
76private:
77 QSharedDataPointer<QXmppJinglePayloadTypePrivate> d;
78};
79
83
84class QXMPP_EXPORT QXmppJingleCandidate
85{
86public:
88 enum Type {
90 PeerReflexiveType,
92 ServerReflexiveType,
94 RelayedType
96 };
97
101
102 QXmppJingleCandidate &operator=(const QXmppJingleCandidate &other);
103
104 int component() const;
105 void setComponent(int component);
106
107 QString foundation() const;
108 void setFoundation(const QString &foundation);
109
110 int generation() const;
111 void setGeneration(int generation);
112
113 QHostAddress host() const;
114 void setHost(const QHostAddress &host);
115
116 QString id() const;
117 void setId(const QString &id);
118
119 int network() const;
120 void setNetwork(int network);
121
122 quint16 port() const;
123 void setPort(quint16 port);
124
125 int priority() const;
126 void setPriority(int priority);
127
128 QString protocol() const;
129 void setProtocol(const QString &protocol);
130
131 QXmppJingleCandidate::Type type() const;
132 void setType(QXmppJingleCandidate::Type);
133
134 bool isNull() const;
135
137 void parse(const QDomElement &element);
138 void toXml(QXmlStreamWriter *writer) const;
139
140 static QXmppJingleCandidate::Type typeFromString(const QString &typeStr, bool *ok = nullptr);
141 static QString typeToString(QXmppJingleCandidate::Type type);
143
144private:
145 QSharedDataPointer<QXmppJingleCandidatePrivate> d;
146};
147
152
153class QXMPP_EXPORT QXmppJingleIq : public QXmppIq
154{
155public:
157 enum Action {
158 ContentAccept,
159 ContentAdd,
160 ContentModify,
161 ContentReject,
162 ContentRemove,
163 DescriptionInfo,
164 SecurityInfo,
165 SessionAccept,
166 SessionInfo,
167 SessionInitiate,
168 SessionTerminate,
169 TransportAccept,
170 TransportInfo,
171 TransportReject,
172 TransportReplace
173 };
174
179
180 class QXMPP_EXPORT Content
181 {
182 public:
183 Content();
184 Content(const QXmppJingleIq::Content &other);
185 ~Content();
186
187 Content &operator=(const Content &other);
188
189 QString creator() const;
190 void setCreator(const QString &creator);
191
192 QString name() const;
193 void setName(const QString &name);
194
195 QString senders() const;
196 void setSenders(const QString &senders);
197
198 // XEP-0167: Jingle RTP Sessions
199 QString descriptionMedia() const;
200 void setDescriptionMedia(const QString &media);
201
202 quint32 descriptionSsrc() const;
203 void setDescriptionSsrc(quint32 ssrc);
204
205 void addPayloadType(const QXmppJinglePayloadType &payload);
206 QList<QXmppJinglePayloadType> payloadTypes() const;
207 void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
208
209 void addTransportCandidate(const QXmppJingleCandidate &candidate);
210 QList<QXmppJingleCandidate> transportCandidates() const;
211 void setTransportCandidates(const QList<QXmppJingleCandidate> &candidates);
212
213 QString transportUser() const;
214 void setTransportUser(const QString &user);
215
216 QString transportPassword() const;
217 void setTransportPassword(const QString &password);
218
219 // XEP-0320: Use of DTLS-SRTP in Jingle Sessions
220 QByteArray transportFingerprint() const;
221 void setTransportFingerprint(const QByteArray &fingerprint);
222
223 QString transportFingerprintHash() const;
224 void setTransportFingerprintHash(const QString &hash);
225
226 QString transportFingerprintSetup() const;
227 void setTransportFingerprintSetup(const QString &setup);
228
230 void parse(const QDomElement &element);
231 void toXml(QXmlStreamWriter *writer) const;
232
233 bool parseSdp(const QString &sdp);
234 QString toSdp() const;
236
237 private:
238 QSharedDataPointer<QXmppJingleIqContentPrivate> d;
239 };
240
245
246 class QXMPP_EXPORT Reason
247 {
248 public:
250 enum Type {
251 None,
252 AlternativeSession,
253 Busy,
254 Cancel,
255 ConnectivityError,
256 Decline,
257 Expired,
258 FailedApplication,
259 FailedTransport,
260 GeneralError,
261 Gone,
262 IncompatibleParameters,
263 MediaError,
264 SecurityError,
265 Success,
266 Timeout,
267 UnsupportedApplications,
268 UnsupportedTransports
269 };
270
271 Reason();
272
273 QString text() const;
274 void setText(const QString &text);
275
276 Type type() const;
277 void setType(Type type);
278
280 void parse(const QDomElement &element);
281 void toXml(QXmlStreamWriter *writer) const;
283
284 private:
285 QString m_text;
286 Type m_type;
287 };
288
290 QXmppJingleIq(const QXmppJingleIq &other);
291 ~QXmppJingleIq() override;
292
293 QXmppJingleIq &operator=(const QXmppJingleIq &other);
294
295 Action action() const;
296 void setAction(Action action);
297
298 void addContent(const Content &content);
299 QList<Content> contents() const;
300 void setContents(const QList<Content> &contents);
301
302 QString initiator() const;
303 void setInitiator(const QString &initiator);
304
305 Reason &reason();
306 const Reason &reason() const;
307
308 QString responder() const;
309 void setResponder(const QString &responder);
310
311 // XEP-0167: Jingle RTP Sessions
312 bool ringing() const;
313 void setRinging(bool ringing);
314
315 QString sid() const;
316 void setSid(const QString &sid);
317
319 static bool isJingleIq(const QDomElement &element);
321
322protected:
324 void parseElementFromChild(const QDomElement &element) override;
325 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
327
328private:
329 QSharedDataPointer<QXmppJingleIqPrivate> d;
330};
331
332#endif
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42
The QXmppJingleCandidate class represents a transport candidate as specified by XEP-0176: Jingle ICE-...
Definition: QXmppJingleIq.h:85
Type
This enum is used to describe a candidate's type.
Definition: QXmppJingleIq.h:88
@ HostType
Host candidate, a local address/port.
Definition: QXmppJingleIq.h:89
The QXmppJingleIq class represents an IQ used for initiating media sessions as specified by XEP-0166:...
Definition: QXmppJingleIq.h:154
Action
This enum is used to describe a Jingle action.
Definition: QXmppJingleIq.h:157
The QXmppJinglePayloadType class represents a payload type as specified by XEP-0167: Jingle RTP Sessi...
Definition: QXmppJingleIq.h:41