mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
merge of branch v0.6-idclean 7180
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7187 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7815efb16f
commit
0f29d28b1b
397 changed files with 6503 additions and 5702 deletions
|
@ -261,14 +261,17 @@ int p3turtle::tick()
|
|||
//
|
||||
void p3turtle::locked_addDistantPeer(const TurtleFileHash&,TurtleTunnelId tid)
|
||||
{
|
||||
char buff[400] ;
|
||||
sprintf(buff,"Anonymous F2F tunnel %08x",tid) ;
|
||||
unsigned char tmp[RsPeerId::SIZE_IN_BYTES] ;
|
||||
memset(tmp,0,RsPeerId::SIZE_IN_BYTES) ;
|
||||
|
||||
_virtual_peers[TurtleVirtualPeerId(buff)] = tid ;
|
||||
((uint32_t*)tmp)[0] = tid ;
|
||||
RsPeerId virtual_peer_id(tmp) ;
|
||||
|
||||
_virtual_peers[virtual_peer_id] = tid ;
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
assert(_local_tunnels.find(tid)!=_local_tunnels.end()) ;
|
||||
#endif
|
||||
_local_tunnels[tid].vpid = TurtleVirtualPeerId(buff) ;
|
||||
_local_tunnels[tid].vpid = virtual_peer_id ;
|
||||
}
|
||||
|
||||
void p3turtle::getSourceVirtualPeersList(const TurtleFileHash& hash,std::list<pqipeer>& list)
|
||||
|
@ -601,7 +604,7 @@ void p3turtle::locked_closeTunnel(TurtleTunnelId tid,std::vector<std::pair<RsTur
|
|||
_local_tunnels.erase(it) ;
|
||||
}
|
||||
|
||||
void p3turtle::stopMonitoringTunnels(const std::string& hash)
|
||||
void p3turtle::stopMonitoringTunnels(const RsFileHash& hash)
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -719,7 +722,7 @@ uint32_t p3turtle::generatePersonalFilePrint(const TurtleFileHash& hash,uint32_t
|
|||
// The only important thing is that the saem couple (hash,SSL id) produces the same tunnel
|
||||
// id. The result uses a boolean to allow generating non symmetric tunnel ids.
|
||||
|
||||
std::string buff(hash + mLinkMgr->getOwnId()) ;
|
||||
std::string buff(hash.toStdString() + mLinkMgr->getOwnId().toStdString()) ;
|
||||
uint32_t res = seed ;
|
||||
uint32_t decal = 0 ;
|
||||
|
||||
|
@ -750,7 +753,7 @@ int p3turtle::handleIncoming()
|
|||
{
|
||||
nhandled++;
|
||||
|
||||
if( (!(_turtle_routing_enabled && _turtle_routing_session_enabled)) || !(RS_SERVICE_PERM_TURTLE & rsPeers->servicePermissionFlags_sslid(item->PeerId())))
|
||||
if( (!(_turtle_routing_enabled && _turtle_routing_session_enabled)) || !(RS_SERVICE_PERM_TURTLE & rsPeers->servicePermissionFlags(item->PeerId())))
|
||||
delete item ;
|
||||
else
|
||||
{
|
||||
|
@ -867,7 +870,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item)
|
|||
}
|
||||
res_item->result.push_back(result.front()) ;
|
||||
|
||||
item_size += 8 /* size */ + result.front().hash.size() + result.front().name.size() ;
|
||||
item_size += 8 /* size */ + result.front().hash.serial_size() + result.front().name.size() ;
|
||||
result.pop_front() ;
|
||||
|
||||
if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || result.empty())
|
||||
|
@ -891,15 +894,15 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item)
|
|||
|
||||
if(item->depth < TURTLE_MAX_SEARCH_DEPTH || random_bypass)
|
||||
{
|
||||
std::list<std::string> onlineIds ;
|
||||
std::list<RsPeerId> onlineIds ;
|
||||
mLinkMgr->getOnlineList(onlineIds);
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << " Looking for online peers" << std::endl ;
|
||||
#endif
|
||||
|
||||
for(std::list<std::string>::const_iterator it(onlineIds.begin());it!=onlineIds.end();++it)
|
||||
for(std::list<RsPeerId>::const_iterator it(onlineIds.begin());it!=onlineIds.end();++it)
|
||||
{
|
||||
if(!(RS_SERVICE_PERM_TURTLE & rsPeers->servicePermissionFlags_sslid(*it)))
|
||||
if(!(RS_SERVICE_PERM_TURTLE & rsPeers->servicePermissionFlags(*it)))
|
||||
continue ;
|
||||
|
||||
uint32_t linkType = mLinkMgr->getLinkType(*it);
|
||||
|
@ -1084,8 +1087,8 @@ void p3turtle::handleRecvGenericTunnelItem(RsTurtleGenericTunnelItem *item)
|
|||
std::cerr << "p3Turtle: received Generic tunnel item:" << std::endl ;
|
||||
item->print(std::cerr,1) ;
|
||||
#endif
|
||||
std::string hash ;
|
||||
std::string vpid ;
|
||||
RsFileHash hash ;
|
||||
RsPeerId vpid ;
|
||||
RsTurtleClientService *service ;
|
||||
|
||||
if(!getTunnelServiceInfo(item->tunnelId(),vpid,hash,service))
|
||||
|
@ -1094,23 +1097,7 @@ void p3turtle::handleRecvGenericTunnelItem(RsTurtleGenericTunnelItem *item)
|
|||
service->receiveTurtleData(item,hash,vpid,item->travelingDirection()) ;
|
||||
}
|
||||
|
||||
//void p3turtle::handleRecvGenericDataItem(RsTurtleGenericDataItem *item)
|
||||
//{
|
||||
//#ifdef P3TURTLE_DEBUG
|
||||
// std::cerr << "p3Turtle: received Generic Data item:" << std::endl ;
|
||||
// item->print(std::cerr,1) ;
|
||||
//#endif
|
||||
// std::string virtual_peer_id ;
|
||||
// std::string hash ;
|
||||
// RsTurtleClientService *service ;
|
||||
//
|
||||
// if(!getTunnelServiceInfo(item->tunnelId(),virtual_peer_id,hash,service))
|
||||
// return ;
|
||||
//
|
||||
// service->receiveTurtleData(item->data_bytes,item->data_size,hash,virtual_peer_id,item->travelingDirection()) ;
|
||||
//}
|
||||
|
||||
bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,std::string& vpid,std::string& hash,RsTurtleClientService *& service)
|
||||
bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,RsPeerId& vpid,RsFileHash& hash,RsTurtleClientService *& service)
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -1140,7 +1127,7 @@ bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,std::string& vpid,s
|
|||
|
||||
// Now sort out the case of client vs. server side items.
|
||||
//
|
||||
std::string ownid = mLinkMgr->getOwnId() ;
|
||||
RsPeerId ownid = mLinkMgr->getOwnId() ;
|
||||
|
||||
if(tunnel.local_src == ownid)
|
||||
{
|
||||
|
@ -1176,7 +1163,7 @@ bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,std::string& vpid,s
|
|||
}
|
||||
// Send a data request into the correct tunnel for the given file hash
|
||||
//
|
||||
void p3turtle::sendTurtleData(const std::string& virtual_peer_id,RsTurtleGenericTunnelItem *item)
|
||||
void p3turtle::sendTurtleData(const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem *item)
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -1204,7 +1191,7 @@ void p3turtle::sendTurtleData(const std::string& virtual_peer_id,RsTurtleGeneric
|
|||
|
||||
item->tunnel_id = tunnel_id ; // we should randomly select a tunnel, or something more clever.
|
||||
|
||||
std::string ownid = mLinkMgr->getOwnId() ;
|
||||
RsPeerId ownid = mLinkMgr->getOwnId() ;
|
||||
uint32_t ss = item->serial_size() ;
|
||||
|
||||
if(item->shouldStampTunnel())
|
||||
|
@ -1237,14 +1224,14 @@ void p3turtle::sendTurtleData(const std::string& virtual_peer_id,RsTurtleGeneric
|
|||
sendItem(item) ;
|
||||
}
|
||||
|
||||
bool p3turtle::isTurtlePeer(const std::string& peer_id) const
|
||||
bool p3turtle::isTurtlePeer(const RsPeerId& peer_id) const
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
return _virtual_peers.find(peer_id) != _virtual_peers.end() ;
|
||||
}
|
||||
|
||||
std::string p3turtle::getTurtlePeerId(TurtleTunnelId tid) const
|
||||
RsPeerId p3turtle::getTurtlePeerId(TurtleTunnelId tid) const
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -1258,7 +1245,7 @@ std::string p3turtle::getTurtlePeerId(TurtleTunnelId tid) const
|
|||
return it->second.vpid ;
|
||||
}
|
||||
|
||||
bool p3turtle::isOnline(const std::string& peer_id) const
|
||||
bool p3turtle::isOnline(const RsPeerId& peer_id) const
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
@ -1278,7 +1265,7 @@ TurtleRequestId p3turtle::diggTunnel(const TurtleFileHash& hash)
|
|||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << "DiggTunnel: performing tunnel request. OwnId = " << mLinkMgr->getOwnId() << " for hash=" << hash << std::endl ;
|
||||
#endif
|
||||
while(mLinkMgr->getOwnId() == "")
|
||||
while(mLinkMgr->getOwnId().isNull())
|
||||
{
|
||||
std::cerr << "... waiting for connect manager to form own id." << std::endl ;
|
||||
#ifdef WIN32
|
||||
|
@ -1483,13 +1470,13 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||
|
||||
if(item->depth < TURTLE_MAX_SEARCH_DEPTH || random_bypass)
|
||||
{
|
||||
std::list<std::string> onlineIds ;
|
||||
std::list<RsPeerId> onlineIds ;
|
||||
mLinkMgr->getOnlineList(onlineIds);
|
||||
|
||||
for(std::list<std::string>::iterator it(onlineIds.begin());it!=onlineIds.end();)
|
||||
if(!(RS_SERVICE_PERM_TURTLE & rsPeers->servicePermissionFlags_sslid(*it)))
|
||||
for(std::list<RsPeerId>::iterator it(onlineIds.begin());it!=onlineIds.end();)
|
||||
if(!(RS_SERVICE_PERM_TURTLE & rsPeers->servicePermissionFlags(*it)))
|
||||
{
|
||||
std::list<std::string>::iterator tmp = it++ ;
|
||||
std::list<RsPeerId>::iterator tmp = it++ ;
|
||||
onlineIds.erase(tmp) ;
|
||||
}
|
||||
else
|
||||
|
@ -1513,7 +1500,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||
std::cerr << " Forwarding tunnel request: Looking for online peers" << std::endl ;
|
||||
#endif
|
||||
|
||||
for(std::list<std::string>::const_iterator it(onlineIds.begin());it!=onlineIds.end();++it)
|
||||
for(std::list<RsPeerId>::const_iterator it(onlineIds.begin());it!=onlineIds.end();++it)
|
||||
{
|
||||
uint32_t linkType = mLinkMgr->getLinkType(*it);
|
||||
|
||||
|
@ -1558,7 +1545,7 @@ void p3turtle::handleTunnelResult(RsTurtleTunnelOkItem *item)
|
|||
{
|
||||
bool new_tunnel = false ;
|
||||
TurtleFileHash new_hash ;
|
||||
std::string new_vpid ;
|
||||
RsPeerId new_vpid ;
|
||||
RsTurtleClientService *service = NULL ;
|
||||
|
||||
{
|
||||
|
@ -1773,7 +1760,7 @@ TurtleRequestId p3turtle::turtleSearch(const std::string& string_to_match)
|
|||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << "performing search. OwnId = " << mLinkMgr->getOwnId() << std::endl ;
|
||||
#endif
|
||||
while(mLinkMgr->getOwnId() == "")
|
||||
while(mLinkMgr->getOwnId().isNull())
|
||||
{
|
||||
std::cerr << "... waitting for connect manager to form own id." << std::endl ;
|
||||
#ifdef WIN32
|
||||
|
@ -1809,7 +1796,7 @@ TurtleRequestId p3turtle::turtleSearch(const LinearizedExpression& expr)
|
|||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << "performing search. OwnId = " << mLinkMgr->getOwnId() << std::endl ;
|
||||
#endif
|
||||
while(mLinkMgr->getOwnId() == "")
|
||||
while(mLinkMgr->getOwnId().isNull())
|
||||
{
|
||||
std::cerr << "... waitting for connect manager to form own id." << std::endl ;
|
||||
#ifdef WIN32
|
||||
|
@ -1833,7 +1820,7 @@ TurtleRequestId p3turtle::turtleSearch(const LinearizedExpression& expr)
|
|||
return id ;
|
||||
}
|
||||
|
||||
void p3turtle::monitorTunnels(const std::string& hash,RsTurtleClientService *client_service)
|
||||
void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *client_service)
|
||||
{
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
@ -1889,7 +1876,7 @@ void p3turtle::returnSearchResult(RsTurtleSearchResultItem *item)
|
|||
/// Warning: this function should never be called while the turtle mutex is locked.
|
||||
/// Otherwize this is a possible source of cross-lock with the File mutex.
|
||||
//
|
||||
bool p3turtle::performLocalHashSearch(const TurtleFileHash& hash,const std::string& peer_id,RsTurtleClientService *& service)
|
||||
bool p3turtle::performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& peer_id,RsTurtleClientService *& service)
|
||||
{
|
||||
if(_registered_services.empty())
|
||||
std::cerr << "Turtle router has no services registered. Tunnel requests cannot be handled." << std::endl;
|
||||
|
@ -1967,7 +1954,7 @@ void p3turtle::getTrafficStatistics(TurtleTrafficStatisticsInfo& info) const
|
|||
float distance_to_maximum = std::min(100.0f,info.tr_up_Bps/(float)(TUNNEL_REQUEST_PACKET_SIZE*_max_tr_up_rate)) ;
|
||||
info.forward_probabilities.clear() ;
|
||||
|
||||
std::list<std::string> onlineIds ;
|
||||
std::list<RsPeerId> onlineIds ;
|
||||
mLinkMgr->getOnlineList(onlineIds);
|
||||
|
||||
int nb_online_ids = onlineIds.size() ;
|
||||
|
@ -2006,7 +1993,7 @@ void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
|
|||
|
||||
std::vector<std::string>& hashes(hashes_info.back()) ;
|
||||
|
||||
hashes.push_back(it->first) ;
|
||||
hashes.push_back(it->first.toStdString()) ;
|
||||
//hashes.push_back(it->second.name) ;
|
||||
hashes.push_back("Name not available") ;
|
||||
hashes.push_back(printNumber(it->second.tunnels.size())) ;
|
||||
|
@ -2026,14 +2013,14 @@ void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
|
|||
if(mLinkMgr->getPeerName(it->second.local_src,name))
|
||||
tunnel.push_back(name) ;
|
||||
else
|
||||
tunnel.push_back(it->second.local_src) ;
|
||||
tunnel.push_back(it->second.local_src.toStdString()) ;
|
||||
|
||||
if(mLinkMgr->getPeerName(it->second.local_dst,name))
|
||||
tunnel.push_back(name) ;
|
||||
else
|
||||
tunnel.push_back(it->second.local_dst);
|
||||
tunnel.push_back(it->second.local_dst.toStdString());
|
||||
|
||||
tunnel.push_back(it->second.hash) ;
|
||||
tunnel.push_back(it->second.hash.toStdString()) ;
|
||||
tunnel.push_back(printNumber(now-it->second.time_stamp) + " secs ago") ;
|
||||
tunnel.push_back(printFloatNumber(it->second.speed_Bps,true)) ;
|
||||
}
|
||||
|
|
|
@ -250,12 +250,12 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
|
|||
// This function should be called in addition to ftServer::FileRequest() so that the turtle router
|
||||
// automatically provide tunnels for the file to download.
|
||||
//
|
||||
virtual void monitorTunnels(const std::string& file_hash,RsTurtleClientService *client_service) ;
|
||||
virtual void monitorTunnels(const RsFileHash& file_hash,RsTurtleClientService *client_service) ;
|
||||
|
||||
/// This should be called when canceling a file download, so that the turtle router stops
|
||||
/// handling tunnels for this file.
|
||||
///
|
||||
virtual void stopMonitoringTunnels(const std::string& file_hash) ;
|
||||
virtual void stopMonitoringTunnels(const RsFileHash& file_hash) ;
|
||||
|
||||
/// Adds a client tunnel service. This means that the service will be added
|
||||
/// to the list of services that might respond to tunnel requests.
|
||||
|
@ -292,23 +292,23 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
|
|||
/************* Communication with clients *******************/
|
||||
/// Does the turtle router manages tunnels to this peer ? (this is not a
|
||||
/// real id, but a fake one, that the turtle router is capable of connecting with a tunnel id).
|
||||
virtual bool isTurtlePeer(const std::string& peer_id) const ;
|
||||
virtual bool isTurtlePeer(const RsPeerId& peer_id) const ;
|
||||
|
||||
/// sets/gets the max number of forwarded tunnel requests per second.
|
||||
virtual void setMaxTRForwardRate(int max_tr_up_rate) ;
|
||||
virtual int getMaxTRForwardRate() const ;
|
||||
|
||||
/// Examines the peer id, finds the turtle tunnel in it, and respond yes if the tunnel is ok and operational.
|
||||
bool isOnline(const std::string& peer_id) const ;
|
||||
bool isOnline(const RsPeerId& peer_id) const ;
|
||||
|
||||
/// Returns a unique peer id, corresponding to the given tunnel.
|
||||
std::string getTurtlePeerId(TurtleTunnelId tid) const ;
|
||||
RsPeerId getTurtlePeerId(TurtleTunnelId tid) const ;
|
||||
|
||||
/// returns the list of virtual peers for all tunnels.
|
||||
void getSourceVirtualPeersList(const TurtleFileHash& hash,std::list<pqipeer>& list) ;
|
||||
|
||||
/// Send a data request into the correct tunnel for the given file hash
|
||||
void sendTurtleData(const std::string& virtual_peer_id, RsTurtleGenericTunnelItem *item) ;
|
||||
void sendTurtleData(const RsPeerId& virtual_peer_id, RsTurtleGenericTunnelItem *item) ;
|
||||
|
||||
private:
|
||||
//--------------------------- Admin/Helper functions -------------------------//
|
||||
|
@ -352,7 +352,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
|
|||
|
||||
/// specific routing functions for handling particular packets.
|
||||
void handleRecvGenericTunnelItem(RsTurtleGenericTunnelItem *item);
|
||||
bool getTunnelServiceInfo(TurtleTunnelId, std::string& virtual_peer_id, std::string& hash, RsTurtleClientService*&) ;
|
||||
bool getTunnelServiceInfo(TurtleTunnelId, RsPeerId& virtual_peer_id, RsFileHash& hash, RsTurtleClientService*&) ;
|
||||
|
||||
// following functions should go to ftServer
|
||||
void handleSearchRequest(RsTurtleSearchRequestItem *item);
|
||||
|
@ -369,7 +369,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
|
|||
void returnSearchResult(RsTurtleSearchResultItem *item) ;
|
||||
|
||||
/// Returns true if the file with given hash is hosted locally, and accessible in anonymous mode the supplied peer.
|
||||
virtual bool performLocalHashSearch(const TurtleFileHash& hash,const std::string& client_peer_id,RsTurtleClientService *& service);
|
||||
virtual bool performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& client_peer_id,RsTurtleClientService *& service);
|
||||
|
||||
//--------------------------- Local variables --------------------------------//
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ uint32_t RsTurtleSearchResultItem::serial_size()
|
|||
for(std::list<TurtleFileInfo>::const_iterator it(result.begin());it!=result.end();++it)
|
||||
{
|
||||
s += 8 ; // file size
|
||||
s += GetTlvStringSize(it->hash) ; // file hash
|
||||
s += it->hash.serial_size(); // file hash
|
||||
s += GetTlvStringSize(it->name) ; // file name
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ uint32_t RsTurtleOpenTunnelItem::serial_size()
|
|||
uint32_t s = 0 ;
|
||||
|
||||
s += 8 ; // header
|
||||
s += GetTlvStringSize(file_hash) ; // file hash
|
||||
s += file_hash.serial_size() ; // file hash
|
||||
s += 4 ; // tunnel request id
|
||||
s += 4 ; // partial tunnel id
|
||||
s += 2 ; // depth
|
||||
|
@ -333,8 +333,8 @@ bool RsTurtleSearchResultItem::serialize(void *data,uint32_t& pktsize)
|
|||
|
||||
for(std::list<TurtleFileInfo>::const_iterator it(result.begin());it!=result.end();++it)
|
||||
{
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, it->size); // file size
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_SHA1, it->hash); // file hash
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, it->size); // file size
|
||||
ok &= it->hash.serialise(data, tlvsize, offset); // file hash
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, it->name); // file name
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ RsTurtleSearchResultItem::RsTurtleSearchResultItem(void *data,uint32_t pktsize)
|
|||
TurtleFileInfo f ;
|
||||
|
||||
ok &= getRawUInt64(data, pktsize, &offset, &(f.size)); // file size
|
||||
ok &= GetTlvString(data, pktsize, &offset, TLV_TYPE_STR_HASH_SHA1, f.hash); // file hash
|
||||
ok &= f.hash.deserialise(data, pktsize, offset); // file hash
|
||||
ok &= GetTlvString(data, pktsize, &offset, TLV_TYPE_STR_NAME, f.name); // file name
|
||||
|
||||
result.push_back(f) ;
|
||||
|
@ -412,7 +412,7 @@ bool RsTurtleOpenTunnelItem::serialize(void *data,uint32_t& pktsize)
|
|||
|
||||
/* add mandatory parts first */
|
||||
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_SHA1, file_hash); // file hash
|
||||
ok &= file_hash.serialise(data, tlvsize, offset); // file hash
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, request_id);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, partial_tunnel_id);
|
||||
ok &= setRawUInt16(data, tlvsize, &offset, depth);
|
||||
|
@ -441,7 +441,7 @@ RsTurtleOpenTunnelItem::RsTurtleOpenTunnelItem(void *data,uint32_t pktsize)
|
|||
/* add mandatory parts first */
|
||||
|
||||
bool ok = true ;
|
||||
ok &= GetTlvString(data, pktsize, &offset, TLV_TYPE_STR_HASH_SHA1, file_hash); // file hash
|
||||
ok &= file_hash.deserialise(data, pktsize, offset); // file hash
|
||||
ok &= getRawUInt32(data, pktsize, &offset, &request_id);
|
||||
ok &= getRawUInt32(data, pktsize, &offset, &partial_tunnel_id) ;
|
||||
ok &= getRawUInt16(data, pktsize, &offset, &depth);
|
||||
|
|
|
@ -46,7 +46,7 @@ class RsTurtleClientService
|
|||
// The output info_string is used by the turtle router to display info about tunnels it manages. It is
|
||||
// not passed to the tunnel.
|
||||
|
||||
virtual bool handleTunnelRequest(const std::string& /*hash*/,const std::string& /*peer_id*/) { return false ; }
|
||||
virtual bool handleTunnelRequest(const RsFileHash& /*hash*/,const RsPeerId& /*peer_id*/) { return false ; }
|
||||
|
||||
// This method is called by the turtle router to send data that comes out of a turtle tunnel.
|
||||
// The turtle router stays responsible for the memory management of data. Most of the time the
|
||||
|
@ -66,7 +66,7 @@ class RsTurtleClientService
|
|||
// By default (if not overloaded), the method will just free the data, as any subclass should do as well.
|
||||
// Note: p3turtle stays owner of the item, so the client should not delete it!
|
||||
//
|
||||
virtual void receiveTurtleData(RsTurtleGenericTunnelItem */*item*/,const std::string& /*hash*/,const std::string& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/)
|
||||
virtual void receiveTurtleData(RsTurtleGenericTunnelItem */*item*/,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/)
|
||||
{
|
||||
std::cerr << "!!!!!! Received Data from turtle router, but the client service is not handling it !!!!!!!!!!" << std::endl ;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
#include "retroshare/rsturtle.h"
|
||||
|
||||
typedef std::string TurtlePeerId ;
|
||||
typedef std::string TurtleVirtualPeerId ;
|
||||
typedef std::string TurtleFileHash ;
|
||||
typedef RsPeerId TurtlePeerId ;
|
||||
typedef RsPeerId TurtleVirtualPeerId ;
|
||||
typedef RsFileHash TurtleFileHash ;
|
||||
typedef std::string TurtleFileName ;
|
||||
|
||||
typedef TurtleRequestId TurtleSearchRequestId ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue