00001 /*************************************************************************** 00002 * Copyright (C) 2004 by Daniel Rocher * 00003 * daniel.rocher@adella.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 00022 #ifndef CLIENTSSL_H 00023 #define CLIENTSSL_H 00024 00025 00026 //SSL 00027 #include <openssl/ssl.h> 00028 #include <openssl/err.h> 00029 00030 #include <QtGui> 00031 #include <QtNetwork> 00032 #include <Qt3Support> 00033 00034 extern void debugQt(const QString & message); 00035 extern void SSL_print_error(int errorcode); 00036 extern void Socket_print_error (int errorcode); 00037 00038 class ClientSSL : public QObject 00039 { 00040 Q_OBJECT 00041 public: 00042 ClientSSL(QObject *parent=0); 00043 virtual ~ClientSSL(); 00044 void sendToServer(const QString & inputText=""); 00045 void Connect(const QString & d_host, Q_UINT16 d_port); 00046 void closeConnection(); 00047 static int compteur_objet; 00048 signals: 00049 void info(const QString &); 00050 void readFromHost(const Q3CString &); 00051 void socketconnected(); 00052 void socketclosed(); 00053 void Socketerror(); 00054 void UnreachableHost(); 00055 private slots: 00056 void connectToHost(); 00057 void ResolveName(QHostInfo host_info); 00058 void socketReadyRead(); 00059 void Exception(); 00060 void socketConnected(); 00061 void socketClosed(); 00062 private: //attributes 00063 Q3SocketDevice *socketdevice; 00064 QSocketNotifier * sn_read; 00065 QSocketNotifier * sn_exception; 00066 bool SSL_init; 00067 SSL_CTX* ssl_ctx; 00068 SSL* ssl; 00069 QString host; 00070 Q_UINT16 port; 00071 }; 00072 00073 #endif