2008-01-25 01:36:40 -05:00
|
|
|
/*
|
|
|
|
* libretroshare/src/pqi: pqisslpersongrp.cc
|
|
|
|
*
|
|
|
|
* 3P/PQI network interface 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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-07-10 12:29:18 -04:00
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include "util/rsdebug.h"
|
|
|
|
|
2008-01-25 01:36:40 -05:00
|
|
|
#include "pqi/pqisslpersongrp.h"
|
2010-01-13 15:56:55 -05:00
|
|
|
#include "pqi/authssl.h"
|
2008-01-28 00:40:32 -05:00
|
|
|
|
2008-01-25 01:36:40 -05:00
|
|
|
|
|
|
|
const int pqipersongrpzone = 354;
|
|
|
|
|
2008-02-26 21:32:20 -05:00
|
|
|
/****
|
|
|
|
* #define PQI_DISABLE_UDP 1
|
|
|
|
***/
|
|
|
|
|
2008-01-25 01:36:40 -05:00
|
|
|
/********************************** SSL Specific features ***************************/
|
|
|
|
|
|
|
|
#include "pqi/pqissl.h"
|
|
|
|
#include "pqi/pqissllistener.h"
|
|
|
|
|
2010-06-24 14:06:10 -04:00
|
|
|
#ifndef PQI_DISABLE_TUNNEL
|
|
|
|
#include "pqi/pqissltunnel.h"
|
|
|
|
#endif
|
|
|
|
|
2008-02-26 21:32:20 -05:00
|
|
|
#ifndef PQI_DISABLE_UDP
|
2008-01-25 01:36:40 -05:00
|
|
|
#include "pqi/pqissludp.h"
|
|
|
|
#endif
|
|
|
|
|
2009-12-13 16:59:26 -05:00
|
|
|
|
2008-01-25 01:36:40 -05:00
|
|
|
pqilistener * pqisslpersongrp::createListener(struct sockaddr_in laddr)
|
|
|
|
{
|
2010-01-13 15:56:55 -05:00
|
|
|
pqilistener *listener = new pqissllistener(laddr, mConnMgr);
|
2008-01-25 01:36:40 -05:00
|
|
|
return listener;
|
|
|
|
}
|
|
|
|
|
|
|
|
pqiperson * pqisslpersongrp::createPerson(std::string id, pqilistener *listener)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::ostringstream out;
|
|
|
|
out << "pqipersongrp::createPerson() PeerId: " << id;
|
|
|
|
pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone, out.str());
|
|
|
|
}
|
|
|
|
|
|
|
|
pqiperson *pqip = new pqiperson(id, this);
|
2010-01-13 15:56:55 -05:00
|
|
|
pqissl *pqis = new pqissl((pqissllistener *) listener, pqip, mConnMgr);
|
2008-01-25 01:36:40 -05:00
|
|
|
|
|
|
|
/* construct the serialiser ....
|
|
|
|
* Needs:
|
|
|
|
* * FileItem
|
|
|
|
* * FileData
|
|
|
|
* * ServiceGeneric
|
|
|
|
*/
|
|
|
|
|
|
|
|
RsSerialiser *rss = new RsSerialiser();
|
|
|
|
rss->addSerialType(new RsFileItemSerialiser());
|
|
|
|
rss->addSerialType(new RsCacheItemSerialiser());
|
|
|
|
rss->addSerialType(new RsServiceSerialiser());
|
|
|
|
|
|
|
|
pqiconnect *pqisc = new pqiconnect(rss, pqis);
|
|
|
|
|
|
|
|
pqip -> addChildInterface(PQI_CONNECT_TCP, pqisc);
|
|
|
|
|
2010-06-24 14:06:10 -04:00
|
|
|
#ifndef PQI_DISABLE_TUNNEL
|
2010-01-13 15:56:55 -05:00
|
|
|
pqissltunnel *pqitun = new pqissltunnel(pqip, mConnMgr);
|
2010-06-24 14:06:10 -04:00
|
|
|
|
2009-12-13 16:59:26 -05:00
|
|
|
RsSerialiser *rss3 = new RsSerialiser();
|
|
|
|
rss3->addSerialType(new RsFileItemSerialiser());
|
|
|
|
rss3->addSerialType(new RsCacheItemSerialiser());
|
|
|
|
rss3->addSerialType(new RsServiceSerialiser());
|
|
|
|
pqiconnect *pqicontun = new pqiconnect(rss3, pqitun);
|
|
|
|
pqip -> addChildInterface(PQI_CONNECT_TUNNEL, pqicontun);
|
2010-06-24 14:06:10 -04:00
|
|
|
#endif
|
2009-12-13 16:59:26 -05:00
|
|
|
|
2008-02-26 21:32:20 -05:00
|
|
|
#ifndef PQI_DISABLE_UDP
|
2010-01-13 15:56:55 -05:00
|
|
|
pqissludp *pqius = new pqissludp(pqip, mConnMgr);
|
2008-01-25 01:36:40 -05:00
|
|
|
|
2009-12-13 16:59:26 -05:00
|
|
|
RsSerialiser *rss2 = new RsSerialiser();
|
|
|
|
rss2->addSerialType(new RsFileItemSerialiser());
|
|
|
|
rss2->addSerialType(new RsCacheItemSerialiser());
|
|
|
|
rss2->addSerialType(new RsServiceSerialiser());
|
2008-01-25 01:36:40 -05:00
|
|
|
|
2009-12-13 16:59:26 -05:00
|
|
|
pqiconnect *pqiusc = new pqiconnect(rss2, pqius);
|
2008-01-25 01:36:40 -05:00
|
|
|
|
2009-12-13 16:59:26 -05:00
|
|
|
// add a ssl + proxy interface.
|
|
|
|
// Add Proxy First.
|
|
|
|
pqip -> addChildInterface(PQI_CONNECT_UDP, pqiusc);
|
2008-01-25 01:36:40 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return pqip;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************** SSL Specific features ***************************/
|
|
|
|
|
|
|
|
|