mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-01 12:24:36 -04:00
fixed compilation, added missing methods for new distant chat
This commit is contained in:
parent
6ca49a2d98
commit
a29f15ae32
13 changed files with 124 additions and 46 deletions
|
@ -58,6 +58,8 @@ static const uint32_t RS_GXS_TUNNEL_DELAY_BETWEEN_RESEND = 10 ; // re-send ever
|
|||
static const uint32_t GXS_TUNNEL_ENCRYPTION_HMAC_SIZE = SHA_DIGEST_LENGTH ;
|
||||
static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ;
|
||||
|
||||
RsGxsTunnelService *rsGxsTunnel = NULL ;
|
||||
|
||||
p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids)
|
||||
: mGixs(pids), mGxsTunnelMtx("GXS tunnel")
|
||||
{
|
||||
|
@ -73,6 +75,22 @@ void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr)
|
|||
tr->registerTunnelService(this) ;
|
||||
}
|
||||
|
||||
bool p3GxsTunnelService::registerClientService(uint32_t service_id,RsGxsTunnelService::RsGxsTunnelClientService *service)
|
||||
{
|
||||
RS_STACK_MUTEX(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
if(mRegisteredServices.find(service_id) != mRegisteredServices.end())
|
||||
{
|
||||
std::cerr << "(EE) p3GxsTunnelService::registerClientService(): trying to register client " << std::hex << service_id << std::dec << ", which is already registered!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "p3GxsTunnelService::registerClientService(): registering client service " << std::hex << service_id << std::dec << std::endl;
|
||||
|
||||
mRegisteredServices[service_id] = service ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
void p3GxsTunnelService::flush()
|
||||
{
|
||||
// Flush pending DH items. This is a higher priority, so we deal with them first.
|
||||
|
@ -1193,6 +1211,31 @@ RsGxsId p3GxsTunnelService::destinationGxsIdFromHash(const TurtleFileHash& sum)
|
|||
return RsGxsId(sum.toByteArray());// takes the first 16 bytes
|
||||
}
|
||||
|
||||
bool p3GxsTunnelService::getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelInfo& info)
|
||||
{
|
||||
RsStackMutex stack(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<RsGxsTunnelId,GxsTunnelPeerInfo>::const_iterator it = _gxs_tunnel_contacts.find(tunnel_id) ;
|
||||
|
||||
if(it == _gxs_tunnel_contacts.end())
|
||||
return false ;
|
||||
|
||||
info.destination_gxs_id = it->second.to_gxs_id;
|
||||
info.source_gxs_id = it->second.own_gxs_id;
|
||||
info.tunnel_status = it->second.status;
|
||||
#warning data missing here
|
||||
info.total_size_sent = 0;
|
||||
info.total_size_received= 0;
|
||||
|
||||
// Data packets
|
||||
|
||||
info.pending_data_packets = 0;
|
||||
info.total_data_packets_sent=0 ;
|
||||
info.total_data_packets_received=0 ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3GxsTunnelService::getTunnelStatus(const RsGxsTunnelId& tunnel_id,uint32_t& status)
|
||||
{
|
||||
RsStackMutex stack(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
|
||||
|
|
|
@ -126,6 +126,7 @@ public:
|
|||
|
||||
virtual bool closeExistingTunnel(const RsGxsTunnelId &tunnel_id) ;
|
||||
virtual bool getTunnelStatus(const RsGxsTunnelId& tunnel_id,uint32_t &status);
|
||||
virtual bool getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelInfo& info);
|
||||
virtual bool sendData(const RsGxsTunnelId& tunnel_id,uint32_t service_id,const uint8_t *data,uint32_t size) ;
|
||||
|
||||
virtual bool registerClientService(uint32_t service_id,RsGxsTunnelClientService *service) ;
|
||||
|
|
|
@ -333,7 +333,7 @@ bool RsGxsTunnelDataAckItem::serialise(void *data, uint32_t& pktsize)
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
RsGxsTunnelDHPublicKeyItem *deserialise_RsGxsTunnelDHPublicKeyItem(void *data,uint32_t /*size*/)
|
||||
RsGxsTunnelDHPublicKeyItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelDHPublicKeyItem(void *data,uint32_t /*size*/)
|
||||
{
|
||||
uint32_t offset = 8; // skip the header
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
@ -367,7 +367,7 @@ RsGxsTunnelDHPublicKeyItem *deserialise_RsGxsTunnelDHPublicKeyItem(void *data,ui
|
|||
return item ;
|
||||
}
|
||||
|
||||
RsGxsTunnelDataItem *deserialise_RsGxsTunnelDataItem(void *dat,uint32_t size)
|
||||
RsGxsTunnelDataItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelDataItem(void *dat,uint32_t size)
|
||||
{
|
||||
uint32_t offset = 8; // skip the header
|
||||
uint32_t rssize = getRsItemSize(dat);
|
||||
|
@ -415,7 +415,7 @@ RsGxsTunnelDataItem *deserialise_RsGxsTunnelDataItem(void *dat,uint32_t size)
|
|||
return item ;
|
||||
}
|
||||
|
||||
RsGxsTunnelDataAckItem *deserialise_RsGxsTunnelDataAckItem(void *dat,uint32_t /* size */)
|
||||
RsGxsTunnelDataAckItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelDataAckItem(void *dat,uint32_t /* size */)
|
||||
{
|
||||
uint32_t offset = 8; // skip the header
|
||||
uint32_t rssize = getRsItemSize(dat);
|
||||
|
@ -443,7 +443,7 @@ RsGxsTunnelDataAckItem *deserialise_RsGxsTunnelDataAckItem(void *dat,uint32_t /*
|
|||
return item ;
|
||||
}
|
||||
|
||||
RsGxsTunnelStatusItem *deserialise_RsGxsTunnelStatusItem(void *dat,uint32_t size)
|
||||
RsGxsTunnelStatusItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelStatusItem(void *dat,uint32_t size)
|
||||
{
|
||||
uint32_t offset = 8; // skip the header
|
||||
uint32_t rssize = getRsItemSize(dat);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue