mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added global router gui to NS
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7250 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
cc8b1e8cb0
commit
bab24af091
@ -0,0 +1,222 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 20011, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include <QLayout>
|
||||
|
||||
#include <retroshare/rsgrouter.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <grouter/p3grouter.h>
|
||||
#include "GlobalRouterStatistics.h"
|
||||
|
||||
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
|
||||
|
||||
static QColor colorScale(float f)
|
||||
{
|
||||
if(f == 0)
|
||||
return QColor::fromHsv(0,0,192) ;
|
||||
else
|
||||
return QColor::fromHsv((int)((1.0-f)*280),200,255) ;
|
||||
}
|
||||
|
||||
GlobalRouterStatistics::GlobalRouterStatistics(QWidget *parent)
|
||||
: RsAutoUpdatePage(2000,parent)
|
||||
{
|
||||
setupUi(this) ;
|
||||
|
||||
_router_F->setWidget( _tst_CW = new GlobalRouterStatisticsWidget() ) ;
|
||||
}
|
||||
|
||||
GlobalRouterStatistics::~GlobalRouterStatistics()
|
||||
{
|
||||
}
|
||||
|
||||
void GlobalRouterStatistics::setGlobalRouter(const RsGRouter *grouter)
|
||||
{
|
||||
_grouter = const_cast<RsGRouter*>(grouter);
|
||||
updateDisplay() ;
|
||||
}
|
||||
void GlobalRouterStatistics::updateDisplay()
|
||||
{
|
||||
_tst_CW->updateContent(_grouter) ;
|
||||
}
|
||||
|
||||
QString GlobalRouterStatistics::getPeerName(const RsPeerId &peer_id)
|
||||
{
|
||||
static std::map<RsPeerId, QString> names ;
|
||||
|
||||
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||
|
||||
if( it != names.end())
|
||||
return it->second ;
|
||||
else
|
||||
{
|
||||
RsPeerDetails detail ;
|
||||
if(!rsPeers->getPeerDetails(peer_id,detail))
|
||||
return tr("Unknown Peer");
|
||||
|
||||
return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ;
|
||||
}
|
||||
}
|
||||
|
||||
GlobalRouterStatisticsWidget::GlobalRouterStatisticsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
maxWidth = 400 ;
|
||||
maxHeight = 0 ;
|
||||
}
|
||||
|
||||
void GlobalRouterStatisticsWidget::updateContent(RsGRouter *grouter)
|
||||
{
|
||||
std::vector<RsGRouter::GRouterRoutingCacheInfo> cache_infos ;
|
||||
RsGRouter::GRouterRoutingMatrixInfo matrix_info ;
|
||||
|
||||
grouter->getRoutingCacheInfo(cache_infos) ;
|
||||
grouter->getRoutingMatrixInfo(matrix_info) ;
|
||||
|
||||
// What do we need to draw?
|
||||
//
|
||||
// Routing matrix
|
||||
// Key [][][][][][][][][][]
|
||||
//
|
||||
// -> each [] shows a square (one per friend location) that is the routing probabilities for all connected friends
|
||||
// computed using the "computeRoutingProbabilitites()" method.
|
||||
//
|
||||
// Own key ids
|
||||
// key service id description
|
||||
//
|
||||
// Data items
|
||||
// Msg id Local origin Destination Time Status
|
||||
//
|
||||
static const int cellx = 6 ;
|
||||
static const int celly = 10+4 ;
|
||||
|
||||
QPixmap tmppixmap(maxWidth, maxHeight);
|
||||
tmppixmap.fill(this, 0, 0);
|
||||
setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
|
||||
maxHeight = 500 ;
|
||||
|
||||
// std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl;
|
||||
// draw...
|
||||
int ox=5,oy=5 ;
|
||||
|
||||
painter.drawText(ox,oy+celly,tr("Pending packets")+":" + QString::number(cache_infos.size())) ; oy += celly*2 ;
|
||||
|
||||
for(uint32_t i=0;i<cache_infos.size();++i)
|
||||
{
|
||||
QString packet_string ;
|
||||
packet_string += QString::number(cache_infos[i].mid,16) ;
|
||||
packet_string += tr(" by ")+QString::fromStdString(cache_infos[i].local_origin.toStdString()) ;
|
||||
packet_string += tr(" to ")+QString::fromStdString(cache_infos[i].destination.toStdString()) ;
|
||||
packet_string += tr(" Status ")+QString::number(cache_infos[i].status) ;
|
||||
|
||||
painter.drawText(ox+2*cellx,oy+celly,packet_string ) ; oy += celly ;
|
||||
}
|
||||
|
||||
oy += celly ;
|
||||
|
||||
painter.drawText(ox,oy+celly,tr("Managed keys")+":" + QString::number(matrix_info.published_keys.size())) ; oy += celly*2 ;
|
||||
|
||||
for(std::map<GRouterKeyId,RsGRouter::GRouterPublishedKeyInfo>::const_iterator it(matrix_info.published_keys.begin());it!=matrix_info.published_keys.end();++it)
|
||||
{
|
||||
QString packet_string ;
|
||||
packet_string += QString::fromStdString(it->first.toStdString()) ;
|
||||
packet_string += tr(" : Service ID = ")+QString::number(it->second.service_id,16) ;
|
||||
packet_string += " \""+QString::fromUtf8(it->second.description_string.c_str()) + "\"" ;
|
||||
|
||||
painter.drawText(ox+2*cellx,oy+celly,packet_string ) ; oy += celly ;
|
||||
}
|
||||
oy += celly ;
|
||||
|
||||
QString prob_string ;
|
||||
|
||||
painter.drawText(ox+0*cellx,oy+celly,tr("Routing matrix (")) ;
|
||||
|
||||
// draw scale
|
||||
|
||||
for(int i=0;i<100;++i)
|
||||
{
|
||||
painter.setPen(colorScale(i/100.0)) ;
|
||||
painter.drawLine(ox+120+i,oy+celly+2,ox+120+i,oy+2) ;
|
||||
}
|
||||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
|
||||
painter.drawText(ox+230,oy+celly,")") ;
|
||||
|
||||
oy += celly ;
|
||||
oy += celly ;
|
||||
|
||||
static const int MaxKeySize = 20 ;
|
||||
|
||||
for(std::map<GRouterKeyId,std::vector<float> >::const_iterator it(matrix_info.per_friend_probabilities.begin());it!=matrix_info.per_friend_probabilities.end();++it)
|
||||
{
|
||||
painter.drawText(ox+2*cellx,oy+celly,QString::fromStdString(it->first.toStdString())+" : ") ;
|
||||
|
||||
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
|
||||
painter.fillRect(ox+(MaxKeySize + i)*cellx+200,oy,cellx,celly,colorScale(it->second[i])) ;
|
||||
|
||||
oy += celly ;
|
||||
}
|
||||
|
||||
oy += celly ;
|
||||
oy += celly ;
|
||||
|
||||
// update the pixmap
|
||||
//
|
||||
pixmap = tmppixmap;
|
||||
maxHeight = oy ;
|
||||
}
|
||||
|
||||
QString GlobalRouterStatisticsWidget::speedString(float f)
|
||||
{
|
||||
if(f < 1.0f)
|
||||
return QString("0 B/s") ;
|
||||
if(f < 1024.0f)
|
||||
return QString::number((int)f)+" B/s" ;
|
||||
|
||||
return QString::number(f/1024.0,'f',2) + " KB/s";
|
||||
}
|
||||
|
||||
void GlobalRouterStatisticsWidget::paintEvent(QPaintEvent */*event*/)
|
||||
{
|
||||
QStylePainter(this).drawPixmap(0, 0, pixmap);
|
||||
}
|
||||
|
||||
void GlobalRouterStatisticsWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QRect TaskGraphRect = geometry();
|
||||
maxWidth = TaskGraphRect.width();
|
||||
maxHeight = TaskGraphRect.height() ;
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
// updateContent();
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 20011, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QPoint>
|
||||
#include <retroshare/rsgrouter.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_GlobalRouterStatistics.h"
|
||||
|
||||
class GlobalRouterStatisticsWidget ;
|
||||
class p3GRouter ;
|
||||
|
||||
class GlobalRouterStatistics: public RsAutoUpdatePage, public Ui::GlobalRouterStatistics
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GlobalRouterStatistics(QWidget *parent = NULL) ;
|
||||
~GlobalRouterStatistics();
|
||||
|
||||
// Cache for peer names.
|
||||
static QString getPeerName(const RsPeerId& peer_id) ;
|
||||
|
||||
void setGlobalRouter(const RsGRouter *grouter) ;
|
||||
|
||||
private:
|
||||
|
||||
virtual void updateDisplay() ;
|
||||
|
||||
GlobalRouterStatisticsWidget *_tst_CW ;
|
||||
RsGRouter *_grouter ;
|
||||
} ;
|
||||
|
||||
class GlobalRouterStatisticsWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GlobalRouterStatisticsWidget(QWidget *parent = NULL) ;
|
||||
|
||||
virtual void paintEvent(QPaintEvent *event) ;
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
void updateContent(RsGRouter *grouter) ;
|
||||
private:
|
||||
static QString speedString(float f) ;
|
||||
|
||||
QPixmap pixmap ;
|
||||
int maxWidth,maxHeight ;
|
||||
};
|
||||
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GlobalRouterStatistics</class>
|
||||
<widget class="QWidget" name="GlobalRouterStatistics">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>611</width>
|
||||
<height>408</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Router Statistics</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="_router_F">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>593</width>
|
||||
<height>390</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -4,6 +4,7 @@
|
||||
#include "NetworkSimulatorGUI.h"
|
||||
#include "NetworkViewer.h"
|
||||
#include "TurtleRouterStatistics.h"
|
||||
#include "GlobalRouterStatistics.h"
|
||||
|
||||
NetworkSimulatorGUI::NetworkSimulatorGUI(Network& net)
|
||||
{
|
||||
@ -16,13 +17,19 @@ NetworkSimulatorGUI::NetworkSimulatorGUI(Network& net)
|
||||
QObject::connect(_viewer,SIGNAL(nodeSelected(int)),this,SLOT(updateSelectedNode(int))) ;
|
||||
QObject::connect(flow_CB,SIGNAL(toggled(bool)),this,SLOT(toggleNetworkTraffic(bool))) ;
|
||||
|
||||
QVBoxLayout *layout2 = new QVBoxLayout(inspectorFrame) ;
|
||||
layout2->addWidget(_turtle_router_statistics = new TurtleRouterStatistics() ) ;
|
||||
QVBoxLayout *layout2 = new QVBoxLayout(inspectorFrame) ;
|
||||
QTabWidget *tabwidget = new QTabWidget() ;
|
||||
|
||||
layout2->addWidget(tabwidget) ;
|
||||
|
||||
tabwidget->addTab(_turtle_router_statistics = new TurtleRouterStatistics(),"Turtle router" ) ;
|
||||
tabwidget->addTab(_global_router_statistics = new GlobalRouterStatistics(),"Global router" ) ;
|
||||
}
|
||||
|
||||
void NetworkSimulatorGUI::updateSelectedNode(int node_id)
|
||||
{
|
||||
_turtle_router_statistics->setTurtleRouter( _viewer->network().node(node_id).turtle_service() ) ;
|
||||
_turtle_router_statistics->setTurtleRouter( _viewer->network().node(node_id).turtle_service() ) ;
|
||||
_global_router_statistics->setGlobalRouter( _viewer->network().node(node_id).global_router_service() ) ;
|
||||
}
|
||||
|
||||
void NetworkSimulatorGUI::toggleNetworkTraffic(bool b)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "ui_NetworkSimulatorGUI.h"
|
||||
|
||||
class TurtleRouterStatistics ;
|
||||
class GlobalRouterStatistics ;
|
||||
class NetworkViewer ;
|
||||
class Network ;
|
||||
|
||||
@ -20,6 +21,7 @@ class NetworkSimulatorGUI: public QMainWindow, public Ui::NetworkSimulatorGUI
|
||||
private:
|
||||
NetworkViewer *_viewer ;
|
||||
TurtleRouterStatistics *_turtle_router_statistics ;
|
||||
GlobalRouterStatistics *_global_router_statistics ;
|
||||
|
||||
int tickTimerId ;
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <retroshare/rsids.h>
|
||||
|
||||
#include "nscore/Network.h"
|
||||
#include "nscore/MonitoredGRouterClient.h"
|
||||
#include "NetworkViewer.h"
|
||||
|
||||
NetworkViewer::NetworkViewer(QWidget *parent,Network&net)
|
||||
@ -32,8 +33,11 @@ NetworkViewer::NetworkViewer(QWidget *parent,Network&net)
|
||||
|
||||
connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
|
||||
|
||||
action_ManageHash = new QAction(QString("Manage new random hash"),this) ;
|
||||
QObject::connect(action_ManageHash,SIGNAL(triggered()),this,SLOT(actionManageHash())) ;
|
||||
action_ClientForHash = new QAction(QString("Client for new random hash"),this) ;
|
||||
QObject::connect(action_ClientForHash,SIGNAL(triggered()),this,SLOT(actionClientForHash())) ;
|
||||
|
||||
action_ProvideGRKey = new QAction(QString("Provide new GRouter key"),this) ;
|
||||
QObject::connect(action_ProvideGRKey,SIGNAL(triggered()),this,SLOT(actionProvideGRKey())) ;
|
||||
|
||||
setMouseTracking(true) ;
|
||||
}
|
||||
@ -514,7 +518,7 @@ void NetworkViewer::contextMenu(QPoint p)
|
||||
|
||||
QMenu contextMnu ;//= ui.msgText->createStandardContextMenu(matrix.map(point));
|
||||
|
||||
contextMnu.addAction(action_ManageHash);
|
||||
contextMnu.addAction(action_ClientForHash);
|
||||
|
||||
if(_current_acted_node == -1)
|
||||
return ;
|
||||
@ -545,19 +549,27 @@ void NetworkViewer::contextMenu(QPoint p)
|
||||
}
|
||||
if(!provided_hashes.empty())
|
||||
{
|
||||
QMenu *Mnu2 = contextMnu.addMenu("Manage hash") ;
|
||||
QMenu *Mnu2 = contextMnu.addMenu("Client for hash") ;
|
||||
|
||||
for(std::set<TurtleFileHash>::const_iterator it(provided_hashes.begin());it!=provided_hashes.end();++it)
|
||||
{
|
||||
QAction* manage_hash_action = new QAction(QString::fromStdString((*it).toStdString()), Mnu2);
|
||||
connect(manage_hash_action, SIGNAL(triggered()), this, SLOT(actionManageHash()));
|
||||
connect(manage_hash_action, SIGNAL(triggered()), this, SLOT(actionClientForHash()));
|
||||
Mnu2->addAction(manage_hash_action);
|
||||
}
|
||||
}
|
||||
contextMnu.exec(mapToGlobal(p));
|
||||
}
|
||||
contextMnu.addSeparator() ;
|
||||
|
||||
// GRouter stuff
|
||||
|
||||
contextMnu.addAction(action_ProvideGRKey);
|
||||
|
||||
// Execute!
|
||||
|
||||
contextMnu.exec(mapToGlobal(p));
|
||||
}
|
||||
|
||||
void NetworkViewer::actionManageHash()
|
||||
void NetworkViewer::actionClientForHash()
|
||||
{
|
||||
if(_current_acted_node < 0)
|
||||
return ;
|
||||
@ -599,4 +611,40 @@ void NetworkViewer::actionProvideHash()
|
||||
updateGL() ;
|
||||
}
|
||||
|
||||
void NetworkViewer::actionSendToGRKey()
|
||||
{
|
||||
if(_current_acted_node < 0)
|
||||
return ;
|
||||
|
||||
GRouterKeyId key_id ;
|
||||
|
||||
if(qobject_cast<QAction*>(sender())->text().length() == 32) //data().toString().toStdString();
|
||||
{
|
||||
key_id = GRouterKeyId(qobject_cast<QAction*>(sender())->text().toStdString()) ;
|
||||
|
||||
std::cerr << "Sending to existing key " << key_id << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << " current node = " << _current_acted_node << std::endl ;
|
||||
std::cerr << " sending message = " << key_id << std::endl;
|
||||
|
||||
_network.node(_current_acted_node).sendToGRKey(key_id) ;
|
||||
|
||||
updateGL() ;
|
||||
}
|
||||
|
||||
void NetworkViewer::actionProvideGRKey()
|
||||
{
|
||||
if(_current_acted_node < 0)
|
||||
return ;
|
||||
|
||||
GRouterKeyId key_id = GRouterKeyId::random();
|
||||
QString key = QString::fromStdString(key_id.toStdString()) ;
|
||||
|
||||
std::cerr << "Providing new grouter key " << key_id << std::endl;
|
||||
_network.node(_current_acted_node).provideGRKey(key_id) ;
|
||||
|
||||
updateGL() ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,8 +43,10 @@ class NetworkViewer: public QGLViewer
|
||||
public slots:
|
||||
void timerEvent(QTimerEvent *) ;
|
||||
void contextMenu(QPoint) ;
|
||||
void actionManageHash() ;
|
||||
void actionClientForHash() ;
|
||||
void actionProvideHash() ;
|
||||
void actionSendToGRKey() ;
|
||||
void actionProvideGRKey() ;
|
||||
|
||||
private:
|
||||
void calculateForces(const Network::NodeId& node_id,const double *map,int W,int H,float x,float y,float /*speedf*/,float& new_x, float& new_y) ;
|
||||
@ -73,7 +75,9 @@ class NetworkViewer: public QGLViewer
|
||||
bool _dragging ;
|
||||
bool _nodes_need_recomputing ;
|
||||
|
||||
QAction *action_ManageHash ;
|
||||
QAction *action_SendToGRKey ;
|
||||
QAction *action_ProvideGRKey ;
|
||||
QAction *action_ClientForHash ;
|
||||
QAction *action_ProvideHash ;
|
||||
};
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG *= qt qglviewer
|
||||
CONFIG *= qt qglviewer uic
|
||||
QT *= xml opengl
|
||||
|
||||
INCLUDEPATH *= ../../.. ..
|
||||
|
||||
TARGET = NetworkSim
|
||||
DESTDIR = bin
|
||||
DESTDIR = ../bin
|
||||
|
||||
PRE_TARGETDEPS = ../nscore/nscore.pro
|
||||
|
||||
SOURCES = main.cpp NetworkViewer.cpp NetworkSimulatorGUI.cpp \
|
||||
TurtleRouterStatistics.cpp RsAutoUpdatePage.cpp
|
||||
TurtleRouterStatistics.cpp RsAutoUpdatePage.cpp GlobalRouterStatistics.cpp
|
||||
|
||||
HEADERS = NetworkViewer.h NetworkSimulatorGUI.h \
|
||||
TurtleRouterStatistics.h RsAutoUpdatePage.h
|
||||
TurtleRouterStatistics.h RsAutoUpdatePage.h GlobalRouterStatistics.h
|
||||
|
||||
FORMS = NetworkSimulatorGUI.ui TurtleRouterStatistics.ui
|
||||
FORMS = NetworkSimulatorGUI.ui TurtleRouterStatistics.ui GlobalRouterStatistics.ui
|
||||
|
||||
LIBS *= ../../../lib/libretroshare.a \
|
||||
../../../../../libbitdht/src/lib/libbitdht.a \
|
||||
|
@ -9,6 +9,7 @@ public:
|
||||
|
||||
bool handleTunnelRequest(const TurtleFileHash& hash,const RsPeerId& peer_id);
|
||||
void provideFileHash(const RsFileHash& hash);
|
||||
void requestFileHash(const RsFileHash& hash) ;
|
||||
|
||||
private:
|
||||
std::map<RsFileHash,FileInfo> _local_files ;
|
||||
|
@ -67,7 +67,14 @@ void PeerNode::manageFileHash(const RsFileHash& hash)
|
||||
_managed_hashes.insert(hash) ;
|
||||
_turtle->monitorTunnels(hash,_turtle_client) ;
|
||||
}
|
||||
|
||||
void PeerNode::sendToGRKey(const GRouterKeyId& key_id)
|
||||
{
|
||||
_grouter_client->sendMessage(key_id) ;
|
||||
}
|
||||
void PeerNode::provideGRKey(const GRouterKeyId& key_id)
|
||||
{
|
||||
_grouter_client->provideKey(key_id) ;
|
||||
}
|
||||
void PeerNode::getTrafficInfo(NodeTrafficInfo& info)
|
||||
{
|
||||
std::vector<std::vector<std::string> > hashes_info ;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <turtle/p3turtle.h>
|
||||
#include <grouter/p3grouter.h>
|
||||
|
||||
class MonitoredTurtleClient ;
|
||||
class MonitoredGRouterClient ;
|
||||
@ -34,6 +35,7 @@ class PeerNode
|
||||
// Turtle-related methods
|
||||
//
|
||||
const RsTurtle *turtle_service() const { return _turtle ; }
|
||||
const RsGRouter *global_router_service() const { return _grouter ; }
|
||||
|
||||
void manageFileHash(const RsFileHash& hash) ;
|
||||
void provideFileHash(const RsFileHash& hash) ;
|
||||
@ -45,6 +47,11 @@ class PeerNode
|
||||
|
||||
// GRouter-related methods
|
||||
//
|
||||
void provideGRKey(const GRouterKeyId& key_id) ;
|
||||
void sendToGRKey(const GRouterKeyId& key_id) ;
|
||||
|
||||
const std::set<GRouterKeyId>& providedGRKeys() const { return _provided_keys; }
|
||||
|
||||
private:
|
||||
p3ServiceServer *_service_server ;
|
||||
pqiPublisher *_publisher ;
|
||||
@ -62,5 +69,6 @@ class PeerNode
|
||||
|
||||
std::set<RsFileHash> _provided_hashes ;
|
||||
std::set<RsFileHash> _managed_hashes ;
|
||||
std::set<GRouterKeyId> _provided_keys ;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user