2018-05-28 16:03:39 -04:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/pqi: pqimonitor.cc *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2007-2008 by Robert Fernie. *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2008-01-25 01:36:40 -05:00
|
|
|
#include "pqi/pqimonitor.h"
|
|
|
|
#include "pqi/pqinetwork.h"
|
2010-07-04 06:35:38 -04:00
|
|
|
#include "pqi/pqiipset.h"
|
2008-01-25 01:36:40 -05:00
|
|
|
#include "util/rsprint.h"
|
|
|
|
|
|
|
|
/***** DUMMY Connect CB for testing *****/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
pqiConnectCbDummy::pqiConnectCbDummy()
|
|
|
|
{
|
|
|
|
std::cerr << "pqiConnectCbDummy()" << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pqiConnectCbDummy::~pqiConnectCbDummy()
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
void pqiConnectCbDummy::peerStatus(const RsPeerId& id, const pqiIpAddrSet &addrs,
|
2008-01-25 01:36:40 -05:00
|
|
|
uint32_t type, uint32_t mode, uint32_t source)
|
|
|
|
{
|
|
|
|
std::cerr << "pqiConnectCbDummy::peerStatus()";
|
|
|
|
std::cerr << " id: " << id;
|
|
|
|
std::cerr << " type: " << type;
|
|
|
|
std::cerr << " mode: " << mode;
|
|
|
|
std::cerr << " source: " << source;
|
|
|
|
std::cerr << std::endl;
|
2010-07-04 06:35:38 -04:00
|
|
|
|
|
|
|
std::cerr << " addrs: ";
|
|
|
|
std::cerr << std::endl;
|
2012-04-14 18:38:24 -04:00
|
|
|
std::string out;
|
|
|
|
addrs.printAddrs(out);
|
|
|
|
std::cerr << out << std::endl;
|
2008-01-25 01:36:40 -05:00
|
|
|
}
|
|
|
|
|
2017-03-15 14:03:39 -04:00
|
|
|
void pqiConnectCbDummy::peerConnectRequest(const RsPeerId &id, const sockaddr_storage &raddr
|
|
|
|
, const sockaddr_storage &proxyaddr, const sockaddr_storage &srcaddr
|
|
|
|
, uint32_t source, uint32_t flags, uint32_t delay, uint32_t bandwidth)
|
2008-01-25 01:36:40 -05:00
|
|
|
{
|
|
|
|
std::cerr << "pqiConnectCbDummy::peerConnectRequest()";
|
|
|
|
std::cerr << " id: " << id;
|
2013-09-13 10:35:19 -04:00
|
|
|
std::cerr << " raddr: " << sockaddr_storage_tostring(raddr);
|
2017-03-15 14:03:39 -04:00
|
|
|
std::cerr << " proxyaddr: " << sockaddr_storage_tostring(proxyaddr);
|
|
|
|
std::cerr << " srcaddr: " << sockaddr_storage_tostring(srcaddr);
|
2008-02-26 21:32:20 -05:00
|
|
|
std::cerr << " source: " << source;
|
2017-03-15 14:03:39 -04:00
|
|
|
std::cerr << " flags: " << flags;
|
|
|
|
std::cerr << " delay: " << delay;
|
|
|
|
std::cerr << " bandwidth: " << bandwidth;
|
|
|
|
std::cerr << std::endl;
|
2015-06-01 18:03:07 -04:00
|
|
|
}
|
|
|
|
|
2016-06-02 08:42:32 -04:00
|
|
|
void pqiMonitor::disconnectPeer(const RsPeerId &/*peer*/)
|
2015-06-01 18:03:07 -04:00
|
|
|
{
|
|
|
|
std::cerr << "(EE) pqiMonitor::disconnectPeer() shouldn't be called!!!"<< std::endl;
|
2008-01-25 01:36:40 -05:00
|
|
|
}
|
|
|
|
|
2010-07-04 06:35:38 -04:00
|
|
|
#if 0
|
2013-09-13 10:35:19 -04:00
|
|
|
void pqiConnectCbDummy::stunStatus(std::string id, const struct sockaddr_storage *raddr,
|
2008-02-25 18:56:23 -05:00
|
|
|
uint32_t type, uint32_t flags)
|
2008-01-25 01:36:40 -05:00
|
|
|
{
|
|
|
|
std::cerr << "pqiConnectCbDummy::stunStatus()";
|
2013-09-13 10:35:19 -04:00
|
|
|
std::cerr << " idhash: " << RsUtil::BinToHex(id) << " raddr: " << sockaddr_storage_tostring(raddr);
|
2008-02-25 18:56:23 -05:00
|
|
|
std::cerr << " type: " << type;
|
2008-01-25 01:36:40 -05:00
|
|
|
std::cerr << " flags: " << flags;
|
|
|
|
std::cerr << std::endl;
|
|
|
|
}
|
2010-07-04 06:35:38 -04:00
|
|
|
#endif
|
2008-01-25 01:36:40 -05:00
|
|
|
|
|
|
|
|