Loading...
Searching...
No Matches
QXmppJingleData.h
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
// SPDX-FileCopyrightText: 2023 Tibor Csötönyi <work@taibsu.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPJINGLEIQ_H
#define QXMPPJINGLEIQ_H
#include "QXmppIq.h"
#include <variant>
#include <QHostAddress>
class QXmppJingleCandidatePrivate;
class QXmppJingleDescriptionPrivate;
class QXmppJingleIqContentPrivate;
class QXmppJingleIqReasonPrivate;
class QXmppJingleIqPrivate;
class QXmppJinglePayloadTypePrivate;
class QXmppJingleRtpCryptoElementPrivate;
class QXmppJingleRtpEncryptionPrivate;
class QXmppJingleRtpFeedbackPropertyPrivate;
class QXmppJingleRtpHeaderExtensionPropertyPrivate;
class QXmppSdpParameterPrivate;
class QXmppJingleMessageInitiationElementPrivate;
class QXmppCallInviteElementPrivate;
class QXMPP_EXPORT QXmppSdpParameter
{
public:
QXmppSdpParameter();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppSdpParameter)
QString name() const;
void setName(const QString &name);
QString value() const;
void setValue(const QString &value);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isSdpParameter(const QDomElement &element);
private:
QSharedDataPointer<QXmppSdpParameterPrivate> d;
};
class QXMPP_EXPORT QXmppJingleRtpCryptoElement
{
public:
QXmppJingleRtpCryptoElement();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpCryptoElement)
uint32_t tag() const;
void setTag(uint32_t tag);
QString cryptoSuite() const;
void setCryptoSuite(const QString &cryptoSuite);
QString keyParams() const;
void setKeyParams(const QString &keyParams);
QString sessionParams() const;
void setSessionParams(const QString &sessionParams);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isJingleRtpCryptoElement(const QDomElement &element);
private:
QSharedDataPointer<QXmppJingleRtpCryptoElementPrivate> d;
};
class QXMPP_EXPORT QXmppJingleRtpEncryption
{
public:
QXmppJingleRtpEncryption();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpEncryption)
bool isRequired() const;
void setRequired(bool isRequired);
QVector<QXmppJingleRtpCryptoElement> cryptoElements() const;
void setCryptoElements(const QVector<QXmppJingleRtpCryptoElement> &cryptoElements);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isJingleRtpEncryption(const QDomElement &element);
private:
QSharedDataPointer<QXmppJingleRtpEncryptionPrivate> d;
};
class QXMPP_EXPORT QXmppJingleRtpFeedbackProperty
{
public:
QXmppJingleRtpFeedbackProperty();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpFeedbackProperty)
QString type() const;
void setType(const QString &type);
QString subtype() const;
void setSubtype(const QString &subtype);
QVector<QXmppSdpParameter> parameters() const;
void setParameters(const QVector<QXmppSdpParameter> &parameters);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isJingleRtpFeedbackProperty(const QDomElement &element);
private:
QSharedDataPointer<QXmppJingleRtpFeedbackPropertyPrivate> d;
};
class QXMPP_EXPORT QXmppJingleRtpFeedbackInterval
{
public:
QXmppJingleRtpFeedbackInterval();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpFeedbackInterval)
uint64_t value() const;
void setValue(uint64_t value);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isJingleRtpFeedbackInterval(const QDomElement &element);
private:
uint64_t m_value;
};
class QXMPP_EXPORT QXmppJingleRtpHeaderExtensionProperty
{
public:
enum Senders {
Both,
Initiator,
Responder
};
QXmppJingleRtpHeaderExtensionProperty();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleRtpHeaderExtensionProperty)
uint32_t id() const;
void setId(uint32_t id);
QString uri() const;
void setUri(const QString &uri);
Senders senders() const;
void setSenders(Senders senders);
QVector<QXmppSdpParameter> parameters() const;
void setParameters(const QVector<QXmppSdpParameter> &parameters);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isJingleRtpHeaderExtensionProperty(const QDomElement &element);
private:
QSharedDataPointer<QXmppJingleRtpHeaderExtensionPropertyPrivate> d;
};
class QXMPP_EXPORT QXmppJinglePayloadType
{
public:
QXmppJinglePayloadType();
QXmppJinglePayloadType(const QXmppJinglePayloadType &other);
~QXmppJinglePayloadType();
unsigned char channels() const;
void setChannels(unsigned char channels);
unsigned int clockrate() const;
void setClockrate(unsigned int clockrate);
unsigned char id() const;
void setId(unsigned char id);
unsigned int maxptime() const;
void setMaxptime(unsigned int maxptime);
QString name() const;
void setName(const QString &name);
QMap<QString, QString> parameters() const;
void setParameters(const QMap<QString, QString> &parameters);
unsigned int ptime() const;
void setPtime(unsigned int ptime);
QVector<QXmppJingleRtpFeedbackProperty> rtpFeedbackProperties() const;
void setRtpFeedbackProperties(const QVector<QXmppJingleRtpFeedbackProperty> &rtpFeedbackProperties);
QVector<QXmppJingleRtpFeedbackInterval> rtpFeedbackIntervals() const;
void setRtpFeedbackIntervals(const QVector<QXmppJingleRtpFeedbackInterval> &rtpFeedbackIntervals);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
QXmppJinglePayloadType &operator=(const QXmppJinglePayloadType &other);
bool operator==(const QXmppJinglePayloadType &other) const;
private:
QSharedDataPointer<QXmppJinglePayloadTypePrivate> d;
};
class QXMPP_EXPORT QXmppJingleDescription
{
public:
QXmppJingleDescription();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleDescription)
QString media() const;
void setMedia(const QString &media);
quint32 ssrc() const;
void setSsrc(quint32 ssrc);
QString type() const;
void setType(const QString &type);
void addPayloadType(const QXmppJinglePayloadType &payload);
const QList<QXmppJinglePayloadType> &payloadTypes() const;
void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
private:
QSharedDataPointer<QXmppJingleDescriptionPrivate> d;
};
class QXMPP_EXPORT QXmppJingleCandidate
{
public:
enum Type {
HostType,
PeerReflexiveType,
ServerReflexiveType,
RelayedType
};
QXmppJingleCandidate();
QXmppJingleCandidate(const QXmppJingleCandidate &other);
QXmppJingleCandidate(QXmppJingleCandidate &&);
~QXmppJingleCandidate();
QXmppJingleCandidate &operator=(const QXmppJingleCandidate &other);
QXmppJingleCandidate &operator=(QXmppJingleCandidate &&);
int component() const;
void setComponent(int component);
QString foundation() const;
void setFoundation(const QString &foundation);
int generation() const;
void setGeneration(int generation);
QHostAddress host() const;
void setHost(const QHostAddress &host);
QString id() const;
void setId(const QString &id);
int network() const;
void setNetwork(int network);
quint16 port() const;
void setPort(quint16 port);
int priority() const;
void setPriority(int priority);
QString protocol() const;
void setProtocol(const QString &protocol);
QXmppJingleCandidate::Type type() const;
void setType(QXmppJingleCandidate::Type);
bool isNull() const;
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static QXmppJingleCandidate::Type typeFromString(const QString &typeStr, bool *ok = nullptr);
static QString typeToString(QXmppJingleCandidate::Type type);
private:
QSharedDataPointer<QXmppJingleCandidatePrivate> d;
};
class QXMPP_EXPORT QXmppJingleReason
{
public:
enum Type {
None,
AlternativeSession,
Busy,
Cancel,
ConnectivityError,
Decline,
Expired,
FailedApplication,
FailedTransport,
GeneralError,
Gone,
IncompatibleParameters,
MediaError,
SecurityError,
Success,
Timeout,
UnsupportedApplications,
UnsupportedTransports
};
enum RtpErrorCondition {
NoErrorCondition,
InvalidCrypto,
CryptoRequired
};
QXmppJingleReason();
QString text() const;
void setText(const QString &text);
Type type() const;
void setType(Type type);
RtpErrorCondition rtpErrorCondition() const;
void setRtpErrorCondition(RtpErrorCondition rtpErrorCondition);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleReason)
private:
QSharedDataPointer<QXmppJingleIqReasonPrivate> d;
};
class QXMPP_EXPORT QXmppJingleIq : public QXmppIq
{
public:
enum Action {
ContentAccept,
ContentAdd,
ContentModify,
ContentReject,
ContentRemove,
DescriptionInfo,
SecurityInfo,
SessionAccept,
SessionInfo,
SessionInitiate,
SessionTerminate,
TransportAccept,
TransportInfo,
TransportReject,
TransportReplace
};
enum Creator {
Initiator,
Responder
};
struct RtpSessionStateActive { };
struct RtpSessionStateHold { };
struct RtpSessionStateUnhold { };
struct RtpSessionStateMuting {
bool isMute = true;
Creator creator;
QString name;
};
struct RtpSessionStateRinging { };
using RtpSessionState = std::variant<RtpSessionStateActive, RtpSessionStateHold, RtpSessionStateUnhold, RtpSessionStateMuting, RtpSessionStateRinging>;
using Reason = QXmppJingleReason;
class QXMPP_EXPORT Content
{
public:
Content();
Content(const QXmppJingleIq::Content &other);
Content(QXmppJingleIq::Content &&);
~Content();
Content &operator=(const Content &other);
Content &operator=(Content &&);
QString creator() const;
void setCreator(const QString &creator);
QString name() const;
void setName(const QString &name);
QString senders() const;
void setSenders(const QString &senders);
// XEP-0167: Jingle RTP Sessions
QXmppJingleDescription description() const;
void setDescription(const QXmppJingleDescription &description);
#if QXMPP_DEPRECATED_SINCE(1, 6)
QString descriptionMedia() const;
void setDescriptionMedia(const QString &media);
quint32 descriptionSsrc() const;
void setDescriptionSsrc(quint32 ssrc);
void addPayloadType(const QXmppJinglePayloadType &payload);
QList<QXmppJinglePayloadType> payloadTypes() const;
void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
#endif
bool isRtpMultiplexingSupported() const;
void setRtpMultiplexingSupported(bool isRtpMultiplexingSupported);
std::optional<QXmppJingleRtpEncryption> rtpEncryption() const;
void setRtpEncryption(const std::optional<QXmppJingleRtpEncryption> &rtpEncryption);
void addTransportCandidate(const QXmppJingleCandidate &candidate);
QList<QXmppJingleCandidate> transportCandidates() const;
void setTransportCandidates(const QList<QXmppJingleCandidate> &candidates);
QString transportUser() const;
void setTransportUser(const QString &user);
QString transportPassword() const;
void setTransportPassword(const QString &password);
QVector<QXmppJingleRtpFeedbackProperty> rtpFeedbackProperties() const;
void setRtpFeedbackProperties(const QVector<QXmppJingleRtpFeedbackProperty> &rtpFeedbackProperties);
QVector<QXmppJingleRtpFeedbackInterval> rtpFeedbackIntervals() const;
void setRtpFeedbackIntervals(const QVector<QXmppJingleRtpFeedbackInterval> &rtpFeedbackIntervals);
QVector<QXmppJingleRtpHeaderExtensionProperty> rtpHeaderExtensionProperties() const;
void setRtpHeaderExtensionProperties(const QVector<QXmppJingleRtpHeaderExtensionProperty> &rtpHeaderExtensionProperties);
bool isRtpHeaderExtensionMixingAllowed() const;
void setRtpHeaderExtensionMixingAllowed(bool isRtpHeaderExtensionMixingAllowed);
// XEP-0320: Use of DTLS-SRTP in Jingle Sessions
QByteArray transportFingerprint() const;
void setTransportFingerprint(const QByteArray &fingerprint);
QString transportFingerprintHash() const;
void setTransportFingerprintHash(const QString &hash);
QString transportFingerprintSetup() const;
void setTransportFingerprintSetup(const QString &setup);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
bool parseSdp(const QString &sdp);
QString toSdp() const;
private:
QSharedDataPointer<QXmppJingleIqContentPrivate> d;
};
QXmppJingleIq();
QXmppJingleIq(const QXmppJingleIq &other);
QXmppJingleIq(QXmppJingleIq &&);
~QXmppJingleIq() override;
QXmppJingleIq &operator=(const QXmppJingleIq &other);
QXmppJingleIq &operator=(QXmppJingleIq &&);
Action action() const;
void setAction(Action action);
void addContent(const Content &content);
QList<Content> contents() const;
void setContents(const QList<Content> &contents);
QString initiator() const;
void setInitiator(const QString &initiator);
QXmppJingleReason &reason();
const QXmppJingleReason &reason() const;
QString responder() const;
void setResponder(const QString &responder);
#if QXMPP_DEPRECATED_SINCE(1, 5)
QT_DEPRECATED_X("Use QXmpp::rtpSessionState() instead")
bool ringing() const;
QT_DEPRECATED_X("Use QXmpp::setRtpSessionState() instead")
void setRinging(bool ringing);
#endif
QString sid() const;
void setSid(const QString &sid);
QString mujiGroupChatJid() const;
void setMujiGroupChatJid(const QString &mujiGroupChatJid);
std::optional<RtpSessionState> rtpSessionState() const;
void setRtpSessionState(const std::optional<RtpSessionState> &rtpSessionState);
static bool isJingleIq(const QDomElement &element);
protected:
void parseElementFromChild(const QDomElement &element) override;
void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
private:
QSharedDataPointer<QXmppJingleIqPrivate> d;
};
class QXMPP_EXPORT QXmppJingleMessageInitiationElement
{
public:
enum class Type {
None,
Propose,
Ringing,
Proceed,
Reject,
Retract,
Finish
};
QXmppJingleMessageInitiationElement();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleMessageInitiationElement)
Type type() const;
void setType(Type type);
QString id() const;
void setId(const QString &id);
std::optional<QXmppJingleDescription> description() const;
void setDescription(std::optional<QXmppJingleDescription> description);
std::optional<QXmppJingleReason> reason() const;
void setReason(std::optional<QXmppJingleReason> reason);
bool containsTieBreak() const;
void setContainsTieBreak(bool containsTieBreak);
QString migratedTo() const;
void setMigratedTo(const QString &migratedTo);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isJingleMessageInitiationElement(const QDomElement &);
static QString jmiElementTypeToString(Type type);
static std::optional<Type> stringToJmiElementType(const QString &typeStr);
private:
QSharedDataPointer<QXmppJingleMessageInitiationElementPrivate> d;
};
class QXMPP_EXPORT QXmppCallInviteElement
{
public:
enum class Type {
None,
Invite,
Retract,
Accept,
Reject,
Left
};
struct Jingle {
QString sid;
std::optional<QString> jid;
bool operator==(const Jingle &other) const { return other.sid == sid && other.jid == jid; }
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
};
struct External {
QString uri;
bool operator==(const External &other) const { return other.uri == uri; }
void toXml(QXmlStreamWriter *writer) const;
};
QXmppCallInviteElement();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppCallInviteElement)
Type type() const;
void setType(Type type);
QString id() const;
void setId(const QString &id);
bool audio() const;
void setAudio(bool audio);
bool video() const;
void setVideo(bool video);
std::optional<Jingle> jingle() const;
void setJingle(std::optional<Jingle> jingle);
std::optional<QVector<External>> external() const;
void setExternal(std::optional<QVector<External>> external);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
static bool isCallInviteElement(const QDomElement &);
private:
static QString callInviteElementTypeToString(Type type);
static std::optional<Type> stringToCallInviteElementType(const QString &typeStr);
QSharedDataPointer<QXmppCallInviteElementPrivate> d;
};
Q_DECLARE_METATYPE(QXmppJingleReason::RtpErrorCondition)
#endif
QXmppCallInviteElement
The QXmppCallInviteElement class represents a Call Invite element as specified by XEP-0482: Call Invi...
Definition QXmppJingleData.h:649
QXmppCallInviteElement::Type
Type
Definition QXmppJingleData.h:651
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition QXmppIq.h:23
QXmppJingleCandidate
The QXmppJingleCandidate class represents a transport candidate as specified by XEP-0176: Jingle ICE-...
Definition QXmppJingleData.h:278
QXmppJingleCandidate::QXmppJingleCandidate
QXmppJingleCandidate(QXmppJingleCandidate &&)
Move-constructor.
QXmppJingleCandidate::operator=
QXmppJingleCandidate & operator=(const QXmppJingleCandidate &other)
Assignment operator.
QXmppJingleCandidate::operator=
QXmppJingleCandidate & operator=(QXmppJingleCandidate &&)
Move-assignment operator.
QXmppJingleCandidate::QXmppJingleCandidate
QXmppJingleCandidate(const QXmppJingleCandidate &other)
Copy-constructor.
QXmppJingleCandidate::Type
Type
This enum is used to describe a candidate's type.
Definition QXmppJingleData.h:281
QXmppJingleCandidate::HostType
@ HostType
Host candidate, a local address/port.
Definition QXmppJingleData.h:282
QXmppJingleDescription
The QXmppJingleDescription class represents descriptions for Jingle elements including media type,...
Definition QXmppJingleData.h:246
QXmppJingleIq
The QXmppJingleIq class represents an IQ used for initiating media sessions as specified by XEP-0166:...
Definition QXmppJingleData.h:409
QXmppJingleIq::operator=
QXmppJingleIq & operator=(const QXmppJingleIq &other)
Assignment operator.
QXmppJingleIq::operator=
QXmppJingleIq & operator=(QXmppJingleIq &&)
Move-assignment operator.
QXmppJingleIq::QXmppJingleIq
QXmppJingleIq(QXmppJingleIq &&)
Move-constructor.
QXmppJingleIq::Action
Action
This enum is used to describe a Jingle action.
Definition QXmppJingleData.h:412
QXmppJingleIq::Creator
Creator
Definition QXmppJingleData.h:430
QXmppJingleIq::Initiator
@ Initiator
The initiator generated the content type.
Definition QXmppJingleData.h:432
QXmppJingleIq::QXmppJingleIq
QXmppJingleIq(const QXmppJingleIq &other)
Copy-constructor.
QXmppJingleIq::RtpSessionState
std::variant< RtpSessionStateActive, RtpSessionStateHold, RtpSessionStateUnhold, RtpSessionStateMuting, RtpSessionStateRinging > RtpSessionState
Definition QXmppJingleData.h:451
QXmppJingleMessageInitiationElement
The QXmppJingleMessageInitiationElement class represents a Jingle Message Initiation element as speci...
Definition QXmppJingleData.h:602
QXmppJingleMessageInitiationElement::Type
Type
Definition QXmppJingleData.h:604
QXmppJinglePayloadType
The QXmppJinglePayloadType class represents a payload type as specified by XEP-0167: Jingle RTP Sessi...
Definition QXmppJingleData.h:200
QXmppJingleReason
Definition QXmppJingleData.h:344
QXmppJingleReason::Type
Type
This enum is used to describe a reason's type.
Definition QXmppJingleData.h:347
QXmppJingleReason::RtpErrorCondition
RtpErrorCondition
Definition QXmppJingleData.h:370
QXmppJingleReason::InvalidCrypto
@ InvalidCrypto
The encryption offer is rejected.
Definition QXmppJingleData.h:374
QXmppJingleReason::NoErrorCondition
@ NoErrorCondition
There is no error condition.
Definition QXmppJingleData.h:372
QXmppJingleRtpCryptoElement
The QXmppJingleRtpCryptoElement class represents the XEP-0167: Jingle RTP Sessions "crypto" element u...
Definition QXmppJingleData.h:55
QXmppJingleRtpEncryption
The QXmppJingleRtpEncryption class represents the XEP-0167: Jingle RTP Sessions "encryption" element ...
Definition QXmppJingleData.h:85
QXmppJingleRtpFeedbackInterval
The QXmppJingleRtpFeedbackInterval class represents the XEP-0293: Jingle RTP Feedback Negotiation "rt...
Definition QXmppJingleData.h:136
QXmppJingleRtpFeedbackProperty
The QXmppJingleRtpFeedbackProperty class represents the XEP-0293: Jingle RTP Feedback Negotiation "rt...
Definition QXmppJingleData.h:109
QXmppJingleRtpHeaderExtensionProperty
The QXmppJingleRtpHeaderExtensionProperty class represents the XEP-0294: Jingle RTP Header Extensions...
Definition QXmppJingleData.h:157
QXmppJingleRtpHeaderExtensionProperty::Senders
Senders
Definition QXmppJingleData.h:159
QXmppJingleRtpHeaderExtensionProperty::Initiator
@ Initiator
Only the initiator is allowed.
Definition QXmppJingleData.h:163
QXmppJingleRtpHeaderExtensionProperty::Both
@ Both
The initiator and the sender are allowed.
Definition QXmppJingleData.h:161
QXmppSdpParameter
The QXmppSdpParameter class represents a Session Description Protocol (SDP) parameter specified by RF...
Definition QXmppJingleData.h:31
QXmpp
Definition Algorithms.h:12
QXmppJingleIq::RtpSessionStateActive
Definition QXmppJingleData.h:437
QXmppJingleIq::RtpSessionStateHold
Definition QXmppJingleData.h:438
QXmppJingleIq::RtpSessionStateMuting
Definition QXmppJingleData.h:440
QXmppJingleIq::RtpSessionStateMuting::name
QString name
Session to be muted (e.g., only audio or video)
Definition QXmppJingleData.h:447
QXmppJingleIq::RtpSessionStateMuting::creator
Creator creator
Creator of the corresponding session.
Definition QXmppJingleData.h:445
QXmppJingleIq::RtpSessionStateRinging
Definition QXmppJingleData.h:449
QXmppJingleIq::RtpSessionStateUnhold
Definition QXmppJingleData.h:439