Gnutella::Handshaking::HandshakeSession Class Reference

#include <HandshakeSession.h> [code]

Inherits QObject.

Inheritance diagram for Gnutella::Handshaking::HandshakeSession:

Inheritance graph
[legend]
Collaboration diagram for Gnutella::Handshaking::HandshakeSession:

Collaboration graph
[legend]
List of all members.

Detailed Description

Provides a high-level handshaking interface to a Connection object.

Todo:
Maybe rename just to Session if we can handle the problem with the duplicate filenames caused by qmake

Definition at line 60 of file HandshakeSession.h.

Signals

void connectionEstablished (HandshakeSession *)
void receivedRequest (HandshakeSession *)
void receivedResponse (HandshakeSession *)
void handshakingCompleted (HandshakeSession *)
void handshakingFailed (HandshakeSession *)

Public Member Functions

 HandshakeSession (Connection *, const NodeAddress &, Handshaker *, NodeCache *)
 ~HandshakeSession ()
void request (const NodeInfo &myNodeInfo)
void waitRequest ()
void respond (const NodeInfo &myNodeInfo)
void waitResponse ()
void acknowledge (const NodeInfo &myNodeInfo)
void waitAcknowledgement ()
void reject (RejectReason, const NodeInfo &myNodeInfo)
NodeInfo otherNodeInfo () const
NodeInfo myNodeInfo () const
Connectionconnection () const
HandshakeError error () const

Private Types

enum  State {
  UnknownState,
  WaitingPhase1Handshake,
  SendingPhase1Handshake,
  WaitingPhase2Handshake,
  SendingPhase2Handshake,
  WaitingPhase3Handshake,
  SendingPhase3Handshake,
  RejectingConnection,
  HandshakingTimedOut,
  HandshakingFailed,
  HandshakingCompleted
}

Private Slots

void connectionEstablished ()
void connectionFailed ()
void connectionClosed ()
 The underlying connection was closed. Clear connection data.
void handshakeRead ()
 The underlying HandshakeReader parsed a header.
void handshakeWritten ()
 The underlying HandshakeWriter wrote a header.
void readError ()
 The underlying HandshakeReader failed to parse a header.
void writeError ()
 The underlying HandhsakeWriter failed to write a header.
void timeout ()
 A timeout elapsed before the handshaking could be completed.

Private Member Functions

void completed ()
void failed (HandshakeError)
void sendResponse (RejectReason, const NodeInfo &)
void setHandshakeHeaders (Header &handshakeHeaders, const NodeInfo &myNodeInfo)
void getHandshakeHeaders (const Header &handshakeHeaders)

Private Attributes

Data d

Classes

struct  Data


Member Enumeration Documentation

enum Gnutella::Handshaking::HandshakeSession::State [private]
 

Enumerator:
UnknownState 
WaitingPhase1Handshake 
SendingPhase1Handshake 
WaitingPhase2Handshake 
SendingPhase2Handshake 
WaitingPhase3Handshake 
SendingPhase3Handshake 
RejectingConnection 
HandshakingTimedOut 
HandshakingFailed 
HandshakingCompleted 

Definition at line 101 of file HandshakeSession.h.


Constructor & Destructor Documentation

HandshakeSession::HandshakeSession Connection ,
const NodeAddress ,
Handshaker ,
NodeCache
 

Definition at line 63 of file HandshakeSession.cpp.

HandshakeSession::~HandshakeSession  ) 
 

Definition at line 102 of file HandshakeSession.cpp.


Member Function Documentation

void HandshakeSession::acknowledge const NodeInfo myNodeInfo  ) 
 

Definition at line 211 of file HandshakeSession.cpp.

void HandshakeSession::completed  )  [inline, private]
 

The address will be null if we never read the Listen-IP header from a node, which contacted us => nothing to update! It might be null if we contacted the node, but the Listen-IP header it returned overwote the address we contacted. In this case we should still mark the old address as not available.

Todo:
If Listen-IP is not null, but different than the one we connected to?

NodeInfo is copied a lot. Make it a class and use ref-counting.

Definition at line 118 of file HandshakeSession.cpp.

Connection * Gnutella::Handshaking::HandshakeSession::connection  )  const [inline]
 

Definition at line 153 of file HandshakeSession.h.

void HandshakeSession::connectionClosed  )  [private, slot]
 

The underlying connection was closed. Clear connection data.

Definition at line 305 of file HandshakeSession.cpp.

void HandshakeSession::connectionEstablished  )  [private, slot]
 

Definition at line 292 of file HandshakeSession.cpp.

void Gnutella::Handshaking::HandshakeSession::connectionEstablished HandshakeSession  )  [signal]
 

void HandshakeSession::connectionFailed  )  [private, slot]
 

Definition at line 298 of file HandshakeSession.cpp.

HandshakeError Gnutella::Handshaking::HandshakeSession::error  )  const [inline]
 

Definition at line 156 of file HandshakeSession.h.

void HandshakeSession::failed HandshakeError   )  [inline, private]
 

Definition at line 140 of file HandshakeSession.cpp.

void HandshakeSession::getHandshakeHeaders const Header handshakeHeaders  )  [private]
 

Definition at line 393 of file HandshakeSession.cpp.

void HandshakeSession::handshakeRead  )  [private, slot]
 

The underlying HandshakeReader parsed a header.

Definition at line 223 of file HandshakeSession.cpp.

void HandshakeSession::handshakeWritten  )  [private, slot]
 

The underlying HandshakeWriter wrote a header.

Definition at line 257 of file HandshakeSession.cpp.

void Gnutella::Handshaking::HandshakeSession::handshakingCompleted HandshakeSession  )  [signal]
 

void Gnutella::Handshaking::HandshakeSession::handshakingFailed HandshakeSession  )  [signal]
 

NodeInfo Gnutella::Handshaking::HandshakeSession::myNodeInfo  )  const [inline]
 

Definition at line 147 of file HandshakeSession.h.

NodeInfo Gnutella::Handshaking::HandshakeSession::otherNodeInfo  )  const [inline]
 

Definition at line 150 of file HandshakeSession.h.

void HandshakeSession::readError  )  [private, slot]
 

The underlying HandshakeReader failed to parse a header.

Definition at line 251 of file HandshakeSession.cpp.

void Gnutella::Handshaking::HandshakeSession::receivedRequest HandshakeSession  )  [signal]
 

void Gnutella::Handshaking::HandshakeSession::receivedResponse HandshakeSession  )  [signal]
 

void HandshakeSession::reject RejectReason  ,
const NodeInfo myNodeInfo
 

Definition at line 217 of file HandshakeSession.cpp.

void HandshakeSession::request const NodeInfo myNodeInfo  ) 
 

Definition at line 165 of file HandshakeSession.cpp.

void HandshakeSession::respond const NodeInfo myNodeInfo  ) 
 

Definition at line 193 of file HandshakeSession.cpp.

void HandshakeSession::sendResponse RejectReason  ,
const NodeInfo
[private]
 

Definition at line 183 of file HandshakeSession.cpp.

void HandshakeSession::setHandshakeHeaders Header header,
const NodeInfo myNodeInfo
[private]
 

Todo:
Should we return only ultrapeers with leaf/ultrapeers slots?

Definition at line 327 of file HandshakeSession.cpp.

void HandshakeSession::timeout  )  [private, slot]
 

A timeout elapsed before the handshaking could be completed.

Definition at line 321 of file HandshakeSession.cpp.

void HandshakeSession::waitAcknowledgement  ) 
 

Definition at line 205 of file HandshakeSession.cpp.

void HandshakeSession::waitRequest  ) 
 

Definition at line 176 of file HandshakeSession.cpp.

void HandshakeSession::waitResponse  ) 
 

Definition at line 199 of file HandshakeSession.cpp.

void HandshakeSession::writeError  )  [private, slot]
 

The underlying HandhsakeWriter failed to write a header.

Definition at line 286 of file HandshakeSession.cpp.


Member Data Documentation

Data Gnutella::Handshaking::HandshakeSession::d [private]
 

Definition at line 144 of file HandshakeSession.h.


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