Added basic ZeroConf interface.

- registers oneself, browses and resolves services.
 - Lots still TODO:
	- parse TxtRecords.
	- Track peers.
	- feedback to libretroshare
	- etc, etc.
Enabled ZeroConf in libretroshare.pro & rsinit.cc. Compiles and runs on OSX.
Added RelayHandler to Dht, to enable external control of Relays.
Marked pqiAssist Interface for changes... will be revamped with ZeroConf.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4727 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-12-13 16:19:37 +00:00
parent 2048bb5e47
commit 4d2175636e
9 changed files with 1488 additions and 19 deletions

View file

@ -118,6 +118,21 @@ class PeerAction
/******
* Adding the ability to install alternative Handler
* for monitoring/controlling Relay Connections outside of p3bitdht.
***/
class p3BitDhtRelayHandler
{
public:
int (*mInstallRelay)(const bdId *srcId, const bdId *destId, uint32_t mode, uint32_t &bandwidth);
int (*mLogFailedConnection)(const bdId *srcId, const bdId *destId, uint32_t mode, uint32_t errcode);
};
class UdpRelayReceiver;
class UdpStunner;
@ -251,6 +266,14 @@ void UdpConnectionFailed_locked(DhtPeerDetails *dpd);
void ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrChgLikely);
/*** RELAY HANDLER CODE ***/
void installRelayHandler(p3BitDhtRelayHandler *);
UdpRelayReceiver *getRelayReceiver();
int RelayHandler_InstallRelayConnection(const bdId *srcId, const bdId *destId, uint32_t mode, uint32_t &bandwidth);
int RelayHandler_LogFailedProxyAttempt(const bdId *srcId, const bdId *destId, uint32_t mode, uint32_t errcode);
/***********************************************************************************************
************************** Internal Accounting (p3bitdht_peers.cc) ****************************
************************************************************************************************/
@ -264,6 +287,9 @@ void ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrChgLikely);
//int addOther(const std::string pid);
int removePeer(const std::string pid);
// Can be used externally too.
int calculateNodeId(const std::string pid, bdNodeId *id);
private:
DhtPeerDetails *addInternalPeer_locked(const std::string pid, int type);
@ -276,7 +302,6 @@ int lookupNodeId_locked(const std::string pid, bdNodeId *id);
int lookupRsId_locked(const bdNodeId *id, std::string &pid);
int storeTranslation_locked(const std::string pid);
int removeTranslation_locked(const std::string pid);
int calculateNodeId(const std::string pid, bdNodeId *id);
UdpBitDht *mUdpBitDht; /* has own mutex, is static except for creation/destruction */
UdpStunner *mDhtStunner;
@ -289,6 +314,9 @@ int calculateNodeId(const std::string pid, bdNodeId *id);
RsMutex dhtMtx;
p3BitDhtRelayHandler *mRelayHandler;
std::string mOwnRsId;
bdNodeId mOwnDhtId;