• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

authenticatebase.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Joris Guisson                                   *
00003  *   joris.guisson@gmail.com                                               *
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  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.             *
00019  ***************************************************************************/
00020 #ifndef BTAUTHENTICATEBASE_H
00021 #define BTAUTHENTICATEBASE_H
00022 
00023 #include <qobject.h>
00024 #include <qtimer.h>
00025 #include <util/constants.h>
00026 
00027 
00028 namespace mse
00029 {
00030     class StreamSocket;
00031 }
00032 
00033 
00034 namespace bt
00035 {
00036     class SHA1Hash;
00037     class PeerID;
00038 
00047     class AuthenticateBase : public QObject
00048     {
00049         Q_OBJECT
00050     public:
00051         AuthenticateBase(mse::StreamSocket* s = 0);
00052         virtual ~AuthenticateBase();
00053 
00055         void setLocal(bool loc) {local = loc;}
00056         
00058         bool isLocal() const {return local;}
00059         
00061         bool isFinished() const {return finished;}
00062         
00064         Uint32 supportedExtensions() const {return ext_support;}
00065         
00067         const mse::StreamSocket* getSocket() const {return sock;}
00068         
00070         virtual void onReadyRead();
00071         
00073         virtual void onReadyWrite();
00074 
00075         void setPollIndex(int pi) {poll_index = pi;}
00076         int getPollIndex() const {return poll_index;}
00077         
00078     protected:
00084         void sendHandshake(const SHA1Hash & info_hash,const PeerID & our_peer_id);
00085         
00090         virtual void onFinish(bool succes) = 0;
00091         
00098         virtual void handshakeReceived(bool full) = 0;
00099         
00103         void makeHandshake(bt::Uint8* buf,const SHA1Hash & info_hash,const PeerID & our_peer_id);
00104         
00105         
00106         
00107     protected slots:
00108         void onTimeout();
00109         void onError(int err);
00110         
00111     protected:
00112         mse::StreamSocket* sock;
00113         QTimer timer;
00114         bool finished;
00115         Uint8 handshake[68];
00116         Uint32 bytes_of_handshake_received;
00117         Uint32 ext_support;
00118         bool local;
00119         int poll_index;
00120     };
00121 
00122 }
00123 
00124 #endif

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal