libktorrent  2.2.0
Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
bt::Authenticate Class Reference

Authenicate a peer. More...

#include <authenticate.h>

Inheritance diagram for bt::Authenticate:
Inheritance graph
[legend]

Public Slots

void stop ()
 Stop the authentication.
 

Public Member Functions

 Authenticate (const net::Address &addr, TransportProtocol proto, const SHA1Hash &info_hash, const PeerID &peer_id, PeerConnector::WPtr pcon)
 
const PeerIDgetPeerID () const
 
bool isSuccesfull () const
 See if the authentication is succesfull.
 
- Public Member Functions inherited from bt::AuthenticateBase
 AuthenticateBase (mse::EncryptedPacketSocket::Ptr s)
 
mse::EncryptedPacketSocket::Ptr getSocket () const
 get the socket
 
bool isFinished () const
 See if the authentication is finished.
 
bool isLocal () const
 Is this a local peer.
 
virtual void onReadyRead ()
 We can read from the socket.
 
virtual void onReadyWrite ()
 We can write to the socket (used to detect a succesfull connection)
 
void setLocal (bool loc)
 Set whether this is a local peer.
 
Uint32 supportedExtensions () const
 Flags indicating which extensions are supported.
 

Protected Slots

void onReadyRead () override
 
void onReadyWrite () override
 
- Protected Slots inherited from bt::AuthenticateBase
void onError (int err)
 
void onTimeout ()
 

Protected Member Functions

virtual void connected ()
 
void handshakeReceived (bool full) override
 
void onFinish (bool succes) override
 
- Protected Member Functions inherited from bt::AuthenticateBase
void makeHandshake (bt::Uint8 *buf, const SHA1Hash &info_hash, const PeerID &our_peer_id)
 
void sendHandshake (const SHA1Hash &info_hash, const PeerID &our_peer_id)
 

Protected Attributes

net::Address addr
 
SHA1Hash info_hash
 
PeerID our_peer_id
 
PeerConnector::WPtr pcon
 
PeerID peer_id
 
net::Sockssocks
 
bool succes
 
- Protected Attributes inherited from bt::AuthenticateBase
Uint32 bytes_of_handshake_received
 
Uint32 ext_support
 
bool finished
 
Uint8 handshake [68]
 
bool local
 
mse::EncryptedPacketSocket::Ptr sock
 
QTimer timer
 

Detailed Description

Author
Joris Guisson

After we connect to a peer, we need to authenticate the peer. This class handles this.

Definition at line 46 of file authenticate.h.

Constructor & Destructor Documentation

◆ Authenticate()

bt::Authenticate::Authenticate ( const net::Address addr,
TransportProtocol  proto,
const SHA1Hash info_hash,
const PeerID peer_id,
PeerConnector::WPtr  pcon 
)

Connect to a remote host first and authenicate it.

Parameters
addrAddress to connect to
protoTransport protocol to use
info_hashInfo hash
peer_idPeer ID
pmanPeerManager

Member Function Documentation

◆ handshakeReceived()

void bt::Authenticate::handshakeReceived ( bool  full)
overrideprotectedvirtual

The other side send a handshake. The first 20 bytes of the handshake will already have been checked.

Parameters
fullIndicates whether we have a full handshake if this is not full, we should just send our own

Implements bt::AuthenticateBase.

◆ onFinish()

void bt::Authenticate::onFinish ( bool  succes)
overrideprotectedvirtual

Authentication finished.

Parameters
succesSucces or not

Implements bt::AuthenticateBase.


The documentation for this class was generated from the following file: