QXmpp
Version:0.9.3
|
00001 /* 00002 * Copyright (C) 2008-2014 The QXmpp developers 00003 * 00004 * Author: 00005 * Jeremy LainĂ© 00006 * 00007 * Source: 00008 * https://github.com/qxmpp-project/qxmpp 00009 * 00010 * This file is a part of QXmpp library. 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2.1 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 */ 00023 00024 #ifndef QXMPPJINGLEIQ_H 00025 #define QXMPPJINGLEIQ_H 00026 00027 #include <QHostAddress> 00028 00029 #include "QXmppIq.h" 00030 00031 class QXmppJingleCandidatePrivate; 00032 class QXmppJingleIqContentPrivate; 00033 class QXmppJingleIqPrivate; 00034 class QXmppJinglePayloadTypePrivate; 00035 00039 00040 class QXMPP_EXPORT QXmppJinglePayloadType 00041 { 00042 public: 00043 QXmppJinglePayloadType(); 00044 QXmppJinglePayloadType(const QXmppJinglePayloadType &other); 00045 ~QXmppJinglePayloadType(); 00046 00047 unsigned char channels() const; 00048 void setChannels(unsigned char channels); 00049 00050 unsigned int clockrate() const; 00051 void setClockrate(unsigned int clockrate); 00052 00053 unsigned char id() const; 00054 void setId(unsigned char id); 00055 00056 unsigned int maxptime() const; 00057 void setMaxptime(unsigned int maxptime); 00058 00059 QString name() const; 00060 void setName(const QString &name); 00061 00062 QMap<QString, QString> parameters() const; 00063 void setParameters(const QMap<QString, QString> ¶meters); 00064 00065 unsigned int ptime() const; 00066 void setPtime(unsigned int ptime); 00067 00069 void parse(const QDomElement &element); 00070 void toXml(QXmlStreamWriter *writer) const; 00072 00073 QXmppJinglePayloadType& operator=(const QXmppJinglePayloadType &other); 00074 bool operator==(const QXmppJinglePayloadType &other) const; 00075 00076 private: 00077 QSharedDataPointer<QXmppJinglePayloadTypePrivate> d; 00078 }; 00079 00083 00084 class QXMPP_EXPORT QXmppJingleCandidate 00085 { 00086 public: 00088 enum Type 00089 { 00090 HostType, 00091 PeerReflexiveType, 00092 00093 ServerReflexiveType, 00094 00095 RelayedType 00096 00097 }; 00098 00099 QXmppJingleCandidate(); 00100 QXmppJingleCandidate(const QXmppJingleCandidate &other); 00101 ~QXmppJingleCandidate(); 00102 00103 QXmppJingleCandidate& operator=(const QXmppJingleCandidate &other); 00104 00105 int component() const; 00106 void setComponent(int component); 00107 00108 QString foundation() const; 00109 void setFoundation(const QString &foundation); 00110 00111 int generation() const; 00112 void setGeneration(int generation); 00113 00114 QHostAddress host() const; 00115 void setHost(const QHostAddress &host); 00116 00117 QString id() const; 00118 void setId(const QString &id); 00119 00120 int network() const; 00121 void setNetwork(int network); 00122 00123 quint16 port() const; 00124 void setPort(quint16 port); 00125 00126 int priority() const; 00127 void setPriority(int priority); 00128 00129 QString protocol() const; 00130 void setProtocol(const QString &protocol); 00131 00132 QXmppJingleCandidate::Type type() const; 00133 void setType(QXmppJingleCandidate::Type); 00134 00135 bool isNull() const; 00136 00138 void parse(const QDomElement &element); 00139 void toXml(QXmlStreamWriter *writer) const; 00140 00141 static QXmppJingleCandidate::Type typeFromString(const QString &typeStr, bool *ok = 0); 00142 static QString typeToString(QXmppJingleCandidate::Type type); 00144 00145 private: 00146 QSharedDataPointer<QXmppJingleCandidatePrivate> d; 00147 }; 00148 00153 00154 class QXMPP_EXPORT QXmppJingleIq : public QXmppIq 00155 { 00156 public: 00158 enum Action { 00159 ContentAccept, 00160 ContentAdd, 00161 ContentModify, 00162 ContentReject, 00163 ContentRemove, 00164 DescriptionInfo, 00165 SecurityInfo, 00166 SessionAccept, 00167 SessionInfo, 00168 SessionInitiate, 00169 SessionTerminate, 00170 TransportAccept, 00171 TransportInfo, 00172 TransportReject, 00173 TransportReplace 00174 }; 00175 00180 00181 class QXMPP_EXPORT Content 00182 { 00183 public: 00184 Content(); 00185 Content(const QXmppJingleIq::Content &other); 00186 ~Content(); 00187 00188 Content& operator=(const Content &other); 00189 00190 QString creator() const; 00191 void setCreator(const QString &creator); 00192 00193 QString name() const; 00194 void setName(const QString &name); 00195 00196 QString senders() const; 00197 void setSenders(const QString &senders); 00198 00199 // XEP-0167: Jingle RTP Sessions 00200 QString descriptionMedia() const; 00201 void setDescriptionMedia(const QString &media); 00202 00203 quint32 descriptionSsrc() const; 00204 void setDescriptionSsrc(quint32 ssrc); 00205 00206 void addPayloadType(const QXmppJinglePayloadType &payload); 00207 QList<QXmppJinglePayloadType> payloadTypes() const; 00208 void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes); 00209 00210 void addTransportCandidate(const QXmppJingleCandidate &candidate); 00211 QList<QXmppJingleCandidate> transportCandidates() const; 00212 void setTransportCandidates(const QList<QXmppJingleCandidate> &candidates); 00213 00214 QString transportUser() const; 00215 void setTransportUser(const QString &user); 00216 00217 QString transportPassword() const; 00218 void setTransportPassword(const QString &password); 00219 00220 // XEP-0320: Use of DTLS-SRTP in Jingle Sessions 00221 QByteArray transportFingerprint() const; 00222 void setTransportFingerprint(const QByteArray &fingerprint); 00223 00224 QString transportFingerprintHash() const; 00225 void setTransportFingerprintHash(const QString &hash); 00226 00227 QString transportFingerprintSetup() const; 00228 void setTransportFingerprintSetup(const QString &setup); 00229 00231 void parse(const QDomElement &element); 00232 void toXml(QXmlStreamWriter *writer) const; 00233 00234 bool parseSdp(const QString &sdp); 00235 QString toSdp() const; 00237 00238 private: 00239 QSharedDataPointer<QXmppJingleIqContentPrivate> d; 00240 }; 00241 00246 00247 class QXMPP_EXPORT Reason 00248 { 00249 public: 00251 enum Type { 00252 None, 00253 AlternativeSession, 00254 Busy, 00255 Cancel, 00256 ConnectivityError, 00257 Decline, 00258 Expired, 00259 FailedApplication, 00260 FailedTransport, 00261 GeneralError, 00262 Gone, 00263 IncompatibleParameters, 00264 MediaError, 00265 SecurityError, 00266 Success, 00267 Timeout, 00268 UnsupportedApplications, 00269 UnsupportedTransports 00270 }; 00271 00272 Reason(); 00273 00274 QString text() const; 00275 void setText(const QString &text); 00276 00277 Type type() const; 00278 void setType(Type type); 00279 00281 void parse(const QDomElement &element); 00282 void toXml(QXmlStreamWriter *writer) const; 00284 00285 private: 00286 QString m_text; 00287 Type m_type; 00288 }; 00289 00290 QXmppJingleIq(); 00291 QXmppJingleIq(const QXmppJingleIq &other); 00292 ~QXmppJingleIq(); 00293 00294 QXmppJingleIq& operator=(const QXmppJingleIq &other); 00295 00296 Action action() const; 00297 void setAction(Action action); 00298 00299 void addContent(const Content &content); 00300 QList<Content> contents() const; 00301 void setContents(const QList<Content> &contents); 00302 00303 QString initiator() const; 00304 void setInitiator(const QString &initiator); 00305 00306 Reason& reason(); 00307 const Reason& reason() const; 00308 00309 QString responder() const; 00310 void setResponder(const QString &responder); 00311 00312 // XEP-0167: Jingle RTP Sessions 00313 bool ringing() const; 00314 void setRinging(bool ringing); 00315 00316 QString sid() const; 00317 void setSid(const QString &sid); 00318 00320 static bool isJingleIq(const QDomElement &element); 00322 00323 protected: 00325 void parseElementFromChild(const QDomElement &element); 00326 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00328 00329 private: 00330 QSharedDataPointer<QXmppJingleIqPrivate> d; 00331 }; 00332 00333 #endif