Merge pull request #482 from G10h4ck/master

Remove some clutter from libretroshare
This commit is contained in:
Cyril Soler 2016-08-25 12:57:27 +02:00 committed by GitHub
commit 8d0541b699
7 changed files with 74 additions and 72 deletions

View File

@ -27,31 +27,10 @@
#ifndef PQI_TOP_HEADER #ifndef PQI_TOP_HEADER
#define PQI_TOP_HEADER #define PQI_TOP_HEADER
/* This just includes the standard headers required.
*/
#include "pqi/pqi_base.h"
#include "pqi/pqinetwork.h"
#include "serialiser/rsserial.h" #include "serialiser/rsserial.h"
#include <iostream>
#include <functional>
#include <algorithm>
/********************** SEARCH INTERFACE ***************************/ class P3Interface
// this is an interface.... so should be
// classified as virtual = 0;
class SearchInterface
{
public:
SearchInterface() { return; }
virtual ~SearchInterface() { return; }
};
class P3Interface: public SearchInterface
{ {
public: public:
P3Interface() {return; } P3Interface() {return; }
@ -61,16 +40,13 @@ virtual int tick() { return 1; }
virtual int status() { return 1; } virtual int status() { return 1; }
virtual int SendRsRawItem(RsRawItem *) = 0; virtual int SendRsRawItem(RsRawItem *) = 0;
#ifdef TO_BE_REMOVED
virtual RsRawItem *GetRsRawItem() = 0;
#endif
}; };
/* interface to allow outgoing messages to be sent directly /**
* through to the pqiperson, rather than being queued * @brief Interface to allow outgoing messages to be sent directly through to
* the pqiperson, rather than being queued
*/ */
class pqiPublisher class pqiPublisher
{ {
public: public:
@ -80,6 +56,4 @@ virtual bool sendItem(RsRawItem *item) = 0;
}; };
#endif // PQI_TOP_HEADER #endif // PQI_TOP_HEADER

View File

@ -25,16 +25,23 @@
#include "pqi/pqihandler.h" #include "pqi/pqihandler.h"
#include "util/rsdebug.h" #include <stdlib.h> // for NULL
#include "util/rsstring.h" #include <time.h> // for time, time_t
#include "retroshare/rspeers.h" #include <algorithm> // for sort
#include <stdlib.h> #include <iostream> // for dec
#include <time.h> #include <string> // for string, char_traits, operator+, bas...
#include <utility> // for pair
#include "pqi/pqi_base.h" // for PQInterface, RsBwRates
#include "retroshare/rsconfig.h" // for RSTrafficClue
#include "retroshare/rsids.h" // for t_RsGenericIdType
#include "retroshare/rspeers.h" // for RsPeers, rsPeers
#include "serialiser/rsserial.h" // for RsItem, RsRawItem
#include "util/rsdebug.h" // for pqioutput, PQL_DEBUG_BASIC, PQL_ALERT
#include "util/rsstring.h" // for rs_sprintf_append
using std::dec; using std::dec;
#include <time.h>
#include <sys/time.h>
#ifdef WINDOWS_SYS #ifdef WINDOWS_SYS
#include <sys/timeb.h> #include <sys/timeb.h>
#endif #endif

View File

@ -26,15 +26,20 @@
#ifndef MRK_PQI_HANDLER_HEADER #ifndef MRK_PQI_HANDLER_HEADER
#define MRK_PQI_HANDLER_HEADER #define MRK_PQI_HANDLER_HEADER
#include "pqi/pqi.h" #include <stdint.h> // for uint32_t
#include "pqi/pqiqos.h" #include <time.h> // for time_t, NULL
#include <list> // for list
#include <map> // for map
#include "util/rsthreads.h" #include "pqi/pqi.h" // for P3Interface, pqiPublisher
#include "retroshare/rstypes.h" #include "retroshare/rstypes.h" // for RsPeerId
#include "retroshare/rsconfig.h" #include "util/rsthreads.h" // for RsStackMutex, RsMutex
#include <map> class PQInterface;
#include <list> class RSTrafficClue;
class RsBwRates;
class RsItem;
class RsRawItem;
class SearchModule class SearchModule
{ {

View File

@ -23,9 +23,12 @@
* *
*/ */
#include "pqi/pqi.h"
#include "pqi/pqiloopback.h" #include "pqi/pqiloopback.h"
#include <stddef.h> // for NULL
class RsItem;
/*** /***
#define LOOPBACK_DEBUG 1 #define LOOPBACK_DEBUG 1
***/ ***/

View File

@ -26,12 +26,12 @@
#ifndef MRK_PQI_LOOPBACK_HEADER #ifndef MRK_PQI_LOOPBACK_HEADER
#define MRK_PQI_LOOPBACK_HEADER #define MRK_PQI_LOOPBACK_HEADER
// The standard data types and the search interface. #include <list> // for list
#include "pqi/pqi.h"
#include <map> #include "pqi/pqi_base.h" // for NetInterface (ptr only), PQInterface
#include <list> #include "retroshare/rstypes.h" // for RsPeerId
#include <iostream>
class RsItem;
class pqiloopback: public PQInterface class pqiloopback: public PQInterface
{ {
@ -47,8 +47,7 @@ virtual RsItem *GetItem();
virtual int tick(); virtual int tick();
virtual int status(); virtual int status();
virtual int notifyEvent(NetInterface */*ni*/, int /*event*/) { return 0; } /* Not used */ private:
private:
std::list<RsItem *> objs; std::list<RsItem *> objs;
}; };

View File

@ -24,18 +24,25 @@
*/ */
#include <iostream>
#include <fstream>
#include <time.h>
#include "util/rsdebug.h"
#include "util/rsstring.h"
#include "util/rsprint.h"
#include "util/rsscopetimer.h"
#include "pqi/pqistreamer.h" #include "pqi/pqistreamer.h"
#include "rsserver/p3face.h"
#include "serialiser/rsserial.h" #include <stdlib.h> // for free, realloc, exit
#include <string.h> // for memcpy, memset, memcmp
#include <time.h> // for NULL, time, time_t
#include <algorithm> // for min
#include <iostream> // for operator<<, ostream, basic_ostream
#include <string> // for string, allocator, operator<<, oper...
#include <utility> // for pair
#include "pqi/p3notify.h" // for p3Notify
#include "retroshare/rsids.h" // for operator<<
#include "retroshare/rsnotify.h" // for RS_SYS_WARNING
#include "rsserver/p3face.h" // for RsServer
#include "serialiser/rsserial.h" // for RsItem, RsSerialiser, getRsItemSize
#include "util/rsdebug.h" // for pqioutput, PQL_ALERT, PQL_DEBUG_ALL
#include "util/rsmemory.h" // for rs_malloc
#include "util/rsprint.h" // for BinToHex
#include "util/rsstring.h" // for rs_sprintf_append, rs_sprintf
static struct RsLog::logInfo pqistreamerzoneInfo = {RsLog::Default, "pqistreamer"}; static struct RsLog::logInfo pqistreamerzoneInfo = {RsLog::Default, "pqistreamer"};
#define pqistreamerzone &pqistreamerzoneInfo #define pqistreamerzone &pqistreamerzoneInfo

View File

@ -27,18 +27,19 @@
#ifndef MRK_PQI_STREAMER_HEADER #ifndef MRK_PQI_STREAMER_HEADER
#define MRK_PQI_STREAMER_HEADER #define MRK_PQI_STREAMER_HEADER
// Only dependent on the base stuff. #include <stdint.h> // for uint32_t
#include "pqi/pqi_base.h" #include <time.h> // for time_t
#include "util/rsthreads.h" #include <iostream> // for operator<<, basic_ostream, cerr, endl
#include "retroshare/rstypes.h" #include <list> // for list
#include <map> // for map
#include <list> #include "pqi/pqi_base.h" // for BinInterface (ptr only), PQInterface
#include "retroshare/rsconfig.h" // for RSTrafficClue
#include "retroshare/rstypes.h" // for RsPeerId
#include "util/rsthreads.h" // for RsMutex
// Fully implements the PQInterface. class RsItem;
// and communicates with peer etc via the BinInterface. class RsSerialiser;
//
// The interface does not handle connection, just communication.
// possible bioflags: BIN_FLAGS_NO_CLOSE | BIN_FLAGS_NO_DELETE
struct PartialPacketRecord struct PartialPacketRecord
{ {
@ -46,6 +47,12 @@ struct PartialPacketRecord
uint32_t size ; uint32_t size ;
}; };
/**
* @brief Fully implements the PQInterface and communicates with peer etc via
* the BinInterface.
* The interface does not handle connection, just communication.
* Possible BIN_FLAGS: BIN_FLAGS_NO_CLOSE | BIN_FLAGS_NO_DELETE
*/
class pqistreamer: public PQInterface class pqistreamer: public PQInterface
{ {
public: public: