mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-01 11:21:25 -05:00
Networking REWORK: Changes for other bits
* Fixed #includes in upnp * switched p3disc over to the new data types. * added new source to .pro file * minor changes to other code. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3249 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8745c2fe2e
commit
ae4ee9df00
@ -214,7 +214,9 @@ HEADERS += dbase/cachestrapper.h \
|
|||||||
# ft/ftdwlqueue.h \
|
# ft/ftdwlqueue.h \
|
||||||
pqi/sslfns.h \
|
pqi/sslfns.h \
|
||||||
pqi/authssl.h \
|
pqi/authssl.h \
|
||||||
|
pqi/authssltest.h \
|
||||||
pqi/authgpg.h \
|
pqi/authgpg.h \
|
||||||
|
pqi/authgpgtest.h \
|
||||||
pqi/cleanupxpgp.h \
|
pqi/cleanupxpgp.h \
|
||||||
# pqi/p3authmgr.h \
|
# pqi/p3authmgr.h \
|
||||||
pqi/p3cfgmgr.h \
|
pqi/p3cfgmgr.h \
|
||||||
@ -230,6 +232,7 @@ HEADERS += dbase/cachestrapper.h \
|
|||||||
pqi/pqihandler.h \
|
pqi/pqihandler.h \
|
||||||
pqi/pqihash.h \
|
pqi/pqihash.h \
|
||||||
pqi/pqiindic.h \
|
pqi/pqiindic.h \
|
||||||
|
pqi/pqiipset.h \
|
||||||
pqi/pqilistener.h \
|
pqi/pqilistener.h \
|
||||||
pqi/pqiloopback.h \
|
pqi/pqiloopback.h \
|
||||||
pqi/pqimonitor.h \
|
pqi/pqimonitor.h \
|
||||||
@ -291,6 +294,7 @@ HEADERS += dbase/cachestrapper.h \
|
|||||||
serialiser/rstlvkvwide.h \
|
serialiser/rstlvkvwide.h \
|
||||||
serialiser/rstlvtypes.h \
|
serialiser/rstlvtypes.h \
|
||||||
serialiser/rstlvutil.h \
|
serialiser/rstlvutil.h \
|
||||||
|
serialiser/rstlvaddrs.h \
|
||||||
services/p3channels.h \
|
services/p3channels.h \
|
||||||
services/p3chatservice.h \
|
services/p3chatservice.h \
|
||||||
services/p3disc.h \
|
services/p3disc.h \
|
||||||
@ -335,7 +339,9 @@ HEADERS += dbase/cachestrapper.h \
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
pqi/sslfns.cc \
|
pqi/sslfns.cc \
|
||||||
pqi/authssl.cc \
|
pqi/authssl.cc \
|
||||||
|
pqi/authssltest.cc \
|
||||||
pqi/authgpg.cc \
|
pqi/authgpg.cc \
|
||||||
|
pqi/authgpgtest.cc \
|
||||||
pqi/cleanupxpgp.cc \
|
pqi/cleanupxpgp.cc \
|
||||||
pqi/p3notify.cc \
|
pqi/p3notify.cc \
|
||||||
pqi/pqipersongrp.cc \
|
pqi/pqipersongrp.cc \
|
||||||
@ -352,6 +358,7 @@ SOURCES += \
|
|||||||
pqi/p3cfgmgr.cc \
|
pqi/p3cfgmgr.cc \
|
||||||
pqi/p3connmgr.cc \
|
pqi/p3connmgr.cc \
|
||||||
pqi/p3dhtmgr.cc \
|
pqi/p3dhtmgr.cc \
|
||||||
|
pqi/pqiipset.cc \
|
||||||
pqi/pqiarchive.cc \
|
pqi/pqiarchive.cc \
|
||||||
pqi/pqibin.cc \
|
pqi/pqibin.cc \
|
||||||
pqi/pqimonitor.cc \
|
pqi/pqimonitor.cc \
|
||||||
@ -430,6 +437,7 @@ SOURCES += \
|
|||||||
serialiser/rstlvbase.cc \
|
serialiser/rstlvbase.cc \
|
||||||
serialiser/rstlvtypes.cc \
|
serialiser/rstlvtypes.cc \
|
||||||
serialiser/rsserial.cc \
|
serialiser/rsserial.cc \
|
||||||
|
serialiser/rstlvaddrs.cc \
|
||||||
tcponudp/extaddrfinder.cc \
|
tcponudp/extaddrfinder.cc \
|
||||||
tcponudp/bss_tou.c \
|
tcponudp/bss_tou.c \
|
||||||
tcponudp/tcpstream.cc \
|
tcponudp/tcpstream.cc \
|
||||||
|
@ -127,11 +127,13 @@ int RsServer::UpdateAllConfig()
|
|||||||
|
|
||||||
/* update network configuration */
|
/* update network configuration */
|
||||||
|
|
||||||
config.netLocalOk = mConnMgr->getNetStatusLocalOk();
|
pqiNetStatus status;
|
||||||
config.netUpnpOk = mConnMgr->getNetStatusUpnpOk();
|
mConnMgr->getNetStatus(status);
|
||||||
config.netDhtOk = mConnMgr->getNetStatusDhtOk();
|
config.netLocalOk = status.mLocalAddrOk;
|
||||||
config.netStunOk = mConnMgr->getNetStatusStunOk();
|
config.netUpnpOk = status.mUpnpOk;
|
||||||
config.netExtraAddressOk = mConnMgr->getNetStatusExtraAddressCheckOk();
|
config.netDhtOk = status.mDhtOk;
|
||||||
|
config.netStunOk = false;
|
||||||
|
config.netExtraAddressOk = status.mExtAddrOk;
|
||||||
|
|
||||||
/* update DHT/UPnP config */
|
/* update DHT/UPnP config */
|
||||||
|
|
||||||
|
@ -307,31 +307,28 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
|||||||
/* generate */
|
/* generate */
|
||||||
d.authcode = "AUTHCODE";
|
d.authcode = "AUTHCODE";
|
||||||
|
|
||||||
|
|
||||||
//TODO : check use of this details
|
|
||||||
// From all addresses, show the most recent one if no address is currently in use.
|
|
||||||
struct sockaddr_in best_local_addr = (!strcmp(inet_ntoa(pcs.currentlocaladdr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.laddr,pcs.dht.ts,pcs.disc.laddr,pcs.disc.ts,pcs.peer.laddr,pcs.peer.ts):pcs.currentlocaladdr ;
|
|
||||||
struct sockaddr_in best_servr_addr = (!strcmp(inet_ntoa(pcs.currentserveraddr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.raddr,pcs.dht.ts,pcs.disc.raddr,pcs.disc.ts,pcs.peer.raddr,pcs.peer.ts):pcs.currentserveraddr ;
|
|
||||||
|
|
||||||
|
|
||||||
/* fill from pcs */
|
/* fill from pcs */
|
||||||
|
|
||||||
d.localAddr = inet_ntoa(best_local_addr.sin_addr);
|
d.localAddr = inet_ntoa(pcs.currentlocaladdr.sin_addr);
|
||||||
d.localPort = ntohs(best_local_addr.sin_port);
|
d.localPort = ntohs(pcs.currentlocaladdr.sin_port);
|
||||||
d.extAddr = inet_ntoa(best_servr_addr.sin_addr);
|
d.extAddr = inet_ntoa(pcs.currentserveraddr.sin_addr);
|
||||||
d.extPort = ntohs(best_servr_addr.sin_port);
|
d.extPort = ntohs(pcs.currentserveraddr.sin_port);
|
||||||
d.dyndns = pcs.dyndns;
|
d.dyndns = pcs.dyndns;
|
||||||
d.lastConnect = pcs.lastcontact;
|
d.lastConnect = pcs.lastcontact;
|
||||||
d.connectPeriod = 0;
|
d.connectPeriod = 0;
|
||||||
std::list<IpAddressTimed> pcsList = pcs.getIpAddressList();
|
|
||||||
d.ipAddressList.clear();
|
|
||||||
for (std::list<IpAddressTimed>::iterator ipListIt = pcsList.begin(); ipListIt!=(pcsList.end()); ipListIt++) {
|
std::list<pqiIpAddress>::iterator it;
|
||||||
|
for(it = pcs.ipAddrs.mExt.mAddrs.begin();
|
||||||
|
it != pcs.ipAddrs.mExt.mAddrs.end(); it++)
|
||||||
|
{
|
||||||
std::ostringstream toto;
|
std::ostringstream toto;
|
||||||
toto << ntohs(ipListIt->ipAddr.sin_port) << " " << (time(NULL) - ipListIt->seenTime) << " sec";
|
toto << ntohs(it->mAddr.sin_port) << " " << (time(NULL) - it->mSeenTime) << " sec";
|
||||||
d.ipAddressList.push_back(std::string(inet_ntoa(ipListIt->ipAddr.sin_addr)) + ":" + toto.str());
|
d.ipAddressList.push_back(std::string(inet_ntoa(it->mAddr.sin_addr)) + ":" + toto.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Translate */
|
/* Translate */
|
||||||
|
|
||||||
d.state = 0;
|
d.state = 0;
|
||||||
|
@ -525,6 +525,10 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||||||
* 2) Get List of Available Accounts.
|
* 2) Get List of Available Accounts.
|
||||||
* 4) Get List of GPG Accounts.
|
* 4) Get List of GPG Accounts.
|
||||||
*/
|
*/
|
||||||
|
/* create singletons */
|
||||||
|
AuthSSLInit();
|
||||||
|
AuthGPGInit();
|
||||||
|
|
||||||
AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL);
|
AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL);
|
||||||
|
|
||||||
// first check config directories, and set bootstrap values.
|
// first check config directories, and set bootstrap values.
|
||||||
@ -2249,7 +2253,7 @@ int RsServer::StartupRetroShare()
|
|||||||
|
|
||||||
//mConfigMgr->addConfiguration("ftserver.cfg", ftserver);
|
//mConfigMgr->addConfiguration("ftserver.cfg", ftserver);
|
||||||
//
|
//
|
||||||
mConfigMgr->addConfiguration("gpg_prefs.cfg", AuthGPG::getAuthGPG());
|
mConfigMgr->addConfiguration("gpg_prefs.cfg", (AuthGPGimpl *) AuthGPG::getAuthGPG());
|
||||||
mConfigMgr->loadConfiguration();
|
mConfigMgr->loadConfiguration();
|
||||||
|
|
||||||
//mConfigMgr->addConfiguration("sslcerts.cfg", AuthSSL::getAuthSSL());
|
//mConfigMgr->addConfiguration("sslcerts.cfg", AuthSSL::getAuthSSL());
|
||||||
|
@ -353,7 +353,9 @@ void p3disc::sendPeerDetails(std::string to, std::string about) {
|
|||||||
rsPeerNetItem->currentlocaladdr = detail.currentlocaladdr;
|
rsPeerNetItem->currentlocaladdr = detail.currentlocaladdr;
|
||||||
rsPeerNetItem->currentremoteaddr = detail.currentserveraddr;
|
rsPeerNetItem->currentremoteaddr = detail.currentserveraddr;
|
||||||
rsPeerNetItem->dyndns = detail.dyndns;
|
rsPeerNetItem->dyndns = detail.dyndns;
|
||||||
rsPeerNetItem->ipAddressList = detail.getIpAddressList();
|
detail.ipAddrs.mLocal.loadTlv(rsPeerNetItem->localAddrList);
|
||||||
|
detail.ipAddrs.mExt.loadTlv(rsPeerNetItem->extAddrList);
|
||||||
|
|
||||||
|
|
||||||
di->rsPeerList.push_back(*rsPeerNetItem);
|
di->rsPeerList.push_back(*rsPeerNetItem);
|
||||||
}
|
}
|
||||||
@ -377,7 +379,9 @@ void p3disc::sendPeerDetails(std::string to, std::string about) {
|
|||||||
rsPeerNetItem->currentlocaladdr = detail.currentlocaladdr;
|
rsPeerNetItem->currentlocaladdr = detail.currentlocaladdr;
|
||||||
rsPeerNetItem->currentremoteaddr = detail.currentserveraddr;
|
rsPeerNetItem->currentremoteaddr = detail.currentserveraddr;
|
||||||
rsPeerNetItem->dyndns = detail.dyndns;
|
rsPeerNetItem->dyndns = detail.dyndns;
|
||||||
rsPeerNetItem->ipAddressList = detail.getIpAddressList();
|
detail.ipAddrs.mLocal.loadTlv(rsPeerNetItem->localAddrList);
|
||||||
|
detail.ipAddrs.mExt.loadTlv(rsPeerNetItem->extAddrList);
|
||||||
|
|
||||||
|
|
||||||
di->rsPeerList.push_back(*rsPeerNetItem);
|
di->rsPeerList.push_back(*rsPeerNetItem);
|
||||||
}
|
}
|
||||||
@ -610,18 +614,25 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
|
|||||||
merge = false ;
|
merge = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pqiIpAddrSet addrsFromPeer;
|
||||||
|
addrsFromPeer.mLocal.loadTlv(pitem->localAddrList);
|
||||||
|
addrsFromPeer.mExt.loadTlv(pitem->extAddrList);
|
||||||
|
|
||||||
|
|
||||||
#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
std::cerr << "Friend is already connected -> not updating" << std::endl;
|
std::cerr << "Friend is already connected -> not updating" << std::endl;
|
||||||
|
|
||||||
std::cerr << "Setting address list to peer " << pitem->pid << ", to be:" << std::endl ;
|
std::cerr << "Setting address list to peer " << pitem->pid << ", to be:" << std::endl ;
|
||||||
for(std::list<IpAddressTimed>::const_iterator it(pitem->ipAddressList.begin());it!=pitem->ipAddressList.end();++it)
|
|
||||||
std::cerr << " " << (*it).ipAddr << " (" << (*it).seenTime << ")" << std::endl ;
|
addrsFromPeer.printAddrs(std::cerr);
|
||||||
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// allways update address list and dns, except if it's ours
|
// allways update address list and dns, except if it's ours
|
||||||
if (pitem->dyndns != "")
|
if (pitem->dyndns != "")
|
||||||
mConnMgr->setDynDNS(pitem->pid, pitem->dyndns);
|
mConnMgr->setDynDNS(pitem->pid, pitem->dyndns);
|
||||||
|
|
||||||
mConnMgr->updateAddressList(pitem->pid, pitem->ipAddressList,merge);
|
mConnMgr->updateAddressList(pitem->pid, addrsFromPeer);
|
||||||
}
|
}
|
||||||
#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
else
|
else
|
||||||
|
@ -30,9 +30,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "upnp.h"
|
#include <upnp/upnp.h>
|
||||||
#include "upnptools.h"
|
#include <upnp/upnptools.h>
|
||||||
#include "upnpdebug.h"
|
#include <upnp/upnpdebug.h>
|
||||||
|
|
||||||
#include "util/rsthreads.h"
|
#include "util/rsthreads.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "util/rsthreads.h"
|
#include "util/rsthreads.h"
|
||||||
|
|
||||||
#include "upnp.h"
|
#include <upnp/upnp.h>
|
||||||
#include "upnp/UPnPBase.h"
|
#include "upnp/UPnPBase.h"
|
||||||
|
|
||||||
#define RS_UPNP_S_UNINITIALISED 0
|
#define RS_UPNP_S_UNINITIALISED 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user