From 7a2ae6e979793a7596120bbab26e797996b7eb79 Mon Sep 17 00:00:00 2001 From: Gio Date: Thu, 25 Aug 2016 11:33:11 +0200 Subject: [PATCH] Remove some clutter from libretroshare Removed SearchInterface that was an historical remain that make no sense anymore Fixed some clang warning Fix includes on some files --- libretroshare/src/pqi/pqi.h | 34 ++++------------------------ libretroshare/src/pqi/pqihandler.cc | 21 +++++++++++------ libretroshare/src/pqi/pqihandler.h | 19 ++++++++++------ libretroshare/src/pqi/pqiloopback.cc | 5 +++- libretroshare/src/pqi/pqiloopback.h | 13 +++++------ libretroshare/src/pqi/pqistreamer.cc | 27 ++++++++++++++-------- libretroshare/src/pqi/pqistreamer.h | 27 ++++++++++++++-------- 7 files changed, 74 insertions(+), 72 deletions(-) diff --git a/libretroshare/src/pqi/pqi.h b/libretroshare/src/pqi/pqi.h index 6109d4761..a7aa5854c 100644 --- a/libretroshare/src/pqi/pqi.h +++ b/libretroshare/src/pqi/pqi.h @@ -27,31 +27,10 @@ #ifndef 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 -#include -#include -/********************** SEARCH INTERFACE ***************************/ -// this is an interface.... so should be -// classified as virtual = 0; - -class SearchInterface -{ -public: - SearchInterface() { return; } - - virtual ~SearchInterface() { return; } -}; - -class P3Interface: public SearchInterface +class P3Interface { public: P3Interface() {return; } @@ -61,16 +40,13 @@ virtual int tick() { return 1; } virtual int status() { return 1; } 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 { public: @@ -80,6 +56,4 @@ virtual bool sendItem(RsRawItem *item) = 0; }; - #endif // PQI_TOP_HEADER - diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index 718e877c1..f5494be15 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -25,16 +25,23 @@ #include "pqi/pqihandler.h" -#include "util/rsdebug.h" -#include "util/rsstring.h" -#include "retroshare/rspeers.h" -#include -#include +#include // for NULL +#include // for time, time_t +#include // for sort +#include // for dec +#include // for string, char_traits, operator+, bas... +#include // 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; -#include -#include #ifdef WINDOWS_SYS #include #endif diff --git a/libretroshare/src/pqi/pqihandler.h b/libretroshare/src/pqi/pqihandler.h index d2e5ce51f..cf1f19429 100644 --- a/libretroshare/src/pqi/pqihandler.h +++ b/libretroshare/src/pqi/pqihandler.h @@ -26,15 +26,20 @@ #ifndef MRK_PQI_HANDLER_HEADER #define MRK_PQI_HANDLER_HEADER -#include "pqi/pqi.h" -#include "pqi/pqiqos.h" +#include // for uint32_t +#include // for time_t, NULL +#include // for list +#include // for map -#include "util/rsthreads.h" -#include "retroshare/rstypes.h" -#include "retroshare/rsconfig.h" +#include "pqi/pqi.h" // for P3Interface, pqiPublisher +#include "retroshare/rstypes.h" // for RsPeerId +#include "util/rsthreads.h" // for RsStackMutex, RsMutex -#include -#include +class PQInterface; +class RSTrafficClue; +class RsBwRates; +class RsItem; +class RsRawItem; class SearchModule { diff --git a/libretroshare/src/pqi/pqiloopback.cc b/libretroshare/src/pqi/pqiloopback.cc index 4eedb7fda..ba4078ce2 100644 --- a/libretroshare/src/pqi/pqiloopback.cc +++ b/libretroshare/src/pqi/pqiloopback.cc @@ -23,9 +23,12 @@ * */ -#include "pqi/pqi.h" #include "pqi/pqiloopback.h" +#include // for NULL + +class RsItem; + /*** #define LOOPBACK_DEBUG 1 ***/ diff --git a/libretroshare/src/pqi/pqiloopback.h b/libretroshare/src/pqi/pqiloopback.h index ff5b983db..7186dd440 100644 --- a/libretroshare/src/pqi/pqiloopback.h +++ b/libretroshare/src/pqi/pqiloopback.h @@ -26,12 +26,12 @@ #ifndef MRK_PQI_LOOPBACK_HEADER #define MRK_PQI_LOOPBACK_HEADER -// The standard data types and the search interface. -#include "pqi/pqi.h" +#include // for list -#include -#include -#include +#include "pqi/pqi_base.h" // for NetInterface (ptr only), PQInterface +#include "retroshare/rstypes.h" // for RsPeerId + +class RsItem; class pqiloopback: public PQInterface { @@ -47,8 +47,7 @@ virtual RsItem *GetItem(); virtual int tick(); virtual int status(); -virtual int notifyEvent(NetInterface */*ni*/, int /*event*/) { return 0; } /* Not used */ - private: +private: std::list objs; }; diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index 166cc6b1e..9d68a50b2 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -24,18 +24,25 @@ */ -#include -#include -#include -#include "util/rsdebug.h" -#include "util/rsstring.h" -#include "util/rsprint.h" -#include "util/rsscopetimer.h" - #include "pqi/pqistreamer.h" -#include "rsserver/p3face.h" -#include "serialiser/rsserial.h" +#include // for free, realloc, exit +#include // for memcpy, memset, memcmp +#include // for NULL, time, time_t +#include // for min +#include // for operator<<, ostream, basic_ostream +#include // for string, allocator, operator<<, oper... +#include // 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"}; #define pqistreamerzone &pqistreamerzoneInfo diff --git a/libretroshare/src/pqi/pqistreamer.h b/libretroshare/src/pqi/pqistreamer.h index 52a376062..5cdbab9d7 100644 --- a/libretroshare/src/pqi/pqistreamer.h +++ b/libretroshare/src/pqi/pqistreamer.h @@ -27,18 +27,19 @@ #ifndef MRK_PQI_STREAMER_HEADER #define MRK_PQI_STREAMER_HEADER -// Only dependent on the base stuff. -#include "pqi/pqi_base.h" -#include "util/rsthreads.h" -#include "retroshare/rstypes.h" +#include // for uint32_t +#include // for time_t +#include // for operator<<, basic_ostream, cerr, endl +#include // for list +#include // for map -#include +#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. -// and communicates with peer etc via the BinInterface. -// -// The interface does not handle connection, just communication. -// possible bioflags: BIN_FLAGS_NO_CLOSE | BIN_FLAGS_NO_DELETE +class RsItem; +class RsSerialiser; struct PartialPacketRecord { @@ -46,6 +47,12 @@ struct PartialPacketRecord 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 { public: