QXmpp Version:0.7.6

- Main Page
- Modules
- Classes
- Files

- File List

All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppSocks.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 QXMPPSOCKS_H
25 #define QXMPPSOCKS_H
26
27 #include <QHostAddress>
28 #include <QTcpSocket>
29
30 #include "QXmppGlobal.h"
31
32 class QTcpServer;
33
34 class QXMPP_EXPORT QXmppSocksClient : public QTcpSocket
35 {
36 Q_OBJECT
37
38 public:
39 QXmppSocksClient(const QString &proxyHost, quint16 proxyPort, QObject *parent=0);
40 void connectToHost(const QString &hostName, quint16 hostPort);
41
42 signals:
43 void ready();
44
45 private slots:
46 void slotConnected();
47 void slotReadyRead();
48
49 private:
50 QString m_proxyHost;
51 quint16 m_proxyPort;
52 QString m_hostName;
53 quint16 m_hostPort;
54 int m_step;
55 };
56
57 class QXMPP_EXPORT QXmppSocksServer : public QObject
58 {
59 Q_OBJECT
60
61 public:
62 QXmppSocksServer(QObject *parent=0);
63 void close();
64 bool listen(quint16 port = 0);
65
66 quint16 serverPort() const;
67
68 signals:
69 void newConnection(QTcpSocket *socket, QString hostName, quint16 port);
70
71 private slots:
72 void slotNewConnection();
73 void slotReadyRead();
74
75 private:
76 QTcpServer *m_server;
77 QTcpServer *m_server_v6;
78 QMap<QTcpSocket*, int> m_states;
79 };
80
81 #endif