Gnutella::Handshaking Namespace Reference


Detailed Description

Take care for negotiating Gnutella connection parameters.

Higher abstraction level is Gnutella

Handshaker can either request or accept a connection. For each connection a HandshakeSession is established. The protocol pattern (see Networks) is in use here:

inline_dotgraph_3

The session layer is represented by HandshakeSession. It uses Http::HeaderReader and Http::HeaderWriter to read read/write HTTP-style headers over a connection (Networks::Transports::Connection). The presentation layer abstraction contains RequestHeader and ResponseHeader.

Todo:
Verify that handshaking works correctly in all modes combinations between Calitkos and between Calitko and other Gnutella servents.

Try using Doxygen's grouping functionality to group RequestHeader and ResponseHeader into "Handshaking Presentation Layer" group for example. Then add a reference to this group in the picture above.

Does SlotAllocator fit nice here? Maybe it, together with Bootstrapping::ConnectionKeeper should either be moved in a separate package directly in Gnutella.

Handshaking resources:


Classes

class  HandshakerPrivate
class  Handshaker
struct  StatusLine
class  HandshakeSession
 Provides a high-level handshaking interface to a Connection object. More...
class  RequestHeader
 Encapsulates a Gnutella CONNECT handshake header. More...
class  ResponseHeader
 Encapsulates a Gnutella CONNECT response handshake header. More...
class  SlotAllocatorPrivate
struct  Slot
class  SlotAllocator

Enumerations

enum  Constants {
  HandshakingTimeout = 10000,
  TryUltrapeersCount = 20
}
enum  RejectReason {
  NotRejecting,
  RejectNoSlots,
  RejectUnsupportedFeatures,
  RejectImUltrapeer,
  RejectImLeaf
}
enum  HandshakeError {
  NoError,
  ErrorCannotEstablishConnection,
  ErrorRemoteClosedConnection,
  ErrorRemoteNodeRejected,
  ErrorRejectedByRemoteNode,
  ErrorInvalidHeadersRead,
  ErrorWriteDevice,
  ErrorReadDevice,
  ErrorTimeout
}
enum  Constants {
  TotalHandshakingSlots = 5,
  TotalUltrapeerSlots = 2,
  TotalPeerSlots = 32,
  TotalLeafSlots = 0,
  BootstrappingThreshold = 4,
  WellConnectedThreshold = 24
}
enum  SlotType {
  HandshakingSlot,
  UltrapeerSlot,
  PeerSlot,
  LeafSlot
}

Variables

static const int CodeOK = 200
static const int CodeNotAcceptable = 406
static const int CodeBusy = 503
static const StatusLine statusLines []


Enumeration Type Documentation

enum Gnutella::Handshaking::Constants
 

Enumerator:
TotalHandshakingSlots 
TotalUltrapeerSlots 
TotalPeerSlots 
TotalLeafSlots 
BootstrappingThreshold 
WellConnectedThreshold 

Definition at line 33 of file SlotAllocator.cpp.

enum Gnutella::Handshaking::Constants
 

Enumerator:
HandshakingTimeout 
TryUltrapeersCount 

Definition at line 54 of file HandshakeSession.cpp.

enum Gnutella::Handshaking::HandshakeError
 

Enumerator:
NoError 
ErrorCannotEstablishConnection 
ErrorRemoteClosedConnection 
ErrorRemoteNodeRejected 
ErrorRejectedByRemoteNode 
ErrorInvalidHeadersRead 
ErrorWriteDevice 
ErrorReadDevice 
ErrorTimeout 

Definition at line 43 of file HandshakeSession.h.

enum Gnutella::Handshaking::RejectReason
 

Enumerator:
NotRejecting 
RejectNoSlots 
RejectUnsupportedFeatures 
RejectImUltrapeer 
RejectImLeaf 

Definition at line 34 of file HandshakeSession.h.

enum Gnutella::Handshaking::SlotType
 

Enumerator:
HandshakingSlot 
UltrapeerSlot 
PeerSlot 
LeafSlot 

Definition at line 65 of file SlotAllocator.cpp.


Variable Documentation

const int Gnutella::Handshaking::CodeBusy = 503 [static]
 

Definition at line 38 of file HandshakeSession.cpp.

const int Gnutella::Handshaking::CodeNotAcceptable = 406 [static]
 

Definition at line 37 of file HandshakeSession.cpp.

const int Gnutella::Handshaking::CodeOK = 200 [static]
 

Definition at line 36 of file HandshakeSession.cpp.

const StatusLine Gnutella::Handshaking::statusLines[] [static]
 

Initial value:

 {
{ CodeOK,               "OK" }, 
{ CodeBusy,             "No Slots Available" }, 
{ CodeNotAcceptable,    "You Don't Support Required Features" }, 
{ CodeNotAcceptable,    "I'm an Ultrapeer" }, 
{ CodeNotAcceptable,    "I'm a Shielded Leaf" } 
}

Definition at line 46 of file HandshakeSession.cpp.