kopete/protocols/messenger/libpapillon
ipendpointconnector.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PAPILLON_IPENDPOINTCONNECTOR_H
00019 #define PAPILLON_IPENDPOINTCONNECTOR_H
00020
00021 #include <QtCore/QObject>
00022 #include <QtCore/QList>
00023 #include <QtCore/QString>
00024 #include <QtNetwork/QAbstractSocket>
00025 #include <QtNetwork/QSslError>
00026
00027 namespace Papillon
00028 {
00029
00030 class NetworkStream;
00033 class IpEndpointConnector : public QObject
00034 {
00035 Q_OBJECT
00036
00037 public:
00039 enum State { Created=0, Connecting=1, Connected=2, Closing=4, Closed=8, Faulted=0x10 };
00040
00041 public:
00043 explicit IpEndpointConnector(bool enableTls, QObject *parent=0);
00045 ~IpEndpointConnector();
00046
00047 public:
00049 void close();
00051 void connectWithAddressInfo(const QString& ipAddress, const quint16 port);
00053 NetworkStream * networkStream();
00055 const State & state() const;
00056
00057 signals:
00059 void connecting();
00061 void connected();
00063 void closing();
00065 void closed();
00067 void faulted();
00068
00069 private Q_SLOTS:
00071 void socket_OnClose();
00073 void socket_OnConnect();
00075 void socket_OnError(QAbstractSocket::SocketError socketError);
00077 void socket_OnTlsConnect();
00079 void socket_OnTlsError(const QList<QSslError>& errors);
00080
00081 private:
00083 void closeConnector();
00084
00085 private:
00086 class IpEndpointConnectorPrivate;
00087 IpEndpointConnectorPrivate *d;
00088
00089 };
00090 }
00091
00092 #endif