- Exported ServiceInfoCompatible for GUI usage.

- Set the rsServiceControl variable.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7197 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-03-22 06:28:59 +00:00
parent 83a78bcaee
commit 3ecf4a0858
4 changed files with 24 additions and 2 deletions

View File

@ -141,6 +141,19 @@ void p3ServiceControl::getServiceChanges(std::set<RsPeerId> &updateSet)
}
bool p3ServiceControl::getOwnServices(RsPeerServiceInfo &info)
{
std::cerr << "p3ServiceControl::getOwnServices()";
std::cerr << std::endl;
RsStackMutex stack(mCtrlMtx); /***** LOCK STACK MUTEX ****/
info.mPeerId = "";
info.mServiceList = mOwnServices;
return true;
}
bool p3ServiceControl::getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info)
{
std::cerr << "p3ServiceControl::getServicesAllowed(" << peerId.toStdString() << ")";
@ -391,7 +404,7 @@ bool versionOkay(uint16_t version_major, uint16_t version_minor,
}
bool servicesCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2)
bool ServiceInfoCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2)
{
// Id, or Name mismatch.
if ((info1.mServiceType != info2.mServiceType) ||
@ -521,7 +534,7 @@ bool p3ServiceControl::updateFilterByPeer_locked(const RsPeerId &peerId)
std::cerr << std::endl;
/* match of service IDs */
/* check if compatible */
if (servicesCompatible(oit->second, tit->second))
if (ServiceInfoCompatible(oit->second, tit->second))
{
if (peerHasPermissionForService_locked(peerId, oit->first))
{

View File

@ -73,6 +73,8 @@ public:
* External Interface (RsServiceControl).
*/
virtual bool getOwnServices(RsPeerServiceInfo &info);
// This is what is passed to peers, can be displayed by GUI too.
virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info);

View File

@ -60,6 +60,10 @@ class RsServiceInfo
};
bool ServiceInfoCompatible(const RsServiceInfo &info1, const RsServiceInfo &info2);
/* this is what is transmitted to peers */
class RsPeerServiceInfo
{
@ -100,6 +104,8 @@ class RsServiceControl
RsServiceControl() { return; }
virtual ~RsServiceControl() { return; }
virtual bool getOwnServices(RsPeerServiceInfo &info) = 0;
virtual bool getServicesAllowed(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0;
virtual bool getServicesProvided(const RsPeerId &peerId, RsPeerServiceInfo &info) = 0;
virtual bool getServicePermissions(uint32_t serviceId, RsServicePermissions &permissions) = 0;

View File

@ -1223,6 +1223,7 @@ int RsServer::StartupRetroShare()
/**************************** BITDHT ***********************************/
p3ServiceControl *serviceCtrl = new p3ServiceControl(0);
rsServiceControl = serviceCtrl;
SecurityPolicy *none = secpolicy_create();
pqih = new pqisslpersongrp(serviceCtrl, none, flags, mPeerMgr);