QXmpp  Version:0.9.1
QXmppByteStreamIq.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 QXMPPBYTESTREAMIQ_H
25 #define QXMPPBYTESTREAMIQ_H
26 
27 #include "QXmppIq.h"
28 
29 #include <QHostAddress>
30 
31 class QXMPP_EXPORT QXmppByteStreamIq : public QXmppIq
32 {
33 public:
34  enum Mode {
35  None = 0,
36  Tcp,
37  Udp
38  };
39 
40  class QXMPP_EXPORT StreamHost
41  {
42  public:
43  QString jid() const;
44  void setJid(const QString &jid);
45 
46  QString host() const;
47  void setHost(const QString &host);
48 
49  quint16 port() const;
50  void setPort(quint16 port);
51 
52  QString zeroconf() const;
53  void setZeroconf(const QString &zeroconf);
54 
55  private:
56  QString m_host;
57  QString m_jid;
58  quint16 m_port;
59  QString m_zeroconf;
60  };
61 
62  QXmppByteStreamIq::Mode mode() const;
63  void setMode(QXmppByteStreamIq::Mode mode);
64 
65  QString sid() const;
66  void setSid(const QString &sid);
67 
68  QString activate() const;
69  void setActivate(const QString &activate);
70 
71  QList<QXmppByteStreamIq::StreamHost> streamHosts() const;
72  void setStreamHosts(const QList<QXmppByteStreamIq::StreamHost> &streamHosts);
73 
74  QString streamHostUsed() const;
75  void setStreamHostUsed(const QString &jid);
76 
77  static bool isByteStreamIq(const QDomElement &element);
78 
79 protected:
81  void parseElementFromChild(const QDomElement &element);
82  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
84 
85 private:
86  Mode m_mode;
87  QString m_sid;
88 
89  QString m_activate;
90  QList<StreamHost> m_streamHosts;
91  QString m_streamHostUsed;
92 };
93 
94 #endif
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42