QXmpp  Version:1.3.1
QXmppByteStreamIq.h
1 /*
2  * Copyright (C) 2008-2020 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 QXMPPBYTESTREAMIQ_H
25 #define QXMPPBYTESTREAMIQ_H
26 
27 #include "QXmppIq.h"
28 
29 #include <QHostAddress>
30 
35 class QXMPP_EXPORT QXmppByteStreamIq : public QXmppIq
36 {
37 public:
38  enum Mode {
39  None = 0,
40  Tcp,
41  Udp
42  };
43 
48  class QXMPP_EXPORT StreamHost
49  {
50  public:
51  QString jid() const;
52  void setJid(const QString &jid);
53 
54  QString host() const;
55  void setHost(const QString &host);
56 
57  quint16 port() const;
58  void setPort(quint16 port);
59 
60  QString zeroconf() const;
61  void setZeroconf(const QString &zeroconf);
62 
63  private:
64  QString m_host;
65  QString m_jid;
66  quint16 m_port;
67  QString m_zeroconf;
68  };
69 
70  QXmppByteStreamIq::Mode mode() const;
71  void setMode(QXmppByteStreamIq::Mode mode);
72 
73  QString sid() const;
74  void setSid(const QString &sid);
75 
76  QString activate() const;
77  void setActivate(const QString &activate);
78 
79  QList<QXmppByteStreamIq::StreamHost> streamHosts() const;
80  void setStreamHosts(const QList<QXmppByteStreamIq::StreamHost> &streamHosts);
81 
82  QString streamHostUsed() const;
83  void setStreamHostUsed(const QString &jid);
84 
85  static bool isByteStreamIq(const QDomElement &element);
86 
87 protected:
89  void parseElementFromChild(const QDomElement &element) override;
90  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
92 
93 private:
94  Mode m_mode;
95  QString m_sid;
96 
97  QString m_activate;
98  QList<StreamHost> m_streamHosts;
99  QString m_streamHostUsed;
100 };
101 
102 #endif
QXmppByteStreamIq::StreamHost
StreamHost represents information about a specific SOCKS5 bytestreams host.
Definition: QXmppByteStreamIq.h:48
QXmppByteStreamIq
QXmppByteStreamIq represents a SOCKS5 bytestreams negoatiation IQ as defined by XEP-0065: SOCKS5 Byte...
Definition: QXmppByteStreamIq.h:35
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:41