2008-01-25 01:36:40 -05:00
|
|
|
/*
|
|
|
|
* libretroshare/src/pqi: pqimonitor.cc
|
|
|
|
*
|
|
|
|
* 3P/PQI network interface for RetroShare.
|
|
|
|
*
|
|
|
|
* Copyright 2007-2008 Robert Fernie.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2010-07-04 06:35:38 -04:00
|
|
|
void pqiConnectCbDummy::peerStatus(std::string 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;
|
|
|
|
addrs.printAddrs(std::cerr);
|
|
|
|
std::cerr << std::endl;
|
2008-01-25 01:36:40 -05:00
|
|
|
}
|
|
|
|
|
2008-02-26 21:32:20 -05:00
|
|
|
void pqiConnectCbDummy::peerConnectRequest(std::string id,
|
|
|
|
struct sockaddr_in raddr, uint32_t source)
|
2008-01-25 01:36:40 -05:00
|
|
|
{
|
|
|
|
std::cerr << "pqiConnectCbDummy::peerConnectRequest()";
|
|
|
|
std::cerr << " id: " << id;
|
2010-07-10 16:34:03 -04:00
|
|
|
std::cerr << " raddr: " << rs_inet_ntoa(raddr.sin_addr);
|
2008-02-26 21:32:20 -05:00
|
|
|
std::cerr << ":" << ntohs(raddr.sin_port);
|
|
|
|
std::cerr << " source: " << source;
|
2008-01-25 01:36:40 -05:00
|
|
|
std::cerr << std::endl;
|
|
|
|
}
|
|
|
|
|
2010-07-04 06:35:38 -04:00
|
|
|
#if 0
|
2008-02-25 18:56:23 -05:00
|
|
|
void pqiConnectCbDummy::stunStatus(std::string id, struct sockaddr_in raddr,
|
|
|
|
uint32_t type, uint32_t flags)
|
2008-01-25 01:36:40 -05:00
|
|
|
{
|
|
|
|
std::cerr << "pqiConnectCbDummy::stunStatus()";
|
2010-07-10 16:34:03 -04:00
|
|
|
std::cerr << " idhash: " << RsUtil::BinToHex(id) << " raddr: " << rs_inet_ntoa(raddr.sin_addr);
|
2008-02-25 18:56:23 -05:00
|
|
|
std::cerr << ":" << ntohs(raddr.sin_port);
|
|
|
|
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
|
|
|
|
|
|
|
|