added a display of turtle search/tunnel requests over time, to help spotting potential spammers

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4216 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-05-23 21:45:25 +00:00
parent 0429baf807
commit 3f21835114
7 changed files with 270 additions and 52 deletions

View file

@ -26,6 +26,8 @@
*
*/
#pragma once
#include <inttypes.h>
#include <string>
#include <list>
@ -39,7 +41,7 @@ extern RsTurtle *rsTurtle ;
typedef uint32_t TurtleRequestId ;
// This is the structure used to send back results of the turtle search
// to the notifyBase class.
// to the notifyBase class, or send info to the GUI.
struct TurtleFileInfo
{
@ -48,6 +50,14 @@ struct TurtleFileInfo
uint64_t size ;
};
struct TurtleRequestDisplayInfo
{
uint32_t request_id ; // Id of the request
std::string source_peer_id ; // Peer that relayed the request
uint32_t age ; // Age in seconds
uint32_t depth ; // Depth of the request. Might be altered.
};
// Interface class for turtle hopping.
//
// This class mainly interacts with the turtle router, that is responsible
@ -61,7 +71,7 @@ class RsTurtle
public:
enum FileSharingStrategy { SHARE_ENTIRE_NETWORK, SHARE_FRIENDS_ONLY } ;
RsTurtle() { _sharing_strategy = SHARE_ENTIRE_NETWORK ;}
RsTurtle() {}
virtual ~RsTurtle() {}
// Lauches a search request through the pipes, and immediately returns
@ -71,6 +81,11 @@ class RsTurtle
virtual TurtleRequestId turtleSearch(const std::string& match_string) = 0 ;
virtual TurtleRequestId turtleSearch(const LinearizedExpression& expr) = 0 ;
// Sets the file sharing strategy. It concerns all local files. It would
// be better to handle this for each file, of course.
void setFileSharingStrategy(FileSharingStrategy f) { _sharing_strategy = f ; }
// Initiates tunnel handling for the given file hash. tunnels. Launches
// an exception if an error occurs during the initialization process. The
// turtle router itself does not initiate downloads, it only maintains
@ -84,18 +99,13 @@ class RsTurtle
//
virtual void stopMonitoringFileTunnels(const std::string& file_hash) = 0 ;
// Sets the file sharing strategy. It concerns all local files. It would
// be better to handle this for each file, of course.
void setFileSharingStrategy(FileSharingStrategy f) { _sharing_strategy = f ; }
// Get info from the turtle router. I use std strings to hide the internal structs.
virtual void getInfo(std::vector<std::vector<std::string> >&,std::vector<std::vector<std::string> >&,
std::vector<std::vector<std::string> >&,std::vector<std::vector<std::string> >&) const = 0;
std::vector<TurtleRequestDisplayInfo>&,std::vector<TurtleRequestDisplayInfo>&) const = 0;
// Convenience function.
virtual bool isTurtlePeer(const std::string& peer_id) const = 0 ;
protected:
FileSharingStrategy _sharing_strategy ;
};