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

#include <authenticatebase.h>

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

Public Member Functions

 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 onError (int err)
 
void onTimeout ()
 

Protected Member Functions

virtual void handshakeReceived (bool full)=0
 
void makeHandshake (bt::Uint8 *buf, const SHA1Hash &info_hash, const PeerID &our_peer_id)
 
virtual void onFinish (bool succes)=0
 
void sendHandshake (const SHA1Hash &info_hash, const PeerID &our_peer_id)
 

Protected Attributes

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

Base class for authentication classes. This class just groups some common stuff between Authenticate and ServerAuthentciate. It has a socket, handles the timing out, provides a function to send the handshake.

Definition at line 60 of file authenticatebase.h.

Member Function Documentation

◆ handshakeReceived()

virtual void bt::AuthenticateBase::handshakeReceived ( bool  full)
protectedpure virtual

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

Implemented in bt::ServerAuthenticate, and bt::Authenticate.

◆ makeHandshake()

void bt::AuthenticateBase::makeHandshake ( bt::Uint8 *  buf,
const SHA1Hash info_hash,
const PeerID our_peer_id 
)
protected

Fill in the handshake in a buffer.

◆ onFinish()

virtual void bt::AuthenticateBase::onFinish ( bool  succes)
protectedpure virtual

Authentication finished.

Parameters
succesSucces or not

Implemented in bt::ServerAuthenticate, and bt::Authenticate.

◆ sendHandshake()

void bt::AuthenticateBase::sendHandshake ( const SHA1Hash info_hash,
const PeerID our_peer_id 
)
protected

Send a handshake

Parameters
info_hashThe info_hash to include
our_peer_idOur PeerID

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