QXmpp  Version:0.7.3
 All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppByteStreamIq.h
1 /*
2  * Copyright (C) 2008-2012 The QXmpp developers
3  *
4  * Author:
5  * Jeremy LainĂ©
6  *
7  * Source:
8  * http://code.google.com/p/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 QDomElement;
32 class QXmlStreamWriter;
33 
34 class QXMPP_EXPORT QXmppByteStreamIq : public QXmppIq
35 {
36 public:
37  enum Mode {
38  None = 0,
39  Tcp,
40  Udp,
41  };
42 
43  class QXMPP_EXPORT StreamHost
44  {
45  public:
46  QString jid() const;
47  void setJid(const QString &jid);
48 
49  QHostAddress host() const;
50  void setHost(const QHostAddress &host);
51 
52  quint16 port() const;
53  void setPort(quint16 port);
54 
55  QString zeroconf() const;
56  void setZeroconf(const QString &zeroconf);
57 
58  private:
59  QHostAddress m_host;
60  QString m_jid;
61  quint16 m_port;
62  QString m_zeroconf;
63  };
64 
65  QXmppByteStreamIq::Mode mode() const;
66  void setMode(QXmppByteStreamIq::Mode mode);
67 
68  QString sid() const;
69  void setSid(const QString &sid);
70 
71  QString activate() const;
72  void setActivate(const QString &activate);
73 
74  QList<QXmppByteStreamIq::StreamHost> streamHosts() const;
75  void setStreamHosts(const QList<QXmppByteStreamIq::StreamHost> &streamHosts);
76 
77  QString streamHostUsed() const;
78  void setStreamHostUsed(const QString &jid);
79 
80  static bool isByteStreamIq(const QDomElement &element);
81 
82 protected:
84  void parseElementFromChild(const QDomElement &element);
85  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
87 
88 private:
89  Mode m_mode;
90  QString m_sid;
91 
92  QString m_activate;
93  QList<StreamHost> m_streamHosts;
94  QString m_streamHostUsed;
95 };
96 
97 #endif