2009-12-13 16:59:26 -05:00
|
|
|
/*
|
|
|
|
* libretroshare/src/services: p3tunnel.h
|
|
|
|
*
|
|
|
|
* Services for RetroShare.
|
|
|
|
*
|
|
|
|
* Copyright 2004-2008 by 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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MRK_PQI_TUNNEL_H
|
|
|
|
#define MRK_PQI_TUNNEL_H
|
|
|
|
|
|
|
|
// The AutoDiscovery Class
|
|
|
|
|
|
|
|
#include "pqi/pqipersongrp.h"
|
|
|
|
|
|
|
|
// system specific network headers
|
|
|
|
#include "pqi/pqi.h"
|
|
|
|
|
|
|
|
class p3ConnectMgr;
|
|
|
|
|
|
|
|
#include "pqi/pqimonitor.h"
|
|
|
|
#include "services/p3service.h"
|
|
|
|
#include "serialiser/rstunnelitems.h"
|
2010-01-13 15:56:55 -05:00
|
|
|
#include "pqi/authssl.h"
|
2009-12-13 16:59:26 -05:00
|
|
|
|
|
|
|
class p3tunnel: public p3Service, public pqiMonitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void statusChange(const std::list<pqipeer> &plist);
|
|
|
|
|
2010-01-13 15:56:55 -05:00
|
|
|
p3tunnel(p3ConnectMgr *cm, pqipersongrp *persGrp);
|
2009-12-13 16:59:26 -05:00
|
|
|
|
|
|
|
int tick();
|
|
|
|
|
|
|
|
void sendTunnelData(std::string destPeerId, std::string relayPeerId, void *data, int data_length);
|
|
|
|
|
|
|
|
void pingTunnelConnection(std::string relayPeerId, std::string destPeerId);
|
2010-02-25 17:44:04 -05:00
|
|
|
void initiateHandshake(std::string relayPeerId, std::string destPeerId);
|
2009-12-13 16:59:26 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2010-02-25 17:44:04 -05:00
|
|
|
void sendTunnelDataPrivate(std::string to, std::string sourcePeerId, std::string relayPeerId, std::string destPeerId, void *data, int data_length);
|
2009-12-13 16:59:26 -05:00
|
|
|
|
|
|
|
void privateRecvTunnelDataRelaying(RsTunnelDataItem *item); //invoked when I am relaying
|
|
|
|
void privateRecvTunnelDataDestination(RsTunnelDataItem *item); //invoked when I am the destination of the tunnel
|
|
|
|
|
|
|
|
/* Network Input */
|
|
|
|
int handleIncoming();
|
|
|
|
void recvTunnelData(RsTunnelDataItem *item);
|
2010-02-25 17:44:04 -05:00
|
|
|
void recvTunnelHandshake(RsTunnelHandshakeItem *item);
|
2009-12-13 16:59:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
p3ConnectMgr *mConnMgr;
|
|
|
|
pqipersongrp *mPqiPersonGrp;
|
|
|
|
std::string ownId;
|
|
|
|
|
|
|
|
|
|
|
|
/* data */
|
|
|
|
RsMutex mTunnelMtx;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MRK_PQI_TUNNEL_H
|