Gnutella::PacketProcessing::QueryRouting Namespace Reference


Detailed Description

Implementation for QRT and QRP.

Higher abstraction level is Gnutella::PacketProcessing.

QueryRoutingTable is used to represent a QRT. It provides functions to calculate a patch table, or apply a patch on a table.

QrtWriter takes a QRT and generates a sequence of QRP packets. QrtWriter stores a copy of the last sent QRT, so that next time it can generate packets for a small patch only.

QrtReader takes QRP packets and reconstructs a QRT. QrtReader stores the last received QRT, so that it will be able to reconstruct a sequence of patch packets.

QrtExchanger is used by PacketProcessor for handling of Packets::QueryRoutingPatch and Packets::QueryRoutingReset packet objects. QrtExchanger stores a QRT per each active Gnutella connection. It also stores the QRT of our node.

Todo:
v0.6.0 QrtExchanger must be modified to store per-connection QRP state. That means to add a QMap <PacketSession, SessionInfo> member. SessionInfo would be a struct containing a QrtReader, a QrtWriter and probably some status or last changed marker (if necessary). All QRP stuff from Gnutella::PacketProcessor::PacketSession must be removed.
Todo:
v0.6.0 QrtExchanger must be added a new function that can be used by PacketProcessor to check whether a query packet should be forwarded over a specific PacketSession. PacketProcessor would call the function only for ttl=1 queries. Integrate the new function in PacketProcessor.
Todo:
v0.6.0 It must be tested whether QrtExchanger correctly merges the QRTs of its leaves. It should further be verified that QRT updates are issued in a good rate (check with specs) and that query packets a correctly filtered. It would be nice to develop a package test app, which can facilitate the process.
Resources:</storng>


Classes

class  QrtExchangerPrivate
class  QrtExchanger
 The class handles all QRT exchange between peers, ultrapeers and leaves. More...
class  QrtReaderPrivate
class  QrtReader
class  QrtWriterPrivate
class  QrtWriter
class  QueryRoutingTable
class  QueryRoutingTableTest

Enumerations

enum  Constants { DefaultQrtSize = 65536 }
enum  Constants { PatchSize = 1024 }

Functions

static bool isPowerOf2 (quint32 size)
quint8 leftNibbleNonZero (quint8 ch)
quint8 rightNibbleNonZero (quint8 ch)
quint8 checkTwoNibbles (quint8 ch)
quint8 getBitsToOr (quint8 ch, quint8 entryBits)
 CPPUNIT_TEST_SUITE_REGISTRATION (QueryRoutingTableTest)

Variables

static const int A_INT = 0x4F1BBCDC
static const quint8 EntryMask [8]
static const quint8 ValueShift [8] = { 7, 6, 5, 4, 3, 2, 1}


Enumeration Type Documentation

enum Gnutella::PacketProcessing::QueryRouting::Constants
 

Enumerator:
PatchSize  Patch size per packet (just data, no headers).

Definition at line 34 of file QrtWriter.cpp.

enum Gnutella::PacketProcessing::QueryRouting::Constants
 

Enumerator:
DefaultQrtSize 

Definition at line 34 of file QrtExchanger.cpp.


Function Documentation

quint8 Gnutella::PacketProcessing::QueryRouting::checkTwoNibbles quint8  ch  ) 
 

Definition at line 55 of file QueryRoutingTable.cpp.

Gnutella::PacketProcessing::QueryRouting::CPPUNIT_TEST_SUITE_REGISTRATION QueryRoutingTableTest   ) 
 

quint8 Gnutella::PacketProcessing::QueryRouting::getBitsToOr quint8  ch,
quint8  entryBits
 

Definition at line 69 of file QueryRoutingTable.cpp.

static bool Gnutella::PacketProcessing::QueryRouting::isPowerOf2 quint32  size  )  [static]
 

Definition at line 39 of file QueryRoutingTable.cpp.

quint8 Gnutella::PacketProcessing::QueryRouting::leftNibbleNonZero quint8  ch  ) 
 

Definition at line 45 of file QueryRoutingTable.cpp.

quint8 Gnutella::PacketProcessing::QueryRouting::rightNibbleNonZero quint8  ch  ) 
 

Definition at line 50 of file QueryRoutingTable.cpp.


Variable Documentation

const int Gnutella::PacketProcessing::QueryRouting::A_INT = 0x4F1BBCDC [static]
 

Definition at line 34 of file QueryRoutingTable.cpp.

const quint8 Gnutella::PacketProcessing::QueryRouting::EntryMask[8] [static]
 

Initial value:

 { 0x80, 0x40, 0x20, 0x10,
                                       0x08, 0x04, 0x02, 0x01}

Definition at line 35 of file QueryRoutingTable.cpp.

const quint8 Gnutella::PacketProcessing::QueryRouting::ValueShift[8] = { 7, 6, 5, 4, 3, 2, 1} [static]
 

Definition at line 37 of file QueryRoutingTable.cpp.