mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1335 from sehraf/pr_jsonfy
Make more APIs jsonapi compatible
This commit is contained in:
commit
cb83abf932
@ -30,6 +30,11 @@
|
||||
|
||||
/* The New Config Interface Class */
|
||||
class RsServerConfig;
|
||||
|
||||
/**
|
||||
* Pointer to global instance of RsServerConfig service implementation
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsServerConfig *rsConfig;
|
||||
|
||||
#define RSNET_NETWORK_UNKNOWN 1
|
||||
@ -129,26 +134,15 @@ int promptAtBoot; /* popup the password prompt */
|
||||
};
|
||||
|
||||
|
||||
class RsConfigDataRates
|
||||
struct RsConfigDataRates : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsConfigDataRates()
|
||||
{
|
||||
mRateIn = 0;
|
||||
mRateMaxIn = 0;
|
||||
mAllocIn = 0;
|
||||
|
||||
mAllocTs = 0;
|
||||
|
||||
mRateOut = 0;
|
||||
mRateMaxOut = 0;
|
||||
mAllowedOut = 0;
|
||||
|
||||
mAllowedTs = 0;
|
||||
|
||||
mQueueIn = 0;
|
||||
mQueueOut = 0;
|
||||
}
|
||||
RsConfigDataRates() :
|
||||
mRateIn(0), mRateMaxIn(0), mAllocIn(0),
|
||||
mAllocTs(0),
|
||||
mRateOut(0), mRateMaxOut(0), mAllowedOut(0),
|
||||
mAllowedTs(0),
|
||||
mQueueIn(0), mQueueOut(0)
|
||||
{}
|
||||
|
||||
/* all in kB/s */
|
||||
float mRateIn;
|
||||
@ -165,11 +159,28 @@ class RsConfigDataRates
|
||||
|
||||
int mQueueIn;
|
||||
int mQueueOut;
|
||||
|
||||
// RsSerializable interface
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
RS_SERIAL_PROCESS(mRateIn);
|
||||
RS_SERIAL_PROCESS(mRateMaxIn);
|
||||
RS_SERIAL_PROCESS(mAllocIn);
|
||||
|
||||
RS_SERIAL_PROCESS(mAllocTs);
|
||||
|
||||
RS_SERIAL_PROCESS(mRateOut);
|
||||
RS_SERIAL_PROCESS(mRateMaxOut);
|
||||
RS_SERIAL_PROCESS(mAllowedOut);
|
||||
|
||||
RS_SERIAL_PROCESS(mAllowedTs);
|
||||
|
||||
RS_SERIAL_PROCESS(mQueueIn);
|
||||
RS_SERIAL_PROCESS(mQueueOut);
|
||||
}
|
||||
};
|
||||
|
||||
class RSTrafficClue
|
||||
struct RSTrafficClue : RsSerializable
|
||||
{
|
||||
public:
|
||||
time_t TS ;
|
||||
uint32_t size ;
|
||||
uint8_t priority ;
|
||||
@ -180,11 +191,21 @@ public:
|
||||
|
||||
RSTrafficClue() { TS=0;size=0;service_id=0;service_sub_id=0; count=0; }
|
||||
RSTrafficClue& operator+=(const RSTrafficClue& tc) { size += tc.size; count += tc.count ; return *this ;}
|
||||
|
||||
// RsSerializable interface
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
RS_SERIAL_PROCESS(TS);
|
||||
RS_SERIAL_PROCESS(size);
|
||||
RS_SERIAL_PROCESS(priority);
|
||||
RS_SERIAL_PROCESS(service_id);
|
||||
RS_SERIAL_PROCESS(service_sub_id);
|
||||
RS_SERIAL_PROCESS(peer_id);
|
||||
RS_SERIAL_PROCESS(count);
|
||||
}
|
||||
};
|
||||
|
||||
class RsConfigNetStatus
|
||||
struct RsConfigNetStatus : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsConfigNetStatus()
|
||||
{
|
||||
localPort = extPort = 0 ;
|
||||
@ -222,6 +243,35 @@ class RsConfigNetStatus
|
||||
|
||||
uint32_t netDhtNetSize; /* response from dht */
|
||||
uint32_t netDhtRsNetSize;/* response from dht */
|
||||
|
||||
// RsSerializable interface
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
RS_SERIAL_PROCESS(ownId);
|
||||
RS_SERIAL_PROCESS(ownName);
|
||||
|
||||
RS_SERIAL_PROCESS(localAddr);
|
||||
RS_SERIAL_PROCESS(localPort);
|
||||
RS_SERIAL_PROCESS(extAddr);
|
||||
RS_SERIAL_PROCESS(extPort);
|
||||
RS_SERIAL_PROCESS(extDynDns);
|
||||
|
||||
RS_SERIAL_PROCESS(firewalled);
|
||||
RS_SERIAL_PROCESS(forwardPort);
|
||||
|
||||
RS_SERIAL_PROCESS(DHTActive);
|
||||
RS_SERIAL_PROCESS(uPnPActive);
|
||||
|
||||
RS_SERIAL_PROCESS(uPnPState);
|
||||
|
||||
RS_SERIAL_PROCESS(netLocalOk);
|
||||
RS_SERIAL_PROCESS(netUpnpOk);
|
||||
RS_SERIAL_PROCESS(netDhtOk);
|
||||
RS_SERIAL_PROCESS(netStunOk);
|
||||
RS_SERIAL_PROCESS(netExtAddressOk);
|
||||
|
||||
RS_SERIAL_PROCESS(netDhtNetSize);
|
||||
RS_SERIAL_PROCESS(netDhtRsNetSize);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -243,13 +293,40 @@ public:
|
||||
|
||||
/* From RsIface::RsConfig */
|
||||
// Implemented Only this one!
|
||||
/**
|
||||
* @brief getConfigNetStatus return the net status
|
||||
* @jsonapi{development}
|
||||
* @param[out] status network status
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int getConfigNetStatus(RsConfigNetStatus &status) = 0;
|
||||
|
||||
// NOT IMPLEMENTED YET!
|
||||
//virtual int getConfigStartup(RsConfigStartup ¶ms) = 0;
|
||||
|
||||
/**
|
||||
* @brief getTotalBandwidthRates returns the current bandwidths rates
|
||||
* @jsonapi{development}
|
||||
* @param[out] rates
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int getTotalBandwidthRates(RsConfigDataRates &rates) = 0;
|
||||
|
||||
/**
|
||||
* @brief getAllBandwidthRates get the bandwidth rates for all peers
|
||||
* @jsonapi{development}
|
||||
* @param[out] ratemap map with peers->rates
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int getAllBandwidthRates(std::map<RsPeerId, RsConfigDataRates> &ratemap) = 0;
|
||||
|
||||
/**
|
||||
* @brief getTrafficInfo returns a list of all tracked traffic clues
|
||||
* @jsonapi{development}
|
||||
* @param[out] out_lst outgoing traffic clues
|
||||
* @param[out] in_lst incomming traffic clues
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int getTrafficInfo(std::list<RSTrafficClue>& out_lst,std::list<RSTrafficClue>& in_lst) = 0 ;
|
||||
|
||||
/* From RsInit */
|
||||
@ -283,14 +360,54 @@ public:
|
||||
|
||||
|
||||
/* Operating Mode */
|
||||
/**
|
||||
* @brief getOperatingMode get current operating mode
|
||||
* @jsonapi{development}
|
||||
* @return return the current operating mode
|
||||
*/
|
||||
virtual uint32_t getOperatingMode() = 0;
|
||||
|
||||
/**
|
||||
* @brief setOperatingMode set the current oprating mode
|
||||
* @jsonapi{development}
|
||||
* @param[in] opMode new opearting mode
|
||||
* @return
|
||||
*/
|
||||
virtual bool setOperatingMode(uint32_t opMode) = 0;
|
||||
|
||||
/**
|
||||
* @brief setOperatingMode set the current operating mode from string
|
||||
* @param[in] opModeStr new operating mode as string
|
||||
* @return
|
||||
*/
|
||||
virtual bool setOperatingMode(const std::string &opModeStr) = 0;
|
||||
|
||||
/* Data Rate Control - to be moved here */
|
||||
/**
|
||||
* @brief SetMaxDataRates set maximum upload and download rates
|
||||
* @jsonapi{development}
|
||||
* @param[in] downKb download rate in kB
|
||||
* @param[in] upKb upload rate in kB
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int SetMaxDataRates( int downKb, int upKb ) = 0;
|
||||
|
||||
/**
|
||||
* @brief GetMaxDataRates get maximum upload and download rates
|
||||
* @jsonapi{development}
|
||||
* @param[out] inKb download rate in kB
|
||||
* @param[out] outKb upload rate in kB
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int GetMaxDataRates( int &inKb, int &outKb ) = 0;
|
||||
|
||||
/**
|
||||
* @brief GetCurrentDataRates get current upload and download rates
|
||||
* @jsonapi{development}
|
||||
* @param[out] inKb download rate in kB
|
||||
* @param[out] outKb upload rate in kB
|
||||
* @return returns 1 on succes and 0 otherwise
|
||||
*/
|
||||
virtual int GetCurrentDataRates( float &inKb, float &outKb ) = 0;
|
||||
};
|
||||
|
||||
|
@ -30,20 +30,55 @@
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsDisc;
|
||||
|
||||
/**
|
||||
* Pointer to global instance of RsDisc service implementation
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsDisc *rsDisc;
|
||||
|
||||
class RsDisc
|
||||
{
|
||||
public:
|
||||
|
||||
RsDisc() { return; }
|
||||
virtual ~RsDisc() { return; }
|
||||
RsDisc() {}
|
||||
virtual ~RsDisc() {}
|
||||
|
||||
/**
|
||||
* @brief getDiscFriends get a list with all friends (ssl id) to a given friend (ssl id)
|
||||
* @jsonapi{development}
|
||||
* @param[in] id peer to get the friends of
|
||||
* @param[out] friends list of friends (ssl id)
|
||||
* @return true on success false otherwise
|
||||
*/
|
||||
virtual bool getDiscFriends(const RsPeerId &id, std::list<RsPeerId>& friends) = 0;
|
||||
virtual bool getDiscPgpFriends(const RsPgpId &pgpid, std::list<RsPgpId>& gpg_friends) = 0;
|
||||
virtual bool getPeerVersion(const RsPeerId &id, std::string &versions) = 0;
|
||||
virtual bool getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount) = 0;
|
||||
|
||||
/**
|
||||
* @brief getDiscPgpFriends get a list with all friends (pgp id) to a given friend (pgp id)
|
||||
* @jsonapi{development}
|
||||
* @param[in] pgpid peer to get the friends of
|
||||
* @param[out] gpg_friends list of friends (gpg id)
|
||||
* @return true on success false otherwise
|
||||
*/
|
||||
virtual bool getDiscPgpFriends(const RsPgpId &pgpid, std::list<RsPgpId>& gpg_friends) = 0;
|
||||
|
||||
/**
|
||||
* @brief getPeerVersion get the version string of a peer.
|
||||
* @jsonapi{development}
|
||||
* @param[in] id peer to get the version string of
|
||||
* @param[out] versions version string sent by the peer
|
||||
* @return true on success false otherwise
|
||||
*/
|
||||
virtual bool getPeerVersion(const RsPeerId &id, std::string &versions) = 0;
|
||||
|
||||
/**
|
||||
* @brief getWaitingDiscCount get the number of queued discovery packets.
|
||||
* @jsonapi{development}
|
||||
* @param[out] sendCount number of queued outgoing packets
|
||||
* @param[out] recvCount number of queued incoming packets
|
||||
* @return true on success false otherwise
|
||||
*/
|
||||
virtual bool getWaitingDiscCount(size_t &sendCount, size_t &recvCount) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -600,14 +600,76 @@ public:
|
||||
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
|
||||
|
||||
/* Group Stuff */
|
||||
/**
|
||||
* @brief addGroup create a new group
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupInfo
|
||||
* @return
|
||||
*/
|
||||
virtual bool addGroup(RsGroupInfo& groupInfo) = 0;
|
||||
|
||||
/**
|
||||
* @brief editGroup edit an existing group
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId
|
||||
* @param[in] groupInfo
|
||||
* @return
|
||||
*/
|
||||
virtual bool editGroup(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
|
||||
/**
|
||||
* @brief removeGroup remove a group
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId
|
||||
* @return
|
||||
*/
|
||||
virtual bool removeGroup(const RsNodeGroupId& groupId) = 0;
|
||||
|
||||
/**
|
||||
* @brief getGroupInfo get group information to one group
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId
|
||||
* @param[out] groupInfo
|
||||
* @return
|
||||
*/
|
||||
virtual bool getGroupInfo(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool getGroupInfoByName(const std::string& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
|
||||
/**
|
||||
* @brief getGroupInfoByName get group information by group name
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupName
|
||||
* @param[out] groupInfo
|
||||
* @return
|
||||
*/
|
||||
virtual bool getGroupInfoByName(const std::string& groupName, RsGroupInfo& groupInfo) = 0;
|
||||
|
||||
/**
|
||||
* @brief getGroupInfoList get list of all groups
|
||||
* @jsonapi{development}
|
||||
* @param[out] groupInfoList
|
||||
* @return
|
||||
*/
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo>& groupInfoList) = 0;
|
||||
|
||||
// groupId == "" && assign == false -> remove from all groups
|
||||
/**
|
||||
* @brief assignPeerToGroup add a peer to a group
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId
|
||||
* @param[in] peerId
|
||||
* @param[in] assign true to assign a peer, false to remove a peer
|
||||
* @return
|
||||
*/
|
||||
virtual bool assignPeerToGroup(const RsNodeGroupId& groupId, const RsPgpId& peerId, bool assign) = 0;
|
||||
|
||||
/**
|
||||
* @brief assignPeersToGroup add a list of peers to a group
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId
|
||||
* @param[in] peerIds
|
||||
* @param[in] assign true to assign a peer, false to remove a peer
|
||||
* @return
|
||||
*/
|
||||
virtual bool assignPeersToGroup(const RsNodeGroupId& groupId, const std::list<RsPgpId>& peerIds, bool assign) = 0;
|
||||
|
||||
/* Group sharing permission */
|
||||
|
@ -31,11 +31,15 @@
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsServiceControl;
|
||||
|
||||
/**
|
||||
* Pointer to global instance of RsServiceControl service implementation
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsServiceControl *rsServiceControl;
|
||||
|
||||
class RsServiceInfo
|
||||
struct RsServiceInfo : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsServiceInfo();
|
||||
RsServiceInfo(
|
||||
const uint16_t service_type,
|
||||
@ -45,6 +49,8 @@ class RsServiceInfo
|
||||
const uint16_t min_version_major,
|
||||
const uint16_t min_version_minor);
|
||||
|
||||
static unsigned int RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType);
|
||||
|
||||
std::string mServiceName;
|
||||
uint32_t mServiceType;
|
||||
// current version, we running.
|
||||
@ -54,32 +60,40 @@ class RsServiceInfo
|
||||
uint16_t mMinVersionMajor;
|
||||
uint16_t mMinVersionMinor;
|
||||
|
||||
static unsigned int RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType);
|
||||
// RsSerializable interface
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
RS_SERIAL_PROCESS(mServiceName);
|
||||
RS_SERIAL_PROCESS(mServiceType);
|
||||
RS_SERIAL_PROCESS(mVersionMajor);
|
||||
RS_SERIAL_PROCESS(mVersionMinor);
|
||||
RS_SERIAL_PROCESS(mMinVersionMajor);
|
||||
RS_SERIAL_PROCESS(mMinVersionMinor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool ServiceInfoCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2);
|
||||
|
||||
|
||||
|
||||
/* this is what is transmitted to peers */
|
||||
class RsPeerServiceInfo
|
||||
struct RsPeerServiceInfo : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsPeerServiceInfo()
|
||||
:mPeerId(), mServiceList() { return; }
|
||||
RsPeerServiceInfo() : mPeerId(), mServiceList() {}
|
||||
|
||||
RsPeerId mPeerId;
|
||||
std::map<uint32_t, RsServiceInfo> mServiceList;
|
||||
|
||||
// RsSerializable interface
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
RS_SERIAL_PROCESS(mPeerId);
|
||||
RS_SERIAL_PROCESS(mServiceList);
|
||||
}
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPeerServiceInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const RsServiceInfo &info);
|
||||
|
||||
|
||||
class RsServicePermissions
|
||||
struct RsServicePermissions : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsServicePermissions();
|
||||
|
||||
bool peerHasPermission(const RsPeerId &peerId) const;
|
||||
@ -96,26 +110,94 @@ public:
|
||||
// if DefaultAllowed = false, then only PeersAllowed is checked.
|
||||
std::set<RsPeerId> mPeersAllowed;
|
||||
std::set<RsPeerId> mPeersDenied;
|
||||
|
||||
// RsSerializable interface
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
RS_SERIAL_PROCESS(mServiceId);
|
||||
RS_SERIAL_PROCESS(mServiceName);
|
||||
|
||||
RS_SERIAL_PROCESS(mDefaultAllowed);
|
||||
|
||||
RS_SERIAL_PROCESS(mPeersAllowed);
|
||||
RS_SERIAL_PROCESS(mPeersDenied);
|
||||
}
|
||||
};
|
||||
|
||||
class RsServiceControl
|
||||
{
|
||||
public:
|
||||
|
||||
RsServiceControl() { return; }
|
||||
virtual ~RsServiceControl() { return; }
|
||||
RsServiceControl() {}
|
||||
virtual ~RsServiceControl(){}
|
||||
|
||||
/**
|
||||
* @brief getOwnServices return a map off all services.
|
||||
* @jsonapi{development}
|
||||
* @param[out] info
|
||||
* @return always true
|
||||
*/
|
||||
virtual bool getOwnServices(RsPeerServiceInfo &info) = 0;
|
||||
virtual std::string getServiceName(uint32_t service_id) = 0;
|
||||
virtual bool getServiceItemNames(uint32_t service_id,std::map<uint8_t,std::string>& names) = 0;
|
||||
|
||||
/**
|
||||
* @brief getServiceName lookup the name of a service.
|
||||
* @jsonapi{development}
|
||||
* @param[in] service_id service to look up
|
||||
* @return name of service
|
||||
*/
|
||||
virtual std::string getServiceName(uint32_t serviceId) = 0;
|
||||
|
||||
/**
|
||||
* @brief getServiceItemNames return a map of service item names.
|
||||
* @jsonapi{development}
|
||||
* @param[in] service_id service to look up
|
||||
* @param[out] names names of items
|
||||
* @return true on success false otherwise
|
||||
*/
|
||||
virtual bool getServiceItemNames(uint32_t serviceId, std::map<uint8_t,std::string>& names) = 0;
|
||||
|
||||
/**
|
||||
* @brief getServicesAllowed return a mpa with allowed service information.
|
||||
* @jsonapi{development}
|
||||
* @param[in] peerId peer to look up
|
||||
* @param[out] info map with infomration
|
||||
* @return always true
|
||||
*/
|
||||
virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0;
|
||||
|
||||
/**
|
||||
* @brief getServicesProvided return services provided by a peer.
|
||||
* @jsonapi{development}
|
||||
* @param[in] peerId peer to look up
|
||||
* @param[out] info
|
||||
* @return true on success false otherwise.
|
||||
*/
|
||||
virtual bool getServicesProvided(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0;
|
||||
|
||||
/**
|
||||
* @brief getServicePermissions return permissions of one service.
|
||||
* @jsonapi{development}
|
||||
* @param[in] serviceId service id to look up
|
||||
* @param[out] permissions
|
||||
* @return true on success false otherwise.
|
||||
*/
|
||||
virtual bool getServicePermissions(uint32_t serviceId, RsServicePermissions &permissions) = 0;
|
||||
|
||||
/**
|
||||
* @brief updateServicePermissions update service permissions of one service.
|
||||
* @jsonapi{development}
|
||||
* @param[in] serviceId service to update
|
||||
* @param[in] permissions new permissions
|
||||
* @return true on success false otherwise.
|
||||
*/
|
||||
virtual bool updateServicePermissions(uint32_t serviceId, const RsServicePermissions &permissions) = 0;
|
||||
|
||||
/**
|
||||
* @brief getPeersConnected return peers using a service.
|
||||
* @jsonapi{development}
|
||||
* @param[in] serviceId service to look up.
|
||||
* @param[out] peerSet set of peers using this service.
|
||||
*/
|
||||
virtual void getPeersConnected(const uint32_t serviceId, std::set<RsPeerId> &peerSet) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1177,6 +1177,15 @@ bool p3discovery2::getDiscFriends(const RsPeerId& id, std::list<RsPeerId> &proxy
|
||||
|
||||
}
|
||||
|
||||
bool p3discovery2::getWaitingDiscCount(size_t &sendCount, size_t &recvCount)
|
||||
{
|
||||
RS_STACK_MUTEX(mDiscMtx);
|
||||
sendCount = mPendingDiscPgpCertOutList.size();
|
||||
recvCount = mPendingDiscPgpCertInList.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool p3discovery2::getDiscPgpFriends(const PGPID &pgp_id, std::list<PGPID> &proxyPgpIds)
|
||||
{
|
||||
@ -1238,27 +1247,6 @@ bool p3discovery2::setPeerVersion(const SSLID &peerId, const std::string &versio
|
||||
}
|
||||
|
||||
|
||||
bool p3discovery2::getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount)
|
||||
{
|
||||
if (sendCount == NULL && recvCount == NULL) {
|
||||
/* Nothing to do */
|
||||
return false;
|
||||
}
|
||||
|
||||
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
if (sendCount) {
|
||||
*sendCount = mPendingDiscPgpCertOutList.size();
|
||||
}
|
||||
|
||||
if (recvCount) {
|
||||
*recvCount = mPendingDiscPgpCertInList.size();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
/* AuthGPGService */
|
||||
/*************************************************************************************/
|
||||
|
@ -87,11 +87,10 @@ virtual RsServiceInfo getServiceInfo();
|
||||
int tick();
|
||||
|
||||
/* external interface */
|
||||
virtual bool getDiscFriends(const RsPeerId &id, std::list<RsPeerId> &friends);
|
||||
virtual bool getDiscPgpFriends(const RsPgpId &pgpid, std::list<RsPgpId> &gpg_friends);
|
||||
virtual bool getPeerVersion(const RsPeerId &id, std::string &version);
|
||||
virtual bool getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount);
|
||||
|
||||
bool getDiscFriends(const RsPeerId &id, std::list<RsPeerId> &friends);
|
||||
bool getDiscPgpFriends(const RsPgpId &pgpid, std::list<RsPgpId> &gpg_friends);
|
||||
bool getPeerVersion(const RsPeerId &id, std::string &version);
|
||||
bool getWaitingDiscCount(size_t &sendCount, size_t &recvCount);
|
||||
/************* from AuthGPService ****************/
|
||||
virtual AuthGPGOperation *getGPGOperation();
|
||||
virtual void setGPGOperation(AuthGPGOperation *operation);
|
||||
|
@ -66,10 +66,10 @@ void DiscStatus::update()
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int sendCount = 0;
|
||||
unsigned int recvCount = 0;
|
||||
size_t sendCount = 0;
|
||||
size_t recvCount = 0;
|
||||
|
||||
rsDisc->getWaitingDiscCount(&sendCount, &recvCount);
|
||||
rsDisc->getWaitingDiscCount(sendCount, recvCount);
|
||||
|
||||
sendLabel->setText(QString::number(sendCount));
|
||||
recvLabel->setText(QString::number(recvCount));
|
||||
|
Loading…
Reference in New Issue
Block a user