libktorrent  2.1.1
authenticate.h
1 /***************************************************************************
2  * Copyright (C) 2005 by Joris Guisson *
3  * joris.guisson@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef BTAUTHENTICATE_H
21 #define BTAUTHENTICATE_H
22 
23 
24 #include <util/sha1hash.h>
25 #include <peer/peerid.h>
26 #include <peer/peerconnector.h>
27 #include "authenticatebase.h"
28 
29 
30 namespace net
31 {
32  class Socks;
33 }
34 
35 namespace bt
36 {
37 
38 
47  {
48  Q_OBJECT
49  public:
58  Authenticate(const net::Address & addr,TransportProtocol proto,
59  const SHA1Hash & info_hash,const PeerID & peer_id,
60  PeerConnector::WPtr pcon);
61 
62  ~Authenticate() override;
63 
64  const PeerID & getPeerID() const {return peer_id;}
65 
67  bool isSuccesfull() const {return succes;}
68 
69  public Q_SLOTS:
71  void stop();
72 
73  protected Q_SLOTS:
74  void onReadyWrite() override;
75  void onReadyRead() override;
76 
77  protected:
78  void onFinish(bool succes) override;
79  void handshakeReceived(bool full) override;
80  virtual void connected();
81 
82  protected:
83  SHA1Hash info_hash;
84  PeerID our_peer_id,peer_id;
85  net::Address addr;
86  bool succes;
87  PeerConnector::WPtr pcon;
88  net::Socks* socks;
89  };
90 }
91 
92 #endif
bt::Authenticate::isSuccesfull
bool isSuccesfull() const
See if the authentication is succesfull.
Definition: authenticate.h:67
net::Socks
Definition: socks.h:56
net::Address
Definition: address.h:59
bt::Authenticate::Authenticate
Authenticate(const net::Address &addr, TransportProtocol proto, const SHA1Hash &info_hash, const PeerID &peer_id, PeerConnector::WPtr pcon)
bt::Authenticate::onFinish
void onFinish(bool succes) override
bt::SHA1Hash
Stores a SHA1 hash.
Definition: sha1hash.h:41
bt::Authenticate::stop
void stop()
Stop the authentication.
bt::AuthenticateBase
Definition: authenticatebase.h:61
bt::PeerID
Definition: peerid.h:51
bt::Authenticate
Authenicate a peer.
Definition: authenticate.h:47
bt::Authenticate::handshakeReceived
void handshakeReceived(bool full) override