CGossip Class Reference

#include <gossip.h>

Inheritance diagram for CGossip:

CKadInterface List of all members.

Public Member Functions

virtual ~CGossip ()
void NotifyApp (const std::string &sFileName, uint8_t filetype, uint8_t relatedModule)
int GetTransactionLog (std::string &transList) const
int FindMissingGossip (const std::string &sTransList, std::string &sMissingList) const
int SendMissingGossip (const std::string &sMissingList, uint32_t ip, uint16_t port)

Static Public Member Functions

static CGossipgetGossipInstance (std::string)

Private Types

typedef std::deque< CFileTransfer * > FileTransfer

Private Member Functions

 CGossip (std::string sFileName)
void ProcessGossipPacket (const GossipPacket &gPack, uint32 ip, uint16 port, size_t length)
int SendGossipPacket (const GossipPacket &packet, int pktLen, uint32_t destinationHost, uint16_t destinationPort)
void OnPacketReceived (uint32 ip, uint16 port, byte *buffer, size_t length)
int OnCommandReceived (int iFd)
int SendCommand (const GossipPacket &gPack, int len, uint32_t srcIP, uint16_t srcPort)
int SendTcpCommand (const std::string &sFileToSend, const boost::uuids::uuid &Tag, uint32_t srcIP, uint16_t srcPort)
int SendCommand (const std::string &sCommand, bool bTcp=false, uint8_t module=MODULE_GOSSIP)
int NotifyCommand (const std::string &)
int GetTransactionID (const std::string &sFile, boost::uuids::uuid &id)
int SendTcpGossipPacket (const std::string &sFileName, uint32_t destinationHost, uint16_t destinationPort)
void ProcessTcpGossipPacket (const std::string &sFileName, uint32 ip, uint16 port, uint8_t module)
std::string CopyFileToTmpDir (const std::string &sFile)
int GetKadBootstrapInfo (int iServerIP, int iPort)
int DoTransactionLog (const boost::uuids::uuid &Tag, const std::string &sFileName)
std::string BackupFileToDownloadDir (const std::string &sFile, const boost::uuids::uuid &Tag)
int SendMissingGossip (const boost::uuids::uuid &Tag, uint32_t ip, uint16_t port)

Private Attributes

MapFwHist mFwHist
MapFwHist mRecvHist
FileTransfer m_gfiletrans
CBootStrapClientm_pBootStrapClient
std::deque< TransactionLogm_qTransactionLog

Static Private Attributes

static bool bInstance = false
static CGossipinstance = NULL

Detailed Description

CGossip class. It extends functionality of CKadInterface class since the gossiping works on top of kademlia protocol.


Constructor & Destructor Documentation

CGossip::~CGossip (  )  [virtual]

CGossip Destructor.

CGossip::CGossip ( std::string  sFileName  )  [private]

CGossip Constructor; Takes configuration file name as its argument. It is private due to make the class as a singleton pattern.


Member Function Documentation

int CGossip::DoTransactionLog ( const boost::uuids::uuid &  Tag,
const std::string &  sFileName 
) [private]

After receiving or sending any TCP Gossip message, the message id, time and the file name is saved so that id list can be sent to the neighbor in PING message.

int CGossip::FindMissingGossip ( const std::string &  sTransList,
std::string &  sMissingList 
) const

From the KAD PING message, this method is used to find if the node missed any gossip message.

CGossip * CGossip::getGossipInstance ( std::string   )  [static]

This method is used to get an instance of CGossip class. It is used to make this architecture as a singleton pattern.

int CGossip::GetKadBootstrapInfo ( int  iServerIP,
int  iPort 
) [private]

Invokes Bootstrap Client for getting bootstrap IP and port.

int CGossip::GetTransactionID ( const std::string &  sFile,
boost::uuids::uuid &  id 
) [private]

Get the transaction id as UUID from sFile. sFile is supposed to be in SMIME format and id should be found in "FROM:" field.

int CGossip::GetTransactionLog ( std::string &  transList  )  const

It is used to get the log of already received Gossip Message Transaction ID to attached in the KAD PING message.

void CGossip::NotifyApp ( const std::string &  sFileName,
uint8_t  filetype,
uint8_t  relatedModule 
) [virtual]

Overrides the functionality of NotifyApp of CKadInterface to send EventMessage to the Policy Component.

Reimplemented from CKadInterface.

int CGossip::NotifyCommand ( const std::string &   )  [private]

This actually sends data to the Policy Component.

int CGossip::OnCommandReceived ( int  iFd  )  [private, virtual]

This method is invoked after receiving EventMessage from Policy Component.

Reimplemented from CKadInterface.

void CGossip::OnPacketReceived ( uint32  ip,
uint16  port,
byte *  buffer,
size_t  length 
) [private]

This method is invoked after receiving any Kademlia message.

void CGossip::ProcessGossipPacket ( const GossipPacket gPack,
uint32  ip,
uint16  port,
size_t  length 
) [private]

Process any received UDP Gossip Message.

void CGossip::ProcessTcpGossipPacket ( const std::string &  sFileName,
uint32  ip,
uint16  port,
uint8_t  module 
) [private, virtual]

Process any received TCP Gossip Message.

Reimplemented from CKadInterface.

int CGossip::SendCommand ( const std::string &  sCommand,
bool  bTcp = false,
uint8_t  module = MODULE_GOSSIP 
) [private]

Sends a gossip message in the network.

int CGossip::SendCommand ( const GossipPacket gPack,
int  len,
uint32_t  srcIP,
uint16_t  srcPort 
) [private]

It sends a UDP Gossip Message.

int CGossip::SendGossipPacket ( const GossipPacket packet,
int  pktLen,
uint32_t  destinationHost,
uint16_t  destinationPort 
) [private]

Send a gossip message using UDP protocol.

int CGossip::SendMissingGossip ( const boost::uuids::uuid &  Tag,
uint32_t  ip,
uint16_t  port 
) [private]

If a neighbor sends a gossip message ID in PONG message, the message is sent to the neighbor.

int CGossip::SendMissingGossip ( const std::string &  sMissingList,
uint32_t  ip,
uint16_t  port 
)

If any missing Gossip Message is found, the transaction is written in the KAD PONG message to retrieve it.

int CGossip::SendTcpCommand ( const std::string &  sFileToSend,
const boost::uuids::uuid &  Tag,
uint32_t  srcIP,
uint16_t  srcPort 
) [private]

It sends a TCP Gossip Message. Tag is used as a unique ID for this gossip message.

int CGossip::SendTcpGossipPacket ( const std::string &  sFileName,
uint32_t  destinationHost,
uint16_t  destinationPort 
) [private]

Sends a gossip message over TCP transport protocol.


The documentation for this class was generated from the following files:
Generated on Thu Sep 16 11:51:45 2010 for Communication Component by  doxygen 1.4.7