From b12f9323dc441efcac2e4a2034f8c73366152ac3 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 10 Dec 2017 15:57:01 +0100 Subject: [PATCH 001/213] added some text to describe the protocol for GXS distant sync --- libretroshare/src/gxs/rsgxsnetservice.cc | 49 +++++++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 88c7701d2..eba451bcd 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -166,8 +166,6 @@ // | | // (Only send if rand() < sendingProb()) +---comes from mClientMsgUpdateMap -----+ // -// -// // Suggestions // =========== // * handleRecvSyncGroup should use mit->second.mLastPost to limit the sending of already known data @@ -194,6 +192,53 @@ // Problem: without msg, we cannot know the grpId!! // // * mClientMsgUpdateMap[peerid][grpId] is only updated when new msgs are received. Up to date groups will keep asking for lists! +// +// Distant sync +// ============ +// +// Distant sync uses tunnels to sync subscribed GXS groups that are not supplied by friends. Peers can subscribe to a GXS group using a RS link +// which GXS uses to request updates through tunnels. +// * The whole exchange should be kept private and anonymous between the two distant peers, so we use the same trick than for FT: encrypt the data using the group ID. +// * The same node shouldn't be known as a common server for different GXS groups +// +// GXS net service: +// * talks to virtual peers, treated like normal peers +// * virtual peers only depend on the server ID, not on tunnel ID, and be kept constant accross time so that ClientGroupUpdateMap is kept consistent +// * does not use tunnels if friends can already supply the data (??) This causes issues with "islands". +// +// Tunnels: +// * a specific service named GxsSyncTunnelService handles the creation/management of sync tunnels: +// * tunnel data need to be encrypted. +// +// bool manageTunnels(const RsGxsGroupId&) ; // start managing tunnels for this group +// bool releaseTunnels(const RsGxsGroupId&) ; // stop managing tunnels for this group +// bool sendData(const unsigned char *data,uint32_t size,const RsPeerId& virtual_peer) ; // send data to this virtual peer +// bool getVirtualPeers(const RsGxsGroupId&, std::list& peers) ; // returns the virtual peers for this group +// +// Proposed protocol: +// * request tunnels based on H(GroupId) +// * encrypt tunnel data using chacha20+HMAC-SHA256 using AEAD( GroupId, 96bits IV, tunnel ID ) (similar to what FT does) +// * when tunnel is established, exchange virtual peer names: vpid = H( GroupID | Random bias ) +// * when vpid is known, notify the client (GXS net service) which can use the virtual peer to sync +// +// * only use a single tunnel per virtual peer ID +// +// Client ------------------ TR(H(GroupId)) --------------> Server +// +// Client <-------------------- T OK ---------------------- Server +// +// [Encrypted traffic using H(GroupId, 96bits IV, tunnel ID)] +// +// Client <--------- VPID = H( Random IV | GroupId ) ------ Server +// | | +// +--------------> Mark the virtual peer active <-----------+ +// +// Unsolved problems: +// * if we want to preserve anonymity, we cannot prevent GXS from duplicating the data from virtual/real peers that actually are the same peers. +// * ultimately we should only use tunnels to sync GXS. The mix between tunnels and real peers is not a problem but will cause unnecessary traffic. +// +// Notes: +// * given that GXS only talks to peers once every 2 mins, it's likely that keep-alive packets will be needed #include From a173f325a9198f70e8b9fad060ef928e7424792b Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 20 Dec 2017 00:09:34 +0100 Subject: [PATCH 002/213] added .h for RsGxsNetTunnel service --- libretroshare/src/gxs/rsgxsnettunnel.cc | 0 libretroshare/src/gxs/rsgxsnettunnel.h | 148 ++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 libretroshare/src/gxs/rsgxsnettunnel.cc create mode 100644 libretroshare/src/gxs/rsgxsnettunnel.h diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc new file mode 100644 index 000000000..e69de29bb diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h new file mode 100644 index 000000000..b831e5bbc --- /dev/null +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -0,0 +1,148 @@ +/* + * libretroshare/src/gxs: rsgxsnettunnel.h + * + * General Data service, interface for RetroShare. + * + * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher + * + * 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.project@gmail.com" + * + */ + +#include + +#include + +/*! + * \brief The RsGxsNetTunnelService class takes care of requesting tunnels to the turtle router, through which it is possible to sync + * a particular GXS group. For each group, a set of virtual peers, corresponding to active tunnels will be made available + * to RsGxsNetService. + * + * It is the responsibility of RsGxsNetService to activate/desactivate tunnels for each particular group, depending on wether the group + * is already available at friends or not. + */ + +// Proposed protocol: +// * request tunnels based on H(GroupId) +// * encrypt tunnel data using chacha20+HMAC-SHA256 using AEAD( GroupId, 96bits IV, tunnel ID ) (similar to what FT does) +// * when tunnel is established, exchange virtual peer names: vpid = H( GroupID | Random bias ) +// * when vpid is known, notify the client (GXS net service) which can use the virtual peer to sync +// +// * only use a single tunnel per virtual peer ID +// +// Client ------------------ TR(H(GroupId)) --------------> Server +// +// Client <-------------------- T OK ---------------------- Server +// +// Here, a turtle vpid is known +// +// [Encrypted traffic using H(GroupId, 96bits IV, tunnel ID)] +// +// Client <--------- VPID = H( Random IV | GroupId ) ------ Server +// | | +// +--------------> Mark the virtual peer active <-----------+ +// +// Here, a consistent virtual peer ID is known + +typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; + +struct RsGxsNetTunnelVirtualPeerInfo +{ + enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. + RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id + RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. + }; + + uint8_t vpid_status ; + RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; + uint8_t side ; // client/server +}; + +struct RsGxsNetTunnelInfo +{ + enum { RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status + RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x01, // waiting for turtle to send some virtual peers. + RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available + }; + + uint8_t group_status ; + uint8_t encryption_master_key[16] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) + + std::map virtual_peers ; +}; + +class RsGxsNetTunnelService +{ +public: + RsGxsNetTunnelService() {} + + /*! + * \brief start managing tunnels for this group + * @param group_id group for which tunnels should be requested + */ + bool manageTunnels(const RsGxsGroupId&) ; + + /*! + * \brief Stop managing tunnels for this group + * @param group_id group for which tunnels should be released + */ + bool releaseTunnels(const RsGxsGroupId&) ; + + /*! + * sends data to this virtual peer ID + */ + bool sendData(const unsigned char *data,uint32_t size,const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; // send data to this virtual peer + + /*! + * \brief Get the list of active virtual peers for a given group. This implies that the tunnel is up and + * alive. + */ + bool getVirtualPeers(const RsGxsGroupId&, std::list& peers) ; // returns the virtual peers for this group + + /*! + * \brief dumps all information about monitored groups. + */ + void dump() const; + + // other methods are still missing. + // - derived from p3Config, to load/save data + // - method to respond to tunnel requests, probably using RsGxsNetService + // - method to encrypt/decrypt data and send/receive to/from turtle. + +private: + std::map mClientGroups ; // groups on the client side + std::map mServerGroups ; // groups on the server side + + std::map > mVirtualPeers ; + + /*! + * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to + * hide the real group id. + */ + + RsFileHash makeRequestHash(const RsGxsGroupId&) const ; + + /*! + * \brief makeVirtualPeerIdForGroup creates a virtual peer id that can be used and that will be constant accross time, whatever the + * tunnel ID and turtle virtual peer id. This allows RsGxsNetService to keep sync-ing the data consistently. + */ + + RsGxsNetTunnelVirtualPeerInfo makeVirtualPeerIdForGroup(const RsGxsGroupId&) const ; + + uint8_t mRandomBias[16] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. +}; + From 76ec079b40b622e4c8266742efdebfc90f023865 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 20 Dec 2017 22:14:58 +0100 Subject: [PATCH 003/213] added missing change in .pro --- libretroshare/src/libretroshare.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 1521f5574..221fe5bd3 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -740,6 +740,7 @@ HEADERS += rsitems/rsnxsitems.h \ gxs/rsgxs.h \ gxs/rsdataservice.h \ gxs/rsgxsnetservice.h \ + gxs/rsgxsnettunnel.h \ retroshare/rsgxsflags.h \ retroshare/rsgxsifacetypes.h \ gxs/rsgenexchange.h \ @@ -765,6 +766,7 @@ SOURCES += rsitems/rsnxsitems.cc \ gxs/rsdataservice.cc \ gxs/rsgenexchange.cc \ gxs/rsgxsnetservice.cc \ + gxs/rsgxsnettunnel.cc \ gxs/rsgxsdata.cc \ rsitems/rsgxsitems.cc \ gxs/rsgxsdataaccess.cc \ From 076309133b5c0e5ddccce75d132a06f7c012d06d Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 15 Mar 2018 17:46:21 +0100 Subject: [PATCH 004/213] basic structure of GxsNetTunnelService --- libretroshare/src/gxs/rsgxsnettunnel.cc | 175 ++++++++++++++++++++++ libretroshare/src/gxs/rsgxsnettunnel.h | 85 +++++++---- libretroshare/src/gxstunnel/p3gxstunnel.h | 2 +- 3 files changed, 231 insertions(+), 31 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index e69de29bb..1e0e83cf7 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -0,0 +1,175 @@ +/* + * libretroshare/src/gxs: rsgxsnettunnel.cc + * + * General Data service, interface for RetroShare. + * + * Copyright 2018-2018 by Cyril Soler + * + * 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.project@gmail.com" + * + */ + +#include "rsgxsnettunnel.h" + +#define DEBUG_RSGXSNETTUNNEL 1 + +#define NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } + +RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") {} + +bool RsGxsNetTunnelService::manage(const RsGxsGroupId& group_id) +{ + RsFileHash hash = calculateGroupHash(group_id) ; + + RsStackMutex stack(mGxsNetTunnelMtx); /********** STACK LOCKED MTX ******/ + + RsGxsNetTunnelGroupInfo& info(mClientGroups[group_id]) ; + + time_t now = time(NULL) ; + + if(info.group_status == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE) + return true; + + info.hash = hash ; + info.last_contact = now ; + info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; + +#ifdef DEBUG_GXS_TUNNEL + std::cerr << "Starting distant chat to " << to_gxs_id << ", hash = " << hash << ", from " << from_gxs_id << std::endl; + std::cerr << "Asking turtle router to monitor tunnels for hash " << hash << std::endl; +#endif + + // Now ask the turtle router to manage a tunnel for that hash. + + mTurtle->monitorTunnels(hash,this,false) ; + + return true; +} + +bool RsGxsNetTunnelService::release(const RsGxsGroupId& group_id) +{ + RsStackMutex stack(mGxsNetTunnelMtx); /********** STACK LOCKED MTX ******/ + + // Here we need to clean the stuff that was created by this group id. + + auto it = mClientGroups.find(group_id) ; + + if(it == mClientGroups.end()) + { + std::cerr << "RsGxsNetTunnelService::release(): Weird. Cannot release client group " << group_id << " that is not known." << std::endl; + return false ; + } + + mClientGroups.erase(it) ; + return true ; +} + +bool RsGxsNetTunnelService::sendData(const unsigned char *data,uint32_t size,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +{ + // The data is encrypted using chacha20+SHA256 and sent to the turtle router. + + NOT_IMPLEMENTED(); + return false ; +} + +bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId&, std::list& peers) +{ + // returns the virtual peers for this group + NOT_IMPLEMENTED(); + return false ; +} + +RsGxsNetTunnelVirtualPeerInfo RsGxsNetTunnelService::makeVirtualPeerIdForGroup(const RsGxsGroupId&) const +{ + NOT_IMPLEMENTED(); + return RsGxsNetTunnelVirtualPeerInfo(); +} +void RsGxsNetTunnelService::dump() const +{ + NOT_IMPLEMENTED(); +} + +//===========================================================================================================================================// +// Interaction with Turtle Router // +//===========================================================================================================================================// + +void RsGxsNetTunnelService::connectToTurtleRouter(p3turtle *tr) +{ + mTurtle = tr ; + mTurtle->registerTunnelService(this) ; +} + +bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) +{ + NOT_IMPLEMENTED(); + return false ; +} +void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) +{ + NOT_IMPLEMENTED(); +} +void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) +{ + NOT_IMPLEMENTED(); +} +void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) +{ + NOT_IMPLEMENTED(); +} + +RsFileHash RsGxsNetTunnelService::calculateGroupHash(const RsGxsGroupId&) const +{ + NOT_IMPLEMENTED(); + return RsFileHash() ; +} + +//===========================================================================================================================================// +// Service parts // +//===========================================================================================================================================// + +#ifdef TODO +void RsGxsNetTunnelService::handleIncomingItem(const RsGxsTunnelId& tunnel_id,RsGxsTunnelItem *item) +{ + if(item == NULL) + return ; + + // We have 3 things to do: + // + // 1 - if it's a data item, send an ACK + // 2 - if it's an ack item, mark the item as properly received, and remove it from the queue + // 3 - if it's a status item, act accordingly. + + switch(item->PacketSubType()) + { + + case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast(item)) ; + break ; + + case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast(item)) ; + break ; + + case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast(item)) ; + break ; + + default: + std::cerr << "(EE) impossible situation. DH items should be handled at the service level" << std::endl; + } + + delete item ; +} +#endif + diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index b831e5bbc..15c3b4f84 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -3,7 +3,7 @@ * * General Data service, interface for RetroShare. * - * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher + * Copyright 2018-2018 by Cyril Soler * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,34 +29,40 @@ /*! * \brief The RsGxsNetTunnelService class takes care of requesting tunnels to the turtle router, through which it is possible to sync - * a particular GXS group. For each group, a set of virtual peers, corresponding to active tunnels will be made available - * to RsGxsNetService. + * a particular GXS group. For each group, a set of virtual peers, corresponding to active tunnels will be made available + * to RsGxsNetService. * - * It is the responsibility of RsGxsNetService to activate/desactivate tunnels for each particular group, depending on wether the group - * is already available at friends or not. + * It is the responsibility of RsGxsNetService to activate/desactivate tunnels for each particular group, depending on wether the group + * is already available at friends or not. */ -// Proposed protocol: +// Protocol: // * request tunnels based on H(GroupId) // * encrypt tunnel data using chacha20+HMAC-SHA256 using AEAD( GroupId, 96bits IV, tunnel ID ) (similar to what FT does) // * when tunnel is established, exchange virtual peer names: vpid = H( GroupID | Random bias ) // * when vpid is known, notify the client (GXS net service) which can use the virtual peer to sync // // * only use a single tunnel per virtual peer ID -// -// Client ------------------ TR(H(GroupId)) --------------> Server -// -// Client <-------------------- T OK ---------------------- Server -// -// Here, a turtle vpid is known -// -// [Encrypted traffic using H(GroupId, 96bits IV, tunnel ID)] -// -// Client <--------- VPID = H( Random IV | GroupId ) ------ Server -// | | -// +--------------> Mark the virtual peer active <-----------+ -// -// Here, a consistent virtual peer ID is known +// - +// Client ------------------ TR(H(GroupId)) --------------> Server | +// | Turtle +// Client <-------------------- T OK ---------------------- Server | +// - +// Here, a turtle vpid is known | [ addVirtualPeer() called by turtle ] +// - +// [Encrypted traffic using H(GroupId | Tunnel ID, 96bits IV)] | +// | +// Client <--------- VPID = H( Random IV | GroupId ) ------ Server | +// | | | +// +--------------> Mark the virtual peer active <-----------+ | Encrypted traffic decoded locally and sorted +// | +// Here, a consistent virtual peer ID is known | +// | +// Client <------------------- GXS Data ------------------> Server | +// - +// Notes: +// * tunnels are only used one-way. If a distant peers wants to sync the same group, he'll have to open his own tunnel, with a different ID. +// * each group will produced multiple tunnels, but each tunnel with have exactly one virtual peer ID typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; @@ -67,40 +73,47 @@ struct RsGxsNetTunnelVirtualPeerInfo RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. }; + RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN) { memset(encryption_master_key,0,16) ; } + uint8_t vpid_status ; RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; uint8_t side ; // client/server + uint8_t encryption_master_key[16] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) + time_t last_contact ; // last time some data was sent/recvd }; -struct RsGxsNetTunnelInfo +struct RsGxsNetTunnelGroupInfo { enum { RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x01, // waiting for turtle to send some virtual peers. RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available }; - uint8_t group_status ; - uint8_t encryption_master_key[16] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) + RsGxsNetTunnelGroupInfo() : group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN),last_contact(0) {} + + uint8_t group_status ; + time_t last_contact ; + TurtleFileHash hash ; std::map virtual_peers ; }; -class RsGxsNetTunnelService +class RsGxsNetTunnelService: public RsTurtleClientService { public: - RsGxsNetTunnelService() {} + RsGxsNetTunnelService() ; /*! * \brief start managing tunnels for this group * @param group_id group for which tunnels should be requested */ - bool manageTunnels(const RsGxsGroupId&) ; + bool manage(const RsGxsGroupId& group_id) ; /*! * \brief Stop managing tunnels for this group * @param group_id group for which tunnels should be released */ - bool releaseTunnels(const RsGxsGroupId&) ; + bool release(const RsGxsGroupId&group_id) ; /*! * sends data to this virtual peer ID @@ -123,9 +136,19 @@ public: // - method to respond to tunnel requests, probably using RsGxsNetService // - method to encrypt/decrypt data and send/receive to/from turtle. + virtual void connectToTurtleRouter(p3turtle *tr) ; +protected: + // interaction with turtle router + + virtual bool handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) ; + virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; + void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ; + void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ; + + p3turtle *mTurtle ; private: - std::map mClientGroups ; // groups on the client side - std::map mServerGroups ; // groups on the server side + std::map mClientGroups ; // groups on the client side + std::map mServerGroups ; // groups on the server side std::map > mVirtualPeers ; @@ -134,7 +157,7 @@ private: * hide the real group id. */ - RsFileHash makeRequestHash(const RsGxsGroupId&) const ; + RsFileHash calculateGroupHash(const RsGxsGroupId&) const ; /*! * \brief makeVirtualPeerIdForGroup creates a virtual peer id that can be used and that will be constant accross time, whatever the @@ -144,5 +167,7 @@ private: RsGxsNetTunnelVirtualPeerInfo makeVirtualPeerIdForGroup(const RsGxsGroupId&) const ; uint8_t mRandomBias[16] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. + + RsMutex mGxsNetTunnelMtx; }; diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.h b/libretroshare/src/gxstunnel/p3gxstunnel.h index cabe520d4..32020e619 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.h +++ b/libretroshare/src/gxstunnel/p3gxstunnel.h @@ -95,7 +95,7 @@ // by a mix between our own GXS id and the GXS id we're talking to. That is what the TunnelVirtualPeer is. // // -// RequestTunnel(source_own_id,destination_id) - +// RequestTunnel(source_own_id,destination_id) - // | | // +---------------------------> p3Turtle::monitorTunnels( hash(destination_id) ) | // | | From 3407604a54e9704f6bf458c049a94475bd62715e Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 21 Mar 2018 22:09:40 +0100 Subject: [PATCH 005/213] added code to add/remove virtual peers in RsGxsNetTunnel --- libretroshare/src/gxs/rsgxsnettunnel.cc | 74 +++++++++++++++++++++---- libretroshare/src/gxs/rsgxsnettunnel.h | 11 ++-- 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 1e0e83cf7..2a960dd7a 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -23,6 +23,7 @@ * */ +#include "util/rsdir.h" #include "rsgxsnettunnel.h" #define DEBUG_RSGXSNETTUNNEL 1 @@ -31,6 +32,10 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") {} +//===========================================================================================================================================// +// Interface with rest of the software // +//===========================================================================================================================================// + bool RsGxsNetTunnelService::manage(const RsGxsGroupId& group_id) { RsFileHash hash = calculateGroupHash(group_id) ; @@ -48,6 +53,8 @@ bool RsGxsNetTunnelService::manage(const RsGxsGroupId& group_id) info.last_contact = now ; info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; + mHandledHashes[hash] = group_id ; + #ifdef DEBUG_GXS_TUNNEL std::cerr << "Starting distant chat to " << to_gxs_id << ", hash = " << hash << ", from " << from_gxs_id << std::endl; std::cerr << "Asking turtle router to monitor tunnels for hash " << hash << std::endl; @@ -75,6 +82,10 @@ bool RsGxsNetTunnelService::release(const RsGxsGroupId& group_id) } mClientGroups.erase(it) ; + + RsFileHash hash = calculateGroupHash(group_id) ; + + mHandledHashes.erase(hash) ; return true ; } @@ -93,7 +104,7 @@ bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId&, std::listsecond) ; + + RsGxsNetTunnelGroupInfo& ginfo( mClientGroups[group_id] ) ; + ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ; + + RsGxsNetTunnelVirtualPeerInfo& vpinfo( ginfo.virtual_peers[vpid] ) ; + + vpinfo.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK ; + vpinfo.net_service_virtual_peer.clear(); + vpinfo.side = dir ; + vpinfo.last_contact = time(NULL) ; + + generateEncryptionKey(group_id,vpid,vpinfo.encryption_key ); } -RsFileHash RsGxsNetTunnelService::calculateGroupHash(const RsGxsGroupId&) const +void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid) { - NOT_IMPLEMENTED(); - return RsFileHash() ; + auto it = mHandledHashes.find(hash) ; + + if(it == mHandledHashes.end()) + { + std::cerr << "RsGxsNetTunnelService::removeVirtualPeer(): error! hash " << hash << " is not handled. Cannot remove vpid " << vpid << std::endl; + return ; + } + + const RsGxsGroupId group_id(it->second) ; + + RsGxsNetTunnelGroupInfo& ginfo( mClientGroups[group_id] ) ; + + ginfo.virtual_peers.erase(vpid); + + if(ginfo.virtual_peers.empty()) + ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED ; +} + +RsFileHash RsGxsNetTunnelService::calculateGroupHash(const RsGxsGroupId& group_id) const +{ + return RsDirUtil::sha1sum(group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; } //===========================================================================================================================================// diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 15c3b4f84..03a676c07 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -77,7 +77,7 @@ struct RsGxsNetTunnelVirtualPeerInfo uint8_t vpid_status ; RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; - uint8_t side ; // client/server + uint8_t side ; // client/server uint8_t encryption_master_key[16] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) time_t last_contact ; // last time some data was sent/recvd }; @@ -150,21 +150,24 @@ private: std::map mClientGroups ; // groups on the client side std::map mServerGroups ; // groups on the server side - std::map > mVirtualPeers ; + std::map > mVirtualPeers ; // current virtual peers, with the (group,turtle vpid) they are for + std::map mHandledHashes ; // hashes asked to turtle /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to * hide the real group id. */ - RsFileHash calculateGroupHash(const RsGxsGroupId&) const ; + RsFileHash calculateGroupHash(const RsGxsGroupId&group_id) const ; /*! * \brief makeVirtualPeerIdForGroup creates a virtual peer id that can be used and that will be constant accross time, whatever the * tunnel ID and turtle virtual peer id. This allows RsGxsNetService to keep sync-ing the data consistently. */ - RsGxsNetTunnelVirtualPeerInfo makeVirtualPeerIdForGroup(const RsGxsGroupId&) const ; + RsGxsNetTunnelVirtualPeerInfo makeVirtualPeerIdForGroup(const RsGxsGroupId&group_id) const ; + + void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid) const ; uint8_t mRandomBias[16] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. From 00a6bd5b73b0a7a76ad46e4f9535f4d69cd7e193 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 22 Mar 2018 14:41:50 +0100 Subject: [PATCH 006/213] started to move FT encryption into p3turtle --- libretroshare/src/gxs/rsgxsnettunnel.cc | 144 ++++++++++++++++++-- libretroshare/src/gxs/rsgxsnettunnel.h | 45 +++++-- libretroshare/src/turtle/p3turtle.cc | 172 ++++++++++++++++++++++++ libretroshare/src/turtle/p3turtle.h | 7 + 4 files changed, 342 insertions(+), 26 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 2a960dd7a..e9c389454 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -24,6 +24,7 @@ */ #include "util/rsdir.h" +#include "retroshare/rspeers.h" #include "rsgxsnettunnel.h" #define DEBUG_RSGXSNETTUNNEL 1 @@ -42,7 +43,7 @@ bool RsGxsNetTunnelService::manage(const RsGxsGroupId& group_id) RsStackMutex stack(mGxsNetTunnelMtx); /********** STACK LOCKED MTX ******/ - RsGxsNetTunnelGroupInfo& info(mClientGroups[group_id]) ; + RsGxsNetTunnelGroupInfo& info(mGroups[group_id]) ; time_t now = time(NULL) ; @@ -73,15 +74,15 @@ bool RsGxsNetTunnelService::release(const RsGxsGroupId& group_id) // Here we need to clean the stuff that was created by this group id. - auto it = mClientGroups.find(group_id) ; + auto it = mGroups.find(group_id) ; - if(it == mClientGroups.end()) + if(it == mGroups.end()) { std::cerr << "RsGxsNetTunnelService::release(): Weird. Cannot release client group " << group_id << " that is not known." << std::endl; return false ; } - mClientGroups.erase(it) ; + mGroups.erase(it) ; RsFileHash hash = calculateGroupHash(group_id) ; @@ -89,12 +90,66 @@ bool RsGxsNetTunnelService::release(const RsGxsGroupId& group_id) return true ; } -bool RsGxsNetTunnelService::sendData(const unsigned char *data,uint32_t size,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +class ItemAutoDelete { - // The data is encrypted using chacha20+SHA256 and sent to the turtle router. +public: + ItemAutoDelete(RsItem *& item) : mItem(item) {} + ~ItemAutoDelete() { delete mItem; mItem=NULL ; } + RsItem *& mItem; +}; + +bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +{ + // The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router. + + ItemAutoDelete iad(item) ; // This ensures the item is deleted whatsoever when leaving + + // 1 - find the virtual peer and the proper master key to encrypt with, and check that all the info is known + + auto it = mVirtualPeers.find(virtual_peer) ; + + if(it == mVirtualPeers.end()) + { + std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; + return false ; + } + + auto it2 = mGroups.find(it->second.first); + + if(it2 == mGroups.end()) + { + std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; + return false ; + } + + auto it3 = it2->second.virtual_peers.find(it->second.second); + + if(it3 == it2->second.virtual_peers.end()) + { + std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot find turtle virtual peer " << it->second.second << ". Data is dropped." << std::endl; + return false ; + } + + if(it3->second.vpid_status != RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE) + { + std::cerr << "(EE) RsGxsNetTunnelService::sendData(): virtual peer " << it->second.second << " is not active. Data is dropped." << std::endl; + return false ; + } + + // 2 - encrypt and send the item. + + RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; NOT_IMPLEMENTED(); - return false ; + // if(!p3Turtle::encryptItem(item,it3->second.encryption_master_key,encrypted_turtle_item)) + // { + // std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot encrypt. Something's wrong. Data is dropped." << std::endl; + // return false ; + // } + + mTurtle->sendTurtleData(it->second.second,encrypted_turtle_item) ; + + return true ; } bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId&, std::list& peers) @@ -104,14 +159,60 @@ bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId&, std::listgetOwnId() ; + + unsigned char mem[RsPeerId::SIZE_IN_BYTES + RsGxsGroupId::SIZE_IN_BYTES + RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE]; + + memcpy(mem ,ssl_id.toByteArray() ,RsPeerId::SIZE_IN_BYTES) ; + memcpy(mem+RsPeerId::SIZE_IN_BYTES ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; + memcpy(mem+RsPeerId::SIZE_IN_BYTES+RsGxsGroupId::SIZE_IN_BYTES,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; + + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsPeerId::SIZE_IN_BYTES+RsGxsGroupId::SIZE_IN_BYTES+RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); } + void RsGxsNetTunnelService::dump() const { - NOT_IMPLEMENTED(); + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + static std::string group_status_str[3] = { + std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN ]"), + std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED]"), + std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ]") + }; + + static std::string vpid_status_str[3] = { + std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN ]"), + std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK ]"), + std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ]") + }; + + std::cerr << "GxsNetTunnelService dump: " << std::endl; + std::cerr << "Managed GXS groups: " << std::endl; + + for(auto it(mGroups.begin());it!=mGroups.end();++it) + { + std::cerr << " " << it->first << " hash: " << it->second.hash << " status: " << group_status_str[it->second.group_status] << "] Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; + + for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2) + std::cerr << " turtle:" << it2->first << " status: " << vpid_status_str[it2->second.vpid_status] << " s: " + << (int)it2->second.side << " last seen " << time(NULL)-it2->second.last_contact + << " ekey: " << RsUtil::BinToHex(it2->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) + << " pending (" << it2->second.incoming_items.size() << "," << it2->second.outgoing_items.size() << ")" << std::endl; + } + + std::cerr << "Virtual peers: " << std::endl; + for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) + std::cerr << " GXS Peer:" << it->first << " group_id: " << it->second.first << " Turtle:" << it->second.second << std::endl; + + std::cerr << "Hashes: " << std::endl; + for(auto it(mHandledHashes.begin());it!=mHandledHashes.end();++it) + std::cerr << " hash: " << it->first << " GroupId: " << it->second << std::endl; } //===========================================================================================================================================// @@ -151,7 +252,7 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur const RsGxsGroupId group_id(it->second) ; - RsGxsNetTunnelGroupInfo& ginfo( mClientGroups[group_id] ) ; + RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ; RsGxsNetTunnelVirtualPeerInfo& vpinfo( ginfo.virtual_peers[vpid] ) ; @@ -161,7 +262,7 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur vpinfo.side = dir ; vpinfo.last_contact = time(NULL) ; - generateEncryptionKey(group_id,vpid,vpinfo.encryption_key ); + generateEncryptionKey(group_id,vpid,vpinfo.encryption_master_key ); } void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid) @@ -176,7 +277,7 @@ void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const const RsGxsGroupId group_id(it->second) ; - RsGxsNetTunnelGroupInfo& ginfo( mClientGroups[group_id] ) ; + RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; ginfo.virtual_peers.erase(vpid); @@ -189,6 +290,21 @@ RsFileHash RsGxsNetTunnelService::calculateGroupHash(const RsGxsGroupId& group_i return RsDirUtil::sha1sum(group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; } +void RsGxsNetTunnelService::generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) const +{ + // The key is generated as H(group_id | vpid) + // Because group_id is not known it shouldn't be possible to recover the key by observing the traffic. + + assert(Sha256CheckSum::SIZE_IN_BYTES == 32) ; + + unsigned char mem[RsGxsGroupId::SIZE_IN_BYTES + TurtleVirtualPeerId::SIZE_IN_BYTES] ; + + memcpy(mem ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; + memcpy(mem+RsGxsGroupId::SIZE_IN_BYTES,vpid.toByteArray() ,TurtleVirtualPeerId::SIZE_IN_BYTES) ; + + memcpy( key, RsDirUtil::sha256sum(mem,RsGxsGroupId::SIZE_IN_BYTES+TurtleVirtualPeerId::SIZE_IN_BYTES).toByteArray(), RS_GXS_TUNNEL_CONST_EKEY_SIZE ) ; +} + //===========================================================================================================================================// // Service parts // //===========================================================================================================================================// diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 03a676c07..2f6cb0eae 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -75,11 +75,16 @@ struct RsGxsNetTunnelVirtualPeerInfo RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN) { memset(encryption_master_key,0,16) ; } - uint8_t vpid_status ; - RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; + uint8_t vpid_status ; // status of the peer uint8_t side ; // client/server uint8_t encryption_master_key[16] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) time_t last_contact ; // last time some data was sent/recvd + + RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; // anonymised peer that is used to communicate with client services + RsGxsGroupId group_id ; // group id + + std::list incoming_items ; + std::list outgoing_items ; }; struct RsGxsNetTunnelGroupInfo @@ -115,10 +120,24 @@ public: */ bool release(const RsGxsGroupId&group_id) ; + /*! - * sends data to this virtual peer ID + * \brief sendItem + * send data to this virtual peer, and takes memory ownership (deletes the item) + * \param item item to send + * \param virtual_peer destination virtual peer + * \return + * true if succeeded. */ - bool sendData(const unsigned char *data,uint32_t size,const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; // send data to this virtual peer + bool sendItem(RsItem *& item, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + + /*! + * \brief receivedItem + * returns the next received item from the given virtual peer. + * \param virtual_peer + * \return + */ + RsItem *receivedItem(const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief Get the list of active virtual peers for a given group. This implies that the tunnel is up and @@ -147,11 +166,13 @@ protected: p3turtle *mTurtle ; private: - std::map mClientGroups ; // groups on the client side - std::map mServerGroups ; // groups on the server side + static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 16 ; + static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; - std::map > mVirtualPeers ; // current virtual peers, with the (group,turtle vpid) they are for - std::map mHandledHashes ; // hashes asked to turtle + std::map mGroups ; // groups on the client and server side + + std::map > mVirtualPeers ; // current virtual peers, + std::map mHandledHashes ; // hashes asked to turtle /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to @@ -165,12 +186,12 @@ private: * tunnel ID and turtle virtual peer id. This allows RsGxsNetService to keep sync-ing the data consistently. */ - RsGxsNetTunnelVirtualPeerInfo makeVirtualPeerIdForGroup(const RsGxsGroupId&group_id) const ; + RsGxsNetTunnelVirtualPeerId makeServerVirtualPeerIdForGroup(const RsGxsGroupId&group_id) const ; - void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid) const ; + void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) const ; - uint8_t mRandomBias[16] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. + uint8_t mRandomBias[RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. - RsMutex mGxsNetTunnelMtx; + mutable RsMutex mGxsNetTunnelMtx; }; diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 8217db2fa..f01f7390e 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -2080,6 +2080,178 @@ std::string p3turtle::getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_i return name; } +#ifdef TODO +static const uint32_t ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE = 12 ; +static const uint32_t ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE = 16 ; +static const uint32_t ENCRYPTED_FT_HEADER_SIZE = 4 ; +static const uint32_t ENCRYPTED_FT_EDATA_SIZE = 4 ; + +static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; +static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; + +bool p3turtle::encryptItem(const RsItem *item,uint8_t *encryption_master_key,RsTurtleGenericDataItem *& encrypted_item) +{ + uint8_t initialization_vector[ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE] ; + + RSRandom::random_bytes(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) ; + +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << "ftServer::Encrypting ft item." << std::endl; + FTSERVER_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) << std::endl; +#endif + + uint32_t item_serialized_size = RsGenericSerializer().size(clear_item) ; + uint32_t total_data_size = ENCRYPTED_FT_HEADER_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_EDATA_SIZE + item_serialized_size + ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE ; + +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << " clear part size : " << size(clear_item) << std::endl; + FTSERVER_DEBUG() << " total item size : " << total_data_size << std::endl; +#endif + + encrypted_item = new RsTurtleGenericDataItem ; + encrypted_item->data_bytes = rs_malloc( total_data_size ) ; + encrypted_item->data_size = total_data_size ; + + if(encrypted_item->data_bytes == NULL) + return false ; + + uint8_t *edata = (uint8_t*)encrypted_item->data_bytes ; + uint32_t edata_size = item_serialized_size; + uint32_t offset = 0; + + edata[0] = 0xae ; + edata[1] = 0xad ; + edata[2] = ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 + edata[3] = 0x01 ; + + offset += ENCRYPTED_FT_HEADER_SIZE; + uint32_t aad_offset = offset ; + uint32_t aad_size = ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_EDATA_SIZE ; + + memcpy(&edata[offset], initialization_vector, ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) ; + offset += ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE ; + + edata[offset+0] = (edata_size >> 0) & 0xff ; + edata[offset+1] = (edata_size >> 8) & 0xff ; + edata[offset+2] = (edata_size >> 16) & 0xff ; + edata[offset+3] = (edata_size >> 24) & 0xff ; + + offset += ENCRYPTED_FT_EDATA_SIZE ; + + uint32_t ser_size = (uint32_t)((int)total_data_size - (int)offset); + + serialise(clear_item,&edata[offset], &ser_size); + +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << " clear item : " << RsUtil::BinToHex(&edata[offset],std::min(50,(int)total_data_size-(int)offset)) << "(...)" << std::endl; +#endif + + uint32_t clear_item_offset = offset ; + offset += edata_size ; + + uint32_t authentication_tag_offset = offset ; + assert(ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE + offset == total_data_size) ; + + uint8_t encryption_key[32] ; + deriveEncryptionKey(hash,encryption_key) ; + + if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305) + librs::crypto::AEAD_chacha20_poly1305(encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; + else if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256) + librs::crypto::AEAD_chacha20_sha256 (encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; + else + return false ; + +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; + FTSERVER_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE) << std::endl; + FTSERVER_DEBUG() << " final item : " << RsUtil::BinToHex(&edata[0],std::min(50u,total_data_size)) << "(...)" << std::endl; +#endif + + return true ; +} + +// Decrypts the given item using aead-chacha20-poly1305 +bool p3turtle::decryptItem(RsTurtleGenericDataItem *item, uint8_t* encryption_master_key, RsItem *& decrypted_item) +{ + uint8_t encryption_key[32] ; + deriveEncryptionKey(hash,encryption_key) ; + + uint8_t *edata = (uint8_t*)encrypted_item->data_bytes ; + uint32_t offset = 0; + + if(encrypted_item->data_size < ENCRYPTED_FT_HEADER_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_EDATA_SIZE) return false ; + + if(edata[0] != 0xae) return false ; + if(edata[1] != 0xad) return false ; + if(edata[2] != ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305 && edata[2] != ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256) return false ; + if(edata[3] != 0x01) return false ; + + offset += ENCRYPTED_FT_HEADER_SIZE ; + uint32_t aad_offset = offset ; + uint32_t aad_size = ENCRYPTED_FT_EDATA_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE ; + + uint8_t *initialization_vector = &edata[offset] ; + +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << "ftServer::decrypting ft item." << std::endl; + FTSERVER_DEBUG() << " item data : " << RsUtil::BinToHex(edata,std::min(50u,encrypted_item->data_size)) << "(...)" << std::endl; + FTSERVER_DEBUG() << " hash : " << hash << std::endl; + FTSERVER_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; + FTSERVER_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) << std::endl; +#endif + + offset += ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE ; + + uint32_t edata_size = 0 ; + edata_size += ((uint32_t)edata[offset+0]) << 0 ; + edata_size += ((uint32_t)edata[offset+1]) << 8 ; + edata_size += ((uint32_t)edata[offset+2]) << 16 ; + edata_size += ((uint32_t)edata[offset+3]) << 24 ; + + if(edata_size + ENCRYPTED_FT_EDATA_SIZE + ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_HEADER_SIZE != encrypted_item->data_size) + { + FTSERVER_ERROR() << " ERROR: encrypted data size is " << edata_size << ", should be " << encrypted_item->data_size - (ENCRYPTED_FT_EDATA_SIZE + ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_HEADER_SIZE ) << std::endl; + return false ; + } + + offset += ENCRYPTED_FT_EDATA_SIZE ; + uint32_t clear_item_offset = offset ; + + uint32_t authentication_tag_offset = offset + edata_size ; +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE) << std::endl; +#endif + + bool result ; + + if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305) + result = librs::crypto::AEAD_chacha20_poly1305(encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; + else if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256) + result = librs::crypto::AEAD_chacha20_sha256 (encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; + else + return false ; + +#ifdef SERVER_DEBUG + FTSERVER_DEBUG() << " authen. result : " << result << std::endl; + FTSERVER_DEBUG() << " decrypted daya : " << RsUtil::BinToHex(&edata[clear_item_offset],std::min(50u,edata_size)) << "(...)" << std::endl; +#endif + + if(!result) + { + FTSERVER_ERROR() << "(EE) decryption/authentication went wrong." << std::endl; + return false ; + } + + decrypted_item = dynamic_cast(deserialise(&edata[clear_item_offset],&edata_size)) ; + + if(decrypted_item == NULL) + return false ; + + return true ; +} +#endif + void p3turtle::getInfo( std::vector >& hashes_info, std::vector >& tunnels_info, std::vector& search_reqs_info, diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index 0c230b88b..2f7512753 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -332,6 +332,13 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config /// Send a data request into the correct tunnel for the given file hash void sendTurtleData(const RsPeerId& virtual_peer_id, RsTurtleGenericTunnelItem *item) ; +#ifdef TODO + /// Encrypts/decrypts an item, using a autenticated construction + chacha20, based on the given 32 bytes master key. + /// + static bool encryptItem(const RsItem *item, uint8_t* encryption_master_key, RsTurtleGenericDataItem *& encrypted_item) ; + static bool decryptItem(RsTurtleGenericDataItem *item,uint8_t *encryption_master_key,RsItem *& decrypted_item) ; +#endif + private: //--------------------------- Admin/Helper functions -------------------------// From 58aa2413b31b52e0d1106a4fd979226d1507ee71 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 23 Mar 2018 22:46:04 +0100 Subject: [PATCH 007/213] finished moving tunnel encryption into turtle --- libretroshare/src/ft/ftserver.cc | 38 ++++++++ libretroshare/src/turtle/p3turtle.cc | 131 ++++++++++++++------------- libretroshare/src/turtle/p3turtle.h | 7 +- 3 files changed, 109 insertions(+), 67 deletions(-) diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index f2200d7db..47718caaa 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1219,6 +1219,21 @@ static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; bool ftServer::encryptItem(RsTurtleGenericTunnelItem *clear_item,const RsFileHash& hash,RsTurtleGenericDataItem *& encrypted_item) { +#ifndef USE_NEW_METHOD + uint32_t item_serialized_size = size(clear_item) ; + + RsTemporaryMemory data(item_serialized_size) ; + + if(data == NULL) + return false ; + + serialise(clear_item, data, &item_serialized_size); + + uint8_t encryption_key[32] ; + deriveEncryptionKey(hash,encryption_key) ; + + return p3turtle::encryptData(data,item_serialized_size,encryption_key,encrypted_item) ; +#else uint8_t initialization_vector[ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE] ; RSRandom::random_bytes(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) ; @@ -1297,12 +1312,34 @@ bool ftServer::encryptItem(RsTurtleGenericTunnelItem *clear_item,const RsFileHas #endif return true ; +#endif } // Decrypts the given item using aead-chacha20-poly1305 bool ftServer::decryptItem(RsTurtleGenericDataItem *encrypted_item,const RsFileHash& hash,RsTurtleGenericTunnelItem *& decrypted_item) { +#ifndef USE_NEW_METHOD + unsigned char *data = NULL ; + uint32_t data_size = 0 ; + + uint8_t encryption_key[32] ; + deriveEncryptionKey(hash,encryption_key) ; + + if(!p3turtle::decryptItem(encrypted_item,encryption_key,data,data_size)) + { + FTSERVER_ERROR() << "Cannot decrypt data!" << std::endl; + + if(data) + free(data) ; + return false ; + } + decrypted_item = dynamic_cast(deserialise(data,&data_size)) ; + free(data); + + return (decrypted_item != NULL); + +#else uint8_t encryption_key[32] ; deriveEncryptionKey(hash,encryption_key) ; @@ -1378,6 +1415,7 @@ bool ftServer::decryptItem(RsTurtleGenericDataItem *encrypted_item,const RsFileH return false ; return true ; +#endif } bool ftServer::encryptHash(const RsFileHash& hash, RsFileHash& hash_of_hash) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index f01f7390e..ca337f241 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -34,6 +34,7 @@ #endif #include "rsserver/p3face.h" +#include "crypto/chacha20.h" #include "pqi/authssl.h" #include "pqi/p3linkmgr.h" @@ -63,6 +64,9 @@ static std::map > TS_request_bounces void TS_dumpState() ; #endif +#define TURTLE_DEBUG() std::cerr << time(NULL) << " : TURTLE : " << __FUNCTION__ << " : " +#define TURTLE_ERROR() std::cerr << "(EE) TURTLE ERROR : " + // These number may be quite important. I setup them with sensible values, but // an in-depth test would be better to get an idea of what the ideal values // could ever be. @@ -2080,32 +2084,31 @@ std::string p3turtle::getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_i return name; } -#ifdef TODO -static const uint32_t ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE = 12 ; -static const uint32_t ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE = 16 ; -static const uint32_t ENCRYPTED_FT_HEADER_SIZE = 4 ; -static const uint32_t ENCRYPTED_FT_EDATA_SIZE = 4 ; +static const uint32_t ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE = 12 ; +static const uint32_t ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE = 16 ; +static const uint32_t ENCRYPTED_TURTLE_HEADER_SIZE = 4 ; +static const uint32_t ENCRYPTED_TURTLE_EDATA_SIZE = 4 ; -static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; -static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; +static const uint8_t ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; +static const uint8_t ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; -bool p3turtle::encryptItem(const RsItem *item,uint8_t *encryption_master_key,RsTurtleGenericDataItem *& encrypted_item) +bool p3turtle::encryptData(const unsigned char *clear_data,uint32_t clear_data_size,uint8_t *encryption_master_key,RsTurtleGenericDataItem *& encrypted_item) { - uint8_t initialization_vector[ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE] ; + uint8_t initialization_vector[ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE] ; - RSRandom::random_bytes(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) ; + RSRandom::random_bytes(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) ; #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << "ftServer::Encrypting ft item." << std::endl; - FTSERVER_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) << std::endl; + TURTLE_DEBUG() << "ftServer::Encrypting ft item." << std::endl; + TURTLE_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) << std::endl; #endif - uint32_t item_serialized_size = RsGenericSerializer().size(clear_item) ; - uint32_t total_data_size = ENCRYPTED_FT_HEADER_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_EDATA_SIZE + item_serialized_size + ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE ; + uint32_t item_serialized_size = clear_data_size;//RsGenericSerializer().size(clear_item) ; + uint32_t total_data_size = ENCRYPTED_TURTLE_HEADER_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE + item_serialized_size + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE ; #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << " clear part size : " << size(clear_item) << std::endl; - FTSERVER_DEBUG() << " total item size : " << total_data_size << std::endl; + TURTLE_DEBUG() << " clear part size : " << size(clear_item) << std::endl; + TURTLE_DEBUG() << " total item size : " << total_data_size << std::endl; #endif encrypted_item = new RsTurtleGenericDataItem ; @@ -2121,87 +2124,85 @@ bool p3turtle::encryptItem(const RsItem *item,uint8_t *encryption_master_key,RsT edata[0] = 0xae ; edata[1] = 0xad ; - edata[2] = ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 + edata[2] = ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 edata[3] = 0x01 ; - offset += ENCRYPTED_FT_HEADER_SIZE; + offset += ENCRYPTED_TURTLE_HEADER_SIZE; uint32_t aad_offset = offset ; - uint32_t aad_size = ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_EDATA_SIZE ; + uint32_t aad_size = ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE ; - memcpy(&edata[offset], initialization_vector, ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) ; - offset += ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE ; + memcpy(&edata[offset], initialization_vector, ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) ; + offset += ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE ; edata[offset+0] = (edata_size >> 0) & 0xff ; edata[offset+1] = (edata_size >> 8) & 0xff ; edata[offset+2] = (edata_size >> 16) & 0xff ; edata[offset+3] = (edata_size >> 24) & 0xff ; - offset += ENCRYPTED_FT_EDATA_SIZE ; + offset += ENCRYPTED_TURTLE_EDATA_SIZE ; - uint32_t ser_size = (uint32_t)((int)total_data_size - (int)offset); - - serialise(clear_item,&edata[offset], &ser_size); + memcpy(&edata[offset],clear_data,clear_data_size); #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << " clear item : " << RsUtil::BinToHex(&edata[offset],std::min(50,(int)total_data_size-(int)offset)) << "(...)" << std::endl; + TURTLE_DEBUG() << " clear item : " << RsUtil::BinToHex(&edata[offset],std::min(50,(int)total_data_size-(int)offset)) << "(...)" << std::endl; #endif uint32_t clear_item_offset = offset ; offset += edata_size ; uint32_t authentication_tag_offset = offset ; - assert(ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE + offset == total_data_size) ; + assert(ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE + offset == total_data_size) ; - uint8_t encryption_key[32] ; - deriveEncryptionKey(hash,encryption_key) ; + //uint8_t encryption_key[32] ; + //deriveEncryptionKey(hash,encryption_key) ; - if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305) - librs::crypto::AEAD_chacha20_poly1305(encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; - else if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256) - librs::crypto::AEAD_chacha20_sha256 (encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; + if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305) + librs::crypto::AEAD_chacha20_poly1305(encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; + else if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256) + librs::crypto::AEAD_chacha20_sha256 (encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; else return false ; #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; - FTSERVER_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE) << std::endl; - FTSERVER_DEBUG() << " final item : " << RsUtil::BinToHex(&edata[0],std::min(50u,total_data_size)) << "(...)" << std::endl; + TURTLE_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; + TURTLE_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE) << std::endl; + TURTLE_DEBUG() << " final item : " << RsUtil::BinToHex(&edata[0],std::min(50u,total_data_size)) << "(...)" << std::endl; #endif return true ; } // Decrypts the given item using aead-chacha20-poly1305 -bool p3turtle::decryptItem(RsTurtleGenericDataItem *item, uint8_t* encryption_master_key, RsItem *& decrypted_item) +bool p3turtle::decryptItem(const RsTurtleGenericDataItem* encrypted_item, uint8_t *encryption_master_key, unsigned char *& decrypted_data, uint32_t& decrypted_data_size) { - uint8_t encryption_key[32] ; - deriveEncryptionKey(hash,encryption_key) ; + //uint8_t encryption_key[32] ; + //deriveEncryptionKey(hash,encryption_key) ; uint8_t *edata = (uint8_t*)encrypted_item->data_bytes ; uint32_t offset = 0; - if(encrypted_item->data_size < ENCRYPTED_FT_HEADER_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_EDATA_SIZE) return false ; + if(encrypted_item->data_size < ENCRYPTED_TURTLE_HEADER_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE) return false ; if(edata[0] != 0xae) return false ; if(edata[1] != 0xad) return false ; - if(edata[2] != ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305 && edata[2] != ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256) return false ; + if(edata[2] != ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305 && edata[2] != ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256) return false ; if(edata[3] != 0x01) return false ; - offset += ENCRYPTED_FT_HEADER_SIZE ; + offset += ENCRYPTED_TURTLE_HEADER_SIZE ; uint32_t aad_offset = offset ; - uint32_t aad_size = ENCRYPTED_FT_EDATA_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE ; + uint32_t aad_size = ENCRYPTED_TURTLE_EDATA_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE ; uint8_t *initialization_vector = &edata[offset] ; #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << "ftServer::decrypting ft item." << std::endl; - FTSERVER_DEBUG() << " item data : " << RsUtil::BinToHex(edata,std::min(50u,encrypted_item->data_size)) << "(...)" << std::endl; - FTSERVER_DEBUG() << " hash : " << hash << std::endl; - FTSERVER_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; - FTSERVER_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE) << std::endl; + TURTLE_DEBUG() << "ftServer::decrypting ft item." << std::endl; + TURTLE_DEBUG() << " item data : " << RsUtil::BinToHex(edata,std::min(50u,encrypted_item->data_size)) << "(...)" << std::endl; + TURTLE_DEBUG() << " hash : " << hash << std::endl; + TURTLE_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; + TURTLE_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) << std::endl; #endif - offset += ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE ; + offset += ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE ; uint32_t edata_size = 0 ; edata_size += ((uint32_t)edata[offset+0]) << 0 ; @@ -2209,48 +2210,52 @@ bool p3turtle::decryptItem(RsTurtleGenericDataItem *item, uint8_t* encryption_ma edata_size += ((uint32_t)edata[offset+2]) << 16 ; edata_size += ((uint32_t)edata[offset+3]) << 24 ; - if(edata_size + ENCRYPTED_FT_EDATA_SIZE + ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_HEADER_SIZE != encrypted_item->data_size) + if(edata_size + ENCRYPTED_TURTLE_EDATA_SIZE + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_HEADER_SIZE != encrypted_item->data_size) { - FTSERVER_ERROR() << " ERROR: encrypted data size is " << edata_size << ", should be " << encrypted_item->data_size - (ENCRYPTED_FT_EDATA_SIZE + ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE + ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_FT_HEADER_SIZE ) << std::endl; + TURTLE_ERROR() << " ERROR: encrypted data size is " << edata_size << ", should be " << encrypted_item->data_size - (ENCRYPTED_TURTLE_EDATA_SIZE + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_HEADER_SIZE ) << std::endl; return false ; } - offset += ENCRYPTED_FT_EDATA_SIZE ; + offset += ENCRYPTED_TURTLE_EDATA_SIZE ; uint32_t clear_item_offset = offset ; uint32_t authentication_tag_offset = offset + edata_size ; #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE) << std::endl; + TURTLE_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE) << std::endl; #endif bool result ; - if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305) - result = librs::crypto::AEAD_chacha20_poly1305(encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; - else if(edata[2] == ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256) - result = librs::crypto::AEAD_chacha20_sha256 (encryption_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; + if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305) + result = librs::crypto::AEAD_chacha20_poly1305(encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; + else if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256) + result = librs::crypto::AEAD_chacha20_sha256 (encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; else return false ; #ifdef SERVER_DEBUG - FTSERVER_DEBUG() << " authen. result : " << result << std::endl; - FTSERVER_DEBUG() << " decrypted daya : " << RsUtil::BinToHex(&edata[clear_item_offset],std::min(50u,edata_size)) << "(...)" << std::endl; + TURTLE_DEBUG() << " authen. result : " << result << std::endl; + TURTLE_DEBUG() << " decrypted daya : " << RsUtil::BinToHex(&edata[clear_item_offset],std::min(50u,edata_size)) << "(...)" << std::endl; #endif if(!result) { - FTSERVER_ERROR() << "(EE) decryption/authentication went wrong." << std::endl; + TURTLE_ERROR() << "(EE) decryption/authentication went wrong." << std::endl; return false ; } - decrypted_item = dynamic_cast(deserialise(&edata[clear_item_offset],&edata_size)) ; + decrypted_data_size = edata_size ; + decrypted_data = (unsigned char*)rs_malloc(edata_size) ; - if(decrypted_item == NULL) + if(decrypted_data == NULL) + { + std::cerr << "Failed to allocate memory for decrypted data chunk of size " << edata_size << std::endl; return false ; + } + memcpy(decrypted_data,&edata[clear_item_offset],edata_size) ; return true ; } -#endif void p3turtle::getInfo( std::vector >& hashes_info, std::vector >& tunnels_info, diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index 2f7512753..b3c4debe4 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -332,12 +332,11 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config /// Send a data request into the correct tunnel for the given file hash void sendTurtleData(const RsPeerId& virtual_peer_id, RsTurtleGenericTunnelItem *item) ; -#ifdef TODO /// Encrypts/decrypts an item, using a autenticated construction + chacha20, based on the given 32 bytes master key. + /// Input values are not touched (memory is not released). Memory ownership of outputs is left to the client. /// - static bool encryptItem(const RsItem *item, uint8_t* encryption_master_key, RsTurtleGenericDataItem *& encrypted_item) ; - static bool decryptItem(RsTurtleGenericDataItem *item,uint8_t *encryption_master_key,RsItem *& decrypted_item) ; -#endif + static bool encryptData(const unsigned char *clear_data,uint32_t clear_data_size,uint8_t *encryption_master_key,RsTurtleGenericDataItem *& encrypted_item); + static bool decryptItem(const RsTurtleGenericDataItem *item, uint8_t* encryption_master_key, unsigned char *& decrypted_data,uint32_t& decrypted_data_size); private: //--------------------------- Admin/Helper functions -------------------------// From 2255bda0070f01444b0a8a74ae677115e860da8c Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 24 Mar 2018 16:41:51 +0100 Subject: [PATCH 008/213] improved documentation of TurtleClientService class with doxygen type --- .../src/turtle/turtleclientservice.h | 92 ++++++++++++------- 1 file changed, 59 insertions(+), 33 deletions(-) diff --git a/libretroshare/src/turtle/turtleclientservice.h b/libretroshare/src/turtle/turtleclientservice.h index d9552c662..962e57cf0 100644 --- a/libretroshare/src/turtle/turtleclientservice.h +++ b/libretroshare/src/turtle/turtleclientservice.h @@ -42,51 +42,77 @@ class p3turtle ; class RsTurtleClientService { public: - // Handling of tunnel request for the given hash. Most of the time, it's a search in a predefined list. - // The output info_string is used by the turtle router to display info about tunnels it manages. It is - // not passed to the tunnel. - virtual bool handleTunnelRequest(const RsFileHash& /*hash*/,const RsPeerId& /*peer_id*/) { return false ; } + /*! + * \brief handleTunnelRequest + Handling of tunnel request for the given hash. To be derived by the service in order to tell the turtle router + whether the service handles this hash or not. Most of the time, it's a search in a predefined list. + + * \return true if the service + */ + virtual bool handleTunnelRequest(const RsFileHash& /*hash*/,const RsPeerId& /*peer_id*/) { return false ; } - // This method is called by the turtle router to send data that comes out of a turtle tunnel. - // The turtle router stays responsible for the memory management of data. Most of the time the - // data chunk is a serialized item to be de-serialized by the client service. - // - // Parameters: - // virtual_peer_id : name of the tunnel that sent the data - // data : memory chunk for the data - // size : size of data - // item->direction : direction of travel: - // RsTurtleGenericTunnelItem::DIRECTION_CLIENT: the service is acting as a client - // RsTurtleGenericTunnelItem::DIRECTION_CLIENT: the service is acting as a server - // - // Most of the time this parameter is not used by services, except when some info (such as chunk maps, chat items, etc) go - // both ways, and their nature cannot suffice to determine where they should be handled. - // - // By default (if not overloaded), the method will just free the data, as any subclass should do as well. - // Note: p3turtle stays owner of the item, so the client should not delete it! - // + + /*! + * \brief receiveTurtleData + * This method is called by the turtle router to send data that comes out of a turtle tunnel, and should + * be overloaded by the client service. + * The turtle router stays responsible for the memory management of data. Most of the time the + * data chunk is a serialized item to be de-serialized by the client service. + * + * Parameters: + * virtual_peer_id : name of the tunnel that sent the data + * data : memory chunk for the data + * size : size of data + * item->direction : direction of travel: + * RsTurtleGenericTunnelItem::DIRECTION_CLIENT: the service is acting as a client + * RsTurtleGenericTunnelItem::DIRECTION_CLIENT: the service is acting as a server + * + * Most of the time this parameter is not used by services, except when some info (such as chunk maps, chat items, etc) go + * both ways, and their nature cannot suffice to determine where they should be handled. + * + * By default (if not overloaded), the method will just free the data, as any subclass should do as well. + * Note: p3turtle stays owner of the item, so the client should not delete it! + */ virtual void receiveTurtleData(RsTurtleGenericTunnelItem */*item*/,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/) { std::cerr << "!!!!!! Received Data from turtle router, but the client service is not handling it !!!!!!!!!!" << std::endl ; } - // Method for creating specific items of the client service. The - // method has a default behavior of not doing anything, since most client - // services might only use the generic item already provided by the turtle - // router: RsTurtleGenericDataItem - + /*! + * \brief serializer + * Method for creating specific items of the client service. The + * method has a default behavior of not doing anything, since most client + * services might only use the generic item already provided by the turtle + * router: RsTurtleGenericDataItem + * + * \return the client's serializer is returned + */ virtual RsServiceSerializer *serializer() { return NULL ; } - // These methods are called by the turtle router to add/remove virtual peers when tunnels are created/deleted - // + /*! + * \brief addVirtualPeer + * These methods are called by the turtle router to notify the client in order to add/remove virtual peers when tunnels are created/deleted + * These methods must be overloaded, because a service which does not care about tunel being openned or closed is not supposed to need tunnels. + * + * \param hash hash that the tunnel responds to + * \param virtual_peer_id virtual peer id provided by turtle to allow the client to send data into this tunnel. This peer is related to the tunnel itself + * rather than to its destination. As such, multiple peer ids may actually send data to the same computer because multiple tunnels + * arrive at the same location. + * \param dir dir indicates which side the cient will be talking to: CLIENT means that the client is the server. SERVER means that the client acts + * as a client (and therefore actually requested the tunnel). + */ virtual void addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction dir) = 0 ; virtual void removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id) = 0 ; - // This function is mandatory. It should do two things: - // 1 - keep a pointer to the turtle router, so as to be able to send data (e.g. copy pt into a local variable) - // 2 - call pt->registerTunnelService(this), so that the TR knows that service and can send back information to it. - // + /*! + * \brief connectToTurtleRouter + * This function must be overloaded by the client. It should do two things: + * 1 - keep a pointer to the turtle router, so as to be able to send data (e.g. store pt into a local variable) + * 2 - call pt->registerTunnelService(this), so that the TR knows that service and can send back information to it. + * + * \param pt A pointer to the turtle router. + */ virtual void connectToTurtleRouter(p3turtle *pt) = 0 ; }; From 5566d90f328d383a9136d38d86b80e5b33974352 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 24 Mar 2018 16:42:16 +0100 Subject: [PATCH 009/213] finished tunnel handling and data send/recv in GxsNetTunnel --- libretroshare/src/gxs/rsgxsnettunnel.cc | 187 +++++++++++++++++++++--- libretroshare/src/gxs/rsgxsnettunnel.h | 14 +- 2 files changed, 181 insertions(+), 20 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index e9c389454..5e7fe557d 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -25,14 +25,77 @@ #include "util/rsdir.h" #include "retroshare/rspeers.h" +#include "serialiser/rstypeserializer.h" #include "rsgxsnettunnel.h" #define DEBUG_RSGXSNETTUNNEL 1 -#define NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } +#define GXS_NET_TUNNEL_NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } +#define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL : " << __FUNCTION__ << " : " +#define GXS_NET_TUNNEL_ERROR() std::cerr << "(EE) GXS_NET_TUNNEL ERROR : " + RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") {} +//===========================================================================================================================================// +// Transport Items // +//===========================================================================================================================================// + +const uint16_t RS_SERVICE_TYPE_GXS_NET_TUNNEL = 0x2233 ; + +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER = 0x01 ; + +class RsGxsNetTunnelItem: public RsItem +{ +public: + explicit RsGxsNetTunnelItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_GXS_NET_TUNNEL,item_subtype) + { + // no priority. All items are encapsulated into generic Turtle items anyway. + } + + virtual ~RsGxsNetTunnelItem() {} + virtual void clear() {} +}; + +class RsGxsNetTunnelVirtualPeerItem: public RsGxsNetTunnelItem +{ +public: + RsGxsNetTunnelVirtualPeerItem() :RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER) {} + explicit RsGxsNetTunnelVirtualPeerItem(uint8_t subtype) :RsGxsNetTunnelItem(subtype) {} + + virtual ~RsGxsNetTunnelVirtualPeerItem() {} + + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) + { + RsTypeSerializer::serial_process(j,ctx,virtual_peer_id,"virtual_peer_id") ; + } + + RsPeerId virtual_peer_id ; +}; + +class RsGxsNetTunnelSerializer: public RsServiceSerializer +{ +public: + RsGxsNetTunnelSerializer() :RsServiceSerializer(RS_SERVICE_TYPE_GXS_NET_TUNNEL) {} + + virtual RsItem *create_item(uint16_t service,uint8_t item_subtype) const + { + if(service != RS_SERVICE_TYPE_GXS_NET_TUNNEL) + { + GXS_NET_TUNNEL_ERROR() << "received item with wrong service ID " << std::hex << service << std::dec << std::endl; + return NULL ; + } + + switch(item_subtype) + { + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER: return new RsGxsNetTunnelVirtualPeerItem ; + default: + GXS_NET_TUNNEL_ERROR() << "type ID " << std::hex << item_subtype << std::dec << " is not handled!" << std::endl; + return NULL ; + } + } +}; + //===========================================================================================================================================// // Interface with rest of the software // //===========================================================================================================================================// @@ -57,8 +120,7 @@ bool RsGxsNetTunnelService::manage(const RsGxsGroupId& group_id) mHandledHashes[hash] = group_id ; #ifdef DEBUG_GXS_TUNNEL - std::cerr << "Starting distant chat to " << to_gxs_id << ", hash = " << hash << ", from " << from_gxs_id << std::endl; - std::cerr << "Asking turtle router to monitor tunnels for hash " << hash << std::endl; + GXS_NET_TUNNEL_DEBUG() << "Asking turtle router to monitor tunnels for hash " << hash << std::endl; #endif // Now ask the turtle router to manage a tunnel for that hash. @@ -78,7 +140,7 @@ bool RsGxsNetTunnelService::release(const RsGxsGroupId& group_id) if(it == mGroups.end()) { - std::cerr << "RsGxsNetTunnelService::release(): Weird. Cannot release client group " << group_id << " that is not known." << std::endl; + GXS_NET_TUNNEL_ERROR() << "RsGxsNetTunnelService::release(): Weird. Cannot release client group " << group_id << " that is not known." << std::endl; return false ; } @@ -110,7 +172,7 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP if(it == mVirtualPeers.end()) { - std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; + GXS_NET_TUNNEL_ERROR() << "cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; return false ; } @@ -118,7 +180,7 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP if(it2 == mGroups.end()) { - std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; + GXS_NET_TUNNEL_ERROR() << "cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; return false ; } @@ -126,13 +188,13 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP if(it3 == it2->second.virtual_peers.end()) { - std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot find turtle virtual peer " << it->second.second << ". Data is dropped." << std::endl; + std::cerr << "cannot find turtle virtual peer " << it->second.second << ". Data is dropped." << std::endl; return false ; } if(it3->second.vpid_status != RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE) { - std::cerr << "(EE) RsGxsNetTunnelService::sendData(): virtual peer " << it->second.second << " is not active. Data is dropped." << std::endl; + GXS_NET_TUNNEL_ERROR() << "virtual peer " << it->second.second << " is not active. Data is dropped." << std::endl; return false ; } @@ -140,12 +202,14 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; - NOT_IMPLEMENTED(); - // if(!p3Turtle::encryptItem(item,it3->second.encryption_master_key,encrypted_turtle_item)) - // { - // std::cerr << "(EE) RsGxsNetTunnelService::sendData(): cannot encrypt. Something's wrong. Data is dropped." << std::endl; - // return false ; - // } + uint32_t serialized_size = 0; // TODO + RsTemporaryMemory data(serialized_size) ; + + if(!p3turtle::encryptData(data,serialized_size,it3->second.encryption_master_key,encrypted_turtle_item)) + { + GXS_NET_TUNNEL_ERROR() << "cannot encrypt. Something's wrong. Data is dropped." << std::endl; + return false ; + } mTurtle->sendTurtleData(it->second.second,encrypted_turtle_item) ; @@ -155,7 +219,7 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId&, std::list& peers) { // returns the virtual peers for this group - NOT_IMPLEMENTED(); + GXS_NET_TUNNEL_NOT_IMPLEMENTED(); return false ; } @@ -227,7 +291,7 @@ void RsGxsNetTunnelService::connectToTurtleRouter(p3turtle *tr) bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) { - NOT_IMPLEMENTED(); + GXS_NET_TUNNEL_NOT_IMPLEMENTED(); // at this point we need to talk to the client services // There's 2 ways to do that: @@ -236,10 +300,70 @@ bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsP return true ; } + void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) { - NOT_IMPLEMENTED(); + GXS_NET_TUNNEL_NOT_IMPLEMENTED(); + + if(item->PacketSubType() != RS_TURTLE_SUBTYPE_GENERIC_DATA) + { + GXS_NET_TUNNEL_ERROR() << "item with type " << std::hex << item->PacketSubType() << std::dec << " received by GxsNetTunnel, but is not handled!" << std::endl; + return; + } + + // (cyril) this is a bit complicated. We should store pointers to the encryption keys in another structure and access it directly. + + auto it = mHandledHashes.find(hash) ; + + if(it == mHandledHashes.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for hash " << hash << " but this hash is unknown!" << std::endl; + return; + } + + RsGxsGroupId group_id = it->second; + + auto it2 = mGroups.find(group_id) ; + + if(it2 == mGroups.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for hash " << hash << " and group " << group_id << " but this group id is unknown!" << std::endl; + return; + } + + RsGxsNetTunnelGroupInfo& g_info(it2->second) ; + + g_info.last_contact = time(NULL) ; + + auto it3 = g_info.virtual_peers.find(virtual_peer_id) ; + + if(it3 == g_info.virtual_peers.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for hash " << hash << ", group " << group_id << " but the virtual peer id is missing!" << std::endl; + return; + } + + RsGxsNetTunnelVirtualPeerInfo& vp_info(it3->second) ; + + unsigned char *data = NULL ; + uint32_t data_size = 0 ; + + if(!p3turtle::decryptItem(static_cast(item),vp_info.encryption_master_key,data,data_size)) + { + GXS_NET_TUNNEL_ERROR() << "Cannot decrypt data!" << std::endl; + + if(data) + free(data) ; + + return ; + } + + RsGxsNetTunnelItem *decrypted_item = dynamic_cast(RsGxsNetTunnelSerializer().deserialise(data,&data_size)) ; + free(data); + + handleIncoming(decrypted_item); } + void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) { auto it = mHandledHashes.find(hash) ; @@ -258,11 +382,25 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur RsGxsNetTunnelVirtualPeerInfo& vpinfo( ginfo.virtual_peers[vpid] ) ; vpinfo.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK ; - vpinfo.net_service_virtual_peer.clear(); vpinfo.side = dir ; vpinfo.last_contact = time(NULL) ; generateEncryptionKey(group_id,vpid,vpinfo.encryption_master_key ); + + // If we're a server, we need to send our own virtual peer id to the client + + if(dir == RsTurtleGenericTunnelItem::DIRECTION_CLIENT) + { + vpinfo.net_service_virtual_peer = makeServerVirtualPeerIdForGroup(group_id); + + RsGxsNetTunnelVirtualPeerItem *pitem = new RsGxsNetTunnelVirtualPeerItem ; + + pitem->virtual_peer_id = vpinfo.net_service_virtual_peer ; + + vpinfo.outgoing_items.push_back(pitem) ; + } + else + vpinfo.net_service_virtual_peer.clear(); } void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid) @@ -309,6 +447,19 @@ void RsGxsNetTunnelService::generateEncryptionKey(const RsGxsGroupId& group_id,c // Service parts // //===========================================================================================================================================// +void RsGxsNetTunnelService::data_tick() +{ + GXS_NET_TUNNEL_DEBUG() << std::endl; + + // cleanup + + autowash(); +} + +void RsGxsNetTunnelService::autowash() +{ +} + #ifdef TODO void RsGxsNetTunnelService::handleIncomingItem(const RsGxsTunnelId& tunnel_id,RsGxsTunnelItem *item) { diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 2f6cb0eae..16f00de4b 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -66,6 +66,8 @@ typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; +class RsGxsNetTunnelItem ; + struct RsGxsNetTunnelVirtualPeerInfo { enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. @@ -77,7 +79,7 @@ struct RsGxsNetTunnelVirtualPeerInfo uint8_t vpid_status ; // status of the peer uint8_t side ; // client/server - uint8_t encryption_master_key[16] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) + uint8_t encryption_master_key[32] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) time_t last_contact ; // last time some data was sent/recvd RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; // anonymised peer that is used to communicate with client services @@ -103,7 +105,7 @@ struct RsGxsNetTunnelGroupInfo std::map virtual_peers ; }; -class RsGxsNetTunnelService: public RsTurtleClientService +class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread { public: RsGxsNetTunnelService() ; @@ -156,6 +158,11 @@ public: // - method to encrypt/decrypt data and send/receive to/from turtle. virtual void connectToTurtleRouter(p3turtle *tr) ; + + // Overloaded from RsTickingThread + + void data_tick() ; + protected: // interaction with turtle router @@ -166,6 +173,9 @@ protected: p3turtle *mTurtle ; private: + void autowash() ; + void handleIncoming(RsGxsNetTunnelItem *item) ; + static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 16 ; static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; From b488760d7d8c858c970712cbc37a8a46c0453f80 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 26 Mar 2018 23:19:29 +0200 Subject: [PATCH 010/213] fixed data incoming/outgoing in GxsNetTunnel --- libretroshare/src/gxs/rsgxsnettunnel.cc | 144 ++++++++++++++++++------ libretroshare/src/gxs/rsgxsnettunnel.h | 3 +- 2 files changed, 110 insertions(+), 37 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 5e7fe557d..36ac81f47 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -37,6 +37,19 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") {} +//===========================================================================================================================================// +// Internal structures // +//===========================================================================================================================================// + +RsGxsNetTunnelVirtualPeerInfo::~RsGxsNetTunnelVirtualPeerInfo() +{ + for(auto it(outgoing_items.begin());it!=outgoing_items.end();++it) + delete *it ; + + for(auto it(incoming_data.begin());it!=incoming_data.end();++it) + delete *it ; +} + //===========================================================================================================================================// // Transport Items // //===========================================================================================================================================// @@ -267,7 +280,7 @@ void RsGxsNetTunnelService::dump() const std::cerr << " turtle:" << it2->first << " status: " << vpid_status_str[it2->second.vpid_status] << " s: " << (int)it2->second.side << " last seen " << time(NULL)-it2->second.last_contact << " ekey: " << RsUtil::BinToHex(it2->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) - << " pending (" << it2->second.incoming_items.size() << "," << it2->second.outgoing_items.size() << ")" << std::endl; + << " pending (" << it2->second.incoming_data.size() << "," << it2->second.outgoing_items.size() << ")" << std::endl; } std::cerr << "Virtual peers: " << std::endl; @@ -303,7 +316,9 @@ bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsP void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) { - GXS_NET_TUNNEL_NOT_IMPLEMENTED(); +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " received turtle data for vpid " << virtual_peer_id << " for hash " << hash << " in direction " << (int)direction << std::endl; +#endif if(item->PacketSubType() != RS_TURTLE_SUBTYPE_GENERIC_DATA) { @@ -358,10 +373,42 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return ; } - RsGxsNetTunnelItem *decrypted_item = dynamic_cast(RsGxsNetTunnelSerializer().deserialise(data,&data_size)) ; - free(data); + // Now we might get 2 kinds of items: GxsNetTunnel items, to be handled here, and Gxs data items, to be handled by the client service - handleIncoming(decrypted_item); + RsItem *decrypted_item = RsGxsNetTunnelSerializer().deserialise(data,&data_size); + + RsGxsNetTunnelVirtualPeerItem *pid_item = dynamic_cast(decrypted_item) ; + + if(pid_item) + { + if(direction == RsTurtleGenericTunnelItem::DIRECTION_SERVER) + { +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id << ". Setting virtual peer." << std::endl; +#endif + vp_info.net_service_virtual_peer = pid_item->virtual_peer_id; + vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; + } + else + GXS_NET_TUNNEL_ERROR() << "Cannot decrypt data!" << std::endl; + + free(data); + return ; + } + else + { +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " item is GXS data. Storing into incoming list." << std::endl; +#endif + // push the data into the service incoming data list + + RsTlvBinaryData *bind = new RsTlvBinaryData; + bind->tlvtype = 0; + bind->bin_len = data_size; + bind->bin_data = data; + + vp_info.incoming_data.push_back(bind) ; + } } void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) @@ -374,6 +421,9 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur return ; } +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " adding virtual peer " << vpid << " for hash " << hash << " in direction " << dir << std::endl; +#endif const RsGxsGroupId group_id(it->second) ; RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; @@ -393,6 +443,9 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur { vpinfo.net_service_virtual_peer = makeServerVirtualPeerIdForGroup(group_id); +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " peer is server side: sending back virtual peer name " << vpinfo.net_service_virtual_peer << std::endl; +#endif RsGxsNetTunnelVirtualPeerItem *pitem = new RsGxsNetTunnelVirtualPeerItem ; pitem->virtual_peer_id = vpinfo.net_service_virtual_peer ; @@ -405,6 +458,9 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid) { +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " removing virtual peer " << vpid << " for hash " << hash << std::endl; +#endif auto it = mHandledHashes.find(hash) ; if(it == mHandledHashes.end()) @@ -420,7 +476,13 @@ void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const ginfo.virtual_peers.erase(vpid); if(ginfo.virtual_peers.empty()) + { ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED ; + +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " no more virtual peers for group " << group_id << ": setting status to TUNNELS_REQUESTED" << std::endl; +#endif + } } RsFileHash RsGxsNetTunnelService::calculateGroupHash(const RsGxsGroupId& group_id) const @@ -454,41 +516,51 @@ void RsGxsNetTunnelService::data_tick() // cleanup autowash(); + + static time_t last_dump = time(NULL); + time_t now = time(NULL); + + if(last_dump + 10 > now) + { + last_dump = now; + dump(); + } } void RsGxsNetTunnelService::autowash() { } -#ifdef TODO -void RsGxsNetTunnelService::handleIncomingItem(const RsGxsTunnelId& tunnel_id,RsGxsTunnelItem *item) -{ - if(item == NULL) - return ; - - // We have 3 things to do: - // - // 1 - if it's a data item, send an ACK - // 2 - if it's an ack item, mark the item as properly received, and remove it from the queue - // 3 - if it's a status item, act accordingly. - - switch(item->PacketSubType()) - { - - case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast(item)) ; - break ; - - case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast(item)) ; - break ; - - case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast(item)) ; - break ; - - default: - std::cerr << "(EE) impossible situation. DH items should be handled at the service level" << std::endl; - } - - delete item ; -} -#endif +// void RsGxsNetTunnelService::handleIncoming(const RsGxsTunnelId& tunnel_id,RsGxsTunnelItem *item) +// { +// #ifdef DEBUG_RSGXSNETTUNNEL +// GXS_NET_TUNNEL_DEBUG() << " received turtle data for vpid " << virtual_peer_id << " for hash " << hash << " in direction " << dir << std::endl; +// #endif +// if(item == NULL) +// return ; +// +// // We have 3 things to do: +// // +// // 1 - if it's a data item, send an ACK +// // 2 - if it's an ack item, mark the item as properly received, and remove it from the queue +// // 3 - if it's a status item, act accordingly. +// +// switch(item->PacketSubType()) +// { +// +// case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast(item)) ; +// break ; +// +// case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast(item)) ; +// break ; +// +// case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast(item)) ; +// break ; +// +// default: +// std::cerr << "(EE) impossible situation. DH items should be handled at the service level" << std::endl; +// } +// +// delete item ; +// } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 16f00de4b..798b49f1e 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -76,6 +76,7 @@ struct RsGxsNetTunnelVirtualPeerInfo }; RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN) { memset(encryption_master_key,0,16) ; } + ~RsGxsNetTunnelVirtualPeerInfo() ; uint8_t vpid_status ; // status of the peer uint8_t side ; // client/server @@ -85,7 +86,7 @@ struct RsGxsNetTunnelVirtualPeerInfo RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; // anonymised peer that is used to communicate with client services RsGxsGroupId group_id ; // group id - std::list incoming_items ; + std::list incoming_data ; std::list outgoing_items ; }; From 73b04f3109b8df3769c5c8199ea99b11c3213144 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 29 Mar 2018 10:54:58 +0200 Subject: [PATCH 011/213] finished implementation of GxsNetTunnel service --- libretroshare/src/gxs/rsgxsnetservice.cc | 4 +- libretroshare/src/gxs/rsgxsnetservice.h | 3 +- libretroshare/src/gxs/rsgxsnettunnel.cc | 180 ++++++++++++----------- libretroshare/src/gxs/rsgxsnettunnel.h | 69 ++++++--- 4 files changed, 148 insertions(+), 108 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 5fc4427ad..914b6ce4e 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -359,7 +359,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, const RsServiceInfo serviceInfo, RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs, - PgpAuxUtils *pgpUtils, bool grpAutoSync, bool msgAutoSync, uint32_t default_store_period, uint32_t default_sync_period) + PgpAuxUtils *pgpUtils, bool grpAutoSync, bool msgAutoSync, bool distSync, uint32_t default_store_period, uint32_t default_sync_period) : p3ThreadedService(), p3Config(), mTransactionN(0), mObserver(nxsObs), mDataStore(gds), mServType(servType), mTransactionTimeOut(TRANSAC_TIMEOUT), @@ -368,7 +368,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mGixs(gixs), mReputations(reputations), mPgpUtils(pgpUtils), - mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync), + mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync),mAllowDistSync(distSync), mServiceInfo(serviceInfo), mDefaultMsgStorePeriod(default_store_period), mDefaultMsgSyncPeriod(default_sync_period) { diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 00ba07953..49d44dab2 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -90,7 +90,7 @@ public: const RsServiceInfo serviceInfo, RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL, PgpAuxUtils *pgpUtils = NULL, - bool grpAutoSync = true, bool msgAutoSync = true, + bool grpAutoSync = true, bool msgAutoSync = true,bool distSync=false, uint32_t default_store_period = RS_GXS_DEFAULT_MSG_STORE_PERIOD, uint32_t default_sync_period = RS_GXS_DEFAULT_MSG_REQ_PERIOD); @@ -543,6 +543,7 @@ private: PgpAuxUtils *mPgpUtils; bool mGrpAutoSync; bool mAllowMsgSync; + bool mAllowDistSync; // need to be verfied std::vector mPendingResp; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 36ac81f47..6d763a092 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -57,6 +57,7 @@ RsGxsNetTunnelVirtualPeerInfo::~RsGxsNetTunnelVirtualPeerInfo() const uint16_t RS_SERVICE_TYPE_GXS_NET_TUNNEL = 0x2233 ; const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER = 0x01 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE = 0x02 ; class RsGxsNetTunnelItem: public RsItem { @@ -74,7 +75,6 @@ class RsGxsNetTunnelVirtualPeerItem: public RsGxsNetTunnelItem { public: RsGxsNetTunnelVirtualPeerItem() :RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER) {} - explicit RsGxsNetTunnelVirtualPeerItem(uint8_t subtype) :RsGxsNetTunnelItem(subtype) {} virtual ~RsGxsNetTunnelVirtualPeerItem() {} @@ -86,6 +86,15 @@ public: RsPeerId virtual_peer_id ; }; +class RsGxsNetTunnelKeepAliveItem: public RsGxsNetTunnelItem +{ +public: + RsGxsNetTunnelKeepAliveItem() :RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE) {} + + virtual ~RsGxsNetTunnelKeepAliveItem() {} + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) {} +}; + class RsGxsNetTunnelSerializer: public RsServiceSerializer { public: @@ -102,6 +111,7 @@ public: switch(item_subtype) { case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER: return new RsGxsNetTunnelVirtualPeerItem ; + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE : return new RsGxsNetTunnelKeepAliveItem ; default: GXS_NET_TUNNEL_ERROR() << "type ID " << std::hex << item_subtype << std::dec << " is not handled!" << std::endl; return NULL ; @@ -113,71 +123,19 @@ public: // Interface with rest of the software // //===========================================================================================================================================// -bool RsGxsNetTunnelService::manage(const RsGxsGroupId& group_id) -{ - RsFileHash hash = calculateGroupHash(group_id) ; - - RsStackMutex stack(mGxsNetTunnelMtx); /********** STACK LOCKED MTX ******/ - - RsGxsNetTunnelGroupInfo& info(mGroups[group_id]) ; - - time_t now = time(NULL) ; - - if(info.group_status == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE) - return true; - - info.hash = hash ; - info.last_contact = now ; - info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; - - mHandledHashes[hash] = group_id ; - -#ifdef DEBUG_GXS_TUNNEL - GXS_NET_TUNNEL_DEBUG() << "Asking turtle router to monitor tunnels for hash " << hash << std::endl; -#endif - - // Now ask the turtle router to manage a tunnel for that hash. - - mTurtle->monitorTunnels(hash,this,false) ; - - return true; -} - -bool RsGxsNetTunnelService::release(const RsGxsGroupId& group_id) -{ - RsStackMutex stack(mGxsNetTunnelMtx); /********** STACK LOCKED MTX ******/ - - // Here we need to clean the stuff that was created by this group id. - - auto it = mGroups.find(group_id) ; - - if(it == mGroups.end()) - { - GXS_NET_TUNNEL_ERROR() << "RsGxsNetTunnelService::release(): Weird. Cannot release client group " << group_id << " that is not known." << std::endl; - return false ; - } - - mGroups.erase(it) ; - - RsFileHash hash = calculateGroupHash(group_id) ; - - mHandledHashes.erase(hash) ; - return true ; -} - -class ItemAutoDelete +class DataAutoDelete { public: - ItemAutoDelete(RsItem *& item) : mItem(item) {} - ~ItemAutoDelete() { delete mItem; mItem=NULL ; } - RsItem *& mItem; + DataAutoDelete(unsigned char *& data) : mData(data) {} + ~DataAutoDelete() { free(mData); mData=NULL ; } + unsigned char *& mData; }; -bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::sendData(unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) { // The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router. - ItemAutoDelete iad(item) ; // This ensures the item is deleted whatsoever when leaving + DataAutoDelete iad(data) ; // This ensures the item is deleted whatsoever when leaving // 1 - find the virtual peer and the proper master key to encrypt with, and check that all the info is known @@ -215,10 +173,7 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; - uint32_t serialized_size = 0; // TODO - RsTemporaryMemory data(serialized_size) ; - - if(!p3turtle::encryptData(data,serialized_size,it3->second.encryption_master_key,encrypted_turtle_item)) + if(!p3turtle::encryptData(data,data_len,it3->second.encryption_master_key,encrypted_turtle_item)) { GXS_NET_TUNNEL_ERROR() << "cannot encrypt. Something's wrong. Data is dropped." << std::endl; return false ; @@ -229,11 +184,63 @@ bool RsGxsNetTunnelService::sendItem(RsItem *& item,const RsGxsNetTunnelVirtualP return true ; } -bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId&, std::list& peers) +bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId& group_id, std::list& peers) { - // returns the virtual peers for this group - GXS_NET_TUNNEL_NOT_IMPLEMENTED(); - return false ; + // This function has two effects: + // - return the virtual peers for this group + // - passively set the group as "managed", so that it we answer tunnel requests. + + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + // update the hash entry if needed + + RsFileHash hash = calculateGroupHash(group_id); + mHandledHashes[hash] = group_id ; + + // Create the group entry, if needed, with passive mode. + + RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; + + ginfo.hash = hash ; + + for(auto it2 = ginfo.virtual_peers.begin();it2 != ginfo.virtual_peers.end();++it2) + if(it2->second.vpid_status == RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE) + peers.push_back(it2->second.net_service_virtual_peer) ; + +#ifdef DEBUG_GXS_TUNNEL + GXS_NET_TUNNEL_DEBUG() << "returning " << peers.size() << " peers." << std::endl; +#endif + + return true ; +} + +bool RsGxsNetTunnelService::requestPeers(const RsGxsGroupId& group_id) +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + // Now ask the turtle router to manage a tunnel for that hash. + + RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; + + ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; + + // we dont set the group policy here. It will only be set if no peers, or too few peers are available. + + return true; +} + +bool RsGxsNetTunnelService::releasePeers(const RsGxsGroupId& group_id) +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + // Ask turtle router to stop requesting tunnels for that hash. + + RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; + + ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE; + mTurtle->stopMonitoringTunnels(ginfo.hash) ; + + return true; } RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::makeServerVirtualPeerIdForGroup(const RsGxsGroupId& group_id) const @@ -304,14 +311,9 @@ void RsGxsNetTunnelService::connectToTurtleRouter(p3turtle *tr) bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) { - GXS_NET_TUNNEL_NOT_IMPLEMENTED(); + // We simply check for wether a managed group has a hash that corresponds to the given hash. - // at this point we need to talk to the client services - // There's 2 ways to do that: - // 1 - client services "register" and we ask them one by one. - // 2 - client service derives from RsGxsNetTunnelService and the client is interrogated using an overloaded virtual method - - return true ; + return mHandledHashes.find(hash) != mHandledHashes.end(); } void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) @@ -437,23 +439,27 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur generateEncryptionKey(group_id,vpid,vpinfo.encryption_master_key ); - // If we're a server, we need to send our own virtual peer id to the client + // We need to send our own virtual peer id to the other end of the tunnel - if(dir == RsTurtleGenericTunnelItem::DIRECTION_CLIENT) - { - vpinfo.net_service_virtual_peer = makeServerVirtualPeerIdForGroup(group_id); + vpinfo.net_service_virtual_peer = makeServerVirtualPeerIdForGroup(group_id); #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " peer is server side: sending back virtual peer name " << vpinfo.net_service_virtual_peer << std::endl; + GXS_NET_TUNNEL_DEBUG() << " sending back virtual peer name " << vpinfo.net_service_virtual_peer << " to end of tunnel" << std::endl; #endif - RsGxsNetTunnelVirtualPeerItem *pitem = new RsGxsNetTunnelVirtualPeerItem ; + RsGxsNetTunnelVirtualPeerItem pitem ; + pitem.virtual_peer_id = vpinfo.net_service_virtual_peer ; - pitem->virtual_peer_id = vpinfo.net_service_virtual_peer ; + RsTemporaryMemory tmpmem( RsGxsNetTunnelSerializer().size(&pitem) ) ; + uint32_t len = tmpmem.size(); - vpinfo.outgoing_items.push_back(pitem) ; - } + RsGxsNetTunnelSerializer().serialise(&pitem,tmpmem,&len); + + RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; + + if(p3turtle::encryptData(tmpmem,len,vpinfo.encryption_master_key,encrypted_turtle_item)) + mTurtle->sendTurtleData(vpid,encrypted_turtle_item) ; else - vpinfo.net_service_virtual_peer.clear(); + GXS_NET_TUNNEL_ERROR() << "cannot encrypt. Something's wrong. Data is dropped." << std::endl; } void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid) @@ -531,6 +537,12 @@ void RsGxsNetTunnelService::autowash() { } +// info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; +// +// mTurtle->monitorTunnels(hash,this,false) ; +// info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; + + // void RsGxsNetTunnelService::handleIncoming(const RsGxsTunnelId& tunnel_id,RsGxsTunnelItem *item) // { // #ifdef DEBUG_RSGXSNETTUNNEL diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 798b49f1e..901aba61d 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -34,6 +34,10 @@ * * It is the responsibility of RsGxsNetService to activate/desactivate tunnels for each particular group, depending on wether the group * is already available at friends or not. + * + * Tunnel management is done at the level of groups rather than services, because we would like to keep the possibility to not + * request tunnels for some groups which do not need it, and only request tunnels for specific groups that cannot be provided + * by direct connections. */ // Protocol: @@ -61,8 +65,23 @@ // Client <------------------- GXS Data ------------------> Server | // - // Notes: -// * tunnels are only used one-way. If a distant peers wants to sync the same group, he'll have to open his own tunnel, with a different ID. -// * each group will produced multiple tunnels, but each tunnel with have exactly one virtual peer ID +// * tunnels are established symetrically. If a distant peers wants to sync the same group, they'll have to open a single tunnel, with a different ID. +// Groups therefore have two states: +// - managed : the group can be used to answer tunnel requests. If server tunnels are established, the group will be synced with these peers +// - tunneled: the group will actively request tunnels. If tunnels are established both ways, the same virtual peers will be used so the tunnels are "merged". +// * In practice, that means one of the two tunnels will not be used and therefore die. +// * If a tunneled group already has enough virtual peers, it will not request for tunnels itself. +// +// Group policy | Request tunnels | SyncWithPeers | Item receipt +// --------------------+-------------------+-----------------------+---------------- +// Passive | no | If peers present | If peers present +// Active | yes, if no peers | If peers present | If peers present +// | | | +// +// * when a service has the DistSync flag set, groups to sync are communicated passively to the GxsNetTunnel service when requesting distant peers. +// However, a call should be made to set a particular group policy to "ACTIVE" for group that do not have peers and need some. +// +// * services also need to retrieve GXS data items that come out of tunnels. These will be available as (data,len) type, since they are not de-serialized. typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; @@ -75,7 +94,7 @@ struct RsGxsNetTunnelVirtualPeerInfo RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. }; - RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN) { memset(encryption_master_key,0,16) ; } + RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN) { memset(encryption_master_key,0,32) ; } ~RsGxsNetTunnelVirtualPeerInfo() ; uint8_t vpid_status ; // status of the peer @@ -92,14 +111,23 @@ struct RsGxsNetTunnelVirtualPeerInfo struct RsGxsNetTunnelGroupInfo { - enum { RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status - RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x01, // waiting for turtle to send some virtual peers. - RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available + enum GroupStatus { + RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status + RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting + RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x02, // virtual peers requested, and waiting for turtle to answer + RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x03 // some virtual peers are available. Data can be read/written }; - RsGxsNetTunnelGroupInfo() : group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN),last_contact(0) {} + enum GroupPolicy { + RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set + RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels + RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group explicitely request tunnels, if none available + }; - uint8_t group_status ; + RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} + + GroupPolicy group_policy ; + GroupStatus group_status ; time_t last_contact ; TurtleFileHash hash ; @@ -112,27 +140,32 @@ public: RsGxsNetTunnelService() ; /*! - * \brief start managing tunnels for this group - * @param group_id group for which tunnels should be requested + * \brief Manage tunnels for this group + * @param group_id group for which tunnels should be released */ - bool manage(const RsGxsGroupId& group_id) ; + bool requestPeers(const RsGxsGroupId&group_id) ; /*! * \brief Stop managing tunnels for this group * @param group_id group for which tunnels should be released */ - bool release(const RsGxsGroupId&group_id) ; - + bool releasePeers(const RsGxsGroupId&group_id) ; /*! - * \brief sendItem + * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and + * alive. This function also "registers" the group which allows to handle tunnel requests in the server side. + */ + bool getVirtualPeers(const RsGxsGroupId& group_id, std::list& peers) ; // returns the virtual peers for this group + + /*! + * \brief sendData * send data to this virtual peer, and takes memory ownership (deletes the item) * \param item item to send * \param virtual_peer destination virtual peer * \return * true if succeeded. */ - bool sendItem(RsItem *& item, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool sendData(unsigned char *& data, uint32_t data_len, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief receivedItem @@ -142,12 +175,6 @@ public: */ RsItem *receivedItem(const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; - /*! - * \brief Get the list of active virtual peers for a given group. This implies that the tunnel is up and - * alive. - */ - bool getVirtualPeers(const RsGxsGroupId&, std::list& peers) ; // returns the virtual peers for this group - /*! * \brief dumps all information about monitored groups. */ From f0f69b8dd95d411aab8a7e7b892f3d36d5fe8c90 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 29 Mar 2018 16:26:36 +0200 Subject: [PATCH 012/213] shared virtual peers across services --- libretroshare/src/gxs/rsgxsnetservice.cc | 14 ++ libretroshare/src/gxs/rsgxsnettunnel.cc | 273 +++++++++++------------ libretroshare/src/gxs/rsgxsnettunnel.h | 37 ++- 3 files changed, 170 insertions(+), 154 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 914b6ce4e..7962f9bf3 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -565,6 +565,20 @@ void RsGxsNetService::syncWithPeers() std::set peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType, peers); + +#ifdef TODO + if(mAllowDistSync) + { + // Grab all online virtual peers of distant tunnels for the current service. + + std::list vpids ; + mGxsNetTunnel->getVirtualPeers(mServType,vpids); + + for(auto it(vpids.begin());it!=vpids.end();++it) + peers.push_back(RsPeerId(*it)) ; + } +#endif + if (peers.empty()) { // nothing to do return; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 6d763a092..d5628eed3 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -43,11 +43,9 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") RsGxsNetTunnelVirtualPeerInfo::~RsGxsNetTunnelVirtualPeerInfo() { - for(auto it(outgoing_items.begin());it!=outgoing_items.end();++it) - delete *it ; - - for(auto it(incoming_data.begin());it!=incoming_data.end();++it) - delete *it ; + for(auto it(providing_set.begin());it!=providing_set.end();++it) + for(auto it2(it->second.incoming_data.begin());it2!=it->second.incoming_data.end();++it2) + delete *it2 ; } //===========================================================================================================================================// @@ -131,8 +129,21 @@ public: unsigned char *& mData; }; +RsGxsNetTunnelService::~RsGxsNetTunnelService() +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + // This is needed because we need to clear these structure in a mutex protected environment + // Also this calls the destructor of the objects which calls the freeing of memory e.g. allocated in the incoming data list. + + mGroups.clear(); + mHandledHashes.clear(); + mVirtualPeers.clear(); +} + bool RsGxsNetTunnelService::sendData(unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) { + RS_STACK_MUTEX(mGxsNetTunnelMtx); // The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router. DataAutoDelete iad(data) ; // This ensures the item is deleted whatsoever when leaving @@ -147,25 +158,9 @@ bool RsGxsNetTunnelService::sendData(unsigned char *& data,uint32_t data_len,con return false ; } - auto it2 = mGroups.find(it->second.first); - - if(it2 == mGroups.end()) + if(it->second.vpid_status != RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE) { - GXS_NET_TUNNEL_ERROR() << "cannot find virtual peer " << virtual_peer << ". Data is dropped." << std::endl; - return false ; - } - - auto it3 = it2->second.virtual_peers.find(it->second.second); - - if(it3 == it2->second.virtual_peers.end()) - { - std::cerr << "cannot find turtle virtual peer " << it->second.second << ". Data is dropped." << std::endl; - return false ; - } - - if(it3->second.vpid_status != RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE) - { - GXS_NET_TUNNEL_ERROR() << "virtual peer " << it->second.second << " is not active. Data is dropped." << std::endl; + GXS_NET_TUNNEL_ERROR() << "virtual peer " << virtual_peer << " is not active. Data is dropped." << std::endl; return false ; } @@ -173,18 +168,18 @@ bool RsGxsNetTunnelService::sendData(unsigned char *& data,uint32_t data_len,con RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; - if(!p3turtle::encryptData(data,data_len,it3->second.encryption_master_key,encrypted_turtle_item)) + if(!p3turtle::encryptData(data,data_len,it->second.encryption_master_key,encrypted_turtle_item)) { GXS_NET_TUNNEL_ERROR() << "cannot encrypt. Something's wrong. Data is dropped." << std::endl; return false ; } - mTurtle->sendTurtleData(it->second.second,encrypted_turtle_item) ; + mTurtle->sendTurtleData(it->second.turtle_virtual_peer_id,encrypted_turtle_item) ; return true ; } -bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId& group_id, std::list& peers) +bool RsGxsNetTunnelService::getVirtualPeers(uint16_t service_id, std::list& peers) { // This function has two effects: // - return the virtual peers for this group @@ -194,21 +189,12 @@ bool RsGxsNetTunnelService::getVirtualPeers(const RsGxsGroupId& group_id, std::l // update the hash entry if needed - RsFileHash hash = calculateGroupHash(group_id); - mHandledHashes[hash] = group_id ; - - // Create the group entry, if needed, with passive mode. - - RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; - - ginfo.hash = hash ; - - for(auto it2 = ginfo.virtual_peers.begin();it2 != ginfo.virtual_peers.end();++it2) - if(it2->second.vpid_status == RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE) - peers.push_back(it2->second.net_service_virtual_peer) ; + for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) + if(it->second.providing_set.find(service_id) != it->second.providing_set.end()) + peers.push_back(it->first) ; #ifdef DEBUG_GXS_TUNNEL - GXS_NET_TUNNEL_DEBUG() << "returning " << peers.size() << " peers." << std::endl; + GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " returning " << peers.size() << " peers." << std::endl; #endif return true ; @@ -243,19 +229,19 @@ bool RsGxsNetTunnelService::releasePeers(const RsGxsGroupId& group_id) return true; } -RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::makeServerVirtualPeerIdForGroup(const RsGxsGroupId& group_id) const +RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId() const { assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ; - // We compute sha1( SSL_id | group_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId + // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId RsPeerId ssl_id = rsPeers->getOwnId() ; - unsigned char mem[RsPeerId::SIZE_IN_BYTES + RsGxsGroupId::SIZE_IN_BYTES + RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE]; + unsigned char mem[RsPeerId::SIZE_IN_BYTES /*+ RsGxsGroupId::SIZE_IN_BYTES */ + RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE]; memcpy(mem ,ssl_id.toByteArray() ,RsPeerId::SIZE_IN_BYTES) ; - memcpy(mem+RsPeerId::SIZE_IN_BYTES ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; - memcpy(mem+RsPeerId::SIZE_IN_BYTES+RsGxsGroupId::SIZE_IN_BYTES,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; + //memcpy(mem+RsPeerId::SIZE_IN_BYTES ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; + memcpy(mem+RsPeerId::SIZE_IN_BYTES /*+RsGxsGroupId::SIZE_IN_BYTES*/,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsPeerId::SIZE_IN_BYTES+RsGxsGroupId::SIZE_IN_BYTES+RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); } @@ -264,12 +250,18 @@ void RsGxsNetTunnelService::dump() const { RS_STACK_MUTEX(mGxsNetTunnelMtx); - static std::string group_status_str[3] = { + static std::string group_status_str[4] = { std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN ]"), + std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE ]"), std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED]"), std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ]") }; + static std::string group_policy_str[3] = { + std::string("[RS_GXS_NET_TUNNEL_POLICY_UNKNOWN]"), + std::string("[RS_GXS_NET_TUNNEL_POLICY_PASSIVE]"), + std::string("[RS_GXS_NET_TUNNEL_POLICY_ACTIVE ]"), + }; static std::string vpid_status_str[3] = { std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN ]"), std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK ]"), @@ -281,18 +273,23 @@ void RsGxsNetTunnelService::dump() const for(auto it(mGroups.begin());it!=mGroups.end();++it) { - std::cerr << " " << it->first << " hash: " << it->second.hash << " status: " << group_status_str[it->second.group_status] << "] Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; - + std::cerr << " " << it->first << " hash: " << it->second.hash << " policy: " << group_policy_str[it->second.group_policy] << " status: " << group_status_str[it->second.group_status] << "] Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; + std::cerr << " virtual peers:" << std::endl; for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2) - std::cerr << " turtle:" << it2->first << " status: " << vpid_status_str[it2->second.vpid_status] << " s: " - << (int)it2->second.side << " last seen " << time(NULL)-it2->second.last_contact - << " ekey: " << RsUtil::BinToHex(it2->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) - << " pending (" << it2->second.incoming_data.size() << "," << it2->second.outgoing_items.size() << ")" << std::endl; + std::cerr << " " << *it2 << std::endl; } std::cerr << "Virtual peers: " << std::endl; for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) - std::cerr << " GXS Peer:" << it->first << " group_id: " << it->second.first << " Turtle:" << it->second.second << std::endl; + { + std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id + << " status: " << vpid_status_str[it->second.vpid_status] << " s: " + << (int)it->second.side << " last seen " << time(NULL)-it->second.last_contact + << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) ; + + for(auto it2(it->second.providing_set.begin());it2!=it->second.providing_set.end();++it2) + std::cerr << " service " << std::hex << it2->first << std::dec << " " << it2->second.provided_groups.size() << " groups, " << it2->second.incoming_data.size() << " data" << std::endl; + } std::cerr << "Hashes: " << std::endl; for(auto it(mHandledHashes.begin());it!=mHandledHashes.end();++it) @@ -311,15 +308,18 @@ void RsGxsNetTunnelService::connectToTurtleRouter(p3turtle *tr) bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) { + RS_STACK_MUTEX(mGxsNetTunnelMtx); // We simply check for wether a managed group has a hash that corresponds to the given hash. return mHandledHashes.find(hash) != mHandledHashes.end(); } -void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) +void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& turtle_virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) { + RS_STACK_MUTEX(mGxsNetTunnelMtx); + #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " received turtle data for vpid " << virtual_peer_id << " for hash " << hash << " in direction " << (int)direction << std::endl; + GXS_NET_TUNNEL_DEBUG() << " received turtle data for vpid " << turtle_virtual_peer_id << " for hash " << hash << " in direction " << (int)direction << std::endl; #endif if(item->PacketSubType() != RS_TURTLE_SUBTYPE_GENERIC_DATA) @@ -327,45 +327,29 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co GXS_NET_TUNNEL_ERROR() << "item with type " << std::hex << item->PacketSubType() << std::dec << " received by GxsNetTunnel, but is not handled!" << std::endl; return; } - - // (cyril) this is a bit complicated. We should store pointers to the encryption keys in another structure and access it directly. + // find the group id auto it = mHandledHashes.find(hash) ; if(it == mHandledHashes.end()) { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for hash " << hash << " but this hash is unknown!" << std::endl; + GXS_NET_TUNNEL_ERROR() << "Cannot find hash " << hash << " to be handled by GxsNetTunnel" << std::endl; return; } - RsGxsGroupId group_id = it->second; - auto it2 = mGroups.find(group_id) ; - - if(it2 == mGroups.end()) - { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for hash " << hash << " and group " << group_id << " but this group id is unknown!" << std::endl; - return; - } - - RsGxsNetTunnelGroupInfo& g_info(it2->second) ; - - g_info.last_contact = time(NULL) ; - - auto it3 = g_info.virtual_peers.find(virtual_peer_id) ; - - if(it3 == g_info.virtual_peers.end()) - { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for hash " << hash << ", group " << group_id << " but the virtual peer id is missing!" << std::endl; - return; - } - - RsGxsNetTunnelVirtualPeerInfo& vp_info(it3->second) ; + // Now check if we got an item to advertise a virtual peer unsigned char *data = NULL ; uint32_t data_size = 0 ; - if(!p3turtle::decryptItem(static_cast(item),vp_info.encryption_master_key,data,data_size)) + // generate the decryption key based on virtual peer id and group id + + uint8_t encryption_master_key[RS_GXS_TUNNEL_CONST_EKEY_SIZE] ; + + generateEncryptionKey(group_id,turtle_virtual_peer_id,encryption_master_key); + + if(!p3turtle::decryptItem(static_cast(item),encryption_master_key,data,data_size)) { GXS_NET_TUNNEL_ERROR() << "Cannot decrypt data!" << std::endl; @@ -375,28 +359,45 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return ; } - // Now we might get 2 kinds of items: GxsNetTunnel items, to be handled here, and Gxs data items, to be handled by the client service - RsItem *decrypted_item = RsGxsNetTunnelSerializer().deserialise(data,&data_size); - RsGxsNetTunnelVirtualPeerItem *pid_item = dynamic_cast(decrypted_item) ; if(pid_item) { - if(direction == RsTurtleGenericTunnelItem::DIRECTION_SERVER) - { #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id << ". Setting virtual peer." << std::endl; + GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id << ". Setting virtual peer." << std::endl; +#endif +#ifdef TODO + vp_info.net_service_virtual_peer = pid_item->virtual_peer_id; + vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; #endif - vp_info.net_service_virtual_peer = pid_item->virtual_peer_id; - vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; - } - else - GXS_NET_TUNNEL_ERROR() << "Cannot decrypt data!" << std::endl; free(data); return ; } + +#ifdef TODO + auto it = mTurtle2GxsPeer.find(turtle_virtual_peer_id) ; + + if(it == mTurtle2GxsPeer.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for vpid " << turtle_virtual_peer_id << " but this vpid is unknown!" << std::endl; + return; + } + + RsGxsNetTunnelVirtualPeerId gxs_vpid = it->second ; + + auto it2 = mVirtualPeers.find(gxs_vpid) ; + + if(it2 == mVirtualPeers.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid " but the virtual peer id is missing!" << std::endl; + return; + } + + RsGxsNetTunnelVirtualPeerInfo& vp_info(it2->second) ; + + else { #ifdef DEBUG_RSGXSNETTUNNEL @@ -411,10 +412,13 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co vp_info.incoming_data.push_back(bind) ; } +#endif } void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) { + RS_STACK_MUTEX(mGxsNetTunnelMtx); + auto it = mHandledHashes.find(hash) ; if(it == mHandledHashes.end()) @@ -431,23 +435,19 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ; - RsGxsNetTunnelVirtualPeerInfo& vpinfo( ginfo.virtual_peers[vpid] ) ; + uint8_t encryption_master_key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]; - vpinfo.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK ; - vpinfo.side = dir ; - vpinfo.last_contact = time(NULL) ; - - generateEncryptionKey(group_id,vpid,vpinfo.encryption_master_key ); + generateEncryptionKey(group_id,vpid,encryption_master_key ); // We need to send our own virtual peer id to the other end of the tunnel - vpinfo.net_service_virtual_peer = makeServerVirtualPeerIdForGroup(group_id); + RsGxsNetTunnelVirtualPeerId net_service_virtual_peer = locked_makeVirtualPeerId(); #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " sending back virtual peer name " << vpinfo.net_service_virtual_peer << " to end of tunnel" << std::endl; + GXS_NET_TUNNEL_DEBUG() << " sending back virtual peer name " << net_service_virtual_peer << " to end of tunnel" << std::endl; #endif RsGxsNetTunnelVirtualPeerItem pitem ; - pitem.virtual_peer_id = vpinfo.net_service_virtual_peer ; + pitem.virtual_peer_id = net_service_virtual_peer ; RsTemporaryMemory tmpmem( RsGxsNetTunnelSerializer().size(&pitem) ) ; uint32_t len = tmpmem.size(); @@ -456,7 +456,7 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; - if(p3turtle::encryptData(tmpmem,len,vpinfo.encryption_master_key,encrypted_turtle_item)) + if(p3turtle::encryptData(tmpmem,len,encryption_master_key,encrypted_turtle_item)) mTurtle->sendTurtleData(vpid,encrypted_turtle_item) ; else GXS_NET_TUNNEL_ERROR() << "cannot encrypt. Something's wrong. Data is dropped." << std::endl; @@ -464,6 +464,8 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid) { + RS_STACK_MUTEX(mGxsNetTunnelMtx); + #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " removing virtual peer " << vpid << " for hash " << hash << std::endl; #endif @@ -496,7 +498,7 @@ RsFileHash RsGxsNetTunnelService::calculateGroupHash(const RsGxsGroupId& group_i return RsDirUtil::sha1sum(group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; } -void RsGxsNetTunnelService::generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) const +void RsGxsNetTunnelService::generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) { // The key is generated as H(group_id | vpid) // Because group_id is not known it shouldn't be possible to recover the key by observing the traffic. @@ -519,12 +521,19 @@ void RsGxsNetTunnelService::data_tick() { GXS_NET_TUNNEL_DEBUG() << std::endl; + time_t now = time(NULL); + // cleanup - autowash(); + static time_t last_autowash = time(NULL); + + if(last_autowash + 5 > now) + { + autowash(); + last_autowash = now; + } static time_t last_dump = time(NULL); - time_t now = time(NULL); if(last_dump + 10 > now) { @@ -535,44 +544,24 @@ void RsGxsNetTunnelService::data_tick() void RsGxsNetTunnelService::autowash() { + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + for(auto it(mGroups.begin());it!=mGroups.end();++it) + { + // check if the group is in active or passive mode, in which case make sure that turtle manages tunnels or not. + // if active, then we check wether they are tunnels are not. If not, we ask turtle to monitor. + + RsGxsNetTunnelGroupInfo& ginfo(it->second) ; + + if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE && ginfo.virtual_peers.empty()) + { + mTurtle->monitorTunnels(ginfo.hash,this,false) ; + ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; + } + + if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE) + mTurtle->stopMonitoringTunnels(ginfo.hash); + } } -// info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; -// -// mTurtle->monitorTunnels(hash,this,false) ; -// info.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; - - -// void RsGxsNetTunnelService::handleIncoming(const RsGxsTunnelId& tunnel_id,RsGxsTunnelItem *item) -// { -// #ifdef DEBUG_RSGXSNETTUNNEL -// GXS_NET_TUNNEL_DEBUG() << " received turtle data for vpid " << virtual_peer_id << " for hash " << hash << " in direction " << dir << std::endl; -// #endif -// if(item == NULL) -// return ; -// -// // We have 3 things to do: -// // -// // 1 - if it's a data item, send an ACK -// // 2 - if it's an ack item, mark the item as properly received, and remove it from the queue -// // 3 - if it's a status item, act accordingly. -// -// switch(item->PacketSubType()) -// { -// -// case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast(item)) ; -// break ; -// -// case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast(item)) ; -// break ; -// -// case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast(item)) ; -// break ; -// -// default: -// std::cerr << "(EE) impossible situation. DH items should be handled at the service level" << std::endl; -// } -// -// delete item ; -// } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 901aba61d..a8b9e701b 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -82,11 +82,22 @@ // However, a call should be made to set a particular group policy to "ACTIVE" for group that do not have peers and need some. // // * services also need to retrieve GXS data items that come out of tunnels. These will be available as (data,len) type, since they are not de-serialized. +// +// * GxsNetService stores data information (such as update maps) per peerId, so it makes sense to use the same PeerId for all groups of a given service +// Therefore, virtual peers are stored separately from groups, because each one can sync multiple groups. +// +// * virtual peers are also shared among services. This reduces the required amount of tunnels and tunnel requests to send. typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; class RsGxsNetTunnelItem ; +struct RsGxsNetTunnelVirtualPeerProvidingSet +{ + std::set provided_groups ; + std::list incoming_data ; +}; + struct RsGxsNetTunnelVirtualPeerInfo { enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. @@ -102,11 +113,10 @@ struct RsGxsNetTunnelVirtualPeerInfo uint8_t encryption_master_key[32] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) time_t last_contact ; // last time some data was sent/recvd - RsGxsNetTunnelVirtualPeerId net_service_virtual_peer ; // anonymised peer that is used to communicate with client services - RsGxsGroupId group_id ; // group id + TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. + RsGxsGroupId group_id ; // group id - std::list incoming_data ; - std::list outgoing_items ; + std::map providing_set; // partial list of groups provided by this virtual peer id, based on tunnel results, for each service }; struct RsGxsNetTunnelGroupInfo @@ -124,20 +134,22 @@ struct RsGxsNetTunnelGroupInfo RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group explicitely request tunnels, if none available }; - RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} + RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0),service_id(0) {} GroupPolicy group_policy ; GroupStatus group_status ; time_t last_contact ; TurtleFileHash hash ; + uint16_t service_id ; - std::map virtual_peers ; + std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. }; class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread { public: RsGxsNetTunnelService() ; + virtual ~RsGxsNetTunnelService() ; /*! * \brief Manage tunnels for this group @@ -155,7 +167,7 @@ public: * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and * alive. This function also "registers" the group which allows to handle tunnel requests in the server side. */ - bool getVirtualPeers(const RsGxsGroupId& group_id, std::list& peers) ; // returns the virtual peers for this group + bool getVirtualPeers(uint16_t service_id, std::list& peers) ; // returns the virtual peers for this group /*! * \brief sendData @@ -204,13 +216,14 @@ private: void autowash() ; void handleIncoming(RsGxsNetTunnelItem *item) ; - static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 16 ; + static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 20 ; static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; std::map mGroups ; // groups on the client and server side - std::map > mVirtualPeers ; // current virtual peers, - std::map mHandledHashes ; // hashes asked to turtle + std::map mVirtualPeers ; // current virtual peers, which group they provide, and how to talk to them through turtle + std::map mHandledHashes ; // hashes asked to turtle. Used to answer tunnel requests + std::map mTurtle2GxsPeer ; // convertion table to find GXS peer id from turtle /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to @@ -224,9 +237,9 @@ private: * tunnel ID and turtle virtual peer id. This allows RsGxsNetService to keep sync-ing the data consistently. */ - RsGxsNetTunnelVirtualPeerId makeServerVirtualPeerIdForGroup(const RsGxsGroupId&group_id) const ; + RsGxsNetTunnelVirtualPeerId locked_makeVirtualPeerId() const ; - void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) const ; + static void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) ; uint8_t mRandomBias[RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. From aa59694d881cdf7681ab8aa8379836a5f0317a4a Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 1 Apr 2018 22:04:16 +0200 Subject: [PATCH 013/213] added automatic detection for need to dist-sync groups --- libretroshare/src/gxs/rsgxsnetservice.cc | 118 +++++++++++++++++------ libretroshare/src/gxs/rsgxsnetservice.h | 4 + libretroshare/src/gxs/rsgxsnettunnel.cc | 63 +++++++----- libretroshare/src/gxs/rsgxsnettunnel.h | 18 ++-- libretroshare/src/rsserver/rsinit.cc | 8 +- 5 files changed, 148 insertions(+), 63 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 7962f9bf3..2a17b54d9 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -269,6 +269,7 @@ NXS_NET_DEBUG_5 summary of transactions (useful to just know what comes in/out) NXS_NET_DEBUG_6 group sync statistics (e.g. number of posts at nighbour nodes, etc) NXS_NET_DEBUG_7 encryption/decryption of transactions + NXS_NET_DEBUG_8 gxs distant sync ***/ //#define NXS_NET_DEBUG_0 1 @@ -279,6 +280,7 @@ //#define NXS_NET_DEBUG_5 1 //#define NXS_NET_DEBUG_6 1 //#define NXS_NET_DEBUG_7 1 +#define NXS_NET_DEBUG_8 1 //#define NXS_FRAG @@ -312,11 +314,12 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ; // Debug system to allow to print only for some IDs (group, Peer, etc) #if defined(NXS_NET_DEBUG_0) || defined(NXS_NET_DEBUG_1) || defined(NXS_NET_DEBUG_2) || defined(NXS_NET_DEBUG_3) \ - || defined(NXS_NET_DEBUG_4) || defined(NXS_NET_DEBUG_5) || defined(NXS_NET_DEBUG_6) || defined(NXS_NET_DEBUG_7) + || defined(NXS_NET_DEBUG_4) || defined(NXS_NET_DEBUG_5) || defined(NXS_NET_DEBUG_6) || defined(NXS_NET_DEBUG_7) \ + || defined(NXS_NET_DEBUG_8) static const RsPeerId peer_to_print = RsPeerId(std::string("")) ; static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs -static const uint32_t service_to_print = RS_SERVICE_TYPE_GXS_TRANS ; // use this to allow to this service id only, or 0 for all services +static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_CHANNELS ; // use this to allow to this service id only, or 0 for all services // warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums) class nullstream: public std::ostream {}; @@ -448,6 +451,7 @@ int RsGxsNetService::tick() { syncWithPeers(); syncGrpStatistics(); + checkDistantSyncState(); mSyncTs = now; } @@ -566,7 +570,6 @@ void RsGxsNetService::syncWithPeers() std::set peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType, peers); -#ifdef TODO if(mAllowDistSync) { // Grab all online virtual peers of distant tunnels for the current service. @@ -575,9 +578,8 @@ void RsGxsNetService::syncWithPeers() mGxsNetTunnel->getVirtualPeers(mServType,vpids); for(auto it(vpids.begin());it!=vpids.end();++it) - peers.push_back(RsPeerId(*it)) ; + peers.insert(RsPeerId(*it)) ; } -#endif if (peers.empty()) { // nothing to do @@ -735,6 +737,62 @@ void RsGxsNetService::syncWithPeers() #endif } +void RsGxsNetService::checkDistantSyncState() +{ + if(!mAllowDistSync) + return ; + + RsGxsGrpMetaTemporaryMap grpMeta; + mDataStore->retrieveGxsGrpMetaData(grpMeta); + + // Go through group statistics and groups without information are re-requested to random peers selected + // among the ones who provided the group info. + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___<< "Checking distant sync for all groups." << std::endl; +#endif + // get the list of online peers + + std::set online_peers; + mNetMgr->getOnlineList(mServiceInfo.mServiceType , online_peers); + + uint16_t service_id = ((mServiceInfo.mServiceType >> 8)& 0xffff); + + RS_STACK_MUTEX(mNxsMutex) ; + + for(auto it(grpMeta.begin());it!=grpMeta.end();++it) + if(it->second->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) // we only consider subscribed groups here. + { +#warning (cyril) We might need to also remove peers for recently unsubscribed groups + const RsGxsGroupId& grpId(it->first); + const RsGxsGrpConfig& rec = locked_getGrpConfig(grpId) ; + +#ifdef NXS_NET_DEBUG_6 + GXSNETDEBUG__G(it->first) << " group " << grpId; +#endif + bool at_least_one_friend_is_supplier = false ; + + for(auto it2(rec.suppliers.ids.begin());it2!=rec.suppliers.ids.end() && !at_least_one_friend_is_supplier;++it2) + if(online_peers.find(*it2) != online_peers.end()) // check that the peer is online + at_least_one_friend_is_supplier = true ; + + if(at_least_one_friend_is_supplier) + { + mGxsNetTunnel->releasePeers(service_id,grpId); +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___<< " Group " << grpId << ": suppliers among friends. Releasing peers." << std::endl; +#endif + } + else + { + mGxsNetTunnel->requestPeers(service_id,grpId); +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___<< " Group " << grpId << ": no suppliers among friends. Requesting peers." << std::endl; +#endif + } + } +} + void RsGxsNetService::syncGrpStatistics() { RS_STACK_MUTEX(mNxsMutex) ; @@ -763,44 +821,44 @@ void RsGxsNetService::syncGrpStatistics() #endif if(rec.statistics_update_TS + GROUP_STATS_UPDATE_DELAY < now && rec.suppliers.ids.size() > 0) - { + { #ifdef NXS_NET_DEBUG_6 - GXSNETDEBUG__G(it->first) << " needs update. Randomly asking to some friends" << std::endl; + GXSNETDEBUG__G(it->first) << " needs update. Randomly asking to some friends" << std::endl; #endif - // randomly select GROUP_STATS_UPDATE_NB_PEERS friends among the suppliers of this group + // randomly select GROUP_STATS_UPDATE_NB_PEERS friends among the suppliers of this group - uint32_t n = RSRandom::random_u32() % rec.suppliers.ids.size() ; + uint32_t n = RSRandom::random_u32() % rec.suppliers.ids.size() ; - std::set::const_iterator rit = rec.suppliers.ids.begin(); - for(uint32_t i=0;i::const_iterator rit = rec.suppliers.ids.begin(); + for(uint32_t i=0;ifirst) << " asking friend " << peer_id << " for an update of stats for group " << it->first << std::endl; + GXSNETDEBUG_PG(peer_id,it->first) << " asking friend " << peer_id << " for an update of stats for group " << it->first << std::endl; #endif - RsNxsSyncGrpStatsItem *grs = new RsNxsSyncGrpStatsItem(mServType) ; + RsNxsSyncGrpStatsItem *grs = new RsNxsSyncGrpStatsItem(mServType) ; - grs->request_type = RsNxsSyncGrpStatsItem::GROUP_INFO_TYPE_REQUEST ; + grs->request_type = RsNxsSyncGrpStatsItem::GROUP_INFO_TYPE_REQUEST ; - grs->grpId = it->first ; - grs->PeerId(peer_id) ; + grs->grpId = it->first ; + grs->PeerId(peer_id) ; - sendItem(grs) ; + sendItem(grs) ; + } } - } - } + } #ifdef NXS_NET_DEBUG_6 else GXSNETDEBUG__G(it->first) << " up to date." << std::endl; diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 49d44dab2..8142f2e74 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -35,6 +35,7 @@ #include "pqi/p3linkmgr.h" #include "rsitems/rsnxsitems.h" #include "rsitems/rsgxsupdateitems.h" +#include "rsgxsnettunnel.h" #include "rsgxsnetutils.h" #include "pqi/p3cfgmgr.h" #include "rsgixs.h" @@ -394,6 +395,7 @@ private: void locked_pushGrpRespFromList(std::list& respList, const RsPeerId& peer, const uint32_t& transN); void locked_pushMsgRespFromList(std::list& itemL, const RsPeerId& sslId, const RsGxsGroupId &grp_id, const uint32_t& transN); + void checkDistantSyncState(); void syncWithPeers(); void syncGrpStatistics(); void addGroupItemToList(NxsTransaction*& tr, @@ -582,6 +584,8 @@ private: uint32_t mDefaultMsgStorePeriod ; uint32_t mDefaultMsgSyncPeriod ; + + RsGxsNetTunnelService *mGxsNetTunnel; }; #endif // RSGXSNETSERVICE_H diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index d5628eed3..c502f2c6d 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -193,14 +193,14 @@ bool RsGxsNetTunnelService::getVirtualPeers(uint16_t service_id, std::listsecond.providing_set.find(service_id) != it->second.providing_set.end()) peers.push_back(it->first) ; -#ifdef DEBUG_GXS_TUNNEL +#ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " returning " << peers.size() << " peers." << std::endl; #endif return true ; } -bool RsGxsNetTunnelService::requestPeers(const RsGxsGroupId& group_id) +bool RsGxsNetTunnelService::requestPeers(uint16_t service_id,const RsGxsGroupId& group_id) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -211,11 +211,14 @@ bool RsGxsNetTunnelService::requestPeers(const RsGxsGroupId& group_id) ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; // we dont set the group policy here. It will only be set if no peers, or too few peers are available. +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " requesting peers for group " << group_id << std::endl; +#endif return true; } -bool RsGxsNetTunnelService::releasePeers(const RsGxsGroupId& group_id) +bool RsGxsNetTunnelService::releasePeers(uint16_t service_id, const RsGxsGroupId& group_id) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -226,6 +229,9 @@ bool RsGxsNetTunnelService::releasePeers(const RsGxsGroupId& group_id) ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE; mTurtle->stopMonitoringTunnels(ginfo.hash) ; +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " releasing peers for group " << group_id << std::endl; +#endif return true; } @@ -329,14 +335,14 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co } // find the group id - auto it = mHandledHashes.find(hash) ; + auto it4 = mHandledHashes.find(hash) ; - if(it == mHandledHashes.end()) + if(it4 == mHandledHashes.end()) { GXS_NET_TUNNEL_ERROR() << "Cannot find hash " << hash << " to be handled by GxsNetTunnel" << std::endl; return; } - RsGxsGroupId group_id = it->second; + RsGxsGroupId group_id = it4->second; // Now check if we got an item to advertise a virtual peer @@ -367,21 +373,33 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id << ". Setting virtual peer." << std::endl; #endif -#ifdef TODO - vp_info.net_service_virtual_peer = pid_item->virtual_peer_id; - vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; -#endif + // we receive a virtual peer id, so we need to update the local information for this peer id + + mTurtle2GxsPeer[turtle_virtual_peer_id] = pid_item->virtual_peer_id ; + + RsGxsNetTunnelVirtualPeerInfo& vp_info(mVirtualPeers[pid_item->virtual_peer_id]) ; + + vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; // status of the peer + vp_info.side = direction; // client/server + vp_info.last_contact = time(NULL); // last time some data was sent/recvd + + memcpy(vp_info.encryption_master_key,encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE); + + vp_info.turtle_virtual_peer_id = turtle_virtual_peer_id; // turtle peer to use when sending data to this vpid. free(data); return ; } + delete decrypted_item ; + + // item is a generic data item for the client. Let's store the data in the appropriate incoming data queue. -#ifdef TODO auto it = mTurtle2GxsPeer.find(turtle_virtual_peer_id) ; if(it == mTurtle2GxsPeer.end()) { GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for vpid " << turtle_virtual_peer_id << " but this vpid is unknown!" << std::endl; + free(data); return; } @@ -391,28 +409,27 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co if(it2 == mVirtualPeers.end()) { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid " but the virtual peer id is missing!" << std::endl; + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid << " but the virtual peer id is missing!" << std::endl; + free(data); return; } RsGxsNetTunnelVirtualPeerInfo& vp_info(it2->second) ; + uint16_t service_id = getRsItemService(getRsItemId(data)) ; - else - { #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " item is GXS data. Storing into incoming list." << std::endl; + GXS_NET_TUNNEL_DEBUG() << "item contains generic data for service " << std::hex << service_id << std::dec << " for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; #endif - // push the data into the service incoming data list - RsTlvBinaryData *bind = new RsTlvBinaryData; - bind->tlvtype = 0; - bind->bin_len = data_size; - bind->bin_data = data; + // push the data into the service incoming data list - vp_info.incoming_data.push_back(bind) ; - } -#endif + RsTlvBinaryData *bind = new RsTlvBinaryData; + bind->tlvtype = 0; + bind->bin_len = data_size; + bind->bin_data = data; + + vp_info.providing_set[service_id].incoming_data.push_back(bind) ; } void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index a8b9e701b..451f5fb9c 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -87,6 +87,13 @@ // Therefore, virtual peers are stored separately from groups, because each one can sync multiple groups. // // * virtual peers are also shared among services. This reduces the required amount of tunnels and tunnel requests to send. +// +// +// How do we know that a group needs distant sync? +// * look into GrpConfigMap for suppliers. Suppliers is cleared at load. +// * last_update_TS in GrpConfigMap is randomised so it cannot be used +// * we need a way to know that there's no suppliers for good reasons (not that we just started) +// * typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; @@ -105,16 +112,15 @@ struct RsGxsNetTunnelVirtualPeerInfo RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. }; - RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN) { memset(encryption_master_key,0,32) ; } + RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } ~RsGxsNetTunnelVirtualPeerInfo() ; uint8_t vpid_status ; // status of the peer - uint8_t side ; // client/server - uint8_t encryption_master_key[32] ; // key from which the encryption key is derived for each virtual peer (using H(master_key | random IV)) time_t last_contact ; // last time some data was sent/recvd + uint8_t side ; // client/server + uint8_t encryption_master_key[32]; TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. - RsGxsGroupId group_id ; // group id std::map providing_set; // partial list of groups provided by this virtual peer id, based on tunnel results, for each service }; @@ -155,13 +161,13 @@ public: * \brief Manage tunnels for this group * @param group_id group for which tunnels should be released */ - bool requestPeers(const RsGxsGroupId&group_id) ; + bool requestPeers(uint16_t service_id, const RsGxsGroupId&group_id) ; /*! * \brief Stop managing tunnels for this group * @param group_id group for which tunnels should be released */ - bool releasePeers(const RsGxsGroupId&group_id) ; + bool releasePeers(uint16_t service_id,const RsGxsGroupId&group_id) ; /*! * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 0d9300202..17314626e 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1386,10 +1386,10 @@ int RsServer::StartupRetroShare() // create GXS photo service RsGxsNetService* gxschannels_ns = new RsGxsNetService( - RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, - mGxsChannels, mGxsChannels->getServiceInfo(), - mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils); + RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, + mGxsChannels, mGxsChannels->getServiceInfo(), + mReputations, mGxsCircles,mGxsIdService, + pgpAuxUtils,true,true,true); mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; From 8fe3eb711d6cae4b6be875dc5deef7e0cc9d8b7a Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 2 Apr 2018 17:07:32 +0200 Subject: [PATCH 014/213] fixed a few bugs in GXS dist sync tunneling --- libretroshare/src/gxs/rsgxsnetservice.cc | 5 ++- libretroshare/src/gxs/rsgxsnetservice.h | 6 +-- libretroshare/src/gxs/rsgxsnettunnel.cc | 51 ++++++++++++++++-------- libretroshare/src/gxs/rsgxsnettunnel.h | 3 ++ libretroshare/src/rsserver/rsinit.cc | 15 ++++--- 5 files changed, 53 insertions(+), 27 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 2a17b54d9..e86d325de 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -362,7 +362,8 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, const RsServiceInfo serviceInfo, RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs, - PgpAuxUtils *pgpUtils, bool grpAutoSync, bool msgAutoSync, bool distSync, uint32_t default_store_period, uint32_t default_sync_period) + PgpAuxUtils *pgpUtils, RsGxsNetTunnelService *mGxsNT, + bool grpAutoSync, bool msgAutoSync, bool distSync, uint32_t default_store_period, uint32_t default_sync_period) : p3ThreadedService(), p3Config(), mTransactionN(0), mObserver(nxsObs), mDataStore(gds), mServType(servType), mTransactionTimeOut(TRANSAC_TIMEOUT), @@ -370,7 +371,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, mSyncTs(0), mLastKeyPublishTs(0), mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mGixs(gixs), - mReputations(reputations), mPgpUtils(pgpUtils), + mReputations(reputations), mPgpUtils(pgpUtils),mGxsNetTunnel(mGxsNT), mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync),mAllowDistSync(distSync), mServiceInfo(serviceInfo), mDefaultMsgStorePeriod(default_store_period), mDefaultMsgSyncPeriod(default_sync_period) diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 8142f2e74..e798f8717 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -90,7 +90,7 @@ public: RsNxsObserver *nxsObs, // used to be = NULL. const RsServiceInfo serviceInfo, RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL, - PgpAuxUtils *pgpUtils = NULL, + PgpAuxUtils *pgpUtils = NULL, RsGxsNetTunnelService *mGxsNT = NULL, bool grpAutoSync = true, bool msgAutoSync = true,bool distSync=false, uint32_t default_store_period = RS_GXS_DEFAULT_MSG_STORE_PERIOD, uint32_t default_sync_period = RS_GXS_DEFAULT_MSG_REQ_PERIOD); @@ -543,6 +543,8 @@ private: RsGixs *mGixs; RsGixsReputation* mReputations; PgpAuxUtils *mPgpUtils; + RsGxsNetTunnelService *mGxsNetTunnel; + bool mGrpAutoSync; bool mAllowMsgSync; bool mAllowDistSync; @@ -584,8 +586,6 @@ private: uint32_t mDefaultMsgStorePeriod ; uint32_t mDefaultMsgSyncPeriod ; - - RsGxsNetTunnelService *mGxsNetTunnel; }; #endif // RSGXSNETSERVICE_H diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index c502f2c6d..3d0f25a15 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -24,6 +24,7 @@ */ #include "util/rsdir.h" +#include "util/rstime.h" #include "retroshare/rspeers.h" #include "serialiser/rstypeserializer.h" #include "rsgxsnettunnel.h" @@ -209,6 +210,9 @@ bool RsGxsNetTunnelService::requestPeers(uint16_t service_id,const RsGxsGroupId& RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; + ginfo.hash = calculateGroupHash(group_id) ; + + mHandledHashes[ginfo.hash] = group_id ; // we dont set the group policy here. It will only be set if no peers, or too few peers are available. #ifdef DEBUG_RSGXSNETTUNNEL @@ -227,6 +231,10 @@ bool RsGxsNetTunnelService::releasePeers(uint16_t service_id, const RsGxsGroupId RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE; + ginfo.hash = calculateGroupHash(group_id) ; + + mHandledHashes[ginfo.hash] = group_id ; // yes, we do not remove, because we're supposed to answer tunnel requests from other peers. + mTurtle->stopMonitoringTunnels(ginfo.hash) ; #ifdef DEBUG_RSGXSNETTUNNEL @@ -257,21 +265,21 @@ void RsGxsNetTunnelService::dump() const RS_STACK_MUTEX(mGxsNetTunnelMtx); static std::string group_status_str[4] = { - std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN ]"), - std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE ]"), - std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED]"), - std::string("[RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ]") + std::string("[UNKNOWN ]"), + std::string("[IDLE ]"), + std::string("[TUNNELS_REQUESTED]"), + std::string("[VPIDS_AVAILABLE ]") }; static std::string group_policy_str[3] = { - std::string("[RS_GXS_NET_TUNNEL_POLICY_UNKNOWN]"), - std::string("[RS_GXS_NET_TUNNEL_POLICY_PASSIVE]"), - std::string("[RS_GXS_NET_TUNNEL_POLICY_ACTIVE ]"), + std::string("[UNKNOWN]"), + std::string("[PASSIVE]"), + std::string("[ACTIVE ]"), }; static std::string vpid_status_str[3] = { - std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN ]"), - std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK ]"), - std::string("[RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ]") + std::string("[UNKNOWN ]"), + std::string("[TUNNEL_OK]"), + std::string("[ACTIVE ]") }; std::cerr << "GxsNetTunnelService dump: " << std::endl; @@ -279,7 +287,7 @@ void RsGxsNetTunnelService::dump() const for(auto it(mGroups.begin());it!=mGroups.end();++it) { - std::cerr << " " << it->first << " hash: " << it->second.hash << " policy: " << group_policy_str[it->second.group_policy] << " status: " << group_status_str[it->second.group_status] << "] Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; + std::cerr << " " << it->first << " hash: " << it->second.hash << " policy: " << group_policy_str[it->second.group_policy] << " status: " << group_status_str[it->second.group_status] << " Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; std::cerr << " virtual peers:" << std::endl; for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2) std::cerr << " " << *it2 << std::endl; @@ -291,7 +299,7 @@ void RsGxsNetTunnelService::dump() const std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id << " status: " << vpid_status_str[it->second.vpid_status] << " s: " << (int)it->second.side << " last seen " << time(NULL)-it->second.last_contact - << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) ; + << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) << std::endl; for(auto it2(it->second.providing_set.begin());it2!=it->second.providing_set.end();++it2) std::cerr << " service " << std::hex << it2->first << std::dec << " " << it2->second.provided_groups.size() << " groups, " << it2->second.incoming_data.size() << " data" << std::endl; @@ -474,7 +482,7 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; if(p3turtle::encryptData(tmpmem,len,encryption_master_key,encrypted_turtle_item)) - mTurtle->sendTurtleData(vpid,encrypted_turtle_item) ; + mPendingTurtleItems.push_back(std::make_pair(vpid,encrypted_turtle_item)) ; // we cannot send directly because of turtle mutex locked before calling addVirtualPeer. else GXS_NET_TUNNEL_ERROR() << "cannot encrypt. Something's wrong. Data is dropped." << std::endl; } @@ -536,7 +544,15 @@ void RsGxsNetTunnelService::generateEncryptionKey(const RsGxsGroupId& group_id,c void RsGxsNetTunnelService::data_tick() { - GXS_NET_TUNNEL_DEBUG() << std::endl; + while(!mPendingTurtleItems.empty()) + { + auto& it(mPendingTurtleItems.front()); + + mTurtle->sendTurtleData(it.first,it.second) ; + mPendingTurtleItems.pop_front(); + } + + rstime::rs_usleep(1*1000*1000); // 1 sec time_t now = time(NULL); @@ -544,7 +560,7 @@ void RsGxsNetTunnelService::data_tick() static time_t last_autowash = time(NULL); - if(last_autowash + 5 > now) + if(last_autowash + 5 < now) { autowash(); last_autowash = now; @@ -552,7 +568,7 @@ void RsGxsNetTunnelService::data_tick() static time_t last_dump = time(NULL); - if(last_dump + 10 > now) + if(last_dump + 10 < now) { last_dump = now; dump(); @@ -577,7 +593,10 @@ void RsGxsNetTunnelService::autowash() } if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE) + { mTurtle->stopMonitoringTunnels(ginfo.hash); + ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE; + } } } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 451f5fb9c..3d6910d14 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -221,6 +221,7 @@ protected: private: void autowash() ; void handleIncoming(RsGxsNetTunnelItem *item) ; + void flush_pending_items(); static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 20 ; static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; @@ -231,6 +232,8 @@ private: std::map mHandledHashes ; // hashes asked to turtle. Used to answer tunnel requests std::map mTurtle2GxsPeer ; // convertion table to find GXS peer id from turtle + std::list > mPendingTurtleItems ; // items that need to be sent off-turtle Mutex. + /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to * hide the real group id. diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 17314626e..c51abf01e 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1300,7 +1300,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_GXSID, gxsid_ds, nxsMgr, mGxsIdService, mGxsIdService->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils, + pgpAuxUtils,NULL, false,false); // don't synchronise group automatic (need explicit group request) // don't sync messages at all. @@ -1319,9 +1319,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_GXSCIRCLE, gxscircles_ds, nxsMgr, mGxsCircles, mGxsCircles->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils, - true, // synchronise group automatic - true); // sync messages automatic, since they contain subscription requests. + pgpAuxUtils); mGxsCircles->setNetworkExchangeService(gxscircles_ns) ; @@ -1379,6 +1377,8 @@ int RsServer::StartupRetroShare() /**** Channel GXS service ****/ + RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; + RsGeneralDataService* gxschannels_ds = new RsDataService(currGxsDir + "/", "gxschannels_db", RS_SERVICE_GXS_TYPE_CHANNELS, NULL, rsInitConfig->gxs_passwd); @@ -1389,7 +1389,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, mGxsChannels, mGxsChannels->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils,true,true,true); + pgpAuxUtils,mGxsNetTunnel,true,true,true); mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; @@ -1444,7 +1444,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxstrans_ns = new RsGxsNetService( RS_SERVICE_TYPE_GXS_TRANS, gxstrans_ds, nxsMgr, mGxsTrans, mGxsTrans->getServiceInfo(), mReputations, mGxsCircles, - mGxsIdService, pgpAuxUtils,true,true,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD); + mGxsIdService, pgpAuxUtils,NULL,true,true,false,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD); mGxsTrans->setNetworkExchangeService(gxstrans_ns); pqih->addService(gxstrans_ns, true); @@ -1486,6 +1486,7 @@ int RsServer::StartupRetroShare() // connect components to turtle router. + mGxsNetTunnel->connectToTurtleRouter(tr) ; ftserver->connectToTurtleRouter(tr) ; ftserver->connectToFileDatabase(fdb) ; chatSrv->connectToGxsTunnelService(mGxsTunnels) ; @@ -1824,6 +1825,8 @@ int RsServer::StartupRetroShare() //rsWire = mWire; /*** start up GXS core runner ***/ + startServiceThread(mGxsNetTunnel, "gxs net tunnel"); + startServiceThread(mGxsIdService, "gxs id"); startServiceThread(mGxsCircles, "gxs circle"); startServiceThread(mPosted, "gxs posted"); From 7d561bccebb56989842eb9bb923d939ea807c418 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 4 Apr 2018 21:41:21 +0200 Subject: [PATCH 015/213] added distant data access in GxsNetService --- libretroshare/src/gxs/rsgxsnetservice.cc | 80 +++++++++++++++++------- libretroshare/src/gxs/rsgxsnetservice.h | 3 + libretroshare/src/gxs/rsgxsnettunnel.cc | 56 ++++++++++++----- libretroshare/src/gxs/rsgxsnettunnel.h | 24 +++++-- 4 files changed, 120 insertions(+), 43 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index e86d325de..cd68ea6bf 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -336,7 +336,6 @@ static std::string nice_time_stamp(time_t now,time_t TS) } } - static std::ostream& gxsnetdebug(const RsPeerId& peer_id,const RsGxsGroupId& grp_id,uint32_t service_type) { static nullstream null ; @@ -611,7 +610,7 @@ void RsGxsNetService::syncWithPeers() #ifdef NXS_NET_DEBUG_5 GXSNETDEBUG_P_(*sit) << "Service "<< std::hex << ((mServiceInfo.mServiceType >> 8)& 0xffff) << std::dec << " sending global group TS of peer id: " << *sit << " ts=" << nice_time_stamp(time(NULL),updateTS) << " (secs ago) to himself" << std::endl; #endif - sendItem(grp); + generic_sendItem(grp); } if(!mAllowMsgSync) @@ -727,7 +726,7 @@ void RsGxsNetService::syncWithPeers() #ifdef NXS_NET_DEBUG_7 GXSNETDEBUG_PG(*sit,grpId) << " Service " << std::hex << ((mServiceInfo.mServiceType >> 8)& 0xffff) << std::dec << " sending message TS of peer id: " << *sit << " ts=" << nice_time_stamp(time(NULL),updateTS) << " (secs ago) for group " << grpId << " to himself - in clear " << std::endl; #endif - sendItem(msg); + generic_sendItem(msg); #ifdef NXS_NET_DEBUG_5 GXSNETDEBUG_PG(*sit,grpId) << "Service "<< std::hex << ((mServiceInfo.mServiceType >> 8)& 0xffff) << std::dec << " sending global message TS of peer id: " << *sit << " ts=" << nice_time_stamp(time(NULL),updateTS) << " (secs ago) for group " << grpId << " to himself" << std::endl; @@ -738,6 +737,28 @@ void RsGxsNetService::syncWithPeers() #endif } +void RsGxsNetService::generic_sendItem(RsNxsItem *si) +{ + // check if the item is to be sent to a distant peer or not + + if(mAllowDistSync && mGxsNetTunnel->isDistantPeer( static_cast(si->PeerId()))) + { + RsNxsSerialiser ser(mServType); + + uint32_t size = ser.size(si); + unsigned char *mem = (unsigned char *)rs_malloc(size) ; + + if(!mem) + return ; + + ser.serialise(si,mem,&size) ; + + mGxsNetTunnel->sendData(mem,size,static_cast(si->PeerId())); + } + else + sendItem(si) ; +} + void RsGxsNetService::checkDistantSyncState() { if(!mAllowDistSync) @@ -757,8 +778,6 @@ void RsGxsNetService::checkDistantSyncState() std::set online_peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType , online_peers); - uint16_t service_id = ((mServiceInfo.mServiceType >> 8)& 0xffff); - RS_STACK_MUTEX(mNxsMutex) ; for(auto it(grpMeta.begin());it!=grpMeta.end();++it) @@ -779,14 +798,14 @@ void RsGxsNetService::checkDistantSyncState() if(at_least_one_friend_is_supplier) { - mGxsNetTunnel->releasePeers(service_id,grpId); + mGxsNetTunnel->releasePeers(mServType,grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": suppliers among friends. Releasing peers." << std::endl; #endif } else { - mGxsNetTunnel->requestPeers(service_id,grpId); + mGxsNetTunnel->requestPeers(mServType,grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": no suppliers among friends. Requesting peers." << std::endl; #endif @@ -856,7 +875,7 @@ void RsGxsNetService::syncGrpStatistics() grs->grpId = it->first ; grs->PeerId(peer_id) ; - sendItem(grs) ; + generic_sendItem(grs) ; } } } @@ -937,7 +956,7 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs) GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << " sending back statistics item with " << vec.size() << " elements." << std::endl; #endif - sendItem(grs_resp) ; + generic_sendItem(grs_resp) ; } else if(grs->request_type == RsNxsSyncGrpStatsItem::GROUP_INFO_TYPE_RESPONSE) { @@ -1638,11 +1657,30 @@ RsSerialiser *RsGxsNetService::setupSerialiser() return rss; } +RsItem *RsGxsNetService::generic_recvItem() +{ + { + RsItem *item ; + + if(NULL != (item=recvItem())) + return item ; + } + + unsigned char *data = NULL ; + uint32_t size = 0 ; + RsGxsNetTunnelVirtualPeerId virtual_peer_id ; + + if(mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) + return dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; + + return NULL ; +} + void RsGxsNetService::recvNxsItemQueue() { RsItem *item ; - while(NULL != (item=recvItem())) + while(NULL != (item=generic_recvItem())) { #ifdef NXS_NET_DEBUG_1 GXSNETDEBUG_P_(item->PeerId()) << "Received RsGxsNetService Item:" << (void*)item << " type=" << std::hex << item->PacketId() << std::dec << std::endl ; @@ -2243,7 +2281,7 @@ void RsGxsNetService::processTransactions() lit_end = tr->mItems.end(); for(; lit != lit_end; ++lit){ - sendItem(*lit); + generic_sendItem(*lit); } tr->mItems.clear(); // clear so they don't get deleted in trans cleaning @@ -2352,7 +2390,7 @@ void RsGxsNetService::processTransactions() trans->transactFlag = RsNxsTransacItem::FLAG_END_SUCCESS; trans->transactionNumber = transN; trans->PeerId(tr->mTransaction->PeerId()); - sendItem(trans); + generic_sendItem(trans); // move to completed transactions @@ -2395,7 +2433,7 @@ void RsGxsNetService::processTransactions() (tr->mTransaction->transactFlag & RsNxsTransacItem::FLAG_TYPE_MASK); trans->transactionNumber = transN; trans->PeerId(tr->mTransaction->PeerId()); - sendItem(trans); + generic_sendItem(trans); tr->mFlag = NxsTransaction::FLAG_STATE_RECEIVING; } @@ -2772,7 +2810,7 @@ void RsGxsNetService::locked_pushMsgTransactionFromList(std::list& r newTrans->mTransaction->PeerId(mOwnId); if (locked_addTransaction(newTrans)) - sendItem(transac); + generic_sendItem(transac); else { delete newTrans; @@ -3068,7 +3106,7 @@ void RsGxsNetService::locked_pushGrpTransactionFromList( std::list& newTrans->mTransaction->PeerId(mOwnId); if (locked_addTransaction(newTrans)) - sendItem(transac); + generic_sendItem(transac); else { delete newTrans; @@ -3272,8 +3310,8 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr) ntr->PeerId(tr->mTransaction->PeerId()); if(locked_addTransaction(newTr)) - sendItem(ntr); - else + generic_sendItem(ntr); + else { delete ntr ; delete newTr; @@ -3567,7 +3605,7 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr) ntr->PeerId(tr->mTransaction->PeerId()); if(locked_addTransaction(newTr)) - sendItem(ntr); + generic_sendItem(ntr); else { delete ntr ; @@ -3886,7 +3924,7 @@ void RsGxsNetService::locked_pushGrpRespFromList(std::list& respList << peer << " with " << respList.size() << " groups " << std::endl; #endif if(locked_addTransaction(tr)) - sendItem(trItem); + generic_sendItem(trItem); else { delete tr ; @@ -4411,7 +4449,7 @@ void RsGxsNetService::locked_pushMsgRespFromList(std::list& itemL, c #endif // signal peer to prepare for transaction if(locked_addTransaction(tr)) - sendItem(trItem); + generic_sendItem(trItem); else { delete tr ; @@ -4798,7 +4836,7 @@ void RsGxsNetService::sharePublishKeysPending() publishKeyItem->private_key = publishKey ; publishKeyItem->PeerId(*it); - sendItem(publishKeyItem); + generic_sendItem(publishKeyItem); #ifdef NXS_NET_DEBUG_3 GXSNETDEBUG_PG(*it,grpMeta->mGroupId) << " sent key item to " << *it << std::endl; #endif diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index e798f8717..aac6c474a 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -495,6 +495,9 @@ private: void cleanRejectedMessages(); void processObserverNotifications(); + void generic_sendItem(RsNxsItem *si); + RsItem *generic_recvItem(); + private: static void locked_checkDelay(uint32_t& time_in_secs); diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 3d0f25a15..65ae72111 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -38,17 +38,6 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") {} -//===========================================================================================================================================// -// Internal structures // -//===========================================================================================================================================// - -RsGxsNetTunnelVirtualPeerInfo::~RsGxsNetTunnelVirtualPeerInfo() -{ - for(auto it(providing_set.begin());it!=providing_set.end();++it) - for(auto it2(it->second.incoming_data.begin());it2!=it->second.incoming_data.end();++it2) - delete *it2 ; -} - //===========================================================================================================================================// // Transport Items // //===========================================================================================================================================// @@ -140,6 +129,40 @@ RsGxsNetTunnelService::~RsGxsNetTunnelService() mGroups.clear(); mHandledHashes.clear(); mVirtualPeers.clear(); + mIncomingData.clear(); +} + +bool RsGxsNetTunnelService::isDistantPeer(const RsGxsNetTunnelVirtualPeerId& virtual_peer) +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + return mVirtualPeers.find(virtual_peer) != mVirtualPeers.end(); +} + +bool RsGxsNetTunnelService::receiveData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + std::list >& lst(mIncomingData[service_id]) ; + + if(lst.empty()) + { + data = NULL; + data_len = 0; + return false ; + } + + data = (unsigned char*)lst.front().second->bin_data ; + data_len = lst.front().second->bin_len ; + virtual_peer = lst.front().first; + + lst.front().second->bin_data = NULL ; // avoids deletion + lst.front().second->bin_len = 0 ; // avoids deletion + + delete lst.front().second; + lst.pop_front(); + + return true; } bool RsGxsNetTunnelService::sendData(unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) @@ -297,12 +320,12 @@ void RsGxsNetTunnelService::dump() const for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) { std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id - << " status: " << vpid_status_str[it->second.vpid_status] << " s: " + << " status: " << vpid_status_str[it->second.vpid_status] << " direction: " << (int)it->second.side << " last seen " << time(NULL)-it->second.last_contact - << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE) << std::endl; + << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE,10) << std::endl; for(auto it2(it->second.providing_set.begin());it2!=it->second.providing_set.end();++it2) - std::cerr << " service " << std::hex << it2->first << std::dec << " " << it2->second.provided_groups.size() << " groups, " << it2->second.incoming_data.size() << " data" << std::endl; + std::cerr << " service " << std::hex << it2->first << std::dec << " " << it2->second.provided_groups.size() << " groups" << std::endl; } std::cerr << "Hashes: " << std::endl; @@ -422,8 +445,6 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return; } - RsGxsNetTunnelVirtualPeerInfo& vp_info(it2->second) ; - uint16_t service_id = getRsItemService(getRsItemId(data)) ; #ifdef DEBUG_RSGXSNETTUNNEL @@ -437,7 +458,7 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co bind->bin_len = data_size; bind->bin_data = data; - vp_info.providing_set[service_id].incoming_data.push_back(bind) ; + mIncomingData[service_id].push_back(std::make_pair(gxs_vpid,bind)) ; } void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) @@ -459,6 +480,7 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE ; + ginfo.virtual_peers.insert(vpid); uint8_t encryption_master_key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 3d6910d14..7543689a2 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -113,7 +113,7 @@ struct RsGxsNetTunnelVirtualPeerInfo }; RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } - ~RsGxsNetTunnelVirtualPeerInfo() ; + virtual ~RsGxsNetTunnelVirtualPeerInfo(){} uint8_t vpid_status ; // status of the peer time_t last_contact ; // last time some data was sent/recvd @@ -186,12 +186,24 @@ public: bool sendData(unsigned char *& data, uint32_t data_len, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! - * \brief receivedItem - * returns the next received item from the given virtual peer. - * \param virtual_peer + * \brief receiveData + * returns the next piece of data received fro the given service, and the virtual GXS peer that sended it. + * \param service_id service that provide the data + * \param data memory check containing the data. Memory ownership belongs to the client. + * \param data_len length of memory chunk + * \param virtual_peer peer who sent the data * \return + * true if something is returned. If not, data is set to NULL, data_len to 0. */ - RsItem *receivedItem(const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool receiveData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + + /*! + * \brief isDistantPeer + * returns wether the peer is in the list of available distant peers or not + * \return true if the peer is a distant GXS peer. + */ + + bool isDistantPeer(const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief dumps all information about monitored groups. @@ -234,6 +246,8 @@ private: std::list > mPendingTurtleItems ; // items that need to be sent off-turtle Mutex. + std::map > > mIncomingData; // list of incoming data items, per service. + /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to * hide the real group id. From 5775203b69bd11992ae0d4ff4dfbf5fb45cf243d Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Thu, 5 Apr 2018 22:22:54 +0300 Subject: [PATCH 016/213] bring back open local file on link click --- retroshare-gui/src/gui/RetroShareLink.cpp | 184 +++++++++++----------- 1 file changed, 96 insertions(+), 88 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 5b45ff584..ad149c15a 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -1388,11 +1388,104 @@ static void processList(const QStringList &list, const QString &textSingular, co case TYPE_FILE: { - col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ; - fileLinkFound = true; + FileInfo fi1; + if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1)) + { + /* fallthrough */ + } + else + { + col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ; + fileLinkFound = true; + break; + } + } + //break; + case TYPE_EXTRAFILE: + { +#ifdef DEBUG_RSLINK + std::cerr << " RetroShareLink::process FileRequest : fileName : " << link.name().toUtf8().constData() << ". fileHash : " << link.hash().toStdString() << ". fileSize : " << link.size() << std::endl; +#endif + + needNotifySuccess = true; + std::list srcIds; + + // Add the link built-in source. This is needed for EXTRA files, where the source is specified in the link. + + if(link.type() == TYPE_EXTRAFILE) + { +#ifdef DEBUG_RSLINK + std::cerr << " RetroShareLink::process Adding built-in source " << link.SSLId().toStdString() << std::endl; +#endif + srcIds.push_back(RsPeerId(link.SSLId().toStdString())) ; + } + + // Get a list of available direct sources, in case the file is browsable only. + // + FileInfo finfo ; + rsFiles->FileDetails(RsFileHash(link.hash().toStdString()), RS_FILE_HINTS_REMOTE, finfo) ; + + for(std::vector::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it) + { +#ifdef DEBUG_RSLINK + std::cerr << " adding peerid " << (*it).peerId << std::endl ; +#endif + srcIds.push_back((*it).peerId) ; + } + + QString cleanname = link.name() ; + static const QString bad_chars_str = "/\\\"*:?<>|" ; + + for(int i=0;ialreadyHaveFile(RsFileHash(link.hash().toStdString()), fi)) { + /* make path for downloaded file */ + std::string path; + path = fi.path;//Shared files has path with filename included + + //Seems that all FileInfo get .path==filepath+filename + //if (fi.downloadStatus == FT_STATE_COMPLETE) + // path = fi.path + "/" + fi.fname; + + QFileInfo qinfo; + qinfo.setFile(QString::fromUtf8(path.c_str())); + if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) { + QString question = ""; + question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. "); + question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code."); + question += "

" + cleanname + ""; + + QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, 0); + int ret = mb.exec(); + if(ret == QMessageBox::Yes) { + ++countFileOpened; + bFileOpened = true; + /* open file with a suitable application */ + if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) { + std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl; + } + } else if (ret == QMessageBox::NoToAll) { + dontOpenNextFile = true; + } + } + } + + if (rsFiles->FileRequest(cleanname.toUtf8().constData(), RsFileHash(link.hash().toStdString()), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) { + fileAdded.append(link.name()); + } else { + if (!bFileOpened) fileExist.append(link.name()); + } } break; - + case TYPE_PERSON: { #ifdef DEBUG_RSLINK @@ -1547,91 +1640,6 @@ static void processList(const QStringList &list, const QString &textSingular, co } break ; - case TYPE_EXTRAFILE: - { -#ifdef DEBUG_RSLINK - std::cerr << " RetroShareLink::process FileRequest : fileName : " << link.name().toUtf8().constData() << ". fileHash : " << link.hash().toStdString() << ". fileSize : " << link.size() << std::endl; -#endif - - needNotifySuccess = true; - std::list srcIds; - - // Add the link built-in source. This is needed for EXTRA files, where the source is specified in the link. - - if(link.type() == TYPE_EXTRAFILE) - { -#ifdef DEBUG_RSLINK - std::cerr << " RetroShareLink::process Adding built-in source " << link.SSLId().toStdString() << std::endl; -#endif - srcIds.push_back(RsPeerId(link.SSLId().toStdString())) ; - } - - // Get a list of available direct sources, in case the file is browsable only. - // - FileInfo finfo ; - rsFiles->FileDetails(RsFileHash(link.hash().toStdString()), RS_FILE_HINTS_REMOTE, finfo) ; - - for(std::vector::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it) - { -#ifdef DEBUG_RSLINK - std::cerr << " adding peerid " << (*it).peerId << std::endl ; -#endif - srcIds.push_back((*it).peerId) ; - } - - QString cleanname = link.name() ; - static const QString bad_chars_str = "/\\\"*:?<>|" ; - - for(int i=0;ialreadyHaveFile(RsFileHash(link.hash().toStdString()), fi)) { - /* make path for downloaded file */ - std::string path; - path = fi.path;//Shared files has path with filename included - - //Seems that all FileInfo get .path==filepath+filename - //if (fi.downloadStatus == FT_STATE_COMPLETE) - // path = fi.path + "/" + fi.fname; - - QFileInfo qinfo; - qinfo.setFile(QString::fromUtf8(path.c_str())); - if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) { - QString question = ""; - question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. "); - question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code."); - question += "

" + cleanname + ""; - - QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, 0); - int ret = mb.exec(); - if(ret == QMessageBox::Yes) { - ++countFileOpened; - bFileOpened = true; - /* open file with a suitable application */ - if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) { - std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl; - } - } else if (ret == QMessageBox::NoToAll) { - dontOpenNextFile = true; - } - } - } - - if (rsFiles->FileRequest(cleanname.toUtf8().constData(), RsFileHash(link.hash().toStdString()), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) { - fileAdded.append(link.name()); - } else { - if (!bFileOpened) fileExist.append(link.name()); - } - } - break; - //TYPE_PRIVATE_CHAT case TYPE_PUBLIC_MSG: From 154f089dd4b1325d72af91a4e61ff6852a7bd46b Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Fri, 6 Apr 2018 12:50:10 +0300 Subject: [PATCH 017/213] fixes --- retroshare-gui/src/gui/RetroShareLink.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index ad149c15a..a8c20c8af 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -1389,7 +1389,8 @@ static void processList(const QStringList &list, const QString &textSingular, co case TYPE_FILE: { FileInfo fi1; - if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1)) + if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1) + && !link.name().endsWith(RsCollection::ExtensionString)) { /* fallthrough */ } @@ -1475,14 +1476,14 @@ static void processList(const QStringList &list, const QString &textSingular, co } else if (ret == QMessageBox::NoToAll) { dontOpenNextFile = true; } + needNotifySuccess = false; } } if (rsFiles->FileRequest(cleanname.toUtf8().constData(), RsFileHash(link.hash().toStdString()), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) { fileAdded.append(link.name()); } else { - if (!bFileOpened) fileExist.append(link.name()); - } + if (!bFileOpened && links.size()>1) fileExist.append(link.name());} } break; @@ -1780,6 +1781,8 @@ static void processList(const QStringList &list, const QString &textSingular, co QString result; + + if (flag & (RSLINK_PROCESS_NOTIFY_SUCCESS | RSLINK_PROCESS_NOTIFY_ERROR)) { result += (links.count() == 1 ? QObject::tr("%1 of %2 RetroShare link processed.") : QObject::tr("%1 of %2 RetroShare links processed.")).arg(countProcessed).arg(links.count()) + "

"; } From dceeab0e4df9cd3eb31ab45bc403649286843b6a Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Fri, 6 Apr 2018 13:02:30 +0300 Subject: [PATCH 018/213] cleanup --- retroshare-gui/src/gui/RetroShareLink.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index a8c20c8af..5a0f7c7ce 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -1781,8 +1781,6 @@ static void processList(const QStringList &list, const QString &textSingular, co QString result; - - if (flag & (RSLINK_PROCESS_NOTIFY_SUCCESS | RSLINK_PROCESS_NOTIFY_ERROR)) { result += (links.count() == 1 ? QObject::tr("%1 of %2 RetroShare link processed.") : QObject::tr("%1 of %2 RetroShare links processed.")).arg(countProcessed).arg(links.count()) + "

"; } From a14b1f60a2b62f693d1db75356fa20cc7acd9431 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Fri, 6 Apr 2018 14:01:52 +0300 Subject: [PATCH 019/213] tooltips improv --- retroshare-gui/src/gui/RetroShareLink.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 5a0f7c7ce..ed9484f08 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -860,17 +860,17 @@ QString RetroShareLink::title() const break; case TYPE_FILE: - return QString("%1 (%2)").arg(hash()).arg(misc::friendlyUnit(size())); + return QString("Size: %2 hash: %1").arg(hash()).arg(misc::friendlyUnit(size())); case TYPE_PERSON: return PeerDefs::rsidFromId(RsPgpId(hash().toStdString())); case TYPE_FORUM: - /* fallthrough */ + return QString("Forum id: %1").arg(hash()); case TYPE_CHANNEL: - /* fallthrough */ + return QString("Channel id: %1").arg(hash()); case TYPE_SEARCH: - break; + return QString("Search files"); case TYPE_MESSAGE: return PeerDefs::rsidFromId(RsPeerId(hash().toStdString())); From 2b9139bf85e26792f85a653bab12f82aeedcf728 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 6 Apr 2018 15:26:54 +0200 Subject: [PATCH 020/213] improved GXS dist sync item handling --- libretroshare/src/gxs/rsgxsnetservice.cc | 11 ++- libretroshare/src/gxs/rsgxsnettunnel.cc | 89 +++++++++++++++--------- libretroshare/src/gxs/rsgxsnettunnel.h | 1 - 3 files changed, 65 insertions(+), 36 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index cd68ea6bf..8ddb992fe 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -1670,8 +1670,15 @@ RsItem *RsGxsNetService::generic_recvItem() uint32_t size = 0 ; RsGxsNetTunnelVirtualPeerId virtual_peer_id ; - if(mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) - return dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; + if(mAllowDistSync && mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) + { + RsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; + item->PeerId(virtual_peer_id) ; + + free(data) ; + + return item ; + } return NULL ; } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 65ae72111..068414099 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -129,6 +129,11 @@ RsGxsNetTunnelService::~RsGxsNetTunnelService() mGroups.clear(); mHandledHashes.clear(); mVirtualPeers.clear(); + + for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) + for(auto it2((*it).second.begin());it2!=(*it).second.end();++it2) + delete (*it2).second; + mIncomingData.clear(); } @@ -234,6 +239,7 @@ bool RsGxsNetTunnelService::requestPeers(uint16_t service_id,const RsGxsGroupId& ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; ginfo.hash = calculateGroupHash(group_id) ; + ginfo.service_id = service_id; mHandledHashes[ginfo.hash] = group_id ; @@ -255,6 +261,7 @@ bool RsGxsNetTunnelService::releasePeers(uint16_t service_id, const RsGxsGroupId ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE; ginfo.hash = calculateGroupHash(group_id) ; + ginfo.service_id = service_id; mHandledHashes[ginfo.hash] = group_id ; // yes, we do not remove, because we're supposed to answer tunnel requests from other peers. @@ -331,6 +338,11 @@ void RsGxsNetTunnelService::dump() const std::cerr << "Hashes: " << std::endl; for(auto it(mHandledHashes.begin());it!=mHandledHashes.end();++it) std::cerr << " hash: " << it->first << " GroupId: " << it->second << std::endl; + + std::cerr << "Incoming data: " << std::endl; + for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) + for(auto it2(it->second.begin());it2!=it->second.end();++it2) + std::cerr << " service " << std::hex << it->first << std::dec << " peer id " << it2->first << " " << (void*)it2->second << std::endl; } //===========================================================================================================================================// @@ -396,13 +408,23 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return ; } - RsItem *decrypted_item = RsGxsNetTunnelSerializer().deserialise(data,&data_size); - RsGxsNetTunnelVirtualPeerItem *pid_item = dynamic_cast(decrypted_item) ; - - if(pid_item) + if(getRsItemService(getRsItemId(data)) == RS_SERVICE_TYPE_GXS_NET_TUNNEL) { + RsItem *decrypted_item = RsGxsNetTunnelSerializer().deserialise(data,&data_size); + RsGxsNetTunnelVirtualPeerItem *pid_item = dynamic_cast(decrypted_item) ; + + if(!pid_item) + { + delete decrypted_item ; + return ; + } + + uint16_t service_id = mGroups[group_id].service_id ; + #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id << ". Setting virtual peer." << std::endl; + GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id + << " for group " << group_id << " in service " << std::hex << service_id << std::dec + << ". Setting virtual peer." << std::endl; #endif // we receive a virtual peer id, so we need to update the local information for this peer id @@ -413,52 +435,53 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; // status of the peer vp_info.side = direction; // client/server vp_info.last_contact = time(NULL); // last time some data was sent/recvd + vp_info.providing_set[service_id].provided_groups.insert(group_id); memcpy(vp_info.encryption_master_key,encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE); vp_info.turtle_virtual_peer_id = turtle_virtual_peer_id; // turtle peer to use when sending data to this vpid. free(data); - return ; } - delete decrypted_item ; - - // item is a generic data item for the client. Let's store the data in the appropriate incoming data queue. - - auto it = mTurtle2GxsPeer.find(turtle_virtual_peer_id) ; - - if(it == mTurtle2GxsPeer.end()) + else { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for vpid " << turtle_virtual_peer_id << " but this vpid is unknown!" << std::endl; - free(data); - return; - } + // item is a generic data item for the client. Let's store the data in the appropriate incoming data queue. - RsGxsNetTunnelVirtualPeerId gxs_vpid = it->second ; + auto it = mTurtle2GxsPeer.find(turtle_virtual_peer_id) ; - auto it2 = mVirtualPeers.find(gxs_vpid) ; + if(it == mTurtle2GxsPeer.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for vpid " << turtle_virtual_peer_id << " but this vpid is unknown!" << std::endl; + free(data); + return; + } - if(it2 == mVirtualPeers.end()) - { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid << " but the virtual peer id is missing!" << std::endl; - free(data); - return; - } + RsGxsNetTunnelVirtualPeerId gxs_vpid = it->second ; - uint16_t service_id = getRsItemService(getRsItemId(data)) ; + auto it2 = mVirtualPeers.find(gxs_vpid) ; + + if(it2 == mVirtualPeers.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid << " but the virtual peer id is missing!" << std::endl; + free(data); + return; + } + + uint16_t service_id = getRsItemService(getRsItemId(data)) ; #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << "item contains generic data for service " << std::hex << service_id << std::dec << " for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; + GXS_NET_TUNNEL_DEBUG() << "item contains generic data for service " << std::hex << service_id << std::dec << " for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; #endif - // push the data into the service incoming data list + // push the data into the service incoming data list - RsTlvBinaryData *bind = new RsTlvBinaryData; - bind->tlvtype = 0; - bind->bin_len = data_size; - bind->bin_data = data; + RsTlvBinaryData *bind = new RsTlvBinaryData; + bind->tlvtype = 0; + bind->bin_len = data_size; + bind->bin_data = data; - mIncomingData[service_id].push_back(std::make_pair(gxs_vpid,bind)) ; + mIncomingData[service_id].push_back(std::make_pair(gxs_vpid,bind)) ; + } } void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 7543689a2..4341f9ce6 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -102,7 +102,6 @@ class RsGxsNetTunnelItem ; struct RsGxsNetTunnelVirtualPeerProvidingSet { std::set provided_groups ; - std::list incoming_data ; }; struct RsGxsNetTunnelVirtualPeerInfo From c0570ffef6a3582ec6285fbf39534250a94d879c Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 7 Apr 2018 00:56:07 +0200 Subject: [PATCH 021/213] fixed costly polling in RsGenExchange --- libretroshare/src/gxs/rsgenexchange.cc | 30 +++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 14a2471e1..11137f8b0 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -64,7 +64,7 @@ static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key #define GXS_MASK "GXS_MASK_HACK" -//#define GEN_EXCH_DEBUG 1 +#define GEN_EXCH_DEBUG 1 static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes @@ -2860,8 +2860,10 @@ void RsGenExchange::processRecvdMessages() time_t now = time(NULL); + if(mMsgPendingValidate.empty()) + return ; #ifdef GEN_EXCH_DEBUG - if(!mMsgPendingValidate.empty()) + else std::cerr << "processing received messages" << std::endl; #endif // 1 - First, make sure items metadata is deserialised, clean old failed items, and collect the groups Ids we have to check @@ -2904,9 +2906,11 @@ void RsGenExchange::processRecvdMessages() } } - // 2 - Retrieve the metadata for the associated groups. + // 2 - Retrieve the metadata for the associated groups. The test is here to avoid the default behavior to + // retrieve all groups when the list is empty - mDataStore->retrieveGxsGrpMetaData(grpMetas); + if(!grpMetas.empty()) + mDataStore->retrieveGxsGrpMetaData(grpMetas); GxsMsgReq msgIds; RsNxsMsgDataTemporaryList msgs_to_store; @@ -2934,7 +2938,7 @@ void RsGenExchange::processRecvdMessages() // } #ifdef GEN_EXCH_DEBUG - std::cerr << " deserialised info: grp id=" << meta->mGroupId << ", msg id=" << meta->mMsgId ; + std::cerr << " deserialised info: grp id=" << msg->grpId << ", msg id=" << msg->msgId ; #endif std::map::iterator mit = grpMetas.find(msg->grpId); @@ -2977,8 +2981,8 @@ void RsGenExchange::processRecvdMessages() msg->metaData->recvTS = time(NULL); #ifdef GEN_EXCH_DEBUG - std::cerr << " new status flags: " << meta->mMsgStatus << std::endl; - std::cerr << " computed hash: " << meta->mHash << std::endl; + std::cerr << " new status flags: " << msg->metaData->mMsgStatus << std::endl; + std::cerr << " computed hash: " << msg->metaData->mHash << std::endl; std::cerr << "Message received. Identity=" << msg->metaData->mAuthorId << ", from peer " << msg->PeerId() << std::endl; #endif @@ -3062,9 +3066,6 @@ void RsGenExchange::processRecvdGroups() GxsPendingItem& gpsi = vit->second; RsNxsGrp* grp = gpsi.mItem; -#ifdef GEN_EXCH_DEBUG - std::cerr << " processing validation for group " << meta->mGroupId << ", original attempt time: " << time(NULL) - gpsi.mFirstTryTS << " seconds ago" << std::endl; -#endif if(grp->metaData == NULL) { RsGxsGrpMetaData* meta = new RsGxsGrpMetaData(); @@ -3074,6 +3075,9 @@ void RsGenExchange::processRecvdGroups() else delete meta ; } +#ifdef GEN_EXCH_DEBUG + std::cerr << " processing validation for group " << grp->metaData->mGroupId << ", original attempt time: " << time(NULL) - gpsi.mFirstTryTS << " seconds ago" << std::endl; +#endif // early deletion of group from the pending list if it's malformed, not accepted, or has been tried unsuccessfully for too long @@ -3102,7 +3106,7 @@ void RsGenExchange::processRecvdGroups() if(!grp->metaData->mAuthorId.isNull()) { #ifdef GEN_EXCH_DEBUG - std::cerr << "Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl; + std::cerr << "Group routage info: Identity=" << grp->metaData->mAuthorId << " from " << grp->PeerId() << std::endl; #endif mRoutingClues[grp->metaData->mAuthorId].insert(grp->PeerId()) ; } @@ -3349,7 +3353,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list& msgs, Gx const RsGxsMessageId::std_vector& msgIds = msgIdReq[(*cit2)->metaData->mGroupId]; #ifdef GEN_EXCH_DEBUG - std::cerr << " grpid=" << cit2->second->mGroupId << ", msgid=" << cit2->second->mMsgId ; + std::cerr << " grpid=" << (*cit2)->grpId << ", msgid=" << (*cit2)->msgId ; #endif // Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test) @@ -3369,7 +3373,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list& msgs, Gx } } #ifdef GEN_EXCH_DEBUG - std::cerr << " discarding " << cit2->second->mMsgId << std::endl; + std::cerr << " discarding " << (*cit2)->msgId << std::endl; #endif delete *cit2; From 393ff75c90c4034f43513cd87d3b696e4691f5f3 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 7 Apr 2018 00:56:44 +0200 Subject: [PATCH 022/213] fixed polling strategy in RsGxsNetService causing some delay in distant post syncing --- libretroshare/src/gxs/rsgxsnetservice.cc | 28 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 8ddb992fe..da9da520f 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -272,8 +272,8 @@ NXS_NET_DEBUG_8 gxs distant sync ***/ -//#define NXS_NET_DEBUG_0 1 -//#define NXS_NET_DEBUG_1 1 +#define NXS_NET_DEBUG_0 1 +#define NXS_NET_DEBUG_1 1 //#define NXS_NET_DEBUG_2 1 //#define NXS_NET_DEBUG_3 1 //#define NXS_NET_DEBUG_4 1 @@ -318,7 +318,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ; || defined(NXS_NET_DEBUG_8) static const RsPeerId peer_to_print = RsPeerId(std::string("")) ; -static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs +static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("ff8d59ef38cad0429f34cc21749dda71")) ; // use this to allow to this group id only, or "" for all IDs static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_CHANNELS ; // use this to allow to this service id only, or 0 for all services // warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums) @@ -427,8 +427,7 @@ int RsGxsNetService::tick() { // always check for new items arriving // from peers - if(receivedItems()) - recvNxsItemQueue(); + recvNxsItemQueue(); bool should_notify = false; @@ -751,6 +750,10 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) if(!mem) return ; +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG_P_(si->PeerId()) << "Sending RsGxsNetTunnelService Item:" << (void*)si << " of type: " << std::hex << si->PacketId() << std::dec + << " transaction " << si->transactionNumber << " to virtual peer " << si->PeerId() << std::endl ; +#endif ser.serialise(si,mem,&size) ; mGxsNetTunnel->sendData(mem,size,static_cast(si->PeerId())); @@ -1670,13 +1673,20 @@ RsItem *RsGxsNetService::generic_recvItem() uint32_t size = 0 ; RsGxsNetTunnelVirtualPeerId virtual_peer_id ; - if(mAllowDistSync && mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) + while(mAllowDistSync && mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) { - RsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; + RsNxsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; item->PeerId(virtual_peer_id) ; free(data) ; + if(!item) + continue ; + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG_P_(item->PeerId()) << "Received RsGxsNetTunnelService Item:" << (void*)item << " of type: " << std::hex << item->PacketId() << std::dec + << " transaction " << item->transactionNumber << " from virtual peer " << item->PeerId() << std::endl ; +#endif return item ; } @@ -1992,7 +2002,7 @@ void RsGxsNetService::debugDump() GXSNETDEBUG___<< "RsGxsNetService::debugDump():" << std::endl; - RsGxsMetaDataTemporaryMap grpMetas; + RsGxsGrpMetaTemporaryMap grpMetas; if(!group_id_to_print.isNull()) grpMetas[group_id_to_print] = NULL ; @@ -2005,7 +2015,7 @@ void RsGxsNetService::debugDump() for(ServerMsgMap::const_iterator it(mServerMsgUpdateMap.begin());it!=mServerMsgUpdateMap.end();++it) { - RsGxsMetaDataTemporaryMap::const_iterator it2 = grpMetas.find(it->first) ; + RsGxsGrpMetaTemporaryMap::const_iterator it2 = grpMetas.find(it->first) ; RsGxsGrpMetaData *grpMeta = (it2 != grpMetas.end())? it2->second : NULL; std::string subscribe_string = (grpMeta==NULL)?"Unknown" : ((grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)?" Subscribed":" NOT Subscribed") ; From 66df281f25f925df47dfbecd35e4ac0ce098c223 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 11 Apr 2018 23:14:10 +0200 Subject: [PATCH 023/213] added asymmetry in GXS tunnel management to reduce the number of tunnels --- libretroshare/src/gxs/rsgxsnetservice.cc | 3 + libretroshare/src/gxs/rsgxsnettunnel.cc | 118 ++++++++++++++++++++--- libretroshare/src/gxs/rsgxsnettunnel.h | 7 +- 3 files changed, 113 insertions(+), 15 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index da9da520f..c430449d2 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -799,6 +799,9 @@ void RsGxsNetService::checkDistantSyncState() if(online_peers.find(*it2) != online_peers.end()) // check that the peer is online at_least_one_friend_is_supplier = true ; + // That strategy is likely to create islands of friends connected to each other. There's no real way + // to decide what to do here, except maybe checking the last message TS remotely vs. locally. + if(at_least_one_friend_is_supplier) { mGxsNetTunnel->releasePeers(mServType,grpId); diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 068414099..4656b1292 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -36,7 +36,11 @@ #define GXS_NET_TUNNEL_ERROR() std::cerr << "(EE) GXS_NET_TUNNEL ERROR : " -RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") {} +RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") +{ +#warning this is for testing only. In the final version this needs to be initialized with some random content. + memset(mRandomBias,0,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; +} //===========================================================================================================================================// // Transport Items // @@ -287,7 +291,7 @@ RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId() co //memcpy(mem+RsPeerId::SIZE_IN_BYTES ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; memcpy(mem+RsPeerId::SIZE_IN_BYTES /*+RsGxsGroupId::SIZE_IN_BYTES*/,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; - return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsPeerId::SIZE_IN_BYTES+RsGxsGroupId::SIZE_IN_BYTES+RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsPeerId::SIZE_IN_BYTES+/*RsGxsGroupId::SIZE_IN_BYTES+*/ RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); } void RsGxsNetTunnelService::dump() const @@ -318,7 +322,9 @@ void RsGxsNetTunnelService::dump() const for(auto it(mGroups.begin());it!=mGroups.end();++it) { std::cerr << " " << it->first << " hash: " << it->second.hash << " policy: " << group_policy_str[it->second.group_policy] << " status: " << group_status_str[it->second.group_status] << " Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; - std::cerr << " virtual peers:" << std::endl; + + if(!it->second.virtual_peers.empty()) + std::cerr << " virtual peers:" << std::endl; for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2) std::cerr << " " << *it2 << std::endl; } @@ -334,6 +340,9 @@ void RsGxsNetTunnelService::dump() const for(auto it2(it->second.providing_set.begin());it2!=it->second.providing_set.end();++it2) std::cerr << " service " << std::hex << it2->first << std::dec << " " << it2->second.provided_groups.size() << " groups" << std::endl; } + std::cerr << "Virtual peer turtle => GXS conversion table: " << std::endl; + for(auto it(mTurtle2GxsPeer.begin());it!=mTurtle2GxsPeer.end();++it) + std::cerr << " " << it->first << " => " << it->second << std::endl; std::cerr << "Hashes: " << std::endl; for(auto it(mHandledHashes.begin());it!=mHandledHashes.end();++it) @@ -413,7 +422,7 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co RsItem *decrypted_item = RsGxsNetTunnelSerializer().deserialise(data,&data_size); RsGxsNetTunnelVirtualPeerItem *pid_item = dynamic_cast(decrypted_item) ; - if(!pid_item) + if(!pid_item) // this handles the case of a KeepAlive packet. { delete decrypted_item ; return ; @@ -555,7 +564,7 @@ void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const if(ginfo.virtual_peers.empty()) { - ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED ; + ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE ; #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " no more virtual peers for group " << group_id << ": setting status to TUNNELS_REQUESTED" << std::endl; @@ -617,30 +626,115 @@ void RsGxsNetTunnelService::data_tick() { last_dump = now; dump(); + + sendKeepAlivePackets() ; } } +void RsGxsNetTunnelService::sendKeepAlivePackets() +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId() ; + +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " sending keep-alive packets. Own GXS peer ID is " << own_gxs_vpid << std::endl; +#endif + + // We send KA packets for each GXS virtual peer. The advantage is that unused tunnels will automatically die which eliminates duplicate tunnels + // automatically. We only send from the client side. + + for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) + if(own_gxs_vpid < it->first) + { +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " sending to virtual peer " << it->first << " through tunnel " << it->second.turtle_virtual_peer_id << std::endl; +#endif + RsGxsNetTunnelKeepAliveItem pitem ; + RsTemporaryMemory tmpmem( RsGxsNetTunnelSerializer().size(&pitem) ) ; + uint32_t len = tmpmem.size(); + + RsGxsNetTunnelSerializer().serialise(&pitem,tmpmem,&len); + + RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; + + if(p3turtle::encryptData(tmpmem,len,it->second.encryption_master_key,encrypted_turtle_item)) + mPendingTurtleItems.push_back(std::make_pair(it->second.turtle_virtual_peer_id,encrypted_turtle_item)) ; + } +#ifdef DEBUG_RSGXSNETTUNNEL + else + GXS_NET_TUNNEL_DEBUG() << " ignoring virtual peer " << it->first << std::endl; +#endif +} + void RsGxsNetTunnelService::autowash() { RS_STACK_MUTEX(mGxsNetTunnelMtx); +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " performing per-group consistency test." << std::endl; +#endif + RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId() ; + for(auto it(mGroups.begin());it!=mGroups.end();++it) { + RsGxsNetTunnelGroupInfo& ginfo(it->second) ; + bool should_monitor_tunnels = false ; + +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " group " << it->first << ": " ; +#endif + // check whether the group already has GXS virtual peers with suppliers. If so, we can set the GRP policy as passive. + + if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE) + { + bool found = false ; + + // check wether one virtual peer provided by GXS has ID > own ID. In this case we leave the priority to it. + + for(auto it2(ginfo.virtual_peers.begin());!found && it2!=ginfo.virtual_peers.end();++it2) + { + auto it3 = mTurtle2GxsPeer.find(*it2) ; + + if( it3 != mTurtle2GxsPeer.end() && it3->second < own_gxs_vpid) + found = true ; + } + + if(found) + { +#ifdef DEBUG_RSGXSNETTUNNEL + std::cerr << " active, with client-side peers : "; +#endif + should_monitor_tunnels = true ; + } + else + { + should_monitor_tunnels = false ; +#ifdef DEBUG_RSGXSNETTUNNEL + std::cerr << " active, and no client-side peers available : " ; +#endif + } + } +#ifdef DEBUG_RSGXSNETTUNNEL + else + std::cerr << " passive : "; +#endif + // check if the group is in active or passive mode, in which case make sure that turtle manages tunnels or not. // if active, then we check wether they are tunnels are not. If not, we ask turtle to monitor. - RsGxsNetTunnelGroupInfo& ginfo(it->second) ; - - if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE && ginfo.virtual_peers.empty()) + if(should_monitor_tunnels) { +#ifdef DEBUG_RSGXSNETTUNNEL + std::cerr << " requesting tunnels" << std::endl; +#endif mTurtle->monitorTunnels(ginfo.hash,this,false) ; - ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED; } - - if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE) + else { +#ifdef DEBUG_RSGXSNETTUNNEL + std::cerr << " dropping tunnels" << std::endl; +#endif mTurtle->stopMonitoringTunnels(ginfo.hash); - ginfo.group_status = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE; } } } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 4341f9ce6..7d5f6bd78 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -129,14 +129,14 @@ struct RsGxsNetTunnelGroupInfo enum GroupStatus { RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting - RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x02, // virtual peers requested, and waiting for turtle to answer +// RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x02, // virtual peers requested, and waiting for turtle to answer RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x03 // some virtual peers are available. Data can be read/written }; enum GroupPolicy { RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels - RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group explicitely request tunnels, if none available + RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will explicitely request tunnels, if none available }; RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0),service_id(0) {} @@ -147,7 +147,7 @@ struct RsGxsNetTunnelGroupInfo TurtleFileHash hash ; uint16_t service_id ; - std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. + std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. }; class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread @@ -231,6 +231,7 @@ protected: p3turtle *mTurtle ; private: void autowash() ; + void sendKeepAlivePackets() ; void handleIncoming(RsGxsNetTunnelItem *item) ; void flush_pending_items(); From 3c9af3d2e7e46fd42d34671a53327a096e25539a Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 14 Apr 2018 11:48:55 +0200 Subject: [PATCH 024/213] fixed bug in tunnel monitoring code --- libretroshare/src/gxs/rsgxsnettunnel.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 4656b1292..4de597285 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -704,11 +704,11 @@ void RsGxsNetTunnelService::autowash() #ifdef DEBUG_RSGXSNETTUNNEL std::cerr << " active, with client-side peers : "; #endif - should_monitor_tunnels = true ; + should_monitor_tunnels = false ; } else { - should_monitor_tunnels = false ; + should_monitor_tunnels = true ; #ifdef DEBUG_RSGXSNETTUNNEL std::cerr << " active, and no client-side peers available : " ; #endif @@ -719,8 +719,9 @@ void RsGxsNetTunnelService::autowash() std::cerr << " passive : "; #endif - // check if the group is in active or passive mode, in which case make sure that turtle manages tunnels or not. - // if active, then we check wether they are tunnels are not. If not, we ask turtle to monitor. + // We should also check whether the group is supplied using another tunnel. If so, no need to request tunnels. + // Otherwise the engine will keep requesting tunnels for all groups. +#warning CODE MISSING HERE if(should_monitor_tunnels) { From 38b39caf13d67e70b1bc3cf6aad1c0e14fddfcfa Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 25 Apr 2018 14:58:53 +0200 Subject: [PATCH 025/213] added compilation flag for GXS dist sync --- libretroshare/src/gxs/rsgxsnetservice.cc | 8 ++++---- libretroshare/src/rsserver/rsinit.cc | 12 +++++++++--- retroshare.pri | 3 +++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index c430449d2..cbd106c39 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -569,7 +569,7 @@ void RsGxsNetService::syncWithPeers() std::set peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType, peers); - if(mAllowDistSync) + if(mAllowDistSync && mGxsNetTunnel != NULL) { // Grab all online virtual peers of distant tunnels for the current service. @@ -740,7 +740,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) { // check if the item is to be sent to a distant peer or not - if(mAllowDistSync && mGxsNetTunnel->isDistantPeer( static_cast(si->PeerId()))) + if(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->isDistantPeer( static_cast(si->PeerId()))) { RsNxsSerialiser ser(mServType); @@ -764,7 +764,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) void RsGxsNetService::checkDistantSyncState() { - if(!mAllowDistSync) + if(!mAllowDistSync || mGxsNetTunnel==NULL) return ; RsGxsGrpMetaTemporaryMap grpMeta; @@ -1676,7 +1676,7 @@ RsItem *RsGxsNetService::generic_recvItem() uint32_t size = 0 ; RsGxsNetTunnelVirtualPeerId virtual_peer_id ; - while(mAllowDistSync && mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) + while(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) { RsNxsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; item->PeerId(virtual_peer_id) ; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index c51abf01e..b8484ac8b 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1358,6 +1358,14 @@ int RsServer::StartupRetroShare() mWiki->setNetworkExchangeService(wiki_ns) ; #endif + /**** GXS Dist sync service ****/ +#ifdef RS_USE_GXS_DISTANT_SYNC + RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; +#else + RsGxsNetTunnelService *mGxsNetTunnel = NULL; +#endif + + /**** Forum GXS service ****/ RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db", @@ -1371,14 +1379,12 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_FORUMS, gxsforums_ds, nxsMgr, mGxsForums, mGxsForums->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils); + pgpAuxUtils); //,mGxsNetTunnel,true,true,true); mGxsForums->setNetworkExchangeService(gxsforums_ns) ; /**** Channel GXS service ****/ - RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; - RsGeneralDataService* gxschannels_ds = new RsDataService(currGxsDir + "/", "gxschannels_db", RS_SERVICE_GXS_TYPE_CHANNELS, NULL, rsInitConfig->gxs_passwd); diff --git a/retroshare.pri b/retroshare.pri index 446c1bd61..21c469aa2 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -9,6 +9,8 @@ no_retroshare_gui:CONFIG -= retroshare_gui # CONFIG *= retrotor +CONFIG *= gxsdistsync + # To disable RetroShare-nogui append the following # assignation to qmake command line "CONFIG+=no_retroshare_nogui" CONFIG *= retroshare_nogui @@ -214,6 +216,7 @@ unfinished { CONFIG += wikipoos } +gxsdistsync:DEFINES *= RS_USE_GXS_DISTANT_SYNC wikipoos:DEFINES *= RS_USE_WIKI rs_gxs:DEFINES *= RS_ENABLE_GXS libresapilocalserver:DEFINES *= LIBRESAPI_LOCAL_SERVER From 1a9a7622a2e3cfb967de4c7511c5e2b062a1eeb3 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 25 Apr 2018 17:58:37 +0200 Subject: [PATCH 026/213] made GxsNetTunnelService a parent class of GxsNetService and renamed public methods appropriately. --- libretroshare/src/gxs/rsgxsnetservice.cc | 27 ++++++++++++++---------- libretroshare/src/gxs/rsgxsnetservice.h | 5 ++--- libretroshare/src/gxs/rsgxsnettunnel.cc | 12 +++++------ libretroshare/src/gxs/rsgxsnettunnel.h | 13 ++++++------ libretroshare/src/rsserver/rsinit.cc | 17 ++++----------- 5 files changed, 34 insertions(+), 40 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index cbd106c39..ad8fa4c73 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -361,7 +361,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, const RsServiceInfo serviceInfo, RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs, - PgpAuxUtils *pgpUtils, RsGxsNetTunnelService *mGxsNT, + PgpAuxUtils *pgpUtils, bool grpAutoSync, bool msgAutoSync, bool distSync, uint32_t default_store_period, uint32_t default_sync_period) : p3ThreadedService(), p3Config(), mTransactionN(0), mObserver(nxsObs), mDataStore(gds), @@ -370,7 +370,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, mSyncTs(0), mLastKeyPublishTs(0), mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mGixs(gixs), - mReputations(reputations), mPgpUtils(pgpUtils),mGxsNetTunnel(mGxsNT), + mReputations(reputations), mPgpUtils(pgpUtils), mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync),mAllowDistSync(distSync), mServiceInfo(serviceInfo), mDefaultMsgStorePeriod(default_store_period), mDefaultMsgSyncPeriod(default_sync_period) @@ -569,12 +569,12 @@ void RsGxsNetService::syncWithPeers() std::set peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType, peers); - if(mAllowDistSync && mGxsNetTunnel != NULL) + if(mAllowDistSync) { // Grab all online virtual peers of distant tunnels for the current service. std::list vpids ; - mGxsNetTunnel->getVirtualPeers(mServType,vpids); + getVirtualPeers(mServType,vpids); for(auto it(vpids.begin());it!=vpids.end();++it) peers.insert(RsPeerId(*it)) ; @@ -668,6 +668,7 @@ void RsGxsNetService::syncWithPeers() const RsGxsGroupId& grpId = mmit->first; RsGxsCircleId encrypt_to_this_circle_id ; +#warning we should use this call in order to determine wether the peer can be sent group information about a specific group, otherwise we leak which group we are subscribed to if(!checkCanRecvMsgFromPeer(peerId, *meta,encrypt_to_this_circle_id)) continue; @@ -725,7 +726,7 @@ void RsGxsNetService::syncWithPeers() #ifdef NXS_NET_DEBUG_7 GXSNETDEBUG_PG(*sit,grpId) << " Service " << std::hex << ((mServiceInfo.mServiceType >> 8)& 0xffff) << std::dec << " sending message TS of peer id: " << *sit << " ts=" << nice_time_stamp(time(NULL),updateTS) << " (secs ago) for group " << grpId << " to himself - in clear " << std::endl; #endif - generic_sendItem(msg); + generic_sendItem(msg); #ifdef NXS_NET_DEBUG_5 GXSNETDEBUG_PG(*sit,grpId) << "Service "<< std::hex << ((mServiceInfo.mServiceType >> 8)& 0xffff) << std::dec << " sending global message TS of peer id: " << *sit << " ts=" << nice_time_stamp(time(NULL),updateTS) << " (secs ago) for group " << grpId << " to himself" << std::endl; @@ -740,7 +741,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) { // check if the item is to be sent to a distant peer or not - if(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->isDistantPeer( static_cast(si->PeerId()))) + if(mAllowDistSync && isDistantPeer( static_cast(si->PeerId()))) { RsNxsSerialiser ser(mServType); @@ -756,7 +757,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) #endif ser.serialise(si,mem,&size) ; - mGxsNetTunnel->sendData(mem,size,static_cast(si->PeerId())); + sendTunnelData(mem,size,static_cast(si->PeerId())); } else sendItem(si) ; @@ -764,7 +765,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) void RsGxsNetService::checkDistantSyncState() { - if(!mAllowDistSync || mGxsNetTunnel==NULL) + if(!mAllowDistSync) return ; RsGxsGrpMetaTemporaryMap grpMeta; @@ -804,14 +805,14 @@ void RsGxsNetService::checkDistantSyncState() if(at_least_one_friend_is_supplier) { - mGxsNetTunnel->releasePeers(mServType,grpId); + releaseDistantPeers(mServType,grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": suppliers among friends. Releasing peers." << std::endl; #endif } else { - mGxsNetTunnel->requestPeers(mServType,grpId); + requestDistantPeers(mServType,grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": no suppliers among friends. Requesting peers." << std::endl; #endif @@ -1676,7 +1677,7 @@ RsItem *RsGxsNetService::generic_recvItem() uint32_t size = 0 ; RsGxsNetTunnelVirtualPeerId virtual_peer_id ; - while(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->receiveData(mServType,data,size,virtual_peer_id)) + while(mAllowDistSync && receiveTunnelData(mServType,data,size,virtual_peer_id)) { RsNxsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; item->PeerId(virtual_peer_id) ; @@ -1995,6 +1996,10 @@ void RsGxsNetService::data_tick() runVetting(); processExplicitGroupRequests(); + + // also tick distant traffic + + RsGxsNetTunnelService::data_tick(); } void RsGxsNetService::debugDump() diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index aac6c474a..04c0317a6 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -72,7 +72,7 @@ class RsGroupNetworkStatsRecord * Incoming transaction are in 3 different states * 1. START 2. RECEIVING 3. END */ -class RsGxsNetService : public RsNetworkExchangeService, public p3ThreadedService, public p3Config +class RsGxsNetService : public RsNetworkExchangeService, public RsGxsNetTunnelService, public p3ThreadedService, public p3Config { public: @@ -90,7 +90,7 @@ public: RsNxsObserver *nxsObs, // used to be = NULL. const RsServiceInfo serviceInfo, RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL, - PgpAuxUtils *pgpUtils = NULL, RsGxsNetTunnelService *mGxsNT = NULL, + PgpAuxUtils *pgpUtils = NULL, bool grpAutoSync = true, bool msgAutoSync = true,bool distSync=false, uint32_t default_store_period = RS_GXS_DEFAULT_MSG_STORE_PERIOD, uint32_t default_sync_period = RS_GXS_DEFAULT_MSG_REQ_PERIOD); @@ -546,7 +546,6 @@ private: RsGixs *mGixs; RsGixsReputation* mReputations; PgpAuxUtils *mPgpUtils; - RsGxsNetTunnelService *mGxsNetTunnel; bool mGrpAutoSync; bool mAllowMsgSync; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 4de597285..f37195936 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -38,7 +38,7 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { -#warning this is for testing only. In the final version this needs to be initialized with some random content. +#warning this is for testing only. In the final version this needs to be initialized with some random content, saved and re-used for a while (e.g. 1 month) memset(mRandomBias,0,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; } @@ -148,7 +148,7 @@ bool RsGxsNetTunnelService::isDistantPeer(const RsGxsNetTunnelVirtualPeerId& vir return mVirtualPeers.find(virtual_peer) != mVirtualPeers.end(); } -bool RsGxsNetTunnelService::receiveData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::receiveTunnelData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -174,7 +174,7 @@ bool RsGxsNetTunnelService::receiveData(uint16_t service_id,unsigned char *& dat return true; } -bool RsGxsNetTunnelService::sendData(unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::sendTunnelData(unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) { RS_STACK_MUTEX(mGxsNetTunnelMtx); // The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router. @@ -233,7 +233,7 @@ bool RsGxsNetTunnelService::getVirtualPeers(uint16_t service_id, std::list virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. }; -class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread +class RsGxsNetTunnelService: public RsTurtleClientService { public: RsGxsNetTunnelService() ; @@ -160,13 +161,13 @@ public: * \brief Manage tunnels for this group * @param group_id group for which tunnels should be released */ - bool requestPeers(uint16_t service_id, const RsGxsGroupId&group_id) ; + bool requestDistantPeers(uint16_t service_id, const RsGxsGroupId&group_id) ; /*! * \brief Stop managing tunnels for this group * @param group_id group for which tunnels should be released */ - bool releasePeers(uint16_t service_id,const RsGxsGroupId&group_id) ; + bool releaseDistantPeers(uint16_t service_id,const RsGxsGroupId&group_id) ; /*! * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and @@ -182,7 +183,7 @@ public: * \return * true if succeeded. */ - bool sendData(unsigned char *& data, uint32_t data_len, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool sendTunnelData(unsigned char *& data, uint32_t data_len, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief receiveData @@ -194,7 +195,7 @@ public: * \return * true if something is returned. If not, data is set to NULL, data_len to 0. */ - bool receiveData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool receiveTunnelData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief isDistantPeer diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index b8484ac8b..12d60061e 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1358,14 +1358,6 @@ int RsServer::StartupRetroShare() mWiki->setNetworkExchangeService(wiki_ns) ; #endif - /**** GXS Dist sync service ****/ -#ifdef RS_USE_GXS_DISTANT_SYNC - RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; -#else - RsGxsNetTunnelService *mGxsNetTunnel = NULL; -#endif - - /**** Forum GXS service ****/ RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db", @@ -1379,7 +1371,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_FORUMS, gxsforums_ds, nxsMgr, mGxsForums, mGxsForums->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils); //,mGxsNetTunnel,true,true,true); + pgpAuxUtils); mGxsForums->setNetworkExchangeService(gxsforums_ns) ; @@ -1395,7 +1387,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, mGxsChannels, mGxsChannels->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils,mGxsNetTunnel,true,true,true); + pgpAuxUtils,true,true,true); mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; @@ -1450,7 +1442,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxstrans_ns = new RsGxsNetService( RS_SERVICE_TYPE_GXS_TRANS, gxstrans_ds, nxsMgr, mGxsTrans, mGxsTrans->getServiceInfo(), mReputations, mGxsCircles, - mGxsIdService, pgpAuxUtils,NULL,true,true,false,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD); + mGxsIdService, pgpAuxUtils,true,true,false,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD); mGxsTrans->setNetworkExchangeService(gxstrans_ns); pqih->addService(gxstrans_ns, true); @@ -1492,7 +1484,7 @@ int RsServer::StartupRetroShare() // connect components to turtle router. - mGxsNetTunnel->connectToTurtleRouter(tr) ; + gxschannels_ns->connectToTurtleRouter(tr) ; ftserver->connectToTurtleRouter(tr) ; ftserver->connectToFileDatabase(fdb) ; chatSrv->connectToGxsTunnelService(mGxsTunnels) ; @@ -1831,7 +1823,6 @@ int RsServer::StartupRetroShare() //rsWire = mWire; /*** start up GXS core runner ***/ - startServiceThread(mGxsNetTunnel, "gxs net tunnel"); startServiceThread(mGxsIdService, "gxs id"); startServiceThread(mGxsCircles, "gxs circle"); From da4b382edec3386e8a27c8255974c8a2becad3e2 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 25 Apr 2018 18:29:49 +0200 Subject: [PATCH 027/213] removed dependency on service in RsGxsNetTunnel --- libretroshare/src/gxs/rsgxsnetservice.cc | 8 +-- libretroshare/src/gxs/rsgxsnettunnel.cc | 76 ++++++++++-------------- libretroshare/src/gxs/rsgxsnettunnel.h | 27 ++++----- 3 files changed, 46 insertions(+), 65 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index ad8fa4c73..619adb5f7 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -574,7 +574,7 @@ void RsGxsNetService::syncWithPeers() // Grab all online virtual peers of distant tunnels for the current service. std::list vpids ; - getVirtualPeers(mServType,vpids); + getVirtualPeers(vpids); for(auto it(vpids.begin());it!=vpids.end();++it) peers.insert(RsPeerId(*it)) ; @@ -805,14 +805,14 @@ void RsGxsNetService::checkDistantSyncState() if(at_least_one_friend_is_supplier) { - releaseDistantPeers(mServType,grpId); + releaseDistantPeers(grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": suppliers among friends. Releasing peers." << std::endl; #endif } else { - requestDistantPeers(mServType,grpId); + requestDistantPeers(grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": no suppliers among friends. Requesting peers." << std::endl; #endif @@ -1677,7 +1677,7 @@ RsItem *RsGxsNetService::generic_recvItem() uint32_t size = 0 ; RsGxsNetTunnelVirtualPeerId virtual_peer_id ; - while(mAllowDistSync && receiveTunnelData(mServType,data,size,virtual_peer_id)) + while(mAllowDistSync && receiveTunnelData(data,size,virtual_peer_id)) { RsNxsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; item->PeerId(virtual_peer_id) ; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index f37195936..e3da0be70 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -135,8 +135,7 @@ RsGxsNetTunnelService::~RsGxsNetTunnelService() mVirtualPeers.clear(); for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) - for(auto it2((*it).second.begin());it2!=(*it).second.end();++it2) - delete (*it2).second; + delete (*it).second; mIncomingData.clear(); } @@ -148,11 +147,11 @@ bool RsGxsNetTunnelService::isDistantPeer(const RsGxsNetTunnelVirtualPeerId& vir return mVirtualPeers.find(virtual_peer) != mVirtualPeers.end(); } -bool RsGxsNetTunnelService::receiveTunnelData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::receiveTunnelData(unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) { RS_STACK_MUTEX(mGxsNetTunnelMtx); - std::list >& lst(mIncomingData[service_id]) ; + std::list >& lst(mIncomingData); if(lst.empty()) { @@ -212,7 +211,7 @@ bool RsGxsNetTunnelService::sendTunnelData(unsigned char *& data,uint32_t data_l return true ; } -bool RsGxsNetTunnelService::getVirtualPeers(uint16_t service_id, std::list& peers) +bool RsGxsNetTunnelService::getVirtualPeers(std::list& peers) { // This function has two effects: // - return the virtual peers for this group @@ -223,17 +222,16 @@ bool RsGxsNetTunnelService::getVirtualPeers(uint16_t service_id, std::listsecond.providing_set.find(service_id) != it->second.providing_set.end()) - peers.push_back(it->first) ; + peers.push_back(it->first) ; #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " returning " << peers.size() << " peers." << std::endl; + GXS_NET_TUNNEL_DEBUG() << " returning " << peers.size() << " peers." << std::endl; #endif return true ; } -bool RsGxsNetTunnelService::requestDistantPeers(uint16_t service_id,const RsGxsGroupId& group_id) +bool RsGxsNetTunnelService::requestDistantPeers(const RsGxsGroupId& group_id) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -243,19 +241,18 @@ bool RsGxsNetTunnelService::requestDistantPeers(uint16_t service_id,const RsGxsG ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; ginfo.hash = calculateGroupHash(group_id) ; - ginfo.service_id = service_id; mHandledHashes[ginfo.hash] = group_id ; // we dont set the group policy here. It will only be set if no peers, or too few peers are available. #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " requesting peers for group " << group_id << std::endl; + GXS_NET_TUNNEL_DEBUG() << " requesting peers for group " << group_id << std::endl; #endif return true; } -bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t service_id, const RsGxsGroupId& group_id) +bool RsGxsNetTunnelService::releaseDistantPeers(const RsGxsGroupId& group_id) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -265,33 +262,31 @@ bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t service_id, const RsGxs ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE; ginfo.hash = calculateGroupHash(group_id) ; - ginfo.service_id = service_id; mHandledHashes[ginfo.hash] = group_id ; // yes, we do not remove, because we're supposed to answer tunnel requests from other peers. mTurtle->stopMonitoringTunnels(ginfo.hash) ; #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " service " << std::hex << service_id << std::dec << " releasing peers for group " << group_id << std::endl; + GXS_NET_TUNNEL_DEBUG() << " releasing peers for group " << group_id << std::endl; #endif return true; } -RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId() const +RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(const RsGxsGroupId& group_id) const { - assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ; + assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ;// so that we can build the virtual PeerId from a SHA1 sum. // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId RsPeerId ssl_id = rsPeers->getOwnId() ; - unsigned char mem[RsPeerId::SIZE_IN_BYTES /*+ RsGxsGroupId::SIZE_IN_BYTES */ + RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE]; + unsigned char mem[RsGxsGroupId::SIZE_IN_BYTES + RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE]; - memcpy(mem ,ssl_id.toByteArray() ,RsPeerId::SIZE_IN_BYTES) ; - //memcpy(mem+RsPeerId::SIZE_IN_BYTES ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; - memcpy(mem+RsPeerId::SIZE_IN_BYTES /*+RsGxsGroupId::SIZE_IN_BYTES*/,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; + memcpy(mem ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; + memcpy(mem+RsGxsGroupId::SIZE_IN_BYTES,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; - return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsPeerId::SIZE_IN_BYTES+/*RsGxsGroupId::SIZE_IN_BYTES+*/ RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsGxsGroupId::SIZE_IN_BYTES+RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); } void RsGxsNetTunnelService::dump() const @@ -331,15 +326,13 @@ void RsGxsNetTunnelService::dump() const std::cerr << "Virtual peers: " << std::endl; for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) - { std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id << " status: " << vpid_status_str[it->second.vpid_status] << " direction: " - << (int)it->second.side << " last seen " << time(NULL)-it->second.last_contact + << " group_id: " << it->second.group_id + << " direction: " << (int)it->second.side + << " last seen " << time(NULL)-it->second.last_contact << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE,10) << std::endl; - for(auto it2(it->second.providing_set.begin());it2!=it->second.providing_set.end();++it2) - std::cerr << " service " << std::hex << it2->first << std::dec << " " << it2->second.provided_groups.size() << " groups" << std::endl; - } std::cerr << "Virtual peer turtle => GXS conversion table: " << std::endl; for(auto it(mTurtle2GxsPeer.begin());it!=mTurtle2GxsPeer.end();++it) std::cerr << " " << it->first << " => " << it->second << std::endl; @@ -350,8 +343,7 @@ void RsGxsNetTunnelService::dump() const std::cerr << "Incoming data: " << std::endl; for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) - for(auto it2(it->second.begin());it2!=it->second.end();++it2) - std::cerr << " service " << std::hex << it->first << std::dec << " peer id " << it2->first << " " << (void*)it2->second << std::endl; + std::cerr << " peer id " << it->first << " " << (void*)it->second << std::endl; } //===========================================================================================================================================// @@ -428,12 +420,9 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return ; } - uint16_t service_id = mGroups[group_id].service_id ; - #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " item is a virtual peer id item with vpid = "<< pid_item->virtual_peer_id - << " for group " << group_id << " in service " << std::hex << service_id << std::dec - << ". Setting virtual peer." << std::endl; + << " for group " << group_id << ". Setting virtual peer." << std::endl; #endif // we receive a virtual peer id, so we need to update the local information for this peer id @@ -444,7 +433,7 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co vp_info.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; // status of the peer vp_info.side = direction; // client/server vp_info.last_contact = time(NULL); // last time some data was sent/recvd - vp_info.providing_set[service_id].provided_groups.insert(group_id); + vp_info.group_id = group_id; memcpy(vp_info.encryption_master_key,encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE); @@ -476,20 +465,18 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return; } - uint16_t service_id = getRsItemService(getRsItemId(data)) ; - #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << "item contains generic data for service " << std::hex << service_id << std::dec << " for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; + GXS_NET_TUNNEL_DEBUG() << "item contains generic data for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; #endif - // push the data into the service incoming data list + // push the data into the incoming data list RsTlvBinaryData *bind = new RsTlvBinaryData; bind->tlvtype = 0; bind->bin_len = data_size; bind->bin_data = data; - mIncomingData[service_id].push_back(std::make_pair(gxs_vpid,bind)) ; + mIncomingData.push_back(std::make_pair(gxs_vpid,bind)) ; } } @@ -520,7 +507,7 @@ void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const Tur // We need to send our own virtual peer id to the other end of the tunnel - RsGxsNetTunnelVirtualPeerId net_service_virtual_peer = locked_makeVirtualPeerId(); + RsGxsNetTunnelVirtualPeerId net_service_virtual_peer = locked_makeVirtualPeerId(group_id); #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " sending back virtual peer name " << net_service_virtual_peer << " to end of tunnel" << std::endl; @@ -632,16 +619,17 @@ void RsGxsNetTunnelService::data_tick() void RsGxsNetTunnelService::sendKeepAlivePackets() { RS_STACK_MUTEX(mGxsNetTunnelMtx); - RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId() ; - #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " sending keep-alive packets. Own GXS peer ID is " << own_gxs_vpid << std::endl; + GXS_NET_TUNNEL_DEBUG() << " sending keep-alive packets. " << std::endl; #endif // We send KA packets for each GXS virtual peer. The advantage is that unused tunnels will automatically die which eliminates duplicate tunnels // automatically. We only send from the client side. for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) + { + RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId(it->second.group_id) ; + if(own_gxs_vpid < it->first) { #ifdef DEBUG_RSGXSNETTUNNEL @@ -662,6 +650,7 @@ void RsGxsNetTunnelService::sendKeepAlivePackets() else GXS_NET_TUNNEL_DEBUG() << " ignoring virtual peer " << it->first << std::endl; #endif + } } void RsGxsNetTunnelService::autowash() @@ -671,10 +660,9 @@ void RsGxsNetTunnelService::autowash() #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " performing per-group consistency test." << std::endl; #endif - RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId() ; - for(auto it(mGroups.begin());it!=mGroups.end();++it) { + RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId(it->first) ; RsGxsNetTunnelGroupInfo& ginfo(it->second) ; bool should_monitor_tunnels = false ; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 4826729f6..c63ab0135 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -100,11 +100,6 @@ typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; class RsGxsNetTunnelItem ; -struct RsGxsNetTunnelVirtualPeerProvidingSet -{ - std::set provided_groups ; -}; - struct RsGxsNetTunnelVirtualPeerInfo { enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. @@ -120,9 +115,9 @@ struct RsGxsNetTunnelVirtualPeerInfo uint8_t side ; // client/server uint8_t encryption_master_key[32]; - TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. + TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. - std::map providing_set; // partial list of groups provided by this virtual peer id, based on tunnel results, for each service + RsGxsGroupId group_id ; // group that virtual peer is providing }; struct RsGxsNetTunnelGroupInfo @@ -140,13 +135,12 @@ struct RsGxsNetTunnelGroupInfo RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will explicitely request tunnels, if none available }; - RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0),service_id(0) {} + RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} GroupPolicy group_policy ; GroupStatus group_status ; time_t last_contact ; TurtleFileHash hash ; - uint16_t service_id ; std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. }; @@ -161,19 +155,19 @@ public: * \brief Manage tunnels for this group * @param group_id group for which tunnels should be released */ - bool requestDistantPeers(uint16_t service_id, const RsGxsGroupId&group_id) ; + bool requestDistantPeers(const RsGxsGroupId&group_id) ; /*! * \brief Stop managing tunnels for this group * @param group_id group for which tunnels should be released */ - bool releaseDistantPeers(uint16_t service_id,const RsGxsGroupId&group_id) ; + bool releaseDistantPeers(const RsGxsGroupId&group_id) ; /*! * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and * alive. This function also "registers" the group which allows to handle tunnel requests in the server side. */ - bool getVirtualPeers(uint16_t service_id, std::list& peers) ; // returns the virtual peers for this group + bool getVirtualPeers(std::list& peers) ; // returns the virtual peers for this group /*! * \brief sendData @@ -187,15 +181,14 @@ public: /*! * \brief receiveData - * returns the next piece of data received fro the given service, and the virtual GXS peer that sended it. - * \param service_id service that provide the data + * returns the next piece of data received, and the virtual GXS peer that sended it. * \param data memory check containing the data. Memory ownership belongs to the client. * \param data_len length of memory chunk * \param virtual_peer peer who sent the data * \return * true if something is returned. If not, data is set to NULL, data_len to 0. */ - bool receiveTunnelData(uint16_t service_id,unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool receiveTunnelData(unsigned char *& data, uint32_t& data_len, RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief isDistantPeer @@ -247,7 +240,7 @@ private: std::list > mPendingTurtleItems ; // items that need to be sent off-turtle Mutex. - std::map > > mIncomingData; // list of incoming data items, per service. + std::list > mIncomingData; // list of incoming data items /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to @@ -261,7 +254,7 @@ private: * tunnel ID and turtle virtual peer id. This allows RsGxsNetService to keep sync-ing the data consistently. */ - RsGxsNetTunnelVirtualPeerId locked_makeVirtualPeerId() const ; + RsGxsNetTunnelVirtualPeerId locked_makeVirtualPeerId(const RsGxsGroupId& group_id) const ; static void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) ; From 57bb31ece62fcbba4a18313fbad7c594e913d70d Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 25 Apr 2018 18:52:07 +0200 Subject: [PATCH 028/213] added new checks in canSend and canRecv Msg/Grp to work with distant peers --- libretroshare/src/gxs/rsgxsnetservice.cc | 37 ++++++++++++++++++++++-- libretroshare/src/gxs/rsgxsnettunnel.cc | 12 ++++++-- libretroshare/src/gxs/rsgxsnettunnel.h | 3 +- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 619adb5f7..33081acd2 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -668,7 +668,6 @@ void RsGxsNetService::syncWithPeers() const RsGxsGroupId& grpId = mmit->first; RsGxsCircleId encrypt_to_this_circle_id ; -#warning we should use this call in order to determine wether the peer can be sent group information about a specific group, otherwise we leak which group we are subscribed to if(!checkCanRecvMsgFromPeer(peerId, *meta,encrypt_to_this_circle_id)) continue; @@ -741,7 +740,9 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) { // check if the item is to be sent to a distant peer or not - if(mAllowDistSync && isDistantPeer( static_cast(si->PeerId()))) + RsGxsGroupId tmp_grpId; + + if(mAllowDistSync && isDistantPeer( static_cast(si->PeerId()),tmp_grpId)) { RsNxsSerialiser ser(mServType); @@ -4091,6 +4092,17 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, const RsGxsGrpMetaData #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendGrpId()"<< std::endl; #endif + // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for + + RsGxsGroupId peer_grp ; + if(isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + { +#ifdef NXS_NET_DEBUG_4 + GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; +#endif + return false ; + } + // first do the simple checks uint8_t circleType = grpMeta.mCircleType; @@ -4144,6 +4156,17 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::checkCanRecvMsgFromPeer()"; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " peer Id = " << sslId << ", grpId=" << grpMeta.mGroupId <& msgMetas, co #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendMsgIds() CIRCLE VETTING" << std::endl; #endif + // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for + + RsGxsGroupId peer_grp ; + if(isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + { +#ifdef NXS_NET_DEBUG_4 + GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; +#endif + return false ; + } // first do the simple checks uint8_t circleType = grpMeta.mCircleType; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index e3da0be70..00e3fd852 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -140,11 +140,19 @@ RsGxsNetTunnelService::~RsGxsNetTunnelService() mIncomingData.clear(); } -bool RsGxsNetTunnelService::isDistantPeer(const RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::isDistantPeer(const RsGxsNetTunnelVirtualPeerId& virtual_peer, RsGxsGroupId& group_id) { RS_STACK_MUTEX(mGxsNetTunnelMtx); - return mVirtualPeers.find(virtual_peer) != mVirtualPeers.end(); + auto it = mVirtualPeers.find(virtual_peer) ; + + if(it != mVirtualPeers.end()) + { + group_id = it->second.group_id ; + return true ; + } + else + return false ; } bool RsGxsNetTunnelService::receiveTunnelData(unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index c63ab0135..9448b9508 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -193,10 +193,11 @@ public: /*! * \brief isDistantPeer * returns wether the peer is in the list of available distant peers or not + * \param group_id returned by the service to indicate which group this peer id is designed for. * \return true if the peer is a distant GXS peer. */ - bool isDistantPeer(const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool isDistantPeer(const RsGxsNetTunnelVirtualPeerId& virtual_peer,RsGxsGroupId& group_id) ; /*! * \brief dumps all information about monitored groups. From 606537a0923fec8af3db0a83f1f78d661fa59b05 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Thu, 26 Apr 2018 23:28:14 +0300 Subject: [PATCH 029/213] reorder cases for nicer diff --- retroshare-gui/src/gui/RetroShareLink.cpp | 202 +++++++++++----------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index ed9484f08..744826bbb 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -1386,107 +1386,6 @@ static void processList(const QStringList &list, const QString &textSingular, co ++countUnknown; break; - case TYPE_FILE: - { - FileInfo fi1; - if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1) - && !link.name().endsWith(RsCollection::ExtensionString)) - { - /* fallthrough */ - } - else - { - col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ; - fileLinkFound = true; - break; - } - } - //break; - case TYPE_EXTRAFILE: - { -#ifdef DEBUG_RSLINK - std::cerr << " RetroShareLink::process FileRequest : fileName : " << link.name().toUtf8().constData() << ". fileHash : " << link.hash().toStdString() << ". fileSize : " << link.size() << std::endl; -#endif - - needNotifySuccess = true; - std::list srcIds; - - // Add the link built-in source. This is needed for EXTRA files, where the source is specified in the link. - - if(link.type() == TYPE_EXTRAFILE) - { -#ifdef DEBUG_RSLINK - std::cerr << " RetroShareLink::process Adding built-in source " << link.SSLId().toStdString() << std::endl; -#endif - srcIds.push_back(RsPeerId(link.SSLId().toStdString())) ; - } - - // Get a list of available direct sources, in case the file is browsable only. - // - FileInfo finfo ; - rsFiles->FileDetails(RsFileHash(link.hash().toStdString()), RS_FILE_HINTS_REMOTE, finfo) ; - - for(std::vector::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it) - { -#ifdef DEBUG_RSLINK - std::cerr << " adding peerid " << (*it).peerId << std::endl ; -#endif - srcIds.push_back((*it).peerId) ; - } - - QString cleanname = link.name() ; - static const QString bad_chars_str = "/\\\"*:?<>|" ; - - for(int i=0;ialreadyHaveFile(RsFileHash(link.hash().toStdString()), fi)) { - /* make path for downloaded file */ - std::string path; - path = fi.path;//Shared files has path with filename included - - //Seems that all FileInfo get .path==filepath+filename - //if (fi.downloadStatus == FT_STATE_COMPLETE) - // path = fi.path + "/" + fi.fname; - - QFileInfo qinfo; - qinfo.setFile(QString::fromUtf8(path.c_str())); - if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) { - QString question = ""; - question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. "); - question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code."); - question += "

" + cleanname + ""; - - QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, 0); - int ret = mb.exec(); - if(ret == QMessageBox::Yes) { - ++countFileOpened; - bFileOpened = true; - /* open file with a suitable application */ - if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) { - std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl; - } - } else if (ret == QMessageBox::NoToAll) { - dontOpenNextFile = true; - } - needNotifySuccess = false; - } - } - - if (rsFiles->FileRequest(cleanname.toUtf8().constData(), RsFileHash(link.hash().toStdString()), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) { - fileAdded.append(link.name()); - } else { - if (!bFileOpened && links.size()>1) fileExist.append(link.name());} - } - break; - case TYPE_PERSON: { #ifdef DEBUG_RSLINK @@ -1641,6 +1540,107 @@ static void processList(const QStringList &list, const QString &textSingular, co } break ; + case TYPE_FILE: + { + FileInfo fi1; + if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1) + && !link.name().endsWith(RsCollection::ExtensionString)) + { + /* fallthrough */ + } + else + { + col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ; + fileLinkFound = true; + break; + } + } + //break; + case TYPE_EXTRAFILE: + { +#ifdef DEBUG_RSLINK + std::cerr << " RetroShareLink::process FileRequest : fileName : " << link.name().toUtf8().constData() << ". fileHash : " << link.hash().toStdString() << ". fileSize : " << link.size() << std::endl; +#endif + + needNotifySuccess = true; + std::list srcIds; + + // Add the link built-in source. This is needed for EXTRA files, where the source is specified in the link. + + if(link.type() == TYPE_EXTRAFILE) + { +#ifdef DEBUG_RSLINK + std::cerr << " RetroShareLink::process Adding built-in source " << link.SSLId().toStdString() << std::endl; +#endif + srcIds.push_back(RsPeerId(link.SSLId().toStdString())) ; + } + + // Get a list of available direct sources, in case the file is browsable only. + // + FileInfo finfo ; + rsFiles->FileDetails(RsFileHash(link.hash().toStdString()), RS_FILE_HINTS_REMOTE, finfo) ; + + for(std::vector::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it) + { +#ifdef DEBUG_RSLINK + std::cerr << " adding peerid " << (*it).peerId << std::endl ; +#endif + srcIds.push_back((*it).peerId) ; + } + + QString cleanname = link.name() ; + static const QString bad_chars_str = "/\\\"*:?<>|" ; + + for(int i=0;ialreadyHaveFile(RsFileHash(link.hash().toStdString()), fi)) { + /* make path for downloaded file */ + std::string path; + path = fi.path;//Shared files has path with filename included + + //Seems that all FileInfo get .path==filepath+filename + //if (fi.downloadStatus == FT_STATE_COMPLETE) + // path = fi.path + "/" + fi.fname; + + QFileInfo qinfo; + qinfo.setFile(QString::fromUtf8(path.c_str())); + if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) { + QString question = ""; + question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. "); + question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code."); + question += "

" + cleanname + ""; + + QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, 0); + int ret = mb.exec(); + if(ret == QMessageBox::Yes) { + ++countFileOpened; + bFileOpened = true; + /* open file with a suitable application */ + if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) { + std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl; + } + } else if (ret == QMessageBox::NoToAll) { + dontOpenNextFile = true; + } + needNotifySuccess = false; + } + } + + if (rsFiles->FileRequest(cleanname.toUtf8().constData(), RsFileHash(link.hash().toStdString()), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) { + fileAdded.append(link.name()); + } else { + if (!bFileOpened && links.size()>1) fileExist.append(link.name());} + } + break; + //TYPE_PRIVATE_CHAT case TYPE_PUBLIC_MSG: From 5be57046f1c88a4ca14196e6f9bad8c8cd5ada31 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 27 Apr 2018 00:00:29 +0200 Subject: [PATCH 030/213] added load/save of random bias in GxsNetTunnel service --- libretroshare/src/gxs/rsgxsnetservice.cc | 26 ++++++++++++------- libretroshare/src/gxs/rsgxsnettunnel.cc | 8 +++--- libretroshare/src/gxs/rsgxsnettunnel.h | 15 +++++++---- libretroshare/src/retroshare/rsids.h | 2 ++ libretroshare/src/rsitems/rsgxsupdateitems.cc | 11 +++++++- libretroshare/src/rsitems/rsgxsupdateitems.h | 13 ++++++++++ 6 files changed, 56 insertions(+), 19 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 33081acd2..bf396a42c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -1522,8 +1522,8 @@ class StoreHere { public: - StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm, RsGxsNetService::ServerMsgMap& smm,RsGxsNetService::GrpConfigMap& gcm, RsGxsServerGrpUpdate& sgm) - : mClientGrpMap(cgm), mClientMsgMap(cmm), mServerMsgMap(smm), mGrpConfigMap(gcm), mServerGrpUpdate(sgm) + StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm, RsGxsNetService::ServerMsgMap& smm,RsGxsNetService::GrpConfigMap& gcm, RsGxsServerGrpUpdate& sgm,Bias20Bytes& mrb) + : mClientGrpMap(cgm), mClientMsgMap(cmm), mServerMsgMap(smm), mGrpConfigMap(gcm), mServerGrpUpdate(sgm), mRandomBias(mrb) {} template void check_store(ID_type id,UpdateMap& map,ItemClass& item) @@ -1536,11 +1536,12 @@ public: void operator() (RsItem* item) { - RsGxsMsgUpdateItem* mui; - RsGxsGrpUpdateItem* gui; - RsGxsServerGrpUpdateItem* gsui; - RsGxsServerMsgUpdateItem* msui; - RsGxsGrpConfigItem* mgci; + RsGxsMsgUpdateItem *mui; + RsGxsGrpUpdateItem *gui; + RsGxsServerGrpUpdateItem *gsui; + RsGxsServerMsgUpdateItem *msui; + RsGxsGrpConfigItem *mgci; + RsGxsTunnelRandomBiasItem *rbsi; if((mui = dynamic_cast(item)) != NULL) check_store(mui->peerID,mClientMsgMap,*mui); @@ -1552,6 +1553,8 @@ public: check_store(msui->grpId,mServerMsgMap, *msui); else if((gsui = dynamic_cast(item)) != NULL) mServerGrpUpdate = *gsui; + else if((rbsi = dynamic_cast(item))!=NULL) + mRandomBias = rbsi->mRandomBias; else std::cerr << "Type not expected!" << std::endl; @@ -1566,7 +1569,7 @@ private: RsGxsNetService::GrpConfigMap& mGrpConfigMap; RsGxsServerGrpUpdate& mServerGrpUpdate; - + Bias20Bytes& mRandomBias ; }; bool RsGxsNetService::loadList(std::list &load) @@ -1575,7 +1578,7 @@ bool RsGxsNetService::loadList(std::list &load) // The delete is done in StoreHere, if necessary - std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap, mServerMsgUpdateMap, mServerGrpConfigMap, mGrpServerUpdate)); + std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap, mServerMsgUpdateMap, mServerGrpConfigMap, mGrpServerUpdate,mRandomBias)); // We reset group statistics here. This is the best place since we know at this point which are all unsubscribed groups. @@ -1652,6 +1655,11 @@ bool RsGxsNetService::saveList(bool& cleanup, std::list& save) save.push_back(it); + RsGxsTunnelRandomBiasItem *it2 = new RsGxsTunnelRandomBiasItem(mServType) ; + it2->mRandomBias = mRandomBias; + + save.push_back(it2) ; + cleanup = true; return true; } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 00e3fd852..7d4a0018f 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -39,7 +39,7 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { #warning this is for testing only. In the final version this needs to be initialized with some random content, saved and re-used for a while (e.g. 1 month) - memset(mRandomBias,0,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; + mRandomBias.clear(); } //===========================================================================================================================================// @@ -289,12 +289,12 @@ RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(cons RsPeerId ssl_id = rsPeers->getOwnId() ; - unsigned char mem[RsGxsGroupId::SIZE_IN_BYTES + RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE]; + unsigned char mem[RsGxsGroupId::SIZE_IN_BYTES + mRandomBias.SIZE_IN_BYTES]; memcpy(mem ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; - memcpy(mem+RsGxsGroupId::SIZE_IN_BYTES,mRandomBias ,RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE) ; + memcpy(mem+RsGxsGroupId::SIZE_IN_BYTES,mRandomBias.toByteArray(),mRandomBias.SIZE_IN_BYTES) ; - return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsGxsGroupId::SIZE_IN_BYTES+RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE).toByteArray()); + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsGxsGroupId::SIZE_IN_BYTES+mRandomBias.SIZE_IN_BYTES).toByteArray()); } void RsGxsNetTunnelService::dump() const diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 9448b9508..5d90d9fe3 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -23,6 +23,8 @@ * */ +#pragma once + #include #include @@ -224,15 +226,17 @@ protected: void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ; p3turtle *mTurtle ; + + static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 20 ; + static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; + + Bias20Bytes mRandomBias ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. private: void autowash() ; void sendKeepAlivePackets() ; void handleIncoming(RsGxsNetTunnelItem *item) ; void flush_pending_items(); - static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 20 ; - static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; - std::map mGroups ; // groups on the client and server side std::map mVirtualPeers ; // current virtual peers, which group they provide, and how to talk to them through turtle @@ -259,8 +263,9 @@ private: static void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) ; - uint8_t mRandomBias[RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE] ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. - mutable RsMutex mGxsNetTunnelMtx; + + friend class RsGxsTunnelRandomBiasItem ; + friend class StoreHere ; }; diff --git a/libretroshare/src/retroshare/rsids.h b/libretroshare/src/retroshare/rsids.h index 21a8fd754..828136dbc 100644 --- a/libretroshare/src/retroshare/rsids.h +++ b/libretroshare/src/retroshare/rsids.h @@ -238,12 +238,14 @@ static const uint32_t RS_GENERIC_ID_GXS_TUNNEL_ID_TYPE = 0x0010 ; static const uint32_t RS_GENERIC_ID_GXS_DISTANT_CHAT_ID_TYPE = 0x0011 ; static const uint32_t RS_GENERIC_ID_NODE_GROUP_ID_TYPE = 0x0012 ; static const uint32_t RS_GENERIC_ID_SHA256_ID_TYPE = 0x0013 ; +static const uint32_t RS_GENERIC_ID_20_BYTES_UNTYPED = 0x0014 ; typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_SSL_ID_TYPE> SSLIdType ; typedef t_RsGenericIdType< PGP_KEY_ID_SIZE , true, RS_GENERIC_ID_PGP_ID_TYPE> PGPIdType ; typedef t_RsGenericIdType< SHA1_SIZE , false, RS_GENERIC_ID_SHA1_ID_TYPE> Sha1CheckSum ; typedef t_RsGenericIdType< SHA256_SIZE , false, RS_GENERIC_ID_SHA256_ID_TYPE> Sha256CheckSum ; typedef t_RsGenericIdType< PGP_KEY_FINGERPRINT_SIZE, true, RS_GENERIC_ID_PGP_FINGERPRINT_TYPE> PGPFingerprintType ; +typedef t_RsGenericIdType< SHA1_SIZE , true, RS_GENERIC_ID_20_BYTES_UNTYPED> Bias20Bytes ; typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_GROUP_ID_TYPE > GXSGroupId ; typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_ID_TYPE > GXSId ; diff --git a/libretroshare/src/rsitems/rsgxsupdateitems.cc b/libretroshare/src/rsitems/rsgxsupdateitems.cc index 50f154cb2..eee847704 100644 --- a/libretroshare/src/rsitems/rsgxsupdateitems.cc +++ b/libretroshare/src/rsitems/rsgxsupdateitems.cc @@ -44,6 +44,7 @@ RsItem* RsGxsUpdateSerialiser::create_item(uint16_t service,uint8_t item_subtype case RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE: return new RsGxsServerGrpUpdateItem(SERVICE_TYPE); case RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE: return new RsGxsServerMsgUpdateItem(SERVICE_TYPE); case RS_PKT_SUBTYPE_GXS_GRP_CONFIG: return new RsGxsGrpConfigItem(SERVICE_TYPE); + case RS_PKT_SUBTYPE_GXS_RANDOM_BIAS: return new RsGxsTunnelRandomBiasItem(SERVICE_TYPE); default: return NULL ; } @@ -76,6 +77,11 @@ void RsGxsServerGrpUpdateItem::clear() grpUpdateTS = 0; } +void RsGxsTunnelRandomBiasItem::clear() +{ + mRandomBias.clear() ; +} + /**********************************************************************************************/ /* SERIALISER */ /**********************************************************************************************/ @@ -134,5 +140,8 @@ void RsGxsGrpConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGe RsTypeSerializer::serial_process(j,ctx,msg_send_delay,"msg_send_delay") ; RsTypeSerializer::serial_process(j,ctx,msg_req_delay,"msg_req_delay") ; } - +void RsGxsTunnelRandomBiasItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,mRandomBias,"random bias") ; +} diff --git a/libretroshare/src/rsitems/rsgxsupdateitems.h b/libretroshare/src/rsitems/rsgxsupdateitems.h index c9725426c..e73dc2197 100644 --- a/libretroshare/src/rsitems/rsgxsupdateitems.h +++ b/libretroshare/src/rsitems/rsgxsupdateitems.h @@ -39,6 +39,7 @@ #include "gxs/rsgxs.h" #include "gxs/rsgxsdata.h" +#include "gxs/rsgxsnettunnel.h" #include "serialiser/rstlvidset.h" @@ -48,6 +49,7 @@ const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE = 0x03; const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE = 0x04; const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE = 0x08; const uint8_t RS_PKT_SUBTYPE_GXS_GRP_CONFIG = 0x09; +const uint8_t RS_PKT_SUBTYPE_GXS_RANDOM_BIAS = 0x0a; class RsGxsNetServiceItem: public RsItem { @@ -186,6 +188,17 @@ public: RsGxsGroupId grpId; }; +class RsGxsTunnelRandomBiasItem: public RsGxsNetServiceItem +{ +public: + explicit RsGxsTunnelRandomBiasItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_RANDOM_BIAS) { clear();} + virtual ~RsGxsTunnelRandomBiasItem() {} + + virtual void clear(); + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); + + Bias20Bytes mRandomBias; // Cannot be a simple char[] because of serialization. +}; class RsGxsUpdateSerialiser : public RsServiceSerializer { From 99739783503a05731916f66b2ae6715785b79a67 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 29 Apr 2018 16:19:45 +0200 Subject: [PATCH 031/213] improved management of tunnels and virtual peers --- libretroshare/src/gxs/rsgxsnetservice.cc | 7 ++- libretroshare/src/gxs/rsgxsnetservice.h | 2 + libretroshare/src/gxs/rsgxsnettunnel.cc | 73 +++++++++++++++--------- libretroshare/src/gxs/rsgxsnettunnel.h | 11 +++- 4 files changed, 61 insertions(+), 32 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index bf396a42c..50045b556 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -273,14 +273,14 @@ ***/ #define NXS_NET_DEBUG_0 1 -#define NXS_NET_DEBUG_1 1 +//#define NXS_NET_DEBUG_1 1 //#define NXS_NET_DEBUG_2 1 //#define NXS_NET_DEBUG_3 1 //#define NXS_NET_DEBUG_4 1 //#define NXS_NET_DEBUG_5 1 //#define NXS_NET_DEBUG_6 1 //#define NXS_NET_DEBUG_7 1 -#define NXS_NET_DEBUG_8 1 +//#define NXS_NET_DEBUG_8 1 //#define NXS_FRAG @@ -2008,7 +2008,8 @@ void RsGxsNetService::data_tick() // also tick distant traffic - RsGxsNetTunnelService::data_tick(); + if(mAllowDistSync) + RsGxsNetTunnelService::data_tick(); } void RsGxsNetService::debugDump() diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 04c0317a6..d7fe23cc3 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -104,6 +104,8 @@ public: public: + virtual uint16_t serviceType() const { return mServType ; } + /*! * Use this to set how far back synchronisation and storage of messages should take place * @param age the max age a sync/storage item can to be allowed in a synchronisation diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 7d4a0018f..052dffacc 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -32,7 +32,7 @@ #define DEBUG_RSGXSNETTUNNEL 1 #define GXS_NET_TUNNEL_NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } -#define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL : " << __FUNCTION__ << " : " +#define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL(" << std::hex << serviceType() << std::dec << ") : " << __FUNCTION__ << " : " #define GXS_NET_TUNNEL_ERROR() std::cerr << "(EE) GXS_NET_TUNNEL ERROR : " @@ -204,6 +204,8 @@ bool RsGxsNetTunnelService::sendTunnelData(unsigned char *& data,uint32_t data_l return false ; } + it->second.last_contact = time(NULL) ; + // 2 - encrypt and send the item. RsTurtleGenericDataItem *encrypted_turtle_item = NULL ; @@ -247,7 +249,9 @@ bool RsGxsNetTunnelService::requestDistantPeers(const RsGxsGroupId& group_id) RsGxsNetTunnelGroupInfo& ginfo( mGroups[group_id] ) ; - ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; + if(ginfo.group_policy < RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE) + ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; + ginfo.hash = calculateGroupHash(group_id) ; mHandledHashes[ginfo.hash] = group_id ; @@ -287,14 +291,18 @@ RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(cons // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId +#ifdef DEBUG_RSGXSNETTUNNEL + // /!\ this is for testing only! Remove this when done! Can not be done at initialization when rsPeer is not started. RsPeerId ssl_id = rsPeers->getOwnId() ; + mRandomBias = Bias20Bytes(RsDirUtil::sha1sum(ssl_id.toByteArray(),ssl_id.SIZE_IN_BYTES)) ; +#endif - unsigned char mem[RsGxsGroupId::SIZE_IN_BYTES + mRandomBias.SIZE_IN_BYTES]; + unsigned char mem[group_id.SIZE_IN_BYTES + mRandomBias.SIZE_IN_BYTES]; - memcpy(mem ,group_id.toByteArray(),RsGxsGroupId::SIZE_IN_BYTES) ; - memcpy(mem+RsGxsGroupId::SIZE_IN_BYTES,mRandomBias.toByteArray(),mRandomBias.SIZE_IN_BYTES) ; + memcpy(mem ,group_id.toByteArray(),group_id.SIZE_IN_BYTES) ; + memcpy(mem+group_id.SIZE_IN_BYTES,mRandomBias.toByteArray(),mRandomBias.SIZE_IN_BYTES) ; - return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,RsGxsGroupId::SIZE_IN_BYTES+mRandomBias.SIZE_IN_BYTES).toByteArray()); + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,group_id.SIZE_IN_BYTES+mRandomBias.SIZE_IN_BYTES).toByteArray()); } void RsGxsNetTunnelService::dump() const @@ -308,10 +316,11 @@ void RsGxsNetTunnelService::dump() const std::string("[VPIDS_AVAILABLE ]") }; - static std::string group_policy_str[3] = { - std::string("[UNKNOWN]"), - std::string("[PASSIVE]"), - std::string("[ACTIVE ]"), + static std::string group_policy_str[4] = { + std::string("[UNKNOWN ]"), + std::string("[PASSIVE ]"), + std::string("[ACTIVE ]"), + std::string("[REQUESTING]"), }; static std::string vpid_status_str[3] = { std::string("[UNKNOWN ]"), @@ -319,39 +328,39 @@ void RsGxsNetTunnelService::dump() const std::string("[ACTIVE ]") }; - std::cerr << "GxsNetTunnelService dump: " << std::endl; - std::cerr << "Managed GXS groups: " << std::endl; + std::cerr << "GxsNetTunnelService dump (this=" << (void*)this << ". serv=" << std::hex << serviceType() << std::dec <<") : " << std::endl; + std::cerr << " Managed GXS groups: " << std::endl; for(auto it(mGroups.begin());it!=mGroups.end();++it) { - std::cerr << " " << it->first << " hash: " << it->second.hash << " policy: " << group_policy_str[it->second.group_policy] << " status: " << group_status_str[it->second.group_status] << " Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; + std::cerr << " " << it->first << " hash: " << it->second.hash << " policy: " << group_policy_str[it->second.group_policy] << " status: " << group_status_str[it->second.group_status] << " Last contact: " << time(NULL) - it->second.last_contact << " secs ago" << std::endl; if(!it->second.virtual_peers.empty()) - std::cerr << " virtual peers:" << std::endl; + std::cerr << " virtual peers:" << std::endl; for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2) - std::cerr << " " << *it2 << std::endl; + std::cerr << " " << *it2 << std::endl; } - std::cerr << "Virtual peers: " << std::endl; + std::cerr << " Virtual peers: " << std::endl; for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) - std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id + std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id << " status: " << vpid_status_str[it->second.vpid_status] << " direction: " << " group_id: " << it->second.group_id << " direction: " << (int)it->second.side - << " last seen " << time(NULL)-it->second.last_contact + << " last seen " << time(NULL)-it->second.last_contact << " secs ago" << " ekey: " << RsUtil::BinToHex(it->second.encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE,10) << std::endl; - std::cerr << "Virtual peer turtle => GXS conversion table: " << std::endl; + std::cerr << " Virtual peer turtle => GXS conversion table: " << std::endl; for(auto it(mTurtle2GxsPeer.begin());it!=mTurtle2GxsPeer.end();++it) - std::cerr << " " << it->first << " => " << it->second << std::endl; + std::cerr << " " << it->first << " => " << it->second << std::endl; - std::cerr << "Hashes: " << std::endl; + std::cerr << " Hashes: " << std::endl; for(auto it(mHandledHashes.begin());it!=mHandledHashes.end();++it) - std::cerr << " hash: " << it->first << " GroupId: " << it->second << std::endl; + std::cerr << " hash: " << it->first << " GroupId: " << it->second << std::endl; - std::cerr << "Incoming data: " << std::endl; + std::cerr << " Incoming data: " << std::endl; for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) - std::cerr << " peer id " << it->first << " " << (void*)it->second << std::endl; + std::cerr << " peer id " << it->first << " " << (void*)it->second << std::endl; } //===========================================================================================================================================// @@ -472,6 +481,8 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co free(data); return; } + it2->second.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; // status of the peer + it2->second.last_contact = time(NULL); // last time some data was sent/recvd #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << "item contains generic data for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; @@ -638,10 +649,14 @@ void RsGxsNetTunnelService::sendKeepAlivePackets() { RsGxsNetTunnelVirtualPeerId own_gxs_vpid = locked_makeVirtualPeerId(it->second.group_id) ; +#ifdef DEBUG_RSGXSNETTUNNEL + GXS_NET_TUNNEL_DEBUG() << " virtual peer " << it->first << " through tunnel " << it->second.turtle_virtual_peer_id << " for group " << it->second.group_id ; +#endif + if(own_gxs_vpid < it->first) { #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << " sending to virtual peer " << it->first << " through tunnel " << it->second.turtle_virtual_peer_id << std::endl; + std::cerr << ": sent!" << std::endl; #endif RsGxsNetTunnelKeepAliveItem pitem ; RsTemporaryMemory tmpmem( RsGxsNetTunnelSerializer().size(&pitem) ) ; @@ -653,10 +668,12 @@ void RsGxsNetTunnelService::sendKeepAlivePackets() if(p3turtle::encryptData(tmpmem,len,it->second.encryption_master_key,encrypted_turtle_item)) mPendingTurtleItems.push_back(std::make_pair(it->second.turtle_virtual_peer_id,encrypted_turtle_item)) ; + + it->second.last_contact = time(NULL) ; } #ifdef DEBUG_RSGXSNETTUNNEL else - GXS_NET_TUNNEL_DEBUG() << " ignoring virtual peer " << it->first << std::endl; + std::cerr << ": ignored!" << std::endl; #endif } } @@ -679,7 +696,7 @@ void RsGxsNetTunnelService::autowash() #endif // check whether the group already has GXS virtual peers with suppliers. If so, we can set the GRP policy as passive. - if(ginfo.group_policy == RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE) + if(ginfo.group_policy >= RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE) { bool found = false ; @@ -699,10 +716,12 @@ void RsGxsNetTunnelService::autowash() std::cerr << " active, with client-side peers : "; #endif should_monitor_tunnels = false ; + ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE ; } else { should_monitor_tunnels = true ; + ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING ; #ifdef DEBUG_RSGXSNETTUNNEL std::cerr << " active, and no client-side peers available : " ; #endif diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 5d90d9fe3..825ff891c 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -134,7 +134,8 @@ struct RsGxsNetTunnelGroupInfo enum GroupPolicy { RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels - RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will explicitely request tunnels, if none available + RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will only explicitely request tunnels if none available + RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING = 0x03, // group explicitely requests tunnels }; RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} @@ -153,6 +154,12 @@ public: RsGxsNetTunnelService() ; virtual ~RsGxsNetTunnelService() ; + /*! + * \brief serviceType + * \return returns the service that is currently using this as a subclass. + */ + virtual uint16_t serviceType() const = 0 ; + /*! * \brief Manage tunnels for this group * @param group_id group for which tunnels should be released @@ -230,7 +237,7 @@ protected: static const uint32_t RS_GXS_TUNNEL_CONST_RANDOM_BIAS_SIZE = 20 ; static const uint32_t RS_GXS_TUNNEL_CONST_EKEY_SIZE = 32 ; - Bias20Bytes mRandomBias ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. + mutable Bias20Bytes mRandomBias ; // constant accross reboots. Allows to disguise the real SSL id while providing a consistent value accross time. private: void autowash() ; void sendKeepAlivePackets() ; From c5ba0e975fe78377eb628cb1ed6f15adc1512009 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 29 Apr 2018 19:20:14 +0200 Subject: [PATCH 032/213] fixed TS in tunnel management --- libretroshare/src/gxs/rsgxsnettunnel.cc | 26 +++++++++++++++---------- libretroshare/src/gxs/rsgxsnettunnel.h | 4 ++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 052dffacc..96232ad6f 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -40,6 +40,10 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { #warning this is for testing only. In the final version this needs to be initialized with some random content, saved and re-used for a while (e.g. 1 month) mRandomBias.clear(); + + mLastKeepAlive = time(NULL) + (lrand48()%20); // adds some variance in order to avoid doing all this tasks at once across services + mLastAutoWash = time(NULL) + (lrand48()%20); + mLastDump = time(NULL) + (lrand48()%20); } //===========================================================================================================================================// @@ -554,6 +558,8 @@ void RsGxsNetTunnelService::removeVirtualPeer(const TurtleFileHash& hash, const #ifdef DEBUG_RSGXSNETTUNNEL GXS_NET_TUNNEL_DEBUG() << " removing virtual peer " << vpid << " for hash " << hash << std::endl; #endif + mTurtle2GxsPeer.erase(vpid); + auto it = mHandledHashes.find(hash) ; if(it == mHandledHashes.end()) @@ -616,23 +622,23 @@ void RsGxsNetTunnelService::data_tick() // cleanup - static time_t last_autowash = time(NULL); - - if(last_autowash + 5 < now) + if(mLastAutoWash + 5 < now) { autowash(); - last_autowash = now; + mLastAutoWash = now; } - static time_t last_dump = time(NULL); - - if(last_dump + 10 < now) + if(mLastKeepAlive + 20 < now) { - last_dump = now; - dump(); - + mLastKeepAlive = now ; sendKeepAlivePackets() ; } + + if(mLastDump + 10 < now) + { + mLastDump = now; + dump(); + } } void RsGxsNetTunnelService::sendKeepAlivePackets() diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 825ff891c..d0ab17c75 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -274,5 +274,9 @@ private: friend class RsGxsTunnelRandomBiasItem ; friend class StoreHere ; + + time_t mLastKeepAlive ; + time_t mLastAutoWash ; + time_t mLastDump ; }; From ba0819f8d0a4b4b3a699f51d29d6f8197b3c74ba Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 1 May 2018 15:17:41 +0200 Subject: [PATCH 033/213] added additional debug info to test proper distant request of GXS ids --- libretroshare/src/gxs/rsgxsnetservice.cc | 25 +++++++++++++++++------ libretroshare/src/gxs/rsgxsnettunnel.h | 2 +- libretroshare/src/services/p3idservice.cc | 3 ++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 50045b556..7538a1604 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -273,14 +273,14 @@ ***/ #define NXS_NET_DEBUG_0 1 -//#define NXS_NET_DEBUG_1 1 +#define NXS_NET_DEBUG_1 1 //#define NXS_NET_DEBUG_2 1 //#define NXS_NET_DEBUG_3 1 //#define NXS_NET_DEBUG_4 1 -//#define NXS_NET_DEBUG_5 1 +#define NXS_NET_DEBUG_5 1 //#define NXS_NET_DEBUG_6 1 //#define NXS_NET_DEBUG_7 1 -//#define NXS_NET_DEBUG_8 1 +#define NXS_NET_DEBUG_8 1 //#define NXS_FRAG @@ -318,7 +318,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ; || defined(NXS_NET_DEBUG_8) static const RsPeerId peer_to_print = RsPeerId(std::string("")) ; -static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("ff8d59ef38cad0429f34cc21749dda71")) ; // use this to allow to this group id only, or "" for all IDs +static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_CHANNELS ; // use this to allow to this service id only, or 0 for all services // warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums) @@ -3275,7 +3275,7 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr) { #ifdef NXS_NET_DEBUG_1 - GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genSendGrpsTransaction() Generating Grp data send fron TransN: " << tr->mTransaction->transactionNumber << std::endl; + GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genSendGrpsTransaction() Generating Grp data send from TransN: " << tr->mTransaction->transactionNumber << std::endl; #endif // go groups requested in transaction tr @@ -3288,7 +3288,12 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr) { RsNxsSyncGrpItem* item = dynamic_cast(*lit); if (item) + { +#ifdef NXS_NET_DEBUG_1 + GXSNETDEBUG_PG(tr->mTransaction->PeerId(),item->grpId) << "locked_genSendGrpsTransaction() retrieving data for group \"" << item->grpId << "\"" << std::endl; +#endif grps[item->grpId] = NULL; + } else { #ifdef NXS_NET_DEBUG_1 @@ -3300,7 +3305,12 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr) if(!grps.empty()) mDataStore->retrieveNxsGrps(grps, false, false); else + { +#ifdef NXS_NET_DEBUG_1 + GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "RsGxsNetService::locked_genSendGrpsTransaction(): no group to request! This is unexpected" << std::endl; +#endif return; + } NxsTransaction* newTr = new NxsTransaction(); newTr->mFlag = NxsTransaction::FLAG_STATE_WAITING_CONFIRM; @@ -3317,6 +3327,9 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr) mit->second->transactionNumber = transN; newTr->mItems.push_back(mit->second); mit->second = NULL ; // avoids deletion +#ifdef NXS_NET_DEBUG_1 + GXSNETDEBUG_PG(tr->mTransaction->PeerId(),mit->first) << "RsGxsNetService::locked_genSendGrpsTransaction(): adding grp data of group \"" << mit->first << "\" to transaction" << std::endl; +#endif } if(newTr->mItems.empty()){ @@ -4769,7 +4782,7 @@ void RsGxsNetService::processExplicitGroupRequests() for(; git != groupIdList.end(); ++git) { #ifdef NXS_NET_DEBUG_0 - GXSNETDEBUG_PG(peerId,*git) << " group request for grp ID " << *git << " to peer " << peerId << std::endl; + GXSNETDEBUG_P_(peerId) << " group request for grp ID " << *git << " to peer " << peerId << std::endl; #endif RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType); item->grpId = *git; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index d0ab17c75..4c776b9fa 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -176,7 +176,7 @@ public: * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and * alive. This function also "registers" the group which allows to handle tunnel requests in the server side. */ - bool getVirtualPeers(std::list& peers) ; // returns the virtual peers for this group + bool getVirtualPeers(std::list& peers) ; // returns the virtual peers for this service /*! * \brief sendData diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 71b0e2274..51bce5550 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -47,6 +47,7 @@ #include #include +#define DEBUG_IDS 1 /**** * #define DEBUG_IDS 1 * #define DEBUG_RECOGN 1 @@ -277,7 +278,7 @@ void p3IdService::timeStampKey(const RsGxsId& gxs_id, const RsIdentityUsage& rea return ; } #ifdef DEBUG_IDS - std::cerr << "(II) time stamping key " << gxs_id << " for the following reason: " << reason << std::endl; + std::cerr << "(II) time stamping key " << gxs_id << " for the following reason: " << reason.mUsageCode << std::endl; #endif RS_STACK_MUTEX(mIdMtx) ; From 4d6fed643a3fd92a12e1d2d55437c7495db7cec2 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 1 May 2018 20:10:56 +0200 Subject: [PATCH 034/213] reverted to single GxsTunnelService shared for all services --- libretroshare/src/gxs/rsgxsnetservice.cc | 51 +++----- libretroshare/src/gxs/rsgxsnetservice.h | 5 +- libretroshare/src/gxs/rsgxsnettunnel.cc | 121 +++++++++++++++--- libretroshare/src/gxs/rsgxsnettunnel.h | 27 ++-- libretroshare/src/rsitems/rsgxsupdateitems.cc | 10 -- libretroshare/src/rsitems/rsgxsupdateitems.h | 12 -- libretroshare/src/rsserver/rsinit.cc | 25 +++- 7 files changed, 157 insertions(+), 94 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 7538a1604..e18423c0d 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -361,7 +361,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, const RsServiceInfo serviceInfo, RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs, - PgpAuxUtils *pgpUtils, + PgpAuxUtils *pgpUtils, RsGxsNetTunnelService *mGxsNT, bool grpAutoSync, bool msgAutoSync, bool distSync, uint32_t default_store_period, uint32_t default_sync_period) : p3ThreadedService(), p3Config(), mTransactionN(0), mObserver(nxsObs), mDataStore(gds), @@ -370,7 +370,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, mSyncTs(0), mLastKeyPublishTs(0), mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mGixs(gixs), - mReputations(reputations), mPgpUtils(pgpUtils), + mReputations(reputations), mPgpUtils(pgpUtils), mGxsNetTunnel(mGxsNT), mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync),mAllowDistSync(distSync), mServiceInfo(serviceInfo), mDefaultMsgStorePeriod(default_store_period), mDefaultMsgSyncPeriod(default_sync_period) @@ -569,12 +569,12 @@ void RsGxsNetService::syncWithPeers() std::set peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType, peers); - if(mAllowDistSync) + if(mAllowDistSync && mGxsNetTunnel != NULL) { // Grab all online virtual peers of distant tunnels for the current service. std::list vpids ; - getVirtualPeers(vpids); + mGxsNetTunnel->getVirtualPeers(vpids); for(auto it(vpids.begin());it!=vpids.end();++it) peers.insert(RsPeerId(*it)) ; @@ -742,7 +742,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) RsGxsGroupId tmp_grpId; - if(mAllowDistSync && isDistantPeer( static_cast(si->PeerId()),tmp_grpId)) + if(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->isDistantPeer( static_cast(si->PeerId()),tmp_grpId)) { RsNxsSerialiser ser(mServType); @@ -758,7 +758,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) #endif ser.serialise(si,mem,&size) ; - sendTunnelData(mem,size,static_cast(si->PeerId())); + mGxsNetTunnel->sendTunnelData(mServType,mem,size,static_cast(si->PeerId())); } else sendItem(si) ; @@ -766,7 +766,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) void RsGxsNetService::checkDistantSyncState() { - if(!mAllowDistSync) + if(!mAllowDistSync || mGxsNetTunnel==NULL) return ; RsGxsGrpMetaTemporaryMap grpMeta; @@ -806,14 +806,14 @@ void RsGxsNetService::checkDistantSyncState() if(at_least_one_friend_is_supplier) { - releaseDistantPeers(grpId); + mGxsNetTunnel->releaseDistantPeers(mServType,grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": suppliers among friends. Releasing peers." << std::endl; #endif } else { - requestDistantPeers(grpId); + mGxsNetTunnel->requestDistantPeers(mServType,grpId); #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___<< " Group " << grpId << ": no suppliers among friends. Requesting peers." << std::endl; #endif @@ -1522,8 +1522,8 @@ class StoreHere { public: - StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm, RsGxsNetService::ServerMsgMap& smm,RsGxsNetService::GrpConfigMap& gcm, RsGxsServerGrpUpdate& sgm,Bias20Bytes& mrb) - : mClientGrpMap(cgm), mClientMsgMap(cmm), mServerMsgMap(smm), mGrpConfigMap(gcm), mServerGrpUpdate(sgm), mRandomBias(mrb) + StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm, RsGxsNetService::ServerMsgMap& smm,RsGxsNetService::GrpConfigMap& gcm, RsGxsServerGrpUpdate& sgm) + : mClientGrpMap(cgm), mClientMsgMap(cmm), mServerMsgMap(smm), mGrpConfigMap(gcm), mServerGrpUpdate(sgm) {} template void check_store(ID_type id,UpdateMap& map,ItemClass& item) @@ -1541,7 +1541,6 @@ public: RsGxsServerGrpUpdateItem *gsui; RsGxsServerMsgUpdateItem *msui; RsGxsGrpConfigItem *mgci; - RsGxsTunnelRandomBiasItem *rbsi; if((mui = dynamic_cast(item)) != NULL) check_store(mui->peerID,mClientMsgMap,*mui); @@ -1553,8 +1552,6 @@ public: check_store(msui->grpId,mServerMsgMap, *msui); else if((gsui = dynamic_cast(item)) != NULL) mServerGrpUpdate = *gsui; - else if((rbsi = dynamic_cast(item))!=NULL) - mRandomBias = rbsi->mRandomBias; else std::cerr << "Type not expected!" << std::endl; @@ -1569,7 +1566,6 @@ private: RsGxsNetService::GrpConfigMap& mGrpConfigMap; RsGxsServerGrpUpdate& mServerGrpUpdate; - Bias20Bytes& mRandomBias ; }; bool RsGxsNetService::loadList(std::list &load) @@ -1578,12 +1574,11 @@ bool RsGxsNetService::loadList(std::list &load) // The delete is done in StoreHere, if necessary - std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap, mServerMsgUpdateMap, mServerGrpConfigMap, mGrpServerUpdate,mRandomBias)); + std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap, mServerMsgUpdateMap, mServerGrpConfigMap, mGrpServerUpdate)); + time_t now = time(NULL); // We reset group statistics here. This is the best place since we know at this point which are all unsubscribed groups. - time_t now = time(NULL); - for(GrpConfigMap::iterator it(mServerGrpConfigMap.begin());it!=mServerGrpConfigMap.end();++it) { // At each reload, we reset the count of visible messages. It will be rapidely restored to its real value from friends. @@ -1637,6 +1632,7 @@ struct get_second : public std::unary_function& save) { RS_STACK_MUTEX(mNxsMutex) ; @@ -1655,11 +1651,6 @@ bool RsGxsNetService::saveList(bool& cleanup, std::list& save) save.push_back(it); - RsGxsTunnelRandomBiasItem *it2 = new RsGxsTunnelRandomBiasItem(mServType) ; - it2->mRandomBias = mRandomBias; - - save.push_back(it2) ; - cleanup = true; return true; } @@ -1686,7 +1677,7 @@ RsItem *RsGxsNetService::generic_recvItem() uint32_t size = 0 ; RsGxsNetTunnelVirtualPeerId virtual_peer_id ; - while(mAllowDistSync && receiveTunnelData(data,size,virtual_peer_id)) + while(mAllowDistSync && mGxsNetTunnel!=NULL && mGxsNetTunnel->receiveTunnelData(mServType,data,size,virtual_peer_id)) { RsNxsItem *item = dynamic_cast(RsNxsSerialiser(mServType).deserialise(data,&size)) ; item->PeerId(virtual_peer_id) ; @@ -2005,11 +1996,6 @@ void RsGxsNetService::data_tick() runVetting(); processExplicitGroupRequests(); - - // also tick distant traffic - - if(mAllowDistSync) - RsGxsNetTunnelService::data_tick(); } void RsGxsNetService::debugDump() @@ -4117,8 +4103,9 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, const RsGxsGrpMetaData // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for RsGxsGroupId peer_grp ; - if(isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + if(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) { +#warning (cyril) make sure that this is not a problem for cross-service sending of items #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; #endif @@ -4181,7 +4168,7 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for RsGxsGroupId peer_grp ; - if(isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + if(mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; @@ -4535,7 +4522,7 @@ bool RsGxsNetService::canSendMsgIds(std::vector& msgMetas, co // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for RsGxsGroupId peer_grp ; - if(isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + if(mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index d7fe23cc3..6ead3f4c7 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -72,7 +72,7 @@ class RsGroupNetworkStatsRecord * Incoming transaction are in 3 different states * 1. START 2. RECEIVING 3. END */ -class RsGxsNetService : public RsNetworkExchangeService, public RsGxsNetTunnelService, public p3ThreadedService, public p3Config +class RsGxsNetService : public RsNetworkExchangeService, public p3ThreadedService, public p3Config { public: @@ -90,7 +90,7 @@ public: RsNxsObserver *nxsObs, // used to be = NULL. const RsServiceInfo serviceInfo, RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL, - PgpAuxUtils *pgpUtils = NULL, + PgpAuxUtils *pgpUtils = NULL, RsGxsNetTunnelService *mGxsNT = NULL, bool grpAutoSync = true, bool msgAutoSync = true,bool distSync=false, uint32_t default_store_period = RS_GXS_DEFAULT_MSG_STORE_PERIOD, uint32_t default_sync_period = RS_GXS_DEFAULT_MSG_REQ_PERIOD); @@ -548,6 +548,7 @@ private: RsGixs *mGixs; RsGixsReputation* mReputations; PgpAuxUtils *mPgpUtils; + RsGxsNetTunnelService *mGxsNetTunnel; bool mGrpAutoSync; bool mAllowMsgSync; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 96232ad6f..bb1abd6e1 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -32,7 +32,7 @@ #define DEBUG_RSGXSNETTUNNEL 1 #define GXS_NET_TUNNEL_NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } -#define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL(" << std::hex << serviceType() << std::dec << ") : " << __FUNCTION__ << " : " +#define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL: " << __FUNCTION__ << " : " #define GXS_NET_TUNNEL_ERROR() std::cerr << "(EE) GXS_NET_TUNNEL ERROR : " @@ -54,6 +54,7 @@ const uint16_t RS_SERVICE_TYPE_GXS_NET_TUNNEL = 0x2233 ; const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER = 0x01 ; const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE = 0x02 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS = 0x03 ; class RsGxsNetTunnelItem: public RsItem { @@ -91,6 +92,21 @@ public: virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) {} }; +class RsGxsNetTunnelRandomBiasItem: public RsGxsNetTunnelItem +{ +public: + explicit RsGxsNetTunnelRandomBiasItem() : RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS) { clear();} + virtual ~RsGxsNetTunnelRandomBiasItem() {} + + virtual void clear() { mRandomBias.clear() ; } + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) + { + RsTypeSerializer::serial_process(j,ctx,mRandomBias,"random bias") ; + } + + Bias20Bytes mRandomBias; // Cannot be a simple char[] because of serialization. +}; + class RsGxsNetTunnelSerializer: public RsServiceSerializer { public: @@ -108,6 +124,7 @@ public: { case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER: return new RsGxsNetTunnelVirtualPeerItem ; case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE : return new RsGxsNetTunnelKeepAliveItem ; + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS : return new RsGxsNetTunnelRandomBiasItem ; default: GXS_NET_TUNNEL_ERROR() << "type ID " << std::hex << item_subtype << std::dec << " is not handled!" << std::endl; return NULL ; @@ -139,7 +156,8 @@ RsGxsNetTunnelService::~RsGxsNetTunnelService() mVirtualPeers.clear(); for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) - delete (*it).second; + for(auto it2(it->second.begin());it2!=it->second.end();++it2) + delete it2->second; mIncomingData.clear(); } @@ -159,11 +177,11 @@ bool RsGxsNetTunnelService::isDistantPeer(const RsGxsNetTunnelVirtualPeerId& vir return false ; } -bool RsGxsNetTunnelService::receiveTunnelData(unsigned char *& data,uint32_t& data_len,RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::receiveTunnelData(uint16_t service_id, unsigned char *& data, uint32_t& data_len, RsGxsNetTunnelVirtualPeerId& virtual_peer) { RS_STACK_MUTEX(mGxsNetTunnelMtx); - std::list >& lst(mIncomingData); + std::list >& lst(mIncomingData[service_id]); if(lst.empty()) { @@ -185,7 +203,7 @@ bool RsGxsNetTunnelService::receiveTunnelData(unsigned char *& data,uint32_t& da return true; } -bool RsGxsNetTunnelService::sendTunnelData(unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::sendTunnelData(uint16_t service_id,unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) { RS_STACK_MUTEX(mGxsNetTunnelMtx); // The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router. @@ -245,7 +263,7 @@ bool RsGxsNetTunnelService::getVirtualPeers(std::listgetOwnId() ; + mRandomBias = Bias20Bytes(RsDirUtil::sha1sum(ssl_id.toByteArray(),ssl_id.SIZE_IN_BYTES)) ; +#else + mRandomBias = Bias20Bytes::random(); +#endif + IndicateConfigChanged(); + } + + return mRandomBias ; +} + +RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(const RsGxsGroupId& group_id) { assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ;// so that we can build the virtual PeerId from a SHA1 sum. // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId -#ifdef DEBUG_RSGXSNETTUNNEL - // /!\ this is for testing only! Remove this when done! Can not be done at initialization when rsPeer is not started. - RsPeerId ssl_id = rsPeers->getOwnId() ; - mRandomBias = Bias20Bytes(RsDirUtil::sha1sum(ssl_id.toByteArray(),ssl_id.SIZE_IN_BYTES)) ; -#endif + Bias20Bytes rb(locked_randomBias()); - unsigned char mem[group_id.SIZE_IN_BYTES + mRandomBias.SIZE_IN_BYTES]; + unsigned char mem[group_id.SIZE_IN_BYTES + rb.SIZE_IN_BYTES]; memcpy(mem ,group_id.toByteArray(),group_id.SIZE_IN_BYTES) ; - memcpy(mem+group_id.SIZE_IN_BYTES,mRandomBias.toByteArray(),mRandomBias.SIZE_IN_BYTES) ; + memcpy(mem+group_id.SIZE_IN_BYTES,rb.toByteArray(),rb.SIZE_IN_BYTES) ; - return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,group_id.SIZE_IN_BYTES+mRandomBias.SIZE_IN_BYTES).toByteArray()); + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,group_id.SIZE_IN_BYTES+rb.SIZE_IN_BYTES).toByteArray()); } void RsGxsNetTunnelService::dump() const @@ -332,7 +363,7 @@ void RsGxsNetTunnelService::dump() const std::string("[ACTIVE ]") }; - std::cerr << "GxsNetTunnelService dump (this=" << (void*)this << ". serv=" << std::hex << serviceType() << std::dec <<") : " << std::endl; + std::cerr << "GxsNetTunnelService dump (this=" << (void*)this << ": " << std::endl; std::cerr << " Managed GXS groups: " << std::endl; for(auto it(mGroups.begin());it!=mGroups.end();++it) @@ -364,7 +395,12 @@ void RsGxsNetTunnelService::dump() const std::cerr << " Incoming data: " << std::endl; for(auto it(mIncomingData.begin());it!=mIncomingData.end();++it) - std::cerr << " peer id " << it->first << " " << (void*)it->second << std::endl; + { + std::cerr << " service " << std::hex << it->first << std::dec << std::endl; + + for(auto it2(it->second.begin());it2!=it->second.end();++it2) + std::cerr << " peer id " << it2->first << " " << (void*)it2->second << std::endl; + } } //===========================================================================================================================================// @@ -639,6 +675,8 @@ void RsGxsNetTunnelService::data_tick() mLastDump = now; dump(); } + + rstime::rs_usleep(1*1000*1000) ; // 1 sec } void RsGxsNetTunnelService::sendKeepAlivePackets() @@ -759,4 +797,51 @@ void RsGxsNetTunnelService::autowash() } } +bool RsGxsNetTunnelService::saveList(bool& cleanup, std::list& save) +{ + RsGxsNetTunnelRandomBiasItem *it2 = new RsGxsNetTunnelRandomBiasItem() ; + { + RS_STACK_MUTEX(mGxsNetTunnelMtx); + it2->mRandomBias = mRandomBias; + } + + save.push_back(it2) ; + cleanup = true ; + + return true; +} + +bool RsGxsNetTunnelService::loadList(std::list &load) +{ + RsGxsNetTunnelRandomBiasItem *rbsi ; + + for(auto it(load.begin());it!=load.end();++it) + { + if((rbsi = dynamic_cast(*it))!=NULL) + { + RS_STACK_MUTEX(mGxsNetTunnelMtx); + mRandomBias = rbsi->mRandomBias; + } + else + GXS_NET_TUNNEL_ERROR() << " unknown item in config file: type=" << std::hex << (*it)->PacketId() << std::dec << std::endl; + + delete *it; + } + + return true; +} + +RsSerialiser *RsGxsNetTunnelService::setupSerialiser() +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + static RsSerialiser *ser = NULL ; // this is not so nice, but this method is only called from p3Config, so there's no really need of a data race + + if(!ser) + { + ser = new RsSerialiser ; + ser->addSerialType(new RsGxsNetTunnelSerializer) ; + } + + return ser ; +} diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 4c776b9fa..a36883cbb 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -148,29 +148,23 @@ struct RsGxsNetTunnelGroupInfo std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. }; -class RsGxsNetTunnelService: public RsTurtleClientService +class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread, public p3Config { public: RsGxsNetTunnelService() ; virtual ~RsGxsNetTunnelService() ; - /*! - * \brief serviceType - * \return returns the service that is currently using this as a subclass. - */ - virtual uint16_t serviceType() const = 0 ; - /*! * \brief Manage tunnels for this group * @param group_id group for which tunnels should be released */ - bool requestDistantPeers(const RsGxsGroupId&group_id) ; + bool requestDistantPeers(uint16_t service_id,const RsGxsGroupId&group_id) ; /*! * \brief Stop managing tunnels for this group * @param group_id group for which tunnels should be released */ - bool releaseDistantPeers(const RsGxsGroupId&group_id) ; + bool releaseDistantPeers(uint16_t service_id, const RsGxsGroupId&group_id) ; /*! * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and @@ -186,7 +180,7 @@ public: * \return * true if succeeded. */ - bool sendTunnelData(unsigned char *& data, uint32_t data_len, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool sendTunnelData(uint16_t service_id,unsigned char *& data, uint32_t data_len, const RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief receiveData @@ -197,7 +191,7 @@ public: * \return * true if something is returned. If not, data is set to NULL, data_len to 0. */ - bool receiveTunnelData(unsigned char *& data, uint32_t& data_len, RsGxsNetTunnelVirtualPeerId& virtual_peer) ; + bool receiveTunnelData(uint16_t service_id, unsigned char *& data, uint32_t& data_len, RsGxsNetTunnelVirtualPeerId& virtual_peer) ; /*! * \brief isDistantPeer @@ -224,6 +218,12 @@ public: void data_tick() ; + // Overloads p3Config + + RsSerialiser *setupSerialiser(); + bool saveList(bool& cleanup, std::list& save); + bool loadList(std::list &load); + protected: // interaction with turtle router @@ -231,6 +231,7 @@ protected: virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ; void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ; + const Bias20Bytes& locked_randomBias() ; p3turtle *mTurtle ; @@ -252,7 +253,7 @@ private: std::list > mPendingTurtleItems ; // items that need to be sent off-turtle Mutex. - std::list > mIncomingData; // list of incoming data items + std::map > > mIncomingData; // list of incoming data items /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to @@ -266,7 +267,7 @@ private: * tunnel ID and turtle virtual peer id. This allows RsGxsNetService to keep sync-ing the data consistently. */ - RsGxsNetTunnelVirtualPeerId locked_makeVirtualPeerId(const RsGxsGroupId& group_id) const ; + RsGxsNetTunnelVirtualPeerId locked_makeVirtualPeerId(const RsGxsGroupId& group_id) ; static void generateEncryptionKey(const RsGxsGroupId& group_id,const TurtleVirtualPeerId& vpid,unsigned char key[RS_GXS_TUNNEL_CONST_EKEY_SIZE]) ; diff --git a/libretroshare/src/rsitems/rsgxsupdateitems.cc b/libretroshare/src/rsitems/rsgxsupdateitems.cc index eee847704..007407210 100644 --- a/libretroshare/src/rsitems/rsgxsupdateitems.cc +++ b/libretroshare/src/rsitems/rsgxsupdateitems.cc @@ -44,7 +44,6 @@ RsItem* RsGxsUpdateSerialiser::create_item(uint16_t service,uint8_t item_subtype case RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE: return new RsGxsServerGrpUpdateItem(SERVICE_TYPE); case RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE: return new RsGxsServerMsgUpdateItem(SERVICE_TYPE); case RS_PKT_SUBTYPE_GXS_GRP_CONFIG: return new RsGxsGrpConfigItem(SERVICE_TYPE); - case RS_PKT_SUBTYPE_GXS_RANDOM_BIAS: return new RsGxsTunnelRandomBiasItem(SERVICE_TYPE); default: return NULL ; } @@ -77,11 +76,6 @@ void RsGxsServerGrpUpdateItem::clear() grpUpdateTS = 0; } -void RsGxsTunnelRandomBiasItem::clear() -{ - mRandomBias.clear() ; -} - /**********************************************************************************************/ /* SERIALISER */ /**********************************************************************************************/ @@ -140,8 +134,4 @@ void RsGxsGrpConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGe RsTypeSerializer::serial_process(j,ctx,msg_send_delay,"msg_send_delay") ; RsTypeSerializer::serial_process(j,ctx,msg_req_delay,"msg_req_delay") ; } -void RsGxsTunnelRandomBiasItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) -{ - RsTypeSerializer::serial_process(j,ctx,mRandomBias,"random bias") ; -} diff --git a/libretroshare/src/rsitems/rsgxsupdateitems.h b/libretroshare/src/rsitems/rsgxsupdateitems.h index e73dc2197..ec21a14c8 100644 --- a/libretroshare/src/rsitems/rsgxsupdateitems.h +++ b/libretroshare/src/rsitems/rsgxsupdateitems.h @@ -188,18 +188,6 @@ public: RsGxsGroupId grpId; }; -class RsGxsTunnelRandomBiasItem: public RsGxsNetServiceItem -{ -public: - explicit RsGxsTunnelRandomBiasItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_RANDOM_BIAS) { clear();} - virtual ~RsGxsTunnelRandomBiasItem() {} - - virtual void clear(); - virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); - - Bias20Bytes mRandomBias; // Cannot be a simple char[] because of serialization. -}; - class RsGxsUpdateSerialiser : public RsServiceSerializer { public: diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 12d60061e..4140eaa0a 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1358,6 +1358,14 @@ int RsServer::StartupRetroShare() mWiki->setNetworkExchangeService(wiki_ns) ; #endif + /**** GXS Dist sync service ****/ + +#ifdef RS_USE_GXS_DISTANT_SYNC + RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; +#else + RsGxsNetTunnelService *mGxsNetTunnel = NULL ; +#endif + /**** Forum GXS service ****/ RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db", @@ -1371,7 +1379,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_FORUMS, gxsforums_ds, nxsMgr, mGxsForums, mGxsForums->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils); + pgpAuxUtils);//,mGxsNetTunnel,true,true,true); mGxsForums->setNetworkExchangeService(gxsforums_ns) ; @@ -1387,7 +1395,7 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, mGxsChannels, mGxsChannels->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils,true,true,true); + pgpAuxUtils,mGxsNetTunnel,true,true,true); mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; @@ -1442,7 +1450,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxstrans_ns = new RsGxsNetService( RS_SERVICE_TYPE_GXS_TRANS, gxstrans_ds, nxsMgr, mGxsTrans, mGxsTrans->getServiceInfo(), mReputations, mGxsCircles, - mGxsIdService, pgpAuxUtils,true,true,false,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD); + mGxsIdService, pgpAuxUtils,NULL,true,true,false,p3GxsTrans::GXS_STORAGE_PERIOD,p3GxsTrans::GXS_SYNC_PERIOD); mGxsTrans->setNetworkExchangeService(gxstrans_ns); pqih->addService(gxstrans_ns, true); @@ -1475,16 +1483,17 @@ int RsServer::StartupRetroShare() pqih -> addService(fdb,true); pqih -> addService(ftserver,true); - mGxsTunnels = new p3GxsTunnelService(mGxsIdService) ; - mGxsTunnels->connectToTurtleRouter(tr) ; - rsGxsTunnel = mGxsTunnels; + mGxsTunnels = new p3GxsTunnelService(mGxsIdService) ; + mGxsTunnels->connectToTurtleRouter(tr) ; + rsGxsTunnel = mGxsTunnels; + + mGxsNetTunnel->connectToTurtleRouter(tr) ; rsDisc = mDisc; rsMsgs = new p3Msgs(msgSrv, chatSrv); // connect components to turtle router. - gxschannels_ns->connectToTurtleRouter(tr) ; ftserver->connectToTurtleRouter(tr) ; ftserver->connectToFileDatabase(fdb) ; chatSrv->connectToGxsTunnelService(mGxsTunnels) ; @@ -1615,6 +1624,7 @@ int RsServer::StartupRetroShare() //mConfigMgr->addConfiguration("ftserver.cfg", ftserver); // mConfigMgr->addConfiguration("gpg_prefs.cfg", AuthGPG::getAuthGPG()); + mConfigMgr->addConfiguration("gxsnettunnel.cfg", mGxsNetTunnel); mConfigMgr->loadConfiguration(); mConfigMgr->addConfiguration("peers.cfg", mPeerMgr); @@ -1824,6 +1834,7 @@ int RsServer::StartupRetroShare() /*** start up GXS core runner ***/ + startServiceThread(mGxsNetTunnel, "gxs net tunnel"); startServiceThread(mGxsIdService, "gxs id"); startServiceThread(mGxsCircles, "gxs circle"); startServiceThread(mPosted, "gxs posted"); From 8d5c013a17b8cce4a4724234f95731f7d08bcfd5 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 3 May 2018 23:21:59 +0200 Subject: [PATCH 035/213] added proper synchronization of GxsIds through tunnels of another service --- libretroshare/src/gxs/rsgxsnetservice.cc | 29 ++++- libretroshare/src/gxs/rsgxsnetservice.h | 1 + libretroshare/src/gxs/rsgxsnettunnel.cc | 149 +++++++++++----------- libretroshare/src/gxs/rsgxsnettunnel.h | 2 + libretroshare/src/gxs/rsnxs.h | 8 ++ libretroshare/src/rsserver/rsinit.cc | 21 +-- libretroshare/src/services/p3idservice.cc | 2 +- 7 files changed, 127 insertions(+), 85 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index e18423c0d..8a46fc89e 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -766,7 +766,7 @@ void RsGxsNetService::generic_sendItem(RsNxsItem *si) void RsGxsNetService::checkDistantSyncState() { - if(!mAllowDistSync || mGxsNetTunnel==NULL) + if(!mAllowDistSync || mGxsNetTunnel==NULL || !mGrpAutoSync) return ; RsGxsGrpMetaTemporaryMap grpMeta; @@ -835,6 +835,17 @@ void RsGxsNetService::syncGrpStatistics() std::set online_peers; mNetMgr->getOnlineList(mServiceInfo.mServiceType, online_peers); + if(mAllowDistSync && mGxsNetTunnel != NULL) + { + // Grab all online virtual peers of distant tunnels for the current service. + + std::list vpids ; + mGxsNetTunnel->getVirtualPeers(vpids); + + for(auto it(vpids.begin());it!=vpids.end();++it) + online_peers.insert(RsPeerId(*it)) ; + } + // Go through group statistics and groups without information are re-requested to random peers selected // among the ones who provided the group info. @@ -4168,7 +4179,7 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for RsGxsGroupId peer_grp ; - if(mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + if(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; @@ -4522,7 +4533,7 @@ bool RsGxsNetService::canSendMsgIds(std::vector& msgMetas, co // check if that peer is a virtual peer id, in which case we only send/recv data to/from it items for the group it's requested for RsGxsGroupId peer_grp ; - if(mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) + if(mAllowDistSync && mGxsNetTunnel != NULL && mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(sslId),peer_grp) && peer_grp != grpMeta.mGroupId) { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Distant peer designed for group " << peer_grp << ": cannot request sync for different group." << std::endl; @@ -5064,6 +5075,18 @@ bool RsGxsNetService::removeGroups(const std::list& groups) return true ; } +bool RsGxsNetService::isDistantPeer(const RsPeerId& pid) +{ + RS_STACK_MUTEX(mNxsMutex) ; + + if(!mAllowDistSync || mGxsNetTunnel == NULL) + return false ; + + RsGxsGroupId group_id ; + + return mGxsNetTunnel->isDistantPeer(RsGxsNetTunnelVirtualPeerId(pid),group_id); +} + bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid) { RS_STACK_MUTEX(mNxsMutex) ; diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 6ead3f4c7..fe1c77010 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -170,6 +170,7 @@ public: virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ; virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ; virtual bool removeGroups(const std::list& groups); + virtual bool isDistantPeer(const RsPeerId& pid); /* p3Config methods */ public: diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index bb1abd6e1..b81b6a7c0 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -275,6 +275,7 @@ bool RsGxsNetTunnelService::requestDistantPeers(uint16_t service_id, const RsGxs ginfo.group_policy = RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE; ginfo.hash = calculateGroupHash(group_id) ; + ginfo.service_id = service_id; mHandledHashes[ginfo.hash] = group_id ; @@ -307,39 +308,6 @@ bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t service_id,const RsGxsG return true; } -const Bias20Bytes& RsGxsNetTunnelService::locked_randomBias() -{ - if(mRandomBias.isNull()) - { -#ifdef DEBUG_RSGXSNETTUNNEL -#warning /!\ this is for testing only! Remove this when done! Can not be done at initialization when rsPeer is not started. - RsPeerId ssl_id = rsPeers->getOwnId() ; - mRandomBias = Bias20Bytes(RsDirUtil::sha1sum(ssl_id.toByteArray(),ssl_id.SIZE_IN_BYTES)) ; -#else - mRandomBias = Bias20Bytes::random(); -#endif - IndicateConfigChanged(); - } - - return mRandomBias ; -} - -RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(const RsGxsGroupId& group_id) -{ - assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ;// so that we can build the virtual PeerId from a SHA1 sum. - - // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId - - Bias20Bytes rb(locked_randomBias()); - - unsigned char mem[group_id.SIZE_IN_BYTES + rb.SIZE_IN_BYTES]; - - memcpy(mem ,group_id.toByteArray(),group_id.SIZE_IN_BYTES) ; - memcpy(mem+group_id.SIZE_IN_BYTES,rb.toByteArray(),rb.SIZE_IN_BYTES) ; - - return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,group_id.SIZE_IN_BYTES+rb.SIZE_IN_BYTES).toByteArray()); -} - void RsGxsNetTunnelService::dump() const { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -379,7 +347,7 @@ void RsGxsNetTunnelService::dump() const std::cerr << " Virtual peers: " << std::endl; for(auto it(mVirtualPeers.begin());it!=mVirtualPeers.end();++it) std::cerr << " GXS Peer:" << it->first << " Turtle:" << it->second.turtle_virtual_peer_id - << " status: " << vpid_status_str[it->second.vpid_status] << " direction: " + << " status: " << vpid_status_str[it->second.vpid_status] << " group_id: " << it->second.group_id << " direction: " << (int)it->second.side << " last seen " << time(NULL)-it->second.last_contact << " secs ago" @@ -466,7 +434,9 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co return ; } - if(getRsItemService(getRsItemId(data)) == RS_SERVICE_TYPE_GXS_NET_TUNNEL) + uint16_t service_id = getRsItemService(getRsItemId(data)); + + if(service_id == RS_SERVICE_TYPE_GXS_NET_TUNNEL) { RsItem *decrypted_item = RsGxsNetTunnelSerializer().deserialise(data,&data_size); RsGxsNetTunnelVirtualPeerItem *pid_item = dynamic_cast(decrypted_item) ; @@ -491,52 +461,61 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co vp_info.side = direction; // client/server vp_info.last_contact = time(NULL); // last time some data was sent/recvd vp_info.group_id = group_id; + vp_info.service_id = mGroups[group_id].service_id ; memcpy(vp_info.encryption_master_key,encryption_master_key,RS_GXS_TUNNEL_CONST_EKEY_SIZE); vp_info.turtle_virtual_peer_id = turtle_virtual_peer_id; // turtle peer to use when sending data to this vpid. free(data); + + return ; } - else + + + // item is a generic data item for the client. Let's store the data in the appropriate incoming data queue. + + auto it = mTurtle2GxsPeer.find(turtle_virtual_peer_id) ; + + if(it == mTurtle2GxsPeer.end()) { - // item is a generic data item for the client. Let's store the data in the appropriate incoming data queue. + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for vpid " << turtle_virtual_peer_id << " but this vpid is unknown!" << std::endl; + free(data); + return; + } - auto it = mTurtle2GxsPeer.find(turtle_virtual_peer_id) ; + RsGxsNetTunnelVirtualPeerId gxs_vpid = it->second ; - if(it == mTurtle2GxsPeer.end()) - { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for vpid " << turtle_virtual_peer_id << " but this vpid is unknown!" << std::endl; - free(data); - return; - } + auto it2 = mVirtualPeers.find(gxs_vpid) ; - RsGxsNetTunnelVirtualPeerId gxs_vpid = it->second ; + if(it2 == mVirtualPeers.end()) + { + GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid << " but the virtual peer id is missing!" << std::endl; + free(data); + return; + } + it2->second.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; // status of the peer + it2->second.last_contact = time(NULL); // last time some data was sent/recvd - auto it2 = mVirtualPeers.find(gxs_vpid) ; - - if(it2 == mVirtualPeers.end()) - { - GXS_NET_TUNNEL_ERROR() << "item received by GxsNetTunnel for GXS vpid " << gxs_vpid << " but the virtual peer id is missing!" << std::endl; - free(data); - return; - } - it2->second.vpid_status = RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE ; // status of the peer - it2->second.last_contact = time(NULL); // last time some data was sent/recvd + if(service_id != it2->second.service_id && service_id != RS_SERVICE_GXS_TYPE_GXSID) + { + GXS_NET_TUNNEL_ERROR() << " received an item for VPID " << gxs_vpid << " openned for service " << it2->second.service_id << " that is not for that service nor for GXS Id service (service=" << std::hex << service_id << std::dec << ". Rejecting!" << std::endl; + free(data); + return ; + } #ifdef DEBUG_RSGXSNETTUNNEL - GXS_NET_TUNNEL_DEBUG() << "item contains generic data for VPID " << gxs_vpid << ". Storing in incoming list" << std::endl; + GXS_NET_TUNNEL_DEBUG() << "item contains generic data for VPID " << gxs_vpid << ". service_id = " << std::hex << service_id << std::dec << ". Storing in incoming list" << std::endl; #endif - // push the data into the incoming data list + // push the data into the incoming data list - RsTlvBinaryData *bind = new RsTlvBinaryData; - bind->tlvtype = 0; - bind->bin_len = data_size; - bind->bin_data = data; + RsTlvBinaryData *bind = new RsTlvBinaryData; + bind->tlvtype = 0; + bind->bin_len = data_size; + bind->bin_data = data; - mIncomingData.push_back(std::make_pair(gxs_vpid,bind)) ; - } + mIncomingData[service_id].push_back(std::make_pair(gxs_vpid,bind)) ; } void RsGxsNetTunnelService::addVirtualPeer(const TurtleFileHash& hash, const TurtleVirtualPeerId& vpid,RsTurtleGenericTunnelItem::Direction dir) @@ -679,6 +658,40 @@ void RsGxsNetTunnelService::data_tick() rstime::rs_usleep(1*1000*1000) ; // 1 sec } +const Bias20Bytes& RsGxsNetTunnelService::locked_randomBias() +{ + if(mRandomBias.isNull()) + { +#ifdef DEBUG_RSGXSNETTUNNEL +#warning /!\ this is for testing only! Remove this when done! Can not be done at initialization when rsPeer is not started. + RsPeerId ssl_id = rsPeers->getOwnId() ; + mRandomBias = Bias20Bytes(RsDirUtil::sha1sum(ssl_id.toByteArray(),ssl_id.SIZE_IN_BYTES)) ; +#else + mRandomBias = Bias20Bytes::random(); +#endif + IndicateConfigChanged(); + } + + return mRandomBias ; +} + +RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(const RsGxsGroupId& group_id) +{ + assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ;// so that we can build the virtual PeerId from a SHA1 sum. + + // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId + + Bias20Bytes rb(locked_randomBias()); + + unsigned char mem[group_id.SIZE_IN_BYTES + rb.SIZE_IN_BYTES]; + + memcpy(mem ,group_id.toByteArray(),group_id.SIZE_IN_BYTES) ; + memcpy(mem+group_id.SIZE_IN_BYTES,rb.toByteArray(),rb.SIZE_IN_BYTES) ; + + return RsGxsNetTunnelVirtualPeerId(RsDirUtil::sha1sum(mem,group_id.SIZE_IN_BYTES+rb.SIZE_IN_BYTES).toByteArray()); +} + + void RsGxsNetTunnelService::sendKeepAlivePackets() { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -834,14 +847,8 @@ bool RsGxsNetTunnelService::loadList(std::list &load) RsSerialiser *RsGxsNetTunnelService::setupSerialiser() { - RS_STACK_MUTEX(mGxsNetTunnelMtx); - static RsSerialiser *ser = NULL ; // this is not so nice, but this method is only called from p3Config, so there's no really need of a data race - - if(!ser) - { - ser = new RsSerialiser ; - ser->addSerialType(new RsGxsNetTunnelSerializer) ; - } + RsSerialiser *ser = new RsSerialiser ; + ser->addSerialType(new RsGxsNetTunnelSerializer) ; return ser ; } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index a36883cbb..abe7aba1c 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -120,6 +120,7 @@ struct RsGxsNetTunnelVirtualPeerInfo TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. RsGxsGroupId group_id ; // group that virtual peer is providing + uint16_t service_id ; // this is used for checkng consistency of the incoming data }; struct RsGxsNetTunnelGroupInfo @@ -144,6 +145,7 @@ struct RsGxsNetTunnelGroupInfo GroupStatus group_status ; time_t last_contact ; TurtleFileHash hash ; + uint16_t service_id ; std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. }; diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 283c96e65..faec2577a 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -166,6 +166,14 @@ public: */ virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) =0; + /*! + * \brief isDistantPeer + * \param pid peer that is a virtual peer provided by GxsNetTunnel + * \return + * true if the peer exists (adn therefore is online) + */ + virtual bool isDistantPeer(const RsPeerId& pid)=0; + /*! * \brief removeGroups * Removes time stamp information from the list of groups. This allows to re-sync them if suppliers are present. diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 4140eaa0a..7fd67fa27 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1279,6 +1279,14 @@ int RsServer::StartupRetroShare() RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(serviceCtrl); + /**** GXS Dist sync service ****/ + +#ifdef RS_USE_GXS_DISTANT_SYNC + RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; +#else + RsGxsNetTunnelService *mGxsNetTunnel = NULL ; +#endif + /**** Identity service ****/ RsGeneralDataService* gxsid_ds = new RsDataService(currGxsDir + "/", "gxsid_db", @@ -1300,9 +1308,10 @@ int RsServer::StartupRetroShare() RS_SERVICE_GXS_TYPE_GXSID, gxsid_ds, nxsMgr, mGxsIdService, mGxsIdService->getServiceInfo(), mReputations, mGxsCircles,mGxsIdService, - pgpAuxUtils,NULL, - false,false); // don't synchronise group automatic (need explicit group request) + pgpAuxUtils,mGxsNetTunnel, + false,false,true); // don't synchronise group automatic (need explicit group request) // don't sync messages at all. + // allow distsync, so that we can grab GXS id requests for other services // Normally we wouldn't need this (we do in other service): // mGxsIdService->setNetworkExchangeService(gxsid_ns) ; @@ -1358,14 +1367,6 @@ int RsServer::StartupRetroShare() mWiki->setNetworkExchangeService(wiki_ns) ; #endif - /**** GXS Dist sync service ****/ - -#ifdef RS_USE_GXS_DISTANT_SYNC - RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; -#else - RsGxsNetTunnelService *mGxsNetTunnel = NULL ; -#endif - /**** Forum GXS service ****/ RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db", diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 51bce5550..5618568fa 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -2700,7 +2700,7 @@ void p3IdService::requestIdsFromNet() bool request_can_proceed = false ; for(cit2 = peers.begin(); cit2 != peers.end(); ++cit2) - if(rsPeers->isOnline(*cit2)) // make sure that the peer in online, so that we know that the request has some chance to succeed. + if(rsPeers->isOnline(*cit2) || mNes->isDistantPeer(*cit2)) // make sure that the peer in online, so that we know that the request has some chance to succeed. { requests[*cit2].push_back(cit->first); request_can_proceed = true ; From 0ada4d48958a4ee049046293969a005b8825c220 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 5 May 2018 18:08:27 +0200 Subject: [PATCH 036/213] improved GxsNetTunnel comment section --- libretroshare/src/gxs/rsgxsnettunnel.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index abe7aba1c..46314da6f 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -35,7 +35,7 @@ * to RsGxsNetService. * * It is the responsibility of RsGxsNetService to activate/desactivate tunnels for each particular group, depending on wether the group - * is already available at friends or not. + * is already available at regular friends or not. * * Tunnel management is done at the level of groups rather than services, because we would like to keep the possibility to not * request tunnels for some groups which do not need it, and only request tunnels for specific groups that cannot be provided @@ -47,7 +47,6 @@ // * encrypt tunnel data using chacha20+HMAC-SHA256 using AEAD( GroupId, 96bits IV, tunnel ID ) (similar to what FT does) // * when tunnel is established, exchange virtual peer names: vpid = H( GroupID | Random bias ) // * when vpid is known, notify the client (GXS net service) which can use the virtual peer to sync -// // * only use a single tunnel per virtual peer ID // - // Client ------------------ TR(H(GroupId)) --------------> Server | @@ -67,7 +66,7 @@ // Client <------------------- GXS Data ------------------> Server | // - // Notes: -// * tunnels are established symetrically. If a distant peers wants to sync the same group, they'll have to open a single tunnel, with a different ID. +// * tunnels are established symmetrically. If a distant peers wants to sync the same group, they'll have to open a single tunnel, with a different ID. // Groups therefore have two states: // - managed : the group can be used to answer tunnel requests. If server tunnels are established, the group will be synced with these peers // - tunneled: the group will actively request tunnels. If tunnels are established both ways, the same virtual peers will be used so the tunnels are "merged". @@ -90,13 +89,18 @@ // // * virtual peers are also shared among services. This reduces the required amount of tunnels and tunnel requests to send. // +// * tunnels for a given service may also be used by the net service of p3IdService in order to explicitely request missing GxsIds. +// So GxsNetTunnel somehow allows different services to use the same tunnel. However we make sure that this traffic is limited to only p3IdService. +// // How do we know that a group needs distant sync? // * look into GrpConfigMap for suppliers. Suppliers is cleared at load. // * last_update_TS in GrpConfigMap is randomised so it cannot be used // * we need a way to know that there's no suppliers for good reasons (not that we just started) // // Security -// * +// * the question of sync-ing with distant anonymous peers is a bit tricky because these peers can try to generate fake requests or change which messages are available +// and there is no way to prevent it. We therefore rely on GXS data integrity system to prevent this to happen. +// typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; @@ -128,8 +132,7 @@ struct RsGxsNetTunnelGroupInfo enum GroupStatus { RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting -// RS_GXS_NET_TUNNEL_GRP_STATUS_TUNNELS_REQUESTED = 0x02, // virtual peers requested, and waiting for turtle to answer - RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x03 // some virtual peers are available. Data can be read/written + RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available. Data can be read/written }; enum GroupPolicy { From e7182013bf18f848a42b3f270e9a6e5c0ac35574 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 5 May 2018 18:41:41 +0200 Subject: [PATCH 037/213] added items for generic search result items for GXS --- libretroshare/src/retroshare/rsturtle.h | 8 ++++++ libretroshare/src/turtle/rsturtleitem.h | 37 +++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 7cef4fd77..4609905bc 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -33,7 +33,9 @@ #include #include +#include "serialiser/rstlvbinary.h" #include "retroshare/rstypes.h" +#include "retroshare/rsgxsifacetypes.h" namespace RsRegularExpression { class LinearizedExpression ; } class RsTurtleClientService ; @@ -52,6 +54,12 @@ struct TurtleFileInfo std::string name ; uint64_t size ; }; +struct TurtleGxsInfo +{ + RsGxsGroupId group_id ; + std::string name ; + RsTlvBinaryData meta ; +}; struct TurtleTunnelRequestDisplayInfo { uint32_t request_id ; // Id of the request diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 248082652..1eded28dd 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -16,7 +16,7 @@ #include "serialiser/rsserializer.h" const uint8_t RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST = 0x01 ; -const uint8_t RS_TURTLE_SUBTYPE_SEARCH_RESULT = 0x02 ; +const uint8_t RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT = 0x02 ; const uint8_t RS_TURTLE_SUBTYPE_OPEN_TUNNEL = 0x03 ; const uint8_t RS_TURTLE_SUBTYPE_TUNNEL_OK = 0x04 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_REQUEST = 0x07 ; @@ -27,6 +27,7 @@ const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP = 0x10 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST = 0x11 ; const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC = 0x14 ; const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST = 0x15 ; +const uint8_t RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT = 0x16 ; // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC = 0x12 ; // unused // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC_REQUEST = 0x13 ; @@ -49,7 +50,23 @@ class RsTurtleItem: public RsItem class RsTurtleSearchResultItem: public RsTurtleItem { public: - RsTurtleSearchResultItem() : RsTurtleItem(RS_TURTLE_SUBTYPE_SEARCH_RESULT), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} + RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} + + TurtleSearchRequestId request_id ; // Randomly generated request id. + + uint16_t depth ; // The depth of a search result is obfuscated in this way: + // If the actual depth is 1, this field will be 1. + // If the actual depth is > 1, this field is a larger arbitrary integer. + + virtual void clear() =0; + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)=0; + protected: +}; + +class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem +{ + public: + RsTurtleFTSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT){} TurtleSearchRequestId request_id ; // Randomly generated request id. @@ -61,7 +78,23 @@ class RsTurtleSearchResultItem: public RsTurtleItem void clear() { result.clear() ; } protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; +class RsTurtleGxsSearchResultItem: public RsTurtleSearchResultItem +{ + public: + RsTurtleGxsSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT){} + + TurtleSearchRequestId request_id ; // Randomly generated request id. + + uint16_t depth ; // The depth of a search result is obfuscated in this way: + // If the actual depth is 1, this field will be 1. + // If the actual depth is > 1, this field is a larger arbitrary integer. + std::list result ; + + void clear() { result.clear() ; } + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; class RsTurtleSearchRequestItem: public RsTurtleItem From 6551af3a472846b52a1a12c3579da8e10fe05bcf Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 16 May 2018 13:47:03 +0200 Subject: [PATCH 038/213] modified control file for debian packaging --- build_scripts/Debian+Ubuntu/debian/control | 10 ++--- .../Debian+Ubuntu/debian_release_howto.txt | 37 ++++++++++++++----- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/build_scripts/Debian+Ubuntu/debian/control b/build_scripts/Debian+Ubuntu/debian/control index 68b7e8a68..ccf757edb 100644 --- a/build_scripts/Debian+Ubuntu/debian/control +++ b/build_scripts/Debian+Ubuntu/debian/control @@ -1,6 +1,6 @@ Source: retroshare Section: devel -Priority: standard +Priority: optional Maintainer: Cyril Soler Build-Depends: debhelper (>= 9), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qtbase5-dev, qt5-qmake, qtbase5-dev-tools Standards-Version: 4.1.4 @@ -8,7 +8,7 @@ Homepage: http://retroshare.sourceforge.net Package: retroshare-voip-plugin Architecture: any -Conflicts: retroshare06-voip-plugin +Conflicts: Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5 Description: RetroShare VOIP plugin This package provides a plugin for RetroShare, a secured Friend-to-Friend communication @@ -17,7 +17,7 @@ Description: RetroShare VOIP plugin Package: retroshare-feedreader-plugin Architecture: any -Conflicts: retroshare06-feedreader-plugin +Conflicts: Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare Description: RetroShare FeedReader plugin Plugin for Retroshare, adding a RSS feed reader tab to retroshare. @@ -25,14 +25,14 @@ Description: RetroShare FeedReader plugin Package: retroshare-nogui Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring -Conflicts: retroshare,retroshare06-nogui +Conflicts: retroshare Description: headless version of Retroshare Headless version of the Retroshare platform. Package: retroshare Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring -Conflicts: retroshare-nogui,retroshare06 +Conflicts: retroshare-nogui Description: Secure communication with friends RetroShare is a Open Source, private and secure decentralised commmunication platform. It creates mesh of computers linked with TLS connections, diff --git a/build_scripts/Debian+Ubuntu/debian_release_howto.txt b/build_scripts/Debian+Ubuntu/debian_release_howto.txt index f77a9dd3e..db9f8d9bf 100644 --- a/build_scripts/Debian+Ubuntu/debian_release_howto.txt +++ b/build_scripts/Debian+Ubuntu/debian_release_howto.txt @@ -2,8 +2,8 @@ Creation of a new Debian changelog: dch --create --package retroshare --newversion 0.6.4-1 - Note: dch reads email in $DEBMAIL or $USER@$HOSTNAME, so it should be made correct in debian/changlog - If the email does not match the email in mentors, the package will be rejected. + Note: dch reads email in $DEBMAIL or $USER@$HOSTNAME, so it should be made correct in debian/changlog + If the email does not match the email in mentors, the package will be rejected. dget command to retrieve source package: @@ -16,17 +16,34 @@ When ready: dput mentors retroshare_0.6.4-1_source.changes -Checkign with lintian: - lintian --pedantic --profile debian retroshare_0.6.4-1_source.changes +Checking with lintian: + lintian -EI --pedantic --profile debian retroshare_0.6.4-1_source.changes + echo -e 'display-info=y\ndisplay-experimental=y\npedantic=y\ncolor=auto' > ~/.config/lintian/lintianrc + + Also apply lintian to binaries + * fix overlinking in voip plugin + +Turn the RFP bug into ITP + you have to send an e-mail to control@bugs.debian.org and use the "retitle" command + [05/13/2018] successfully retitled. The mail *body* (instead of subject) needs to contain the command in a single line. Todo - * make a sid binary package. - * test in sid using pbuilder chroot system (pbuilder login) - * upload to mentors - * request for sponsorship + x make a sid binary package. + * test in sid using pbuilder chroot system (pbuilder login) + x upload to mentors + x request for sponsorship + * Getting help: - https://webchat.oftc.net/ + https://webchat.oftc.net/ Bug creation/report - reportbug -B debian + reportbug -B debian + +Re-do debian/rules according to + https://sources.debian.org/src/sleepyhead/1.0.0-beta-2+dfsg-5/debian/rules/ + the proper way to use qtchooser in d/rules is exporting QT_SELECT in d/rules, see https://pkg-kde.alioth.debian.org/packagingqtbasedstuff.html + disable autologin + +Put the package on salsa: + salsa.debian.org From cfda3b8ac6779a1024d641268e683d219e29b839 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 16 May 2018 18:37:28 +0200 Subject: [PATCH 039/213] moved debian packaging files into a separate directory --- build_scripts/Debian/clean.sh | 11 ++ build_scripts/Debian/debian/README.Debian | 6 + build_scripts/Debian/debian/changelog | 5 + build_scripts/Debian/debian/compat | 1 + build_scripts/Debian/debian/control | 41 +++++ build_scripts/Debian/debian/copyright | 44 +++++ build_scripts/Debian/debian/docs | 0 .../retroshare-feedreader-plugin.install | 1 + .../Debian/debian/retroshare-nogui.install | 3 + .../debian/retroshare-voip-plugin.install | 1 + .../Debian/debian/retroshare.install | 6 + build_scripts/Debian/debian/retrotor.install | 5 + build_scripts/Debian/debian/rules | 81 ++++++++++ build_scripts/Debian/debian/source/format | 1 + build_scripts/Debian/debian_release_howto.txt | 49 ++++++ build_scripts/Debian/makeSourcePackage.sh | 151 ++++++++++++++++++ 16 files changed, 406 insertions(+) create mode 100755 build_scripts/Debian/clean.sh create mode 100644 build_scripts/Debian/debian/README.Debian create mode 100644 build_scripts/Debian/debian/changelog create mode 100644 build_scripts/Debian/debian/compat create mode 100644 build_scripts/Debian/debian/control create mode 100644 build_scripts/Debian/debian/copyright create mode 100644 build_scripts/Debian/debian/docs create mode 100644 build_scripts/Debian/debian/retroshare-feedreader-plugin.install create mode 100644 build_scripts/Debian/debian/retroshare-nogui.install create mode 100644 build_scripts/Debian/debian/retroshare-voip-plugin.install create mode 100644 build_scripts/Debian/debian/retroshare.install create mode 100644 build_scripts/Debian/debian/retrotor.install create mode 100755 build_scripts/Debian/debian/rules create mode 100644 build_scripts/Debian/debian/source/format create mode 100644 build_scripts/Debian/debian_release_howto.txt create mode 100755 build_scripts/Debian/makeSourcePackage.sh diff --git a/build_scripts/Debian/clean.sh b/build_scripts/Debian/clean.sh new file mode 100755 index 000000000..8750b8f46 --- /dev/null +++ b/build_scripts/Debian/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +rm -f ./retroshare_0.?.?-1_source.build +rm -f ./retroshare_0.?.?-1_source.changes +rm -f ./retroshare_0.?.?-1.tar.gz +rm -f ./retroshare_0.?.?-1.diff.gz +rm -f ./retroshare_0.?.?-1.dsc + +rm -f *~ +find . -name "*~" -exec rm {} \; + diff --git a/build_scripts/Debian/debian/README.Debian b/build_scripts/Debian/debian/README.Debian new file mode 100644 index 000000000..1d60d62a6 --- /dev/null +++ b/build_scripts/Debian/debian/README.Debian @@ -0,0 +1,6 @@ +retroshare for Debian +--------------------- + + + + -- Cyril Soler Sat, 06 Feb 2010 07:15:46 +0100 diff --git a/build_scripts/Debian/debian/changelog b/build_scripts/Debian/debian/changelog new file mode 100644 index 000000000..c4dd0e732 --- /dev/null +++ b/build_scripts/Debian/debian/changelog @@ -0,0 +1,5 @@ +retroshare (0.6.4-1) UNRELEASED; urgency=medium + + * Initial release for Debian. (Closes: #659069) + + -- Cyril Soler Wed, 09 May 2018 10:11:31 +0200 diff --git a/build_scripts/Debian/debian/compat b/build_scripts/Debian/debian/compat new file mode 100644 index 000000000..f599e28b8 --- /dev/null +++ b/build_scripts/Debian/debian/compat @@ -0,0 +1 @@ +10 diff --git a/build_scripts/Debian/debian/control b/build_scripts/Debian/debian/control new file mode 100644 index 000000000..ccf757edb --- /dev/null +++ b/build_scripts/Debian/debian/control @@ -0,0 +1,41 @@ +Source: retroshare +Section: devel +Priority: optional +Maintainer: Cyril Soler +Build-Depends: debhelper (>= 9), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qtbase5-dev, qt5-qmake, qtbase5-dev-tools +Standards-Version: 4.1.4 +Homepage: http://retroshare.sourceforge.net + +Package: retroshare-voip-plugin +Architecture: any +Conflicts: +Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5 +Description: RetroShare VOIP plugin + This package provides a plugin for RetroShare, a secured Friend-to-Friend communication + plateform. The plugin adds voice-over-IP functionality to the private chat window. Both + friends chatting together need the plugin installed to be able to talk together. + +Package: retroshare-feedreader-plugin +Architecture: any +Conflicts: +Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare +Description: RetroShare FeedReader plugin + Plugin for Retroshare, adding a RSS feed reader tab to retroshare. + +Package: retroshare-nogui +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring +Conflicts: retroshare +Description: headless version of Retroshare + Headless version of the Retroshare platform. + +Package: retroshare +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring +Conflicts: retroshare-nogui +Description: Secure communication with friends + RetroShare is a Open Source, private and secure decentralised + commmunication platform. It creates mesh of computers linked with TLS connections, + on top of which it provides file transfer, asynchronous email, forums, channels and chat. + + diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright new file mode 100644 index 000000000..84b7e4a7f --- /dev/null +++ b/build_scripts/Debian/debian/copyright @@ -0,0 +1,44 @@ +This package was debianized by: + + Cyril Soler on Sat, 06 Feb 2010 07:15:46 +0100 + +It was downloaded from: + + + +Upstream Author(s): + + + + +Copyright: + + + + +License: + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This package 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +On Debian systems, the complete text of the GNU General +Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. + +The Debian packaging is: + + Copyright (C) 2010 Cyril Soler + +and is licensed under the GPL version 3, see above. + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/build_scripts/Debian/debian/docs b/build_scripts/Debian/debian/docs new file mode 100644 index 000000000..e69de29bb diff --git a/build_scripts/Debian/debian/retroshare-feedreader-plugin.install b/build_scripts/Debian/debian/retroshare-feedreader-plugin.install new file mode 100644 index 000000000..5fc9c6571 --- /dev/null +++ b/build_scripts/Debian/debian/retroshare-feedreader-plugin.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/retroshare/extensions6/libFeedReader.so* diff --git a/build_scripts/Debian/debian/retroshare-nogui.install b/build_scripts/Debian/debian/retroshare-nogui.install new file mode 100644 index 000000000..5fb7e3c8d --- /dev/null +++ b/build_scripts/Debian/debian/retroshare-nogui.install @@ -0,0 +1,3 @@ +debian/tmp/usr/bin/retroshare-nogui +debian/tmp/usr/share/retroshare/bdboot.txt +debian/tmp/usr/share/retroshare/webui/* diff --git a/build_scripts/Debian/debian/retroshare-voip-plugin.install b/build_scripts/Debian/debian/retroshare-voip-plugin.install new file mode 100644 index 000000000..48f8bdbab --- /dev/null +++ b/build_scripts/Debian/debian/retroshare-voip-plugin.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/retroshare/extensions6/libVOIP.so* diff --git a/build_scripts/Debian/debian/retroshare.install b/build_scripts/Debian/debian/retroshare.install new file mode 100644 index 000000000..e8bfb8315 --- /dev/null +++ b/build_scripts/Debian/debian/retroshare.install @@ -0,0 +1,6 @@ +debian/tmp/usr/bin/retroshare +debian/tmp/usr/bin/retroshare-nogui +debian/tmp/usr/share/applications/retroshare.desktop +debian/tmp/usr/share/icons/hicolor/* +debian/tmp/usr/share/pixmaps/retroshare.xpm +debian/tmp/usr/share/retroshare/* diff --git a/build_scripts/Debian/debian/retrotor.install b/build_scripts/Debian/debian/retrotor.install new file mode 100644 index 000000000..2a81067cd --- /dev/null +++ b/build_scripts/Debian/debian/retrotor.install @@ -0,0 +1,5 @@ +debian/tmp/usr/bin/retroshare +debian/tmp/usr/share/applications/retroshare.desktop +debian/tmp/usr/share/icons/hicolor/* +debian/tmp/usr/share/pixmaps/retroshare.xpm +debian/tmp/usr/share/retroshare/* diff --git a/build_scripts/Debian/debian/rules b/build_scripts/Debian/debian/rules new file mode 100755 index 000000000..67b3e334e --- /dev/null +++ b/build_scripts/Debian/debian/rules @@ -0,0 +1,81 @@ +#!/usr/bin/make -f + +export DH_VERBOSE = 1 + +GPKG_EXPORT_BUILDFLAGS = 1 +export DEB_BUILD_MAINT_PTIONS = hardening=+all +export QT_SELECT = qt5 + +include /usr/share/dpkg/default.mk + +MY_BUILD_DIR = _build + +%: + dh $@ --buildsystem=qmake --builddirectory=$(MY_BUILD_DIR) + +# Override dh_auto_configure in order to call qmake on the parent dir. +# We call mkdir here because of #800738. +override_dh_auto_configure: + @mkdir -p $(MY_BUILDDIR) + dh_auto_configure -- .. + +# Upstream ships with a 'history' directory containing ancient code. +# We are not interested in installing this. +override_dh_installchangelogs: + dh_installchangelogs --exclude=history + + +# configure: configure-stamp +# configure-stamp: +# dh_testdir +# cd src && qmake "CONFIG-=debug" "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=retroshare_plugins" PREFIX=/usr LIB_DIR=/usr/lib RetroShare.pro +# touch $@ +# +# +# build: build-arch build-indep +# +# build-stamp: configure-stamp +# dh_testdir +# cd src && $(MAKE) +# touch $@ +# +# build-indep: build-stamp +# +# build-arch: build-stamp +# +# clean: +# dh_testdir +# dh_testroot +# rm -f configure-stamp build-stamp +# # Add here commands to clean up after the build process. +# [ ! -f src/Makefile ] || (cd src && $(MAKE) distclean) +# dh_prep +# dh_clean +# +# install: build +# dh_testdir +# dh_testroot +# dh_prep +# dh_clean +# cd src && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/tmp install +# +# # Build architecture-independent files here. +# binary-indep: build install +# +# # Build architecture-dependent files here. +# binary-arch: build install +# dh_testdir +# dh_testroot +# dh_install --list-missing +# dh_link +# dh_strip +# dh_compress +# dh_fixperms +# dh_installdeb +# dh_shlibdeps +# dh_gencontrol +# dh_md5sums +# dh_builddeb +# +# binary: binary-indep binary-arch +# .PHONY: build clean binary-indep binary-arch binary install configure diff --git a/build_scripts/Debian/debian/source/format b/build_scripts/Debian/debian/source/format new file mode 100644 index 000000000..d3827e75a --- /dev/null +++ b/build_scripts/Debian/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/build_scripts/Debian/debian_release_howto.txt b/build_scripts/Debian/debian_release_howto.txt new file mode 100644 index 000000000..db9f8d9bf --- /dev/null +++ b/build_scripts/Debian/debian_release_howto.txt @@ -0,0 +1,49 @@ +Creation of a new Debian changelog: + + dch --create --package retroshare --newversion 0.6.4-1 + + Note: dch reads email in $DEBMAIL or $USER@$HOSTNAME, so it should be made correct in debian/changlog + If the email does not match the email in mentors, the package will be rejected. + +dget command to retrieve source package: + + dget -u https://launchpad.net/~retroshare/+archive/ubuntu/stable/+files/retroshare_0.6.4-1.20180313.0e6d27ad~xenial.dsc + + (-u means don't check PGP signature) + +When ready: + * updload the package in a place that can be used to dget the package on mentors.debian.net. + + dput mentors retroshare_0.6.4-1_source.changes + +Checking with lintian: + lintian -EI --pedantic --profile debian retroshare_0.6.4-1_source.changes + echo -e 'display-info=y\ndisplay-experimental=y\npedantic=y\ncolor=auto' > ~/.config/lintian/lintianrc + + Also apply lintian to binaries + * fix overlinking in voip plugin + +Turn the RFP bug into ITP + you have to send an e-mail to control@bugs.debian.org and use the "retitle" command + [05/13/2018] successfully retitled. The mail *body* (instead of subject) needs to contain the command in a single line. + +Todo + x make a sid binary package. + * test in sid using pbuilder chroot system (pbuilder login) + x upload to mentors + x request for sponsorship + * + +Getting help: + https://webchat.oftc.net/ + +Bug creation/report + reportbug -B debian + +Re-do debian/rules according to + https://sources.debian.org/src/sleepyhead/1.0.0-beta-2+dfsg-5/debian/rules/ + the proper way to use qtchooser in d/rules is exporting QT_SELECT in d/rules, see https://pkg-kde.alioth.debian.org/packagingqtbasedstuff.html + disable autologin + +Put the package on salsa: + salsa.debian.org diff --git a/build_scripts/Debian/makeSourcePackage.sh b/build_scripts/Debian/makeSourcePackage.sh new file mode 100755 index 000000000..2817cef07 --- /dev/null +++ b/build_scripts/Debian/makeSourcePackage.sh @@ -0,0 +1,151 @@ +#!/bin/sh + +###################### PARAMETERS #################### +gitpath="https://github.com/RetroShare/RetroShare.git" +#branch="master" +branch="v0.6.4-official_release" +#bubba3="Y" # comment out to compile for bubba3 +###################################################### + +RS_MAJOR_VERSION=`fgrep RS_MAJOR_VERSION ../../libretroshare/src/retroshare/rsversion.h | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1` +RS_MINOR_VERSION=`fgrep RS_MINOR_VERSION ../../libretroshare/src/retroshare/rsversion.h | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1` +RS_BUILD_NUMBER=`fgrep RS_BUILD_NUMBER ../../libretroshare/src/retroshare/rsversion.h | grep -v BUILD_NUMBER_ADD | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1` + +# echo "RS_MAJOR_VERSION="${RS_MAJOR_VERSION} +# echo "RS_MINOR_VERSION="${RS_MINOR_VERSION} +# echo "RS_BUILD_NUMBER="${RS_BUILD_NUMBER} + +version_number="${RS_MAJOR_VERSION}"'.'"${RS_MINOR_VERSION}"'.'"${RS_BUILD_NUMBER}" +workdir=retroshare-${version_number} + +echo This script is going to build the debian source package for RetroShare, from the Git repository. + +if test -d "${workdir}" ; then + echo Removing the ${workdir} directory... + rm -rf ${workdir} +fi + +# Parse options +rev="" +dist="" +# This is the key for "Cyril Soler " +gpgkey="0932399B" + +date=`git log --pretty=format:"%ai" | head -1 | cut -d\ -f1 | sed -e s/-//g` +time=`git log --pretty=format:"%aD" | head -1 | cut -d\ -f5 | sed -e s/://g` +hhsh=`git log --pretty=format:"%H" | head -1 | cut -c1-8` + +rev=${date}.${hhsh} +useretrotor="false" + +while [ ${#} -gt 0 ]; do + case ${1} in + "-rev") shift + rev=${1} + shift + ;; + "-key") shift + gpgkey=${1} + shift + ;; + "-makeorig") + makeorig=yes + shift + ;; + "-h") shift + echo Package building script for debian/ubuntu distributions + echo Usage: + echo " "${0} '-key [PGP key id] -rev [svn revision number] -distribution [distrib name list with quotes, in (wheezy, sid, precise, saucy, etc)]' + exit 1 + ;; + "*") echo "Unknown option" + exit 1 + ;; + esac +done + +echo Attempting to get revision number... +ccount=`git rev-list --count --all` +ccount=`expr $ccount + 8613 - 8267` + +echo " Workdir :"${workdir} +echo " Version :"${version_number} +echo " Using revision :"${rev} +echo " Commit count :"${ccount} +echo " Hash :"${hhsh} +echo " Date :"${date} +echo " Time :"${time} +echo " Using branch :"${branch} +echo " Using PGP key id :"${gpgkey} + +if test ${useretrotor} = "true"; then + echo " "Specific flags : retrotor +fi + +echo Done. +version="${version_number}"."${rev}" +echo Got version number ${version} +echo +echo Please check that the changelog is up to date. +echo Hit ENTER if this is correct. Otherwise hit Ctrl+C +read tmp + +echo Extracting base archive... + +if ! test "${makeorig}" = "yes" ; then + if ! test -f retroshare_${version}.orig.tar.gz; then + echo Error: no orig file found. Please call with -makeorig option first + exit + fi +fi + + +mkdir -p ${workdir}/src +echo Checking out latest snapshot... +cd ${workdir}/src +git clone --depth 1 ${gitpath} --single-branch --branch $branch . + +cd - + +if ! test -d ${workdir}/src/libretroshare/; then + echo Git clone failed. + exit +fi + +cp -r debian ${workdir}/debian + +# VOIP tweak +cp ${workdir}/src/retroshare-gui/src/gui/chat/PopupChatDialog.ui ${workdir}/src/plugins/VOIP/gui/PopupChatDialog.ui + +# remove unised qml code, only needed on Android + +rm -rf ${workdir}/src/retroshare-qml-app/ +rm -rf ${workdir}/src/build_scripts/ +rm ${workdir}/debian/*~ + +# Cloning sqlcipher +# git clone https://github.com/sqlcipher/sqlcipher.git + +cd ${workdir} +echo Setting version numbers... + +# setup version numbers +sed -e "s%RS_REVISION_NUMBER.*%RS_REVISION_NUMBER 0x${hhsh}%" src/libretroshare/src/retroshare/rsversion.in > src/libretroshare/src/retroshare/rsversion.h + +# Various cleaning +echo Cleaning... + +\rm -rf src/.git + +if test "${makeorig}" = "yes" ; then + echo making orig archive + cd - + tar zcvf retroshare_${version_number}.orig.tar.gz ${workdir} + exit +fi + +echo Calling debuild... +debuild -S -k${gpgkey} --lintian-opts +pedantic -EviIL +cd - + +exit 0 From 83e198260b41a7234ff79425c09020824a4a2ff4 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 16 May 2018 21:24:19 +0200 Subject: [PATCH 040/213] switch to dh for debian packaging --- build_scripts/Debian/debian/rules | 66 ++---------------- build_scripts/Debian/makeSourcePackage.sh | 85 +++++++++++++---------- 2 files changed, 53 insertions(+), 98 deletions(-) diff --git a/build_scripts/Debian/debian/rules b/build_scripts/Debian/debian/rules index 67b3e334e..1068923eb 100755 --- a/build_scripts/Debian/debian/rules +++ b/build_scripts/Debian/debian/rules @@ -2,22 +2,22 @@ export DH_VERBOSE = 1 -GPKG_EXPORT_BUILDFLAGS = 1 +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk + export DEB_BUILD_MAINT_PTIONS = hardening=+all export QT_SELECT = qt5 -include /usr/share/dpkg/default.mk - -MY_BUILD_DIR = _build +MY_BUILDDIR = _build %: - dh $@ --buildsystem=qmake --builddirectory=$(MY_BUILD_DIR) + dh $@ --buildsystem=qmake --builddirectory=$(MY_BUILDDIR) # Override dh_auto_configure in order to call qmake on the parent dir. # We call mkdir here because of #800738. override_dh_auto_configure: @mkdir -p $(MY_BUILDDIR) - dh_auto_configure -- .. + dh_auto_configure -- ../src # Upstream ships with a 'history' directory containing ancient code. # We are not interested in installing this. @@ -25,57 +25,3 @@ override_dh_installchangelogs: dh_installchangelogs --exclude=history -# configure: configure-stamp -# configure-stamp: -# dh_testdir -# cd src && qmake "CONFIG-=debug" "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=retroshare_plugins" PREFIX=/usr LIB_DIR=/usr/lib RetroShare.pro -# touch $@ -# -# -# build: build-arch build-indep -# -# build-stamp: configure-stamp -# dh_testdir -# cd src && $(MAKE) -# touch $@ -# -# build-indep: build-stamp -# -# build-arch: build-stamp -# -# clean: -# dh_testdir -# dh_testroot -# rm -f configure-stamp build-stamp -# # Add here commands to clean up after the build process. -# [ ! -f src/Makefile ] || (cd src && $(MAKE) distclean) -# dh_prep -# dh_clean -# -# install: build -# dh_testdir -# dh_testroot -# dh_prep -# dh_clean -# cd src && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/tmp install -# -# # Build architecture-independent files here. -# binary-indep: build install -# -# # Build architecture-dependent files here. -# binary-arch: build install -# dh_testdir -# dh_testroot -# dh_install --list-missing -# dh_link -# dh_strip -# dh_compress -# dh_fixperms -# dh_installdeb -# dh_shlibdeps -# dh_gencontrol -# dh_md5sums -# dh_builddeb -# -# binary: binary-indep binary-arch -# .PHONY: build clean binary-indep binary-arch binary install configure diff --git a/build_scripts/Debian/makeSourcePackage.sh b/build_scripts/Debian/makeSourcePackage.sh index 2817cef07..c62914cf5 100755 --- a/build_scripts/Debian/makeSourcePackage.sh +++ b/build_scripts/Debian/makeSourcePackage.sh @@ -48,6 +48,10 @@ while [ ${#} -gt 0 ]; do gpgkey=${1} shift ;; + "-nodl") + nodl=yes + shift + ;; "-makeorig") makeorig=yes shift @@ -93,58 +97,63 @@ read tmp echo Extracting base archive... if ! test "${makeorig}" = "yes" ; then - if ! test -f retroshare_${version}.orig.tar.gz; then + if ! test -f retroshare_${version_number}.orig.tar.gz; then echo Error: no orig file found. Please call with -makeorig option first exit fi fi +if ! test "${nodl}" = "yes"; then + mkdir -p ${workdir}/src + echo Checking out latest snapshot... + cd ${workdir}/src + git clone --depth 1 ${gitpath} --single-branch --branch $branch . + + cd - -mkdir -p ${workdir}/src -echo Checking out latest snapshot... -cd ${workdir}/src -git clone --depth 1 ${gitpath} --single-branch --branch $branch . + if ! test -d ${workdir}/src/libretroshare/; then + echo Git clone failed. + exit + fi -cd - + cp -r debian ${workdir}/debian -if ! test -d ${workdir}/src/libretroshare/; then - echo Git clone failed. - exit + # VOIP tweak + cp ${workdir}/src/retroshare-gui/src/gui/chat/PopupChatDialog.ui ${workdir}/src/plugins/VOIP/gui/PopupChatDialog.ui + + # remove unised qml code, only needed on Android + rm -rf ${workdir}/src/retroshare-qml-app/ + rm -rf ${workdir}/src/build_scripts/ + rm ${workdir}/debian/*~ + + cd ${workdir} + echo Setting version numbers... + + # setup version numbers + sed -e "s%RS_REVISION_NUMBER.*%RS_REVISION_NUMBER 0x${hhsh}%" src/libretroshare/src/retroshare/rsversion.in > src/libretroshare/src/retroshare/rsversion.h + + # Various cleaning + echo Cleaning... + + \rm -rf src/.git + + if test "${makeorig}" = "yes" ; then + echo making orig archive + cd - + tar zcvf retroshare_${version_number}.orig.tar.gz ${workdir} + exit + fi + + cd - +else + tar zxvf retroshare_${version_number}.orig.tar.gz fi -cp -r debian ${workdir}/debian - -# VOIP tweak -cp ${workdir}/src/retroshare-gui/src/gui/chat/PopupChatDialog.ui ${workdir}/src/plugins/VOIP/gui/PopupChatDialog.ui - -# remove unised qml code, only needed on Android - -rm -rf ${workdir}/src/retroshare-qml-app/ -rm -rf ${workdir}/src/build_scripts/ -rm ${workdir}/debian/*~ - # Cloning sqlcipher # git clone https://github.com/sqlcipher/sqlcipher.git -cd ${workdir} -echo Setting version numbers... - -# setup version numbers -sed -e "s%RS_REVISION_NUMBER.*%RS_REVISION_NUMBER 0x${hhsh}%" src/libretroshare/src/retroshare/rsversion.in > src/libretroshare/src/retroshare/rsversion.h - -# Various cleaning -echo Cleaning... - -\rm -rf src/.git - -if test "${makeorig}" = "yes" ; then - echo making orig archive - cd - - tar zcvf retroshare_${version_number}.orig.tar.gz ${workdir} - exit -fi - echo Calling debuild... +cd ${workdir} debuild -S -k${gpgkey} --lintian-opts +pedantic -EviIL cd - From ddf98a52ca7611bf7d0a397ed5da06195e9fa202 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 17 May 2018 22:43:49 +0200 Subject: [PATCH 041/213] fixed compilation in debian/rules --- build_scripts/Debian/debian/rules | 4 ++-- build_scripts/Debian/makeSourcePackage.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build_scripts/Debian/debian/rules b/build_scripts/Debian/debian/rules index 1068923eb..cb95b1d68 100755 --- a/build_scripts/Debian/debian/rules +++ b/build_scripts/Debian/debian/rules @@ -5,7 +5,7 @@ export DH_VERBOSE = 1 DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/default.mk -export DEB_BUILD_MAINT_PTIONS = hardening=+all +#export DEB_BUILD_MAINT_PTIONS = hardening=+all export QT_SELECT = qt5 MY_BUILDDIR = _build @@ -17,7 +17,7 @@ MY_BUILDDIR = _build # We call mkdir here because of #800738. override_dh_auto_configure: @mkdir -p $(MY_BUILDDIR) - dh_auto_configure -- ../src + dh_auto_configure -- CONFIG="release retroshare_plugins rs_autologin" PREFIX=/usr LIB_DIR=/usr/lib ../src # Upstream ships with a 'history' directory containing ancient code. # We are not interested in installing this. diff --git a/build_scripts/Debian/makeSourcePackage.sh b/build_scripts/Debian/makeSourcePackage.sh index c62914cf5..87508924a 100755 --- a/build_scripts/Debian/makeSourcePackage.sh +++ b/build_scripts/Debian/makeSourcePackage.sh @@ -125,6 +125,7 @@ if ! test "${nodl}" = "yes"; then rm -rf ${workdir}/src/retroshare-qml-app/ rm -rf ${workdir}/src/build_scripts/ rm ${workdir}/debian/*~ + rm ${workdir}/debian/.*.sw? cd ${workdir} echo Setting version numbers... @@ -147,6 +148,10 @@ if ! test "${nodl}" = "yes"; then cd - else tar zxvf retroshare_${version_number}.orig.tar.gz + + cp -r debian/* ${workdir}/debian/ + rm ${workdir}/debian/*~ + rm ${workdir}/debian/.*.sw? fi # Cloning sqlcipher From 5fb6005ee41e8ae1d8b3fc85613fcc6fd50ff1c2 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 19 May 2018 11:32:16 +0200 Subject: [PATCH 042/213] fixed debian/rules file --- build_scripts/Debian/debian/rules | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/build_scripts/Debian/debian/rules b/build_scripts/Debian/debian/rules index cb95b1d68..8b4fe6b6d 100755 --- a/build_scripts/Debian/debian/rules +++ b/build_scripts/Debian/debian/rules @@ -3,6 +3,8 @@ export DH_VERBOSE = 1 DPKG_EXPORT_BUILDFLAGS = 1 +DEB_BUILD_OPTIONS=noddebs + include /usr/share/dpkg/default.mk #export DEB_BUILD_MAINT_PTIONS = hardening=+all @@ -11,17 +13,13 @@ export QT_SELECT = qt5 MY_BUILDDIR = _build %: - dh $@ --buildsystem=qmake --builddirectory=$(MY_BUILDDIR) + dh $@ --parallel --buildsystem=qmake --builddirectory=$(MY_BUILDDIR) + +# Override dh_auto_configure in order to call qmake on the parent dir. We call mkdir here because of #800738. -# Override dh_auto_configure in order to call qmake on the parent dir. -# We call mkdir here because of #800738. override_dh_auto_configure: @mkdir -p $(MY_BUILDDIR) - dh_auto_configure -- CONFIG="release retroshare_plugins rs_autologin" PREFIX=/usr LIB_DIR=/usr/lib ../src - -# Upstream ships with a 'history' directory containing ancient code. -# We are not interested in installing this. -override_dh_installchangelogs: - dh_installchangelogs --exclude=history + dh_auto_configure -- CONFIG="unix release retroshare_plugins rs_autologin" PREFIX=/usr LIB_DIR=/usr/lib ../src + From d7340fe400fc8e5645d49bdf0278d2d463548d89 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 19 May 2018 13:08:46 +0200 Subject: [PATCH 043/213] fixed copyright file --- build_scripts/Debian/debian/copyright | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright index 84b7e4a7f..86b489954 100644 --- a/build_scripts/Debian/debian/copyright +++ b/build_scripts/Debian/debian/copyright @@ -1,20 +1,19 @@ This package was debianized by: - Cyril Soler on Sat, 06 Feb 2010 07:15:46 +0100 + Cyril Soler on Sat, 19 May 2018 20:15:46 +0100 It was downloaded from: - + Upstream Author(s): - - + Cyril Soler + Robert Fernie Copyright: - - + Copyright (C) 2018 Retroshare Team License: @@ -36,9 +35,8 @@ Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. The Debian packaging is: - Copyright (C) 2010 Cyril Soler + Cyril Soler on Sat, 19 May 2018 20:15:46 +0100 and is licensed under the GPL version 3, see above. -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. + From f10a24dbbd84cd1696f86ebdd78ab6ba1ef34cfa Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 19 May 2018 22:03:31 +0200 Subject: [PATCH 044/213] fixed bugs in control and copyright --- build_scripts/Debian/debian/control | 12 ++-- build_scripts/Debian/debian/copyright | 86 +++++++++++++---------- build_scripts/Debian/makeSourcePackage.sh | 20 ++++-- 3 files changed, 72 insertions(+), 46 deletions(-) diff --git a/build_scripts/Debian/debian/control b/build_scripts/Debian/debian/control index ccf757edb..78c1ad740 100644 --- a/build_scripts/Debian/debian/control +++ b/build_scripts/Debian/debian/control @@ -11,9 +11,10 @@ Architecture: any Conflicts: Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5 Description: RetroShare VOIP plugin - This package provides a plugin for RetroShare, a secured Friend-to-Friend communication - plateform. The plugin adds voice-over-IP functionality to the private chat window. Both - friends chatting together need the plugin installed to be able to talk together. + This package provides a plugin for RetroShare, a secured Friend-to-Friend + communication plateform. The plugin adds voice-over-IP functionality to the + private chat window. Both friends chatting together need the plugin installed + to be able to talk together. Package: retroshare-feedreader-plugin Architecture: any @@ -35,7 +36,8 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring Conflicts: retroshare-nogui Description: Secure communication with friends RetroShare is a Open Source, private and secure decentralised - commmunication platform. It creates mesh of computers linked with TLS connections, - on top of which it provides file transfer, asynchronous email, forums, channels and chat. + commmunication platform. It creates mesh of computers linked with TLS + connections, on top of which it provides file transfer, asynchronous email, + forums, channels and chat. diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright index 86b489954..4b89afc5e 100644 --- a/build_scripts/Debian/debian/copyright +++ b/build_scripts/Debian/debian/copyright @@ -1,42 +1,54 @@ -This package was debianized by: +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: retroshare +Source: https://github.com/retroshare/retroshare - Cyril Soler on Sat, 19 May 2018 20:15:46 +0100 +Files: * -It was downloaded from: +Upstream Author(s): + Cyril Soler + Robert Fernie - - -Upstream Author(s): - - Cyril Soler - Robert Fernie - -Copyright: - - Copyright (C) 2018 Retroshare Team - -License: - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This package 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -On Debian systems, the complete text of the GNU General -Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. - -The Debian packaging is: - - Cyril Soler on Sat, 19 May 2018 20:15:46 +0100 - -and is licensed under the GPL version 3, see above. +Upstream-Contact: retroshare.team@gmail.com +Copyright: Copyright 2007-2018 Retroshare Team All rights reserved. +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + . + This program 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 General Public License for more details. + . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + . + See /usr/share/common-licenses/GPL-2 on your Debian system. + . + In addition to these license terms, the author grants the following + additional rights: + . + If you modify this program, or any covered work, by linking or + combining it with the OpenSSL project's OpenSSL library (or a + modified version of that library), containing parts covered by the + terms of the OpenSSL or SSLeay licenses, the author + grants you additional permission to convey the resulting work. + Corresponding Source for a non-source form of such a combination + shall include the source code for the parts of OpenSSL used as well + as that of the covered work. + . + You may at your option choose to remove this additional permission from + the work, or from any part of it. + . + It is possible to build this program in a way that it loads OpenSSL + libraries at run-time. If doing so, the following notices are required + by the OpenSSL and SSLeay licenses: + . + This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/) + . + This product includes cryptographic software written by Eric Young + (eay@cryptsoft.com) diff --git a/build_scripts/Debian/makeSourcePackage.sh b/build_scripts/Debian/makeSourcePackage.sh index 87508924a..273030f48 100755 --- a/build_scripts/Debian/makeSourcePackage.sh +++ b/build_scripts/Debian/makeSourcePackage.sh @@ -124,8 +124,13 @@ if ! test "${nodl}" = "yes"; then # remove unised qml code, only needed on Android rm -rf ${workdir}/src/retroshare-qml-app/ rm -rf ${workdir}/src/build_scripts/ - rm ${workdir}/debian/*~ - rm ${workdir}/debian/.*.sw? + rm -f ${workdir}/debian/*~ + rm -f ${workdir}/debian/.*.sw? + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble_Compact/private/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/src/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/public/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/"history"/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/private/images.sh cd ${workdir} echo Setting version numbers... @@ -150,8 +155,15 @@ else tar zxvf retroshare_${version_number}.orig.tar.gz cp -r debian/* ${workdir}/debian/ - rm ${workdir}/debian/*~ - rm ${workdir}/debian/.*.sw? + rm -rf ${workdir}/src/retroshare-qml-app/ + rm -rf ${workdir}/src/build_scripts/ + rm -f ${workdir}/debian/*~ + rm -f ${workdir}/debian/.*.sw? + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble_Compact/private/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/src/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/public/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/"history"/images.sh + rm -f ${workdir}/src/retroshare-gui/src/gui/qss/chat/Bubble/private/images.sh fi # Cloning sqlcipher From 926200098e0caa12844597daa421deccd10efd4c Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 20 May 2018 00:46:39 +0200 Subject: [PATCH 045/213] fixed copyright --- build_scripts/Debian/debian/copyright | 4 ---- build_scripts/Debian/debian_release_howto.txt | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright index 4b89afc5e..3c6b5e98f 100644 --- a/build_scripts/Debian/debian/copyright +++ b/build_scripts/Debian/debian/copyright @@ -4,10 +4,6 @@ Source: https://github.com/retroshare/retroshare Files: * -Upstream Author(s): - Cyril Soler - Robert Fernie - Upstream-Contact: retroshare.team@gmail.com Copyright: Copyright 2007-2018 Retroshare Team All rights reserved. diff --git a/build_scripts/Debian/debian_release_howto.txt b/build_scripts/Debian/debian_release_howto.txt index db9f8d9bf..2bf578fb9 100644 --- a/build_scripts/Debian/debian_release_howto.txt +++ b/build_scripts/Debian/debian_release_howto.txt @@ -46,4 +46,18 @@ Re-do debian/rules according to disable autologin Put the package on salsa: - salsa.debian.org + salsa.debian.org + +Debian binary changes file signature: + gpg --clearsign -u 0932399B retroshare_0.6.4-1_amd64.changes + + Signature does only work when done with debsign: + debsign -k0932399B retroshare_0.6.4-1.dsc + debsign -k0932399B retroshare_0.6.4-1_source.changes + debsign -k0932399B retroshare_0.6.4-1_amd64.changes + +Uploading-to-mentors bug: + Apparently the system prevents you from uploading while a package is in the + queue. So the upload responds "403 forbidden" whene e.g. the previous + upload was cancelled by ^C. + From 1411a56ce999c8ddcebf512be97f859758b9a985 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 20 May 2018 09:59:33 +0200 Subject: [PATCH 046/213] fixed a few errors reported by lintian --- build_scripts/Debian/debian/control | 12 ++++-------- build_scripts/Debian/debian/copyright | 10 +++++----- build_scripts/Debian/debian/rules | 5 ++--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/build_scripts/Debian/debian/control b/build_scripts/Debian/debian/control index 78c1ad740..42646702d 100644 --- a/build_scripts/Debian/debian/control +++ b/build_scripts/Debian/debian/control @@ -2,15 +2,14 @@ Source: retroshare Section: devel Priority: optional Maintainer: Cyril Soler -Build-Depends: debhelper (>= 9), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qtbase5-dev, qt5-qmake, qtbase5-dev-tools +Build-Depends: debhelper (>= 10), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qtbase5-dev, qt5-qmake, qtbase5-dev-tools Standards-Version: 4.1.4 Homepage: http://retroshare.sourceforge.net Package: retroshare-voip-plugin Architecture: any -Conflicts: Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5 -Description: RetroShare VOIP plugin +Description: VOIP plugin for the Retroshare communication platform This package provides a plugin for RetroShare, a secured Friend-to-Friend communication plateform. The plugin adds voice-over-IP functionality to the private chat window. Both friends chatting together need the plugin installed @@ -18,16 +17,15 @@ Description: RetroShare VOIP plugin Package: retroshare-feedreader-plugin Architecture: any -Conflicts: Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare -Description: RetroShare FeedReader plugin +Description: FeedReader plugin for the Retroshare communication platform Plugin for Retroshare, adding a RSS feed reader tab to retroshare. Package: retroshare-nogui Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring Conflicts: retroshare -Description: headless version of Retroshare +Description: headless version of Retroshare software Headless version of the Retroshare platform. Package: retroshare @@ -39,5 +37,3 @@ Description: Secure communication with friends commmunication platform. It creates mesh of computers linked with TLS connections, on top of which it provides file transfer, asynchronous email, forums, channels and chat. - - diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright index 3c6b5e98f..74eed3147 100644 --- a/build_scripts/Debian/debian/copyright +++ b/build_scripts/Debian/debian/copyright @@ -1,11 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: retroshare -Source: https://github.com/retroshare/retroshare - -Files: * - Upstream-Contact: retroshare.team@gmail.com -Copyright: Copyright 2007-2018 Retroshare Team All rights reserved. +Source: https://github.com/retroshare/retroshare License: GPL-2+ This program is free software; you can redistribute it and/or modify @@ -48,3 +44,7 @@ License: GPL-2+ This product includes cryptographic software written by Eric Young (eay@cryptsoft.com) +Copyright: Copyright 2007-2018 Retroshare Team All rights reserved. + +Files: * + diff --git a/build_scripts/Debian/debian/rules b/build_scripts/Debian/debian/rules index 8b4fe6b6d..f40a23ed3 100755 --- a/build_scripts/Debian/debian/rules +++ b/build_scripts/Debian/debian/rules @@ -3,6 +3,8 @@ export DH_VERBOSE = 1 DPKG_EXPORT_BUILDFLAGS = 1 + +# skip *-dbgsym packages DEB_BUILD_OPTIONS=noddebs include /usr/share/dpkg/default.mk @@ -20,6 +22,3 @@ MY_BUILDDIR = _build override_dh_auto_configure: @mkdir -p $(MY_BUILDDIR) dh_auto_configure -- CONFIG="unix release retroshare_plugins rs_autologin" PREFIX=/usr LIB_DIR=/usr/lib ../src - - - From b34449bfab4075bff3e8c00cf73c641a05383d55 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 20 May 2018 14:39:29 +0200 Subject: [PATCH 047/213] fixed copyright + rules --- build_scripts/Debian/debian/copyright | 5 ++--- build_scripts/Debian/debian/rules | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build_scripts/Debian/debian/copyright b/build_scripts/Debian/debian/copyright index 74eed3147..e230e1ad4 100644 --- a/build_scripts/Debian/debian/copyright +++ b/build_scripts/Debian/debian/copyright @@ -3,6 +3,8 @@ Upstream-Name: retroshare Upstream-Contact: retroshare.team@gmail.com Source: https://github.com/retroshare/retroshare +Files: * +Copyright: Copyright 2007-2018, Retroshare Team License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as @@ -44,7 +46,4 @@ License: GPL-2+ This product includes cryptographic software written by Eric Young (eay@cryptsoft.com) -Copyright: Copyright 2007-2018 Retroshare Team All rights reserved. - -Files: * diff --git a/build_scripts/Debian/debian/rules b/build_scripts/Debian/debian/rules index f40a23ed3..28e804a5f 100755 --- a/build_scripts/Debian/debian/rules +++ b/build_scripts/Debian/debian/rules @@ -15,7 +15,7 @@ export QT_SELECT = qt5 MY_BUILDDIR = _build %: - dh $@ --parallel --buildsystem=qmake --builddirectory=$(MY_BUILDDIR) + dh $@ --buildsystem=qmake --builddirectory=$(MY_BUILDDIR) # Override dh_auto_configure in order to call qmake on the parent dir. We call mkdir here because of #800738. From ea76e577677c5b917bdc773ae7b496fa19535744 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 20 May 2018 22:34:54 +0200 Subject: [PATCH 048/213] notes about licenses --- build_scripts/Debian/debian_release_howto.txt | 79 ++++++++++++++++++- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/build_scripts/Debian/debian_release_howto.txt b/build_scripts/Debian/debian_release_howto.txt index 2bf578fb9..28fd414bc 100644 --- a/build_scripts/Debian/debian_release_howto.txt +++ b/build_scripts/Debian/debian_release_howto.txt @@ -51,13 +51,84 @@ Put the package on salsa: Debian binary changes file signature: gpg --clearsign -u 0932399B retroshare_0.6.4-1_amd64.changes - Signature does only work when done with debsign: + Signature does only work when done with debsign: debsign -k0932399B retroshare_0.6.4-1.dsc debsign -k0932399B retroshare_0.6.4-1_source.changes debsign -k0932399B retroshare_0.6.4-1_amd64.changes Uploading-to-mentors bug: - Apparently the system prevents you from uploading while a package is in the - queue. So the upload responds "403 forbidden" whene e.g. the previous - upload was cancelled by ^C. + Apparently the system prevents you from uploading while a package is in the + queue. So the upload responds "403 forbidden" whene e.g. the previous + upload was cancelled by ^C. + +Licensing issues: + Various licenses involved: + + Code part | Licenses | Authors | Comment + --------------------------------+--------------------------+----------------------------------------------+------------------------------------------------- + libbitdht | GPLv3 | drbob, csoler, Retroshare team | + bitdht/bencode.h | Public domain | Mike Frysinger | + bitdht/bdrandom.h | GPLv2 | csoler | + --------------------------------+--------------------------+----------------------------------------------+------------------------------------------------- + libresapi | GPLv3 | G10H4ck, [], electron128 | Most files are unlicenced + libretroshare | GPLv2,GPLv3 | csoler,drbob,Mr-alice,Chris,Thunder | Some files unversionned. + plugins/dlfcn_win32.cc | GPLv2.1 | Ramiro Polla | + pqi/authgpg.h | GPLv2 | Raghu Dev R. | .cc is authed by drbob + upnp/UPnPBase.h | GPLv2 | Marcelo Roberto Jimenez, aMule Team | other code in upnp/ not copyrighted + util/pugiconfig.h | MIT | Arseny Kapoulkyne | [unused file!] + util/rsstring.h | GPLv2 | Thomas Kister | + util/rswin.h | GPLv2 | Thomas Kister | + util/rsversioninfo.h | [none] | Alexandrut | + util/stacktrace.h | GPLv2 | Timo Bingmann, G10H4ck | + librssimulator | [None] | No authors | + openpgpsdk | Apache | Rachell Wilmer, Ben Laurie | + pegmarkdown | All right reserved | Daniel Jalkut - Code currently unused | + plugins/feedreader | GPLv2 | Thunder | + plugins/VOIP | | | + AudioInputConfig.h+ | All right reserved | Thorvald Natvig | Code can be modified/re-used. Mumble's code. + SpeezProcessor.h | | Peter Zotov | + retroshare-android-notify-* | GPLv3 | G10H4ck | + retroshare-android-service | GPLv3 | G10H4ck | + retroshare-gui/src | | Thunder, csoler, drbob, crypton | + control/* | GPLv2 | Matt Edman, crypton, Justin Hiple | [Unused code] + common/ElideLabel.h | BSD | Qt Toolkit | + common/FlowLayout.h | BSD | Qt Toolkit | Is that really Qt code?? Qt examples can be used. + common/html.h | GPLv2 | Matt Edman, defnax, Justin Hiple | + common/rwindow.h | GPLv2 | Matt Edman, defnax, Justin Hiple | + common/vmessagebox.h | GPLv2 | Matt Edman, defnax, Justin Hiple | + common/PictureFlow | unclear | Ariya Hidayat (@kde.org) | [Unused code] + elastic/* | LGPL | Trolltech | + FileTransfer/FTIWidget | GPLv2 | defnax, lsn752 | + FileTransfer/xprogressb | GPLv2 | Xesc | + help/browser.h | GPLv2 | Matt Edman, defnax, Justin Hiple | + images/retroshare_win.rc.h | GPLv2 | crypton | [Unused code] + msgs/textformat.h | GPLv3 | Merdhah Momeny, Golnaz Nilieh | very simple .h. Can be re-implemented + settings/rsettings.h | GPLv2 | Matt Edman, defnax, Justin Hiple | + statistics/BandwidthGraphW.h| GPLv2 | Matt Edman, defnax, Justin Hiple | + statistics/dhtgraph.h | GPLv2 | Matt Edman, defnax, Justin Hiple | + toaster/MessageToaster.h | GPLv3 | Xesc | + toaster/DownloadToaster.h | GPLv3 | Xesc | + About{Widget,Dialog}.h | GPLv2 | Unipro, Russia | Very small file. + linetypes.h | GPLv2 | Merdhah Momeny, Golnaz Nilieh | very simple .h. Can be re-implemented + mainpagestack.h | GPLv2 | Matt Edman, crypton, Justin Hiple | + land/langagesupport.h | GPLv2 | Matt Edman, crypton, Justin Hiple | + util/log.h | GPLv2 | Matt Edman, crypton, Justin Hiple | + idle/idle.h | GPLv2 | Justin Karneges | May be re-implemented + TorControl/* |* Public domaine | John Brooks | Code from Ricochet.im + util/HandleRichText.h | GPLv2 | Thomas Kister | + util/misc.h | GPLv2 | defnax, Christophe Dumez | + util/printpreview.h | GPLv2 | Trolltech example | + util/retrosharewin32.h | GPLv2 | Matt Edman, crypton, Justin Hiple | + util/stringutil.h | GPLv2 | Matt Edman, crypton, Justin Hiple | + rshare.h | GPLv2 | Matt Edman, crypton, Justin Hiple | + retroshare-nogui/* | GPLv2 | drbob | + + + Plan: move to GPLv3 with OpenSSL exception + + Many files unversionned. + + Use a pointer to the top level licence file + + From 8b8eb6b597f82d2310e59bc2dd7879010c730efc Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 21 May 2018 18:23:52 +0200 Subject: [PATCH 049/213] re-licenced libbitdht to AGPLv3+ --- RetroShare.pro | 18 +++ build_scripts/Debian/debian_release_howto.txt | 121 +++++++++--------- libbitdht/src/bitdht/bdaccount.cc | 45 +++---- libbitdht/src/bitdht/bdaccount.h | 45 +++---- libbitdht/src/bitdht/bdconnection.cc | 45 +++---- libbitdht/src/bitdht/bdconnection.h | 48 ++++--- libbitdht/src/bitdht/bdfilter.cc | 47 +++---- libbitdht/src/bitdht/bdfilter.h | 52 ++++---- libbitdht/src/bitdht/bdfriendlist.cc | 46 +++---- libbitdht/src/bitdht/bdfriendlist.h | 47 ++++--- libbitdht/src/bitdht/bdhash.cc | 46 +++---- libbitdht/src/bitdht/bdhash.h | 47 ++++--- libbitdht/src/bitdht/bdhistory.cc | 21 +++ libbitdht/src/bitdht/bdhistory.h | 22 ++++ libbitdht/src/bitdht/bdiface.h | 46 +++---- libbitdht/src/bitdht/bdmanager.cc | 46 +++---- libbitdht/src/bitdht/bdmanager.h | 48 +++---- libbitdht/src/bitdht/bdmsgs.cc | 45 +++---- libbitdht/src/bitdht/bdmsgs.h | 47 +++---- libbitdht/src/bitdht/bdnode.cc | 45 +++---- libbitdht/src/bitdht/bdnode.h | 47 +++---- libbitdht/src/bitdht/bdobj.cc | 46 +++---- libbitdht/src/bitdht/bdobj.h | 47 +++---- libbitdht/src/bitdht/bdpeer.cc | 46 +++---- libbitdht/src/bitdht/bdpeer.h | 46 +++---- libbitdht/src/bitdht/bdquery.cc | 47 +++---- libbitdht/src/bitdht/bdquery.h | 47 +++---- libbitdht/src/bitdht/bdquerymgr.cc | 45 +++---- libbitdht/src/bitdht/bdquerymgr.h | 47 +++---- libbitdht/src/bitdht/bdstddht.cc | 46 +++---- libbitdht/src/bitdht/bdstddht.h | 47 +++---- libbitdht/src/bitdht/bdstore.cc | 46 +++---- libbitdht/src/bitdht/bdstore.h | 47 +++---- libbitdht/src/bitdht/bencode.c | 35 +++-- libbitdht/src/bitdht/bencode.h | 38 ++++-- libbitdht/src/libbitdht.pro | 18 +++ libbitdht/src/udp/udpbitdht.cc | 46 +++---- libbitdht/src/udp/udpbitdht.h | 47 +++---- libbitdht/src/udp/udplayer.cc | 45 +++---- libbitdht/src/udp/udplayer.h | 46 +++---- libbitdht/src/udp/udpstack.cc | 45 +++---- libbitdht/src/udp/udpstack.h | 47 +++---- libbitdht/src/use_libbitdht.pri | 18 +++ libbitdht/src/util/bdbloom.cc | 45 +++---- libbitdht/src/util/bdbloom.h | 47 +++---- libbitdht/src/util/bdfile.cc | 21 +++ libbitdht/src/util/bdfile.h | 21 +++ libbitdht/src/util/bdnet.cc | 46 +++---- libbitdht/src/util/bdnet.h | 46 +++---- libbitdht/src/util/bdrandom.cc | 21 +++ libbitdht/src/util/bdrandom.h | 46 ++++--- libbitdht/src/util/bdstring.cc | 41 +++--- libbitdht/src/util/bdstring.h | 42 +++--- libbitdht/src/util/bdthreads.cc | 47 +++---- libbitdht/src/util/bdthreads.h | 47 +++---- retroshare.pri | 18 +++ 56 files changed, 1216 insertions(+), 1188 deletions(-) diff --git a/RetroShare.pro b/RetroShare.pro index d124ce94d..d53d37a71 100644 --- a/RetroShare.pro +++ b/RetroShare.pro @@ -1,3 +1,21 @@ +################################################################################ +# Retroshare.pro # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ + !include("retroshare.pri"): error("Could not include file retroshare.pri") TEMPLATE = subdirs diff --git a/build_scripts/Debian/debian_release_howto.txt b/build_scripts/Debian/debian_release_howto.txt index 28fd414bc..a9d06e16e 100644 --- a/build_scripts/Debian/debian_release_howto.txt +++ b/build_scripts/Debian/debian_release_howto.txt @@ -65,68 +65,73 @@ Uploading-to-mentors bug: Licensing issues: Various licenses involved: - Code part | Licenses | Authors | Comment - --------------------------------+--------------------------+----------------------------------------------+------------------------------------------------- - libbitdht | GPLv3 | drbob, csoler, Retroshare team | - bitdht/bencode.h | Public domain | Mike Frysinger | - bitdht/bdrandom.h | GPLv2 | csoler | - --------------------------------+--------------------------+----------------------------------------------+------------------------------------------------- - libresapi | GPLv3 | G10H4ck, [], electron128 | Most files are unlicenced - libretroshare | GPLv2,GPLv3 | csoler,drbob,Mr-alice,Chris,Thunder | Some files unversionned. - plugins/dlfcn_win32.cc | GPLv2.1 | Ramiro Polla | - pqi/authgpg.h | GPLv2 | Raghu Dev R. | .cc is authed by drbob - upnp/UPnPBase.h | GPLv2 | Marcelo Roberto Jimenez, aMule Team | other code in upnp/ not copyrighted - util/pugiconfig.h | MIT | Arseny Kapoulkyne | [unused file!] - util/rsstring.h | GPLv2 | Thomas Kister | - util/rswin.h | GPLv2 | Thomas Kister | - util/rsversioninfo.h | [none] | Alexandrut | - util/stacktrace.h | GPLv2 | Timo Bingmann, G10H4ck | - librssimulator | [None] | No authors | - openpgpsdk | Apache | Rachell Wilmer, Ben Laurie | - pegmarkdown | All right reserved | Daniel Jalkut - Code currently unused | - plugins/feedreader | GPLv2 | Thunder | - plugins/VOIP | | | - AudioInputConfig.h+ | All right reserved | Thorvald Natvig | Code can be modified/re-used. Mumble's code. - SpeezProcessor.h | | Peter Zotov | - retroshare-android-notify-* | GPLv3 | G10H4ck | - retroshare-android-service | GPLv3 | G10H4ck | - retroshare-gui/src | | Thunder, csoler, drbob, crypton | - control/* | GPLv2 | Matt Edman, crypton, Justin Hiple | [Unused code] - common/ElideLabel.h | BSD | Qt Toolkit | - common/FlowLayout.h | BSD | Qt Toolkit | Is that really Qt code?? Qt examples can be used. - common/html.h | GPLv2 | Matt Edman, defnax, Justin Hiple | - common/rwindow.h | GPLv2 | Matt Edman, defnax, Justin Hiple | - common/vmessagebox.h | GPLv2 | Matt Edman, defnax, Justin Hiple | - common/PictureFlow | unclear | Ariya Hidayat (@kde.org) | [Unused code] - elastic/* | LGPL | Trolltech | - FileTransfer/FTIWidget | GPLv2 | defnax, lsn752 | - FileTransfer/xprogressb | GPLv2 | Xesc | - help/browser.h | GPLv2 | Matt Edman, defnax, Justin Hiple | - images/retroshare_win.rc.h | GPLv2 | crypton | [Unused code] - msgs/textformat.h | GPLv3 | Merdhah Momeny, Golnaz Nilieh | very simple .h. Can be re-implemented - settings/rsettings.h | GPLv2 | Matt Edman, defnax, Justin Hiple | - statistics/BandwidthGraphW.h| GPLv2 | Matt Edman, defnax, Justin Hiple | - statistics/dhtgraph.h | GPLv2 | Matt Edman, defnax, Justin Hiple | - toaster/MessageToaster.h | GPLv3 | Xesc | - toaster/DownloadToaster.h | GPLv3 | Xesc | - About{Widget,Dialog}.h | GPLv2 | Unipro, Russia | Very small file. - linetypes.h | GPLv2 | Merdhah Momeny, Golnaz Nilieh | very simple .h. Can be re-implemented - mainpagestack.h | GPLv2 | Matt Edman, crypton, Justin Hiple | - land/langagesupport.h | GPLv2 | Matt Edman, crypton, Justin Hiple | - util/log.h | GPLv2 | Matt Edman, crypton, Justin Hiple | - idle/idle.h | GPLv2 | Justin Karneges | May be re-implemented - TorControl/* |* Public domaine | John Brooks | Code from Ricochet.im - util/HandleRichText.h | GPLv2 | Thomas Kister | - util/misc.h | GPLv2 | defnax, Christophe Dumez | - util/printpreview.h | GPLv2 | Trolltech example | - util/retrosharewin32.h | GPLv2 | Matt Edman, crypton, Justin Hiple | - util/stringutil.h | GPLv2 | Matt Edman, crypton, Justin Hiple | - rshare.h | GPLv2 | Matt Edman, crypton, Justin Hiple | - retroshare-nogui/* | GPLv2 | drbob | + R: re-licence to GPLv3 + D: delete + + Code part | Licenses |A| Authors | Comment + --------------------------------+------------------------+-+----------------------------------------------+------------------------------------------------- + libbitdht | GPLv3 | | drbob, csoler, Retroshare team | + bitdht/bencode.h | Public domain | | Mike Frysinger | + bitdht/bdrandom.h | GPLv2 |R| csoler | + --------------------------------+------------------------+-+----------------------------------------------+------------------------------------------------- + libresapi | GPLv3 | | G10H4ck, [], electron128 | Most files are unlicenced + libretroshare | GPLv2,GPLv3 | | csoler,drbob,Mr-alice,Chris,Thunder | Some files unversionned. + plugins/dlfcn_win32.cc | GPLv2.1 |R| Ramiro Polla | + pqi/authgpg.h | GPLv2 |R| Raghu Dev R. | .cc is authed by drbob + upnp/UPnPBase.h | GPLv2 | | Marcelo Roberto Jimenez, aMule Team | other code in upnp/ not copyrighted + util/pugiconfig.h | MIT | | Arseny Kapoulkyne | [unused file!] + util/rsstring.h | GPLv2 |R| Thomas Kister | + util/rswin.h | GPLv2 |R| Thomas Kister | + util/rsversioninfo.h | [none] | | Alexandrut | + util/stacktrace.h | GPLv2 |R| Timo Bingmann, G10H4ck | + librssimulator | [None] | | No authors | + openpgpsdk | Apache | | Rachell Wilmer, Ben Laurie | + pegmarkdown | All right reserved | | Daniel Jalkut - Code currently unused | + plugins/feedreader | GPLv2 | | Thunder | + plugins/VOIP | | | | + AudioInputConfig.h+ | All right reserved | | Thorvald Natvig | Code can be modified/re-used. Mumble's code. + SpeezProcessor.h | | | Peter Zotov | + retroshare-android-notify-* | GPLv3 | | G10H4ck | + retroshare-android-service | GPLv3 | | G10H4ck | + retroshare-gui/src | | | Thunder, csoler, drbob, crypton | + control/* | GPLv2 | | Matt Edman, crypton, Justin Hiple | [Unused code] + common/ElideLabel.h | BSD | | Qt Toolkit | + common/FlowLayout.h | BSD | | Qt Toolkit | Is that really Qt code?? Qt examples can be used. + common/html.h | GPLv2 | | Matt Edman, defnax, Justin Hiple | + common/rwindow.h | GPLv2 | | Matt Edman, defnax, Justin Hiple | + common/vmessagebox.h | GPLv2 | | Matt Edman, defnax, Justin Hiple | + common/PictureFlow | unclear | | Ariya Hidayat (@kde.org) | [Unused code] + elastic/* | LGPL | | Trolltech | + FileTransfer/FTIWidget | GPLv2 | | defnax, lsn752 | + FileTransfer/xprogressb | GPLv2 | | Xesc | + help/browser.h | GPLv2 | | Matt Edman, defnax, Justin Hiple | + images/retroshare_win.rc.h | GPLv2 | | crypton | [Unused code] + msgs/textformat.h | GPLv3 | | Merdhah Momeny, Golnaz Nilieh | very simple .h. Can be re-implemented + settings/rsettings.h | GPLv2 | | Matt Edman, defnax, Justin Hiple | + statistics/BandwidthGraphW.h| GPLv2 | | Matt Edman, defnax, Justin Hiple | + statistics/dhtgraph.h | GPLv2 | | Matt Edman, defnax, Justin Hiple | + toaster/MessageToaster.h | GPLv3 | | Xesc | + toaster/DownloadToaster.h | GPLv3 | | Xesc | + About{Widget,Dialog}.h | GPLv2 | | Unipro, Russia | Very small file. + linetypes.h | GPLv2 | | Merdhah Momeny, Golnaz Nilieh | very simple .h. Can be re-implemented + mainpagestack.h | GPLv2 | | Matt Edman, crypton, Justin Hiple | + land/langagesupport.h | GPLv2 | | Matt Edman, crypton, Justin Hiple | + util/log.h | GPLv2 | | Matt Edman, crypton, Justin Hiple | + idle/idle.h | GPLv2 | | Justin Karneges | May be re-implemented + TorControl/* |* Public domaine | | John Brooks | Code from Ricochet.im + util/HandleRichText.h | GPLv2 | | Thomas Kister | + util/misc.h | GPLv2 | | defnax, Christophe Dumez | + util/printpreview.h | GPLv2 | | Trolltech example | + util/retrosharewin32.h | GPLv2 | | Matt Edman, crypton, Justin Hiple | + util/stringutil.h | GPLv2 | | Matt Edman, crypton, Justin Hiple | + rshare.h | GPLv2 | | Matt Edman, crypton, Justin Hiple | + retroshare-nogui/* | GPLv2 | | drbob | Plan: move to GPLv3 with OpenSSL exception + - Appache is compatible with GPLv3 + Many files unversionned. Use a pointer to the top level licence file diff --git a/libbitdht/src/bitdht/bdaccount.cc b/libbitdht/src/bitdht/bdaccount.cc index 6246b0241..57de177f7 100644 --- a/libbitdht/src/bitdht/bdaccount.cc +++ b/libbitdht/src/bitdht/bdaccount.cc @@ -1,27 +1,24 @@ -/* - * bitdht/bdaccount.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdaccount.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdaccount.h" diff --git a/libbitdht/src/bitdht/bdaccount.h b/libbitdht/src/bitdht/bdaccount.h index 5e9b6cc61..7116e3ced 100644 --- a/libbitdht/src/bitdht/bdaccount.h +++ b/libbitdht/src/bitdht/bdaccount.h @@ -1,30 +1,27 @@ #ifndef BITDHT_ACCOUNT_H #define BITDHT_ACCOUNT_H -/* - * bitdht/bdaccount.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdaccount.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libbitdht/src/bitdht/bdconnection.cc b/libbitdht/src/bitdht/bdconnection.cc index 90e6afa98..494e076f3 100644 --- a/libbitdht/src/bitdht/bdconnection.cc +++ b/libbitdht/src/bitdht/bdconnection.cc @@ -1,27 +1,24 @@ -/* - * bitdht/bdconnection.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdconnection.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "bitdht/bdiface.h" diff --git a/libbitdht/src/bitdht/bdconnection.h b/libbitdht/src/bitdht/bdconnection.h index 4453a0bf0..c55d95c09 100644 --- a/libbitdht/src/bitdht/bdconnection.h +++ b/libbitdht/src/bitdht/bdconnection.h @@ -1,32 +1,28 @@ +/******************************************************************************* + * bitdht/bdconnection.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #ifndef BITDHT_CONNECTION_H #define BITDHT_CONNECTION_H -/* - * bitdht/bdconnection.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include "bitdht/bdiface.h" class bdQueryManager; diff --git a/libbitdht/src/bitdht/bdfilter.cc b/libbitdht/src/bitdht/bdfilter.cc index 5be9e1178..1ba7d3aca 100644 --- a/libbitdht/src/bitdht/bdfilter.cc +++ b/libbitdht/src/bitdht/bdfilter.cc @@ -1,29 +1,24 @@ - -/* - * bitdht/bdfilter.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdfilter.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdfilter.h" #include "bitdht/bdmanager.h" diff --git a/libbitdht/src/bitdht/bdfilter.h b/libbitdht/src/bitdht/bdfilter.h index 7c1d940d3..27d32a7d4 100644 --- a/libbitdht/src/bitdht/bdfilter.h +++ b/libbitdht/src/bitdht/bdfilter.h @@ -1,36 +1,28 @@ +/******************************************************************************* + * bitdht/bdfilter.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #ifndef BITDHT_FILTER_H #define BITDHT_FILTER_H -/* - * bitdht/bdfilter.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - -/* This class is used to detect bad and filter them peers - * - */ - - #include "bitdht/bdiface.h" #include diff --git a/libbitdht/src/bitdht/bdfriendlist.cc b/libbitdht/src/bitdht/bdfriendlist.cc index 3bb258c40..487f0a75c 100644 --- a/libbitdht/src/bitdht/bdfriendlist.cc +++ b/libbitdht/src/bitdht/bdfriendlist.cc @@ -1,28 +1,24 @@ - -/* - * bitdht/bdfriendlist.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdfriendlist.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdfriendlist.h" #include "bitdht/bdstddht.h" diff --git a/libbitdht/src/bitdht/bdfriendlist.h b/libbitdht/src/bitdht/bdfriendlist.h index 35cad86bb..a58888ed8 100644 --- a/libbitdht/src/bitdht/bdfriendlist.h +++ b/libbitdht/src/bitdht/bdfriendlist.h @@ -1,31 +1,28 @@ +/******************************************************************************* + * bitdht/bdfriendlist.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #ifndef BITDHT_FRIEND_LIST_H #define BITDHT_FRIEND_LIST_H -/* - * bitdht/bdfriendlist.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ - /* * This class maintains a list of current friends and friends-of-friends. * It should also be updated when a peer's address has been identified. diff --git a/libbitdht/src/bitdht/bdhash.cc b/libbitdht/src/bitdht/bdhash.cc index 762ca5e1b..5eabd3d95 100644 --- a/libbitdht/src/bitdht/bdhash.cc +++ b/libbitdht/src/bitdht/bdhash.cc @@ -1,28 +1,24 @@ -/* - * bitdht/bdhash.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdhash.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdhash.h" #include "bitdht/bdstddht.h" diff --git a/libbitdht/src/bitdht/bdhash.h b/libbitdht/src/bitdht/bdhash.h index 10c8fd6e2..680169665 100644 --- a/libbitdht/src/bitdht/bdhash.h +++ b/libbitdht/src/bitdht/bdhash.h @@ -1,31 +1,28 @@ +/******************************************************************************* + * bitdht/bdhash.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #ifndef BITDHT_HASH_SPACE_H #define BITDHT_HASH_SPACE_H -/* - * bitdht/bdhash.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - #include "bitdht/bdpeer.h" #include diff --git a/libbitdht/src/bitdht/bdhistory.cc b/libbitdht/src/bitdht/bdhistory.cc index 434ab3333..05bb73fa0 100644 --- a/libbitdht/src/bitdht/bdhistory.cc +++ b/libbitdht/src/bitdht/bdhistory.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * bitdht/bdhistory.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdhistory.h" diff --git a/libbitdht/src/bitdht/bdhistory.h b/libbitdht/src/bitdht/bdhistory.h index 656d91413..79e420d92 100644 --- a/libbitdht/src/bitdht/bdhistory.h +++ b/libbitdht/src/bitdht/bdhistory.h @@ -1,3 +1,25 @@ +/******************************************************************************* + * bitdht/bdhistory.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #ifndef BITDHT_HISTORY_H #define BITDHT_HISTORY_H diff --git a/libbitdht/src/bitdht/bdiface.h b/libbitdht/src/bitdht/bdiface.h index f6f47126c..4e571ccdb 100644 --- a/libbitdht/src/bitdht/bdiface.h +++ b/libbitdht/src/bitdht/bdiface.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * bitdht/bdiface.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BIT_DHT_INTERFACE_H #define BIT_DHT_INTERFACE_H -/* - * bitdht/bdiface.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - #include #include #include diff --git a/libbitdht/src/bitdht/bdmanager.cc b/libbitdht/src/bitdht/bdmanager.cc index 52ac66e9a..522b0629f 100644 --- a/libbitdht/src/bitdht/bdmanager.cc +++ b/libbitdht/src/bitdht/bdmanager.cc @@ -1,28 +1,24 @@ -/* - * bitdht/bdmanager.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdmanager.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /******* * Node Manager. diff --git a/libbitdht/src/bitdht/bdmanager.h b/libbitdht/src/bitdht/bdmanager.h index c494b2bef..1a6a2cebd 100644 --- a/libbitdht/src/bitdht/bdmanager.h +++ b/libbitdht/src/bitdht/bdmanager.h @@ -1,33 +1,27 @@ +/******************************************************************************* + * bitdht/bdmanager.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_MANAGER_H #define BITDHT_MANAGER_H -/* - * bitdht/bdmanager.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - - /******* * Node Manager. ******/ diff --git a/libbitdht/src/bitdht/bdmsgs.cc b/libbitdht/src/bitdht/bdmsgs.cc index ebaccefcc..1af0c9814 100644 --- a/libbitdht/src/bitdht/bdmsgs.cc +++ b/libbitdht/src/bitdht/bdmsgs.cc @@ -1,27 +1,24 @@ -/* - * bitdht/bdmsgs.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdmsgs.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libbitdht/src/bitdht/bdmsgs.h b/libbitdht/src/bitdht/bdmsgs.h index ea7b8a3a1..99a26d76a 100644 --- a/libbitdht/src/bitdht/bdmsgs.h +++ b/libbitdht/src/bitdht/bdmsgs.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdmsgs.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_MSGS_H #define BITDHT_MSGS_H -/* - * bitdht/bdmsgs.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include #include #include diff --git a/libbitdht/src/bitdht/bdnode.cc b/libbitdht/src/bitdht/bdnode.cc index f7ae5e220..f1a13f718 100644 --- a/libbitdht/src/bitdht/bdnode.cc +++ b/libbitdht/src/bitdht/bdnode.cc @@ -1,27 +1,24 @@ -/* - * bitdht/bdnode.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010-2011 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdnode.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdnode.h" diff --git a/libbitdht/src/bitdht/bdnode.h b/libbitdht/src/bitdht/bdnode.h index 5acb1255b..ad1ffe2fb 100644 --- a/libbitdht/src/bitdht/bdnode.h +++ b/libbitdht/src/bitdht/bdnode.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdnode.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_NODE_H #define BITDHT_NODE_H -/* - * bitdht/bdnode.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include "bitdht/bdpeer.h" #include "bitdht/bdquery.h" #include "bitdht/bdstore.h" diff --git a/libbitdht/src/bitdht/bdobj.cc b/libbitdht/src/bitdht/bdobj.cc index df22686cc..9832796d2 100644 --- a/libbitdht/src/bitdht/bdobj.cc +++ b/libbitdht/src/bitdht/bdobj.cc @@ -1,28 +1,24 @@ - -/* - * bitdht/bdobj.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdobj.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdobj.h" diff --git a/libbitdht/src/bitdht/bdobj.h b/libbitdht/src/bitdht/bdobj.h index dbc8b5385..d193c59a8 100644 --- a/libbitdht/src/bitdht/bdobj.h +++ b/libbitdht/src/bitdht/bdobj.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdobj.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_OBJECTS_H #define BITDHT_OBJECTS_H -/* - * bitdht/bdobj.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #define BITDHT_TOKEN_MAX_LEN 20 #include diff --git a/libbitdht/src/bitdht/bdpeer.cc b/libbitdht/src/bitdht/bdpeer.cc index 295ca083d..65cfb31b5 100644 --- a/libbitdht/src/bitdht/bdpeer.cc +++ b/libbitdht/src/bitdht/bdpeer.cc @@ -1,28 +1,24 @@ -/* - * bitdht/bdpeer.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdpeer.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdpeer.h" #include "util/bdnet.h" diff --git a/libbitdht/src/bitdht/bdpeer.h b/libbitdht/src/bitdht/bdpeer.h index 59175c531..d663a7ecd 100644 --- a/libbitdht/src/bitdht/bdpeer.h +++ b/libbitdht/src/bitdht/bdpeer.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * bitdht/bdpeer.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_PEER_H #define BITDHT_PEER_H -/* - * bitdht/bdpeer.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - #include "bitdht/bdiface.h" #include diff --git a/libbitdht/src/bitdht/bdquery.cc b/libbitdht/src/bitdht/bdquery.cc index e93000a84..f9b77002d 100644 --- a/libbitdht/src/bitdht/bdquery.cc +++ b/libbitdht/src/bitdht/bdquery.cc @@ -1,29 +1,24 @@ - -/* - * bitdht/bdquery.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdquery.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdquery.h" #include "bitdht/bdstddht.h" diff --git a/libbitdht/src/bitdht/bdquery.h b/libbitdht/src/bitdht/bdquery.h index 2c17ae1d5..4cb08f165 100644 --- a/libbitdht/src/bitdht/bdquery.h +++ b/libbitdht/src/bitdht/bdquery.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdquery.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_QUERY_H #define BITDHT_QUERY_H -/* - * bitdht/bdquery.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include "bitdht/bdiface.h" #include "bitdht/bdpeer.h" #include "bitdht/bdobj.h" diff --git a/libbitdht/src/bitdht/bdquerymgr.cc b/libbitdht/src/bitdht/bdquerymgr.cc index d920d1283..70f58ce90 100644 --- a/libbitdht/src/bitdht/bdquerymgr.cc +++ b/libbitdht/src/bitdht/bdquerymgr.cc @@ -1,27 +1,24 @@ -/* - * bitdht/bdnode.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * bitdht/bdquerymgr.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdquerymgr.h" #include "bitdht/bdnode.h" diff --git a/libbitdht/src/bitdht/bdquerymgr.h b/libbitdht/src/bitdht/bdquerymgr.h index 042fbec41..355781244 100644 --- a/libbitdht/src/bitdht/bdquerymgr.h +++ b/libbitdht/src/bitdht/bdquerymgr.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdquerymgr.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_QUERY_MANAGER_H #define BITDHT_QUERY_MANAGER_H -/* - * bitdht/bdquerymgr.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include "bitdht/bdquery.h" class bdNodePublisher; diff --git a/libbitdht/src/bitdht/bdstddht.cc b/libbitdht/src/bitdht/bdstddht.cc index 3faa85df2..eac5c148e 100644 --- a/libbitdht/src/bitdht/bdstddht.cc +++ b/libbitdht/src/bitdht/bdstddht.cc @@ -1,28 +1,24 @@ -/* - * bitdht/bdstddht.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdstddht.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdstddht.h" #include "bitdht/bdpeer.h" diff --git a/libbitdht/src/bitdht/bdstddht.h b/libbitdht/src/bitdht/bdstddht.h index 4637cc8f2..d38c19724 100644 --- a/libbitdht/src/bitdht/bdstddht.h +++ b/libbitdht/src/bitdht/bdstddht.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdstddht.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_STANDARD_DHT_H #define BITDHT_STANDARD_DHT_H -/* - * bitdht/bdstddht.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include "bitdht/bdiface.h" #define BITDHT_STANDARD_BUCKET_SIZE 10 // 20 too many per query? diff --git a/libbitdht/src/bitdht/bdstore.cc b/libbitdht/src/bitdht/bdstore.cc index 3465d71c6..40031abac 100644 --- a/libbitdht/src/bitdht/bdstore.cc +++ b/libbitdht/src/bitdht/bdstore.cc @@ -1,28 +1,24 @@ -/* - * bitdht/bdstore.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/bdstore.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bitdht/bdstore.h" #include "util/bdnet.h" diff --git a/libbitdht/src/bitdht/bdstore.h b/libbitdht/src/bitdht/bdstore.h index 627972716..a01f5aa2c 100644 --- a/libbitdht/src/bitdht/bdstore.h +++ b/libbitdht/src/bitdht/bdstore.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * bitdht/bdstore.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_STORE_H #define BITDHT_STORE_H -/* - * bitdht/bdstore.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include #include "bitdht/bdiface.h" #include "bitdht/bdpeer.h" diff --git a/libbitdht/src/bitdht/bencode.c b/libbitdht/src/bitdht/bencode.c index b1f4c2eaf..a496f5bc3 100644 --- a/libbitdht/src/bitdht/bencode.c +++ b/libbitdht/src/bitdht/bencode.c @@ -1,16 +1,25 @@ -/* - * C implementation of a bencode decoder. - * This is the format defined by BitTorrent: - * http://wiki.theory.org/BitTorrentSpecification#bencoding - * - * The only external requirements are a few [standard] function calls and - * the long long type. Any sane system should provide all of these things. - * - * See the bencode.h header file for usage information. - * - * This is released into the public domain. - * Written by Mike Frysinger . - */ +/******************************************************************************* + * bitdht/bdencode.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * by Mike Frysinger * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* * This implementation isn't optimized at all as I wrote it to support diff --git a/libbitdht/src/bitdht/bencode.h b/libbitdht/src/bitdht/bencode.h index 211c96542..4e733b66f 100644 --- a/libbitdht/src/bitdht/bencode.h +++ b/libbitdht/src/bitdht/bencode.h @@ -1,14 +1,27 @@ -/* - * C implementation of a bencode decoder. - * This is the format defined by BitTorrent: - * http://wiki.theory.org/BitTorrentSpecification#bencoding - * - * The only external requirements are a few [standard] function calls and - * the long long type. Any sane system should provide all of these things. - * - * This is released into the public domain. - * Written by Mike Frysinger . - */ +/******************************************************************************* + * bitdht/bdencode.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * by Mike Frysinger * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#ifndef _BENCODE_H +#define _BENCODE_H /* USAGE: * - pass the string full of the bencoded data to be_decode() @@ -16,9 +29,6 @@ * - call be_free() on the tree to release resources */ -#ifndef _BENCODE_H -#define _BENCODE_H - #ifdef __cplusplus extern "C" { #endif diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro index d9e5816c4..e375c5b90 100644 --- a/libbitdht/src/libbitdht.pro +++ b/libbitdht/src/libbitdht.pro @@ -1,3 +1,21 @@ +################################################################################ +# libbitdht.pro # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ + !include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri") TEMPLATE = lib diff --git a/libbitdht/src/udp/udpbitdht.cc b/libbitdht/src/udp/udpbitdht.cc index 39c13e182..72357c91f 100644 --- a/libbitdht/src/udp/udpbitdht.cc +++ b/libbitdht/src/udp/udpbitdht.cc @@ -1,28 +1,24 @@ -/* - * bitdht/udpbitdht.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - +/******************************************************************************* + * bitdht/udpbitdht.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "udp/udpbitdht.h" #include "bitdht/bdpeer.h" diff --git a/libbitdht/src/udp/udpbitdht.h b/libbitdht/src/udp/udpbitdht.h index f1e167abf..5cbf0622d 100644 --- a/libbitdht/src/udp/udpbitdht.h +++ b/libbitdht/src/udp/udpbitdht.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * udp/udpbitdht.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef UDP_BIT_DHT_CLASS_H #define UDP_BIT_DHT_CLASS_H -/* - * bitdht/udpbitdht.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include #include #include diff --git a/libbitdht/src/udp/udplayer.cc b/libbitdht/src/udp/udplayer.cc index a0cc2324e..1a82c3d81 100644 --- a/libbitdht/src/udp/udplayer.cc +++ b/libbitdht/src/udp/udplayer.cc @@ -1,27 +1,24 @@ -/* - * udp/udplayer.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2004-2010 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * udp/udplayer.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2004-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "udp/udplayer.h" #include "util/bdrandom.h" diff --git a/libbitdht/src/udp/udplayer.h b/libbitdht/src/udp/udplayer.h index 8f2551cb0..06e76c647 100644 --- a/libbitdht/src/udp/udplayer.h +++ b/libbitdht/src/udp/udplayer.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * udp/udplayer.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2004-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_UDP_LAYER_H #define BITDHT_UDP_LAYER_H -/* - * udp/udplayer.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2004-2010 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 3 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 "bitdht@lunamutt.com". - * - */ - #include "util/bdthreads.h" #include "util/bdnet.h" diff --git a/libbitdht/src/udp/udpstack.cc b/libbitdht/src/udp/udpstack.cc index a66f4c6e2..fdf8eb9cf 100644 --- a/libbitdht/src/udp/udpstack.cc +++ b/libbitdht/src/udp/udpstack.cc @@ -1,27 +1,24 @@ -/* - * udp/udpstack.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * udp/udpstack.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "udp/udpstack.h" diff --git a/libbitdht/src/udp/udpstack.h b/libbitdht/src/udp/udpstack.h index 3f04f0d38..31b8ec324 100644 --- a/libbitdht/src/udp/udpstack.h +++ b/libbitdht/src/udp/udpstack.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * udp/udpstack.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_UDP_STACK_RECEIVER_H #define BITDHT_UDP_STACK_RECEIVER_H -/* - * udp/udpstack.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include "util/bdthreads.h" #include "util/bdnet.h" diff --git a/libbitdht/src/use_libbitdht.pri b/libbitdht/src/use_libbitdht.pri index bbaf1d4d5..086f16a89 100644 --- a/libbitdht/src/use_libbitdht.pri +++ b/libbitdht/src/use_libbitdht.pri @@ -1,3 +1,21 @@ +################################################################################ +# use_libbitdht.pri # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ + DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libbitdht/src)) INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libbitdht/src)) LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libbitdht/src/lib/)) -lbitdht diff --git a/libbitdht/src/util/bdbloom.cc b/libbitdht/src/util/bdbloom.cc index 016808ea4..739e2c793 100644 --- a/libbitdht/src/util/bdbloom.cc +++ b/libbitdht/src/util/bdbloom.cc @@ -1,27 +1,24 @@ -/* - * bitdht/bdbloom.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * util/bdbloom.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/bdbloom.h" #include "util/bdstring.h" diff --git a/libbitdht/src/util/bdbloom.h b/libbitdht/src/util/bdbloom.h index 91257514e..8ffd13f1e 100644 --- a/libbitdht/src/util/bdbloom.h +++ b/libbitdht/src/util/bdbloom.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * util/bdbloom.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_BLOOM_H #define BITDHT_BLOOM_H -/* - * bitdht/bdbloom.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2011 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include #include diff --git a/libbitdht/src/util/bdfile.cc b/libbitdht/src/util/bdfile.cc index 48db4a232..bcd2eb64b 100644 --- a/libbitdht/src/util/bdfile.cc +++ b/libbitdht/src/util/bdfile.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * util/bdfile.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef WIN32 #include #endif diff --git a/libbitdht/src/util/bdfile.h b/libbitdht/src/util/bdfile.h index c3d5444d7..5228f986a 100644 --- a/libbitdht/src/util/bdfile.h +++ b/libbitdht/src/util/bdfile.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * util/bdfile.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libbitdht/src/util/bdnet.cc b/libbitdht/src/util/bdnet.cc index 3bccf0d65..4c5f681a6 100644 --- a/libbitdht/src/util/bdnet.cc +++ b/libbitdht/src/util/bdnet.cc @@ -1,28 +1,24 @@ - -/* - * util/bdnet.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2010 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 3 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 "bitdht@lunamutt.com". - * - */ +/******************************************************************************* + * util/bdnet.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bdnet.h" #include "bdstring.h" diff --git a/libbitdht/src/util/bdnet.h b/libbitdht/src/util/bdnet.h index 7e3e24644..639a2ed1a 100644 --- a/libbitdht/src/util/bdnet.h +++ b/libbitdht/src/util/bdnet.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * util/bdnet.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_UNIVERSAL_NETWORK_HEADER #define BITDHT_UNIVERSAL_NETWORK_HEADER -/* - * - * util/bdnet.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2004-2010 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 3 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 "bitdht@lunamutt.com". - * - */ #include #include diff --git a/libbitdht/src/util/bdrandom.cc b/libbitdht/src/util/bdrandom.cc index 6288f86b8..93a0352dd 100644 --- a/libbitdht/src/util/bdrandom.cc +++ b/libbitdht/src/util/bdrandom.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * util/bdrandom.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright (C) 2010 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libbitdht/src/util/bdrandom.h b/libbitdht/src/util/bdrandom.h index 95d70bf13..9ab3f22bd 100644 --- a/libbitdht/src/util/bdrandom.h +++ b/libbitdht/src/util/bdrandom.h @@ -1,39 +1,37 @@ +/******************************************************************************* + * util/bdrandom.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright (C) 2010 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_UTILS_BDRANDOM_H #define BITDHT_UTILS_BDRANDOM_H - -/**************************************************************** - * libbitdht is distributed under the following license: - * - * Copyright (C) 2010 Cyril Soler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - /* This Source Code is basically a direct copy of libretroshare's RsRandom. * the function names have just been renamed. drbob */ - // bdRandom contains a random number generator that is // - thread safe // - system independant // - fast // - NOT CRYPTOGRAPHICALLY SAFE -// - DO NOT USE FOR ANYTHING REQUIRING STRONG RANDOMNESS +// - DO NOT USE FOR ANYTHING REQUIRING STRONG UNPREDICTABLE RANDOMNESS // // The implementation is adapted from the Mersenne Twister page of Wikipedia. // diff --git a/libbitdht/src/util/bdstring.cc b/libbitdht/src/util/bdstring.cc index 07fd4632f..2b9b289f4 100644 --- a/libbitdht/src/util/bdstring.cc +++ b/libbitdht/src/util/bdstring.cc @@ -1,23 +1,24 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2012, RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ +/******************************************************************************* + * util/bdstring.h * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright (C) 2010 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bdstring.h" diff --git a/libbitdht/src/util/bdstring.h b/libbitdht/src/util/bdstring.h index 9c4dc94aa..7bd76892d 100644 --- a/libbitdht/src/util/bdstring.h +++ b/libbitdht/src/util/bdstring.h @@ -1,27 +1,27 @@ +/******************************************************************************* + * util/bdstring.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright (C) 2010 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_UTILS_BDSTRING_H #define BITDHT_UTILS_BDSTRING_H -/**************************************************************** - * libbitdht is distributed under the following license: - * - * Copyright (C) 2012 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - #ifdef WIN32 // for proper handling of %ll #define bd_snprintf __mingw_snprintf diff --git a/libbitdht/src/util/bdthreads.cc b/libbitdht/src/util/bdthreads.cc index b52d152da..942df305f 100644 --- a/libbitdht/src/util/bdthreads.cc +++ b/libbitdht/src/util/bdthreads.cc @@ -1,29 +1,24 @@ -/* - * util/bdthreads.cc - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2004-2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - +/******************************************************************************* + * util/bdthread.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright (C) 2004-2010 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "bdthreads.h" #include /* for usleep() */ diff --git a/libbitdht/src/util/bdthreads.h b/libbitdht/src/util/bdthreads.h index 23350af18..34c48b1bc 100644 --- a/libbitdht/src/util/bdthreads.h +++ b/libbitdht/src/util/bdthreads.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * util/bdthread.cc * + * * + * BitDHT: An Flexible DHT library. * + * * + * Copyright (C) 2004-2010 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BITDHT_THREADS_H #define BITDHT_THREADS_H -/* - * util/bdthreads.h - * - * BitDHT: An Flexible DHT library. - * - * Copyright 2004-2010 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 3 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 "bitdht@lunamutt.com". - * - */ - - #include #include #include diff --git a/retroshare.pri b/retroshare.pri index 6b8fdd870..def629360 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -1,3 +1,21 @@ +################################################################################ +# retroshare.pri # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ + ################################################################################ ## Documented build options (CONFIG) goes here as all the rest depend on them ## ## CONFIG must not be edited in other .pro files, aka if CONFIG need do be ##### From 50b360bf9dc0a5b02434a971f63fca590ae4aa26 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 21 May 2018 20:17:54 +0200 Subject: [PATCH 050/213] added missing license to some libresapi files --- build_scripts/Debian/debian_release_howto.txt | 4 ++ libresapi/src/api/ApiPluginHandler.cpp | 21 ++++++++++ libresapi/src/api/ApiPluginHandler.h | 21 ++++++++++ libresapi/src/api/ApiServer.cpp | 21 ++++++++++ libresapi/src/api/ApiServer.h | 21 ++++++++++ libresapi/src/api/ApiServerLocal.cpp | 38 +++++++++-------- libresapi/src/api/ApiServerLocal.h | 38 +++++++++-------- libresapi/src/api/ApiServerMHD.cpp | 21 ++++++++++ libresapi/src/api/ApiServerMHD.h | 21 ++++++++++ libresapi/src/api/ApiTypes.h | 21 ++++++++++ libresapi/src/api/ChannelsHandler.cpp | 38 +++++++++-------- libresapi/src/api/ChannelsHandler.h | 38 +++++++++-------- libresapi/src/api/ChatHandler.cpp | 40 ++++++++++-------- libresapi/src/api/ChatHandler.h | 22 ++++++++++ libresapi/src/api/FileSearchHandler.cpp | 21 ++++++++++ libresapi/src/api/FileSearchHandler.h | 21 ++++++++++ libresapi/src/api/FileSharingHandler.cpp | 39 ++++++++++-------- libresapi/src/api/FileSharingHandler.h | 39 ++++++++++-------- libresapi/src/api/ForumHandler.cpp | 21 ++++++++++ libresapi/src/api/ForumHandler.h | 21 ++++++++++ libresapi/src/api/GetPluginInterfaces.cpp | 21 ++++++++++ libresapi/src/api/GetPluginInterfaces.h | 21 ++++++++++ libresapi/src/api/GxsResponseTask.cpp | 21 ++++++++++ libresapi/src/api/GxsResponseTask.h | 21 ++++++++++ libresapi/src/api/IdentityHandler.cpp | 41 ++++++++++--------- libresapi/src/api/IdentityHandler.h | 41 ++++++++++--------- libresapi/src/api/JsonStream.cpp | 21 ++++++++++ libresapi/src/api/JsonStream.h | 21 ++++++++++ libresapi/src/api/LivereloadHandler.cpp | 21 ++++++++++ libresapi/src/api/LivereloadHandler.h | 21 ++++++++++ libresapi/src/api/Operators.cpp | 21 ++++++++++ libresapi/src/api/Operators.h | 21 ++++++++++ libresapi/src/api/PeersHandler.cpp | 41 ++++++++++--------- libresapi/src/api/PeersHandler.h | 41 ++++++++++--------- libresapi/src/api/ResourceRouter.cpp | 21 ++++++++++ libresapi/src/api/ResourceRouter.h | 21 ++++++++++ libresapi/src/api/RsControlModule.cpp | 21 ++++++++++ libresapi/src/api/RsControlModule.h | 21 ++++++++++ libresapi/src/api/ServiceControlHandler.cpp | 21 ++++++++++ libresapi/src/api/ServiceControlHandler.h | 21 ++++++++++ libresapi/src/api/SettingsHandler.cpp | 21 ++++++++++ libresapi/src/api/SettingsHandler.h | 21 ++++++++++ libresapi/src/api/StateTokenServer.cpp | 21 ++++++++++ libresapi/src/api/StateTokenServer.h | 21 ++++++++++ libresapi/src/api/StatsHandler.cpp | 21 ++++++++++ libresapi/src/api/StatsHandler.h | 21 ++++++++++ libresapi/src/api/TmpBlobStore.cpp | 21 ++++++++++ libresapi/src/api/TmpBlobStore.h | 21 ++++++++++ libresapi/src/api/TransfersHandler.cpp | 21 ++++++++++ libresapi/src/api/TransfersHandler.h | 21 ++++++++++ libresapi/src/api/json.cpp | 21 ++++++++++ libresapi/src/use_libresapi.pri | 17 ++++++++ libresapi/src/util/ContentTypes.cpp | 21 ++++++++++ libresapi/src/util/ContentTypes.h | 21 ++++++++++ libretroshare/src/use_libretroshare.pri | 21 ++++++++++ openpgpsdk/src/use_openpgpsdk.pri | 21 ++++++++++ 56 files changed, 1161 insertions(+), 198 deletions(-) diff --git a/build_scripts/Debian/debian_release_howto.txt b/build_scripts/Debian/debian_release_howto.txt index a9d06e16e..40415d544 100644 --- a/build_scripts/Debian/debian_release_howto.txt +++ b/build_scripts/Debian/debian_release_howto.txt @@ -137,3 +137,7 @@ Licensing issues: Use a pointer to the top level licence file +Files after switch: + + libresapi/api/json.h MIT license Copyright (c) 2013 Jeff Weinstein (jeff.weinstein at gmail) + diff --git a/libresapi/src/api/ApiPluginHandler.cpp b/libresapi/src/api/ApiPluginHandler.cpp index fe3211eac..304e8e805 100644 --- a/libresapi/src/api/ApiPluginHandler.cpp +++ b/libresapi/src/api/ApiPluginHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiPluginHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ApiPluginHandler.h" namespace resource_api diff --git a/libresapi/src/api/ApiPluginHandler.h b/libresapi/src/api/ApiPluginHandler.h index ad29922f6..5fa8c8098 100644 --- a/libresapi/src/api/ApiPluginHandler.h +++ b/libresapi/src/api/ApiPluginHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiPluginHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ResourceRouter.h" diff --git a/libresapi/src/api/ApiServer.cpp b/libresapi/src/api/ApiServer.cpp index cc78f7eb8..420a8ef05 100644 --- a/libresapi/src/api/ApiServer.cpp +++ b/libresapi/src/api/ApiServer.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiServer.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ApiServer.h" #include diff --git a/libresapi/src/api/ApiServer.h b/libresapi/src/api/ApiServer.h index 807271eb5..6843d39e7 100644 --- a/libresapi/src/api/ApiServer.h +++ b/libresapi/src/api/ApiServer.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiServer.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libresapi/src/api/ApiServerLocal.cpp b/libresapi/src/api/ApiServerLocal.cpp index e14f85520..e856f2db2 100644 --- a/libresapi/src/api/ApiServerLocal.cpp +++ b/libresapi/src/api/ApiServerLocal.cpp @@ -1,20 +1,24 @@ -/* - * libresapi local socket server - * Copyright (C) 2016 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/ApiServer.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2016 by Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libresapi/src/api/ApiServerLocal.h b/libresapi/src/api/ApiServerLocal.h index 1d6c87ae5..c9ef246b8 100644 --- a/libresapi/src/api/ApiServerLocal.h +++ b/libresapi/src/api/ApiServerLocal.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libresapi/api/ApiServer.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2016 by Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libresapi local socket server - * Copyright (C) 2016 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include #include diff --git a/libresapi/src/api/ApiServerMHD.cpp b/libresapi/src/api/ApiServerMHD.cpp index 6b77db59a..83861fe6c 100644 --- a/libresapi/src/api/ApiServerMHD.cpp +++ b/libresapi/src/api/ApiServerMHD.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiServerMHD.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ApiServerMHD.h" #include diff --git a/libresapi/src/api/ApiServerMHD.h b/libresapi/src/api/ApiServerMHD.h index ec0897c95..9046f0aa7 100644 --- a/libresapi/src/api/ApiServerMHD.h +++ b/libresapi/src/api/ApiServerMHD.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiServerMHD.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libresapi/src/api/ApiTypes.h b/libresapi/src/api/ApiTypes.h index 6d6d5c746..21e1b2132 100644 --- a/libresapi/src/api/ApiTypes.h +++ b/libresapi/src/api/ApiTypes.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ApiTypes.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libresapi/src/api/ChannelsHandler.cpp b/libresapi/src/api/ChannelsHandler.cpp index 52a3527ac..8b6a306f6 100644 --- a/libresapi/src/api/ChannelsHandler.cpp +++ b/libresapi/src/api/ChannelsHandler.cpp @@ -1,20 +1,24 @@ -/* - * RetroShare JSON API - * Copyright (C) 2018 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/ChannelsHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ChannelsHandler.h" diff --git a/libresapi/src/api/ChannelsHandler.h b/libresapi/src/api/ChannelsHandler.h index b40f23b73..f5c027b82 100644 --- a/libresapi/src/api/ChannelsHandler.h +++ b/libresapi/src/api/ChannelsHandler.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libresapi/api/ChannelsHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * RetroShare JSON API - * Copyright (C) 2018 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include "ResourceRouter.h" diff --git a/libresapi/src/api/ChatHandler.cpp b/libresapi/src/api/ChatHandler.cpp index f03df69f9..b7917eb19 100644 --- a/libresapi/src/api/ChatHandler.cpp +++ b/libresapi/src/api/ChatHandler.cpp @@ -1,21 +1,25 @@ -/* - * libresapi - * Copyright (C) 2015 electron128 - * Copyright (C) 2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/ChatHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2015 by electron128 * + * Copyright 2017 by Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ChatHandler.h" #include "Pagination.h" diff --git a/libresapi/src/api/ChatHandler.h b/libresapi/src/api/ChatHandler.h index 4d6104592..d635c02dc 100644 --- a/libresapi/src/api/ChatHandler.h +++ b/libresapi/src/api/ChatHandler.h @@ -1,3 +1,25 @@ +/******************************************************************************* + * libresapi/api/ChatHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2015 by electron128 * + * Copyright 2017 by Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ResourceRouter.h" diff --git a/libresapi/src/api/FileSearchHandler.cpp b/libresapi/src/api/FileSearchHandler.cpp index 0382005df..6a322dc97 100644 --- a/libresapi/src/api/FileSearchHandler.cpp +++ b/libresapi/src/api/FileSearchHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/FileSearchHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "FileSearchHandler.h" diff --git a/libresapi/src/api/FileSearchHandler.h b/libresapi/src/api/FileSearchHandler.h index 5832577b5..d4b3c31cf 100644 --- a/libresapi/src/api/FileSearchHandler.h +++ b/libresapi/src/api/FileSearchHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/FileSearchHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ResourceRouter.h" #include "StateTokenServer.h" diff --git a/libresapi/src/api/FileSharingHandler.cpp b/libresapi/src/api/FileSharingHandler.cpp index a6296973d..fbbd172d8 100644 --- a/libresapi/src/api/FileSharingHandler.cpp +++ b/libresapi/src/api/FileSharingHandler.cpp @@ -1,21 +1,24 @@ -/* - * libresapi - * - * Copyright (C) 2017, Konrad Dębiec - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/FileSharingHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright (C) 2017, Konrad Dębiec * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "FileSharingHandler.h" namespace resource_api diff --git a/libresapi/src/api/FileSharingHandler.h b/libresapi/src/api/FileSharingHandler.h index 0eb67764e..23eeb1f2e 100644 --- a/libresapi/src/api/FileSharingHandler.h +++ b/libresapi/src/api/FileSharingHandler.h @@ -1,21 +1,24 @@ -/* - * libresapi - * - * Copyright (C) 2017, Konrad Dębiec - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/FileSharingHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright (C) 2017, Konrad Dębiec * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ResourceRouter.h" diff --git a/libresapi/src/api/ForumHandler.cpp b/libresapi/src/api/ForumHandler.cpp index fa7562691..fcfe3d942 100644 --- a/libresapi/src/api/ForumHandler.cpp +++ b/libresapi/src/api/ForumHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ForumHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ForumHandler.h" #include diff --git a/libresapi/src/api/ForumHandler.h b/libresapi/src/api/ForumHandler.h index e44b19818..39fa0167f 100644 --- a/libresapi/src/api/ForumHandler.h +++ b/libresapi/src/api/ForumHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ForumHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FORUMHANDLER_H #define FORUMHANDLER_H diff --git a/libresapi/src/api/GetPluginInterfaces.cpp b/libresapi/src/api/GetPluginInterfaces.cpp index f2bac46b0..f2558a469 100644 --- a/libresapi/src/api/GetPluginInterfaces.cpp +++ b/libresapi/src/api/GetPluginInterfaces.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/GetPluginInterfaces.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "GetPluginInterfaces.h" #include diff --git a/libresapi/src/api/GetPluginInterfaces.h b/libresapi/src/api/GetPluginInterfaces.h index 73cca040a..c7f92b263 100644 --- a/libresapi/src/api/GetPluginInterfaces.h +++ b/libresapi/src/api/GetPluginInterfaces.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/GetPluginInterfaces.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once class RsPlugInInterfaces; diff --git a/libresapi/src/api/GxsResponseTask.cpp b/libresapi/src/api/GxsResponseTask.cpp index dcb4ebb51..d1622b798 100644 --- a/libresapi/src/api/GxsResponseTask.cpp +++ b/libresapi/src/api/GxsResponseTask.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/GxsResponseTask.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "GxsResponseTask.h" #include "Operators.h" diff --git a/libresapi/src/api/GxsResponseTask.h b/libresapi/src/api/GxsResponseTask.h index 8200b3eee..69e31d38d 100644 --- a/libresapi/src/api/GxsResponseTask.h +++ b/libresapi/src/api/GxsResponseTask.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/GxsResponseTask.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ApiTypes.h" diff --git a/libresapi/src/api/IdentityHandler.cpp b/libresapi/src/api/IdentityHandler.cpp index ff5e50a1e..854dfdb59 100644 --- a/libresapi/src/api/IdentityHandler.cpp +++ b/libresapi/src/api/IdentityHandler.cpp @@ -1,22 +1,25 @@ -/* - * libresapi - * - * Copyright (C) 2015 electron128 - * Copyright (C) 2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/IdentityHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright (C) 2015 electron128 * + * Copyright (C) 2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "IdentityHandler.h" diff --git a/libresapi/src/api/IdentityHandler.h b/libresapi/src/api/IdentityHandler.h index dff974e73..08bc5fbed 100644 --- a/libresapi/src/api/IdentityHandler.h +++ b/libresapi/src/api/IdentityHandler.h @@ -1,23 +1,26 @@ +/******************************************************************************* + * libresapi/api/IdentityHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright (C) 2015 electron128 * + * Copyright (C) 2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libresapi - * - * Copyright (C) 2015 electron128 - * Copyright (C) 2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include #include diff --git a/libresapi/src/api/JsonStream.cpp b/libresapi/src/api/JsonStream.cpp index bbba2f2c8..9802efe2a 100644 --- a/libresapi/src/api/JsonStream.cpp +++ b/libresapi/src/api/JsonStream.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/jsonStream.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "JsonStream.h" #include diff --git a/libresapi/src/api/JsonStream.h b/libresapi/src/api/JsonStream.h index 25b7d8f93..720b239d2 100644 --- a/libresapi/src/api/JsonStream.h +++ b/libresapi/src/api/JsonStream.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/jsonStream.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ApiTypes.h" diff --git a/libresapi/src/api/LivereloadHandler.cpp b/libresapi/src/api/LivereloadHandler.cpp index 1f433754f..e67cc2327 100644 --- a/libresapi/src/api/LivereloadHandler.cpp +++ b/libresapi/src/api/LivereloadHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/LivereloadHarder.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "LivereloadHandler.h" namespace resource_api diff --git a/libresapi/src/api/LivereloadHandler.h b/libresapi/src/api/LivereloadHandler.h index 9d85999e4..e32b206c9 100644 --- a/libresapi/src/api/LivereloadHandler.h +++ b/libresapi/src/api/LivereloadHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/LivereloadHarder.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ResourceRouter.h" diff --git a/libresapi/src/api/Operators.cpp b/libresapi/src/api/Operators.cpp index 97dff652d..643b39c7a 100644 --- a/libresapi/src/api/Operators.cpp +++ b/libresapi/src/api/Operators.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/Operators.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "Operators.h" namespace resource_api diff --git a/libresapi/src/api/Operators.h b/libresapi/src/api/Operators.h index 06683cb94..92bed4c16 100644 --- a/libresapi/src/api/Operators.h +++ b/libresapi/src/api/Operators.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/Operators.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libresapi/src/api/PeersHandler.cpp b/libresapi/src/api/PeersHandler.cpp index 66def7eab..e1055dadd 100644 --- a/libresapi/src/api/PeersHandler.cpp +++ b/libresapi/src/api/PeersHandler.cpp @@ -1,22 +1,25 @@ -/* - * libresapi - * - * Copyright (C) 2015 electron128 - * Copyright (C) 2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +/******************************************************************************* + * libresapi/api/PeersHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright (C) 2015 electron128 * + * Copyright (C) 2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "PeersHandler.h" diff --git a/libresapi/src/api/PeersHandler.h b/libresapi/src/api/PeersHandler.h index d15705602..60b92a797 100644 --- a/libresapi/src/api/PeersHandler.h +++ b/libresapi/src/api/PeersHandler.h @@ -1,23 +1,26 @@ +/******************************************************************************* + * libresapi/api/PeersHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright (C) 2015 electron128 * + * Copyright (C) 2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libresapi - * - * Copyright (C) 2015 electron128 - * Copyright (C) 2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include "ResourceRouter.h" #include "StateTokenServer.h" diff --git a/libresapi/src/api/ResourceRouter.cpp b/libresapi/src/api/ResourceRouter.cpp index 48050cdb6..2c780ec2b 100644 --- a/libresapi/src/api/ResourceRouter.cpp +++ b/libresapi/src/api/ResourceRouter.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ResourceRouter.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ResourceRouter.h" diff --git a/libresapi/src/api/ResourceRouter.h b/libresapi/src/api/ResourceRouter.h index 2bb5930a3..53222ac75 100644 --- a/libresapi/src/api/ResourceRouter.h +++ b/libresapi/src/api/ResourceRouter.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ResourceRouter.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ApiTypes.h" diff --git a/libresapi/src/api/RsControlModule.cpp b/libresapi/src/api/RsControlModule.cpp index ebeadf986..1972cf4e1 100644 --- a/libresapi/src/api/RsControlModule.cpp +++ b/libresapi/src/api/RsControlModule.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/RsControlModule.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "RsControlModule.h" #include diff --git a/libresapi/src/api/RsControlModule.h b/libresapi/src/api/RsControlModule.h index e81bb66f1..cb3b7834d 100644 --- a/libresapi/src/api/RsControlModule.h +++ b/libresapi/src/api/RsControlModule.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/RsControlModule.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libresapi/src/api/ServiceControlHandler.cpp b/libresapi/src/api/ServiceControlHandler.cpp index f426f3378..6597d9d43 100644 --- a/libresapi/src/api/ServiceControlHandler.cpp +++ b/libresapi/src/api/ServiceControlHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ServiceControlHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ServiceControlHandler.h" #include "retroshare/rsservicecontrol.h" diff --git a/libresapi/src/api/ServiceControlHandler.h b/libresapi/src/api/ServiceControlHandler.h index da1db64e4..5ee9f6250 100644 --- a/libresapi/src/api/ServiceControlHandler.h +++ b/libresapi/src/api/ServiceControlHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/ServiceControlHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ApiTypes.h" diff --git a/libresapi/src/api/SettingsHandler.cpp b/libresapi/src/api/SettingsHandler.cpp index 6e1aa75da..64a4d4997 100644 --- a/libresapi/src/api/SettingsHandler.cpp +++ b/libresapi/src/api/SettingsHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/SettingsHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "SettingsHandler.h" #include diff --git a/libresapi/src/api/SettingsHandler.h b/libresapi/src/api/SettingsHandler.h index b4c21fae2..6d7b040e8 100644 --- a/libresapi/src/api/SettingsHandler.h +++ b/libresapi/src/api/SettingsHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/SettingsHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SETTINGSHANDLER_H #define SETTINGSHANDLER_H diff --git a/libresapi/src/api/StateTokenServer.cpp b/libresapi/src/api/StateTokenServer.cpp index 6c113cdae..7bd77a41f 100644 --- a/libresapi/src/api/StateTokenServer.cpp +++ b/libresapi/src/api/StateTokenServer.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/StateTokenServer.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "StateTokenServer.h" #include diff --git a/libresapi/src/api/StateTokenServer.h b/libresapi/src/api/StateTokenServer.h index 8b80b9350..17900de8e 100644 --- a/libresapi/src/api/StateTokenServer.h +++ b/libresapi/src/api/StateTokenServer.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/StateTokenServer.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libresapi/src/api/StatsHandler.cpp b/libresapi/src/api/StatsHandler.cpp index 46bf600d4..49ce23487 100644 --- a/libresapi/src/api/StatsHandler.cpp +++ b/libresapi/src/api/StatsHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/StatsHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "StatsHandler.h" #include "Operators.h" diff --git a/libresapi/src/api/StatsHandler.h b/libresapi/src/api/StatsHandler.h index cbe8ae231..0b6d65009 100644 --- a/libresapi/src/api/StatsHandler.h +++ b/libresapi/src/api/StatsHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/StatsHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef STATSHANDLER_H #define STATSHANDLER_H diff --git a/libresapi/src/api/TmpBlobStore.cpp b/libresapi/src/api/TmpBlobStore.cpp index c179b6830..098f02e39 100644 --- a/libresapi/src/api/TmpBlobStore.cpp +++ b/libresapi/src/api/TmpBlobStore.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/TmpBLogStore.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "TmpBlobStore.h" #include diff --git a/libresapi/src/api/TmpBlobStore.h b/libresapi/src/api/TmpBlobStore.h index 1cf439b85..18ec6917b 100644 --- a/libresapi/src/api/TmpBlobStore.h +++ b/libresapi/src/api/TmpBlobStore.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/TmpBLogStore.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "StateTokenServer.h" diff --git a/libresapi/src/api/TransfersHandler.cpp b/libresapi/src/api/TransfersHandler.cpp index c696411da..9ee4688df 100644 --- a/libresapi/src/api/TransfersHandler.cpp +++ b/libresapi/src/api/TransfersHandler.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/TransfersHandler.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "TransfersHandler.h" #include "Operators.h" #include diff --git a/libresapi/src/api/TransfersHandler.h b/libresapi/src/api/TransfersHandler.h index 7d07a7198..67deca276 100644 --- a/libresapi/src/api/TransfersHandler.h +++ b/libresapi/src/api/TransfersHandler.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/TransfersHandler.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "ResourceRouter.h" diff --git a/libresapi/src/api/json.cpp b/libresapi/src/api/json.cpp index 2bcec7e81..103ad9b67 100644 --- a/libresapi/src/api/json.cpp +++ b/libresapi/src/api/json.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/api/json.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #define nullptr 0 #include "json.h" diff --git a/libresapi/src/use_libresapi.pri b/libresapi/src/use_libresapi.pri index e9b1753a2..963f5ceb4 100644 --- a/libresapi/src/use_libresapi.pri +++ b/libresapi/src/use_libresapi.pri @@ -1,3 +1,20 @@ +################################################################################ +# uselibresapi.pri # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src)) INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src)) LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi diff --git a/libresapi/src/util/ContentTypes.cpp b/libresapi/src/util/ContentTypes.cpp index 30434e093..3d026932b 100644 --- a/libresapi/src/util/ContentTypes.cpp +++ b/libresapi/src/util/ContentTypes.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/util/ContentTypes.cpp * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ContentTypes.h" #include #include diff --git a/libresapi/src/util/ContentTypes.h b/libresapi/src/util/ContentTypes.h index 0e6b71e73..269383bae 100644 --- a/libresapi/src/util/ContentTypes.h +++ b/libresapi/src/util/ContentTypes.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libresapi/util/ContentTypes.h * + * * + * LibResAPI: API for local socket server * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef CONTENTTYPES_H #define CONTENTTYPES_H diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index d17e36739..4d4e00061 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -1,3 +1,24 @@ +################################################################################ +# uselibretroshare.pri # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ +DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src)) +INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src)) +LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi + DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src/)) INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src)) LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libretroshare/src/lib/)) -lretroshare diff --git a/openpgpsdk/src/use_openpgpsdk.pri b/openpgpsdk/src/use_openpgpsdk.pri index adf10f1ca..0e776f5b4 100644 --- a/openpgpsdk/src/use_openpgpsdk.pri +++ b/openpgpsdk/src/use_openpgpsdk.pri @@ -1,3 +1,24 @@ +################################################################################ +# use_openpgpsdk.pri # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ +DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src)) +INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src)) +LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi + DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../openpgpsdk/src/lib/)) -lops From 544b4af4c23da1c73aaef3ad357975e30562a00f Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 21 May 2018 20:50:38 +0200 Subject: [PATCH 051/213] fixed license in chat, crypto, dht, file_sharing --- libresapi/src/libresapi.pro | 17 +++++++ libretroshare/src/chat/distantchat.cc | 46 ++++++++--------- libretroshare/src/chat/distantchat.h | 45 ++++++++--------- libretroshare/src/chat/distributedchat.cc | 45 ++++++++--------- libretroshare/src/chat/distributedchat.h | 45 ++++++++--------- libretroshare/src/chat/p3chatservice.cc | 46 +++++++++-------- libretroshare/src/chat/p3chatservice.h | 46 ++++++++--------- libretroshare/src/chat/rschatitems.cc | 46 ++++++++--------- libretroshare/src/chat/rschatitems.h | 45 ++++++++--------- libretroshare/src/crypto/chacha20.cpp | 45 ++++++++--------- libretroshare/src/crypto/chacha20.h | 45 ++++++++--------- libretroshare/src/crypto/hashstream.cc | 21 ++++++++ libretroshare/src/crypto/hashstream.h | 21 ++++++++ libretroshare/src/dht/connectstatebox.cc | 45 ++++++++--------- libretroshare/src/dht/connectstatebox.h | 46 ++++++++--------- libretroshare/src/dht/p3bitdht.cc | 45 ++++++++--------- libretroshare/src/dht/p3bitdht.h | 46 ++++++++--------- libretroshare/src/dht/p3bitdht_interface.cc | 45 ++++++++--------- libretroshare/src/dht/p3bitdht_peernet.cc | 21 ++++++++ libretroshare/src/dht/p3bitdht_peers.cc | 49 +++++++++---------- libretroshare/src/dht/p3bitdht_relay.cc | 45 ++++++++--------- libretroshare/src/dht/stunaddrassist.h | 46 ++++++++--------- .../src/file_sharing/dir_hierarchy.cc | 45 ++++++++--------- .../src/file_sharing/dir_hierarchy.h | 47 ++++++++---------- .../src/file_sharing/directory_storage.cc | 45 ++++++++--------- .../src/file_sharing/directory_storage.h | 46 ++++++++--------- .../src/file_sharing/directory_updater.cc | 45 ++++++++--------- .../src/file_sharing/directory_updater.h | 46 ++++++++--------- libretroshare/src/file_sharing/file_tree.cc | 21 ++++++++ libretroshare/src/file_sharing/file_tree.h | 46 ++++++++--------- libretroshare/src/file_sharing/filelist_io.cc | 46 ++++++++--------- libretroshare/src/file_sharing/filelist_io.h | 47 ++++++++---------- libretroshare/src/file_sharing/hash_cache.cc | 45 ++++++++--------- libretroshare/src/file_sharing/hash_cache.h | 45 ++++++++--------- libretroshare/src/file_sharing/p3filelists.cc | 45 ++++++++--------- libretroshare/src/file_sharing/p3filelists.h | 46 ++++++++--------- .../src/file_sharing/rsfilelistitems.cc | 45 ++++++++--------- .../src/file_sharing/rsfilelistitems.h | 45 ++++++++--------- libretroshare/src/libretroshare.pro | 21 ++++++++ 39 files changed, 817 insertions(+), 810 deletions(-) diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index 885d430f5..f75ffc2c4 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -1,3 +1,20 @@ +################################################################################ +# libresapi.pro # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ !include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri") TEMPLATE = lib diff --git a/libretroshare/src/chat/distantchat.cc b/libretroshare/src/chat/distantchat.cc index c9999c56d..a6ba359e2 100644 --- a/libretroshare/src/chat/distantchat.cc +++ b/libretroshare/src/chat/distantchat.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/chat: distantchat.cc - * - * Services for RetroShare. - * - * Copyright 2014 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/chat: distantchat.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/chat/distantchat.h b/libretroshare/src/chat/distantchat.h index b177e6029..25896c4b8 100644 --- a/libretroshare/src/chat/distantchat.h +++ b/libretroshare/src/chat/distantchat.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/chat: distantchat.h - * - * Services for RetroShare. - * - * Copyright 2014 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/chat: distantchat.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index 00fcd3a97..fce60a65a 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/chat: distributedchat.cc - * - * Services for RetroShare. - * - * Copyright 2014 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/chat: distributedchat.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/chat/distributedchat.h b/libretroshare/src/chat/distributedchat.h index ca7155dd2..69168ce01 100644 --- a/libretroshare/src/chat/distributedchat.h +++ b/libretroshare/src/chat/distributedchat.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/chat/distributedchat.h - * - * Services for RetroShare. - * - * Copyright 2014 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/chat: distributedchat.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/chat/p3chatservice.cc b/libretroshare/src/chat/p3chatservice.cc index 9b34460e7..71edc4898 100644 --- a/libretroshare/src/chat/p3chatservice.cc +++ b/libretroshare/src/chat/p3chatservice.cc @@ -1,27 +1,25 @@ -/* - * "$Id: p3ChatService.cc,v 1.24 2007-05-05 16:10:06 rmf24 Exp $" - * - * Other Bits for RetroShare. - * - * Copyright 2004-2006 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". - * - */ +/******************************************************************************* + * libretroshare/src/chat: chatservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #include #include #include diff --git a/libretroshare/src/chat/p3chatservice.h b/libretroshare/src/chat/p3chatservice.h index bcd0af977..e6b66ec35 100644 --- a/libretroshare/src/chat/p3chatservice.h +++ b/libretroshare/src/chat/p3chatservice.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services chatservice.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". - * - */ - +/******************************************************************************* + * libretroshare/src/chat: chatservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_CHAT_HEADER #define SERVICE_CHAT_HEADER diff --git a/libretroshare/src/chat/rschatitems.cc b/libretroshare/src/chat/rschatitems.cc index 7ae680105..17bfce1ec 100644 --- a/libretroshare/src/chat/rschatitems.cc +++ b/libretroshare/src/chat/rschatitems.cc @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsbaseitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/chat: rschatitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/chat/rschatitems.h b/libretroshare/src/chat/rschatitems.h index 8ea4189f4..064044f1a 100644 --- a/libretroshare/src/chat/rschatitems.h +++ b/libretroshare/src/chat/rschatitems.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/serialiser: rschatitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/chat: rschatitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once diff --git a/libretroshare/src/crypto/chacha20.cpp b/libretroshare/src/crypto/chacha20.cpp index 3f12b2086..228162622 100644 --- a/libretroshare/src/crypto/chacha20.cpp +++ b/libretroshare/src/crypto/chacha20.cpp @@ -1,27 +1,24 @@ -/* - * RetroShare C++ File sharing default variables - * - * file_sharing/file_sharing_defaults.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/crypto: chacha20.cpp * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/crypto/chacha20.h b/libretroshare/src/crypto/chacha20.h index ffce04605..1ecf05411 100644 --- a/libretroshare/src/crypto/chacha20.h +++ b/libretroshare/src/crypto/chacha20.h @@ -1,27 +1,24 @@ -/* - * RetroShare C++ File sharing default variables - * - * crypto/chacha20.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/crypto: chacha20.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include diff --git a/libretroshare/src/crypto/hashstream.cc b/libretroshare/src/crypto/hashstream.cc index 3f97cef7b..22bb64059 100644 --- a/libretroshare/src/crypto/hashstream.cc +++ b/libretroshare/src/crypto/hashstream.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/crypto: hashstream.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "hashstream.h" #include diff --git a/libretroshare/src/crypto/hashstream.h b/libretroshare/src/crypto/hashstream.h index c73c7367c..5714b6816 100644 --- a/libretroshare/src/crypto/hashstream.h +++ b/libretroshare/src/crypto/hashstream.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/crypto: hashstream.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/dht/connectstatebox.cc b/libretroshare/src/dht/connectstatebox.cc index ca631687d..7ca107fa9 100644 --- a/libretroshare/src/dht/connectstatebox.cc +++ b/libretroshare/src/dht/connectstatebox.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/dht: connectstatebox.cc - * - * RetroShare DHT C++ Interface. - * - * Copyright 2011-2011 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". - * - */ +/******************************************************************************* + * libretroshare/src/dht: connectstatebox.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "dht/connectstatebox.h" #include "retroshare/rsconfig.h" diff --git a/libretroshare/src/dht/connectstatebox.h b/libretroshare/src/dht/connectstatebox.h index 178dcd00d..5eac8b6c8 100644 --- a/libretroshare/src/dht/connectstatebox.h +++ b/libretroshare/src/dht/connectstatebox.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/dht: connectstatebox.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef CONNECT_STATUS_BOX_H #define CONNECT_STATUS_BOX_H -/* - * libretroshare/src/dht: connectstatebox.h - * - * RetroShare DHT C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - /* a connect state box */ #define CSB_START 1 diff --git a/libretroshare/src/dht/p3bitdht.cc b/libretroshare/src/dht/p3bitdht.cc index 4cb4aa973..b7320c0ac 100644 --- a/libretroshare/src/dht/p3bitdht.cc +++ b/libretroshare/src/dht/p3bitdht.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/dht: p3bitdht.h - * - * BitDht interface for RetroShare. - * - * Copyright 2009-2010 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". - * - */ +/******************************************************************************* + * libretroshare/src/dht: p3bitdht.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include diff --git a/libretroshare/src/dht/p3bitdht.h b/libretroshare/src/dht/p3bitdht.h index 92c2e626d..09fcd7263 100644 --- a/libretroshare/src/dht/p3bitdht.h +++ b/libretroshare/src/dht/p3bitdht.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/dht: p3bitdht.h - * - * BitDht interface for RetroShare. - * - * Copyright 2009-2010 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". - * - */ - +/******************************************************************************* + * libretroshare/src/dht: p3bitdht.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_P3_BITDHT_H #define MRK_P3_BITDHT_H diff --git a/libretroshare/src/dht/p3bitdht_interface.cc b/libretroshare/src/dht/p3bitdht_interface.cc index e82758964..1b7ff35f5 100644 --- a/libretroshare/src/dht/p3bitdht_interface.cc +++ b/libretroshare/src/dht/p3bitdht_interface.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/dht: p3bitdht.h - * - * BitDht interface for RetroShare. - * - * Copyright 2009-2011 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". - * - */ +/******************************************************************************* + * libretroshare/src/dht: p3bitdht_interface.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsnet.h" #include "dht/p3bitdht.h" diff --git a/libretroshare/src/dht/p3bitdht_peernet.cc b/libretroshare/src/dht/p3bitdht_peernet.cc index 3f37f8793..4be52dfa5 100644 --- a/libretroshare/src/dht/p3bitdht_peernet.cc +++ b/libretroshare/src/dht/p3bitdht_peernet.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/dht: p3bitdht_peernet.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "dht/p3bitdht.h" diff --git a/libretroshare/src/dht/p3bitdht_peers.cc b/libretroshare/src/dht/p3bitdht_peers.cc index cf2d2af97..950b1bfd8 100644 --- a/libretroshare/src/dht/p3bitdht_peers.cc +++ b/libretroshare/src/dht/p3bitdht_peers.cc @@ -1,30 +1,25 @@ -/* - * libretroshare/src/dht: p3bitdht.h - * - * BitDht interface for RetroShare. - * - * Copyright 2009-2010 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/dht: p3bitdht_peernet.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2010 by Robert Fernie. * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "dht/p3bitdht.h" #include "bitdht/bdstddht.h" diff --git a/libretroshare/src/dht/p3bitdht_relay.cc b/libretroshare/src/dht/p3bitdht_relay.cc index d846e7691..8939da5c7 100644 --- a/libretroshare/src/dht/p3bitdht_relay.cc +++ b/libretroshare/src/dht/p3bitdht_relay.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/dht: p3bitdht.h - * - * BitDht interface for RetroShare. - * - * Copyright 2009-2011 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". - * - */ +/******************************************************************************* + * libretroshare/src/dht: p3bitdht_relay.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2011 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include "util/rsnet.h" #include "dht/p3bitdht.h" diff --git a/libretroshare/src/dht/stunaddrassist.h b/libretroshare/src/dht/stunaddrassist.h index 1df0bfabc..e12f64f73 100644 --- a/libretroshare/src/dht/stunaddrassist.h +++ b/libretroshare/src/dht/stunaddrassist.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/dht: stunaddrassist.h - * - * BitDht interface for RetroShare. - * - * Copyright 2011-2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/dht: stunaddrassist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #ifndef STUN_ADDR_ASSIST_H #define STUN_ADDR_ASSIST_H diff --git a/libretroshare/src/file_sharing/dir_hierarchy.cc b/libretroshare/src/file_sharing/dir_hierarchy.cc index c2b7baa44..46ddd0164 100644 --- a/libretroshare/src/file_sharing/dir_hierarchy.cc +++ b/libretroshare/src/file_sharing/dir_hierarchy.cc @@ -1,27 +1,24 @@ -/* - * RetroShare Internal directory storage class. - * - * file_sharing/dir_hierarchy.cc - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: dir_hierarchy.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include #include #include diff --git a/libretroshare/src/file_sharing/dir_hierarchy.h b/libretroshare/src/file_sharing/dir_hierarchy.h index 0eeda5e6f..30b30760e 100644 --- a/libretroshare/src/file_sharing/dir_hierarchy.h +++ b/libretroshare/src/file_sharing/dir_hierarchy.h @@ -1,29 +1,24 @@ -/* - * RetroShare C++ Internal directory hierarchy class. - * - * file_sharing/dir_hierarchy.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ - - +/******************************************************************************* + * libretroshare/src/file_sharing: dir_hierarchy.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/file_sharing/directory_storage.cc b/libretroshare/src/file_sharing/directory_storage.cc index d39401e06..abcd4cc00 100644 --- a/libretroshare/src/file_sharing/directory_storage.cc +++ b/libretroshare/src/file_sharing/directory_storage.cc @@ -1,27 +1,24 @@ -/* - * RetroShare File list storage system. - * - * file_sharing/directory_storage.cc - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: directory_storage.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include #include #include "serialiser/rstlvbinary.h" diff --git a/libretroshare/src/file_sharing/directory_storage.h b/libretroshare/src/file_sharing/directory_storage.h index 22377bb0b..51f3edabe 100644 --- a/libretroshare/src/file_sharing/directory_storage.h +++ b/libretroshare/src/file_sharing/directory_storage.h @@ -1,28 +1,24 @@ -/* - * RetroShare C++ Directory Storage system. - * - * file_sharing/directory_storage.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ - +/******************************************************************************* + * libretroshare/src/file_sharing: directory_storage.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/file_sharing/directory_updater.cc b/libretroshare/src/file_sharing/directory_updater.cc index dffef92c7..ba600224b 100644 --- a/libretroshare/src/file_sharing/directory_updater.cc +++ b/libretroshare/src/file_sharing/directory_updater.cc @@ -1,27 +1,24 @@ -/* - * RetroShare Directory watching system. - * - * file_sharing/directory_updater.cc - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: directory_updater.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include "util/folderiterator.h" #include "util/rstime.h" #include "rsserver/p3face.h" diff --git a/libretroshare/src/file_sharing/directory_updater.h b/libretroshare/src/file_sharing/directory_updater.h index 4c6e05649..e518ee80c 100644 --- a/libretroshare/src/file_sharing/directory_updater.h +++ b/libretroshare/src/file_sharing/directory_updater.h @@ -1,28 +1,24 @@ -/* - * RetroShare C++ Directory parsing code. - * - * file_sharing/directory_updater.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ - +/******************************************************************************* + * libretroshare/src/file_sharing: directory_updater.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ // This class crawls the given directry hierarchy and updates it. It does so by calling the // shared file list source. This source may be of two types: diff --git a/libretroshare/src/file_sharing/file_tree.cc b/libretroshare/src/file_sharing/file_tree.cc index 92ee6a362..76ce41651 100644 --- a/libretroshare/src/file_sharing/file_tree.cc +++ b/libretroshare/src/file_sharing/file_tree.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/file_sharing: file_tree.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include #include #include diff --git a/libretroshare/src/file_sharing/file_tree.h b/libretroshare/src/file_sharing/file_tree.h index 0505ceed5..37f64c776 100644 --- a/libretroshare/src/file_sharing/file_tree.h +++ b/libretroshare/src/file_sharing/file_tree.h @@ -1,28 +1,24 @@ -/* - * RetroShare C++ File lists IO methods. - * - * file_sharing/file_tree.h - * - * Copyright 2017 by csoler - * - * 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.project@gmail.com". - * - */ - +/******************************************************************************* + * libretroshare/src/file_sharing: file_tree.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include "retroshare/rsfiles.h" class FileTreeImpl: public FileTree diff --git a/libretroshare/src/file_sharing/filelist_io.cc b/libretroshare/src/file_sharing/filelist_io.cc index 15d4d1b53..51cec3c92 100644 --- a/libretroshare/src/file_sharing/filelist_io.cc +++ b/libretroshare/src/file_sharing/filelist_io.cc @@ -1,28 +1,24 @@ -/* - * RetroShare File lists IO methods. - * - * file_sharing/filelist_io.h - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ - +/******************************************************************************* + * libretroshare/src/file_sharing: filelist_io.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include #include "retroshare/rsids.h" #include "pqi/authssl.h" diff --git a/libretroshare/src/file_sharing/filelist_io.h b/libretroshare/src/file_sharing/filelist_io.h index 8eccd6b27..bda8e089a 100644 --- a/libretroshare/src/file_sharing/filelist_io.h +++ b/libretroshare/src/file_sharing/filelist_io.h @@ -1,29 +1,24 @@ -/* - * RetroShare C++ File lists IO methods. - * - * file_sharing/filelist_io.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ - - +/******************************************************************************* + * libretroshare/src/file_sharing: filelist_io.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/file_sharing/hash_cache.cc b/libretroshare/src/file_sharing/hash_cache.cc index f0db680cf..8db7b3ed4 100644 --- a/libretroshare/src/file_sharing/hash_cache.cc +++ b/libretroshare/src/file_sharing/hash_cache.cc @@ -1,27 +1,24 @@ -/* - * RetroShare Hash cache - * - * file_sharing/hash_cache.cc - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: hash_cache.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include "util/rsdir.h" #include "util/rsprint.h" #include "util/rstime.h" diff --git a/libretroshare/src/file_sharing/hash_cache.h b/libretroshare/src/file_sharing/hash_cache.h index 05dcbd9c3..de4b32943 100644 --- a/libretroshare/src/file_sharing/hash_cache.h +++ b/libretroshare/src/file_sharing/hash_cache.h @@ -1,27 +1,24 @@ -/* - * RetroShare C++ Hash cache. - * - * file_sharing/hash_cache.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: hash_cache.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #pragma once diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 3eaaa9d03..01ae6034e 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1,27 +1,24 @@ -/* - * RetroShare File lists service. - * - * file_sharing/p3filelists.cc - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: p3filelists.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include "rsitems/rsserviceids.h" #include "file_sharing/p3filelists.h" diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 4de5e24b3..e285a4e23 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -1,28 +1,24 @@ -/* - * RetroShare C++ File lists service. - * - * file_sharing/p3filelists.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ - +/******************************************************************************* + * libretroshare/src/file_sharing: p3filelists.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ // // This class is responsible for diff --git a/libretroshare/src/file_sharing/rsfilelistitems.cc b/libretroshare/src/file_sharing/rsfilelistitems.cc index 7d91549d4..77628777c 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.cc +++ b/libretroshare/src/file_sharing/rsfilelistitems.cc @@ -1,27 +1,24 @@ -/* - * RetroShare File lists service items - * - * file_sharing/rsfilelistsitems.cc - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: rsfilelistsitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "serialiser/rstypeserializer.h" diff --git a/libretroshare/src/file_sharing/rsfilelistitems.h b/libretroshare/src/file_sharing/rsfilelistitems.h index 2f04a84a5..eaadaf7bd 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.h +++ b/libretroshare/src/file_sharing/rsfilelistitems.h @@ -1,27 +1,24 @@ -/* - * RetroShare File lists service items. - * - * file_sharing/rsfilelistitems.h - * - * Copyright 2016 Mr.Alice - * - * 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.project@gmail.com". - * - */ +/******************************************************************************* + * libretroshare/src/file_sharing: rsfilelistsitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index e401ed8ee..3e5ead553 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -1,3 +1,24 @@ +################################################################################ +# libretroshare.pro # +# Copyright (C) 2018, Retroshare team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program 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 Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +################################################################################ +!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri") + +TEMPLATE = lib +CONFIG += staticlib !include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri") TEMPLATE = lib From d5627d4b22f406872186db5f521604b0c1057e61 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 22 May 2018 22:03:11 +0200 Subject: [PATCH 052/213] fixed license in ft, grouter, and gxs --- libretroshare/src/ft/ftchunkmap.cc | 45 ++++++++--------- libretroshare/src/ft/ftchunkmap.h | 22 +++++++++ libretroshare/src/ft/ftcontroller.cc | 45 ++++++++--------- libretroshare/src/ft/ftcontroller.h | 45 ++++++++--------- libretroshare/src/ft/ftdatamultiplex.cc | 45 ++++++++--------- libretroshare/src/ft/ftdatamultiplex.h | 45 ++++++++--------- libretroshare/src/ft/ftextralist.cc | 45 ++++++++--------- libretroshare/src/ft/ftextralist.h | 45 ++++++++--------- libretroshare/src/ft/ftfilecreator.cc | 21 ++++++++ libretroshare/src/ft/ftfilecreator.h | 45 ++++++++--------- libretroshare/src/ft/ftfileprovider.cc | 21 ++++++++ libretroshare/src/ft/ftfileprovider.h | 45 ++++++++--------- libretroshare/src/ft/ftfilesearch.cc | 46 ++++++++---------- libretroshare/src/ft/ftfilesearch.h | 45 ++++++++--------- libretroshare/src/ft/ftserver.cc | 45 ++++++++--------- libretroshare/src/ft/ftserver.h | 45 ++++++++--------- libretroshare/src/ft/fttransfermodule.cc | 46 ++++++++---------- libretroshare/src/ft/fttransfermodule.h | 44 ++++++++--------- .../src/ft/ftturtlefiletransferitem.cc | 46 ++++++++---------- .../src/ft/ftturtlefiletransferitem.h | 46 ++++++++---------- libretroshare/src/grouter/groutercache.h | 46 ++++++++---------- libretroshare/src/grouter/grouteritems.cc | 21 ++++++++ libretroshare/src/grouter/grouteritems.h | 46 ++++++++---------- libretroshare/src/grouter/groutertypes.h | 46 ++++++++---------- libretroshare/src/grouter/p3grouter.cc | 45 ++++++++--------- libretroshare/src/grouter/p3grouter.h | 46 ++++++++---------- libretroshare/src/gxs/gxssecurity.cc | 48 +++++++++---------- libretroshare/src/gxs/gxssecurity.h | 48 +++++++++---------- libretroshare/src/gxs/gxstokenqueue.cc | 46 ++++++++---------- libretroshare/src/gxs/gxstokenqueue.h | 45 ++++++++--------- libretroshare/src/gxs/rsdataservice.cc | 46 ++++++++---------- libretroshare/src/gxs/rsdataservice.h | 46 ++++++++---------- libretroshare/src/gxs/rsgds.h | 46 ++++++++---------- libretroshare/src/gxs/rsgenexchange.cc | 47 ++++++++---------- libretroshare/src/gxs/rsgenexchange.h | 46 ++++++++---------- libretroshare/src/gxs/rsgixs.h | 46 ++++++++---------- libretroshare/src/gxs/rsgxs.h | 45 ++++++++--------- libretroshare/src/gxs/rsgxsdata.cc | 46 ++++++++---------- libretroshare/src/gxs/rsgxsdata.h | 46 ++++++++---------- libretroshare/src/gxs/rsgxsdataaccess.cc | 45 ++++++++--------- libretroshare/src/gxs/rsgxsdataaccess.h | 46 ++++++++---------- libretroshare/src/gxs/rsgxsnetservice.cc | 45 ++++++++--------- libretroshare/src/gxs/rsgxsnetservice.h | 46 ++++++++---------- libretroshare/src/gxs/rsgxsnetutils.cc | 45 ++++++++--------- libretroshare/src/gxs/rsgxsnetutils.h | 45 ++++++++--------- libretroshare/src/gxs/rsgxsrequesttypes.cc | 45 ++++++++--------- libretroshare/src/gxs/rsgxsrequesttypes.h | 46 ++++++++---------- libretroshare/src/gxs/rsgxsutil.cc | 46 ++++++++---------- libretroshare/src/gxs/rsgxsutil.h | 45 ++++++++--------- libretroshare/src/gxs/rsnxsobserver.h | 46 ++++++++---------- 50 files changed, 1053 insertions(+), 1130 deletions(-) diff --git a/libretroshare/src/ft/ftchunkmap.cc b/libretroshare/src/ft/ftchunkmap.cc index 64411ac58..b7630ccb2 100644 --- a/libretroshare/src/ft/ftchunkmap.cc +++ b/libretroshare/src/ft/ftchunkmap.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftdata.cc - * - * File Transfer for RetroShare. - * - * Copyright 2010 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftchunkmap.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ /******** * #define DEBUG_FTCHUNK 1 diff --git a/libretroshare/src/ft/ftchunkmap.h b/libretroshare/src/ft/ftchunkmap.h index f7c696b9a..f6364596c 100644 --- a/libretroshare/src/ft/ftchunkmap.h +++ b/libretroshare/src/ft/ftchunkmap.h @@ -1,3 +1,25 @@ +/******************************************************************************* + * libretroshare/src/ft: ftchunkmap.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ + #pragma once #include diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 9abec040f..c80712d23 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftcontroller.cc - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftcontroller.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* * ftController diff --git a/libretroshare/src/ft/ftcontroller.h b/libretroshare/src/ft/ftcontroller.h index 564660879..8499f1e5b 100644 --- a/libretroshare/src/ft/ftcontroller.h +++ b/libretroshare/src/ft/ftcontroller.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftcontroller.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftcontroller.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_CONTROLLER_HEADER #define FT_CONTROLLER_HEADER diff --git a/libretroshare/src/ft/ftdatamultiplex.cc b/libretroshare/src/ft/ftdatamultiplex.cc index ad16e0e4c..7800468d0 100644 --- a/libretroshare/src/ft/ftdatamultiplex.cc +++ b/libretroshare/src/ft/ftdatamultiplex.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftdatamultiplex.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftdatamultiplex.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* * ftDataMultiplexModule. diff --git a/libretroshare/src/ft/ftdatamultiplex.h b/libretroshare/src/ft/ftdatamultiplex.h index 1679e7832..4bb8c3109 100644 --- a/libretroshare/src/ft/ftdatamultiplex.h +++ b/libretroshare/src/ft/ftdatamultiplex.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftdatamultiplex.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftdatamultiplex.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_DATA_MULTIPLEX_HEADER #define FT_DATA_MULTIPLEX_HEADER diff --git a/libretroshare/src/ft/ftextralist.cc b/libretroshare/src/ft/ftextralist.cc index b6fec4076..d2c70b3d9 100644 --- a/libretroshare/src/ft/ftextralist.cc +++ b/libretroshare/src/ft/ftextralist.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftextralist.cc - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftextralist.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef WINDOWS_SYS #include "util/rswin.h" diff --git a/libretroshare/src/ft/ftextralist.h b/libretroshare/src/ft/ftextralist.h index 211e66dc6..e148a505f 100644 --- a/libretroshare/src/ft/ftextralist.h +++ b/libretroshare/src/ft/ftextralist.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftextralist.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftextralist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_FILE_EXTRA_LIST_HEADER #define FT_FILE_EXTRA_LIST_HEADER diff --git a/libretroshare/src/ft/ftfilecreator.cc b/libretroshare/src/ft/ftfilecreator.cc index 56bf78bf7..69e7b9cf8 100644 --- a/libretroshare/src/ft/ftfilecreator.cc +++ b/libretroshare/src/ft/ftfilecreator.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/ft: ftfilecreator.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef WINDOWS_SYS #include "util/rsstring.h" #include "util/rswin.h" diff --git a/libretroshare/src/ft/ftfilecreator.h b/libretroshare/src/ft/ftfilecreator.h index 68820c160..b0461524d 100644 --- a/libretroshare/src/ft/ftfilecreator.h +++ b/libretroshare/src/ft/ftfilecreator.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft/ ftfilecreator.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftfilecreator.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_FILE_CREATOR_HEADER #define FT_FILE_CREATOR_HEADER diff --git a/libretroshare/src/ft/ftfileprovider.cc b/libretroshare/src/ft/ftfileprovider.cc index e613694c1..44fbe7945 100644 --- a/libretroshare/src/ft/ftfileprovider.cc +++ b/libretroshare/src/ft/ftfileprovider.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/ft: ftfileprovider.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef WINDOWS_SYS #include "util/rswin.h" #endif // WINDOWS_SYS diff --git a/libretroshare/src/ft/ftfileprovider.h b/libretroshare/src/ft/ftfileprovider.h index 8b6acf9f6..eedda8693 100644 --- a/libretroshare/src/ft/ftfileprovider.h +++ b/libretroshare/src/ft/ftfileprovider.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft ftFileProvider.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftfileprovider.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_FILE_PROVIDER_HEADER #define FT_FILE_PROVIDER_HEADER diff --git a/libretroshare/src/ft/ftfilesearch.cc b/libretroshare/src/ft/ftfilesearch.cc index 4aae20e05..ed021e66d 100644 --- a/libretroshare/src/ft/ftfilesearch.cc +++ b/libretroshare/src/ft/ftfilesearch.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/ft: ftfilesearch.cc - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: ftfilesearch.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "ft/ftfilesearch.h" const uint32_t MAX_SEARCHS = 24; /* lower 24 bits of hint */ diff --git a/libretroshare/src/ft/ftfilesearch.h b/libretroshare/src/ft/ftfilesearch.h index ce714ff71..f4b4e8abe 100644 --- a/libretroshare/src/ft/ftfilesearch.h +++ b/libretroshare/src/ft/ftfilesearch.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftfilesearch.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftfilesearch.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_FILE_SEARCH_HEADER #define FT_FILE_SEARCH_HEADER diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index a3c344460..e24f75a2c 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftserver.cc - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftserver.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "crypto/chacha20.h" //const int ftserverzone = 29539; diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 440113d11..541db6e68 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/ft: ftserver.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/ft: ftserver.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_SERVER_HEADER #define FT_SERVER_HEADER diff --git a/libretroshare/src/ft/fttransfermodule.cc b/libretroshare/src/ft/fttransfermodule.cc index 46d10c400..9559bcb0a 100644 --- a/libretroshare/src/ft/fttransfermodule.cc +++ b/libretroshare/src/ft/fttransfermodule.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/ft: fttransfermodule.cc - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: fttransfermodule.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /****** * #define FT_DEBUG 1 *****/ diff --git a/libretroshare/src/ft/fttransfermodule.h b/libretroshare/src/ft/fttransfermodule.h index 02cf0212d..52e015c90 100644 --- a/libretroshare/src/ft/fttransfermodule.h +++ b/libretroshare/src/ft/fttransfermodule.h @@ -1,26 +1,24 @@ -/* - * Retroshare file transfer module: ftTransferModule.h - * - * Copyright 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". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: fttransfermodule.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_TRANSFER_MODULE_HEADER #define FT_TRANSFER_MODULE_HEADER diff --git a/libretroshare/src/ft/ftturtlefiletransferitem.cc b/libretroshare/src/ft/ftturtlefiletransferitem.cc index 44722af4b..d3c4e7ac6 100644 --- a/libretroshare/src/ft/ftturtlefiletransferitem.cc +++ b/libretroshare/src/ft/ftturtlefiletransferitem.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: ftturtlefiletransferitem.cc - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: ftturtlefiletransferitem.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/ft/ftturtlefiletransferitem.h b/libretroshare/src/ft/ftturtlefiletransferitem.h index a2aa18034..211884932 100644 --- a/libretroshare/src/ft/ftturtlefiletransferitem.h +++ b/libretroshare/src/ft/ftturtlefiletransferitem.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: ftturtlefiletransferitem.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: ftturtlefiletransferitem.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/grouter/groutercache.h b/libretroshare/src/grouter/groutercache.h index b30362857..d969bfda9 100644 --- a/libretroshare/src/grouter/groutercache.h +++ b/libretroshare/src/grouter/groutercache.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: groutercache.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/grouter: groutercache.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "retroshare/rsflags.h" diff --git a/libretroshare/src/grouter/grouteritems.cc b/libretroshare/src/grouter/grouteritems.cc index 5fc4813a7..7738a175d 100644 --- a/libretroshare/src/grouter/grouteritems.cc +++ b/libretroshare/src/grouter/grouteritems.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/grouter: grouteritems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsprint.h" #include "serialiser/rsbaseserial.h" #include "serialiser/rstlvbase.h" diff --git a/libretroshare/src/grouter/grouteritems.h b/libretroshare/src/grouter/grouteritems.h index 9777c074b..312dfad99 100644 --- a/libretroshare/src/grouter/grouteritems.h +++ b/libretroshare/src/grouter/grouteritems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: rsgrouteritems.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/grouter: grouteritems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "util/rsmemory.h" diff --git a/libretroshare/src/grouter/groutertypes.h b/libretroshare/src/grouter/groutertypes.h index df8c90d48..c19fa55ee 100644 --- a/libretroshare/src/grouter/groutertypes.h +++ b/libretroshare/src/grouter/groutertypes.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: groutermatrix.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/grouter: groutertypes.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/grouter/p3grouter.cc b/libretroshare/src/grouter/p3grouter.cc index d184b15f5..48966db2f 100644 --- a/libretroshare/src/grouter/p3grouter.cc +++ b/libretroshare/src/grouter/p3grouter.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/services: p3grouter.cc - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/grouter: p3grouter.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ //////////////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/libretroshare/src/grouter/p3grouter.h b/libretroshare/src/grouter/p3grouter.h index 71b2fc138..7d20f522b 100644 --- a/libretroshare/src/grouter/p3grouter.h +++ b/libretroshare/src/grouter/p3grouter.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3grouter.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/grouter: p3grouter.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/gxs/gxssecurity.cc b/libretroshare/src/gxs/gxssecurity.cc index 7d200ab86..153431c56 100644 --- a/libretroshare/src/gxs/gxssecurity.cc +++ b/libretroshare/src/gxs/gxssecurity.cc @@ -1,29 +1,25 @@ - -/* - * libretroshare/src/gxs: gxssecurity.cc - * - * - * Copyright 2008-2010 by Robert Fernie - * 2011-2012 Christopher Evi-Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/gxs: gxssecurity.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2010 by Robert Fernie * + * 2011-2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "gxssecurity.h" #include "pqi/authgpg.h" #include "util/rsdir.h" diff --git a/libretroshare/src/gxs/gxssecurity.h b/libretroshare/src/gxs/gxssecurity.h index 57cffcd2a..ebbf3ba4c 100644 --- a/libretroshare/src/gxs/gxssecurity.h +++ b/libretroshare/src/gxs/gxssecurity.h @@ -1,32 +1,28 @@ +/******************************************************************************* + * libretroshare/src/gxs: gxssecurity.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2010 by Robert Fernie * + * 2011-2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef GXSSECURITY_H #define GXSSECURITY_H -/* - * libretroshare/src/gxs: gxssecurity.h - * - * Security functions for Gxs - * - * Copyright 2008-2010 by Robert Fernie - * 2011-2012 Christopher Evi-Parker - * - * 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 "serialiser/rstlvkeys.h" #include "rsitems/rsnxsitems.h" diff --git a/libretroshare/src/gxs/gxstokenqueue.cc b/libretroshare/src/gxs/gxstokenqueue.cc index b857ee1a8..64d1ec9db 100644 --- a/libretroshare/src/gxs/gxstokenqueue.cc +++ b/libretroshare/src/gxs/gxstokenqueue.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/gxs gxstokenqueue.cc - * - * Gxs Support for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/gxs: gxstokenqueue.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "gxs/gxstokenqueue.h" /******* diff --git a/libretroshare/src/gxs/gxstokenqueue.h b/libretroshare/src/gxs/gxstokenqueue.h index 1099cd338..0ea43d345 100644 --- a/libretroshare/src/gxs/gxstokenqueue.h +++ b/libretroshare/src/gxs/gxstokenqueue.h @@ -1,29 +1,26 @@ +/******************************************************************************* + * libretroshare/src/gxs: gxstokenqueue.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef R_GXS_TOKEN_QUEUE_H #define R_GXS_TOKEN_QUEUE_H -/* - * libretroshare/src/gxs gxstokenqueue.h - * - * Gxs Support for RetroShare. - * - * Copyright 2012-2012 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.1 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 "gxs/rsgenexchange.h" #include "util/rsthreads.h" diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index bebcee21d..3c2e48021 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/gxs: rsdataservice.cc - * - * Data Access, interface for RetroShare. - * - * Copyright 2011-2011 by Evi-Parker Christopher - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: gxsdataservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /***** * #define RS_DATA_SERVICE_DEBUG 1 diff --git a/libretroshare/src/gxs/rsdataservice.h b/libretroshare/src/gxs/rsdataservice.h index c669ee016..4fa5c866f 100644 --- a/libretroshare/src/gxs/rsdataservice.h +++ b/libretroshare/src/gxs/rsdataservice.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: gxsdataservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2012 by Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSDATASERVICE_H #define RSDATASERVICE_H -/* - * libretroshare/src/gxs: rsdataservice.h - * - * General Data service, interface for RetroShare. - * - * Copyright 2011-2012 by Evi-Parker Christopher - * - * 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 "gxs/rsgds.h" #include "util/retrodb.h" diff --git a/libretroshare/src/gxs/rsgds.h b/libretroshare/src/gxs/rsgds.h index e20d0ed04..9c23d920e 100644 --- a/libretroshare/src/gxs/rsgds.h +++ b/libretroshare/src/gxs/rsgds.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgds.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGDS_H #define RSGDS_H -/* - * libretroshare/src/gxp: gxp.h - * - * General Data service, interface for RetroShare. - * - * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher - * - * 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 #include #include diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 15d0aa9e9..fe3781e85 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/gxs: rsgenexchange.cc - * - * RetroShare Gxs exchange interface. - * - * Copyright 2012-2012 by Christopher Evi-Parker, 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". - * - */ - +/******************************************************************************* + * libretroshare/src/gxs: rsgenexchange.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie, Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "pqi/pqihash.h" diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 491ff017b..8a8af9444 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgenexchange.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie, Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGENEXCHANGE_H #define RSGENEXCHANGE_H -/* - * libretroshare/src/gxs: rsgenexchange.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 by Christopher Evi-Parker, 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 #include diff --git a/libretroshare/src/gxs/rsgixs.h b/libretroshare/src/gxs/rsgixs.h index 3c7c5ae1b..21a4cf1c4 100644 --- a/libretroshare/src/gxs/rsgixs.h +++ b/libretroshare/src/gxs/rsgixs.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgixs.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGIXS_H #define RSGIXS_H -/* - * libretroshare/src/gxs: gxs.h - * - * General Identity Exchange Service interface for RetroShare. - * - * Copyright 2011-2011 by Robert Fernie, Christopher Evi-Prker - * - * 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 "gxs/rsgxs.h" #include "gxs/rsgenexchange.h" diff --git a/libretroshare/src/gxs/rsgxs.h b/libretroshare/src/gxs/rsgxs.h index e8e64a098..0719d6109 100644 --- a/libretroshare/src/gxs/rsgxs.h +++ b/libretroshare/src/gxs/rsgxs.h @@ -1,30 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgxs.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXS_H #define RSGXS_H -/* - * libretroshare/src/gxs : rsgxs.h - * - * Copyright 2012 Christopher Evi-Parker - * - * 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 "gxs/rsgxsdata.h" #include diff --git a/libretroshare/src/gxs/rsgxsdata.cc b/libretroshare/src/gxs/rsgxsdata.cc index 48dfa9917..b69606f72 100644 --- a/libretroshare/src/gxs/rsgxsdata.cc +++ b/libretroshare/src/gxs/rsgxsdata.cc @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/gxs: rsgxsdata.cc - * - * Gxs Data types used to specific services - * - * Copyright 2012-2012 by Christopher Evi-Parker, 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsdata.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsgxsdata.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/gxs/rsgxsdata.h b/libretroshare/src/gxs/rsgxsdata.h index 3cead4a11..c1d6becc4 100644 --- a/libretroshare/src/gxs/rsgxsdata.h +++ b/libretroshare/src/gxs/rsgxsdata.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsdata.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSMETA_H #define RSGXSMETA_H -/* - * libretroshare/src/gxs: rsgxsdata.h - * - * Gxs Data types used to specific services - * - * Copyright 2012-2012 by Christopher Evi-Parker, 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 #include diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 5d36bd909..383fcf840 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/retroshare: rsgxsdataaccess.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2013 by Robert Fernie, Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsdataaccess.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 by Christopher Evi-Parker, Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include diff --git a/libretroshare/src/gxs/rsgxsdataaccess.h b/libretroshare/src/gxs/rsgxsdataaccess.h index 77f94137e..741a3b78d 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.h +++ b/libretroshare/src/gxs/rsgxsdataaccess.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsdataaccess.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSDATAACCESS_H #define RSGXSDATAACCESS_H -/* - * libretroshare/src/retroshare: rsgxsdataaccess.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 by Robert Fernie, Christopher Evi-Parker - * - * 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 "retroshare/rstokenservice.h" #include "rsgxsrequesttypes.h" #include "rsgds.h" diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 48a9e9234..eff91a417 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/gxs: rsgxnetservice.cc - * - * Access to rs network and synchronisation service implementation - * - * Copyright 2012-2012 by Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsnetservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ // // RsNxsItem diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 00ba07953..9ec6bdf9b 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsnetservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSNETSERVICE_H #define RSGXSNETSERVICE_H -/* - * libretroshare/src/gxs: rsgxnetservice.h - * - * Access to rs network and synchronisation service implementation - * - * Copyright 2012-2012 by Christopher Evi-Parker - * - * 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 #include diff --git a/libretroshare/src/gxs/rsgxsnetutils.cc b/libretroshare/src/gxs/rsgxsnetutils.cc index 7454ba58a..4796cffd6 100644 --- a/libretroshare/src/gxs/rsgxsnetutils.cc +++ b/libretroshare/src/gxs/rsgxsnetutils.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/gxs: rsgxnetutils.cc - * - * Helper objects for the operation rsgxsnetservice - * - * Copyright 2012-2013 by Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsnetutils.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsgxsnetutils.h" #include "pqi/p3servicecontrol.h" diff --git a/libretroshare/src/gxs/rsgxsnetutils.h b/libretroshare/src/gxs/rsgxsnetutils.h index aae2be9f8..39d9a6112 100644 --- a/libretroshare/src/gxs/rsgxsnetutils.h +++ b/libretroshare/src/gxs/rsgxsnetutils.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/gxs: rsgxnetutils.h - * - * Helper objects for the operation rsgxsnetservice - * - * Copyright 2012-2013 by Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsnetutils.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSNETUTILS_H_ #define RSGXSNETUTILS_H_ diff --git a/libretroshare/src/gxs/rsgxsrequesttypes.cc b/libretroshare/src/gxs/rsgxsrequesttypes.cc index 81dec52ab..57fff5143 100644 --- a/libretroshare/src/gxs/rsgxsrequesttypes.cc +++ b/libretroshare/src/gxs/rsgxsrequesttypes.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/gxs: rgxsrequesttypes.cc - * - * Type introspect request types for data access request implementation - * - * Copyright 2012-2012 by Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsrequesttypes.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsgxsrequesttypes.h" #include "util/rsstd.h" diff --git a/libretroshare/src/gxs/rsgxsrequesttypes.h b/libretroshare/src/gxs/rsgxsrequesttypes.h index 5c70c9d52..72138e801 100644 --- a/libretroshare/src/gxs/rsgxsrequesttypes.h +++ b/libretroshare/src/gxs/rsgxsrequesttypes.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsrequesttypes.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSREQUESTTYPES_H_ #define RSGXSREQUESTTYPES_H_ -/* - * libretroshare/src/gxs: rgxsrequesttypes.h - * - * Type introspect request types for data access request implementation - * - * Copyright 2012-2012 by Christopher Evi-Parker - * - * 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 "retroshare/rstokenservice.h" #include "gxs/rsgds.h" #include "util/rsdeprecate.h" diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index abf02aef2..b6e26e6e3 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/gxs: rsgxsutil.cc - * - * RetroShare C++ Interface. Generic routines that are useful in GXS - * - * Copyright 2013-2013 by Christopher Evi-Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/gxs: rsgxsutil.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsgxsutil.h" diff --git a/libretroshare/src/gxs/rsgxsutil.h b/libretroshare/src/gxs/rsgxsutil.h index b169e00b5..67c384cfc 100644 --- a/libretroshare/src/gxs/rsgxsutil.h +++ b/libretroshare/src/gxs/rsgxsutil.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/gxs: rsgxsutil.h - * - * RetroShare C++ Interface. Generic routines that are useful in GXS - * - * Copyright 2013-2013 by Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsutil.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef GXSUTIL_H_ #define GXSUTIL_H_ diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index 087842ef0..90c306129 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/gxs: rsgxsobserver.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2012 by Robert Fernie, Evi-Parker Christopher * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSNXSOBSERVER_H #define RSNXSOBSERVER_H -/* - * libretroshare/src/gxs: rsnxsobserver.h - * - * Observer interface used by nxs to transport new messages to clients - * - * Copyright 2011-2012 by Robert Fernie, Evi-Parker Christopher - * - * 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 #include "rsitems/rsnxsitems.h" From 8a07f2c8c446b020072c092775e5e79694376b4f Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 24 May 2018 19:50:07 +0200 Subject: [PATCH 053/213] fixed wrong commit with copy-pasted code --- libretroshare/src/use_libretroshare.pri | 4 ---- openpgpsdk/src/use_openpgpsdk.pri | 4 ---- 2 files changed, 8 deletions(-) diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index 4d4e00061..47b657222 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -15,10 +15,6 @@ # You should have received a copy of the GNU Affero General Public License # # along with this program. If not, see . # ################################################################################ -DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src)) -INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src)) -LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi - DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src/)) INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src)) LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libretroshare/src/lib/)) -lretroshare diff --git a/openpgpsdk/src/use_openpgpsdk.pri b/openpgpsdk/src/use_openpgpsdk.pri index 0e776f5b4..115f88d67 100644 --- a/openpgpsdk/src/use_openpgpsdk.pri +++ b/openpgpsdk/src/use_openpgpsdk.pri @@ -15,10 +15,6 @@ # You should have received a copy of the GNU Affero General Public License # # along with this program. If not, see . # ################################################################################ -DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src)) -INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src)) -LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi - DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../openpgpsdk/src/lib/)) -lops From 1fee544db7b3c7c6357b979b91108e711535d1fc Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 26 May 2018 14:45:43 +0200 Subject: [PATCH 054/213] re-licensed gxstrans, gxstunnel, pgp, plugins and half pqi --- libretroshare/src/ft/ftdata.h | 46 ++++++++--------- libretroshare/src/gxstrans/p3gxstrans.cc | 39 +++++++------- libretroshare/src/gxstrans/p3gxstrans.h | 38 +++++++------- libretroshare/src/gxstrans/p3gxstransitems.cc | 39 +++++++------- libretroshare/src/gxstrans/p3gxstransitems.h | 38 +++++++------- libretroshare/src/gxstunnel/p3gxstunnel.cc | 47 ++++++++--------- libretroshare/src/gxstunnel/p3gxstunnel.h | 46 ++++++++--------- .../src/gxstunnel/rsgxstunnelitems.cc | 47 ++++++++--------- .../src/gxstunnel/rsgxstunnelitems.h | 46 ++++++++--------- libretroshare/src/pgp/pgpauxutils.cc | 46 ++++++++--------- libretroshare/src/pgp/pgpauxutils.h | 46 ++++++++--------- libretroshare/src/pgp/pgphandler.cc | 23 +++++++++ libretroshare/src/pgp/pgphandler.h | 23 +++++++++ libretroshare/src/pgp/pgpkeyutil.cc | 23 +++++++++ libretroshare/src/pgp/pgpkeyutil.h | 42 +++++++-------- libretroshare/src/pgp/rscertificate.cc | 23 +++++++++ libretroshare/src/pgp/rscertificate.h | 23 +++++++++ libretroshare/src/plugins/dlfcn_win32.cc | 40 ++++++++------- libretroshare/src/plugins/dlfcn_win32.h | 40 ++++++++------- libretroshare/src/plugins/pluginmanager.cc | 21 ++++++++ libretroshare/src/plugins/pluginmanager.h | 21 ++++++++ libretroshare/src/pqi/authgpg.cc | 47 ++++++++--------- libretroshare/src/pqi/authgpg.h | 49 ++++++++---------- libretroshare/src/pqi/authssl.cc | 51 ++++++++----------- libretroshare/src/pqi/authssl.h | 46 ++++++++--------- libretroshare/src/pqi/p3cfgmgr.cc | 46 ++++++++--------- libretroshare/src/pqi/p3cfgmgr.h | 21 ++++++++ 27 files changed, 582 insertions(+), 435 deletions(-) diff --git a/libretroshare/src/ft/ftdata.h b/libretroshare/src/ft/ftdata.h index 909195009..b66b32fc2 100644 --- a/libretroshare/src/ft/ftdata.h +++ b/libretroshare/src/ft/ftdata.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/ft: ftdata.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: ftdata.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_DATA_INTERFACE_HEADER #define FT_DATA_INTERFACE_HEADER diff --git a/libretroshare/src/gxstrans/p3gxstrans.cc b/libretroshare/src/gxstrans/p3gxstrans.cc index d0dbb61b0..373f0bc1c 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.cc +++ b/libretroshare/src/gxstrans/p3gxstrans.cc @@ -1,21 +1,24 @@ -/* - * GXS Mailing Service - * Copyright (C) 2016-2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - +/******************************************************************************* + * libretroshare/src/gxstrans: p3gxstrans.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016-2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsdir.h" #include "gxstrans/p3gxstrans.h" #include "util/stacktrace.h" diff --git a/libretroshare/src/gxstrans/p3gxstrans.h b/libretroshare/src/gxstrans/p3gxstrans.h index af79679d9..efddf9929 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.h +++ b/libretroshare/src/gxstrans/p3gxstrans.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libretroshare/src/gxstrans: p3gxstrans.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016-2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * GXS Mailing Service - * Copyright (C) 2016-2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include #include diff --git a/libretroshare/src/gxstrans/p3gxstransitems.cc b/libretroshare/src/gxstrans/p3gxstransitems.cc index 5d28ec582..20fc85540 100644 --- a/libretroshare/src/gxstrans/p3gxstransitems.cc +++ b/libretroshare/src/gxstrans/p3gxstransitems.cc @@ -1,21 +1,24 @@ -/* - * GXS Mailing Service - * Copyright (C) 2016-2018 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - +/******************************************************************************* + * libretroshare/src/gxstrans: p3gxstrans.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "gxstrans/p3gxstransitems.h" #include "serialiser/rstypeserializer.h" diff --git a/libretroshare/src/gxstrans/p3gxstransitems.h b/libretroshare/src/gxstrans/p3gxstransitems.h index bd13c9e71..63b4792a5 100644 --- a/libretroshare/src/gxstrans/p3gxstransitems.h +++ b/libretroshare/src/gxstrans/p3gxstransitems.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libretroshare/src/gxstrans: p3gxstrans.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016-2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * GXS Mailing Service - * Copyright (C) 2016-2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index eef365230..d9b7afd97 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -1,28 +1,25 @@ -/* - * libretroshare/src/chat: distantchat.cc - * - * Services for RetroShare. - * - * Copyright 2014 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/chat: distantchat.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2015 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once #include diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.h b/libretroshare/src/gxstunnel/p3gxstunnel.h index cabe520d4..4284ba64d 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.h +++ b/libretroshare/src/gxstunnel/p3gxstunnel.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/chat: distantchat.h - * - * Services for RetroShare. - * - * Copyright 2015 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/chat: distantchat.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2015 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once // Generic tunnel service diff --git a/libretroshare/src/gxstunnel/rsgxstunnelitems.cc b/libretroshare/src/gxstunnel/rsgxstunnelitems.cc index d653b03ea..0569337ac 100644 --- a/libretroshare/src/gxstunnel/rsgxstunnelitems.cc +++ b/libretroshare/src/gxstunnel/rsgxstunnelitems.cc @@ -1,28 +1,25 @@ - -/* - * libretroshare/src/serialiser: rsbaseitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/gxstunnel: rsgxstunnelitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2015 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once #include #include diff --git a/libretroshare/src/gxstunnel/rsgxstunnelitems.h b/libretroshare/src/gxstunnel/rsgxstunnelitems.h index 8c4e95ba4..eea267503 100644 --- a/libretroshare/src/gxstunnel/rsgxstunnelitems.h +++ b/libretroshare/src/gxstunnel/rsgxstunnelitems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rschatitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/chat: rsgxstunnelitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2015 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/pgp/pgpauxutils.cc b/libretroshare/src/pgp/pgpauxutils.cc index 6cd4ebf08..ff69f1a1a 100644 --- a/libretroshare/src/pgp/pgpauxutils.cc +++ b/libretroshare/src/pgp/pgpauxutils.cc @@ -1,27 +1,25 @@ -/* - * libretroshare/src/pgp: pgpauxutils.cc - * - * PGP interface for RetroShare. - * - * Copyright 2014-2014 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/pgp: pgpauxutils.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once #include "pgp/pgpauxutils.h" diff --git a/libretroshare/src/pgp/pgpauxutils.h b/libretroshare/src/pgp/pgpauxutils.h index 2ead59db8..ff16caf92 100644 --- a/libretroshare/src/pgp/pgpauxutils.h +++ b/libretroshare/src/pgp/pgpauxutils.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pgp: pgpauxutils.h - * - * PGP interface for RetroShare. - * - * Copyright 2014-2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pgp: pgpauxutils.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "retroshare/rsids.h" diff --git a/libretroshare/src/pgp/pgphandler.cc b/libretroshare/src/pgp/pgphandler.cc index df95fc7f9..5b8bddf43 100644 --- a/libretroshare/src/pgp/pgphandler.cc +++ b/libretroshare/src/pgp/pgphandler.cc @@ -1,3 +1,26 @@ +/******************************************************************************* + * libretroshare/src/pgp: pgphandler.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + #include #include #include diff --git a/libretroshare/src/pgp/pgphandler.h b/libretroshare/src/pgp/pgphandler.h index 8b3d9a4fe..2210611fe 100644 --- a/libretroshare/src/pgp/pgphandler.h +++ b/libretroshare/src/pgp/pgphandler.h @@ -1,3 +1,26 @@ +/******************************************************************************* + * libretroshare/src/pgp: pgphandler.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + #pragma once // This class implements an abstract pgp handler to be used in RetroShare. diff --git a/libretroshare/src/pgp/pgpkeyutil.cc b/libretroshare/src/pgp/pgpkeyutil.cc index ebd2ccf5b..ca02a4f14 100644 --- a/libretroshare/src/pgp/pgpkeyutil.cc +++ b/libretroshare/src/pgp/pgpkeyutil.cc @@ -1,3 +1,26 @@ +/******************************************************************************* + * libretroshare/src/pgp: pgpkeyutil.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + #include #include #include "pgpkeyutil.h" diff --git a/libretroshare/src/pgp/pgpkeyutil.h b/libretroshare/src/pgp/pgpkeyutil.h index 672550b1b..d117b010c 100644 --- a/libretroshare/src/pgp/pgpkeyutil.h +++ b/libretroshare/src/pgp/pgpkeyutil.h @@ -1,24 +1,24 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2012 Cyril Soler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - +/******************************************************************************* + * libretroshare/src/pgp: pgpkeyutil.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once // refer to RFC4880 specif document for loading GPG public keys: diff --git a/libretroshare/src/pgp/rscertificate.cc b/libretroshare/src/pgp/rscertificate.cc index 70a00328f..5eaadfbea 100644 --- a/libretroshare/src/pgp/rscertificate.cc +++ b/libretroshare/src/pgp/rscertificate.cc @@ -1,3 +1,26 @@ +/******************************************************************************* + * libretroshare/src/pgp: rscertificate.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + #include #include #include diff --git a/libretroshare/src/pgp/rscertificate.h b/libretroshare/src/pgp/rscertificate.h index a70a1752f..8b82b2cfa 100644 --- a/libretroshare/src/pgp/rscertificate.h +++ b/libretroshare/src/pgp/rscertificate.h @@ -1,3 +1,26 @@ +/******************************************************************************* + * libretroshare/src/pgp: rscertificate.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + #pragma once #include diff --git a/libretroshare/src/plugins/dlfcn_win32.cc b/libretroshare/src/plugins/dlfcn_win32.cc index 1a6b107b5..3677a4706 100644 --- a/libretroshare/src/plugins/dlfcn_win32.cc +++ b/libretroshare/src/plugins/dlfcn_win32.cc @@ -1,21 +1,25 @@ -/* - * dlfcn-win32 - * Copyright (c) 2007 Ramiro Polla - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ +/******************************************************************************* + * libretroshare/src/plugins: dlfcn_win32.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007 Ramiro Polla * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once #ifdef WINDOWS_SYS diff --git a/libretroshare/src/plugins/dlfcn_win32.h b/libretroshare/src/plugins/dlfcn_win32.h index af33af443..0b21e9e53 100644 --- a/libretroshare/src/plugins/dlfcn_win32.h +++ b/libretroshare/src/plugins/dlfcn_win32.h @@ -1,21 +1,25 @@ -/* - * dlfcn-win32 - * Copyright (c) 2007 Ramiro Polla - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ +/******************************************************************************* + * libretroshare/src/plugins: dlfcn_win32.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007 Ramiro Polla * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once #ifdef WINDOWS_SYS #ifndef DLFCN_H diff --git a/libretroshare/src/plugins/pluginmanager.cc b/libretroshare/src/plugins/pluginmanager.cc index 61757f31d..b8f6fdcec 100644 --- a/libretroshare/src/plugins/pluginmanager.cc +++ b/libretroshare/src/plugins/pluginmanager.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/plugins: pluginmanager.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "pluginmanager.h" diff --git a/libretroshare/src/plugins/pluginmanager.h b/libretroshare/src/plugins/pluginmanager.h index 09f05563b..540068428 100644 --- a/libretroshare/src/plugins/pluginmanager.h +++ b/libretroshare/src/plugins/pluginmanager.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/plugins: pluginmanager.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index ccfb8a260..4d7d0f446 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src AuthGPG.cc - * - * GnuPG/GPGme interface for RetroShare. - * - * Copyright 2008-2009 by Robert Fernie, Retroshare Team. - * - * This library is free software; you can redistribute it and/or - * modify it under the termsf 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". - * - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: authgpg.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2009 by Robert Fernie, Retroshare Team. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "authgpg.h" #include "retroshare/rsiface.h" // For rsicontrol. #include "retroshare/rspeers.h" // For RsPeerDetails. diff --git a/libretroshare/src/pqi/authgpg.h b/libretroshare/src/pqi/authgpg.h index 4ad48c42b..4f0149908 100644 --- a/libretroshare/src/pqi/authgpg.h +++ b/libretroshare/src/pqi/authgpg.h @@ -1,31 +1,24 @@ -/* - * libretroshare/src/ : gpgauthmgr.h - * - * GPG interface for RetroShare. - * - * Copyright 2008-2009 by Raghu Dev R. - * - * 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". - * - * This is *THE* auth manager. It provides the web-of-trust via - * gpgme, and authenticates the certificates that are managed - * by the sublayer AuthSSL. - * - */ +/******************************************************************************* + * libretroshare/src/pqi: authgpg.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2009 by Raghu Dev R. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /**** * Here's GPG policy : diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 9956459d3..19201906c 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -1,33 +1,24 @@ -/* - * libretroshare/src/pqi: authssl.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". - * - * - * This class is designed to provide authentication using ssl certificates - * only. It is intended to be wrapped by an gpgauthmgr to provide - * pgp + ssl web-of-trust authentication. - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: authssl.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie, Retroshare Team. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef WINDOWS_SYS #include "util/rswin.h" #endif // WINDOWS_SYS diff --git a/libretroshare/src/pqi/authssl.h b/libretroshare/src/pqi/authssl.h index bdfd141c0..c0ea77449 100644 --- a/libretroshare/src/pqi/authssl.h +++ b/libretroshare/src/pqi/authssl.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: authssl.h - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: authssl.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie, Retroshare Team. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_AUTH_SSL_HEADER #define MRK_AUTH_SSL_HEADER diff --git a/libretroshare/src/pqi/p3cfgmgr.cc b/libretroshare/src/pqi/p3cfgmgr.cc index 3266f68d4..0182303eb 100644 --- a/libretroshare/src/pqi/p3cfgmgr.cc +++ b/libretroshare/src/pqi/p3cfgmgr.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: p3cfgmgr.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3cfgmgr.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie, Retroshare Team. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsdir.h" //#include "retroshare/rspeers.h" #include "pqi/p3cfgmgr.h" diff --git a/libretroshare/src/pqi/p3cfgmgr.h b/libretroshare/src/pqi/p3cfgmgr.h index 43e19b66e..91de5136a 100644 --- a/libretroshare/src/pqi/p3cfgmgr.h +++ b/libretroshare/src/pqi/p3cfgmgr.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/pqi: p3cfgmgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie, Retroshare Team. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* * libretroshare/src/pqi: p3cfgmgr.h * From b3277824ebe16d3f1d2de8370985fd9d78e57740 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 28 May 2018 22:03:39 +0200 Subject: [PATCH 055/213] license fix in pqi --- libbitdht/src/use_libbitdht.pri | 6 +-- libretroshare/src/chat/distantchat.cc | 6 +-- libretroshare/src/chat/distantchat.h | 6 +-- libretroshare/src/chat/distributedchat.cc | 6 +-- libretroshare/src/chat/distributedchat.h | 6 +-- libretroshare/src/chat/p3chatservice.cc | 6 +-- libretroshare/src/chat/p3chatservice.h | 6 +-- libretroshare/src/chat/rschatitems.cc | 6 +-- libretroshare/src/chat/rschatitems.h | 6 +-- libretroshare/src/crypto/chacha20.h | 6 +-- libretroshare/src/crypto/hashstream.cc | 6 +-- libretroshare/src/crypto/hashstream.h | 6 +-- libretroshare/src/dht/connectstatebox.cc | 6 +-- libretroshare/src/dht/connectstatebox.h | 6 +-- libretroshare/src/dht/p3bitdht.cc | 6 +-- libretroshare/src/dht/p3bitdht.h | 6 +-- libretroshare/src/dht/stunaddrassist.h | 6 +-- .../src/file_sharing/dir_hierarchy.cc | 6 +-- .../src/file_sharing/dir_hierarchy.h | 6 +-- .../src/file_sharing/directory_storage.cc | 6 +-- .../src/file_sharing/directory_storage.h | 6 +-- .../src/file_sharing/directory_updater.cc | 6 +-- .../src/file_sharing/directory_updater.h | 6 +-- .../src/file_sharing/file_sharing_defaults.h | 47 ++++++++--------- libretroshare/src/file_sharing/file_tree.cc | 6 +-- libretroshare/src/file_sharing/file_tree.h | 6 +-- libretroshare/src/file_sharing/filelist_io.cc | 6 +-- libretroshare/src/file_sharing/filelist_io.h | 6 +-- libretroshare/src/file_sharing/hash_cache.cc | 6 +-- libretroshare/src/file_sharing/hash_cache.h | 6 +-- libretroshare/src/file_sharing/p3filelists.cc | 6 +-- libretroshare/src/file_sharing/p3filelists.h | 6 +-- .../src/file_sharing/rsfilelistitems.cc | 6 +-- .../src/file_sharing/rsfilelistitems.h | 6 +-- libretroshare/src/ft/ftchunkmap.cc | 6 +-- libretroshare/src/ft/ftchunkmap.h | 6 +-- libretroshare/src/ft/ftcontroller.cc | 6 +-- libretroshare/src/ft/ftcontroller.h | 6 +-- libretroshare/src/ft/ftdata.h | 6 +-- libretroshare/src/ft/ftdatamultiplex.cc | 6 +-- libretroshare/src/ft/ftdatamultiplex.h | 6 +-- libretroshare/src/ft/ftextralist.cc | 6 +-- libretroshare/src/ft/ftextralist.h | 6 +-- libretroshare/src/ft/ftfilecreator.cc | 6 +-- libretroshare/src/ft/ftfilecreator.h | 6 +-- libretroshare/src/ft/ftfileprovider.cc | 6 +-- libretroshare/src/ft/ftfileprovider.h | 6 +-- libretroshare/src/ft/ftfilesearch.cc | 6 +-- libretroshare/src/ft/ftfilesearch.h | 6 +-- libretroshare/src/ft/ftsearch.h | 46 ++++++++--------- libretroshare/src/ft/ftserver.cc | 6 +-- libretroshare/src/ft/ftserver.h | 6 +-- libretroshare/src/ft/fttransfermodule.cc | 6 +-- libretroshare/src/ft/fttransfermodule.h | 6 +-- .../src/ft/ftturtlefiletransferitem.cc | 6 +-- .../src/ft/ftturtlefiletransferitem.h | 6 +-- libretroshare/src/grouter/groutercache.h | 6 +-- libretroshare/src/grouter/grouteritems.cc | 6 +-- libretroshare/src/grouter/grouteritems.h | 6 +-- libretroshare/src/grouter/groutertypes.h | 6 +-- libretroshare/src/grouter/p3grouter.cc | 6 +-- libretroshare/src/grouter/p3grouter.h | 6 +-- libretroshare/src/gxs/gxssecurity.cc | 6 +-- libretroshare/src/gxs/gxssecurity.h | 6 +-- libretroshare/src/gxs/gxstokenqueue.cc | 6 +-- libretroshare/src/gxs/gxstokenqueue.h | 6 +-- libretroshare/src/gxs/rsdataservice.cc | 6 +-- libretroshare/src/gxs/rsdataservice.h | 6 +-- libretroshare/src/gxs/rsgds.h | 6 +-- libretroshare/src/gxs/rsgenexchange.cc | 6 +-- libretroshare/src/gxs/rsgenexchange.h | 6 +-- libretroshare/src/gxs/rsgixs.h | 6 +-- libretroshare/src/gxs/rsgxs.h | 6 +-- libretroshare/src/gxs/rsgxsdata.cc | 6 +-- libretroshare/src/gxs/rsgxsdata.h | 6 +-- libretroshare/src/gxs/rsgxsdataaccess.cc | 6 +-- libretroshare/src/gxs/rsgxsdataaccess.h | 6 +-- libretroshare/src/gxs/rsgxsnetservice.cc | 6 +-- libretroshare/src/gxs/rsgxsnetservice.h | 6 +-- libretroshare/src/gxs/rsgxsnetutils.cc | 6 +-- libretroshare/src/gxs/rsgxsnetutils.h | 6 +-- libretroshare/src/gxs/rsgxsrequesttypes.cc | 6 +-- libretroshare/src/gxs/rsgxsrequesttypes.h | 6 +-- libretroshare/src/gxs/rsgxsutil.cc | 6 +-- libretroshare/src/gxs/rsgxsutil.h | 6 +-- libretroshare/src/gxs/rsnxsobserver.h | 6 +-- libretroshare/src/gxstrans/p3gxstrans.cc | 6 +-- libretroshare/src/gxstrans/p3gxstrans.h | 6 +-- libretroshare/src/gxstrans/p3gxstransitems.cc | 6 +-- libretroshare/src/gxstrans/p3gxstransitems.h | 6 +-- libretroshare/src/gxstunnel/p3gxstunnel.cc | 6 +-- libretroshare/src/gxstunnel/p3gxstunnel.h | 6 +-- .../src/gxstunnel/rsgxstunnelitems.cc | 6 +-- .../src/gxstunnel/rsgxstunnelitems.h | 6 +-- libretroshare/src/libretroshare.pro | 6 +-- libretroshare/src/pgp/pgpauxutils.cc | 6 +-- libretroshare/src/pgp/pgpauxutils.h | 6 +-- libretroshare/src/pgp/pgphandler.cc | 6 +-- libretroshare/src/pgp/pgphandler.h | 6 +-- libretroshare/src/pgp/pgpkeyutil.cc | 6 +-- libretroshare/src/pgp/pgpkeyutil.h | 6 +-- libretroshare/src/pgp/rscertificate.cc | 6 +-- libretroshare/src/pgp/rscertificate.h | 6 +-- libretroshare/src/plugins/dlfcn_win32.cc | 6 +-- libretroshare/src/plugins/dlfcn_win32.h | 6 +-- libretroshare/src/plugins/pluginmanager.cc | 6 +-- libretroshare/src/plugins/pluginmanager.h | 6 +-- libretroshare/src/pqi/authgpg.cc | 6 +-- libretroshare/src/pqi/authgpg.h | 6 +-- libretroshare/src/pqi/authssl.cc | 6 +-- libretroshare/src/pqi/authssl.h | 6 +-- libretroshare/src/pqi/p3cfgmgr.cc | 6 +-- libretroshare/src/pqi/p3cfgmgr.h | 35 ++----------- libretroshare/src/pqi/p3historymgr.cc | 46 ++++++++--------- libretroshare/src/pqi/p3historymgr.h | 46 ++++++++--------- libretroshare/src/pqi/p3linkmgr.cc | 48 ++++++++---------- libretroshare/src/pqi/p3linkmgr.h | 46 ++++++++--------- libretroshare/src/pqi/p3netmgr.cc | 48 ++++++++---------- libretroshare/src/pqi/p3netmgr.h | 46 ++++++++--------- libretroshare/src/pqi/p3notify.cc | 47 ++++++++--------- libretroshare/src/pqi/p3notify.h | 46 ++++++++--------- libretroshare/src/pqi/p3peermgr.cc | 48 ++++++++---------- libretroshare/src/pqi/p3peermgr.h | 46 ++++++++--------- libretroshare/src/pqi/p3servicecontrol.cc | 46 ++++++++--------- libretroshare/src/pqi/p3servicecontrol.h | 47 ++++++++--------- libretroshare/src/pqi/p3upnpmgr.h | 47 ++++++++--------- libretroshare/src/pqi/pqi.h | 47 ++++++++--------- libretroshare/src/pqi/pqi_base.h | 48 ++++++++---------- libretroshare/src/pqi/pqiarchive.cc | 45 ++++++++--------- libretroshare/src/pqi/pqiarchive.h | 46 ++++++++--------- libretroshare/src/pqi/pqiassist.h | 47 ++++++++--------- libretroshare/src/pqi/pqibin.cc | 46 ++++++++--------- libretroshare/src/pqi/pqibin.h | 48 ++++++++---------- libretroshare/src/pqi/pqihandler.cc | 46 ++++++++--------- libretroshare/src/pqi/pqihandler.h | 46 ++++++++--------- libretroshare/src/pqi/pqihash.h | 46 ++++++++--------- libretroshare/src/pqi/pqiindic.h | 48 ++++++++---------- libretroshare/src/pqi/pqiipset.cc | 46 ++++++++--------- libretroshare/src/pqi/pqiipset.h | 46 ++++++++--------- libretroshare/src/pqi/pqilistener.h | 46 ++++++++--------- libretroshare/src/pqi/pqiloopback.cc | 46 ++++++++--------- libretroshare/src/pqi/pqiloopback.h | 46 ++++++++--------- libretroshare/src/pqi/pqimonitor.cc | 46 ++++++++--------- libretroshare/src/pqi/pqimonitor.h | 45 ++++++++--------- libretroshare/src/pqi/pqinetstatebox.cc | 21 ++++++++ libretroshare/src/pqi/pqinetstatebox.h | 21 ++++++++ libretroshare/src/pqi/pqinetwork.cc | 48 ++++++++---------- libretroshare/src/pqi/pqinetwork.h | 49 ++++++++---------- libretroshare/src/pqi/pqiperson.cc | 46 ++++++++--------- libretroshare/src/pqi/pqiperson.h | 48 ++++++++---------- libretroshare/src/pqi/pqipersongrp.cc | 46 ++++++++--------- libretroshare/src/pqi/pqipersongrp.h | 47 ++++++++--------- libretroshare/src/pqi/pqiqos.cc | 21 ++++++++ libretroshare/src/pqi/pqiqos.h | 45 ++++++++--------- libretroshare/src/pqi/pqiqosstreamer.cc | 46 ++++++++--------- libretroshare/src/pqi/pqiqosstreamer.h | 46 ++++++++--------- libretroshare/src/pqi/pqiservice.cc | 46 ++++++++--------- libretroshare/src/pqi/pqiservice.h | 47 ++++++++--------- libretroshare/src/pqi/pqissl.cc | 48 ++++++++---------- libretroshare/src/pqi/pqissl.h | 50 ++++++++----------- libretroshare/src/pqi/pqissli2pbob.cpp | 21 ++++++++ libretroshare/src/pqi/pqissli2pbob.h | 21 ++++++++ libretroshare/src/pqi/pqissllistener.cc | 48 ++++++++---------- libretroshare/src/pqi/pqissllistener.h | 48 ++++++++---------- libretroshare/src/pqi/pqisslpersongrp.cc | 46 ++++++++--------- libretroshare/src/pqi/pqisslpersongrp.h | 48 ++++++++---------- libretroshare/src/pqi/pqisslproxy.cc | 48 ++++++++---------- libretroshare/src/pqi/pqisslproxy.h | 48 ++++++++---------- libretroshare/src/pqi/pqissludp.cc | 46 ++++++++--------- libretroshare/src/pqi/pqissludp.h | 48 ++++++++---------- libretroshare/src/pqi/pqistore.cc | 48 ++++++++---------- libretroshare/src/pqi/pqistore.h | 48 ++++++++---------- libretroshare/src/pqi/pqistreamer.cc | 47 ++++++++--------- libretroshare/src/pqi/pqistreamer.h | 47 ++++++++--------- libretroshare/src/pqi/pqithreadstreamer.cc | 47 ++++++++--------- libretroshare/src/pqi/pqithreadstreamer.h | 46 ++++++++--------- libretroshare/src/pqi/sslfns.cc | 45 ++++++++--------- libretroshare/src/pqi/sslfns.h | 48 ++++++++---------- libretroshare/src/use_libretroshare.pri | 6 +-- openpgpsdk/src/use_openpgpsdk.pri | 6 +-- retroshare.pri | 6 +-- 181 files changed, 1759 insertions(+), 1961 deletions(-) diff --git a/libbitdht/src/use_libbitdht.pri b/libbitdht/src/use_libbitdht.pri index 086f16a89..a31c0d452 100644 --- a/libbitdht/src/use_libbitdht.pri +++ b/libbitdht/src/use_libbitdht.pri @@ -3,16 +3,16 @@ # Copyright (C) 2018, Retroshare team # # # # This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # +# it under the terms of the GNU Lesser General Public License as # # published by the Free Software Foundation, either version 3 of the # # License, or (at your option) any later version. # # # # This program 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 Affero General Public License for more details. # +# GNU Lesser General Public License for more details. # # # -# You should have received a copy of the GNU Affero General Public License # +# You should have received a copy of the GNU Lesser General Public License # # along with this program. If not, see . # ################################################################################ diff --git a/libretroshare/src/chat/distantchat.cc b/libretroshare/src/chat/distantchat.cc index a6ba359e2..b6da39fe8 100644 --- a/libretroshare/src/chat/distantchat.cc +++ b/libretroshare/src/chat/distantchat.cc @@ -6,16 +6,16 @@ * Copyright 2014 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/distantchat.h b/libretroshare/src/chat/distantchat.h index 25896c4b8..196c1079f 100644 --- a/libretroshare/src/chat/distantchat.h +++ b/libretroshare/src/chat/distantchat.h @@ -6,16 +6,16 @@ * Copyright 2014 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index fce60a65a..0c7a765de 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -6,16 +6,16 @@ * Copyright 2014 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/distributedchat.h b/libretroshare/src/chat/distributedchat.h index 69168ce01..f0db7f649 100644 --- a/libretroshare/src/chat/distributedchat.h +++ b/libretroshare/src/chat/distributedchat.h @@ -6,16 +6,16 @@ * Copyright 2014 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/p3chatservice.cc b/libretroshare/src/chat/p3chatservice.cc index 71edc4898..77fb91bea 100644 --- a/libretroshare/src/chat/p3chatservice.cc +++ b/libretroshare/src/chat/p3chatservice.cc @@ -6,16 +6,16 @@ * Copyright 2004-2008 by Robert Fernie. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/p3chatservice.h b/libretroshare/src/chat/p3chatservice.h index e6b66ec35..3a5b08ab9 100644 --- a/libretroshare/src/chat/p3chatservice.h +++ b/libretroshare/src/chat/p3chatservice.h @@ -6,16 +6,16 @@ * Copyright 2004-2008 by Robert Fernie. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/rschatitems.cc b/libretroshare/src/chat/rschatitems.cc index 17bfce1ec..bd79f6821 100644 --- a/libretroshare/src/chat/rschatitems.cc +++ b/libretroshare/src/chat/rschatitems.cc @@ -6,16 +6,16 @@ * Copyright 2007-2008 by Robert Fernie. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/chat/rschatitems.h b/libretroshare/src/chat/rschatitems.h index 064044f1a..f2ca0731d 100644 --- a/libretroshare/src/chat/rschatitems.h +++ b/libretroshare/src/chat/rschatitems.h @@ -6,16 +6,16 @@ * Copyright 2007-2008 by Robert Fernie. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/crypto/chacha20.h b/libretroshare/src/crypto/chacha20.h index 1ecf05411..1b19a1402 100644 --- a/libretroshare/src/crypto/chacha20.h +++ b/libretroshare/src/crypto/chacha20.h @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/crypto/hashstream.cc b/libretroshare/src/crypto/hashstream.cc index 22bb64059..88709acfc 100644 --- a/libretroshare/src/crypto/hashstream.cc +++ b/libretroshare/src/crypto/hashstream.cc @@ -6,16 +6,16 @@ * Copyright 2018 by Retroshare Team * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/crypto/hashstream.h b/libretroshare/src/crypto/hashstream.h index 5714b6816..fe276b6b4 100644 --- a/libretroshare/src/crypto/hashstream.h +++ b/libretroshare/src/crypto/hashstream.h @@ -6,16 +6,16 @@ * Copyright 2018 by Retroshare Team * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/dht/connectstatebox.cc b/libretroshare/src/dht/connectstatebox.cc index 7ca107fa9..a5b0d44cb 100644 --- a/libretroshare/src/dht/connectstatebox.cc +++ b/libretroshare/src/dht/connectstatebox.cc @@ -6,16 +6,16 @@ * Copyright 2011-2011 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/dht/connectstatebox.h b/libretroshare/src/dht/connectstatebox.h index 5eac8b6c8..15334c284 100644 --- a/libretroshare/src/dht/connectstatebox.h +++ b/libretroshare/src/dht/connectstatebox.h @@ -6,16 +6,16 @@ * Copyright 2011-2011 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/dht/p3bitdht.cc b/libretroshare/src/dht/p3bitdht.cc index b7320c0ac..a1fed1824 100644 --- a/libretroshare/src/dht/p3bitdht.cc +++ b/libretroshare/src/dht/p3bitdht.cc @@ -6,16 +6,16 @@ * Copyright 2009-2010 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/dht/p3bitdht.h b/libretroshare/src/dht/p3bitdht.h index 09fcd7263..2935fcf16 100644 --- a/libretroshare/src/dht/p3bitdht.h +++ b/libretroshare/src/dht/p3bitdht.h @@ -6,16 +6,16 @@ * Copyright 2009-2010 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/dht/stunaddrassist.h b/libretroshare/src/dht/stunaddrassist.h index e12f64f73..195337b1a 100644 --- a/libretroshare/src/dht/stunaddrassist.h +++ b/libretroshare/src/dht/stunaddrassist.h @@ -6,16 +6,16 @@ * Copyright 2011-2011 by Robert Fernie. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/dir_hierarchy.cc b/libretroshare/src/file_sharing/dir_hierarchy.cc index 46ddd0164..743176e38 100644 --- a/libretroshare/src/file_sharing/dir_hierarchy.cc +++ b/libretroshare/src/file_sharing/dir_hierarchy.cc @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/dir_hierarchy.h b/libretroshare/src/file_sharing/dir_hierarchy.h index 30b30760e..50b8217b0 100644 --- a/libretroshare/src/file_sharing/dir_hierarchy.h +++ b/libretroshare/src/file_sharing/dir_hierarchy.h @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/directory_storage.cc b/libretroshare/src/file_sharing/directory_storage.cc index abcd4cc00..a0164a94b 100644 --- a/libretroshare/src/file_sharing/directory_storage.cc +++ b/libretroshare/src/file_sharing/directory_storage.cc @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/directory_storage.h b/libretroshare/src/file_sharing/directory_storage.h index 51f3edabe..e7c4d14b7 100644 --- a/libretroshare/src/file_sharing/directory_storage.h +++ b/libretroshare/src/file_sharing/directory_storage.h @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/directory_updater.cc b/libretroshare/src/file_sharing/directory_updater.cc index ba600224b..3bf125839 100644 --- a/libretroshare/src/file_sharing/directory_updater.cc +++ b/libretroshare/src/file_sharing/directory_updater.cc @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/directory_updater.h b/libretroshare/src/file_sharing/directory_updater.h index e518ee80c..366e1330e 100644 --- a/libretroshare/src/file_sharing/directory_updater.h +++ b/libretroshare/src/file_sharing/directory_updater.h @@ -6,16 +6,16 @@ * Copyright 2016 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/file_sharing_defaults.h b/libretroshare/src/file_sharing/file_sharing_defaults.h index 8de4b31c8..09bf937d5 100644 --- a/libretroshare/src/file_sharing/file_sharing_defaults.h +++ b/libretroshare/src/file_sharing/file_sharing_defaults.h @@ -1,29 +1,24 @@ -/* - * RetroShare C++ File sharing default variables - * - * file_sharing/file_sharing_defaults.h - * - * Copyright 2016 by Mr.Alice - * - * 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.project@gmail.com". - * - */ - - +/******************************************************************************* + * libretroshare/src/file_sharing: file_sharing_defaults.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Mr.Alice * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ #pragma once static const uint32_t DELAY_BETWEEN_DIRECTORY_UPDATES = 600 ; // 10 minutes diff --git a/libretroshare/src/file_sharing/file_tree.cc b/libretroshare/src/file_sharing/file_tree.cc index 76ce41651..e96217804 100644 --- a/libretroshare/src/file_sharing/file_tree.cc +++ b/libretroshare/src/file_sharing/file_tree.cc @@ -6,16 +6,16 @@ * Copyright 2018 by Retroshare Team * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/file_tree.h b/libretroshare/src/file_sharing/file_tree.h index 37f64c776..c5328a6df 100644 --- a/libretroshare/src/file_sharing/file_tree.h +++ b/libretroshare/src/file_sharing/file_tree.h @@ -6,16 +6,16 @@ * Copyright 2018 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/filelist_io.cc b/libretroshare/src/file_sharing/filelist_io.cc index 51cec3c92..a8bb35a9d 100644 --- a/libretroshare/src/file_sharing/filelist_io.cc +++ b/libretroshare/src/file_sharing/filelist_io.cc @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/filelist_io.h b/libretroshare/src/file_sharing/filelist_io.h index bda8e089a..65863ffd0 100644 --- a/libretroshare/src/file_sharing/filelist_io.h +++ b/libretroshare/src/file_sharing/filelist_io.h @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/hash_cache.cc b/libretroshare/src/file_sharing/hash_cache.cc index 8db7b3ed4..c67216e86 100644 --- a/libretroshare/src/file_sharing/hash_cache.cc +++ b/libretroshare/src/file_sharing/hash_cache.cc @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/hash_cache.h b/libretroshare/src/file_sharing/hash_cache.h index de4b32943..f9123b998 100644 --- a/libretroshare/src/file_sharing/hash_cache.h +++ b/libretroshare/src/file_sharing/hash_cache.h @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 01ae6034e..9458643f1 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index e285a4e23..44e5ec4b4 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/rsfilelistitems.cc b/libretroshare/src/file_sharing/rsfilelistitems.cc index 77628777c..49aa4edff 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.cc +++ b/libretroshare/src/file_sharing/rsfilelistitems.cc @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/file_sharing/rsfilelistitems.h b/libretroshare/src/file_sharing/rsfilelistitems.h index eaadaf7bd..337bde15f 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.h +++ b/libretroshare/src/file_sharing/rsfilelistitems.h @@ -6,16 +6,16 @@ * Copyright 2018 by Mr.Alice * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/ft/ftchunkmap.cc b/libretroshare/src/ft/ftchunkmap.cc index b7630ccb2..93a9a590c 100644 --- a/libretroshare/src/ft/ftchunkmap.cc +++ b/libretroshare/src/ft/ftchunkmap.cc @@ -6,16 +6,16 @@ * Copyright 2010 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/ft/ftchunkmap.h b/libretroshare/src/ft/ftchunkmap.h index f6364596c..a9307b966 100644 --- a/libretroshare/src/ft/ftchunkmap.h +++ b/libretroshare/src/ft/ftchunkmap.h @@ -6,16 +6,16 @@ * Copyright 2010 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * ******************************************************************************/ diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index c80712d23..bb0a56588 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftcontroller.h b/libretroshare/src/ft/ftcontroller.h index 8499f1e5b..6564ae7be 100644 --- a/libretroshare/src/ft/ftcontroller.h +++ b/libretroshare/src/ft/ftcontroller.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftdata.h b/libretroshare/src/ft/ftdata.h index b66b32fc2..349dae521 100644 --- a/libretroshare/src/ft/ftdata.h +++ b/libretroshare/src/ft/ftdata.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftdatamultiplex.cc b/libretroshare/src/ft/ftdatamultiplex.cc index 7800468d0..56cdd9f52 100644 --- a/libretroshare/src/ft/ftdatamultiplex.cc +++ b/libretroshare/src/ft/ftdatamultiplex.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftdatamultiplex.h b/libretroshare/src/ft/ftdatamultiplex.h index 4bb8c3109..57acda1f2 100644 --- a/libretroshare/src/ft/ftdatamultiplex.h +++ b/libretroshare/src/ft/ftdatamultiplex.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftextralist.cc b/libretroshare/src/ft/ftextralist.cc index d2c70b3d9..cf5a4f603 100644 --- a/libretroshare/src/ft/ftextralist.cc +++ b/libretroshare/src/ft/ftextralist.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftextralist.h b/libretroshare/src/ft/ftextralist.h index e148a505f..5832b33fd 100644 --- a/libretroshare/src/ft/ftextralist.h +++ b/libretroshare/src/ft/ftextralist.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftfilecreator.cc b/libretroshare/src/ft/ftfilecreator.cc index 69e7b9cf8..fc25fe426 100644 --- a/libretroshare/src/ft/ftfilecreator.cc +++ b/libretroshare/src/ft/ftfilecreator.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Retroshare Team * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftfilecreator.h b/libretroshare/src/ft/ftfilecreator.h index b0461524d..004558307 100644 --- a/libretroshare/src/ft/ftfilecreator.h +++ b/libretroshare/src/ft/ftfilecreator.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftfileprovider.cc b/libretroshare/src/ft/ftfileprovider.cc index 44fbe7945..543464515 100644 --- a/libretroshare/src/ft/ftfileprovider.cc +++ b/libretroshare/src/ft/ftfileprovider.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftfileprovider.h b/libretroshare/src/ft/ftfileprovider.h index eedda8693..f0d9d60d1 100644 --- a/libretroshare/src/ft/ftfileprovider.h +++ b/libretroshare/src/ft/ftfileprovider.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftfilesearch.cc b/libretroshare/src/ft/ftfilesearch.cc index ed021e66d..c9571f9a8 100644 --- a/libretroshare/src/ft/ftfilesearch.cc +++ b/libretroshare/src/ft/ftfilesearch.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftfilesearch.h b/libretroshare/src/ft/ftfilesearch.h index f4b4e8abe..46c11d33c 100644 --- a/libretroshare/src/ft/ftfilesearch.h +++ b/libretroshare/src/ft/ftfilesearch.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftsearch.h b/libretroshare/src/ft/ftsearch.h index 710e3ee92..7906d275f 100644 --- a/libretroshare/src/ft/ftsearch.h +++ b/libretroshare/src/ft/ftsearch.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/ft: ftsearch.h - * - * File Transfer for RetroShare. - * - * Copyright 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". - * - */ - +/******************************************************************************* + * libretroshare/src/ft: ftsearch.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FT_SEARCH_HEADER #define FT_SEARCH_HEADER diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index e24f75a2c..1a8b40c87 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 541db6e68..f21d154bc 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/fttransfermodule.cc b/libretroshare/src/ft/fttransfermodule.cc index 9559bcb0a..136be4653 100644 --- a/libretroshare/src/ft/fttransfermodule.cc +++ b/libretroshare/src/ft/fttransfermodule.cc @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/fttransfermodule.h b/libretroshare/src/ft/fttransfermodule.h index 52e015c90..9999cbdc1 100644 --- a/libretroshare/src/ft/fttransfermodule.h +++ b/libretroshare/src/ft/fttransfermodule.h @@ -6,16 +6,16 @@ * Copyright 2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftturtlefiletransferitem.cc b/libretroshare/src/ft/ftturtlefiletransferitem.cc index d3c4e7ac6..14150e42d 100644 --- a/libretroshare/src/ft/ftturtlefiletransferitem.cc +++ b/libretroshare/src/ft/ftturtlefiletransferitem.cc @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/ft/ftturtlefiletransferitem.h b/libretroshare/src/ft/ftturtlefiletransferitem.h index 211884932..6bbc24aef 100644 --- a/libretroshare/src/ft/ftturtlefiletransferitem.h +++ b/libretroshare/src/ft/ftturtlefiletransferitem.h @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/grouter/groutercache.h b/libretroshare/src/grouter/groutercache.h index d969bfda9..e406976b8 100644 --- a/libretroshare/src/grouter/groutercache.h +++ b/libretroshare/src/grouter/groutercache.h @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/grouter/grouteritems.cc b/libretroshare/src/grouter/grouteritems.cc index 7738a175d..1e098de00 100644 --- a/libretroshare/src/grouter/grouteritems.cc +++ b/libretroshare/src/grouter/grouteritems.cc @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/grouter/grouteritems.h b/libretroshare/src/grouter/grouteritems.h index 312dfad99..43b69be7d 100644 --- a/libretroshare/src/grouter/grouteritems.h +++ b/libretroshare/src/grouter/grouteritems.h @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/grouter/groutertypes.h b/libretroshare/src/grouter/groutertypes.h index c19fa55ee..ee1bda7dc 100644 --- a/libretroshare/src/grouter/groutertypes.h +++ b/libretroshare/src/grouter/groutertypes.h @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/grouter/p3grouter.cc b/libretroshare/src/grouter/p3grouter.cc index 48966db2f..de5cd0d11 100644 --- a/libretroshare/src/grouter/p3grouter.cc +++ b/libretroshare/src/grouter/p3grouter.cc @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/grouter/p3grouter.h b/libretroshare/src/grouter/p3grouter.h index 7d20f522b..a981a8dbc 100644 --- a/libretroshare/src/grouter/p3grouter.h +++ b/libretroshare/src/grouter/p3grouter.h @@ -6,16 +6,16 @@ * Copyright 2013 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/gxssecurity.cc b/libretroshare/src/gxs/gxssecurity.cc index 153431c56..608e938fc 100644 --- a/libretroshare/src/gxs/gxssecurity.cc +++ b/libretroshare/src/gxs/gxssecurity.cc @@ -7,16 +7,16 @@ * 2011-2012 Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/gxssecurity.h b/libretroshare/src/gxs/gxssecurity.h index ebbf3ba4c..7b607c916 100644 --- a/libretroshare/src/gxs/gxssecurity.h +++ b/libretroshare/src/gxs/gxssecurity.h @@ -7,16 +7,16 @@ * 2011-2012 Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/gxstokenqueue.cc b/libretroshare/src/gxs/gxstokenqueue.cc index 64d1ec9db..568daf88a 100644 --- a/libretroshare/src/gxs/gxstokenqueue.cc +++ b/libretroshare/src/gxs/gxstokenqueue.cc @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/gxstokenqueue.h b/libretroshare/src/gxs/gxstokenqueue.h index 0ea43d345..0b58f7c3d 100644 --- a/libretroshare/src/gxs/gxstokenqueue.h +++ b/libretroshare/src/gxs/gxstokenqueue.h @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index 3c2e48021..e618c91f2 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -6,16 +6,16 @@ * Copyright 2011-2011 by Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsdataservice.h b/libretroshare/src/gxs/rsdataservice.h index 4fa5c866f..a99847304 100644 --- a/libretroshare/src/gxs/rsdataservice.h +++ b/libretroshare/src/gxs/rsdataservice.h @@ -6,16 +6,16 @@ * Copyright 2011-2012 by Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgds.h b/libretroshare/src/gxs/rsgds.h index 9c23d920e..5c326f1cc 100644 --- a/libretroshare/src/gxs/rsgds.h +++ b/libretroshare/src/gxs/rsgds.h @@ -6,16 +6,16 @@ * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index fe3781e85..bf770e1ca 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Robert Fernie, Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 8a8af9444..c841dc3d3 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Robert Fernie, Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgixs.h b/libretroshare/src/gxs/rsgixs.h index 21a4cf1c4..98b99be54 100644 --- a/libretroshare/src/gxs/rsgixs.h +++ b/libretroshare/src/gxs/rsgixs.h @@ -6,16 +6,16 @@ * Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxs.h b/libretroshare/src/gxs/rsgxs.h index 0719d6109..3f25b087b 100644 --- a/libretroshare/src/gxs/rsgxs.h +++ b/libretroshare/src/gxs/rsgxs.h @@ -6,16 +6,16 @@ * Copyright 2012 Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsdata.cc b/libretroshare/src/gxs/rsgxsdata.cc index b69606f72..0ec61de8e 100644 --- a/libretroshare/src/gxs/rsgxsdata.cc +++ b/libretroshare/src/gxs/rsgxsdata.cc @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsdata.h b/libretroshare/src/gxs/rsgxsdata.h index c1d6becc4..fffcfbe6a 100644 --- a/libretroshare/src/gxs/rsgxsdata.h +++ b/libretroshare/src/gxs/rsgxsdata.h @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 383fcf840..cb84b27b9 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -6,16 +6,16 @@ * Copyright 2012-2013 by Christopher Evi-Parker, Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsdataaccess.h b/libretroshare/src/gxs/rsgxsdataaccess.h index 741a3b78d..2849af07d 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.h +++ b/libretroshare/src/gxs/rsgxsdataaccess.h @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index eff91a417..fe2ce1dd9 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 9ec6bdf9b..509ce5cdc 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsnetutils.cc b/libretroshare/src/gxs/rsgxsnetutils.cc index 4796cffd6..7195ff519 100644 --- a/libretroshare/src/gxs/rsgxsnetutils.cc +++ b/libretroshare/src/gxs/rsgxsnetutils.cc @@ -6,16 +6,16 @@ * Copyright 2012-2013 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsnetutils.h b/libretroshare/src/gxs/rsgxsnetutils.h index 39d9a6112..90ab64cf9 100644 --- a/libretroshare/src/gxs/rsgxsnetutils.h +++ b/libretroshare/src/gxs/rsgxsnetutils.h @@ -6,16 +6,16 @@ * Copyright 2012-2013 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsrequesttypes.cc b/libretroshare/src/gxs/rsgxsrequesttypes.cc index 57fff5143..d57b4d353 100644 --- a/libretroshare/src/gxs/rsgxsrequesttypes.cc +++ b/libretroshare/src/gxs/rsgxsrequesttypes.cc @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsrequesttypes.h b/libretroshare/src/gxs/rsgxsrequesttypes.h index 72138e801..aa485edbb 100644 --- a/libretroshare/src/gxs/rsgxsrequesttypes.h +++ b/libretroshare/src/gxs/rsgxsrequesttypes.h @@ -6,16 +6,16 @@ * Copyright 2012-2012 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index b6e26e6e3..149bd3128 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -6,16 +6,16 @@ * Copyright 2013-2013 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsgxsutil.h b/libretroshare/src/gxs/rsgxsutil.h index 67c384cfc..3fc7f8508 100644 --- a/libretroshare/src/gxs/rsgxsutil.h +++ b/libretroshare/src/gxs/rsgxsutil.h @@ -6,16 +6,16 @@ * Copyright 2013-2013 by Christopher Evi-Parker * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index 90c306129..4404ee806 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -6,16 +6,16 @@ * Copyright 2011-2012 by Robert Fernie, Evi-Parker Christopher * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstrans/p3gxstrans.cc b/libretroshare/src/gxstrans/p3gxstrans.cc index 373f0bc1c..0efa7e578 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.cc +++ b/libretroshare/src/gxstrans/p3gxstrans.cc @@ -6,16 +6,16 @@ * Copyright (C) 2016-2017 Gioacchino Mazzurco * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstrans/p3gxstrans.h b/libretroshare/src/gxstrans/p3gxstrans.h index efddf9929..2b5abdead 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.h +++ b/libretroshare/src/gxstrans/p3gxstrans.h @@ -6,16 +6,16 @@ * Copyright (C) 2016-2017 Gioacchino Mazzurco * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstrans/p3gxstransitems.cc b/libretroshare/src/gxstrans/p3gxstransitems.cc index 20fc85540..733d40bec 100644 --- a/libretroshare/src/gxstrans/p3gxstransitems.cc +++ b/libretroshare/src/gxstrans/p3gxstransitems.cc @@ -6,16 +6,16 @@ * Copyright (C) 2016-2018 Gioacchino Mazzurco * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstrans/p3gxstransitems.h b/libretroshare/src/gxstrans/p3gxstransitems.h index 63b4792a5..cc7322844 100644 --- a/libretroshare/src/gxstrans/p3gxstransitems.h +++ b/libretroshare/src/gxstrans/p3gxstransitems.h @@ -6,16 +6,16 @@ * Copyright (C) 2016-2017 Gioacchino Mazzurco * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index d9b7afd97..7fd417549 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -6,16 +6,16 @@ * Copyright 2015 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.h b/libretroshare/src/gxstunnel/p3gxstunnel.h index 4284ba64d..c5f709707 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.h +++ b/libretroshare/src/gxstunnel/p3gxstunnel.h @@ -6,16 +6,16 @@ * Copyright 2015 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstunnel/rsgxstunnelitems.cc b/libretroshare/src/gxstunnel/rsgxstunnelitems.cc index 0569337ac..a86625f0f 100644 --- a/libretroshare/src/gxstunnel/rsgxstunnelitems.cc +++ b/libretroshare/src/gxstunnel/rsgxstunnelitems.cc @@ -6,16 +6,16 @@ * Copyright 2015 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/gxstunnel/rsgxstunnelitems.h b/libretroshare/src/gxstunnel/rsgxstunnelitems.h index eea267503..a098c8c05 100644 --- a/libretroshare/src/gxstunnel/rsgxstunnelitems.h +++ b/libretroshare/src/gxstunnel/rsgxstunnelitems.h @@ -6,16 +6,16 @@ * Copyright 2015 by Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 3e5ead553..f2ef3e4fc 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -3,16 +3,16 @@ # Copyright (C) 2018, Retroshare team # # # # This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # +# it under the terms of the GNU Lesser General Public License as # # published by the Free Software Foundation, either version 3 of the # # License, or (at your option) any later version. # # # # This program 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 Affero General Public License for more details. # +# GNU Lesser General Public License for more details. # # # -# You should have received a copy of the GNU Affero General Public License # +# You should have received a copy of the GNU Lesser General Public License # # along with this program. If not, see . # ################################################################################ !include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri") diff --git a/libretroshare/src/pgp/pgpauxutils.cc b/libretroshare/src/pgp/pgpauxutils.cc index ff69f1a1a..abf92e5ac 100644 --- a/libretroshare/src/pgp/pgpauxutils.cc +++ b/libretroshare/src/pgp/pgpauxutils.cc @@ -6,16 +6,16 @@ * Copyright 2014 Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/pgpauxutils.h b/libretroshare/src/pgp/pgpauxutils.h index ff16caf92..6ead67a2d 100644 --- a/libretroshare/src/pgp/pgpauxutils.h +++ b/libretroshare/src/pgp/pgpauxutils.h @@ -6,16 +6,16 @@ * Copyright 2014 Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/pgphandler.cc b/libretroshare/src/pgp/pgphandler.cc index 5b8bddf43..709231f20 100644 --- a/libretroshare/src/pgp/pgphandler.cc +++ b/libretroshare/src/pgp/pgphandler.cc @@ -6,16 +6,16 @@ * Copyright 2018 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/pgphandler.h b/libretroshare/src/pgp/pgphandler.h index 2210611fe..9fe4abfbb 100644 --- a/libretroshare/src/pgp/pgphandler.h +++ b/libretroshare/src/pgp/pgphandler.h @@ -6,16 +6,16 @@ * Copyright 2018 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/pgpkeyutil.cc b/libretroshare/src/pgp/pgpkeyutil.cc index ca02a4f14..e8f1f1d5b 100644 --- a/libretroshare/src/pgp/pgpkeyutil.cc +++ b/libretroshare/src/pgp/pgpkeyutil.cc @@ -6,16 +6,16 @@ * Copyright 2018 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/pgpkeyutil.h b/libretroshare/src/pgp/pgpkeyutil.h index d117b010c..38a02dedf 100644 --- a/libretroshare/src/pgp/pgpkeyutil.h +++ b/libretroshare/src/pgp/pgpkeyutil.h @@ -6,16 +6,16 @@ * Copyright 2012 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/rscertificate.cc b/libretroshare/src/pgp/rscertificate.cc index 5eaadfbea..88424fa29 100644 --- a/libretroshare/src/pgp/rscertificate.cc +++ b/libretroshare/src/pgp/rscertificate.cc @@ -6,16 +6,16 @@ * Copyright 2016 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pgp/rscertificate.h b/libretroshare/src/pgp/rscertificate.h index 8b82b2cfa..4dda06789 100644 --- a/libretroshare/src/pgp/rscertificate.h +++ b/libretroshare/src/pgp/rscertificate.h @@ -6,16 +6,16 @@ * Copyright 2016 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/plugins/dlfcn_win32.cc b/libretroshare/src/plugins/dlfcn_win32.cc index 3677a4706..83404e965 100644 --- a/libretroshare/src/plugins/dlfcn_win32.cc +++ b/libretroshare/src/plugins/dlfcn_win32.cc @@ -6,16 +6,16 @@ * Copyright 2007 Ramiro Polla * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/plugins/dlfcn_win32.h b/libretroshare/src/plugins/dlfcn_win32.h index 0b21e9e53..3298777dd 100644 --- a/libretroshare/src/plugins/dlfcn_win32.h +++ b/libretroshare/src/plugins/dlfcn_win32.h @@ -6,16 +6,16 @@ * Copyright 2007 Ramiro Polla * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/plugins/pluginmanager.cc b/libretroshare/src/plugins/pluginmanager.cc index b8f6fdcec..ea3a72932 100644 --- a/libretroshare/src/plugins/pluginmanager.cc +++ b/libretroshare/src/plugins/pluginmanager.cc @@ -6,16 +6,16 @@ * Copyright 2012 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/plugins/pluginmanager.h b/libretroshare/src/plugins/pluginmanager.h index 540068428..021a80463 100644 --- a/libretroshare/src/plugins/pluginmanager.h +++ b/libretroshare/src/plugins/pluginmanager.h @@ -6,16 +6,16 @@ * Copyright 2012 Cyril Soler * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index 4d7d0f446..2da8275c3 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -6,16 +6,16 @@ * Copyright 2008-2009 by Robert Fernie, Retroshare Team. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pqi/authgpg.h b/libretroshare/src/pqi/authgpg.h index 4f0149908..588148e86 100644 --- a/libretroshare/src/pqi/authgpg.h +++ b/libretroshare/src/pqi/authgpg.h @@ -6,16 +6,16 @@ * Copyright 2008-2009 by Raghu Dev R. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 19201906c..a885c3318 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -6,16 +6,16 @@ * Copyright 2004-2008 by Robert Fernie, Retroshare Team. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pqi/authssl.h b/libretroshare/src/pqi/authssl.h index c0ea77449..e6dd33078 100644 --- a/libretroshare/src/pqi/authssl.h +++ b/libretroshare/src/pqi/authssl.h @@ -6,16 +6,16 @@ * Copyright 2004-2008 by Robert Fernie, Retroshare Team. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pqi/p3cfgmgr.cc b/libretroshare/src/pqi/p3cfgmgr.cc index 0182303eb..d601c460e 100644 --- a/libretroshare/src/pqi/p3cfgmgr.cc +++ b/libretroshare/src/pqi/p3cfgmgr.cc @@ -6,16 +6,16 @@ * Copyright 2007-2008 by Robert Fernie, Retroshare Team. * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ diff --git a/libretroshare/src/pqi/p3cfgmgr.h b/libretroshare/src/pqi/p3cfgmgr.h index 91de5136a..b1e554c98 100644 --- a/libretroshare/src/pqi/p3cfgmgr.h +++ b/libretroshare/src/pqi/p3cfgmgr.h @@ -3,49 +3,22 @@ * * * libretroshare: retroshare core library * * * - * Copyright 2004-2008 by Robert Fernie, Retroshare Team. * + * Copyright 2004-2008 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * + * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program 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 Affero General Public License for more details. * + * GNU Lesser General Public License for more details. * * * - * You should have received a copy of the GNU Affero General Public License * + * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see . * * * *******************************************************************************/ -/* - * libretroshare/src/pqi: p3cfgmgr.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-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 P3_CONFIG_MGR_HEADER #define P3_CONFIG_MGR_HEADER diff --git a/libretroshare/src/pqi/p3historymgr.cc b/libretroshare/src/pqi/p3historymgr.cc index e1acb0888..00b36a505 100644 --- a/libretroshare/src/pqi/p3historymgr.cc +++ b/libretroshare/src/pqi/p3historymgr.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3HistoryMgr.cc - * - * RetroShare C++ . - * - * Copyright 2011 by Thunder. - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3historymgr.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Thunder. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "p3historymgr.h" diff --git a/libretroshare/src/pqi/p3historymgr.h b/libretroshare/src/pqi/p3historymgr.h index 3f3c9a6f1..897688fa8 100644 --- a/libretroshare/src/pqi/p3historymgr.h +++ b/libretroshare/src/pqi/p3historymgr.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/pqi: p3historymgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Thunder. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_P3_HISTORY_MGR_H #define RS_P3_HISTORY_MGR_H -/* - * libretroshare/src/services: p3historymgr.h - * - * RetroShare C++ - * - * Copyright 2011 by Thunder. - * - * 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 #include diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc index 302efd255..c380c205b 100644 --- a/libretroshare/src/pqi/p3linkmgr.cc +++ b/libretroshare/src/pqi/p3linkmgr.cc @@ -1,29 +1,25 @@ -/* - * libretroshare/src/pqi: p3linkmgr.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright (C) 2007-2011 Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3linkmgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2011 by Robert Fernie. * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/p3linkmgr.h" #include "pqi/p3peermgr.h" diff --git a/libretroshare/src/pqi/p3linkmgr.h b/libretroshare/src/pqi/p3linkmgr.h index 1fee7d6f2..57638c174 100644 --- a/libretroshare/src/pqi/p3linkmgr.h +++ b/libretroshare/src/pqi/p3linkmgr.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: p3linkmgr.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3linkmgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_LINK_MANAGER_HEADER #define MRK_PQI_LINK_MANAGER_HEADER diff --git a/libretroshare/src/pqi/p3netmgr.cc b/libretroshare/src/pqi/p3netmgr.cc index 7ca1713f7..8a98aacb1 100644 --- a/libretroshare/src/pqi/p3netmgr.cc +++ b/libretroshare/src/pqi/p3netmgr.cc @@ -1,29 +1,25 @@ -/* - * libretroshare/src/pqi: p3netmgr.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright (C) 2007-2011 Robert Fernie - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3netmgr.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2011 by Robert Fernie. * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/pqi/p3netmgr.h b/libretroshare/src/pqi/p3netmgr.h index 1b379afec..56e9b1778 100644 --- a/libretroshare/src/pqi/p3netmgr.h +++ b/libretroshare/src/pqi/p3netmgr.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: p3netmgr.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3netmgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_NET_MANAGER_HEADER #define MRK_PQI_NET_MANAGER_HEADER diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index 43caf9758..d86233c68 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src/rsserver: p3notify.cc - * - * RetroShare C++ Interface. - * - * Copyright 2007-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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: p3notify.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2007-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/p3notify.h" #include #include diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index 820c4a6bb..e89481fb9 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/pqi: p3notify.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_P3_NOTIFY_INTERFACE_H #define RS_P3_NOTIFY_INTERFACE_H -/* - * libretroshare/src/rsserver: p3notify.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-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". - * - */ - #include "retroshare/rsnotify.h" #include "retroshare/rsturtle.h" diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index ba3ecbf84..d67e320f1 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -1,29 +1,25 @@ -/* - * libretroshare/src/pqi: p3peermgr.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-2011 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3peermgr.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2007-2011 Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include // for std::vector #include // for std::random_shuffle diff --git a/libretroshare/src/pqi/p3peermgr.h b/libretroshare/src/pqi/p3peermgr.h index 8a0ac5235..dc8a8f41b 100644 --- a/libretroshare/src/pqi/p3peermgr.h +++ b/libretroshare/src/pqi/p3peermgr.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: p3peermgr.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3peermgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_PEER_MANAGER_HEADER #define MRK_PQI_PEER_MANAGER_HEADER diff --git a/libretroshare/src/pqi/p3servicecontrol.cc b/libretroshare/src/pqi/p3servicecontrol.cc index 251777e70..bfcb09031 100644 --- a/libretroshare/src/pqi/p3servicecontrol.cc +++ b/libretroshare/src/pqi/p3servicecontrol.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: p3servicecontrol.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: p3servicecontrol.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2014-2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "p3servicecontrol.h" diff --git a/libretroshare/src/pqi/p3servicecontrol.h b/libretroshare/src/pqi/p3servicecontrol.h index e7f4e5959..6cabf1193 100644 --- a/libretroshare/src/pqi/p3servicecontrol.h +++ b/libretroshare/src/pqi/p3servicecontrol.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi: p3servicecontrol.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2014 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.1 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: p3servicecontrol.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014-2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_SERVICE_CONTROL_HEADER #define P3_SERVICE_CONTROL_HEADER diff --git a/libretroshare/src/pqi/p3upnpmgr.h b/libretroshare/src/pqi/p3upnpmgr.h index 47b95d5cc..6f58aa8ae 100644 --- a/libretroshare/src/pqi/p3upnpmgr.h +++ b/libretroshare/src/pqi/p3upnpmgr.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi: p3upnpmgr.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2007 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: p3upnpmgr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2007 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_P3_UPNP_MANAGER_H #define MRK_P3_UPNP_MANAGER_H diff --git a/libretroshare/src/pqi/pqi.h b/libretroshare/src/pqi/pqi.h index 07cf00f9d..1bf581ff1 100644 --- a/libretroshare/src/pqi/pqi.h +++ b/libretroshare/src/pqi/pqi.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi pqi.h - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqi.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_TOP_HEADER #define PQI_TOP_HEADER diff --git a/libretroshare/src/pqi/pqi_base.h b/libretroshare/src/pqi/pqi_base.h index a7d06c644..0741df1c5 100644 --- a/libretroshare/src/pqi/pqi_base.h +++ b/libretroshare/src/pqi/pqi_base.h @@ -1,30 +1,24 @@ -/* - * "$Id: pqi_base.h,v 1.18 2007-05-05 16:10:05 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqi_base.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_BASE_ITEM_HEADER #define PQI_BASE_ITEM_HEADER diff --git a/libretroshare/src/pqi/pqiarchive.cc b/libretroshare/src/pqi/pqiarchive.cc index e6d3d65e1..195d560ae 100644 --- a/libretroshare/src/pqi/pqiarchive.cc +++ b/libretroshare/src/pqi/pqiarchive.cc @@ -1,27 +1,24 @@ -/* - * "$Id: pqiarchive.cc,v 1.5 2007-03-21 18:45:41 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ +/******************************************************************************* + * libretroshare/src/pqi: pqiarchive.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* This is dependent on the sslroot at the moment. * -> as we need to create/restore references to the Person. diff --git a/libretroshare/src/pqi/pqiarchive.h b/libretroshare/src/pqi/pqiarchive.h index e80d634b0..4c2a82a96 100644 --- a/libretroshare/src/pqi/pqiarchive.h +++ b/libretroshare/src/pqi/pqiarchive.h @@ -1,28 +1,24 @@ -/* - * "$Id: pqiarchive.h,v 1.3 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiarchive.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef SUSPENDED_UNUSED_CODE #ifndef MRK_PQI_ARCHIVE_STREAMER_HEADER diff --git a/libretroshare/src/pqi/pqiassist.h b/libretroshare/src/pqi/pqiassist.h index 9f93b07df..1bc00fbe9 100644 --- a/libretroshare/src/pqi/pqiassist.h +++ b/libretroshare/src/pqi/pqiassist.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi: pqiassist.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2007 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqiassist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2007 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_ASSIST_H #define MRK_PQI_ASSIST_H diff --git a/libretroshare/src/pqi/pqibin.cc b/libretroshare/src/pqi/pqibin.cc index 172a23b14..75e0b4b39 100644 --- a/libretroshare/src/pqi/pqibin.cc +++ b/libretroshare/src/pqi/pqibin.cc @@ -1,28 +1,24 @@ -/* - * "$Id: pqibin.cc,v 1.4 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqibin.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqibin.h" #include "pqi/authssl.h" #include "util/rsnet.h" diff --git a/libretroshare/src/pqi/pqibin.h b/libretroshare/src/pqi/pqibin.h index 706a0a04f..b8cbb1c58 100644 --- a/libretroshare/src/pqi/pqibin.h +++ b/libretroshare/src/pqi/pqibin.h @@ -1,30 +1,24 @@ -/* - * "$Id: pqibin.h,v 1.2 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqibin.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_BIN_INTERFACE_HEADER #define PQI_BIN_INTERFACE_HEADER diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index a589f7e26..cb7d9f4a2 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -1,28 +1,24 @@ -/* - * "$Id: pqihandler.cc,v 1.12 2007-03-31 09:41:32 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqihandler.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqihandler.h" #include // for NULL diff --git a/libretroshare/src/pqi/pqihandler.h b/libretroshare/src/pqi/pqihandler.h index c285c4ef7..755b13cfd 100644 --- a/libretroshare/src/pqi/pqihandler.h +++ b/libretroshare/src/pqi/pqihandler.h @@ -1,28 +1,24 @@ -/* - * "$Id: pqihandler.h,v 1.10 2007-03-31 09:41:32 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqihandler.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_HANDLER_HEADER #define MRK_PQI_HANDLER_HEADER diff --git a/libretroshare/src/pqi/pqihash.h b/libretroshare/src/pqi/pqihash.h index 5c1ecd986..9a36cb89c 100644 --- a/libretroshare/src/pqi/pqihash.h +++ b/libretroshare/src/pqi/pqihash.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: pqihash.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqihash.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_HASH_ #define PQI_HASH_ diff --git a/libretroshare/src/pqi/pqiindic.h b/libretroshare/src/pqi/pqiindic.h index 391f4791a..28f619b16 100644 --- a/libretroshare/src/pqi/pqiindic.h +++ b/libretroshare/src/pqi/pqiindic.h @@ -1,30 +1,24 @@ -/* - * "$Id: pqiindic.h,v 1.3 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqiindic.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_INDICATOR_HEADER #define MRK_PQI_INDICATOR_HEADER diff --git a/libretroshare/src/pqi/pqiipset.cc b/libretroshare/src/pqi/pqiipset.cc index 8fa686844..8d9017442 100644 --- a/libretroshare/src/pqi/pqiipset.cc +++ b/libretroshare/src/pqi/pqiipset.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: pqiipset.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiipset.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "pqi/pqiipset.h" #include "util/rsstring.h" diff --git a/libretroshare/src/pqi/pqiipset.h b/libretroshare/src/pqi/pqiipset.h index 6da862b08..ef2d8a09a 100644 --- a/libretroshare/src/pqi/pqiipset.h +++ b/libretroshare/src/pqi/pqiipset.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/pqi: pqiipset.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_IP_SET_H #define PQI_IP_SET_H -/* - * libretroshare/src/pqi: pqiipset.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2009-2010 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". - * - */ - #include "util/rsnet.h" #include "serialiser/rstlvaddrs.h" diff --git a/libretroshare/src/pqi/pqilistener.h b/libretroshare/src/pqi/pqilistener.h index 6d02db294..5f748dc8f 100644 --- a/libretroshare/src/pqi/pqilistener.h +++ b/libretroshare/src/pqi/pqilistener.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: pqilistener.h - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqilistener.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_GENERIC_LISTEN_HEADER #define MRK_PQI_GENERIC_LISTEN_HEADER diff --git a/libretroshare/src/pqi/pqiloopback.cc b/libretroshare/src/pqi/pqiloopback.cc index 8a8ba342b..69e70488b 100644 --- a/libretroshare/src/pqi/pqiloopback.cc +++ b/libretroshare/src/pqi/pqiloopback.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: pqiloopback.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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiloopback.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqiloopback.h" #include // for NULL diff --git a/libretroshare/src/pqi/pqiloopback.h b/libretroshare/src/pqi/pqiloopback.h index 82c3923d8..f8d40e667 100644 --- a/libretroshare/src/pqi/pqiloopback.h +++ b/libretroshare/src/pqi/pqiloopback.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: pqiloopback.h - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiloopback.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_LOOPBACK_HEADER #define MRK_PQI_LOOPBACK_HEADER diff --git a/libretroshare/src/pqi/pqimonitor.cc b/libretroshare/src/pqi/pqimonitor.cc index fac7a50f9..550cd7b5a 100644 --- a/libretroshare/src/pqi/pqimonitor.cc +++ b/libretroshare/src/pqi/pqimonitor.cc @@ -1,28 +1,24 @@ -/* - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqimonitor.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqimonitor.h" #include "pqi/pqinetwork.h" #include "pqi/pqiipset.h" diff --git a/libretroshare/src/pqi/pqimonitor.h b/libretroshare/src/pqi/pqimonitor.h index 94e9bdf05..eaba16b73 100644 --- a/libretroshare/src/pqi/pqimonitor.h +++ b/libretroshare/src/pqi/pqimonitor.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/pqi: pqimonitor.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/pqi: pqimonitor.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_MONITOR_H #define PQI_MONITOR_H diff --git a/libretroshare/src/pqi/pqinetstatebox.cc b/libretroshare/src/pqi/pqinetstatebox.cc index 128c4d9e5..c10e5ed6d 100644 --- a/libretroshare/src/pqi/pqinetstatebox.cc +++ b/libretroshare/src/pqi/pqinetstatebox.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/pqi: pqinetstatebox.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "retroshare/rsconfig.h" #include "util/rsnet.h" diff --git a/libretroshare/src/pqi/pqinetstatebox.h b/libretroshare/src/pqi/pqinetstatebox.h index 6b266b627..615099864 100644 --- a/libretroshare/src/pqi/pqinetstatebox.h +++ b/libretroshare/src/pqi/pqinetstatebox.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/pqi: pqinetstatebox.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_NET_STATUS_BOX_H #define PQI_NET_STATUS_BOX_H diff --git a/libretroshare/src/pqi/pqinetwork.cc b/libretroshare/src/pqi/pqinetwork.cc index 8f843cfeb..a3f4ac47f 100644 --- a/libretroshare/src/pqi/pqinetwork.cc +++ b/libretroshare/src/pqi/pqinetwork.cc @@ -1,29 +1,25 @@ -/* - * "$Id: pqinetwork.cc,v 1.18 2007-04-15 18:45:18 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright (C) 2004-2006 Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqinetwork.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef WINDOWS_SYS # include "util/rswin.h" # include "util/rsmemory.h" diff --git a/libretroshare/src/pqi/pqinetwork.h b/libretroshare/src/pqi/pqinetwork.h index e974f68cf..e4238ee5e 100644 --- a/libretroshare/src/pqi/pqinetwork.h +++ b/libretroshare/src/pqi/pqinetwork.h @@ -1,30 +1,25 @@ -/* - * "$Id: pqinetwork.h,v 1.15 2007-04-15 18:45:18 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright (C) 2004-2006 Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqinetwork.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_NETWORKING_HEADER #define MRK_PQI_NETWORKING_HEADER diff --git a/libretroshare/src/pqi/pqiperson.cc b/libretroshare/src/pqi/pqiperson.cc index 7f33a3e1b..30f7d37d3 100644 --- a/libretroshare/src/pqi/pqiperson.cc +++ b/libretroshare/src/pqi/pqiperson.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi pqiperson.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiperson.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqi.h" #include "pqi/pqiperson.h" #include "pqi/pqipersongrp.h" diff --git a/libretroshare/src/pqi/pqiperson.h b/libretroshare/src/pqi/pqiperson.h index 69faec48c..895af2925 100644 --- a/libretroshare/src/pqi/pqiperson.h +++ b/libretroshare/src/pqi/pqiperson.h @@ -1,30 +1,24 @@ -/* - * libretroshare/src/pqi pqiperson.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqiperson.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2006 Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_PERSON_HEADER #define MRK_PQI_PERSON_HEADER diff --git a/libretroshare/src/pqi/pqipersongrp.cc b/libretroshare/src/pqi/pqipersongrp.cc index 3df48fdb3..7146be7de 100644 --- a/libretroshare/src/pqi/pqipersongrp.cc +++ b/libretroshare/src/pqi/pqipersongrp.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi: pqipersongrp.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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqipersongrp.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqipersongrp.h" #include "pqi/p3linkmgr.h" #include "util/rsdebug.h" diff --git a/libretroshare/src/pqi/pqipersongrp.h b/libretroshare/src/pqi/pqipersongrp.h index 18c124968..0afd00a78 100644 --- a/libretroshare/src/pqi/pqipersongrp.h +++ b/libretroshare/src/pqi/pqipersongrp.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi: pqipersongrp.h - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqipersongrp.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2008 Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_PERSON_HANDLER_HEADER #define MRK_PQI_PERSON_HANDLER_HEADER diff --git a/libretroshare/src/pqi/pqiqos.cc b/libretroshare/src/pqi/pqiqos.cc index 9fc62aa8c..0b2b484fa 100644 --- a/libretroshare/src/pqi/pqiqos.cc +++ b/libretroshare/src/pqi/pqiqos.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/pqi: pqiqos.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2008 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/pqi/pqiqos.h b/libretroshare/src/pqi/pqiqos.h index 3a006b5a0..15e42b803 100644 --- a/libretroshare/src/pqi/pqiqos.h +++ b/libretroshare/src/pqi/pqiqos.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/pqi: pqiqos.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2008 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net" - * - */ +/******************************************************************************* + * libretroshare/src/pqi: pqiqos.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2004-2008 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ // This class handles the prioritisation of RsItem, based on the // priority level. The QoS algorithm must ensure that: diff --git a/libretroshare/src/pqi/pqiqosstreamer.cc b/libretroshare/src/pqi/pqiqosstreamer.cc index 2b4d02681..2818b3ee7 100644 --- a/libretroshare/src/pqi/pqiqosstreamer.cc +++ b/libretroshare/src/pqi/pqiqosstreamer.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi pqistreamer.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2012-2012 by Cyril Soler - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiqosstreamer.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2012-2012 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqiqosstreamer.h" //#define DEBUG_PQIQOSSTREAMER 1 diff --git a/libretroshare/src/pqi/pqiqosstreamer.h b/libretroshare/src/pqi/pqiqosstreamer.h index 0144cbdb8..5964b6cbe 100644 --- a/libretroshare/src/pqi/pqiqosstreamer.h +++ b/libretroshare/src/pqi/pqiqosstreamer.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi pqistreamer.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2012-2012 by Cyril Soler - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiqosstreamer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2012-2012 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "pqiqos.h" diff --git a/libretroshare/src/pqi/pqiservice.cc b/libretroshare/src/pqi/pqiservice.cc index dbe20279a..3d28f9164 100644 --- a/libretroshare/src/pqi/pqiservice.cc +++ b/libretroshare/src/pqi/pqiservice.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi pqiservice.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqiservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqiservice.h" #include "util/rsdebug.h" #include "util/rsstring.h" diff --git a/libretroshare/src/pqi/pqiservice.h b/libretroshare/src/pqi/pqiservice.h index 41c540d4c..ad983266e 100644 --- a/libretroshare/src/pqi/pqiservice.h +++ b/libretroshare/src/pqi/pqiservice.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi pqiservice.h - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqiservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQI_SERVICE_HEADER #define PQI_SERVICE_HEADER diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index 47da19b93..c1ea271a3 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -1,29 +1,25 @@ -/* - * "$Id: pqissl.cc,v 1.28 2007-03-17 19:32:59 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqissl.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqissl.h" #include "pqi/pqinetwork.h" #include "pqi/sslfns.h" diff --git a/libretroshare/src/pqi/pqissl.h b/libretroshare/src/pqi/pqissl.h index e14e3928d..712e06a11 100644 --- a/libretroshare/src/pqi/pqissl.h +++ b/libretroshare/src/pqi/pqissl.h @@ -1,31 +1,25 @@ -/* - * "$Id: pqissl.h,v 1.18 2007-03-11 14:54:22 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqissl.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_SSL_HEADER #define MRK_PQI_SSL_HEADER diff --git a/libretroshare/src/pqi/pqissli2pbob.cpp b/libretroshare/src/pqi/pqissli2pbob.cpp index 4b1b05dc6..5551ce788 100644 --- a/libretroshare/src/pqi/pqissli2pbob.cpp +++ b/libretroshare/src/pqi/pqissli2pbob.cpp @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/pqi: pqissli2pbob.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Sehraf * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqissli2pbob.h" bool pqissli2pbob::connect_parameter(uint32_t type, const std::string &value) diff --git a/libretroshare/src/pqi/pqissli2pbob.h b/libretroshare/src/pqi/pqissli2pbob.h index e36112c08..b1a643a75 100644 --- a/libretroshare/src/pqi/pqissli2pbob.h +++ b/libretroshare/src/pqi/pqissli2pbob.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/pqi: pqissli2pbob.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Sehraf * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef PQISSLI2PBOB_H #define PQISSLI2PBOB_H diff --git a/libretroshare/src/pqi/pqissllistener.cc b/libretroshare/src/pqi/pqissllistener.cc index c81c96cd2..676ac8226 100644 --- a/libretroshare/src/pqi/pqissllistener.cc +++ b/libretroshare/src/pqi/pqissllistener.cc @@ -1,29 +1,25 @@ -/* - * "$Id: pqissllistener.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqissllistener.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqissl.h" #include "pqi/pqissllistener.h" #include "pqi/pqinetwork.h" diff --git a/libretroshare/src/pqi/pqissllistener.h b/libretroshare/src/pqi/pqissllistener.h index b5de39069..98e3a77e2 100644 --- a/libretroshare/src/pqi/pqissllistener.h +++ b/libretroshare/src/pqi/pqissllistener.h @@ -1,30 +1,24 @@ -/* - * "$Id: pqissllistener.h,v 1.2 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqissllistener.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_SSL_LISTEN_HEADER #define MRK_PQI_SSL_LISTEN_HEADER diff --git a/libretroshare/src/pqi/pqisslpersongrp.cc b/libretroshare/src/pqi/pqisslpersongrp.cc index 20fe314d4..e907feb28 100644 --- a/libretroshare/src/pqi/pqisslpersongrp.cc +++ b/libretroshare/src/pqi/pqisslpersongrp.cc @@ -1,28 +1,24 @@ -/* - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqisslpersongrp.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsserializer.h" #include "services/autoproxy/rsautoproxymonitor.h" #include "util/rsdebug.h" diff --git a/libretroshare/src/pqi/pqisslpersongrp.h b/libretroshare/src/pqi/pqisslpersongrp.h index 5027abd66..aa574e617 100644 --- a/libretroshare/src/pqi/pqisslpersongrp.h +++ b/libretroshare/src/pqi/pqisslpersongrp.h @@ -1,30 +1,24 @@ -/* - * libretroshare/src/pqi: pqisslpersongrp.h - * - * 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqisslpersongrp.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_SSL_PERSON_HANDLER_HEADER #define MRK_PQI_SSL_PERSON_HANDLER_HEADER diff --git a/libretroshare/src/pqi/pqisslproxy.cc b/libretroshare/src/pqi/pqisslproxy.cc index 500c6a7d8..1c61bef78 100644 --- a/libretroshare/src/pqi/pqisslproxy.cc +++ b/libretroshare/src/pqi/pqisslproxy.cc @@ -1,30 +1,24 @@ -/* - * pqisslproxy.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqisslproxy.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqisslproxy.h" #include "pqi/pqinetwork.h" diff --git a/libretroshare/src/pqi/pqisslproxy.h b/libretroshare/src/pqi/pqisslproxy.h index 347a9fa7f..d643ccb2e 100644 --- a/libretroshare/src/pqi/pqisslproxy.h +++ b/libretroshare/src/pqi/pqisslproxy.h @@ -1,30 +1,24 @@ -/* - * pqisslproxy.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqisslproxy.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_SSL_PROXY_HEADER #define MRK_PQI_SSL_PROXY_HEADER diff --git a/libretroshare/src/pqi/pqissludp.cc b/libretroshare/src/pqi/pqissludp.cc index 8d7e45fd1..aec5f1dae 100644 --- a/libretroshare/src/pqi/pqissludp.cc +++ b/libretroshare/src/pqi/pqissludp.cc @@ -1,28 +1,24 @@ -/* - * "$Id: pqissludp.cc,v 1.16 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqissludp.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqissludp.h" #include "pqi/pqinetwork.h" diff --git a/libretroshare/src/pqi/pqissludp.h b/libretroshare/src/pqi/pqissludp.h index 195e9e604..9cc5e3b23 100644 --- a/libretroshare/src/pqi/pqissludp.h +++ b/libretroshare/src/pqi/pqissludp.h @@ -1,30 +1,24 @@ -/* - * "$Id: pqissludp.h,v 1.8 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqissludp.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_SSL_UDP_HEADER #define MRK_PQI_SSL_UDP_HEADER diff --git a/libretroshare/src/pqi/pqistore.cc b/libretroshare/src/pqi/pqistore.cc index 09932a029..090a6a794 100644 --- a/libretroshare/src/pqi/pqistore.cc +++ b/libretroshare/src/pqi/pqistore.cc @@ -1,30 +1,24 @@ -/* - * "$Id: pqistore.cc,v 1.5 2007-03-21 18:45:41 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqistore.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* This is dependent on the sslroot at the moment. * -> as we need to create/restore references to the Person. diff --git a/libretroshare/src/pqi/pqistore.h b/libretroshare/src/pqi/pqistore.h index 7870c39b3..f8a586c67 100644 --- a/libretroshare/src/pqi/pqistore.h +++ b/libretroshare/src/pqi/pqistore.h @@ -1,30 +1,24 @@ -/* - * pqistore.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/pqi: pqistore.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_STORE_STREAMER_HEADER #define MRK_PQI_STORE_STREAMER_HEADER diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index 839a5364e..9015492a3 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -1,29 +1,24 @@ -/* - * "$Id: pqistreamer.cc,v 1.19 2007-02-18 21:46:50 rmf24 Exp $" - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqistreamer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqistreamer.h" #include // for gettimeofday diff --git a/libretroshare/src/pqi/pqistreamer.h b/libretroshare/src/pqi/pqistreamer.h index 9908651b2..c9ab558cd 100644 --- a/libretroshare/src/pqi/pqistreamer.h +++ b/libretroshare/src/pqi/pqistreamer.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/pqi pqistreamer.h - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqistreamer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_STREAMER_HEADER #define MRK_PQI_STREAMER_HEADER diff --git a/libretroshare/src/pqi/pqithreadstreamer.cc b/libretroshare/src/pqi/pqithreadstreamer.cc index 54ab925e1..8f2bd47c3 100644 --- a/libretroshare/src/pqi/pqithreadstreamer.cc +++ b/libretroshare/src/pqi/pqithreadstreamer.cc @@ -1,29 +1,24 @@ -/* - * pqithreadstreamer.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/pqi: pqithreadstreamer.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rstime.h" #include "pqi/pqithreadstreamer.h" #include diff --git a/libretroshare/src/pqi/pqithreadstreamer.h b/libretroshare/src/pqi/pqithreadstreamer.h index 65cfabdfe..cfa3c12d4 100644 --- a/libretroshare/src/pqi/pqithreadstreamer.h +++ b/libretroshare/src/pqi/pqithreadstreamer.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/pqi pqithreadstreamer.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/pqi: pqithreadstreamer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_PQI_THREAD_STREAMER_HEADER #define MRK_PQI_THREAD_STREAMER_HEADER diff --git a/libretroshare/src/pqi/sslfns.cc b/libretroshare/src/pqi/sslfns.cc index ff964c45c..59bdc884a 100644 --- a/libretroshare/src/pqi/sslfns.cc +++ b/libretroshare/src/pqi/sslfns.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/pqi: sslfns.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". - * - */ +/******************************************************************************* + * libretroshare/src/pqi: sslfns.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* Functions in this file are SSL only, * and have no dependence on SSLRoot() etc. diff --git a/libretroshare/src/pqi/sslfns.h b/libretroshare/src/pqi/sslfns.h index 4682810b5..0a19904e1 100644 --- a/libretroshare/src/pqi/sslfns.h +++ b/libretroshare/src/pqi/sslfns.h @@ -1,31 +1,27 @@ -#ifndef RS_PQI_SSL_HELPER_H +/******************************************************************************* + * libretroshare/src/pqi: sslfns.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#ifndef RS_PQI_SSL_HELPER_H #define RS_PQI_SSL_HELPER_H -/* - * libretroshare/src/pqi: sslfns.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". - * - */ - /* Functions in this file are SSL only, * and have no dependence on SSLRoot() etc. * might need SSL_Init() to be called - thats it! diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index 47b657222..84319b8ff 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -3,16 +3,16 @@ # Copyright (C) 2018, Retroshare team # # # # This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # +# it under the terms of the GNU Lesser General Public License as # # published by the Free Software Foundation, either version 3 of the # # License, or (at your option) any later version. # # # # This program 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 Affero General Public License for more details. # +# GNU Lesser General Public License for more details. # # # -# You should have received a copy of the GNU Affero General Public License # +# You should have received a copy of the GNU Lesser General Public License # # along with this program. If not, see . # ################################################################################ DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src/)) diff --git a/openpgpsdk/src/use_openpgpsdk.pri b/openpgpsdk/src/use_openpgpsdk.pri index 115f88d67..800781a3c 100644 --- a/openpgpsdk/src/use_openpgpsdk.pri +++ b/openpgpsdk/src/use_openpgpsdk.pri @@ -3,16 +3,16 @@ # Copyright (C) 2018, Retroshare team # # # # This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # +# it under the terms of the GNU Lesser General Public License as # # published by the Free Software Foundation, either version 3 of the # # License, or (at your option) any later version. # # # # This program 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 Affero General Public License for more details. # +# GNU Lesser General Public License for more details. # # # -# You should have received a copy of the GNU Affero General Public License # +# You should have received a copy of the GNU Lesser General Public License # # along with this program. If not, see . # ################################################################################ DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) diff --git a/retroshare.pri b/retroshare.pri index def629360..8f57cf618 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -3,16 +3,16 @@ # Copyright (C) 2018, Retroshare team # # # # This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # +# it under the terms of the GNU Lesser General Public License as # # published by the Free Software Foundation, either version 3 of the # # License, or (at your option) any later version. # # # # This program 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 Affero General Public License for more details. # +# GNU Lesser General Public License for more details. # # # -# You should have received a copy of the GNU Affero General Public License # +# You should have received a copy of the GNU Lesser General Public License # # along with this program. If not, see . # ################################################################################ From ff8c37f169fd0534dc1755c6473bea9751335d29 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 28 May 2018 22:28:51 +0200 Subject: [PATCH 056/213] fixed license in retroshare/ --- libretroshare/src/gxstunnel/p3gxstunnel.cc | 2 - libretroshare/src/pgp/pgpauxutils.cc | 2 - libretroshare/src/retroshare/rsbanlist.h | 46 ++++++++--------- libretroshare/src/retroshare/rsconfig.h | 46 ++++++++--------- libretroshare/src/retroshare/rsdht.h | 46 ++++++++--------- libretroshare/src/retroshare/rsdisc.h | 46 ++++++++--------- libretroshare/src/retroshare/rsexpr.h | 46 ++++++++--------- libretroshare/src/retroshare/rsfiles.h | 47 ++++++++--------- libretroshare/src/retroshare/rsgxschannels.h | 46 ++++++++--------- libretroshare/src/retroshare/rsgxscircles.h | 46 ++++++++--------- libretroshare/src/retroshare/rsgxsflags.h | 21 ++++++++ libretroshare/src/retroshare/rsgxsforums.h | 46 ++++++++--------- .../src/retroshare/rsgxsifacetypes.h | 49 ++++++++---------- libretroshare/src/retroshare/rsgxsservice.h | 21 ++++++++ libretroshare/src/retroshare/rsgxstunnel.h | 46 ++++++++--------- libretroshare/src/retroshare/rshistory.h | 46 ++++++++--------- libretroshare/src/retroshare/rsidentity.h | 48 ++++++++--------- libretroshare/src/retroshare/rsids.h | 22 ++++++++ libretroshare/src/retroshare/rsiface.h | 47 ++++++++--------- libretroshare/src/retroshare/rsinit.h | 46 ++++++++--------- libretroshare/src/retroshare/rsmsgs.h | 47 ++++++++--------- libretroshare/src/retroshare/rsnotify.h | 47 ++++++++--------- libretroshare/src/retroshare/rspeers.h | 46 ++++++++--------- libretroshare/src/retroshare/rsphoto.h | 46 ++++++++--------- libretroshare/src/retroshare/rsplugin.h | 46 ++++++++--------- libretroshare/src/retroshare/rsposted.h | 46 ++++++++--------- libretroshare/src/retroshare/rsrtt.h | 46 ++++++++--------- .../src/retroshare/rsservicecontrol.h | 46 ++++++++--------- libretroshare/src/retroshare/rsstatus.h | 46 ++++++++--------- libretroshare/src/retroshare/rstokenservice.h | 46 ++++++++--------- libretroshare/src/retroshare/rsturtle.h | 51 ++++++++----------- libretroshare/src/retroshare/rstypes.h | 47 ++++++++--------- libretroshare/src/retroshare/rsversion.h | 21 ++++++++ libretroshare/src/retroshare/rswiki.h | 46 ++++++++--------- libretroshare/src/retroshare/rswire.h | 46 ++++++++--------- libretroshare/src/rsserver/rsinit.cc | 45 ++++++++-------- 36 files changed, 717 insertions(+), 766 deletions(-) diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index 7fd417549..89beb2b8b 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -19,8 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once - #include #include "openssl/rand.h" diff --git a/libretroshare/src/pgp/pgpauxutils.cc b/libretroshare/src/pgp/pgpauxutils.cc index abf92e5ac..a6a592c2c 100644 --- a/libretroshare/src/pgp/pgpauxutils.cc +++ b/libretroshare/src/pgp/pgpauxutils.cc @@ -19,8 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once - #include "pgp/pgpauxutils.h" #include "pqi/authgpg.h" diff --git a/libretroshare/src/retroshare/rsbanlist.h b/libretroshare/src/retroshare/rsbanlist.h index b6778f0e3..f60b129f9 100644 --- a/libretroshare/src/retroshare/rsbanlist.h +++ b/libretroshare/src/retroshare/rsbanlist.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services/p3banlist.h - * - * Exchange list of Peers for Banning / Whitelisting. - * - * Copyright 2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/retroshare: rsbanlist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "util/rsnet.h" diff --git a/libretroshare/src/retroshare/rsconfig.h b/libretroshare/src/retroshare/rsconfig.h index e3b74aa4b..962519ad9 100644 --- a/libretroshare/src/retroshare/rsconfig.h +++ b/libretroshare/src/retroshare/rsconfig.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsconfig.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_CONFIG_GUI_INTERFACE_H #define RETROSHARE_CONFIG_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rsconfig.h - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - #include #include #include diff --git a/libretroshare/src/retroshare/rsdht.h b/libretroshare/src/retroshare/rsdht.h index 35dee0354..022fb421b 100644 --- a/libretroshare/src/retroshare/rsdht.h +++ b/libretroshare/src/retroshare/rsdht.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsdht.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_DHT_GUI_INTERFACE_H #define RETROSHARE_DHT_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rsdht.h - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - #include #include #include diff --git a/libretroshare/src/retroshare/rsdisc.h b/libretroshare/src/retroshare/rsdisc.h index e97f19571..b81e03c3c 100644 --- a/libretroshare/src/retroshare/rsdisc.h +++ b/libretroshare/src/retroshare/rsdisc.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsdht.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_DISC_GUI_INTERFACE_H #define RETROSHARE_DISC_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rsdisc.h - * - * RetroShare C++ Interface. - * - * Copyright 2008-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". - * - */ - #include #include #include diff --git a/libretroshare/src/retroshare/rsexpr.h b/libretroshare/src/retroshare/rsexpr.h index 72c63d463..628e3f3c4 100644 --- a/libretroshare/src/retroshare/rsexpr.h +++ b/libretroshare/src/retroshare/rsexpr.h @@ -1,28 +1,24 @@ -/* - * rs-core/src/rsiface: rsexpr.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-2008 by Kashif Kaleem. - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/retroshare: rsexpr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Kashif Kaleem * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index ccd4428be..8fc17874a 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsfiles.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_FILES_GUI_INTERFACE_H #define RS_FILES_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rsfiles.h - * - * RetroShare C++ Interface. - * - * Copyright 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". - * - */ - - #include #include #include diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index c75235f0e..e61a0f131 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsgxschannels.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_GXS_CHANNEL_GUI_INTERFACE_H #define RETROSHARE_GXS_CHANNEL_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rsgxschannel.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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 #include #include diff --git a/libretroshare/src/retroshare/rsgxscircles.h b/libretroshare/src/retroshare/rsgxscircles.h index 8ce446200..32d21fb14 100644 --- a/libretroshare/src/retroshare/rsgxscircles.h +++ b/libretroshare/src/retroshare/rsgxscircles.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsgxscircles.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_GXSCIRCLES_INTERFACE_H #define RETROSHARE_GXSCIRCLES_INTERFACE_H -/* - * libretroshare/src/retroshare: rsgxscircles.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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 #include #include diff --git a/libretroshare/src/retroshare/rsgxsflags.h b/libretroshare/src/retroshare/rsgxsflags.h index 921c843fa..b2645aaab 100644 --- a/libretroshare/src/retroshare/rsgxsflags.h +++ b/libretroshare/src/retroshare/rsgxsflags.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsgxsflags.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSFLAGS_H #define RSGXSFLAGS_H diff --git a/libretroshare/src/retroshare/rsgxsforums.h b/libretroshare/src/retroshare/rsgxsforums.h index 28558d4ce..9d0296e4b 100644 --- a/libretroshare/src/retroshare/rsgxsforums.h +++ b/libretroshare/src/retroshare/rsgxsforums.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsgxsforums.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_GXS_FORUM_GUI_INTERFACE_H #define RETROSHARE_GXS_FORUM_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rsgxsforum.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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 #include #include diff --git a/libretroshare/src/retroshare/rsgxsifacetypes.h b/libretroshare/src/retroshare/rsgxsifacetypes.h index 18637f1b1..6ad3ceb05 100644 --- a/libretroshare/src/retroshare/rsgxsifacetypes.h +++ b/libretroshare/src/retroshare/rsgxsifacetypes.h @@ -1,30 +1,25 @@ -/* - * rsgxsifacetypes.h - * - * Copyright (C) 2013 crispy - * Copyright (C) 2018 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -/* - * rsgxsifacetypes.h - * - * Created on: 28 Feb 2013 - * Author: crispy - */ - +/******************************************************************************* + * libretroshare/src/retroshare: rsgxsifacetypes.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2013 crispy * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSIFACETYPES_H_ #define RSGXSIFACETYPES_H_ diff --git a/libretroshare/src/retroshare/rsgxsservice.h b/libretroshare/src/retroshare/rsgxsservice.h index 6afed31c6..4bb299408 100644 --- a/libretroshare/src/retroshare/rsgxsservice.h +++ b/libretroshare/src/retroshare/rsgxsservice.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsgxsservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2015 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSSERVICE_H #define RSGXSSERVICE_H diff --git a/libretroshare/src/retroshare/rsgxstunnel.h b/libretroshare/src/retroshare/rsgxstunnel.h index 4d3588c9f..ce7798300 100644 --- a/libretroshare/src/retroshare/rsgxstunnel.h +++ b/libretroshare/src/retroshare/rsgxstunnel.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: rsgrouter.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/retroshare: rsgxstunnel.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "util/rsdir.h" diff --git a/libretroshare/src/retroshare/rshistory.h b/libretroshare/src/retroshare/rshistory.h index 77e30b35d..eff72e237 100644 --- a/libretroshare/src/retroshare/rshistory.h +++ b/libretroshare/src/retroshare/rshistory.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rshistory.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Thunder * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_HISTORY_INTERFACE_H #define RS_HISTORY_INTERFACE_H -/* - * libretroshare/src/retroshare: rshistory.h - * - * RetroShare C++ . - * - * Copyright 2011 by Thunder. - * - * 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". - * - */ - class RsHistory; class ChatId; diff --git a/libretroshare/src/retroshare/rsidentity.h b/libretroshare/src/retroshare/rsidentity.h index 47da42de4..610df360f 100644 --- a/libretroshare/src/retroshare/rsidentity.h +++ b/libretroshare/src/retroshare/rsidentity.h @@ -1,32 +1,28 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsidentity.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2012 Robert Fernie * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_IDENTITY_GUI_INTERFACE_H #define RETROSHARE_IDENTITY_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rsidentity.h - * - * RetroShare C++ Interface. - * - * Copyright (C) 2012 Robert Fernie. - * Copyright (C) 2018 Gioacchino Mazzurco - * - * 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.1 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 #include #include diff --git a/libretroshare/src/retroshare/rsids.h b/libretroshare/src/retroshare/rsids.h index 21a8fd754..fee615d90 100644 --- a/libretroshare/src/retroshare/rsids.h +++ b/libretroshare/src/retroshare/rsids.h @@ -1,3 +1,25 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsids.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + // This class aims at defining a generic ID type that is a list of bytes. It // can be converted into a hexadecial string for printing, mainly) or for // compatibility with old methods. diff --git a/libretroshare/src/retroshare/rsiface.h b/libretroshare/src/retroshare/rsiface.h index 2eb905e3a..643e404c0 100644 --- a/libretroshare/src/retroshare/rsiface.h +++ b/libretroshare/src/retroshare/rsiface.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsiface.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_GUI_INTERFACE_H #define RETROSHARE_GUI_INTERFACE_H -/* - * "$Id: rsiface.h,v 1.9 2007-04-21 19:08:51 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ - - #include "retroshare/rsnotify.h" #include "rstypes.h" diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 18326d3a1..aeb487fb2 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsinit.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_INIT_INTERFACE_H #define RETROSHARE_INIT_INTERFACE_H -/* - * "$Id: rsiface.h,v 1.9 2007-04-21 19:08:51 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ - // Initialize ok, result >= 0 #define RS_INIT_OK 0 // Initialize ok #define RS_INIT_HAVE_ACCOUNT 1 // Initialize ok, have account diff --git a/libretroshare/src/retroshare/rsmsgs.h b/libretroshare/src/retroshare/rsmsgs.h index bf36100b3..340606bb8 100644 --- a/libretroshare/src/retroshare/rsmsgs.h +++ b/libretroshare/src/retroshare/rsmsgs.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsmsgs.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_MSG_GUI_INTERFACE_H #define RS_MSG_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rsmsgs.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-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". - * - */ - - #include #include #include diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index b73c577e9..5ad23507c 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsnotify.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_NOTIFY_GUI_INTERFACE_H #define RS_NOTIFY_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rsnotify.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-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". - * - */ - - #include #include #include diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h index f1b274d09..df63d8112 100644 --- a/libretroshare/src/retroshare/rspeers.h +++ b/libretroshare/src/retroshare/rspeers.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rspeers.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_PEER_GUI_INTERFACE_H #define RETROSHARE_PEER_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rspeer.h - * - * RetroShare C++ Interface. - * - * 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". - * - */ - #include #include #include diff --git a/libretroshare/src/retroshare/rsphoto.h b/libretroshare/src/retroshare/rsphoto.h index 1e782d2ef..7e5b6ea99 100644 --- a/libretroshare/src/retroshare/rsphoto.h +++ b/libretroshare/src/retroshare/rsphoto.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsphoto.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSPHOTOV2_H #define RSPHOTOV2_H -/* - * libretroshare/src/retroshare: rsphoto.h - * - * RetroShare C++ Interface. - * - * Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker - * - * 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 #include #include diff --git a/libretroshare/src/retroshare/rsplugin.h b/libretroshare/src/retroshare/rsplugin.h index 6b8363c37..557f9a61d 100644 --- a/libretroshare/src/retroshare/rsplugin.h +++ b/libretroshare/src/retroshare/rsplugin.h @@ -1,28 +1,24 @@ -/* - * "$Id: rsiface.h,v 1.9 2007-04-21 19:08:51 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 by Cyril Soler - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/retroshare: rsplugin.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/retroshare/rsposted.h b/libretroshare/src/retroshare/rsposted.h index 586449a47..eb089383c 100644 --- a/libretroshare/src/retroshare/rsposted.h +++ b/libretroshare/src/retroshare/rsposted.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsposted.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H #define RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rsposted.h - * - * RetroShare C++ Interface. - * - * Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker - * - * 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.1 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 #include #include diff --git a/libretroshare/src/retroshare/rsrtt.h b/libretroshare/src/retroshare/rsrtt.h index 6d9422562..e55220307 100644 --- a/libretroshare/src/retroshare/rsrtt.h +++ b/libretroshare/src/retroshare/rsrtt.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsposted.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_RTT_INTERFACE_H #define RETROSHARE_RTT_INTERFACE_H -/* - * libretroshare/src/retroshare: rsrtt.h - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - #include #include #include diff --git a/libretroshare/src/retroshare/rsservicecontrol.h b/libretroshare/src/retroshare/rsservicecontrol.h index 12d9dc5d2..b081e3305 100644 --- a/libretroshare/src/retroshare/rsservicecontrol.h +++ b/libretroshare/src/retroshare/rsservicecontrol.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsservicecontrol.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014-2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_SERVICE_CONTROL_GUI_INTERFACE_H #define RETROSHARE_SERVICE_CONTROL_GUI_INTERFACE_H -/* - * libretroshare/src/rsiface: rsservicecontrol.h - * - * RetroShare C++ Interface. - * - * Copyright 2014 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.1 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 #include #include diff --git a/libretroshare/src/retroshare/rsstatus.h b/libretroshare/src/retroshare/rsstatus.h index 00b82eab7..4698cd8b5 100644 --- a/libretroshare/src/retroshare/rsstatus.h +++ b/libretroshare/src/retroshare/rsstatus.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsstatus.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Vinny Do, Chris Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_STATUS_INTERFACE_H #define RS_STATUS_INTERFACE_H -/* - * libretroshare/src/rsiface: rsstatus.h - * - * RetroShare C++ . - * - * Copyright 2007-2008 by Vinny Do, Chris Evi-Parker. - * - * 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". - * - */ - class RsStatus; extern RsStatus *rsStatus; diff --git a/libretroshare/src/retroshare/rstokenservice.h b/libretroshare/src/retroshare/rstokenservice.h index bcb273dd5..fedf54f9d 100644 --- a/libretroshare/src/retroshare/rstokenservice.h +++ b/libretroshare/src/retroshare/rstokenservice.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rstokenservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie, Chris Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSTOKENSERVICE_H #define RSTOKENSERVICE_H -/* - * libretroshare/src/retroshare: rstokenservice.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 by Robert Fernie, Christopher Evi-Parker - * - * 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 #include #include diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 7cef4fd77..f845f06db 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -1,31 +1,24 @@ -#ifndef RETROSHARE_TURTLE_GUI_INTERFACE_H -#define RETROSHARE_TURTLE_GUI_INTERFACE_H - -/* - * libretroshare/src/rsiface: rsturtle.h - * - * RetroShare C++ Interface. - * - * Copyright 2009 by Cyril Soler. - * - * 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 "csoler@users.sourceforge.net" - * - */ - +/******************************************************************************* + * libretroshare/src/retroshare: rsturtle.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include @@ -155,5 +148,3 @@ class RsTurtle virtual void setMaxTRForwardRate(int max_tr_up_rate) = 0 ; virtual int getMaxTRForwardRate() const = 0 ; }; - -#endif diff --git a/libretroshare/src/retroshare/rstypes.h b/libretroshare/src/retroshare/rstypes.h index dcad22795..443f2e2b3 100644 --- a/libretroshare/src/retroshare/rstypes.h +++ b/libretroshare/src/retroshare/rstypes.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsturtle.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_TYPES_GUI_INTERFACE_H #define RS_TYPES_GUI_INTERFACE_H -/* - * "$Id: rstypes.h,v 1.7 2007-05-05 16:10:05 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ - - #include #include #include diff --git a/libretroshare/src/retroshare/rsversion.h b/libretroshare/src/retroshare/rsversion.h index d194024d7..110d622fa 100644 --- a/libretroshare/src/retroshare/rsversion.h +++ b/libretroshare/src/retroshare/rsversion.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsversion.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #define RS_MAJOR_VERSION 0 #define RS_MINOR_VERSION 6 #define RS_BUILD_NUMBER 4 diff --git a/libretroshare/src/retroshare/rswiki.h b/libretroshare/src/retroshare/rswiki.h index 9db3ff7e6..ab3bcfd85 100644 --- a/libretroshare/src/retroshare/rswiki.h +++ b/libretroshare/src/retroshare/rswiki.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsturtle.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_WIKI_GUI_INTERFACE_H #define RETROSHARE_WIKI_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rswiki.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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". - * - */ - #include #include #include diff --git a/libretroshare/src/retroshare/rswire.h b/libretroshare/src/retroshare/rswire.h index d9cdb7832..6052c7291 100644 --- a/libretroshare/src/retroshare/rswire.h +++ b/libretroshare/src/retroshare/rswire.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/retroshare: rsturtle.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_WIRE_GUI_INTERFACE_H #define RETROSHARE_WIRE_GUI_INTERFACE_H -/* - * libretroshare/src/retroshare: rswire.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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 #include #include diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 0d9300202..e1501141f 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/reserver rsinit.cc - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ +/******************************************************************************* + * libretroshare/src/retroshare: rsinit.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* This is an updated startup class. Class variables are hidden from * the GUI / External via a hidden class */ From 05e2f684a9a50dced65bc020cfb5bc6d6d1324cd Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 29 May 2018 21:08:17 +0200 Subject: [PATCH 057/213] re-licensed rsitems and rsserver --- libretroshare/src/rsitems/itempriorities.h | 46 ++++++++--------- libretroshare/src/rsitems/rsbanlistitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsbanlistitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsbwctrlitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsbwctrlitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsconfigitems.cc | 47 ++++++++---------- libretroshare/src/rsitems/rsconfigitems.h | 46 ++++++++--------- .../src/rsitems/rsdiscovery2items.cc | 47 ++++++++---------- libretroshare/src/rsitems/rsdiscovery2items.h | 48 ++++++++---------- .../src/rsitems/rsfiletransferitems.cc | 47 ++++++++---------- .../src/rsitems/rsfiletransferitems.h | 46 ++++++++--------- .../src/rsitems/rsgxschannelitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxschannelitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsgxscircleitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxscircleitems.h | 46 ++++++++--------- .../src/rsitems/rsgxscommentitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxscommentitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsforumitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsforumitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsiditems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsiditems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsitems.cc | 30 +++++++++--- libretroshare/src/rsitems/rsgxsitems.h | 47 +++++++++--------- libretroshare/src/rsitems/rsgxsrecognitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsrecognitems.h | 46 ++++++++--------- .../src/rsitems/rsgxsreputationitems.cc | 46 ++++++++--------- .../src/rsitems/rsgxsreputationitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsupdateitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsgxsupdateitems.h | 48 ++++++++---------- libretroshare/src/rsitems/rsheartbeatitems.h | 48 ++++++++---------- libretroshare/src/rsitems/rshistoryitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rshistoryitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsitem.h | 38 +++++++------- libretroshare/src/rsitems/rsmsgitems.cc | 47 ++++++++---------- libretroshare/src/rsitems/rsmsgitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsnxsitems.cc | 21 ++++++++ libretroshare/src/rsitems/rsnxsitems.h | 47 ++++++++---------- libretroshare/src/rsitems/rsphotoitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rsphotoitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rspluginitems.h | 47 ++++++++---------- libretroshare/src/rsitems/rsposteditems.cc | 47 ++++++++---------- libretroshare/src/rsitems/rsposteditems.h | 21 ++++++++ libretroshare/src/rsitems/rsrttitems.cc | 47 ++++++++---------- libretroshare/src/rsitems/rsrttitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsserviceids.h | 46 ++++++++--------- .../src/rsitems/rsserviceinfoitems.cc | 46 ++++++++--------- .../src/rsitems/rsserviceinfoitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rsstatusitems.h | 46 ++++++++--------- libretroshare/src/rsitems/rswikiitems.cc | 46 ++++++++--------- libretroshare/src/rsitems/rswikiitems.h | 45 ++++++++--------- libretroshare/src/rsitems/rswireitems.cc | 47 ++++++++---------- libretroshare/src/rsitems/rswireitems.h | 45 ++++++++--------- libretroshare/src/rsserver/p3face.h | 46 ++++++++--------- libretroshare/src/rsserver/p3history.cc | 47 ++++++++---------- libretroshare/src/rsserver/p3history.h | 46 ++++++++--------- libretroshare/src/rsserver/p3msgs.cc | 49 ++++++++----------- libretroshare/src/rsserver/p3msgs.h | 46 ++++++++--------- libretroshare/src/rsserver/p3peers.cc | 48 +++++++++--------- libretroshare/src/rsserver/p3peers.h | 47 ++++++++---------- libretroshare/src/rsserver/p3serverconfig.cc | 46 ++++++++--------- libretroshare/src/rsserver/p3serverconfig.h | 47 ++++++++---------- libretroshare/src/rsserver/p3status.cc | 47 ++++++++---------- libretroshare/src/rsserver/p3status.h | 46 ++++++++--------- libretroshare/src/rsserver/rsaccounts.cc | 46 ++++++++--------- libretroshare/src/rsserver/rsaccounts.h | 46 ++++++++--------- 65 files changed, 1368 insertions(+), 1571 deletions(-) diff --git a/libretroshare/src/rsitems/itempriorities.h b/libretroshare/src/rsitems/itempriorities.h index f5008eef0..dc346b7c3 100644 --- a/libretroshare/src/rsitems/itempriorities.h +++ b/libretroshare/src/rsitems/itempriorities.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: itempriorities.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2011-2011 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net" - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsitempriorities.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/rsitems/rsbanlistitems.cc b/libretroshare/src/rsitems/rsbanlistitems.cc index 44f908dee..f5dd9fca8 100644 --- a/libretroshare/src/rsitems/rsbanlistitems.cc +++ b/libretroshare/src/rsitems/rsbanlistitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsbanlist.cc - * - * RetroShare Serialiser. - * - * Copyright 2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsbanlistitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "rsitems/rsbanlistitems.h" diff --git a/libretroshare/src/rsitems/rsbanlistitems.h b/libretroshare/src/rsitems/rsbanlistitems.h index 6aec4b115..2f22a199e 100644 --- a/libretroshare/src/rsitems/rsbanlistitems.h +++ b/libretroshare/src/rsitems/rsbanlistitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsbanlistitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_BANLIST_ITEMS_H #define RS_BANLIST_ITEMS_H -/* - * libretroshare/src/serialiser: rsbanlistitems.h - * - * RetroShare Serialiser. - * - * Copyright 2011 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". - * - */ - #include #include "rsitems/rsserviceids.h" diff --git a/libretroshare/src/rsitems/rsbwctrlitems.cc b/libretroshare/src/rsitems/rsbwctrlitems.cc index bfa172b45..759264aa0 100644 --- a/libretroshare/src/rsitems/rsbwctrlitems.cc +++ b/libretroshare/src/rsitems/rsbwctrlitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsbwctrlitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsbwctrlitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "rsitems/rsbwctrlitems.h" diff --git a/libretroshare/src/rsitems/rsbwctrlitems.h b/libretroshare/src/rsitems/rsbwctrlitems.h index 71ec641e1..300bd6f54 100644 --- a/libretroshare/src/rsitems/rsbwctrlitems.h +++ b/libretroshare/src/rsitems/rsbwctrlitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsbwctrlitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_BANDWIDTH_CONTROL_ITEMS_H #define RS_BANDWIDTH_CONTROL_ITEMS_H -/* - * libretroshare/src/serialiser: rsbwctrlitems.h - * - * RetroShare Serialiser. - * - * Copyright 2012 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.1 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 #include "rsitems/rsitem.h" diff --git a/libretroshare/src/rsitems/rsconfigitems.cc b/libretroshare/src/rsitems/rsconfigitems.cc index 17edb7962..654d1a7f6 100644 --- a/libretroshare/src/rsitems/rsconfigitems.cc +++ b/libretroshare/src/rsitems/rsconfigitems.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsconfigitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker. - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsconfigitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "rsitems/rsconfigitems.h" #include "retroshare/rspeers.h" // Needed for RsGroupInfo. diff --git a/libretroshare/src/rsitems/rsconfigitems.h b/libretroshare/src/rsitems/rsconfigitems.h index a22f907d6..376bebb78 100644 --- a/libretroshare/src/rsitems/rsconfigitems.h +++ b/libretroshare/src/rsitems/rsconfigitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsconfigitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_CONFIG_ITEMS_SERIALISER_H #define RS_CONFIG_ITEMS_SERIALISER_H -/* - * libretroshare/src/serialiser: rsconfigitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - #include #include diff --git a/libretroshare/src/rsitems/rsdiscovery2items.cc b/libretroshare/src/rsitems/rsdiscovery2items.cc index 0d1d3a493..1a23583db 100644 --- a/libretroshare/src/rsitems/rsdiscovery2items.cc +++ b/libretroshare/src/rsitems/rsdiscovery2items.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsdiscitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsdiscitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/rsdiscovery2items.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/rsitems/rsdiscovery2items.h b/libretroshare/src/rsitems/rsdiscovery2items.h index 012ebe1b5..85f30b995 100644 --- a/libretroshare/src/rsitems/rsdiscovery2items.h +++ b/libretroshare/src/rsitems/rsdiscovery2items.h @@ -1,30 +1,24 @@ -/* - * libretroshare/src/serialiser: rsdiscitems.h - * - * Serialiser 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/rsitems: rsdiscitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_DISC_ITEMS_H #define RS_DISC_ITEMS_H diff --git a/libretroshare/src/rsitems/rsfiletransferitems.cc b/libretroshare/src/rsitems/rsfiletransferitems.cc index 4241081a7..3c34acf6a 100644 --- a/libretroshare/src/rsitems/rsfiletransferitems.cc +++ b/libretroshare/src/rsitems/rsfiletransferitems.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsbaseitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsfiletransferitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "serialiser/rstlvbase.h" #include "rsitems/rsfiletransferitems.h" diff --git a/libretroshare/src/rsitems/rsfiletransferitems.h b/libretroshare/src/rsitems/rsfiletransferitems.h index 85f6d5eab..60514e41f 100644 --- a/libretroshare/src/rsitems/rsfiletransferitems.h +++ b/libretroshare/src/rsitems/rsfiletransferitems.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsfiletransferitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rsbaseitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - #include #include "retroshare/rstypes.h" diff --git a/libretroshare/src/rsitems/rsgxschannelitems.cc b/libretroshare/src/rsitems/rsgxschannelitems.cc index a8cc067b1..123e85c17 100644 --- a/libretroshare/src/rsitems/rsgxschannelitems.cc +++ b/libretroshare/src/rsitems/rsgxschannelitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxschannelitems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxschannelitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsgxschannelitems.h" diff --git a/libretroshare/src/rsitems/rsgxschannelitems.h b/libretroshare/src/rsitems/rsgxschannelitems.h index b0fc67987..fa52c8cfc 100644 --- a/libretroshare/src/rsitems/rsgxschannelitems.h +++ b/libretroshare/src/rsitems/rsgxschannelitems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxschannelitems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxschannelitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXS_CHANNEL_ITEMS_H #define RS_GXS_CHANNEL_ITEMS_H diff --git a/libretroshare/src/rsitems/rsgxscircleitems.cc b/libretroshare/src/rsitems/rsgxscircleitems.cc index a468f483f..0acdd03de 100644 --- a/libretroshare/src/rsitems/rsgxscircleitems.cc +++ b/libretroshare/src/rsitems/rsgxscircleitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rswikiitems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxscircleitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsgxscircleitems.h" diff --git a/libretroshare/src/rsitems/rsgxscircleitems.h b/libretroshare/src/rsitems/rsgxscircleitems.h index 8e57b478c..6338fb368 100644 --- a/libretroshare/src/rsitems/rsgxscircleitems.h +++ b/libretroshare/src/rsitems/rsgxscircleitems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxscircleitems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxscircleitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXSCIRCLE_ITEMS_H #define RS_GXSCIRCLE_ITEMS_H diff --git a/libretroshare/src/rsitems/rsgxscommentitems.cc b/libretroshare/src/rsitems/rsgxscommentitems.cc index 8c175a1bd..2386fb069 100644 --- a/libretroshare/src/rsitems/rsgxscommentitems.cc +++ b/libretroshare/src/rsitems/rsgxscommentitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxscommentitems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxscommentitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsgxscommentitems.h" diff --git a/libretroshare/src/rsitems/rsgxscommentitems.h b/libretroshare/src/rsitems/rsgxscommentitems.h index ec5d6ae2c..c35c6c2aa 100644 --- a/libretroshare/src/rsitems/rsgxscommentitems.h +++ b/libretroshare/src/rsitems/rsgxscommentitems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxscommentitems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxscommentitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXS_COMMENT_ITEMS_H #define RS_GXS_COMMENT_ITEMS_H diff --git a/libretroshare/src/rsitems/rsgxsforumitems.cc b/libretroshare/src/rsitems/rsgxsforumitems.cc index fb5b8f632..64356e1ed 100644 --- a/libretroshare/src/rsitems/rsgxsforumitems.cc +++ b/libretroshare/src/rsitems/rsgxsforumitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxsforumitems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsforumitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsgxsforumitems.h" diff --git a/libretroshare/src/rsitems/rsgxsforumitems.h b/libretroshare/src/rsitems/rsgxsforumitems.h index 5ce8a84ee..30c6c4e08 100644 --- a/libretroshare/src/rsitems/rsgxsforumitems.h +++ b/libretroshare/src/rsitems/rsgxsforumitems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxsforumitems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsforumitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXS_FORUM_ITEMS_H #define RS_GXS_FORUM_ITEMS_H diff --git a/libretroshare/src/rsitems/rsgxsiditems.cc b/libretroshare/src/rsitems/rsgxsiditems.cc index 1a4eac4e8..ee94d3682 100644 --- a/libretroshare/src/rsitems/rsgxsiditems.cc +++ b/libretroshare/src/rsitems/rsgxsiditems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxsiditems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsiditems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsgxsiditems.h" diff --git a/libretroshare/src/rsitems/rsgxsiditems.h b/libretroshare/src/rsitems/rsgxsiditems.h index 19802a9a1..61c7500f3 100644 --- a/libretroshare/src/rsitems/rsgxsiditems.h +++ b/libretroshare/src/rsitems/rsgxsiditems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxsiditems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsiditems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXS_IDENTITY_ITEMS_H #define RS_GXS_IDENTITY_ITEMS_H diff --git a/libretroshare/src/rsitems/rsgxsitems.cc b/libretroshare/src/rsitems/rsgxsitems.cc index 9971514ec..90dc30462 100644 --- a/libretroshare/src/rsitems/rsgxsitems.cc +++ b/libretroshare/src/rsitems/rsgxsitems.cc @@ -1,11 +1,25 @@ -/* - * rsgxsitems.cc - * - * Created on: 26 Jul 2012 - * Author: crispy - */ - - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * Copyright 2012-2012 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsgxsitems.h" #include "gxs/rsgxsdata.h" #include diff --git a/libretroshare/src/rsitems/rsgxsitems.h b/libretroshare/src/rsitems/rsgxsitems.h index fa461a0e8..026f179e5 100644 --- a/libretroshare/src/rsitems/rsgxsitems.h +++ b/libretroshare/src/rsitems/rsgxsitems.h @@ -1,31 +1,28 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * Copyright 2012-2012 by Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSITEMS_H #define RSGXSITEMS_H -/* - * libretroshare/src/serialiser: rsgxsitems.h - * - * RetroShare Serialiser. - * - * Copyright 2012 Christopher Evi-Parker, 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 "rsitems/rsitem.h" #include "rsitems/rsserviceids.h" diff --git a/libretroshare/src/rsitems/rsgxsrecognitems.cc b/libretroshare/src/rsitems/rsgxsrecognitems.cc index bb6a40ca8..4113a051c 100644 --- a/libretroshare/src/rsitems/rsgxsrecognitems.cc +++ b/libretroshare/src/rsitems/rsgxsrecognitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxsrecogitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2013-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsrecogitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/rsgxsrecognitems.h" #include "serialiser/rstypeserializer.h" diff --git a/libretroshare/src/rsitems/rsgxsrecognitems.h b/libretroshare/src/rsitems/rsgxsrecognitems.h index 68a9aa174..3e049f0c2 100644 --- a/libretroshare/src/rsitems/rsgxsrecognitems.h +++ b/libretroshare/src/rsitems/rsgxsrecognitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsrecogitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXS_RECOG_ITEMS_H #define RS_GXS_RECOG_ITEMS_H -/* - * libretroshare/src/serialiser: rsgxsrecogitems.h - * - * RetroShare Serialiser. - * - * Copyright 2013-2013 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.1 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 #include "rsitems/rsitem.h" diff --git a/libretroshare/src/rsitems/rsgxsreputationitems.cc b/libretroshare/src/rsitems/rsgxsreputationitems.cc index 7b558131a..9aa8c6e9c 100644 --- a/libretroshare/src/rsitems/rsgxsreputationitems.cc +++ b/libretroshare/src/rsitems/rsgxsreputationitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsbanlist.cc - * - * RetroShare Serialiser. - * - * Copyright 2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsreputationitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/rsitems/rsgxsreputationitems.h b/libretroshare/src/rsitems/rsgxsreputationitems.h index d4134f745..6bcd77451 100644 --- a/libretroshare/src/rsitems/rsgxsreputationitems.h +++ b/libretroshare/src/rsitems/rsgxsreputationitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsreputationitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014-2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_GXSREPUTATION_ITEMS_H #define RS_GXSREPUTATION_ITEMS_H -/* - * libretroshare/src/serialiser: rsgxsreputationitems.h - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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 #include "rsitems/rsserviceids.h" diff --git a/libretroshare/src/rsitems/rsgxsupdateitems.cc b/libretroshare/src/rsitems/rsgxsupdateitems.cc index a5f3ecf02..5fb7c94fb 100644 --- a/libretroshare/src/rsitems/rsgxsupdateitems.cc +++ b/libretroshare/src/rsitems/rsgxsupdateitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgxsupdateitems.h - * - * RetroShare Serialiser. - * - * Copyright 2012 Christopher Evi-Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsupdateitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstypeserializer.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/rsitems/rsgxsupdateitems.h b/libretroshare/src/rsitems/rsgxsupdateitems.h index 5d13028ff..d1ca0eecd 100644 --- a/libretroshare/src/rsitems/rsgxsupdateitems.h +++ b/libretroshare/src/rsitems/rsgxsupdateitems.h @@ -1,33 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsgxsupdateitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSGXSUPDATEITEMS_H_ #define RSGXSUPDATEITEMS_H_ -/* - * libretroshare/src/serialiser: rsgxsupdateitems.h - * - * RetroShare Serialiser. - * - * Copyright 2012 Christopher Evi-Parker - * - * 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 "gxs/rsgxs.h" #include "gxs/rsgxsdata.h" #include "serialiser/rstlvidset.h" diff --git a/libretroshare/src/rsitems/rsheartbeatitems.h b/libretroshare/src/rsitems/rsheartbeatitems.h index 87d480b3e..b7e4f27c6 100644 --- a/libretroshare/src/rsitems/rsheartbeatitems.h +++ b/libretroshare/src/rsitems/rsheartbeatitems.h @@ -1,30 +1,24 @@ -/* - * libretroshare/src/serialiser: rsheartbeatitems.h - * - * Serialiser for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/rsitems: rsheartbeatitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_HEARTBEAT_ITEMS_H #define RS_HEARTBEAT_ITEMS_H diff --git a/libretroshare/src/rsitems/rshistoryitems.cc b/libretroshare/src/rsitems/rshistoryitems.cc index 1f16e976f..4cfb04945 100644 --- a/libretroshare/src/rsitems/rshistoryitems.cc +++ b/libretroshare/src/rsitems/rshistoryitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rshistoryitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2011 by Thunder. - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rshistoryitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Thunder. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/rshistoryitems.h" #include "rsitems/rsconfigitems.h" diff --git a/libretroshare/src/rsitems/rshistoryitems.h b/libretroshare/src/rsitems/rshistoryitems.h index 7f65f3d19..693817757 100644 --- a/libretroshare/src/rsitems/rshistoryitems.h +++ b/libretroshare/src/rsitems/rshistoryitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rshistoryitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Thunder. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_HISTORY_ITEMS_H #define RS_HISTORY_ITEMS_H -/* - * libretroshare/src/serialiser: rshistoryitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Thunder. - * - * 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 "rsitems/rsserviceids.h" #include "serialiser/rsserial.h" #include "rsitems/rsconfigitems.h" diff --git a/libretroshare/src/rsitems/rsitem.h b/libretroshare/src/rsitems/rsitem.h index 545870631..c7cdccf5b 100644 --- a/libretroshare/src/rsitems/rsitem.h +++ b/libretroshare/src/rsitems/rsitem.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsitem.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * RetroShare Serialiser. - * Copyright (C) 2018 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #include // for typeid diff --git a/libretroshare/src/rsitems/rsmsgitems.cc b/libretroshare/src/rsitems/rsmsgitems.cc index e9668cc9f..32d32dd06 100644 --- a/libretroshare/src/rsitems/rsmsgitems.cc +++ b/libretroshare/src/rsitems/rsmsgitems.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsbaseitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsmsgitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/rsitems/rsmsgitems.h b/libretroshare/src/rsitems/rsmsgitems.h index 71f546683..ad84ec3ba 100644 --- a/libretroshare/src/rsitems/rsmsgitems.h +++ b/libretroshare/src/rsitems/rsmsgitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsmsgitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_MSG_ITEMS_H #define RS_MSG_ITEMS_H -/* - * libretroshare/src/serialiser: rsmsgitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - #include #include "retroshare/rstypes.h" diff --git a/libretroshare/src/rsitems/rsnxsitems.cc b/libretroshare/src/rsitems/rsnxsitems.cc index 8c6775275..ab596a99b 100644 --- a/libretroshare/src/rsitems/rsnxsitems.cc +++ b/libretroshare/src/rsitems/rsnxsitems.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsnxsitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker,Robert Fernie* + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsnxsitems.h" #include "util/rsprint.h" #include diff --git a/libretroshare/src/rsitems/rsnxsitems.h b/libretroshare/src/rsitems/rsnxsitems.h index f717a3d09..ea4dbea06 100644 --- a/libretroshare/src/rsitems/rsnxsitems.h +++ b/libretroshare/src/rsitems/rsnxsitems.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsnxsitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker,Robert Fernie* + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSNXSITEMS_H #define RSNXSITEMS_H -/* - * libretroshare/src/serialiser: rsnxssitems.h - * - * RetroShare Serialiser. - * - * Copyright 2012 Christopher Evi-Parker, 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 #include diff --git a/libretroshare/src/rsitems/rsphotoitems.cc b/libretroshare/src/rsitems/rsphotoitems.cc index 9c9ff2d02..7d137a29a 100644 --- a/libretroshare/src/rsitems/rsphotoitems.cc +++ b/libretroshare/src/rsitems/rsphotoitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/retroshare: rsphoto.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 by Christopher Evi-Parker, 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsphotoitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker,Robert Fernie* + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsitems/rsphotoitems.h" diff --git a/libretroshare/src/rsitems/rsphotoitems.h b/libretroshare/src/rsitems/rsphotoitems.h index 3819edb88..2aa041597 100644 --- a/libretroshare/src/rsitems/rsphotoitems.h +++ b/libretroshare/src/rsitems/rsphotoitems.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/retroshare: rsphoto.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 by Christopher Evi-Parker, 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsphotoitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker,Robert Fernie* + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSPHOTOV2ITEMS_H_ #define RSPHOTOV2ITEMS_H_ diff --git a/libretroshare/src/rsitems/rspluginitems.h b/libretroshare/src/rsitems/rspluginitems.h index c21567cd1..29069815d 100644 --- a/libretroshare/src/rsitems/rspluginitems.h +++ b/libretroshare/src/rsitems/rspluginitems.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services: p3turtle.h - * - * Services for RetroShare. - * - * Copyright 2009 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - - +/******************************************************************************* + * libretroshare/src/rsitems: rspluginitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "rsitems/rsitem.h" diff --git a/libretroshare/src/rsitems/rsposteditems.cc b/libretroshare/src/rsitems/rsposteditems.cc index 378153df3..67a5a9873 100644 --- a/libretroshare/src/rsitems/rsposteditems.cc +++ b/libretroshare/src/rsitems/rsposteditems.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/gxs: rsopsteditems.cc - * - * RetroShare Serialiser. - * - * Copyright 2012-2013 by Robert Fernie, Christopher Evi-Parker - * - * 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsposteditems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/rsposteditems.h" #include "serialiser/rstypeserializer.h" diff --git a/libretroshare/src/rsitems/rsposteditems.h b/libretroshare/src/rsitems/rsposteditems.h index b78835451..62ab7a6af 100644 --- a/libretroshare/src/rsitems/rsposteditems.h +++ b/libretroshare/src/rsitems/rsposteditems.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsposteditems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSPOSTEDITEMS_H #define RSPOSTEDITEMS_H diff --git a/libretroshare/src/rsitems/rsrttitems.cc b/libretroshare/src/rsitems/rsrttitems.cc index 033975a3b..739f1c06d 100644 --- a/libretroshare/src/rsitems/rsrttitems.cc +++ b/libretroshare/src/rsitems/rsrttitems.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsrttitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2011-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsrttitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/rsrttitems.h" /*** diff --git a/libretroshare/src/rsitems/rsrttitems.h b/libretroshare/src/rsitems/rsrttitems.h index 90b2e385e..54f612ee6 100644 --- a/libretroshare/src/rsitems/rsrttitems.h +++ b/libretroshare/src/rsitems/rsrttitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsrttitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2013 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_RTT_ITEMS_H #define RS_RTT_ITEMS_H -/* - * libretroshare/src/serialiser: rsrttitems.h - * - * RetroShare Serialiser. - * - * Copyright 2011-2013 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.1 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 #include "rsitems/rsitem.h" diff --git a/libretroshare/src/rsitems/rsserviceids.h b/libretroshare/src/rsitems/rsserviceids.h index 557bc54d7..4c7f26fd8 100644 --- a/libretroshare/src/rsitems/rsserviceids.h +++ b/libretroshare/src/rsitems/rsserviceids.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsserviceids.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_SERVICE_IDS_H #define RS_SERVICE_IDS_H -/* - * libretroshare/src/serialiser: rsserviceids.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - #include /* Single place for Cache/Service Ids (uint16_t) diff --git a/libretroshare/src/rsitems/rsserviceinfoitems.cc b/libretroshare/src/rsitems/rsserviceinfoitems.cc index d0d2070ab..8d007941d 100644 --- a/libretroshare/src/rsitems/rsserviceinfoitems.cc +++ b/libretroshare/src/rsitems/rsserviceinfoitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsserviceinfoitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rsserviceinfoitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "serialiser/rstypeserializer.h" #include "rsitems/rsserviceinfoitems.h" diff --git a/libretroshare/src/rsitems/rsserviceinfoitems.h b/libretroshare/src/rsitems/rsserviceinfoitems.h index 04a524331..e3d04b3c8 100644 --- a/libretroshare/src/rsitems/rsserviceinfoitems.h +++ b/libretroshare/src/rsitems/rsserviceinfoitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsserviceinfoitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_SERVICE_INFO_ITEMS_H #define RS_SERVICE_INFO_ITEMS_H -/* - * libretroshare/src/serialiser: rsserviceinfoitems.h - * - * RetroShare Serialiser. - * - * Copyright 2012 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.1 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". - * - */ - // Provides serialiser for p3ServiceControl & p3ServiceInfo. #include diff --git a/libretroshare/src/rsitems/rsstatusitems.h b/libretroshare/src/rsitems/rsstatusitems.h index 8a8a946b7..e92db7816 100644 --- a/libretroshare/src/rsitems/rsstatusitems.h +++ b/libretroshare/src/rsitems/rsstatusitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsitems: rsstatusitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Vinny Do. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_STATUS_ITEMS_H #define RS_STATUS_ITEMS_H -/* - * libretroshare/src/serialiser: rsstatusitems.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Vinny Do. - * - * 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 "rsitems/rsserviceids.h" #include "rsitems/itempriorities.h" #include "rsitems/rsitem.h" diff --git a/libretroshare/src/rsitems/rswikiitems.cc b/libretroshare/src/rsitems/rswikiitems.cc index 96f9e2768..e7ffa8508 100644 --- a/libretroshare/src/rsitems/rswikiitems.cc +++ b/libretroshare/src/rsitems/rswikiitems.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rswikiitems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rswikiitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsitems/rswikiitems.h" diff --git a/libretroshare/src/rsitems/rswikiitems.h b/libretroshare/src/rsitems/rswikiitems.h index 378b77e5a..fa5cf1533 100644 --- a/libretroshare/src/rsitems/rswikiitems.h +++ b/libretroshare/src/rsitems/rswikiitems.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/serialiser: rswikiitems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/rsitems: rswikiitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_WIKI_ITEMS_H #define RS_WIKI_ITEMS_H diff --git a/libretroshare/src/rsitems/rswireitems.cc b/libretroshare/src/rsitems/rswireitems.cc index 7a8008ff8..eb3896f17 100644 --- a/libretroshare/src/rsitems/rswireitems.cc +++ b/libretroshare/src/rsitems/rswireitems.cc @@ -1,32 +1,27 @@ -/* - * libretroshare/src/serialiser: rswikiitems.cc - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsitems: rswireitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rswireitems.h" - #include "serialiser/rstypeserializer.h" #define WIRE_DEBUG 1 diff --git a/libretroshare/src/rsitems/rswireitems.h b/libretroshare/src/rsitems/rswireitems.h index 137619aa6..4db5f3d25 100644 --- a/libretroshare/src/rsitems/rswireitems.h +++ b/libretroshare/src/rsitems/rswireitems.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/serialiser: rswireitems.h - * - * RetroShare C++ Interface. - * - * Copyright 2012-2012 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/rsitems: rswireitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_WIRE_ITEMS_H #define RS_WIRE_ITEMS_H diff --git a/libretroshare/src/rsserver/p3face.h b/libretroshare/src/rsserver/p3face.h index 8e1ffac56..6a9d7b2ea 100644 --- a/libretroshare/src/rsserver/p3face.h +++ b/libretroshare/src/rsserver/p3face.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsserver: p3face.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_P3RS_INTERFACE_H #define MRK_P3RS_INTERFACE_H -/* - * "$Id: p3face.h,v 1.9 2007-05-05 16:10:06 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ - //#include "server/filedexserver.h" #include "ft/ftserver.h" //#include "pqi/pqissl.h" diff --git a/libretroshare/src/rsserver/p3history.cc b/libretroshare/src/rsserver/p3history.cc index 6c631ef43..9492a09f0 100644 --- a/libretroshare/src/rsserver/p3history.cc +++ b/libretroshare/src/rsserver/p3history.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src/rsserver: p3history.h - * - * RetroShare C++ Interface. - * - * Copyright 2011 by Thunder. - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/rsserver: p3history.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Thunder. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "p3history.h" #include "pqi/p3historymgr.h" diff --git a/libretroshare/src/rsserver/p3history.h b/libretroshare/src/rsserver/p3history.h index 70b7c701b..73d009657 100644 --- a/libretroshare/src/rsserver/p3history.h +++ b/libretroshare/src/rsserver/p3history.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsserver: p3history.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Thunder. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_P3HISTORY_INTERFACE_H #define RS_P3HISTORY_INTERFACE_H -/* - * libretroshare/src/rsserver: p3history.h - * - * RetroShare C++ Interface. - * - * Copyright 2011 by Thunder. - * - * 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 "retroshare/rshistory.h" class p3HistoryMgr; diff --git a/libretroshare/src/rsserver/p3msgs.cc b/libretroshare/src/rsserver/p3msgs.cc index 0e058cac9..da2220912 100644 --- a/libretroshare/src/rsserver/p3msgs.cc +++ b/libretroshare/src/rsserver/p3msgs.cc @@ -1,31 +1,24 @@ - -/* - * "$Id: p3face-msgs.cc,v 1.7 2007-05-05 16:10:06 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/rsserver: p3msgs.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "util/rsdir.h" diff --git a/libretroshare/src/rsserver/p3msgs.h b/libretroshare/src/rsserver/p3msgs.h index 7c242680f..edd5911a8 100644 --- a/libretroshare/src/rsserver/p3msgs.h +++ b/libretroshare/src/rsserver/p3msgs.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsserver: p3msgs.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_P3MSG_INTERFACE_H #define RS_P3MSG_INTERFACE_H -/* - * libretroshare/src/rsserver: p3msgs.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-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". - * - */ - #include "retroshare/rsmsgs.h" #include "retroshare/rsgxsifacetypes.h" diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 52f6c3dba..9d3b8f60c 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -1,29 +1,25 @@ -/* - * libretroshare/src/rsserver: p3peers.cc - * - * RetroShare C++ Interface. - * - * Copyright 2004-2008 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsserver: p3peers.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * Copyright (C) 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/radix64.h" #include "pgp/pgpkeyutil.h" diff --git a/libretroshare/src/rsserver/p3peers.h b/libretroshare/src/rsserver/p3peers.h index 4f9b661d7..b30fc8eb6 100644 --- a/libretroshare/src/rsserver/p3peers.h +++ b/libretroshare/src/rsserver/p3peers.h @@ -1,31 +1,26 @@ +/******************************************************************************* + * libretroshare/src/rsserver: p3peers.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_P3_PEER_INTERFACE_H #define RETROSHARE_P3_PEER_INTERFACE_H - -/* - * libretroshare/src/rsserver: p3peers.h - * - * RetroShare C++ Interface. - * - * 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". - * - */ - /* get OS-specific definitions for: * struct sockaddr_storage */ diff --git a/libretroshare/src/rsserver/p3serverconfig.cc b/libretroshare/src/rsserver/p3serverconfig.cc index eab0f5722..21d43cbae 100644 --- a/libretroshare/src/rsserver/p3serverconfig.cc +++ b/libretroshare/src/rsserver/p3serverconfig.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/rsserver: p3serverconfig.h - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsserver: p3serverconfig.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsserver/p3serverconfig.h" #include "services/p3bwctrl.h" diff --git a/libretroshare/src/rsserver/p3serverconfig.h b/libretroshare/src/rsserver/p3serverconfig.h index 134558049..1a806d713 100644 --- a/libretroshare/src/rsserver/p3serverconfig.h +++ b/libretroshare/src/rsserver/p3serverconfig.h @@ -1,32 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsserver: p3serverconfig.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef LIBRETROSHARE_CONFIG_IMPLEMENTATION_H #define LIBRETROSHARE_CONFIG_IMPLEMENTATION_H -/* - * libretroshare/src/rsserver: p3serverconfig.h - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - - #include "retroshare/rsconfig.h" #include "pqi/p3peermgr.h" #include "pqi/p3linkmgr.h" diff --git a/libretroshare/src/rsserver/p3status.cc b/libretroshare/src/rsserver/p3status.cc index a1733a86c..4185e6802 100644 --- a/libretroshare/src/rsserver/p3status.cc +++ b/libretroshare/src/rsserver/p3status.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src/rsserver: p3msgs.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-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". - * - */ - - +/******************************************************************************* + * libretroshare/src/rsserver: p3status.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Chris Evi-Parker. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "p3status.h" #include "services/p3statusservice.h" diff --git a/libretroshare/src/rsserver/p3status.h b/libretroshare/src/rsserver/p3status.h index bec3d4822..a6ae941f0 100644 --- a/libretroshare/src/rsserver/p3status.h +++ b/libretroshare/src/rsserver/p3status.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/rsserver: p3status.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Chris Evi-Parker. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_P3STATUS_INTERFACE_H #define RS_P3STATUS_INTERFACE_H -/* - * libretroshare/src/rsserver: p3status.h - * - * RetroShare C++ Interface. - * - * Copyright 2007-2008 by Chris Evi-Parker. - * - * 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 "retroshare/rsstatus.h" diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index 6136a2a87..f9965cee4 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/rsserver/rsaccounts.cc - * - * RetroShare C++ Interface. - * - * Copyright 2013-2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsserver: rsaccounts.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /********************************************************************* * Libretroshare interface declared in rsaccounts.h. diff --git a/libretroshare/src/rsserver/rsaccounts.h b/libretroshare/src/rsserver/rsaccounts.h index 8ff253587..2ec87b3e6 100644 --- a/libretroshare/src/rsserver/rsaccounts.h +++ b/libretroshare/src/rsserver/rsaccounts.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/rsserver/rsaccounts.h - * - * RetroShare C++ Interface. - * - * Copyright 2013-2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/rsserver: rsaccounts.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /********************************************************************* * Header providing interface for libretroshare access to RsAccounts stuff. From 70f09b654c4f7a7eaefc521817c08ff5a7babc52 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 29 May 2018 21:27:12 +0200 Subject: [PATCH 058/213] re-licensed serialiser/ --- libretroshare/src/serialiser/rsbaseserial.cc | 46 +++++++-------- libretroshare/src/serialiser/rsbaseserial.h | 46 +++++++-------- libretroshare/src/serialiser/rsserial.cc | 46 +++++++-------- libretroshare/src/serialiser/rsserial.h | 46 +++++++-------- libretroshare/src/serialiser/rsserializable.h | 39 +++++++------ libretroshare/src/serialiser/rsserializer.cc | 46 +++++++-------- libretroshare/src/serialiser/rsserializer.h | 47 +++++++-------- libretroshare/src/serialiser/rstlvaddrs.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvaddrs.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvbanlist.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvbanlist.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvbase.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvbase.h | 47 +++++++-------- libretroshare/src/serialiser/rstlvbinary.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvbinary.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvfileitem.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvfileitem.h | 46 +++++++-------- .../src/serialiser/rstlvgenericmap.h | 46 +++++++-------- .../src/serialiser/rstlvgenericmap.inl | 46 +++++++-------- .../src/serialiser/rstlvgenericparam.cc | 47 +++++++-------- .../src/serialiser/rstlvgenericparam.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvidset.cc | 57 +++++++------------ libretroshare/src/serialiser/rstlvidset.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvimage.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvimage.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvitem.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvitem.h | 45 +++++++-------- libretroshare/src/serialiser/rstlvkeys.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvkeys.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvkeyvalue.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvkeyvalue.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvlist.h | 46 +++++++-------- libretroshare/src/serialiser/rstlvmaps.h | 52 +++++++---------- libretroshare/src/serialiser/rstlvstring.cc | 47 +++++++-------- libretroshare/src/serialiser/rstlvstring.h | 46 +++++++-------- .../src/serialiser/rstypeserializer.cc | 47 +++++++-------- .../src/serialiser/rstypeserializer.h | 47 +++++++-------- 37 files changed, 780 insertions(+), 946 deletions(-) diff --git a/libretroshare/src/serialiser/rsbaseserial.cc b/libretroshare/src/serialiser/rsbaseserial.cc index ef862db5c..a5b84518f 100644 --- a/libretroshare/src/serialiser/rsbaseserial.cc +++ b/libretroshare/src/serialiser/rsbaseserial.cc @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsbaseserial.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/serialiser: rsbaseserial.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include /* Included because GCC4.4 wants it */ #include /* Included because GCC4.4 wants it */ diff --git a/libretroshare/src/serialiser/rsbaseserial.h b/libretroshare/src/serialiser/rsbaseserial.h index 650fc9e6d..512feb393 100644 --- a/libretroshare/src/serialiser/rsbaseserial.h +++ b/libretroshare/src/serialiser/rsbaseserial.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rsbaseserial.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_BASE_PACKING_H #define RS_BASE_PACKING_H -/* - * libretroshare/src/serialiser: rsbaseserial.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - #include #include #include diff --git a/libretroshare/src/serialiser/rsserial.cc b/libretroshare/src/serialiser/rsserial.cc index 230501ea8..0a1a7503f 100644 --- a/libretroshare/src/serialiser/rsserial.cc +++ b/libretroshare/src/serialiser/rsserial.cc @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/serialiser: rsserial.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/serialiser: rsserial.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/serialiser/rsserial.h b/libretroshare/src/serialiser/rsserial.h index ee3a79537..3ce56a424 100644 --- a/libretroshare/src/serialiser/rsserial.h +++ b/libretroshare/src/serialiser/rsserial.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rsserial.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_BASE_SERIALISER_H #define RS_BASE_SERIALISER_H -/* - * libretroshare/src/serialiser: rsserial.h - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - #include #include #include diff --git a/libretroshare/src/serialiser/rsserializable.h b/libretroshare/src/serialiser/rsserializable.h index c717afc4b..fc6d73662 100644 --- a/libretroshare/src/serialiser/rsserializable.h +++ b/libretroshare/src/serialiser/rsserializable.h @@ -1,22 +1,25 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rsserializable.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * RetroShare Serialiser. - * Copyright (C) 2016-2018 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - #include "serialiser/rsserializer.h" diff --git a/libretroshare/src/serialiser/rsserializer.cc b/libretroshare/src/serialiser/rsserializer.cc index 164f31342..4a07da014 100644 --- a/libretroshare/src/serialiser/rsserializer.cc +++ b/libretroshare/src/serialiser/rsserializer.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/serialiser: rsserializer.cc - * - * RetroShare Serialiser. - * - * Copyright 2016 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rsserializer.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "rsitems/rsitem.h" diff --git a/libretroshare/src/serialiser/rsserializer.h b/libretroshare/src/serialiser/rsserializer.h index aa12feeef..7045218df 100644 --- a/libretroshare/src/serialiser/rsserializer.h +++ b/libretroshare/src/serialiser/rsserializer.h @@ -1,28 +1,25 @@ -/* - * libretroshare/src/serialiser: rsserializer.h - * - * RetroShare Serialiser. - * - * Copyright (C) 2016 Cyril Soler - * Copyright (C) 2018 Gioacchino Mazzurco - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/serialiser: rsserializer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016 Cyril Soler * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once /////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/libretroshare/src/serialiser/rstlvaddrs.cc b/libretroshare/src/serialiser/rstlvaddrs.cc index d3f7da87f..5f9a06390 100644 --- a/libretroshare/src/serialiser/rstlvaddrs.cc +++ b/libretroshare/src/serialiser/rstlvaddrs.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvtypes.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvaddr.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvbase.h" #include "serialiser/rstlvaddrs.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/serialiser/rstlvaddrs.h b/libretroshare/src/serialiser/rstlvaddrs.h index eebda4b31..07b668559 100644 --- a/libretroshare/src/serialiser/rstlvaddrs.h +++ b/libretroshare/src/serialiser/rstlvaddrs.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvaddr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvaddrs.h - * - * RetroShare Serialiser. - * - * Copyright 2010 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. ******************************************************************/ diff --git a/libretroshare/src/serialiser/rstlvbanlist.cc b/libretroshare/src/serialiser/rstlvbanlist.cc index 16cef67dc..92bd3a6d2 100644 --- a/libretroshare/src/serialiser/rstlvbanlist.cc +++ b/libretroshare/src/serialiser/rstlvbanlist.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvtypes.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvbanlist.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvbanlist.h" #include "serialiser/rstlvbase.h" diff --git a/libretroshare/src/serialiser/rstlvbanlist.h b/libretroshare/src/serialiser/rstlvbanlist.h index f4cbf54c4..a08f92a7a 100644 --- a/libretroshare/src/serialiser/rstlvbanlist.h +++ b/libretroshare/src/serialiser/rstlvbanlist.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvbanlist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvbanlist.h - * - * RetroShare Serialiser. - * - * Copyright 2011 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. ******************************************************************/ diff --git a/libretroshare/src/serialiser/rstlvbase.cc b/libretroshare/src/serialiser/rstlvbase.cc index f92dae4d9..9cf713193 100644 --- a/libretroshare/src/serialiser/rstlvbase.cc +++ b/libretroshare/src/serialiser/rstlvbase.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvbase.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Horatio, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvbase.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie, Horatio, Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "serialiser/rstlvbase.h" diff --git a/libretroshare/src/serialiser/rstlvbase.h b/libretroshare/src/serialiser/rstlvbase.h index 3f6ac1102..fa685b11e 100644 --- a/libretroshare/src/serialiser/rstlvbase.h +++ b/libretroshare/src/serialiser/rstlvbase.h @@ -1,31 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvbase.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie, Horatio, Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvbase.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Horatio, Chris Parker - * - * 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". - * - */ - - /******************************************************************* * These are the general TLV (un)packing routines. * diff --git a/libretroshare/src/serialiser/rstlvbinary.cc b/libretroshare/src/serialiser/rstlvbinary.cc index 9c84f6ec2..daa35c56d 100644 --- a/libretroshare/src/serialiser/rstlvbinary.cc +++ b/libretroshare/src/serialiser/rstlvbinary.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvbinary.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvbinary.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsmemory.h" #include "serialiser/rstlvbinary.h" diff --git a/libretroshare/src/serialiser/rstlvbinary.h b/libretroshare/src/serialiser/rstlvbinary.h index a22269e0f..3d41d5402 100644 --- a/libretroshare/src/serialiser/rstlvbinary.h +++ b/libretroshare/src/serialiser/rstlvbinary.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvbinary.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvbinary.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. * diff --git a/libretroshare/src/serialiser/rstlvfileitem.cc b/libretroshare/src/serialiser/rstlvfileitem.cc index dfc90672c..098b8de6f 100644 --- a/libretroshare/src/serialiser/rstlvfileitem.cc +++ b/libretroshare/src/serialiser/rstlvfileitem.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvfileitem.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvfileitem.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvfileitem.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/serialiser/rstlvfileitem.h b/libretroshare/src/serialiser/rstlvfileitem.h index 1a474e60c..174753364 100644 --- a/libretroshare/src/serialiser/rstlvfileitem.h +++ b/libretroshare/src/serialiser/rstlvfileitem.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvfileitem.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvfileitem.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. * diff --git a/libretroshare/src/serialiser/rstlvgenericmap.h b/libretroshare/src/serialiser/rstlvgenericmap.h index baccae90f..0cc4a3a88 100644 --- a/libretroshare/src/serialiser/rstlvgenericmap.h +++ b/libretroshare/src/serialiser/rstlvgenericmap.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvgenericmap.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_TLV_GENERIC_MAP_H #define RS_TLV_GENERIC_MAP_H -/* - * libretroshare/src/serialiser: rstlvgenericmap.h - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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 "serialiser/rstlvitem.h" #include "serialiser/rstlvgenericparam.h" diff --git a/libretroshare/src/serialiser/rstlvgenericmap.inl b/libretroshare/src/serialiser/rstlvgenericmap.inl index 540ee5d2e..b5239d2f7 100644 --- a/libretroshare/src/serialiser/rstlvgenericmap.inl +++ b/libretroshare/src/serialiser/rstlvgenericmap.inl @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvgenericmap.inl - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvgenericmap.inl * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvbase.h" diff --git a/libretroshare/src/serialiser/rstlvgenericparam.cc b/libretroshare/src/serialiser/rstlvgenericparam.cc index 483bae0fb..941fd6883 100644 --- a/libretroshare/src/serialiser/rstlvgenericparam.cc +++ b/libretroshare/src/serialiser/rstlvgenericparam.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvgenericparam.cc - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvgenericparam.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvgenericparam.h" #include "serialiser/rstlvbase.h" #include diff --git a/libretroshare/src/serialiser/rstlvgenericparam.h b/libretroshare/src/serialiser/rstlvgenericparam.h index 31da8e275..b1b6417a7 100644 --- a/libretroshare/src/serialiser/rstlvgenericparam.h +++ b/libretroshare/src/serialiser/rstlvgenericparam.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvgenericparam.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_TLV_GENERIC_PARAM_H #define RS_TLV_GENERIC_PARAM_H -/* - * libretroshare/src/serialiser: rstlvgenericparam.h - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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 "serialiser/rstlvitem.h" #if 0 diff --git a/libretroshare/src/serialiser/rstlvidset.cc b/libretroshare/src/serialiser/rstlvidset.cc index 918d98526..c3d6ac3d7 100644 --- a/libretroshare/src/serialiser/rstlvidset.cc +++ b/libretroshare/src/serialiser/rstlvidset.cc @@ -1,41 +1,26 @@ - -/* - * libretroshare/src/serialiser: rstlvtypes.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvidset.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rstlvidset.h" -#if 0 -#include "rstlvbase.h" -#include "rsbaseserial.h" -#include "util/rsprint.h" -#include -#include -#include -#include -#endif - #define TLV_DEBUG 1 /************************************* Service Id Set ************************************/ diff --git a/libretroshare/src/serialiser/rstlvidset.h b/libretroshare/src/serialiser/rstlvidset.h index b1d0ee51f..26c5c7ce7 100644 --- a/libretroshare/src/serialiser/rstlvidset.h +++ b/libretroshare/src/serialiser/rstlvidset.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvidset.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvidset.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. * diff --git a/libretroshare/src/serialiser/rstlvimage.cc b/libretroshare/src/serialiser/rstlvimage.cc index 4083f9e54..ce8ea5d6c 100644 --- a/libretroshare/src/serialiser/rstlvimage.cc +++ b/libretroshare/src/serialiser/rstlvimage.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvimage.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvimage.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvimage.h" #if 0 diff --git a/libretroshare/src/serialiser/rstlvimage.h b/libretroshare/src/serialiser/rstlvimage.h index 51c18288c..b5602096f 100644 --- a/libretroshare/src/serialiser/rstlvimage.h +++ b/libretroshare/src/serialiser/rstlvimage.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvimage.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvimage.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. * diff --git a/libretroshare/src/serialiser/rstlvitem.cc b/libretroshare/src/serialiser/rstlvitem.cc index 02a1f8c63..16ca002db 100644 --- a/libretroshare/src/serialiser/rstlvitem.cc +++ b/libretroshare/src/serialiser/rstlvitem.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvtypes.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvitem.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rstlvitem.h" #include "rstlvbase.h" #include diff --git a/libretroshare/src/serialiser/rstlvitem.h b/libretroshare/src/serialiser/rstlvitem.h index 0cd0d42d7..1623a8224 100644 --- a/libretroshare/src/serialiser/rstlvitem.h +++ b/libretroshare/src/serialiser/rstlvitem.h @@ -1,28 +1,25 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvitem.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvitem.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ /******************************************************************* * These are the Compound TLV structures that must be (un)packed. diff --git a/libretroshare/src/serialiser/rstlvkeys.cc b/libretroshare/src/serialiser/rstlvkeys.cc index 538862320..b13250479 100644 --- a/libretroshare/src/serialiser/rstlvkeys.cc +++ b/libretroshare/src/serialiser/rstlvkeys.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvtypes.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvkeys.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rstlvkeys.h" #include "rstlvbase.h" #include "rsbaseserial.h" diff --git a/libretroshare/src/serialiser/rstlvkeys.h b/libretroshare/src/serialiser/rstlvkeys.h index 632a7fb09..5f82e51f0 100644 --- a/libretroshare/src/serialiser/rstlvkeys.h +++ b/libretroshare/src/serialiser/rstlvkeys.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvkeys.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvkeys.h - * - * RetroShare Serialiser. - * - * Copyright 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. ******************************************************************/ diff --git a/libretroshare/src/serialiser/rstlvkeyvalue.cc b/libretroshare/src/serialiser/rstlvkeyvalue.cc index 6bef23277..2e1a9dd16 100644 --- a/libretroshare/src/serialiser/rstlvkeyvalue.cc +++ b/libretroshare/src/serialiser/rstlvkeyvalue.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvtypes.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvkeyvalue.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rstlvkeyvalue.h" #include "rstlvbase.h" diff --git a/libretroshare/src/serialiser/rstlvkeyvalue.h b/libretroshare/src/serialiser/rstlvkeyvalue.h index 2e288a15b..63cf3091f 100644 --- a/libretroshare/src/serialiser/rstlvkeyvalue.h +++ b/libretroshare/src/serialiser/rstlvkeyvalue.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvkeyvalue.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvkeyvalue.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. * diff --git a/libretroshare/src/serialiser/rstlvlist.h b/libretroshare/src/serialiser/rstlvlist.h index decd2bc6b..099868179 100644 --- a/libretroshare/src/serialiser/rstlvlist.h +++ b/libretroshare/src/serialiser/rstlvlist.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvlist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvlist.h - * - * RetroShare Serialiser. - * - * Copyright 2014 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". - * - */ - #include "serialiser/rstlvbase.h" #include "serialiser/rstlvitem.h" diff --git a/libretroshare/src/serialiser/rstlvmaps.h b/libretroshare/src/serialiser/rstlvmaps.h index 06a3fd6d5..49b05e382 100644 --- a/libretroshare/src/serialiser/rstlvmaps.h +++ b/libretroshare/src/serialiser/rstlvmaps.h @@ -1,37 +1,27 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvmaps.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_TLV_MAPS_H #define RS_TLV_MAPS_H -/* - * libretroshare/src/serialiser: rstlvmaps.h - * - * RetroShare Serialiser. - * - * Copyright 2014 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.1 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". - * - */ - -#if 0 -#include "serialiser/rstlvgenericmaps.h" - -#endif - - class RsTlvOpinionMapRef: public RsTlvGenericMapRef { public: diff --git a/libretroshare/src/serialiser/rstlvstring.cc b/libretroshare/src/serialiser/rstlvstring.cc index 43344c118..8f800b73c 100644 --- a/libretroshare/src/serialiser/rstlvstring.cc +++ b/libretroshare/src/serialiser/rstlvstring.cc @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/serialiser: rstlvstring.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/serialiser: rstlvstring.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rstlvstring.h" #include "serialiser/rstlvbase.h" diff --git a/libretroshare/src/serialiser/rstlvstring.h b/libretroshare/src/serialiser/rstlvstring.h index 9c22ee939..5e0c2f276 100644 --- a/libretroshare/src/serialiser/rstlvstring.h +++ b/libretroshare/src/serialiser/rstlvstring.h @@ -1,30 +1,26 @@ +/******************************************************************************* + * libretroshare/src/serialiser: rstlvstring.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2008 by Robert Fernie,Chris Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * libretroshare/src/serialiser: rstlvstring.h - * - * RetroShare Serialiser. - * - * Copyright 2007-2008 by Robert Fernie, Chris Parker - * - * 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". - * - */ - /******************************************************************* * These are the Compound TLV structures that must be (un)packed. * diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index e7faa5b52..5c91c9da2 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -1,28 +1,25 @@ -/* - * libretroshare/src/serialiser: rstypeserializer.cc - * - * RetroShare Serialiser. - * - * Copyright (C) 2017 Cyril Soler - * Copyright (C) 2018 Gioacchino Mazzurco - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/serialiser: rstypeserializer.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Cyril Soler * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsserializer.h" #include "serialiser/rstypeserializer.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index 3e3c0b251..5c20f3f9f 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -1,28 +1,25 @@ -/* - * libretroshare/src/serialiser: rstypeserializer.h - * - * RetroShare Serialiser. - * - * Copyright (C) 2017 Cyril Soler - * Copyright (C) 2018 Gioacchino Mazzurco - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/serialiser: rstypeserializer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Cyril Soler * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "serialiser/rsserial.h" From b3853156cea6cf302b2dd928fcf976908507885d Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 29 May 2018 21:54:27 +0200 Subject: [PATCH 059/213] re-licensed services/ --- libretroshare/src/libretroshare.pro | 2 +- .../src/services/autoproxy/p3i2pbob.cc | 21 ++++++++ .../src/services/autoproxy/p3i2pbob.h | 21 ++++++++ .../services/autoproxy/rsautoproxymonitor.cc | 21 ++++++++ .../services/autoproxy/rsautoproxymonitor.h | 21 ++++++++ libretroshare/src/services/p3banlist.cc | 46 ++++++++---------- libretroshare/src/services/p3banlist.h | 47 ++++++++---------- libretroshare/src/services/p3bwctrl.cc | 46 ++++++++---------- libretroshare/src/services/p3bwctrl.h | 47 ++++++++---------- libretroshare/src/services/p3discovery2.cc | 48 +++++++++---------- libretroshare/src/services/p3discovery2.h | 46 ++++++++---------- libretroshare/src/services/p3gxschannels.cc | 46 ++++++++---------- libretroshare/src/services/p3gxschannels.h | 46 ++++++++---------- libretroshare/src/services/p3gxscircles.cc | 46 ++++++++---------- libretroshare/src/services/p3gxscircles.h | 46 ++++++++---------- libretroshare/src/services/p3gxscommon.cc | 46 ++++++++---------- libretroshare/src/services/p3gxscommon.h | 45 ++++++++--------- libretroshare/src/services/p3gxsforums.cc | 46 ++++++++---------- libretroshare/src/services/p3gxsforums.h | 46 ++++++++---------- libretroshare/src/services/p3gxsreputation.cc | 46 ++++++++---------- libretroshare/src/services/p3gxsreputation.h | 47 ++++++++---------- libretroshare/src/services/p3heartbeat.cc | 46 ++++++++---------- libretroshare/src/services/p3heartbeat.h | 46 ++++++++---------- libretroshare/src/services/p3idservice.cc | 48 +++++++++---------- libretroshare/src/services/p3idservice.h | 46 ++++++++---------- libretroshare/src/services/p3msgservice.cc | 47 ++++++++---------- libretroshare/src/services/p3msgservice.h | 47 ++++++++---------- libretroshare/src/services/p3photoservice.cc | 21 ++++++++ libretroshare/src/services/p3photoservice.h | 46 ++++++++---------- libretroshare/src/services/p3postbase.cc | 46 ++++++++---------- libretroshare/src/services/p3postbase.h | 46 ++++++++---------- libretroshare/src/services/p3posted.cc | 46 ++++++++---------- libretroshare/src/services/p3posted.h | 45 ++++++++--------- libretroshare/src/services/p3rtt.cc | 46 ++++++++---------- libretroshare/src/services/p3rtt.h | 47 ++++++++---------- libretroshare/src/services/p3service.cc | 46 ++++++++---------- libretroshare/src/services/p3service.h | 46 ++++++++---------- libretroshare/src/services/p3serviceinfo.cc | 46 ++++++++---------- libretroshare/src/services/p3serviceinfo.h | 47 ++++++++---------- libretroshare/src/services/p3statusservice.cc | 46 ++++++++---------- libretroshare/src/services/p3statusservice.h | 46 ++++++++---------- libretroshare/src/services/p3wiki.cc | 46 ++++++++---------- libretroshare/src/services/p3wiki.h | 46 ++++++++---------- libretroshare/src/services/p3wire.cc | 46 ++++++++---------- libretroshare/src/services/p3wire.h | 46 ++++++++---------- 45 files changed, 927 insertions(+), 983 deletions(-) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index f2ef3e4fc..396a87eef 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -510,7 +510,7 @@ HEADERS += services/autoproxy/p3i2pbob.h \ services/p3discovery2.h \ services/p3heartbeat.h \ services/p3rtt.h \ - services/p3serviceinfo.cc \ + services/p3serviceinfo.h \ HEADERS += turtle/p3turtle.h \ turtle/rsturtleitem.h \ diff --git a/libretroshare/src/services/autoproxy/p3i2pbob.cc b/libretroshare/src/services/autoproxy/p3i2pbob.cc index 36e5604c7..390477127 100644 --- a/libretroshare/src/services/autoproxy/p3i2pbob.cc +++ b/libretroshare/src/services/autoproxy/p3i2pbob.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/services/autoproxy: p3i2pbob.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Sehraf * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include /* for usleep() */ diff --git a/libretroshare/src/services/autoproxy/p3i2pbob.h b/libretroshare/src/services/autoproxy/p3i2pbob.h index 5fd44bc85..27b911262 100644 --- a/libretroshare/src/services/autoproxy/p3i2pbob.h +++ b/libretroshare/src/services/autoproxy/p3i2pbob.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/services/autoproxy: p3i2pbob.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Sehraf * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3I2PBOB_H #define P3I2PBOB_H diff --git a/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc b/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc index d4d3f87ce..aef160590 100644 --- a/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc +++ b/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/services/autoproxy: rsautoproximonitor.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Sehraf * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsautoproxymonitor.h" #include /* for usleep() */ diff --git a/libretroshare/src/services/autoproxy/rsautoproxymonitor.h b/libretroshare/src/services/autoproxy/rsautoproxymonitor.h index 21ea95c3b..d9a4c16aa 100644 --- a/libretroshare/src/services/autoproxy/rsautoproxymonitor.h +++ b/libretroshare/src/services/autoproxy/rsautoproxymonitor.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/services/autoproxy: rsautoproximonitor.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2016 by Sehraf * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSAUTOPROXYMONITOR_H #define RSAUTOPROXYMONITOR_H diff --git a/libretroshare/src/services/p3banlist.cc b/libretroshare/src/services/p3banlist.cc index b1fc07113..cda290268 100644 --- a/libretroshare/src/services/p3banlist.cc +++ b/libretroshare/src/services/p3banlist.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3banlist.cc - * - * Ban List Service for RetroShare. - * - * Copyright 2011-2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3banlist.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/p3servicecontrol.h" #include "pqi/p3netmgr.h" #include "pqi/p3cfgmgr.h" diff --git a/libretroshare/src/services/p3banlist.h b/libretroshare/src/services/p3banlist.h index 34d4bc50c..ac22996a9 100644 --- a/libretroshare/src/services/p3banlist.h +++ b/libretroshare/src/services/p3banlist.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services/p3banlist.h - * - * Exchange list of Peers for Banning / Whitelisting. - * - * Copyright 2011 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3banlist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_RSBANLIST_HEADER #define SERVICE_RSBANLIST_HEADER diff --git a/libretroshare/src/services/p3bwctrl.cc b/libretroshare/src/services/p3bwctrl.cc index aa9106e47..7597c7fc9 100644 --- a/libretroshare/src/services/p3bwctrl.cc +++ b/libretroshare/src/services/p3bwctrl.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3bwctrl.cc - * - * Bandwidth Control Service for RetroShare. - * - * Copyright 2011-2011 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3bwctrl.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/p3linkmgr.h" #include "pqi/p3netmgr.h" #include "pqi/pqipersongrp.h" diff --git a/libretroshare/src/services/p3bwctrl.h b/libretroshare/src/services/p3bwctrl.h index 67e6f97fd..9b53f2d0d 100644 --- a/libretroshare/src/services/p3bwctrl.h +++ b/libretroshare/src/services/p3bwctrl.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services/p3bwctrl.h - * - * Bandwidth Control. - * - * Copyright 2012 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.1 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3bwctrl.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_RSBANDWIDTH_CONTROL_HEADER #define SERVICE_RSBANDWIDTH_CONTROL_HEADER diff --git a/libretroshare/src/services/p3discovery2.cc b/libretroshare/src/services/p3discovery2.cc index 3eacf2548..cf4bc28dd 100644 --- a/libretroshare/src/services/p3discovery2.cc +++ b/libretroshare/src/services/p3discovery2.cc @@ -1,29 +1,25 @@ -/* - * libretroshare/src/services: p3discovery2.cc - * - * Services for RetroShare. - * - * Copyright (C) 2004-2013 Robert Fernie. - * Copyright (C) 2018 Gioacchino Mazzurco - * - * 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3discovery2.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 Robert Fernie * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3discovery2.h" #include "pqi/p3peermgr.h" #include "util/rsversioninfo.h" diff --git a/libretroshare/src/services/p3discovery2.h b/libretroshare/src/services/p3discovery2.h index 79ac13135..a4b127553 100644 --- a/libretroshare/src/services/p3discovery2.h +++ b/libretroshare/src/services/p3discovery2.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3discovery2.h - * - * Services for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3discovery2.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_SERVICES_DISCOVERY2_H #define MRK_SERVICES_DISCOVERY2_H diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index e70769c7a..564088cee 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3gxschannels.cc - * - * GxsChannels interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxschannels.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3gxschannels.h" #include "rsitems/rsgxschannelitems.h" #include "util/radix64.h" diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index 0e6156f48..16833ba75 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3gxschannels.h - * - * GxsChannel interface for RetroShare. - * - * Copyright 2012-2012 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxschannels.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_GXSCHANNELS_SERVICE_HEADER #define P3_GXSCHANNELS_SERVICE_HEADER diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 5e27e378d..a6e8d1501 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3gxscircles.cc - * - * Circles Interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxscircles.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/rsgxscircleitems.h" #include "services/p3gxscircles.h" diff --git a/libretroshare/src/services/p3gxscircles.h b/libretroshare/src/services/p3gxscircles.h index 4e011eea0..a5a56efc0 100644 --- a/libretroshare/src/services/p3gxscircles.h +++ b/libretroshare/src/services/p3gxscircles.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3circles.h - * - * Identity interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxscircles.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_CIRCLES_SERVICE_HEADER #define P3_CIRCLES_SERVICE_HEADER diff --git a/libretroshare/src/services/p3gxscommon.cc b/libretroshare/src/services/p3gxscommon.cc index 5793e58ff..be38085e6 100644 --- a/libretroshare/src/services/p3gxscommon.cc +++ b/libretroshare/src/services/p3gxscommon.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3gxscommon.cc - * - * GxsChannels interface for RetroShare. - * - * Copyright 2012-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxscommon.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "retroshare/rsgxscommon.h" #include "services/p3gxscommon.h" #include "rsitems/rsgxscommentitems.h" diff --git a/libretroshare/src/services/p3gxscommon.h b/libretroshare/src/services/p3gxscommon.h index af7e0983c..469fa3426 100644 --- a/libretroshare/src/services/p3gxscommon.h +++ b/libretroshare/src/services/p3gxscommon.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/services p3gxscommon.cc - * - * GxsChannels interface for RetroShare. - * - * Copyright 2012-2013 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/services: p3gxscommon.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_GXSCOMMON_SERVICE_HEADER #define P3_GXSCOMMON_SERVICE_HEADER diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 7f1e8dfcf..3cb4f1d0a 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3gxsforums.cc - * - * GxsForums interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxsforums.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3gxsforums.h" #include "rsitems/rsgxsforumitems.h" diff --git a/libretroshare/src/services/p3gxsforums.h b/libretroshare/src/services/p3gxsforums.h index a4e0ebf47..c6341c333 100644 --- a/libretroshare/src/services/p3gxsforums.h +++ b/libretroshare/src/services/p3gxsforums.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3gxsforums.h - * - * GxsForum interface for RetroShare. - * - * Copyright 2012-2012 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxsforums.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_GXSFORUMS_SERVICE_HEADER #define P3_GXSFORUMS_SERVICE_HEADER diff --git a/libretroshare/src/services/p3gxsreputation.cc b/libretroshare/src/services/p3gxsreputation.cc index 118d404e5..01e022c8e 100644 --- a/libretroshare/src/services/p3gxsreputation.cc +++ b/libretroshare/src/services/p3gxsreputation.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3gxsreputation.cc - * - * Gxs Reputation Service for RetroShare. - * - * Copyright 2011-2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3gxsreputation.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014-2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "pqi/p3linkmgr.h" diff --git a/libretroshare/src/services/p3gxsreputation.h b/libretroshare/src/services/p3gxsreputation.h index ad45e2298..75d5d628c 100644 --- a/libretroshare/src/services/p3gxsreputation.h +++ b/libretroshare/src/services/p3gxsreputation.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services/p3gxsreputation.h - * - * Exchange list of Peers Reputations. - * - * Copyright 2014 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.1 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3gxsreputation.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014-2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_RSGXSREPUTATION_HEADER #define SERVICE_RSGXSREPUTATION_HEADER diff --git a/libretroshare/src/services/p3heartbeat.cc b/libretroshare/src/services/p3heartbeat.cc index 498a88cfa..e74787812 100644 --- a/libretroshare/src/services/p3heartbeat.cc +++ b/libretroshare/src/services/p3heartbeat.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3heartbeat.cc - * - * Services for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3heartbeat.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "services/p3heartbeat.h" diff --git a/libretroshare/src/services/p3heartbeat.h b/libretroshare/src/services/p3heartbeat.h index da7c8b1df..21dd9b6b7 100644 --- a/libretroshare/src/services/p3heartbeat.h +++ b/libretroshare/src/services/p3heartbeat.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3heartbeat.h - * - * Services for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3heartbeat.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_SERVICES_HEARTBEAT_H #define MRK_SERVICES_HEARTBEAT_H diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 5ea8f898e..084edadb2 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -1,29 +1,25 @@ -/* - * libretroshare/src/services p3idservice.cc - * - * Id interface for RetroShare. - * - * Copyright (C) 2012 Robert Fernie - * Copyright (C) 2018 Gioacchino Mazzurco - * - * 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3idservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "services/p3idservice.h" diff --git a/libretroshare/src/services/p3idservice.h b/libretroshare/src/services/p3idservice.h index f97192e72..6a5ec640f 100644 --- a/libretroshare/src/services/p3idservice.h +++ b/libretroshare/src/services/p3idservice.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3idservice.h - * - * Identity interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3idservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_IDENTITY_SERVICE_HEADER #define P3_IDENTITY_SERVICE_HEADER diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc index e56d2fb5a..54fdc710e 100644 --- a/libretroshare/src/services/p3msgservice.cc +++ b/libretroshare/src/services/p3msgservice.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services msgservice.cc - * - * 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3msgservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "retroshare/rsiface.h" #include "retroshare/rspeers.h" #include "retroshare/rsidentity.h" diff --git a/libretroshare/src/services/p3msgservice.h b/libretroshare/src/services/p3msgservice.h index 7027e470b..32f087ad0 100644 --- a/libretroshare/src/services/p3msgservice.h +++ b/libretroshare/src/services/p3msgservice.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services msgservice.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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3msgservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MESSAGE_SERVICE_HEADER #define MESSAGE_SERVICE_HEADER diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index 519f10c68..fa42224d7 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/services: p3photoservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2012 Robert Fernie,Chris Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "p3photoservice.h" #include "rsitems/rsphotoitems.h" #include "retroshare/rsgxsflags.h" diff --git a/libretroshare/src/services/p3photoservice.h b/libretroshare/src/services/p3photoservice.h index 236687301..3d26ea739 100644 --- a/libretroshare/src/services/p3photoservice.h +++ b/libretroshare/src/services/p3photoservice.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/services: p3photoservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2012 Robert Fernie,Chris Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3PHOTOSERVICEV2_H #define P3PHOTOSERVICEV2_H -/* - * libretroshare/src/retroshare: rsphoto.h - * - * RetroShare C++ Interface. - * - * Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker - * - * 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 "gxs/rsgenexchange.h" #include "retroshare/rsphoto.h" diff --git a/libretroshare/src/services/p3postbase.cc b/libretroshare/src/services/p3postbase.cc index 0c37db1f1..a294737c5 100644 --- a/libretroshare/src/services/p3postbase.cc +++ b/libretroshare/src/services/p3postbase.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3posted.cc - * - * Posted interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3postbase.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "retroshare/rsgxsflags.h" diff --git a/libretroshare/src/services/p3postbase.h b/libretroshare/src/services/p3postbase.h index b5ce1d895..1e63b0dcd 100644 --- a/libretroshare/src/services/p3postbase.h +++ b/libretroshare/src/services/p3postbase.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3postbase.h - * - * GxsChannel interface for RetroShare. - * - * Copyright 2012-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3postbase.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2012 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_POSTBASE_SERVICE_HEADER #define P3_POSTBASE_SERVICE_HEADER diff --git a/libretroshare/src/services/p3posted.cc b/libretroshare/src/services/p3posted.cc index 555f2147f..c83a6f241 100644 --- a/libretroshare/src/services/p3posted.cc +++ b/libretroshare/src/services/p3posted.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3posted.cc - * - * Posted interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3posted.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3posted.h" #include "rsitems/rsposteditems.h" diff --git a/libretroshare/src/services/p3posted.h b/libretroshare/src/services/p3posted.h index aa4bbc8ee..4a032b49b 100644 --- a/libretroshare/src/services/p3posted.h +++ b/libretroshare/src/services/p3posted.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/services: p3posted.h - * - * GxsChannel interface for RetroShare. - * - * Copyright 2012-2013 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/services: p3posted.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_POSTED_SERVICE_HEADER #define P3_POSTED_SERVICE_HEADER diff --git a/libretroshare/src/services/p3rtt.cc b/libretroshare/src/services/p3rtt.cc index 2fc991227..d7fee261d 100644 --- a/libretroshare/src/services/p3rtt.cc +++ b/libretroshare/src/services/p3rtt.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3rtt.cc - * - * Round Trip Time Measurement for RetroShare. - * - * Copyright 2011-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3rtt.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "util/rsdir.h" diff --git a/libretroshare/src/services/p3rtt.h b/libretroshare/src/services/p3rtt.h index 067feca0c..3bc99eacc 100644 --- a/libretroshare/src/services/p3rtt.h +++ b/libretroshare/src/services/p3rtt.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services/p3rtt.h - * - * Round Trip Time Measurement for RetroShare. - * - * Copyright 2011-2013 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.1 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3rtt.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_RSRTT_HEADER #define SERVICE_RSRTT_HEADER diff --git a/libretroshare/src/services/p3service.cc b/libretroshare/src/services/p3service.cc index bb15831d7..a2b7755c8 100644 --- a/libretroshare/src/services/p3service.cc +++ b/libretroshare/src/services/p3service.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3service.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2004-2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3service.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsitems/itempriorities.h" #include "pqi/pqi.h" diff --git a/libretroshare/src/services/p3service.h b/libretroshare/src/services/p3service.h index daba663c7..4eb66c470 100644 --- a/libretroshare/src/services/p3service.h +++ b/libretroshare/src/services/p3service.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3service.h - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3service.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_GENERIC_SERVICE_HEADER #define P3_GENERIC_SERVICE_HEADER diff --git a/libretroshare/src/services/p3serviceinfo.cc b/libretroshare/src/services/p3serviceinfo.cc index 0782016a1..f05604021 100644 --- a/libretroshare/src/services/p3serviceinfo.cc +++ b/libretroshare/src/services/p3serviceinfo.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3serviceinfo.cc - * - * ServiceInfo Service for RetroShare. - * - * Copyright 2014 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3serviceinfo.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/p3linkmgr.h" #include "pqi/p3netmgr.h" diff --git a/libretroshare/src/services/p3serviceinfo.h b/libretroshare/src/services/p3serviceinfo.h index 210731af1..2d8f8a8af 100644 --- a/libretroshare/src/services/p3serviceinfo.h +++ b/libretroshare/src/services/p3serviceinfo.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services/p3serviceinfo.h - * - * Exchange list of Service Information. - * - * Copyright 2014 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.1 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/services: p3serviceinfo.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2014 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_RSSERVICEINFO_HEADER #define SERVICE_RSSERVICEINFO_HEADER diff --git a/libretroshare/src/services/p3statusservice.cc b/libretroshare/src/services/p3statusservice.cc index 54184f4db..7ff736d7b 100644 --- a/libretroshare/src/services/p3statusservice.cc +++ b/libretroshare/src/services/p3statusservice.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3statusservice.cc - * - * RetroShare C++ . - * - * Copyright 2008 by Vinny Do, Chris Evi-Parker. - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3statusservice.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Vinny Do, Chris Evi-Parker. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3statusservice.h" #include "rsitems/rsstatusitems.h" #include "rsserver/p3face.h" diff --git a/libretroshare/src/services/p3statusservice.h b/libretroshare/src/services/p3statusservice.h index c4f730b0d..ac0b70653 100644 --- a/libretroshare/src/services/p3statusservice.h +++ b/libretroshare/src/services/p3statusservice.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/services: p3statusservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008 by Vinny Do, Chris Evi-Parker. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_P3_STATUS_INTERFACE_H #define RS_P3_STATUS_INTERFACE_H -/* - * libretroshare/src/services: p3statusService.h - * - * RetroShare C++ - * - * Copyright 2008 by Vinny Do, Chris Evi-Parker. - * - * 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 #include diff --git a/libretroshare/src/services/p3wiki.cc b/libretroshare/src/services/p3wiki.cc index a707596c1..0d7a2a450 100644 --- a/libretroshare/src/services/p3wiki.cc +++ b/libretroshare/src/services/p3wiki.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3wiki.cc - * - * Wiki interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3wiki.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3wiki.h" #include "retroshare/rsgxsflags.h" #include "rsitems/rswikiitems.h" diff --git a/libretroshare/src/services/p3wiki.h b/libretroshare/src/services/p3wiki.h index bd53fd6b7..f6f446920 100644 --- a/libretroshare/src/services/p3wiki.h +++ b/libretroshare/src/services/p3wiki.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3wikiservice.h - * - * Wiki interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3wiki.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_WIKI_SERVICE_HEADER #define P3_WIKI_SERVICE_HEADER diff --git a/libretroshare/src/services/p3wire.cc b/libretroshare/src/services/p3wire.cc index 7edce4a4d..23d31198f 100644 --- a/libretroshare/src/services/p3wire.cc +++ b/libretroshare/src/services/p3wire.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services p3wire.cc - * - * Wire interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3wire.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "services/p3wire.h" #include "rsitems/rswireitems.h" diff --git a/libretroshare/src/services/p3wire.h b/libretroshare/src/services/p3wire.h index 24c0f26e7..3858d158e 100644 --- a/libretroshare/src/services/p3wire.h +++ b/libretroshare/src/services/p3wire.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services: p3wire.h - * - * Wiki interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/services: p3wire.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef P3_WIRE_SERVICE_HEADER #define P3_WIRE_SERVICE_HEADER From 6cf2090149487a1f29607029bc8df10db254a618 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 May 2018 21:19:13 +0200 Subject: [PATCH 060/213] relicensed tcponudp, turtle, unused, upnp, and part of util/ --- build_scripts/Debian/debian_release_howto.txt | 4 +- libretroshare/src/libretroshare.pro | 3 - libretroshare/src/tcponudp/bio_tou.h | 45 +++++++------- libretroshare/src/tcponudp/tcppacket.cc | 49 +++++++-------- libretroshare/src/tcponudp/tcppacket.h | 48 +++++++------- libretroshare/src/tcponudp/tcpstream.cc | 47 +++++++------- libretroshare/src/tcponudp/tcpstream.h | 48 +++++++------- libretroshare/src/tcponudp/tou.cc | 49 +++++++-------- libretroshare/src/tcponudp/tou.h | 48 +++++++------- libretroshare/src/tcponudp/udppeer.cc | 46 +++++++------- libretroshare/src/tcponudp/udppeer.h | 46 +++++++------- libretroshare/src/tcponudp/udprelay.cc | 46 +++++++------- libretroshare/src/tcponudp/udprelay.h | 46 +++++++------- libretroshare/src/tcponudp/udpstunner.cc | 46 +++++++------- libretroshare/src/tcponudp/udpstunner.h | 45 +++++++------- libretroshare/src/turtle/p3turtle.cc | 45 +++++++------- libretroshare/src/turtle/p3turtle.h | 45 +++++++------- libretroshare/src/turtle/rsturtleitem.cc | 21 +++++++ libretroshare/src/turtle/rsturtleitem.h | 21 +++++++ .../src/turtle/turtleclientservice.h | 45 +++++++------- libretroshare/src/turtle/turtletypes.h | 21 +++++++ libretroshare/src/unused/p3dsdv.cc | 46 +++++++------- libretroshare/src/unused/p3dsdv.h | 47 +++++++------- .../src/{util => unused}/rscompress.cc | 46 +++++++------- libretroshare/src/unused/rscompress.h | 30 +++++++++ libretroshare/src/unused/rsdsdv.h | 46 +++++++------- libretroshare/src/unused/rsdsdvitems.cc | 45 +++++++------- libretroshare/src/unused/rsdsdvitems.h | 46 +++++++------- libretroshare/src/upnp/upnphandler_linux.cc | 24 ++++++- libretroshare/src/upnp/upnphandler_linux.h | 21 +++++++ .../src/upnp/upnphandler_miniupnp.cc | 21 +++++++ libretroshare/src/upnp/upnphandler_miniupnp.h | 21 +++++++ libretroshare/src/upnp/upnputil.c | 19 ++++++ libretroshare/src/upnp/upnputil.h | 26 +++++--- libretroshare/src/util/androiddebug.h | 38 +++++++----- libretroshare/src/util/contentvalue.cc | 45 +++++++------- libretroshare/src/util/contentvalue.h | 44 +++++++------ libretroshare/src/util/cxx11retrocompat.h | 38 +++++++----- libretroshare/src/util/dnsresolver.cc | 21 +++++++ libretroshare/src/util/dnsresolver.h | 21 +++++++ libretroshare/src/util/extaddrfinder.cc | 21 +++++++ libretroshare/src/util/extaddrfinder.h | 21 +++++++ libretroshare/src/util/folderiterator.cc | 21 +++++++ libretroshare/src/util/folderiterator.h | 21 +++++++ libretroshare/src/util/pugiconfig.h | 62 ------------------- libretroshare/src/util/radix32.h | 21 +++++++ libretroshare/src/util/radix64.h | 21 +++++++ libretroshare/src/util/retrodb.cc | 44 +++++++------ libretroshare/src/util/retrodb.h | 44 +++++++------ libretroshare/src/util/rscompress.h | 34 ---------- libretroshare/src/util/rsdbbind.cc | 44 +++++++------ libretroshare/src/util/rsdbbind.h | 44 +++++++------ libretroshare/src/util/rsdebug.cc | 45 +++++++------- libretroshare/src/util/rsdebug.h | 47 +++++++------- libretroshare/src/util/rsdeprecate.h | 38 +++++++----- libretroshare/src/util/rsdir.cc | 46 +++++++------- libretroshare/src/util/rsdir.h | 47 +++++++------- libretroshare/src/util/rsdiscspace.cc | 46 +++++++------- libretroshare/src/util/rsdiscspace.h | 46 +++++++------- libretroshare/src/util/rsinitedptr.h | 22 +++++++ libretroshare/src/util/rsmemcache.h | 45 +++++++------- libretroshare/src/util/rsmemory.cc | 21 +++++++ libretroshare/src/util/rsmemory.h | 21 +++++++ libretroshare/src/util/rsnet.cc | 47 +++++++------- libretroshare/src/util/rsnet.h | 48 +++++++------- libretroshare/src/util/rsprint.cc | 46 +++++++------- libretroshare/src/util/rsprint.h | 48 +++++++------- 67 files changed, 1334 insertions(+), 1136 deletions(-) rename libretroshare/src/{util => unused}/rscompress.cc (72%) create mode 100644 libretroshare/src/unused/rscompress.h delete mode 100644 libretroshare/src/util/pugiconfig.h delete mode 100644 libretroshare/src/util/rscompress.h diff --git a/build_scripts/Debian/debian_release_howto.txt b/build_scripts/Debian/debian_release_howto.txt index 40415d544..8d669d311 100644 --- a/build_scripts/Debian/debian_release_howto.txt +++ b/build_scripts/Debian/debian_release_howto.txt @@ -139,5 +139,7 @@ Licensing issues: Files after switch: - libresapi/api/json.h MIT license Copyright (c) 2013 Jeff Weinstein (jeff.weinstein at gmail) + libresapi/api/json.h MIT license Copyright (c) 2013 Jeff Weinstein (jeff.weinstein at gmail) + libretroshare/src/tcponudp/bss_tou.cc SSL Licence Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + libretroshare/src/upnp/UPnPBase.{h,cpp} GPL Licence Copyright (c) 2004-2009 Marcelo Roberto Jimenez ( phoenix@amule.org ) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 396a87eef..d11012de6 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -520,7 +520,6 @@ HEADERS += turtle/p3turtle.h \ HEADERS += util/folderiterator.h \ util/rsdebug.h \ util/rsmemory.h \ - util/rscompress.h \ util/smallobject.h \ util/rsdir.h \ util/rsdiscspace.h \ @@ -537,7 +536,6 @@ HEADERS += util/folderiterator.h \ util/rsversioninfo.h \ util/rswin.h \ util/rsrandom.h \ - util/pugiconfig.h \ util/rsmemcache.h \ util/rstickevent.h \ util/rsrecogn.h \ @@ -672,7 +670,6 @@ SOURCES += turtle/p3turtle.cc \ SOURCES += util/folderiterator.cc \ util/rsdebug.cc \ util/rsexpr.cc \ - util/rscompress.cc \ util/smallobject.cc \ util/rsdir.cc \ util/rsmemory.cc \ diff --git a/libretroshare/src/tcponudp/bio_tou.h b/libretroshare/src/tcponudp/bio_tou.h index cf02825e1..a82444ccc 100644 --- a/libretroshare/src/tcponudp/bio_tou.h +++ b/libretroshare/src/tcponudp/bio_tou.h @@ -1,27 +1,24 @@ -/* - * "$Id: bio_tou.h,v 1.2 2007-02-18 21:46:50 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ +/******************************************************************************* + * libretroshare/src/tcponudp: bio_tou.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef BIO_TCPONUDP_H #define BIO_TCPONUDP_H diff --git a/libretroshare/src/tcponudp/tcppacket.cc b/libretroshare/src/tcponudp/tcppacket.cc index 3351cf168..2da199288 100644 --- a/libretroshare/src/tcponudp/tcppacket.cc +++ b/libretroshare/src/tcponudp/tcppacket.cc @@ -1,31 +1,24 @@ -/* - * "$Id: tcppacket.cc,v 1.3 2007-02-18 21:46:50 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - - +/******************************************************************************* + * libretroshare/src/tcponudp: tcppacket.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "tcppacket.h" /* diff --git a/libretroshare/src/tcponudp/tcppacket.h b/libretroshare/src/tcponudp/tcppacket.h index 3b0fe4371..e87c3e394 100644 --- a/libretroshare/src/tcponudp/tcppacket.h +++ b/libretroshare/src/tcponudp/tcppacket.h @@ -1,30 +1,24 @@ -/* - * "$Id: tcppacket.h,v 1.3 2007-02-18 21:46:50 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/tcponudp: tcppacket.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef TOU_TCP_PACKET_H #define TOU_TCP_PACKET_H diff --git a/libretroshare/src/tcponudp/tcpstream.cc b/libretroshare/src/tcponudp/tcpstream.cc index d789def44..5af0f505d 100644 --- a/libretroshare/src/tcponudp/tcpstream.cc +++ b/libretroshare/src/tcponudp/tcpstream.cc @@ -1,29 +1,24 @@ -/* - * "$Id: tcpstream.cc,v 1.11 2007-03-01 01:09:39 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/tcponudp: tcpstream.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/tcponudp/tcpstream.h b/libretroshare/src/tcponudp/tcpstream.h index eb79620cd..87ed693d0 100644 --- a/libretroshare/src/tcponudp/tcpstream.h +++ b/libretroshare/src/tcponudp/tcpstream.h @@ -1,30 +1,24 @@ -/* - * "$Id: tcpstream.h,v 1.5 2007-02-18 21:46:50 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/tcponudp: tcpstream.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef TOU_TCP_PROTO_H #define TOU_TCP_PROTO_H diff --git a/libretroshare/src/tcponudp/tou.cc b/libretroshare/src/tcponudp/tou.cc index e6fb7f480..4121c6985 100644 --- a/libretroshare/src/tcponudp/tou.cc +++ b/libretroshare/src/tcponudp/tou.cc @@ -1,31 +1,24 @@ -/* - * "$Id: tou.cc,v 1.7 2007-02-18 21:46:50 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - - +/******************************************************************************* + * libretroshare/src/tcponudp: tou.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "tou.h" static const int kInitStreamTable = 5; diff --git a/libretroshare/src/tcponudp/tou.h b/libretroshare/src/tcponudp/tou.h index da72bb85d..0c09ce159 100644 --- a/libretroshare/src/tcponudp/tou.h +++ b/libretroshare/src/tcponudp/tou.h @@ -1,30 +1,24 @@ -/* - * "$Id: tou.h,v 1.4 2007-02-18 21:46:50 rmf24 Exp $" - * - * TCP-on-UDP (tou) network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ - - - +/******************************************************************************* + * libretroshare/src/tcponudp: tou.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef TOU_C_HEADER_H #define TOU_C_HEADER_H diff --git a/libretroshare/src/tcponudp/udppeer.cc b/libretroshare/src/tcponudp/udppeer.cc index d7b904c9a..b3cf10913 100644 --- a/libretroshare/src/tcponudp/udppeer.cc +++ b/libretroshare/src/tcponudp/udppeer.cc @@ -1,28 +1,24 @@ -/* - * tcponudp/udppeer.cc - * - * libretroshare. - * - * Copyright 2010 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 3 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". - * - */ - +/******************************************************************************* + * libretroshare/src/tcponudp: udppeer.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "udppeer.h" #include diff --git a/libretroshare/src/tcponudp/udppeer.h b/libretroshare/src/tcponudp/udppeer.h index f25d1cffc..9ecf23419 100644 --- a/libretroshare/src/tcponudp/udppeer.h +++ b/libretroshare/src/tcponudp/udppeer.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/tcponudp: udppeer.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_UDP_PEER_RECV_H #define RS_UDP_PEER_RECV_H -/* - * tcponudp/udppeer.h - * - * libretroshare. - * - * Copyright 2010 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 3 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 WINDOWS_SYS #include #endif diff --git a/libretroshare/src/tcponudp/udprelay.cc b/libretroshare/src/tcponudp/udprelay.cc index 2f837feec..8793eb636 100644 --- a/libretroshare/src/tcponudp/udprelay.cc +++ b/libretroshare/src/tcponudp/udprelay.cc @@ -1,28 +1,24 @@ -/* - * tcponudp/udprelay.cc - * - * libretroshare. - * - * Copyright 2010 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 3 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". - * - */ - +/******************************************************************************* + * libretroshare/src/tcponudp: udprelay.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "udprelay.h" #include #include diff --git a/libretroshare/src/tcponudp/udprelay.h b/libretroshare/src/tcponudp/udprelay.h index e04710f2f..fda6958d3 100644 --- a/libretroshare/src/tcponudp/udprelay.h +++ b/libretroshare/src/tcponudp/udprelay.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/tcponudp: udprelay.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_UDP_RELAY_H #define RS_UDP_RELAY_H -/* - * tcponudp/udprelay.h - * - * libretroshare. - * - * Copyright 2010 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 3 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 "tcponudp/udppeer.h" #include #include diff --git a/libretroshare/src/tcponudp/udpstunner.cc b/libretroshare/src/tcponudp/udpstunner.cc index 421ad8f17..8fd1dfd46 100644 --- a/libretroshare/src/tcponudp/udpstunner.cc +++ b/libretroshare/src/tcponudp/udpstunner.cc @@ -1,28 +1,24 @@ -/* - * tcponudp/udpstunner.cc - * - * libretroshare. - * - * Copyright 2010 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 3 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". - * - */ - +/******************************************************************************* + * libretroshare/src/tcponudp: udpstunner.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "tcponudp/udpstunner.h" #include #include diff --git a/libretroshare/src/tcponudp/udpstunner.h b/libretroshare/src/tcponudp/udpstunner.h index 1f55f241b..1abc48d6e 100644 --- a/libretroshare/src/tcponudp/udpstunner.h +++ b/libretroshare/src/tcponudp/udpstunner.h @@ -1,29 +1,26 @@ +/******************************************************************************* + * libretroshare/src/tcponudp: udpstunner.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_UDP_STUN_H #define RS_UDP_STUN_H -/* - * tcponudp/udpstunner.h - * - * libretroshare. - * - * Copyright 2010 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 3 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 WINDOWS_SYS #include diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 8217db2fa..933188345 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/services: p3turtle.cc - * - * Services for RetroShare. - * - * Copyright 2009 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/turtle: p3turtle.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ //#define P3TURTLE_DEBUG diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index 0c230b88b..9d648508b 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/services: p3turtle.h - * - * Services for RetroShare. - * - * Copyright 2009 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/turtle: p3turtle.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ //====================================== General setup of the router ===================================// // diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index cf206a153..56b07ccca 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/turtle: rsturtleitem.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef WINDOWS_SYS #include #endif diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 248082652..46cb87fd7 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/turtle: rsturtleitem.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2009-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "rsitems/rsserviceids.h" diff --git a/libretroshare/src/turtle/turtleclientservice.h b/libretroshare/src/turtle/turtleclientservice.h index 51a9dbdc3..fe7db2fdd 100644 --- a/libretroshare/src/turtle/turtleclientservice.h +++ b/libretroshare/src/turtle/turtleclientservice.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/services: turtleclientservice.h - * - * Services for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ +/******************************************************************************* + * libretroshare/src/turtle: rsturtleclientservice.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ // This class is the parent class for any service that will use the turtle router to distribute its packets. // Typical representative clients include: diff --git a/libretroshare/src/turtle/turtletypes.h b/libretroshare/src/turtle/turtletypes.h index 840dda1d0..56fd78f8b 100644 --- a/libretroshare/src/turtle/turtletypes.h +++ b/libretroshare/src/turtle/turtletypes.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/turtle: rsturtletypes.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "retroshare/rsturtle.h" diff --git a/libretroshare/src/unused/p3dsdv.cc b/libretroshare/src/unused/p3dsdv.cc index 6373dea8e..b6a3cf057 100644 --- a/libretroshare/src/unused/p3dsdv.cc +++ b/libretroshare/src/unused/p3dsdv.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/services/p3dsdv.h - * - * Network-Wide Routing Service. - * - * Copyright 2011 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". - * - */ - +/******************************************************************************* + * libretroshare/src/unused: p3dsdv.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/unused/p3dsdv.h b/libretroshare/src/unused/p3dsdv.h index 4b95fdba3..72327fd22 100644 --- a/libretroshare/src/unused/p3dsdv.h +++ b/libretroshare/src/unused/p3dsdv.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/services/p3dsdv.h - * - * Network-Wide Routing Service. - * - * Copyright 2011 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/unused: p3dsdv.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef SERVICE_RSDSDV_HEADER #define SERVICE_RSDSDV_HEADER diff --git a/libretroshare/src/util/rscompress.cc b/libretroshare/src/unused/rscompress.cc similarity index 72% rename from libretroshare/src/util/rscompress.cc rename to libretroshare/src/unused/rscompress.cc index 1942e4feb..e3aa0f849 100644 --- a/libretroshare/src/util/rscompress.cc +++ b/libretroshare/src/unused/rscompress.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/utils: rscompress.cc - * - * Basic memory chunk compression, based on openpgp-sdk - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rscompress.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/unused/rscompress.h b/libretroshare/src/unused/rscompress.h new file mode 100644 index 000000000..96b9e2092 --- /dev/null +++ b/libretroshare/src/unused/rscompress.h @@ -0,0 +1,30 @@ +/******************************************************************************* + * libretroshare/src/util: rscompress.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + +class RsCompress +{ + public: + static bool compress_memory_chunk(const uint8_t *input_mem,const uint32_t input_size,uint8_t *& output_mem,uint32_t& output_size) ; + static bool uncompress_memory_chunk(const uint8_t *input_mem,const uint32_t input_size,uint8_t *& output_mem,uint32_t& output_size) ; +}; + diff --git a/libretroshare/src/unused/rsdsdv.h b/libretroshare/src/unused/rsdsdv.h index dd7eb03c0..e2d634a10 100644 --- a/libretroshare/src/unused/rsdsdv.h +++ b/libretroshare/src/unused/rsdsdv.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/unused: rsdsdv.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RETROSHARE_DSDV_INTERFACE_H #define RETROSHARE_DSDV_INTERFACE_H -/* - * libretroshare/src/rsiface: rsdsdv.h - * - * RetroShare C++ Interface. - * - * Copyright 2011-2011 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". - * - */ - #include #include #include diff --git a/libretroshare/src/unused/rsdsdvitems.cc b/libretroshare/src/unused/rsdsdvitems.cc index 4731d1814..073ebe669 100644 --- a/libretroshare/src/unused/rsdsdvitems.cc +++ b/libretroshare/src/unused/rsdsdvitems.cc @@ -1,27 +1,24 @@ -/* - * libretroshare/src/serialiser: rsgameitems.cc - * - * RetroShare Serialiser. - * - * Copyright 2007-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". - * - */ +/******************************************************************************* + * libretroshare/src/unused: rsdsdvitems.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "serialiser/rsbaseserial.h" #include "serialiser/rsdsdvitems.h" diff --git a/libretroshare/src/unused/rsdsdvitems.h b/libretroshare/src/unused/rsdsdvitems.h index fd03be486..856a06b92 100644 --- a/libretroshare/src/unused/rsdsdvitems.h +++ b/libretroshare/src/unused/rsdsdvitems.h @@ -1,31 +1,27 @@ +/******************************************************************************* + * libretroshare/src/unused: rsdsdvitems.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_DSDV_ITEMS_H #define RS_DSDV_ITEMS_H -/* - * libretroshare/src/serialiser: rsdsdvitems.h - * - * RetroShare Serialiser. - * - * Copyright 2011-2011 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". - * - */ - #include #include "rsitems/rsserviceids.h" diff --git a/libretroshare/src/upnp/upnphandler_linux.cc b/libretroshare/src/upnp/upnphandler_linux.cc index 13f70f041..4e6c344fb 100644 --- a/libretroshare/src/upnp/upnphandler_linux.cc +++ b/libretroshare/src/upnp/upnphandler_linux.cc @@ -1,6 +1,24 @@ -//Linux only -/* This stuff is actually C */ - +/******************************************************************************* + * libretroshare/src/upnp: upnphandler_linux.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2018 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifdef __cplusplus extern "C" { #endif diff --git a/libretroshare/src/upnp/upnphandler_linux.h b/libretroshare/src/upnp/upnphandler_linux.h index b22a9a9e2..741adfc47 100644 --- a/libretroshare/src/upnp/upnphandler_linux.h +++ b/libretroshare/src/upnp/upnphandler_linux.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/upnp: upnphandler_linux.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2018 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef _RS_UPNP_IFACE_H #define _RS_UPNP_IFACE_H diff --git a/libretroshare/src/upnp/upnphandler_miniupnp.cc b/libretroshare/src/upnp/upnphandler_miniupnp.cc index 24a3395f4..f264d80a7 100644 --- a/libretroshare/src/upnp/upnphandler_miniupnp.cc +++ b/libretroshare/src/upnp/upnphandler_miniupnp.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/upnp: upnphandler_miniupnp.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2018 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ // Windows / Mac version. /* This stuff is actually C */ diff --git a/libretroshare/src/upnp/upnphandler_miniupnp.h b/libretroshare/src/upnp/upnphandler_miniupnp.h index 6b4660e32..1f3c33378 100644 --- a/libretroshare/src/upnp/upnphandler_miniupnp.h +++ b/libretroshare/src/upnp/upnphandler_miniupnp.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/upnp: upnphandler_miniupnp.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2007-2018 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ //windows/osx (miniupnpc) implementation #ifndef _RS_UPNP_IFACE_H #define _RS_UPNP_IFACE_H diff --git a/libretroshare/src/upnp/upnputil.c b/libretroshare/src/upnp/upnputil.c index 525878bf6..6d5bf326c 100644 --- a/libretroshare/src/upnp/upnputil.c +++ b/libretroshare/src/upnp/upnputil.c @@ -1,3 +1,22 @@ +/************************************************************************************** + * MiniUPnPc * + * Copyright (c) 2005-2016, Thomas BERNARD * + * All rights reserved. * + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions are met: * + * * + * * Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * Redistributions in binary form must reproduce the above copyright notice, * + * this list of conditions and the following disclaimer in the documentation * + * and/or other materials provided with the distribution. * + * * The name of the author may not be used to endorse or promote products * + * derived from this software without specific prior written permission. * + * This software is subject to the conditions detailed in the * + * LICENCE file provided in this distribution. * + * * + **************************************************************************************/ //this file uses miniupnp //From https://github.com/miniupnp/miniupnp/blob/master/miniupnpc/upnpc.c diff --git a/libretroshare/src/upnp/upnputil.h b/libretroshare/src/upnp/upnputil.h index 99ec61f4f..20339bb72 100644 --- a/libretroshare/src/upnp/upnputil.h +++ b/libretroshare/src/upnp/upnputil.h @@ -1,15 +1,27 @@ +/************************************************************************************** + * MiniUPnPc * + * Copyright (c) 2005-2016, Thomas BERNARD * + * All rights reserved. * + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions are met: * + * * + * * Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * Redistributions in binary form must reproduce the above copyright notice, * + * this list of conditions and the following disclaimer in the documentation * + * and/or other materials provided with the distribution. * + * * The name of the author may not be used to endorse or promote products * + * derived from this software without specific prior written permission. * + * This software is subject to the conditions detailed in the * + * LICENCE file provided in this distribution. * + * * + **************************************************************************************/ //this file uses miniupnp #ifndef MINIUPNP_UTIL_H_ #define MINIUPNP_UTIL_H_ -/* $Id: upnpc.c,v 1.50 2007/04/26 19:00:10 nanard Exp $ */ -/* Project : miniupnp - * Author : Thomas Bernard - * Copyright (c) 2005 Thomas Bernard - * This software is subject to the conditions detailed in the - * LICENCE file provided in this distribution. - * */ #include #include #include diff --git a/libretroshare/src/util/androiddebug.h b/libretroshare/src/util/androiddebug.h index 2e429b99f..c358be553 100644 --- a/libretroshare/src/util/androiddebug.h +++ b/libretroshare/src/util/androiddebug.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libretroshare/src/util: androiddebug.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * Redirect plain stdout and stderr to Android debug - * Copyright (C) 2016 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ // Inspired by: https://codelab.wordpress.com/2014/11/03/how-to-use-standard-output-streams-for-logging-in-android-apps/ diff --git a/libretroshare/src/util/contentvalue.cc b/libretroshare/src/util/contentvalue.cc index 1ab962120..e2eee943c 100644 --- a/libretroshare/src/util/contentvalue.cc +++ b/libretroshare/src/util/contentvalue.cc @@ -1,27 +1,24 @@ - -/* - * util/contentvalue.cc, key val container - * - * Copyright 2012 Christopher Evi-Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: contentvalue.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/util/contentvalue.h b/libretroshare/src/util/contentvalue.h index d81deb662..23ee55eca 100644 --- a/libretroshare/src/util/contentvalue.h +++ b/libretroshare/src/util/contentvalue.h @@ -1,29 +1,27 @@ +/******************************************************************************* + * libretroshare/src/util: contentvalue.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef CONTENTVALUE_H #define CONTENTVALUE_H -/* - * util/contentvalue.h, key val container - * - * Copyright 2012 Christopher Evi-Parker - * - * 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 #include #include diff --git a/libretroshare/src/util/cxx11retrocompat.h b/libretroshare/src/util/cxx11retrocompat.h index 587b1374d..98dd998db 100644 --- a/libretroshare/src/util/cxx11retrocompat.h +++ b/libretroshare/src/util/cxx11retrocompat.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libretroshare/src/util: cxx11retrocompat.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * RetroShare - * Copyright (C) 2017 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #ifdef __GNUC__ # define GCC_VERSION (__GNUC__*10000+__GNUC_MINOR__*100+__GNUC_PATCHLEVEL__) diff --git a/libretroshare/src/util/dnsresolver.cc b/libretroshare/src/util/dnsresolver.cc index e57d5864f..4807b1322 100644 --- a/libretroshare/src/util/dnsresolver.cc +++ b/libretroshare/src/util/dnsresolver.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: dnsresolver.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "dnsresolver.h" #include "pqi/pqinetwork.h" diff --git a/libretroshare/src/util/dnsresolver.h b/libretroshare/src/util/dnsresolver.h index 1f9581d1e..9db589825 100644 --- a/libretroshare/src/util/dnsresolver.h +++ b/libretroshare/src/util/dnsresolver.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: dnsresolver.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include "pqi/pqinetwork.h" diff --git a/libretroshare/src/util/extaddrfinder.cc b/libretroshare/src/util/extaddrfinder.cc index 308a8ea48..d0395c710 100644 --- a/libretroshare/src/util/extaddrfinder.cc +++ b/libretroshare/src/util/extaddrfinder.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: extaddrfinder.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "extaddrfinder.h" #include "pqi/pqinetwork.h" diff --git a/libretroshare/src/util/extaddrfinder.h b/libretroshare/src/util/extaddrfinder.h index 203e1ff9e..2b4bd4da3 100644 --- a/libretroshare/src/util/extaddrfinder.h +++ b/libretroshare/src/util/extaddrfinder.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: extaddrfinder.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/util/folderiterator.cc b/libretroshare/src/util/folderiterator.cc index eb70ab791..73afebeab 100644 --- a/libretroshare/src/util/folderiterator.cc +++ b/libretroshare/src/util/folderiterator.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: folderiterator.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/util/folderiterator.h b/libretroshare/src/util/folderiterator.h index 79a011ace..3232a4b47 100644 --- a/libretroshare/src/util/folderiterator.h +++ b/libretroshare/src/util/folderiterator.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: folderiterator.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2017 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef FOLDERITERATOR_H #define FOLDERITERATOR_H diff --git a/libretroshare/src/util/pugiconfig.h b/libretroshare/src/util/pugiconfig.h deleted file mode 100644 index 6b553ae04..000000000 --- a/libretroshare/src/util/pugiconfig.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * pugixml parser - version 1.0 - * -------------------------------------------------------- - * Copyright (C) 2006-2010, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) - * Report bugs and download new versions at http://pugixml.org/ - * - * This library is distributed under the MIT License. See notice at the end - * of this file. - * - * This work is based on the pugxml parser, which is: - * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) - */ - -#ifndef HEADER_PUGICONFIG_HPP -#define HEADER_PUGICONFIG_HPP - -// Uncomment this to enable wchar_t mode -// #define PUGIXML_WCHAR_MODE - -// Uncomment this to disable XPath -// #define PUGIXML_NO_XPATH - -// Uncomment this to disable STL -// Note: you can't use XPath with PUGIXML_NO_STL -// #define PUGIXML_NO_STL - -// Uncomment this to disable exceptions -// Note: you can't use XPath with PUGIXML_NO_EXCEPTIONS -// #define PUGIXML_NO_EXCEPTIONS - -// Set this to control attributes for public classes/functions, i.e.: -// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL -// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL -// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall -// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead - -#endif - -/** - * Copyright (c) 2006-2010 Arseny Kapoulkine - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ diff --git a/libretroshare/src/util/radix32.h b/libretroshare/src/util/radix32.h index 008aa3e9f..af5fef3ec 100644 --- a/libretroshare/src/util/radix32.h +++ b/libretroshare/src/util/radix32.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: radix32.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2015 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RADIX32_H #define RADIX32_H diff --git a/libretroshare/src/util/radix64.h b/libretroshare/src/util/radix64.h index 7776995f9..470186a02 100644 --- a/libretroshare/src/util/radix64.h +++ b/libretroshare/src/util/radix64.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: radix64.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2015 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/util/retrodb.cc b/libretroshare/src/util/retrodb.cc index 9924bbf9d..5a903dd62 100644 --- a/libretroshare/src/util/retrodb.cc +++ b/libretroshare/src/util/retrodb.cc @@ -1,26 +1,24 @@ - -/* - * RetroShare : RetroDb functionality - * - * Copyright 2012-2013 Christopher Evi-Parker - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: retrodb.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/util/retrodb.h b/libretroshare/src/util/retrodb.h index 435b6e466..8cf772c44 100644 --- a/libretroshare/src/util/retrodb.h +++ b/libretroshare/src/util/retrodb.h @@ -1,29 +1,27 @@ +/******************************************************************************* + * libretroshare/src/util: retrodb.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSSQLITE_H #define RSSQLITE_H -/* - * RetroShare : RetroDb functionality - * - * Copyright 2012 Christopher Evi-Parker - * - * 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". - * - */ - #ifdef NO_SQLCIPHER #include #else diff --git a/libretroshare/src/util/rscompress.h b/libretroshare/src/util/rscompress.h deleted file mode 100644 index 0d11c3f47..000000000 --- a/libretroshare/src/util/rscompress.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * libretroshare/src/utils: rscompress.h - * - * Basic memory chunk compression, based on openpgp-sdk - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - -#pragma once - -class RsCompress -{ - public: - static bool compress_memory_chunk(const uint8_t *input_mem,const uint32_t input_size,uint8_t *& output_mem,uint32_t& output_size) ; - static bool uncompress_memory_chunk(const uint8_t *input_mem,const uint32_t input_size,uint8_t *& output_mem,uint32_t& output_size) ; -}; - diff --git a/libretroshare/src/util/rsdbbind.cc b/libretroshare/src/util/rsdbbind.cc index 31e548ebd..db5233ba8 100644 --- a/libretroshare/src/util/rsdbbind.cc +++ b/libretroshare/src/util/rsdbbind.cc @@ -1,26 +1,24 @@ -/* - * RetroShare : RetroDb functionality - * - * Copyright 2013 Christopher Evi-Parker - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsbdbind.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsdbbind.h" RsDoubleBind::RsDoubleBind(double value, int index) diff --git a/libretroshare/src/util/rsdbbind.h b/libretroshare/src/util/rsdbbind.h index 44c701157..aa41e5b3e 100644 --- a/libretroshare/src/util/rsdbbind.h +++ b/libretroshare/src/util/rsdbbind.h @@ -1,29 +1,27 @@ +/******************************************************************************* + * libretroshare/src/util: rsbdbind.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013 Christopher Evi-Parker * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSDBBIND_H_ #define RSDBBIND_H_ -/* - * RetroShare : RetroDb functionality - * - * Copyright 2013 Christopher Evi-Parker - * - * 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 #include diff --git a/libretroshare/src/util/rsdebug.cc b/libretroshare/src/util/rsdebug.cc index ab40c3035..aade16282 100644 --- a/libretroshare/src/util/rsdebug.cc +++ b/libretroshare/src/util/rsdebug.cc @@ -1,27 +1,24 @@ -/* - * "$Id: pqidebug.cc,v 1.6 2007-02-18 21:46:49 rmf24 Exp $" - * - * 3P/RS network interface for RetroShare. - * - * Copyright 2004-2006 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsdebug.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsdebug.h" #include "util/rsthreads.h" diff --git a/libretroshare/src/util/rsdebug.h b/libretroshare/src/util/rsdebug.h index abf39e4b0..dd054822c 100644 --- a/libretroshare/src/util/rsdebug.h +++ b/libretroshare/src/util/rsdebug.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/util: rsdebug.h - * - * Debug 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/util: rsdebug.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2008 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /* Moved from pqi/ to util/ so it can be used more generally. */ diff --git a/libretroshare/src/util/rsdeprecate.h b/libretroshare/src/util/rsdeprecate.h index 4d44e208e..560f91c44 100644 --- a/libretroshare/src/util/rsdeprecate.h +++ b/libretroshare/src/util/rsdeprecate.h @@ -1,21 +1,25 @@ +/******************************************************************************* + * libretroshare/src/util: rsdebug.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once -/* - * RetroShare deprecation macros - * Copyright (C) 2016 Gioacchino Mazzurco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) # define RS_DEPRECATED __attribute__((__deprecated__)) diff --git a/libretroshare/src/util/rsdir.cc b/libretroshare/src/util/rsdir.cc index e1c1cf4ab..a890ed8f1 100644 --- a/libretroshare/src/util/rsdir.cc +++ b/libretroshare/src/util/rsdir.cc @@ -1,28 +1,24 @@ - -/* - * "$Id: rsdir.cc,v 1.1 2007-02-19 20:08:30 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2007 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsdir.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2007 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ // Includes for directory creation. #include diff --git a/libretroshare/src/util/rsdir.h b/libretroshare/src/util/rsdir.h index ef95e100e..b6ef4891d 100644 --- a/libretroshare/src/util/rsdir.h +++ b/libretroshare/src/util/rsdir.h @@ -1,29 +1,24 @@ - -/* - * "$Id: rsdir.h,v 1.1 2007-02-19 20:08:30 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2007 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsdir.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2007 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSUTIL_DIRFNS_H #define RSUTIL_DIRFNS_H diff --git a/libretroshare/src/util/rsdiscspace.cc b/libretroshare/src/util/rsdiscspace.cc index 25a764b14..9e325ea7b 100644 --- a/libretroshare/src/util/rsdiscspace.cc +++ b/libretroshare/src/util/rsdiscspace.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: rsdiscspace.cc - * - * Universal Networking Header for RetroShare. - * - * Copyright 2010-2010 by Cyril Soler. - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsdiscspace.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/util/rsdiscspace.h b/libretroshare/src/util/rsdiscspace.h index 1e01ebe3f..1262fd5e4 100644 --- a/libretroshare/src/util/rsdiscspace.h +++ b/libretroshare/src/util/rsdiscspace.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: rsdiscspace.h - * - * Universal Networking Header for RetroShare. - * - * Copyright 2010-2010 by Cyril Soler. - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsdiscspace.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/util/rsinitedptr.h b/libretroshare/src/util/rsinitedptr.h index a1d346ba0..333a8af87 100644 --- a/libretroshare/src/util/rsinitedptr.h +++ b/libretroshare/src/util/rsinitedptr.h @@ -1,3 +1,25 @@ +/******************************************************************************* + * libretroshare/src/util: rsinitedptr.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2010-2010 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #pragma once /** helper class to store a pointer diff --git a/libretroshare/src/util/rsmemcache.h b/libretroshare/src/util/rsmemcache.h index 03ce9f44a..a0d188295 100644 --- a/libretroshare/src/util/rsmemcache.h +++ b/libretroshare/src/util/rsmemcache.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/util: rsmemcache.h - * - * Identity interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsmemcache.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_UTIL_MEM_CACHE #define RS_UTIL_MEM_CACHE diff --git a/libretroshare/src/util/rsmemory.cc b/libretroshare/src/util/rsmemory.cc index 6aab9dfef..2b162c77d 100644 --- a/libretroshare/src/util/rsmemory.cc +++ b/libretroshare/src/util/rsmemory.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: rsmemory.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsmemory.h" void *rs_malloc(size_t size) diff --git a/libretroshare/src/util/rsmemory.h b/libretroshare/src/util/rsmemory.h index 7da4245c4..b46e12ad1 100644 --- a/libretroshare/src/util/rsmemory.h +++ b/libretroshare/src/util/rsmemory.h @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: rsmemory.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/util/rsnet.cc b/libretroshare/src/util/rsnet.cc index 565185edc..d7d60241a 100644 --- a/libretroshare/src/util/rsnet.cc +++ b/libretroshare/src/util/rsnet.cc @@ -1,28 +1,25 @@ -/* - * libretroshare/src/util: rsnet.cc - * - * Universal Networking Header for RetroShare. - * - * Copyright 2007-2008 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsnet.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 Robert Fernie * + * Copyright 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsnet.h" #include "util/rsthreads.h" diff --git a/libretroshare/src/util/rsnet.h b/libretroshare/src/util/rsnet.h index a5381702c..5807d40a7 100644 --- a/libretroshare/src/util/rsnet.h +++ b/libretroshare/src/util/rsnet.h @@ -1,29 +1,25 @@ -/* - * libretroshare/src/util: rsnet.h - * - * Universal Networking Header for RetroShare. - * - * Copyright 2004-2006 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsnet.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 Robert Fernie * + * Copyright 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_UNIVERSAL_NETWORK_HEADER #define RS_UNIVERSAL_NETWORK_HEADER diff --git a/libretroshare/src/util/rsprint.cc b/libretroshare/src/util/rsprint.cc index c87fc02f7..dca3d925c 100644 --- a/libretroshare/src/util/rsprint.cc +++ b/libretroshare/src/util/rsprint.cc @@ -1,28 +1,24 @@ - -/* - * libretroshare/src/util: rsprint.cc - * - * RetroShare Utilities - * - * Copyright 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsprint.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rsprint.h" #include "util/rsstring.h" diff --git a/libretroshare/src/util/rsprint.h b/libretroshare/src/util/rsprint.h index 3ab70a411..58a0b7f89 100644 --- a/libretroshare/src/util/rsprint.h +++ b/libretroshare/src/util/rsprint.h @@ -1,30 +1,24 @@ - -/* - * libretroshare/src/util: rsprint.h - * - * RetroShare Utilities - * - * Copyright 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/util: rsprint.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2008-2008 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSUTIL_PRINTFNS_H #define RSUTIL_PRINTFNS_H From 858dcfc14cb816dbf91a3c1e18177912adb7cc72 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 May 2018 21:19:53 +0200 Subject: [PATCH 061/213] removed unused tempering in random number generator, added comments and license text --- libretroshare/src/util/rsrandom.cc | 27 +++++++++++++++ libretroshare/src/util/rsrandom.h | 53 ++++++++++++++---------------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/libretroshare/src/util/rsrandom.cc b/libretroshare/src/util/rsrandom.cc index 03c8a95d9..86f93bf5f 100644 --- a/libretroshare/src/util/rsrandom.cc +++ b/libretroshare/src/util/rsrandom.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: rsrandom.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2010 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include @@ -35,6 +56,10 @@ bool RSRandom::seed(uint32_t s) for (j=1; j> 30)) + j) & 0xffffffffUL ; + // This *does not* replace the internal seed state of RAND_bytes(), but only *adds* entropy to the random pool + // So calling this method with the same value twice does not guarranty that the output of the random bytes + // will be the same. + RAND_seed((unsigned char *)&MT[0],N*sizeof(uint32_t)) ; locked_next_state() ; @@ -66,11 +91,13 @@ uint32_t RSRandom::random_u32() y = MT[index] ; } +#ifdef UNNECESSARY_CODE // Tempering y ^= (y >> 11); y ^= (y << 7 ) & 0x9d2c5680UL; y ^= (y << 15) & 0xefc60000UL; y ^= (y >> 18); +#endif return y; } diff --git a/libretroshare/src/util/rsrandom.h b/libretroshare/src/util/rsrandom.h index 8cd66f7f6..59c488909 100644 --- a/libretroshare/src/util/rsrandom.h +++ b/libretroshare/src/util/rsrandom.h @@ -1,36 +1,31 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2010 Cyril Soler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - +/******************************************************************************* + * libretroshare/src/util: rsrandom.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2010 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once // RSRandom contains a random number generator that is // - thread safe // - system independant // - fast -// - NOT CRYPTOGRAPHICALLY SAFE -// - DO NOT USE FOR ANYTHING REQUIRING STRONG RANDOMNESS -// -// The implementation is adapted from the Mersenne Twister page of Wikipedia. -// -// http://en.wikipedia.org/wiki/Mersenne_twister +// - CRYPTOGRAPHICALLY SAFE, because it is based on openssl random number generator #include #include @@ -40,8 +35,8 @@ class RSRandom public: static uint32_t random_u32() ; static uint64_t random_u64() ; - static float random_f32() ; - static double random_f64() ; + static float random_f32() ; + static double random_f64() ; static bool seed(uint32_t s) ; From 8641da189c05a5008a3b32d3368841e2c721e757 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 May 2018 21:34:38 +0200 Subject: [PATCH 062/213] relicensed util/ and moved rsaes to crypto/ --- libretroshare/src/{util => crypto}/rsaes.cc | 46 +++++++++----------- libretroshare/src/crypto/rsaes.h | 43 +++++++++++++++++++ libretroshare/src/libretroshare.pro | 9 ++-- libretroshare/src/util/rsaes.h | 47 --------------------- libretroshare/src/util/rsnet_ss.cc | 47 ++++++++++----------- libretroshare/src/util/rsrecogn.cc | 46 +++++++++----------- libretroshare/src/util/rsrecogn.h | 47 +++++++++------------ libretroshare/src/util/rsstd.h | 42 +++++++++--------- libretroshare/src/util/rsstring.cc | 42 +++++++++--------- libretroshare/src/util/rsstring.h | 42 +++++++++--------- libretroshare/src/util/rsthreads.cc | 46 +++++++++----------- libretroshare/src/util/rsthreads.h | 46 +++++++++----------- libretroshare/src/util/rstickevent.cc | 46 +++++++++----------- libretroshare/src/util/rstickevent.h | 45 +++++++++----------- libretroshare/src/util/rstime.cc | 46 +++++++++----------- libretroshare/src/util/rstime.h | 46 +++++++++----------- libretroshare/src/util/rsversioninfo.cc | 28 +++++++++--- libretroshare/src/util/rsversioninfo.h | 28 +++++++++--- libretroshare/src/util/rswin.cc | 1 - libretroshare/src/util/rswin.h | 42 +++++++++--------- libretroshare/src/util/smallobject.cc | 21 +++++++++ libretroshare/src/util/smallobject.h | 46 +++++++++----------- libretroshare/src/util/stacktrace.h | 44 +++++++++---------- 23 files changed, 448 insertions(+), 448 deletions(-) rename libretroshare/src/{util => crypto}/rsaes.cc (68%) create mode 100644 libretroshare/src/crypto/rsaes.h delete mode 100644 libretroshare/src/util/rsaes.h delete mode 100644 libretroshare/src/util/rswin.cc diff --git a/libretroshare/src/util/rsaes.cc b/libretroshare/src/crypto/rsaes.cc similarity index 68% rename from libretroshare/src/util/rsaes.cc rename to libretroshare/src/crypto/rsaes.cc index 7be5175f9..d5ad2c7a0 100644 --- a/libretroshare/src/util/rsaes.cc +++ b/libretroshare/src/crypto/rsaes.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/utils: rsaes.cc - * - * AES crptography for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsaes.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/crypto/rsaes.h b/libretroshare/src/crypto/rsaes.h new file mode 100644 index 000000000..d4592793d --- /dev/null +++ b/libretroshare/src/crypto/rsaes.h @@ -0,0 +1,43 @@ +/******************************************************************************* + * libretroshare/src/util: rsaes.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#include + +class RsAES +{ + public: + // Crypt/decrypt data using a 16 bytes key and a 8 bytes salt. + // + // output_data allocation is left to the client. The size should be at least RsAES::get_buffer_size(input_data_length) + // + // Return value: + // true: encryption/decryption ok + // + // false: encryption/decryption went bad. Check buffer size. + // + static bool aes_crypt_8_16(const uint8_t *input_data,uint32_t input_data_length,uint8_t key[16],uint8_t salt[8],uint8_t *output_data,uint32_t& output_data_length) ; + static bool aes_decrypt_8_16(const uint8_t *input_data,uint32_t input_data_length,uint8_t key[16],uint8_t salt[8],uint8_t *output_data,uint32_t& output_data_length) ; + + // computes the safe buffer size to store encrypted/decrypted data for the given input stream size + // + static uint32_t get_buffer_size(uint32_t size) ; +}; + diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index d11012de6..6c8620617 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -391,7 +391,8 @@ HEADERS += ft/ftchunkmap.h \ ft/ftturtlefiletransferitem.h HEADERS += crypto/chacha20.h \ - crypto/hashstream.h + crypto/rsaes.h \ + crypto/hashstream.h HEADERS += directory_updater.h \ directory_list.h \ @@ -406,7 +407,6 @@ HEADERS += pqi/authssl.h \ pqi/authgpg.h \ pgp/pgphandler.h \ pgp/pgpkeyutil.h \ - pgp/rsaes.h \ pgp/rscertificate.h \ pgp/pgpauxutils.h \ pqi/p3cfgmgr.h \ @@ -556,7 +556,8 @@ SOURCES += ft/ftchunkmap.cc \ ft/ftturtlefiletransferitem.cc SOURCES += crypto/chacha20.cpp \ - crypto/hashstream.cc + crypto/rsaes.cc \ + crypto/hashstream.cc SOURCES += chat/distantchat.cc \ chat/p3chatservice.cc \ @@ -682,8 +683,6 @@ SOURCES += util/folderiterator.cc \ util/rsstring.cc \ util/rsthreads.cc \ util/rsversioninfo.cc \ - util/rswin.cc \ - util/rsaes.cc \ util/rsrandom.cc \ util/rstickevent.cc \ util/rsrecogn.cc \ diff --git a/libretroshare/src/util/rsaes.h b/libretroshare/src/util/rsaes.h deleted file mode 100644 index 21a8c701c..000000000 --- a/libretroshare/src/util/rsaes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libretroshare/src/utils: rsaescrypt.h - * - * AES crptography for RetroShare. - * - * Copyright 2013 by Cyril Soler - * - * 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 "csoler@users.sourceforge.net". - * - */ - -#include - -class RsAES -{ - public: - // Crypt/decrypt data using a 16 bytes key and a 8 bytes salt. - // - // output_data allocation is left to the client. The size should be at least RsAES::get_buffer_size(input_data_length) - // - // Return value: - // true: encryption/decryption ok - // - // false: encryption/decryption went bad. Check buffer size. - // - static bool aes_crypt_8_16(const uint8_t *input_data,uint32_t input_data_length,uint8_t key[16],uint8_t salt[8],uint8_t *output_data,uint32_t& output_data_length) ; - static bool aes_decrypt_8_16(const uint8_t *input_data,uint32_t input_data_length,uint8_t key[16],uint8_t salt[8],uint8_t *output_data,uint32_t& output_data_length) ; - - // computes the safe buffer size to store encrypted/decrypted data for the given input stream size - // - static uint32_t get_buffer_size(uint32_t size) ; -}; - diff --git a/libretroshare/src/util/rsnet_ss.cc b/libretroshare/src/util/rsnet_ss.cc index 581fd06e9..985282cc2 100644 --- a/libretroshare/src/util/rsnet_ss.cc +++ b/libretroshare/src/util/rsnet_ss.cc @@ -1,28 +1,25 @@ -/* - * libretroshare/src/util: rsnet_ss.cc - * - * sockaddr_storage functions for RetroShare. - * - * Copyright 2013-2013 by Robert Fernie. - * Copyright (C) 2015-2018 Gioacchino Mazzurco - * - * 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsnet_ss.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 Robert Fernie * + * Copyright 2015-2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/util/rsrecogn.cc b/libretroshare/src/util/rsrecogn.cc index 2b6e51caa..581ec9268 100644 --- a/libretroshare/src/util/rsrecogn.cc +++ b/libretroshare/src/util/rsrecogn.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: rsrecogn.cc - * - * RetroShare Utilities - * - * Copyright 2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsrandom.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "pqi/pqi_base.h" #include "util/rsrecogn.h" diff --git a/libretroshare/src/util/rsrecogn.h b/libretroshare/src/util/rsrecogn.h index 4f7b7cd2e..7cc33ec76 100644 --- a/libretroshare/src/util/rsrecogn.h +++ b/libretroshare/src/util/rsrecogn.h @@ -1,29 +1,24 @@ - -/* - * libretroshare/src/util: rsrecogn.h - * - * RetroShare Utilities - * - * Copyright 2013 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsrandom.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2013 Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSUTIL_RECOGN_H #define RSUTIL_RECOGN_H diff --git a/libretroshare/src/util/rsstd.h b/libretroshare/src/util/rsstd.h index b2ff78887..8a41a3270 100644 --- a/libretroshare/src/util/rsstd.h +++ b/libretroshare/src/util/rsstd.h @@ -1,24 +1,24 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2015, RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - +/******************************************************************************* + * libretroshare/src/util: rsstd.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2015 Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSSTD_H_ #define RSSTD_H_ diff --git a/libretroshare/src/util/rsstring.cc b/libretroshare/src/util/rsstring.cc index fe29bca92..db7000cec 100644 --- a/libretroshare/src/util/rsstring.cc +++ b/libretroshare/src/util/rsstring.cc @@ -1,24 +1,24 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2010, Thomas Kister - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - +/******************************************************************************* + * libretroshare/src/util: rsstd.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (c) 2010, Thomas Kister * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsstring.h" #ifdef WINDOWS_SYS diff --git a/libretroshare/src/util/rsstring.h b/libretroshare/src/util/rsstring.h index 0e9df964f..93553885e 100644 --- a/libretroshare/src/util/rsstring.h +++ b/libretroshare/src/util/rsstring.h @@ -1,24 +1,24 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2010, Thomas Kister - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - +/******************************************************************************* + * libretroshare/src/util: rsstd.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (c) 2010, Thomas Kister * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RSSTRING_H_ #define RSSTRING_H_ diff --git a/libretroshare/src/util/rsthreads.cc b/libretroshare/src/util/rsthreads.cc index 65fcad4b7..755134817 100644 --- a/libretroshare/src/util/rsthreads.cc +++ b/libretroshare/src/util/rsthreads.cc @@ -1,28 +1,24 @@ - -/* - * "$Id: rsthreads.cc,v 1.1 2007-02-19 20:08:30 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2007 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rsthreads.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2007 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsthreads.h" #include // for usleep() diff --git a/libretroshare/src/util/rsthreads.h b/libretroshare/src/util/rsthreads.h index 0dfbc4c44..dfad45e2c 100644 --- a/libretroshare/src/util/rsthreads.h +++ b/libretroshare/src/util/rsthreads.h @@ -1,28 +1,24 @@ -/* - * "$Id: rsthreads.h,v 1.1 2007-02-19 20:08:30 rmf24 Exp $" - * - * RetroShare C++ Interface. - * - * Copyright 2004-2006 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rsthreads.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2004-2006 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/util/rstickevent.cc b/libretroshare/src/util/rstickevent.cc index 0da21cf4d..4c9cdc37b 100644 --- a/libretroshare/src/util/rstickevent.cc +++ b/libretroshare/src/util/rstickevent.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: rstickevent.cc - * - * Identity interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rstickevent.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "util/rstickevent.h" #include diff --git a/libretroshare/src/util/rstickevent.h b/libretroshare/src/util/rstickevent.h index 1b26c6b43..4b08d9139 100644 --- a/libretroshare/src/util/rstickevent.h +++ b/libretroshare/src/util/rstickevent.h @@ -1,27 +1,24 @@ -/* - * libretroshare/src/util: rstickevent.h - * - * Identity interface for RetroShare. - * - * Copyright 2012-2012 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.1 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". - * - */ +/******************************************************************************* + * libretroshare/src/util: rstickevent.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2012-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef RS_UTIL_TICK_EVENT #define RS_UTIL_TICK_EVENT diff --git a/libretroshare/src/util/rstime.cc b/libretroshare/src/util/rstime.cc index 9733ac55d..d2180775e 100644 --- a/libretroshare/src/util/rstime.cc +++ b/libretroshare/src/util/rstime.cc @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: rsscopetimer.cc - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2013- by Cyril Soler - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rstime.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include #include diff --git a/libretroshare/src/util/rstime.h b/libretroshare/src/util/rstime.h index 4359a28ff..a9b3dfd5b 100644 --- a/libretroshare/src/util/rstime.h +++ b/libretroshare/src/util/rstime.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: rsscopetimer.h - * - * 3P/PQI network interface for RetroShare. - * - * Copyright 2013- by Cyril Soler - * - * 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". - * - */ - +/******************************************************************************* + * libretroshare/src/util: rstime.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include namespace rstime { diff --git a/libretroshare/src/util/rsversioninfo.cc b/libretroshare/src/util/rsversioninfo.cc index 04f03322f..6e48d3939 100644 --- a/libretroshare/src/util/rsversioninfo.cc +++ b/libretroshare/src/util/rsversioninfo.cc @@ -1,10 +1,24 @@ -/* - * rsversion.cc - * - * Created on: Jun 23, 2009 - * Author: alexandrut - */ - +/******************************************************************************* + * libretroshare/src/util: rsversioninfo.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Alexandrut * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "rsversioninfo.h" #include "retroshare/rsversion.h" #include "rsstring.h" diff --git a/libretroshare/src/util/rsversioninfo.h b/libretroshare/src/util/rsversioninfo.h index 3cc331aca..041839b21 100644 --- a/libretroshare/src/util/rsversioninfo.h +++ b/libretroshare/src/util/rsversioninfo.h @@ -1,10 +1,24 @@ -/* - * rsversion.h - * - * Created on: Jun 23, 2009 - * Author: alexandrut - */ - +/******************************************************************************* + * libretroshare/src/util: rsversioninfo.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2013-2013 by Alexandrut * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include diff --git a/libretroshare/src/util/rswin.cc b/libretroshare/src/util/rswin.cc deleted file mode 100644 index 6476c6faf..000000000 --- a/libretroshare/src/util/rswin.cc +++ /dev/null @@ -1 +0,0 @@ -#include "util/rswin.h" diff --git a/libretroshare/src/util/rswin.h b/libretroshare/src/util/rswin.h index eba97f428..22e2ead96 100644 --- a/libretroshare/src/util/rswin.h +++ b/libretroshare/src/util/rswin.h @@ -1,24 +1,24 @@ -/**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2010, Thomas Kister - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - +/******************************************************************************* + * libretroshare/src/util: rswin.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (c) 2010, Thomas Kister * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ /** * This file provides helper functions for the windows environment diff --git a/libretroshare/src/util/smallobject.cc b/libretroshare/src/util/smallobject.cc index baf8ee357..3e1759fed 100644 --- a/libretroshare/src/util/smallobject.cc +++ b/libretroshare/src/util/smallobject.cc @@ -1,3 +1,24 @@ +/******************************************************************************* + * libretroshare/src/util: smallobject.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright (c) 2011, Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include #include "smallobject.h" #include "util/rsthreads.h" diff --git a/libretroshare/src/util/smallobject.h b/libretroshare/src/util/smallobject.h index a5b11bcc9..2f3ac592c 100644 --- a/libretroshare/src/util/smallobject.h +++ b/libretroshare/src/util/smallobject.h @@ -1,28 +1,24 @@ -/* - * libretroshare/src/util: smallobject.h - * - * Universal Networking Header for RetroShare. - * - * Copyright 2011 by Cyril Soler - * - * 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 "cyril.soler@users.sourceforge.net". - * - */ - +/******************************************************************************* + * libretroshare/src/util: smallobject.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (c) 2011, Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #pragma once #include diff --git a/libretroshare/src/util/stacktrace.h b/libretroshare/src/util/stacktrace.h index 48ab2527d..f7284e7f9 100644 --- a/libretroshare/src/util/stacktrace.h +++ b/libretroshare/src/util/stacktrace.h @@ -1,25 +1,25 @@ -/* - * stacktrace.h - * - * Copyright (C) 2016 Gioacchino Mazzurco - * Copyright (C) 2008 Timo Bingmann http://idlebox.net/ - * - * 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. - * - */ - +/******************************************************************************* + * libretroshare/src/util: smallobject.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2016 Gioacchino Mazzurco * + * Copyright (C) 2008 Timo Bingmann http://idlebox.net/ * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef _STACKTRACE_H_ #define _STACKTRACE_H_ From bc63726c4c606ff5d410907709fe6309305e5221 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 May 2018 21:35:29 +0200 Subject: [PATCH 063/213] fixed compilation --- libretroshare/src/chat/distantchat.cc | 2 +- libretroshare/src/chat/p3chatservice.cc | 2 +- libretroshare/src/gxstunnel/p3gxstunnel.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/chat/distantchat.cc b/libretroshare/src/chat/distantchat.cc index b6da39fe8..60b11b0b3 100644 --- a/libretroshare/src/chat/distantchat.cc +++ b/libretroshare/src/chat/distantchat.cc @@ -27,7 +27,7 @@ #include "openssl/dh.h" #include "openssl/err.h" -#include "util/rsaes.h" +#include "crypto/rsaes.h" #include "util/rsmemory.h" #include "util/rsprint.h" diff --git a/libretroshare/src/chat/p3chatservice.cc b/libretroshare/src/chat/p3chatservice.cc index 77fb91bea..08267f6be 100644 --- a/libretroshare/src/chat/p3chatservice.cc +++ b/libretroshare/src/chat/p3chatservice.cc @@ -26,7 +26,7 @@ #include "util/rsdir.h" #include "util/radix64.h" -#include "util/rsaes.h" +#include "crypto/rsaes.h" #include "util/rsrandom.h" #include "util/rsstring.h" #include "retroshare/rsiface.h" diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index 89beb2b8b..bb51caaeb 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -25,7 +25,7 @@ #include "openssl/dh.h" #include "openssl/err.h" -#include "util/rsaes.h" +#include "crypto/rsaes.h" #include "util/rsprint.h" #include "util/rsmemory.h" From b0f391d66f823f63b4ede44c76df100534310f04 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 May 2018 21:45:18 +0200 Subject: [PATCH 064/213] fixed compilation and re-licensed zeroconf/ --- libretroshare/src/libretroshare.pro | 2 - libretroshare/src/pgp/pgphandler.cc | 2 - libretroshare/src/pgp/pgpkeyutil.cc | 2 - libretroshare/src/pgp/rscertificate.cc | 2 - libretroshare/src/pqi/p3cfgmgr.cc | 1 - libretroshare/src/services/p3msgservice.cc | 1 - .../src/{pqi => unused}/pqiarchive.cc | 0 .../src/{pqi => unused}/pqiarchive.h | 0 libretroshare/src/zeroconf/p3zcnatassist.cc | 47 +++++++++---------- libretroshare/src/zeroconf/p3zcnatassist.h | 47 +++++++++---------- libretroshare/src/zeroconf/p3zeroconf.cc | 47 +++++++++---------- libretroshare/src/zeroconf/p3zeroconf.h | 47 +++++++++---------- 12 files changed, 84 insertions(+), 114 deletions(-) rename libretroshare/src/{pqi => unused}/pqiarchive.cc (100%) rename libretroshare/src/{pqi => unused}/pqiarchive.h (100%) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 6c8620617..36db181aa 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -418,7 +418,6 @@ HEADERS += pqi/authssl.h \ pqi/pqiqos.h \ pqi/pqi.h \ pqi/pqi_base.h \ - pqi/pqiarchive.h \ pqi/pqiassist.h \ pqi/pqibin.h \ pqi/pqihandler.h \ @@ -576,7 +575,6 @@ SOURCES += pqi/authgpg.cc \ pqi/p3netmgr.cc \ pqi/p3notify.cc \ pqi/pqiqos.cc \ - pqi/pqiarchive.cc \ pqi/pqibin.cc \ pqi/pqihandler.cc \ pqi/p3historymgr.cc \ diff --git a/libretroshare/src/pgp/pgphandler.cc b/libretroshare/src/pgp/pgphandler.cc index 709231f20..f5ca9fa1e 100644 --- a/libretroshare/src/pgp/pgphandler.cc +++ b/libretroshare/src/pgp/pgphandler.cc @@ -19,8 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once - #include #include #include diff --git a/libretroshare/src/pgp/pgpkeyutil.cc b/libretroshare/src/pgp/pgpkeyutil.cc index e8f1f1d5b..76b332edf 100644 --- a/libretroshare/src/pgp/pgpkeyutil.cc +++ b/libretroshare/src/pgp/pgpkeyutil.cc @@ -19,8 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once - #include #include #include "pgpkeyutil.h" diff --git a/libretroshare/src/pgp/rscertificate.cc b/libretroshare/src/pgp/rscertificate.cc index 88424fa29..a72a589bf 100644 --- a/libretroshare/src/pgp/rscertificate.cc +++ b/libretroshare/src/pgp/rscertificate.cc @@ -19,8 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once - #include #include #include diff --git a/libretroshare/src/pqi/p3cfgmgr.cc b/libretroshare/src/pqi/p3cfgmgr.cc index d601c460e..7f9f03547 100644 --- a/libretroshare/src/pqi/p3cfgmgr.cc +++ b/libretroshare/src/pqi/p3cfgmgr.cc @@ -25,7 +25,6 @@ #include "pqi/authssl.h" #include "pqi/pqibin.h" #include "pqi/pqistore.h" -#include "pqi/pqiarchive.h" #include #include #include diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc index 54fdc710e..5b270749b 100644 --- a/libretroshare/src/services/p3msgservice.cc +++ b/libretroshare/src/services/p3msgservice.cc @@ -24,7 +24,6 @@ #include "retroshare/rsidentity.h" #include "pqi/pqibin.h" -#include "pqi/pqiarchive.h" #include "pqi/p3linkmgr.h" #include "pqi/authgpg.h" #include "pqi/p3cfgmgr.h" diff --git a/libretroshare/src/pqi/pqiarchive.cc b/libretroshare/src/unused/pqiarchive.cc similarity index 100% rename from libretroshare/src/pqi/pqiarchive.cc rename to libretroshare/src/unused/pqiarchive.cc diff --git a/libretroshare/src/pqi/pqiarchive.h b/libretroshare/src/unused/pqiarchive.h similarity index 100% rename from libretroshare/src/pqi/pqiarchive.h rename to libretroshare/src/unused/pqiarchive.h diff --git a/libretroshare/src/zeroconf/p3zcnatassist.cc b/libretroshare/src/zeroconf/p3zcnatassist.cc index 1e35de50b..9e3ed5e58 100644 --- a/libretroshare/src/zeroconf/p3zcnatassist.cc +++ b/libretroshare/src/zeroconf/p3zcnatassist.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src/zeroconf: p3zeroconf.cc - * - * ZeroConf interface for RetroShare. - * - * Copyright 2011-2011 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/zeroconf: p3zcnatassist.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "zeroconf/p3zeroconf.h" #include "zeroconf/p3zcnatassist.h" diff --git a/libretroshare/src/zeroconf/p3zcnatassist.h b/libretroshare/src/zeroconf/p3zcnatassist.h index ad92d9a2a..9e5bcc313 100644 --- a/libretroshare/src/zeroconf/p3zcnatassist.h +++ b/libretroshare/src/zeroconf/p3zcnatassist.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/zeroconf: p3zcnatassist.h - * - * ZeroConf interface for RetroShare. - * - * Copyright 2011-2012 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/zeroconf: p3zcnatassist.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_P3_ZC_NAT_ASSIST_H #define MRK_P3_ZC_NAT_ASSIST_H diff --git a/libretroshare/src/zeroconf/p3zeroconf.cc b/libretroshare/src/zeroconf/p3zeroconf.cc index b4417ddbd..65aedc7f6 100644 --- a/libretroshare/src/zeroconf/p3zeroconf.cc +++ b/libretroshare/src/zeroconf/p3zeroconf.cc @@ -1,29 +1,24 @@ -/* - * libretroshare/src/zeroconf: p3zeroconf.cc - * - * ZeroConf interface for RetroShare. - * - * Copyright 2011-2011 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/zeroconf: p3zeroconf.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #include "zeroconf/p3zeroconf.h" #include #include diff --git a/libretroshare/src/zeroconf/p3zeroconf.h b/libretroshare/src/zeroconf/p3zeroconf.h index 46365633b..9b7e21b5c 100644 --- a/libretroshare/src/zeroconf/p3zeroconf.h +++ b/libretroshare/src/zeroconf/p3zeroconf.h @@ -1,29 +1,24 @@ -/* - * libretroshare/src/zeroconf: p3zeroconf.h - * - * ZeroConf interface for RetroShare. - * - * Copyright 2011-2011 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". - * - */ - - +/******************************************************************************* + * libretroshare/src/zeroconf: p3zeroconf.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2011-2012 by Robert Fernie * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ #ifndef MRK_P3_ZEROCONF_H #define MRK_P3_ZEROCONF_H From 8ceb597310b160be5cf72e1aceb5cf86e70446dd Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 30 May 2018 21:57:13 +0200 Subject: [PATCH 065/213] removed non relevent directories from debian archive --- build_scripts/Debian/makeSourcePackage.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build_scripts/Debian/makeSourcePackage.sh b/build_scripts/Debian/makeSourcePackage.sh index 273030f48..30e6aa736 100755 --- a/build_scripts/Debian/makeSourcePackage.sh +++ b/build_scripts/Debian/makeSourcePackage.sh @@ -123,6 +123,12 @@ if ! test "${nodl}" = "yes"; then # remove unised qml code, only needed on Android rm -rf ${workdir}/src/retroshare-qml-app/ + rm -rf ${workdir}/src/librssimulator/ + rm -rf ${workdir}/src/retroshare-android-notify-service/ + rm -rf ${workdir}/src/retroshare-android-service/ + rm -rf ${workdir}/src/libretroshare/src/unused/ + rm -rf ${workdir}/src/pegmarkdown/ + rm -rf ${workdir}/src/unittests/ rm -rf ${workdir}/src/build_scripts/ rm -f ${workdir}/debian/*~ rm -f ${workdir}/debian/.*.sw? @@ -156,6 +162,12 @@ else cp -r debian/* ${workdir}/debian/ rm -rf ${workdir}/src/retroshare-qml-app/ + rm -rf ${workdir}/src/retroshare-android-notify-service/ + rm -rf ${workdir}/src/retroshare-android-service/ + rm -rf ${workdir}/src/librssimulator/ + rm -rf ${workdir}/src/unittests/ + rm -rf ${workdir}/src/libretroshare/src/unused/ + rm -rf ${workdir}/src/pegmarkdown/ rm -rf ${workdir}/src/build_scripts/ rm -f ${workdir}/debian/*~ rm -f ${workdir}/debian/.*.sw? From 90d7f55c404cca1829f8b978d084f5dbfd271bc3 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 May 2018 15:41:54 +0200 Subject: [PATCH 066/213] finished implementing GXS search items --- libretroshare/src/pqi/p3notify.cc | 3 +- libretroshare/src/pqi/p3notify.h | 1 + libretroshare/src/retroshare/rsnotify.h | 1 + libretroshare/src/retroshare/rsturtle.h | 3 +- libretroshare/src/turtle/p3turtle.cc | 206 +++++++++++++---------- libretroshare/src/turtle/rsturtleitem.cc | 67 +++++++- libretroshare/src/turtle/rsturtleitem.h | 195 +++++++++++++-------- retroshare-gui/src/gui/notifyqt.cpp | 5 + retroshare-gui/src/gui/notifyqt.h | 1 + 9 files changed, 322 insertions(+), 160 deletions(-) diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index 43caf9758..2461d5f1c 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -231,7 +231,8 @@ void p3Notify::notifyChatLobbyTimeShift (int time_shift) void p3Notify::notifyCustomState (const std::string& peer_id , const std::string& status_string ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyCustomState (peer_id,status_string) ; } void p3Notify::notifyHashingInfo (uint32_t type , const std::string& fileinfo ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHashingInfo (type,fileinfo) ; } void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,files) ; } -void p3Notify::notifyPeerHasNewAvatar (std::string peer_id ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerHasNewAvatar(peer_id) ; } +void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& groups ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,groups) ; } +void p3Notify::notifyPeerHasNewAvatar (std::string peer_id ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerHasNewAvatar(peer_id) ; } void p3Notify::notifyOwnAvatarChanged () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnAvatarChanged() ; } void p3Notify::notifyOwnStatusMessageChanged() { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnStatusMessageChanged() ; } void p3Notify::notifyDiskFull (uint32_t location , uint32_t size_limit_in_MB ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDiskFull (location,size_limit_in_MB) ; } diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index 820c4a6bb..22e1f143d 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -106,6 +106,7 @@ class p3Notify: public RsNotify void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ; void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) ; void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) ; + void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) ; void notifyPeerHasNewAvatar (std::string /* peer_id */) ; void notifyOwnAvatarChanged () ; void notifyOwnStatusMessageChanged () ; diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index b73c577e9..6d9db3ef7 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -228,6 +228,7 @@ class NotifyClient virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {} virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {} virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) {} + virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) {} virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {} virtual void notifyOwnAvatarChanged () {} virtual void notifyOwnStatusMessageChanged () {} diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 4609905bc..0467b452d 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -57,8 +57,9 @@ struct TurtleFileInfo struct TurtleGxsInfo { RsGxsGroupId group_id ; + uint16_t service_id ; std::string name ; - RsTlvBinaryData meta ; + //RsTlvBinaryData meta ;// is that actually needed? Not sure. Better if it's not. }; struct TurtleTunnelRequestDisplayInfo { diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index ca337f241..11cb8017a 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -71,7 +71,7 @@ void TS_dumpState() ; // an in-depth test would be better to get an idea of what the ideal values // could ever be. // -// update of 14-03-11: +// update of 14-03-11: // - I raised the cache time for tunnel requests. This avoids inconsistencies such as: // * tunnel requests bouncing back while the original request is not in the cache anymore // * special case of this for own file transfer: an outgoing tunnel is built with no end. @@ -155,13 +155,15 @@ void p3turtle::getItemNames(std::map& names) const { names.clear(); - names[RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST ] = "Search request"; - names[RS_TURTLE_SUBTYPE_SEARCH_RESULT ] = "Search result"; + names[RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST ] = "Filename substring search request"; + names[RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST ] = "GXS search request"; + names[RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT ] = "File search result"; + names[RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT ] = "GXS search result"; names[RS_TURTLE_SUBTYPE_OPEN_TUNNEL ] = "Tunnel request"; names[RS_TURTLE_SUBTYPE_TUNNEL_OK ] = "Tunnel response"; names[RS_TURTLE_SUBTYPE_FILE_REQUEST ] = "Data request"; names[RS_TURTLE_SUBTYPE_FILE_DATA ] = "Data chunk"; - names[RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST ] = "RegExp search"; + names[RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST ] = "Filename RegExp search request"; names[RS_TURTLE_SUBTYPE_GENERIC_DATA ] = "Generic data"; names[RS_TURTLE_SUBTYPE_FILE_MAP ] = "Chunk map"; names[RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST ] = "Chunk map request"; @@ -169,7 +171,7 @@ void p3turtle::getItemNames(std::map& names) const names[RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST ] = "Chunk CRC request"; } -void p3turtle::setEnabled(bool b) +void p3turtle::setEnabled(bool b) { RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ _turtle_routing_enabled = b; @@ -188,7 +190,7 @@ bool p3turtle::enabled() const } -void p3turtle::setSessionEnabled(bool b) +void p3turtle::setSessionEnabled(bool b) { RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ _turtle_routing_session_enabled = b; @@ -246,7 +248,7 @@ int p3turtle::tick() RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ _last_tunnel_management_time = now ; - // Update traffic statistics. The constants are important: they allow a smooth variation of the + // Update traffic statistics. The constants are important: they allow a smooth variation of the // traffic speed, which is used to moderate tunnel requests statistics. // _traffic_info = _traffic_info*0.9 + _traffic_info_buffer* (0.1 / (float)TIME_BETWEEN_TUNNEL_MANAGEMENT_CALLS) ; @@ -374,8 +376,8 @@ void p3turtle::manageTunnels() // - the hash hasn't been tunneled for more than REGULAR_TUNNEL_DIGGING_TIME seconds, even if downloading. // // Candidate hashes are sorted, by olderness. The older gets tunneled first. At most MAX_TUNNEL_REQS_PER_SECOND are - // treated at once, as this method is called every second. - // Note: Because REGULAR_TUNNEL_DIGGING_TIME is larger than EMPTY_TUNNELS_DIGGING_TIME, files being downloaded get + // treated at once, as this method is called every second. + // Note: Because REGULAR_TUNNEL_DIGGING_TIME is larger than EMPTY_TUNNELS_DIGGING_TIME, files being downloaded get // re-tunneled in priority. As this happens less, they don't obliterate tunneling for files that have no tunnels yet. std::vector > hashes_to_digg ; @@ -556,7 +558,7 @@ void p3turtle::autoWash() // Now remove all the virtual peers ids at the client services. Off mutex! // - + for(uint32_t i=0;i::iterator it(_incoming_file_hashes.find(hash)) ; @@ -663,7 +665,7 @@ void p3turtle::locked_closeTunnel(TurtleTunnelId tid,std::vector& load) RsConfigKeyValueSet *vitem = dynamic_cast(*it) ; if(vitem != NULL) - for(std::list::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit) + for(std::list::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit) { if(kit->key == "TURTLE_CONFIG_MAX_TR_RATE") { @@ -828,7 +830,7 @@ int p3turtle::handleIncoming() RsTurtleGenericTunnelItem *gti = dynamic_cast(item) ; if(gti != NULL) - routeGenericTunnelItem(gti) ; /// Generic packets, that travel through established tunnels. + routeGenericTunnelItem(gti) ; /// Generic packets, that travel through established tunnels. else /// These packets should be destroyed by the client. { /// Special packets that require specific treatment, because tunnels do not exist for these packets. @@ -840,7 +842,8 @@ int p3turtle::handleIncoming() case RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST: handleSearchRequest(dynamic_cast(item)) ; break ; - case RS_TURTLE_SUBTYPE_SEARCH_RESULT : handleSearchResult(dynamic_cast(item)) ; + case RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT : + case RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT : handleSearchResult(dynamic_cast(item)) ; break ; case RS_TURTLE_SUBTYPE_OPEN_TUNNEL : handleTunnelRequest(dynamic_cast(item)) ; @@ -867,7 +870,7 @@ int p3turtle::handleIncoming() void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) { RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ - + // take a look at the item and test against inconsistent values // - If the item destimation is @@ -875,7 +878,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) std::cerr << "Received search request from peer " << item->PeerId() << ": " << std::endl ; item->print(std::cerr,0) ; #endif - + uint32_t item_size = RsTurtleSerialiser().size(item); if(item_size > TURTLE_MAX_SEARCH_REQ_ACCEPTED_SERIAL_SIZE) @@ -886,7 +889,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) std::cerr << " Caught a turtle search item with arbitrary large size from " << item->PeerId() << " of size " << item_size << " and depth " << item->depth << ". This is not allowed => dropping." << std::endl; return ; } - + if(_search_requests_origins.size() > MAX_ALLOWED_SR_IN_CACHE) { #ifdef P3TURTLE_DEBUG @@ -924,49 +927,12 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) #ifdef P3TURTLE_DEBUG std::cerr << " Request not from us. Performing local search" << std::endl ; #endif + std::list search_results ; - std::list result ; + item->performLocalSearch(req,search_results) ; - item->performLocalSearch(result) ; - - RsTurtleSearchResultItem *res_item = NULL ; - uint32_t item_size = 0 ; - -#ifdef P3TURTLE_DEBUG - if(!result.empty()) - std::cerr << " " << result.size() << " matches found. Sending back to origin (" << item->PeerId() << ")." << std::endl ; -#endif - while(!result.empty() && req.result_count < TURTLE_SEARCH_RESULT_MAX_HITS) - { - // Let's chop search results items into several chunks of finite size to avoid exceeding streamer's capacity. - // - static const uint32_t RSTURTLE_MAX_SEARCH_RESPONSE_SIZE = 10000 ; - - if(res_item == NULL) - { - res_item = new RsTurtleSearchResultItem ; - item_size = 0 ; - - res_item->depth = 0 ; - res_item->request_id = item->request_id ; - res_item->PeerId(item->PeerId()) ; // send back to the same guy - } - res_item->result.push_back(result.front()) ; - - ++req.result_count ; // increase hit number for this particular search request. - - item_size += 8 /* size */ + result.front().hash.serial_size() + result.front().name.size() ; - result.pop_front() ; - - if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || result.empty() || req.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) - { -#ifdef P3TURTLE_DEBUG - std::cerr << " Sending back chunk of size " << item_size << ", for " << res_item->result.size() << " elements." << std::endl ; -#endif - sendItem(res_item) ; - res_item = NULL ; - } - } + for(auto it(search_results.begin());it!=search_results.end();++it) + sendItem(*it) ; } // if enough has been sent back already, do not sarch further @@ -1011,14 +977,14 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) // Copy current item and modify it. RsTurtleSearchRequestItem *fwd_item = item->clone() ; - // increase search depth, except in some rare cases, to prevent correlation between + // increase search depth, except in some rare cases, to prevent correlation between // TR sniffing and friend names. The strategy is to not increase depth if the depth // is 1: // If B receives a TR of depth 1 from A, B cannot deduice that A is downloading the // file, since A might have shifted the depth. // if(!random_dshift) - ++(fwd_item->depth) ; + ++(fwd_item->depth) ; fwd_item->PeerId(*it) ; @@ -1055,7 +1021,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) if(it->second.origin == _own_id) { - it->second.result_count += item->result.size() ; + it->second.result_count += item->count() ; returnSearchResult(item) ; // Yes, so send upward. } else @@ -1065,7 +1031,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) #endif // We update the total count forwarded back, and chop it to TURTLE_SEARCH_RESULT_MAX_HITS. - uint32_t n = item->result.size(); // not so good! + uint32_t n = item->count(); // not so good! if(it->second.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) { @@ -1076,14 +1042,14 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) if(it->second.result_count + n > TURTLE_SEARCH_RESULT_MAX_HITS) { for(uint32_t i=it->second.result_count + n; i>TURTLE_SEARCH_RESULT_MAX_HITS;--i) - item->result.pop_back() ; + item->pop() ; it->second.result_count = TURTLE_SEARCH_RESULT_MAX_HITS ; } else it->second.result_count += n ; - RsTurtleSearchResultItem *fwd_item = new RsTurtleSearchResultItem(*item) ; // copy the item + RsTurtleSearchResultItem *fwd_item = item->duplicate(); // Normally here, we should setup the forward adress, so that the owner's // of the files found can be further reached by a tunnel. @@ -1154,8 +1120,8 @@ void p3turtle::routeGenericTunnelItem(RsTurtleGenericTunnelItem *item) // Let's figure out whether this packet is for us or not. - if(item->PeerId() == tunnel.local_dst && tunnel.local_src != _own_id) //direction == RsTurtleGenericTunnelItem::DIRECTION_CLIENT && - { + if(item->PeerId() == tunnel.local_dst && tunnel.local_src != _own_id) //direction == RsTurtleGenericTunnelItem::DIRECTION_CLIENT && + { #ifdef P3TURTLE_DEBUG std::cerr << " Forwarding generic item to peer " << tunnel.local_src << std::endl ; #endif @@ -1193,7 +1159,7 @@ void p3turtle::routeGenericTunnelItem(RsTurtleGenericTunnelItem *item) // The packet was not forwarded, so it is for us. Let's treat it. // This is done off-mutex, to avoid various deadlocks // - + handleRecvGenericTunnelItem(item) ; delete item ; @@ -1316,13 +1282,13 @@ void p3turtle::sendTurtleData(const RsPeerId& virtual_peer_id,RsTurtleGenericTun if(tunnel.local_src == _own_id) { - item->setTravelingDirection(RsTurtleGenericTunnelItem::DIRECTION_SERVER) ; + item->setTravelingDirection(RsTurtleGenericTunnelItem::DIRECTION_SERVER) ; item->PeerId(tunnel.local_dst) ; _traffic_info_buffer.data_dn_Bps += ss ; } else if(tunnel.local_dst == _own_id) { - item->setTravelingDirection(RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ; + item->setTravelingDirection(RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ; item->PeerId(tunnel.local_src) ; _traffic_info_buffer.data_up_Bps += ss ; } @@ -1460,7 +1426,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ std::map::iterator it = _tunnel_requests_origins.find(item->request_id) ; - + if(it != _tunnel_requests_origins.end()) { #ifdef P3TURTLE_DEBUG @@ -1563,7 +1529,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) // - the tunnel id will now be unique for a given route // - allows a better balance of bandwidth for a given transfer // - avoid the waste of items that get lost when re-routing a tunnel - + #ifdef P3TURTLE_DEBUG std::cerr << "Perturbating partial tunnel id. Original=" << std::hex << item->partial_tunnel_id ; #endif @@ -1594,7 +1560,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) forward_probability = 1.0f / nb_online_ids ; // Setting forward_probability to 1/nb_online_ids forces at most one TR up per TR dn. But if we are overflooded by - // TR dn, we still need to control them to avoid flooding the pqiHandler outqueue. So we additionally moderate the + // TR dn, we still need to control them to avoid flooding the pqiHandler outqueue. So we additionally moderate the // forward probability so as to reduct the output rate accordingly. // if(_traffic_info.tr_dn_Bps / (float)TUNNEL_REQUEST_PACKET_SIZE > _max_tr_up_rate) @@ -1620,7 +1586,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) // Copy current item and modify it. RsTurtleOpenTunnelItem *fwd_item = new RsTurtleOpenTunnelItem(*item) ; - // increase search depth, except in some rare cases, to prevent correlation between + // increase search depth, except in some rare cases, to prevent correlation between // TR sniffing and friend names. The strategy is to not increase depth if the depth // is 1: // If B receives a TR of depth 1 from A, B cannot deduice that A is downloading the @@ -1777,7 +1743,61 @@ void p3turtle::handleTunnelResult(RsTurtleTunnelOkItem *item) // ------------------------------ IO with libretroshare ----------------------------// // -----------------------------------------------------------------------------------// // -void RsTurtleStringSearchRequestItem::performLocalSearch(std::list& result) const +void RsTurtleFileSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const +{ +#ifdef P3TURTLE_DEBUG + std::cerr << "Performing rsFiles->search()" << std::endl ; +#endif + // now, search! + std::list initialResults ; + search(initialResults) ; + +#ifdef P3TURTLE_DEBUG + std::cerr << initialResults.size() << " matches found." << std::endl ; +#endif + result.clear() ; + RsTurtleFTSearchResultItem *res_item = NULL ; + uint32_t item_size = 0 ; + + static const uint32_t RSTURTLE_MAX_SEARCH_RESPONSE_SIZE = 10000 ; + + for(auto it(initialResults.begin());it!=initialResults.end();++it) + { + if(res_item == NULL) + { + res_item = new RsTurtleFTSearchResultItem ; + item_size = 0 ; + + res_item->depth = 0 ; + res_item->request_id = request_id ; + res_item->PeerId(PeerId()) ; // send back to the same guy + + result.push_back(res_item) ; + } + res_item->result.push_back(*it); + + // Let's chop search results items into several chunks of finite size to avoid exceeding streamer's capacity. + // + ++req.result_count ; // increase hit number for this particular search request. + + item_size += 8 /* size */ + it->hash.serial_size() + it->name.size() ; + + if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + { +#ifdef P3TURTLE_DEBUG + std::cerr << " Sending back chunk of size " << item_size << ", for " << res_item->result.size() << " elements." << std::endl ; +#endif + res_item = NULL ; // forces creation of a new item. + } + } +} + +void RsTurtleGxsSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const +{ + std::cerr << "(EE) Missing code to perform actual GXS search" << std::endl; +} + +void RsTurtleStringSearchRequestItem::search(std::list& result) const { /* call to core */ std::list initialResults; @@ -1800,7 +1820,7 @@ void RsTurtleStringSearchRequestItem::performLocalSearch(std::list::const_iterator it(initialResults.begin());it!=initialResults.end();++it) { // retain only file type - if (it->type == DIR_TYPE_DIR) + if (it->type == DIR_TYPE_DIR) { #ifdef P3TURTLE_DEBUG std::cerr << " Skipping directory " << it->name << std::endl ; @@ -1816,7 +1836,7 @@ void RsTurtleStringSearchRequestItem::performLocalSearch(std::list& result) const +void RsTurtleRegExpSearchRequestItem::search(std::list& result) const { /* call to core */ std::list initialResults; @@ -1839,7 +1859,7 @@ void RsTurtleRegExpSearchRequestItem::performLocalSearch(std::list::const_iterator it(initialResults.begin());it!=initialResults.end();++it) { // retain only file type - if (it->type == DIR_TYPE_DIR) + if (it->type == DIR_TYPE_DIR) { #ifdef P3TURTLE_DEBUG std::cerr << " Skipping directory " << it->name << std::endl ; @@ -1953,13 +1973,25 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie void p3turtle::returnSearchResult(RsTurtleSearchResultItem *item) { - // just cout for now, but it should be notified to the gui - #ifdef P3TURTLE_DEBUG std::cerr << " Returning result for search request " << HEX_PRINT(item->request_id) << " upwards." << std::endl ; #endif - RsServer::notify()->notifyTurtleSearchResult(item->request_id,item->result) ; + RsTurtleFTSearchResultItem *ft_sr = dynamic_cast(item) ; + + if(ft_sr != NULL) + { + RsServer::notify()->notifyTurtleSearchResult(ft_sr->request_id,ft_sr->result) ; + return ; + } + + RsTurtleGxsSearchResultItem *gxs_sr = dynamic_cast(item) ; + + if(gxs_sr != NULL) + { + RsServer::notify()->notifyTurtleSearchResult(gxs_sr->request_id,gxs_sr->result) ; + return ; + } } /// Warning: this function should never be called while the turtle mutex is locked. @@ -2072,7 +2104,7 @@ std::string p3turtle::getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_i std::map::const_iterator it(_virtual_peers.find(virtual_peer_id)) ; if(it != _virtual_peers.end()) { - std::map::iterator it2( _local_tunnels.find(it->second) ) ; + std::map::iterator it2( _local_tunnels.find(it->second) ) ; if(it2 != _local_tunnels.end()) { if(it2->second.local_src == _own_id) @@ -2103,7 +2135,7 @@ bool p3turtle::encryptData(const unsigned char *clear_data,uint32_t clear_data_s TURTLE_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) << std::endl; #endif - uint32_t item_serialized_size = clear_data_size;//RsGenericSerializer().size(clear_item) ; + uint32_t item_serialized_size = clear_data_size;//RsGenericSerializer().size(clear_item) ; uint32_t total_data_size = ENCRYPTED_TURTLE_HEADER_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE + item_serialized_size + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE ; #ifdef SERVER_DEBUG @@ -2124,7 +2156,7 @@ bool p3turtle::encryptData(const unsigned char *clear_data,uint32_t clear_data_s edata[0] = 0xae ; edata[1] = 0xad ; - edata[2] = ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 + edata[2] = ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 edata[3] = 0x01 ; offset += ENCRYPTED_TURTLE_HEADER_SIZE; @@ -2141,7 +2173,7 @@ bool p3turtle::encryptData(const unsigned char *clear_data,uint32_t clear_data_s offset += ENCRYPTED_TURTLE_EDATA_SIZE ; - memcpy(&edata[offset],clear_data,clear_data_size); + memcpy(&edata[offset],clear_data,clear_data_size); #ifdef SERVER_DEBUG TURTLE_DEBUG() << " clear item : " << RsUtil::BinToHex(&edata[offset],std::min(50,(int)total_data_size-(int)offset)) << "(...)" << std::endl; @@ -2291,12 +2323,12 @@ void p3turtle::getInfo( std::vector >& hashes_info, tunnel.push_back(printNumber(it->first,true)) ; std::string name; - if(mLinkMgr->getPeerName(it->second.local_src,name)) + if(mLinkMgr->getPeerName(it->second.local_src,name)) tunnel.push_back(name) ; else tunnel.push_back(it->second.local_src.toStdString()) ; - if(mLinkMgr->getPeerName(it->second.local_dst,name)) + if(mLinkMgr->getPeerName(it->second.local_dst,name)) tunnel.push_back(name) ; else tunnel.push_back(it->second.local_dst.toStdString()); diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 35b250117..ca99b24d4 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -28,7 +28,9 @@ RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype) c { case RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST : return new RsTurtleStringSearchRequestItem(); case RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST : return new RsTurtleRegExpSearchRequestItem(); - case RS_TURTLE_SUBTYPE_SEARCH_RESULT : return new RsTurtleSearchResultItem(); + case RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST : return new RsTurtleGxsSearchRequestItem(); + case RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT : return new RsTurtleFTSearchResultItem(); + case RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT : return new RsTurtleGxsSearchResultItem(); case RS_TURTLE_SUBTYPE_OPEN_TUNNEL : return new RsTurtleOpenTunnelItem(); case RS_TURTLE_SUBTYPE_TUNNEL_OK : return new RsTurtleTunnelOkItem(); case RS_TURTLE_SUBTYPE_GENERIC_DATA : return new RsTurtleGenericDataItem(); @@ -61,7 +63,13 @@ void RsTurtleRegExpSearchRequestItem::serial_process(RsGenericSerializer::Serial RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; RsTypeSerializer::serial_process(j,ctx,expr,"expr") ; } - +void RsTurtleGxsSearchRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; + RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; + RsTypeSerializer::serial_process(j,ctx,service_id,"service_id") ; + RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_VALUE,match_string,"match_string") ; +} template<> uint32_t RsTypeSerializer::serial_size(const RsRegularExpression::LinearizedExpression& r) { uint32_t s = 0 ; @@ -140,13 +148,18 @@ template<> void RsTypeSerializer::print_data(const std::string& n, const RsRegul std::cerr << " [RegExpr ] " << n << ", tokens=" << expr._tokens.size() << " ints=" << expr._ints.size() << " strings=" << expr._strings.size() << std::endl; } -void RsTurtleSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +void RsTurtleFTSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; + RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; + RsTypeSerializer::serial_process (j,ctx,result ,"result") ; +} +void RsTurtleGxsSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; RsTypeSerializer::serial_process (j,ctx,result ,"result") ; } - template<> uint32_t RsTypeSerializer::serial_size(const TurtleFileInfo& i) { uint32_t s = 0 ; @@ -193,6 +206,52 @@ template<> void RsTypeSerializer::print_data(const std::string& n, const TurtleF std::cerr << " [FileInfo ] " << n << " size=" << i.size << " hash=" << i.hash << ", name=" << i.name << std::endl; } +template<> uint32_t RsTypeSerializer::serial_size(const TurtleGxsInfo& i) +{ + uint32_t s = 0 ; + + s += 2 ; // service_id + s += i.group_id.SIZE_IN_BYTES ; + s += GetTlvStringSize(i.name) ; + + return s; +} + +template<> bool RsTypeSerializer::deserialize(const uint8_t data[],uint32_t size,uint32_t& offset,TurtleGxsInfo& i) +{ + uint32_t saved_offset = offset ; + bool ok = true ; + + ok &= getRawUInt16(data, size, &offset, &i.service_id); // service_id + ok &= i.group_id.deserialise(data, size, offset); // group_id + ok &= GetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // group name + + if(!ok) + offset = saved_offset ; + + return ok; +} + +template<> bool RsTypeSerializer::serialize(uint8_t data[],uint32_t size,uint32_t& offset,const TurtleGxsInfo& i) +{ + uint32_t saved_offset = offset ; + bool ok = true ; + + ok &= setRawUInt16(data, size, &offset, i.service_id); // service_id + ok &= i.group_id.serialise(data, size, offset); // group_id + ok &= SetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // group name + + if(!ok) + offset = saved_offset ; + + return ok; +} + +template<> void RsTypeSerializer::print_data(const std::string& n, const TurtleGxsInfo& i) +{ + std::cerr << " [GXS Info ] " << n << " group_id=" << i.group_id << " service=" << std::hex << i.service_id << std::dec << ", name=" << i.name << std::endl; +} + void RsTurtleOpenTunnelItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process (j,ctx,file_hash ,"file_hash") ; diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 1eded28dd..1353a77c5 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -23,6 +23,7 @@ const uint8_t RS_TURTLE_SUBTYPE_FILE_REQUEST = 0x07 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_DATA = 0x08 ; const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ; const uint8_t RS_TURTLE_SUBTYPE_GENERIC_DATA = 0x0a ; +const uint8_t RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST = 0x0b ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP = 0x10 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST = 0x11 ; const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC = 0x14 ; @@ -32,6 +33,8 @@ const uint8_t RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT = 0x16 ; // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC = 0x12 ; // unused // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC_REQUEST = 0x13 ; +class TurtleSearchRequestInfo ; + /***********************************************************************************/ /* Basic Turtle Item Class */ /***********************************************************************************/ @@ -47,92 +50,81 @@ class RsTurtleItem: public RsItem /* Specific packets */ /***********************************************************************************/ -class RsTurtleSearchResultItem: public RsTurtleItem -{ - public: - RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} +// Class hierarchy is +// +// RsTurtleItem +// | +// +---- RsTurtleSearchRequestItem +// | | +// | +---- RsTurtleFileSearchRequestItem +// | | | +// | | +---- RsTurtleFileSearchRequestItem +// | | | +// | | +---- RsTurtleStringSearchRequestItem +// | | | +// | | +---- RsTurtleReqExpSearchRequestItem +// | | +// | +---- RsTurtleGxsSearchRequestItem +// | +// +---- RsTurtleSearchResultItem +// | +// +---- RsTurtleFTSearchResultItem +// | +// +---- RsTurtleGxsSearchResultItem +// - TurtleSearchRequestId request_id ; // Randomly generated request id. - - uint16_t depth ; // The depth of a search result is obfuscated in this way: - // If the actual depth is 1, this field will be 1. - // If the actual depth is > 1, this field is a larger arbitrary integer. - - virtual void clear() =0; - virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)=0; - protected: -}; - -class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem -{ - public: - RsTurtleFTSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT){} - - TurtleSearchRequestId request_id ; // Randomly generated request id. - - uint16_t depth ; // The depth of a search result is obfuscated in this way: - // If the actual depth is 1, this field will be 1. - // If the actual depth is > 1, this field is a larger arbitrary integer. - std::list result ; - - void clear() { result.clear() ; } - protected: - void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); -}; - -class RsTurtleGxsSearchResultItem: public RsTurtleSearchResultItem -{ - public: - RsTurtleGxsSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT){} - - TurtleSearchRequestId request_id ; // Randomly generated request id. - - uint16_t depth ; // The depth of a search result is obfuscated in this way: - // If the actual depth is 1, this field will be 1. - // If the actual depth is > 1, this field is a larger arbitrary integer. - std::list result ; - - void clear() { result.clear() ; } - protected: - void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); -}; +class RsTurtleSearchResultItem ; class RsTurtleSearchRequestItem: public RsTurtleItem { public: RsTurtleSearchRequestItem(uint32_t subtype) : RsTurtleItem(subtype), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_REQUEST) ;} + virtual ~RsTurtleSearchRequestItem() {} + virtual RsTurtleSearchRequestItem *clone() const = 0 ; // used for cloning in routing methods - virtual void performLocalSearch(std::list&) const = 0 ; // abstracts the search method - + virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const = 0 ; // abstracts the search method + virtual std::string GetKeywords() = 0; - + uint32_t request_id ; // randomly generated request id. uint16_t depth ; // Used for limiting search depth. }; -class RsTurtleStringSearchRequestItem: public RsTurtleSearchRequestItem +class RsTurtleFileSearchRequestItem: public RsTurtleSearchRequestItem { public: - RsTurtleStringSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST) {} - + RsTurtleFileSearchRequestItem(uint32_t subtype) : RsTurtleSearchRequestItem(subtype) {} + virtual ~RsTurtleFileSearchRequestItem() {} + + virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method + virtual void search(std::list &) const =0; +}; + +class RsTurtleStringSearchRequestItem: public RsTurtleFileSearchRequestItem +{ + public: + RsTurtleStringSearchRequestItem() : RsTurtleFileSearchRequestItem(RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST) {} + virtual ~RsTurtleStringSearchRequestItem() {} + std::string match_string ; // string to match - + std::string GetKeywords() { return match_string; } - + virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleStringSearchRequestItem(*this) ; } - virtual void performLocalSearch(std::list&) const ; void clear() { match_string.clear() ; } protected: + virtual void search(std::list &) const ; void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; -class RsTurtleRegExpSearchRequestItem: public RsTurtleSearchRequestItem +class RsTurtleRegExpSearchRequestItem: public RsTurtleFileSearchRequestItem { public: - RsTurtleRegExpSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST) {} + RsTurtleRegExpSearchRequestItem() : RsTurtleFileSearchRequestItem(RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST) {} + virtual ~RsTurtleRegExpSearchRequestItem() {} RsRegularExpression::LinearizedExpression expr ; // Reg Exp in linearised mode @@ -143,15 +135,84 @@ class RsTurtleRegExpSearchRequestItem: public RsTurtleSearchRequestItem delete ex; return exs; } - - virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleRegExpSearchRequestItem(*this) ; } - virtual void performLocalSearch(std::list&) const ; + virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleRegExpSearchRequestItem(*this) ; } void clear() { expr = RsRegularExpression::LinearizedExpression(); } + protected: + virtual void search(std::list &) const ; + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + +class RsTurtleGxsSearchRequestItem: public RsTurtleSearchRequestItem +{ + public: + RsTurtleGxsSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST) {} + virtual ~RsTurtleGxsSearchRequestItem() {} + + virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method + + std::string match_string ; // string to match + uint16_t service_id ; // searvice to search + + std::string GetKeywords() { return match_string; } + + virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleGxsSearchRequestItem(*this) ; } + + void clear() { match_string.clear() ; } + protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; +class RsTurtleSearchResultItem: public RsTurtleItem +{ + public: + RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} + + TurtleSearchRequestId request_id ; // Randomly generated request id. + uint16_t depth ; // The depth of a search result is obfuscated in this way: + // If the actual depth is 1, this field will be 1. + // If the actual depth is > 1, this field is a larger arbitrary integer. + + virtual void clear() =0; + virtual uint32_t count() const =0; + virtual void pop() =0; + + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)=0; + virtual RsTurtleSearchResultItem *duplicate() const =0; +}; + +class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem +{ + public: + RsTurtleFTSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT){} + + std::list result ; + + void clear() { result.clear() ; } + uint32_t count() const { return result.size() ; } + virtual void pop() { result.pop_back() ;} + virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleFTSearchResultItem(*this) ; } + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + +class RsTurtleGxsSearchResultItem: public RsTurtleSearchResultItem +{ + public: + RsTurtleGxsSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT){} + + std::list result ; + + void clear() { result.clear() ; } + uint32_t count() const { return result.size() ; } + virtual void pop() { result.pop_back() ;} + virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleGxsSearchResultItem(*this) ; } + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + + /***********************************************************************************/ /* Turtle Tunnel Item classes */ /***********************************************************************************/ @@ -200,24 +261,24 @@ class RsTurtleGenericTunnelItem: public RsTurtleItem /// Does this packet stamps tunnels when it passes through ? /// This is used for keeping trace weither tunnels are active or not. - + virtual bool shouldStampTunnel() const = 0 ; - /// All tunnels derived from RsTurtleGenericTunnelItem should have a tunnel id to + /// All tunnels derived from RsTurtleGenericTunnelItem should have a tunnel id to /// indicate which tunnel they are travelling through. - + virtual TurtleTunnelId tunnelId() const { return tunnel_id ; } /// Indicate weither the packet is a client packet (goign back to the /// client) or a server packet (going to the server. Typically file /// requests are server packets, whereas file data are client packets. - + virtual Direction travelingDirection() const { return direction ; } virtual void setTravelingDirection(Direction d) { direction = d; } Direction direction ; // This does not need to be serialised. It's only used by the client services, optionnally, // and is set by the turtle router according to which direction the item travels. - + uint32_t tunnel_id ; // Id of the tunnel to travel through }; diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index 3810fefc3..da8dac48d 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -563,6 +563,11 @@ void NotifyQt::notifyChatCleared(const ChatId& chat_id) emit chatCleared(chat_id); } +void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list& found_groups) +{ + std::cerr << "(EE) missing code to handle GXS turtle search result." << std::endl; +} + void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list& files) { { diff --git a/retroshare-gui/src/gui/notifyqt.h b/retroshare-gui/src/gui/notifyqt.h index b179d9999..597231703 100644 --- a/retroshare-gui/src/gui/notifyqt.h +++ b/retroshare-gui/src/gui/notifyqt.h @@ -47,6 +47,7 @@ class NotifyQt: public QObject, public NotifyClient virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string); virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo); virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list& found_files); + virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list& found_groups); virtual void notifyPeerHasNewAvatar(std::string peer_id) ; virtual void notifyOwnAvatarChanged() ; virtual void notifyChatLobbyEvent(uint64_t /* lobby id */, uint32_t /* event type */, const RsGxsId & /*nickname*/, const std::string& /* any string */) ; From b5c1b8210be58db6a4416599fccc9dcab54ca453 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 2 Jun 2018 18:12:27 +0200 Subject: [PATCH 067/213] added classes for both group data and group summary results in turtle search --- libretroshare/src/turtle/p3turtle.cc | 28 +++++++++--- libretroshare/src/turtle/rsturtleitem.cc | 24 +++++++++-- libretroshare/src/turtle/rsturtleitem.h | 54 +++++++++++++++++++++--- 3 files changed, 89 insertions(+), 17 deletions(-) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 11cb8017a..5208b32d8 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -158,7 +158,8 @@ void p3turtle::getItemNames(std::map& names) const names[RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST ] = "Filename substring search request"; names[RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST ] = "GXS search request"; names[RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT ] = "File search result"; - names[RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT ] = "GXS search result"; + names[RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY ] = "GXS group summary"; + names[RS_TURTLE_SUBTYPE_GXS_GROUP_DATA ] = "GXS group data"; names[RS_TURTLE_SUBTYPE_OPEN_TUNNEL ] = "Tunnel request"; names[RS_TURTLE_SUBTYPE_TUNNEL_OK ] = "Tunnel response"; names[RS_TURTLE_SUBTYPE_FILE_REQUEST ] = "Data request"; @@ -842,7 +843,8 @@ int p3turtle::handleIncoming() case RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST: handleSearchRequest(dynamic_cast(item)) ; break ; - case RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT : + case RS_TURTLE_SUBTYPE_GXS_GROUP_DATA : + case RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY : case RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT : handleSearchResult(dynamic_cast(item)) ; break ; @@ -1794,9 +1796,15 @@ void RsTurtleFileSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo & void RsTurtleGxsSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const { - std::cerr << "(EE) Missing code to perform actual GXS search" << std::endl; + std::cerr << "(EE) p3turtle: Missing code to perform actual GXS search" << std::endl; } +void RsTurtleGxsGroupRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const +{ + std::cerr << "(EE) p3turtle: Missing code to perform actual retrieval of GXS group" << std::endl; +} + + void RsTurtleStringSearchRequestItem::search(std::list& result) const { /* call to core */ @@ -1985,11 +1993,19 @@ void p3turtle::returnSearchResult(RsTurtleSearchResultItem *item) return ; } - RsTurtleGxsSearchResultItem *gxs_sr = dynamic_cast(item) ; + RsTurtleGxsSearchResultGroupSummaryItem *gxs_sr_gs = dynamic_cast(item) ; - if(gxs_sr != NULL) + if(gxs_sr_gs != NULL) { - RsServer::notify()->notifyTurtleSearchResult(gxs_sr->request_id,gxs_sr->result) ; + RsServer::notify()->notifyTurtleSearchResult(gxs_sr_gs->request_id,gxs_sr_gs->result) ; + return ; + } + RsTurtleGxsSearchResultGroupDataItem *gxs_sr_gd = dynamic_cast(item) ; + + if(gxs_sr_gd != NULL) + { +#warning MISSING CODE HERE TO HANDLE ENCRYPTED INCOMING GROUP DATA. + //RsServer::notify()->notifyTurtleSearchResult(gxs_sr_gd->request_id,gxs_sr_gd->encrypted_nxs_group) ; return ; } } diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index ca99b24d4..175996575 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -28,13 +28,16 @@ RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype) c { case RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST : return new RsTurtleStringSearchRequestItem(); case RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST : return new RsTurtleRegExpSearchRequestItem(); - case RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST : return new RsTurtleGxsSearchRequestItem(); case RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT : return new RsTurtleFTSearchResultItem(); - case RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT : return new RsTurtleGxsSearchResultItem(); case RS_TURTLE_SUBTYPE_OPEN_TUNNEL : return new RsTurtleOpenTunnelItem(); case RS_TURTLE_SUBTYPE_TUNNEL_OK : return new RsTurtleTunnelOkItem(); case RS_TURTLE_SUBTYPE_GENERIC_DATA : return new RsTurtleGenericDataItem(); + case RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST : return new RsTurtleGxsSearchRequestItem(); + case RS_TURTLE_SUBTYPE_GXS_GROUP_REQUEST : return new RsTurtleGxsGroupRequestItem(); + case RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY : return new RsTurtleGxsSearchResultGroupSummaryItem(); + case RS_TURTLE_SUBTYPE_GXS_GROUP_DATA : return new RsTurtleGxsSearchResultGroupDataItem(); + default: break ; } @@ -56,7 +59,6 @@ void RsTurtleStringSearchRequestItem::serial_process(RsGenericSerializer::Serial RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; } - void RsTurtleRegExpSearchRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; @@ -70,6 +72,14 @@ void RsTurtleGxsSearchRequestItem::serial_process(RsGenericSerializer::Serialize RsTypeSerializer::serial_process(j,ctx,service_id,"service_id") ; RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_VALUE,match_string,"match_string") ; } +void RsTurtleGxsGroupRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; + RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; + RsTypeSerializer::serial_process(j,ctx,service_id,"service_id") ; + RsTypeSerializer::serial_process(j,ctx,hashed_group_id,"hashed_group_id") ; +} + template<> uint32_t RsTypeSerializer::serial_size(const RsRegularExpression::LinearizedExpression& r) { uint32_t s = 0 ; @@ -154,12 +164,18 @@ void RsTurtleFTSearchResultItem::serial_process(RsGenericSerializer::SerializeJo RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; RsTypeSerializer::serial_process (j,ctx,result ,"result") ; } -void RsTurtleGxsSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +void RsTurtleGxsSearchResultGroupSummaryItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; RsTypeSerializer::serial_process (j,ctx,result ,"result") ; } +void RsTurtleGxsSearchResultGroupDataItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process (j,ctx,request_id,"request_id") ; + RsTypeSerializer::serial_process (j,ctx,depth ,"depth") ; + RsTypeSerializer::serial_process(j,ctx,encrypted_nxs_group,"encrypted_nxs_group") ; +} template<> uint32_t RsTypeSerializer::serial_size(const TurtleFileInfo& i) { uint32_t s = 0 ; diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 1353a77c5..885ab04de 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -24,11 +24,13 @@ const uint8_t RS_TURTLE_SUBTYPE_FILE_DATA = 0x08 ; const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ; const uint8_t RS_TURTLE_SUBTYPE_GENERIC_DATA = 0x0a ; const uint8_t RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST = 0x0b ; +const uint8_t RS_TURTLE_SUBTYPE_GXS_GROUP_REQUEST = 0x0c ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP = 0x10 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST = 0x11 ; const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC = 0x14 ; const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST = 0x15 ; -const uint8_t RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT = 0x16 ; +const uint8_t RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY = 0x16 ; +const uint8_t RS_TURTLE_SUBTYPE_GXS_GROUP_DATA = 0x17 ; // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC = 0x12 ; // unused // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC_REQUEST = 0x13 ; @@ -65,12 +67,18 @@ class RsTurtleItem: public RsItem // | | +---- RsTurtleReqExpSearchRequestItem // | | // | +---- RsTurtleGxsSearchRequestItem +// | | +// | +---- RsTurtleGxsGroupRequestItem // | // +---- RsTurtleSearchResultItem // | // +---- RsTurtleFTSearchResultItem // | // +---- RsTurtleGxsSearchResultItem +// | +// +---- RsTurtleGxsSearchResultGroupSummaryItem +// | +// +---- RsTurtleGxsSearchResultGroupDataItem // class RsTurtleSearchResultItem ; @@ -149,21 +157,38 @@ class RsTurtleGxsSearchRequestItem: public RsTurtleSearchRequestItem RsTurtleGxsSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST) {} virtual ~RsTurtleGxsSearchRequestItem() {} - virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method - std::string match_string ; // string to match uint16_t service_id ; // searvice to search std::string GetKeywords() { return match_string; } + virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleGxsSearchRequestItem(*this) ; } - void clear() { match_string.clear() ; } protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; +class RsTurtleGxsGroupRequestItem: public RsTurtleSearchRequestItem +{ + public: + RsTurtleGxsGroupRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GXS_GROUP_REQUEST) {} + virtual ~RsTurtleGxsGroupRequestItem() {} + + uint16_t service_id ; // searvice to search + Sha1CheckSum hashed_group_id ; // the group ID is hashed in order to keep it private. + + virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleGxsGroupRequestItem(*this) ; } + + virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method + void clear() { hashed_group_id.clear() ; } + std::string GetKeywords() { return hashed_group_id.toStdString(); } + + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + class RsTurtleSearchResultItem: public RsTurtleItem { public: @@ -197,21 +222,36 @@ class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; -class RsTurtleGxsSearchResultItem: public RsTurtleSearchResultItem +class RsTurtleGxsSearchResultGroupSummaryItem: public RsTurtleSearchResultItem { public: - RsTurtleGxsSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_RESULT){} + RsTurtleGxsSearchResultGroupSummaryItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY){} + virtual ~RsTurtleGxsSearchResultGroupSummaryItem() {} std::list result ; void clear() { result.clear() ; } uint32_t count() const { return result.size() ; } virtual void pop() { result.pop_back() ;} - virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleGxsSearchResultItem(*this) ; } + virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleGxsSearchResultGroupSummaryItem(*this) ; } protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; +class RsTurtleGxsSearchResultGroupDataItem: public RsTurtleSearchResultItem +{ + public: + RsTurtleGxsSearchResultGroupDataItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_GROUP_DATA){} + virtual ~RsTurtleGxsSearchResultGroupDataItem() {} + RsTlvBinaryData encrypted_nxs_group; // data is encrypted with group ID. + + uint32_t count() const { return 1 ; } + virtual void pop() { clear(); } + void clear() { encrypted_nxs_group.TlvClear() ; } + virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleGxsSearchResultGroupDataItem(*this) ; } + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; /***********************************************************************************/ /* Turtle Tunnel Item classes */ From 7caf06b57d69e834f234909d75ff8cef8d761b3b Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 6 Jun 2018 23:15:29 +0200 Subject: [PATCH 068/213] added structures for generic turtle search and access functions in Gxs objects --- libresapi/src/api/FileSearchHandler.cpp | 4 +- libretroshare/src/ft/ftserver.cc | 43 +++- libretroshare/src/ft/ftserver.h | 8 +- libretroshare/src/grouter/p3grouter.cc | 7 +- libretroshare/src/grouter/p3grouter.h | 2 +- libretroshare/src/gxs/rsgenexchange.cc | 8 + libretroshare/src/gxs/rsgenexchange.h | 9 + libretroshare/src/gxs/rsgxsnetservice.cc | 9 + libretroshare/src/gxs/rsgxsnetservice.h | 2 + libretroshare/src/gxs/rsgxsnettunnel.cc | 24 ++- libretroshare/src/gxs/rsgxsnettunnel.h | 22 +- libretroshare/src/gxs/rsnxs.h | 2 + libretroshare/src/gxstunnel/p3gxstunnel.cc | 4 +- libretroshare/src/gxstunnel/p3gxstunnel.h | 2 +- libretroshare/src/pqi/p3notify.cc | 3 +- libretroshare/src/pqi/p3notify.h | 3 +- libretroshare/src/retroshare/rsfiles.h | 3 + libretroshare/src/retroshare/rsgxschannels.h | 3 + libretroshare/src/retroshare/rsnotify.h | 3 +- libretroshare/src/retroshare/rsturtle.h | 11 +- libretroshare/src/rsitems/rsgxsitems.cc | 56 +++++ libretroshare/src/rsitems/rsgxsitems.h | 76 +++++++ libretroshare/src/services/p3gxschannels.cc | 7 + libretroshare/src/services/p3gxschannels.h | 3 + libretroshare/src/turtle/p3turtle.cc | 198 +++++++++++------- libretroshare/src/turtle/p3turtle.h | 19 +- libretroshare/src/turtle/rsturtleitem.cc | 94 +++------ libretroshare/src/turtle/rsturtleitem.h | 95 +++------ .../src/turtle/turtleclientservice.h | 47 ++++- .../src/gui/FileTransfer/SearchDialog.cpp | 6 +- retroshare-gui/src/gui/notifyqt.h | 2 + 31 files changed, 513 insertions(+), 262 deletions(-) diff --git a/libresapi/src/api/FileSearchHandler.cpp b/libresapi/src/api/FileSearchHandler.cpp index 0382005df..eb414fc9f 100644 --- a/libresapi/src/api/FileSearchHandler.cpp +++ b/libresapi/src/api/FileSearchHandler.cpp @@ -190,9 +190,9 @@ void FileSearchHandler::handleCreateSearch(Request &req, Response &resp) // i have no idea what the reasons for two different search modes are // rs-gui does it, so do we if(words.size() == 1) - search_id = mTurtle->turtleSearch(words.front()); + search_id = rsFiles->turtleSearch(words.front()); else - search_id = mTurtle->turtleSearch(lin_exp); + search_id = rsFiles->turtleSearch(lin_exp); } std::list results; diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 47718caaa..3172cfd89 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1317,7 +1317,7 @@ bool ftServer::encryptItem(RsTurtleGenericTunnelItem *clear_item,const RsFileHas // Decrypts the given item using aead-chacha20-poly1305 -bool ftServer::decryptItem(RsTurtleGenericDataItem *encrypted_item,const RsFileHash& hash,RsTurtleGenericTunnelItem *& decrypted_item) +bool ftServer::decryptItem(const RsTurtleGenericDataItem *encrypted_item,const RsFileHash& hash,RsTurtleGenericTunnelItem *& decrypted_item) { #ifndef USE_NEW_METHOD unsigned char *data = NULL ; @@ -1453,9 +1453,34 @@ bool ftServer::findRealHash(const RsFileHash& hash, RsFileHash& real_hash) return false ; } +TurtleSearchRequestId ftServer::turtleSearch(const std::string& string_to_match) +{ + return mTurtleRouter->turtleSearch(string_to_match) ; +} +TurtleSearchRequestId ftServer::turtleSearch(const RsRegularExpression::LinearizedExpression& expr) +{ + return mTurtleRouter->turtleSearch(expr) ; +} + +#warning we should do this here, but for now it's done by turtle router. +// // Dont delete the item. The client (p3turtle) is doing it after calling this. +// // +// void ftServer::receiveSearchResult(RsTurtleSearchResultItem *item) +// { +// RsTurtleFTSearchResultItem *ft_sr = dynamic_cast(item) ; +// +// if(ft_sr == NULL) +// { +// FTSERVER_ERROR() << "(EE) ftServer::receiveSearchResult(): item cannot be cast to a RsTurtleFTSearchResultItem" << std::endl; +// return ; +// } +// +// RsServer::notify()->notifyTurtleSearchResult(ft_sr->request_id,ft_sr->result) ; +// } + // Dont delete the item. The client (p3turtle) is doing it after calling this. // -void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, +void ftServer::receiveTurtleData(const RsTurtleGenericTunnelItem *i, const RsFileHash& hash, const RsPeerId& virtual_peer_id, RsTurtleGenericTunnelItem::Direction direction) @@ -1475,7 +1500,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, } RsTurtleGenericTunnelItem *decrypted_item ; - if(!decryptItem(dynamic_cast(i),real_hash,decrypted_item)) + if(!decryptItem(dynamic_cast(i),real_hash,decrypted_item)) { FTSERVER_ERROR() << "(EE) decryption error." << std::endl; return ; @@ -1491,7 +1516,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, { case RS_TURTLE_SUBTYPE_FILE_REQUEST: { - RsTurtleFileRequestItem *item = dynamic_cast(i) ; + const RsTurtleFileRequestItem *item = dynamic_cast(i) ; if (item) { #ifdef SERVER_DEBUG @@ -1504,7 +1529,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, case RS_TURTLE_SUBTYPE_FILE_DATA : { - RsTurtleFileDataItem *item = dynamic_cast(i) ; + const RsTurtleFileDataItem *item = dynamic_cast(i) ; if (item) { #ifdef SERVER_DEBUG @@ -1512,7 +1537,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, #endif getMultiplexer()->recvData(virtual_peer_id,hash,0,item->chunk_offset,item->chunk_size,item->chunk_data) ; - item->chunk_data = NULL ; // this prevents deletion in the destructor of RsFileDataItem, because data will be deleted + const_cast(item)->chunk_data = NULL ; // this prevents deletion in the destructor of RsFileDataItem, because data will be deleted // down _ft_server->getMultiplexer()->recvData()...in ftTransferModule::recvFileData } } @@ -1520,7 +1545,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, case RS_TURTLE_SUBTYPE_FILE_MAP : { - RsTurtleFileMapItem *item = dynamic_cast(i) ; + const RsTurtleFileMapItem *item = dynamic_cast(i) ; if (item) { #ifdef SERVER_DEBUG @@ -1543,7 +1568,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, case RS_TURTLE_SUBTYPE_CHUNK_CRC : { - RsTurtleChunkCrcItem *item = dynamic_cast(i) ; + const RsTurtleChunkCrcItem *item = dynamic_cast(i) ; if (item) { #ifdef SERVER_DEBUG @@ -1556,7 +1581,7 @@ void ftServer::receiveTurtleData(RsTurtleGenericTunnelItem *i, case RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST: { - RsTurtleChunkCrcRequestItem *item = dynamic_cast(i) ; + const RsTurtleChunkCrcRequestItem *item = dynamic_cast(i) ; if (item) { #ifdef SERVER_DEBUG diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 191b201b4..0833127cf 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -96,7 +96,8 @@ public: // Implements RsTurtleClientService // virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ; - virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; + virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; + //virtual void receiveSearchResult(RsTurtleSearchResultItem *item);// TODO virtual RsItem *create_item(uint16_t service,uint8_t item_type) const ; virtual RsServiceSerializer *serializer() { return this ; } @@ -143,6 +144,9 @@ public: virtual void setFilePermDirectDL(uint32_t perm) ; virtual uint32_t filePermDirectDL() ; + virtual TurtleSearchRequestId turtleSearch(const std::string& string_to_match) ; + virtual TurtleSearchRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) ; + /*** * Control of Downloads Priority. ***/ @@ -250,7 +254,7 @@ public: static void deriveEncryptionKey(const RsFileHash& hash, uint8_t *key); bool encryptItem(RsTurtleGenericTunnelItem *clear_item,const RsFileHash& hash,RsTurtleGenericDataItem *& encrypted_item); - bool decryptItem(RsTurtleGenericDataItem *encrypted_item, const RsFileHash& hash, RsTurtleGenericTunnelItem *&decrypted_item); + bool decryptItem(const RsTurtleGenericDataItem *encrypted_item, const RsFileHash& hash, RsTurtleGenericTunnelItem *&decrypted_item); /*************** Internal Transfer Fns *************************/ virtual int tick(); diff --git a/libretroshare/src/grouter/p3grouter.cc b/libretroshare/src/grouter/p3grouter.cc index 75e8fd4d6..656da0f9c 100644 --- a/libretroshare/src/grouter/p3grouter.cc +++ b/libretroshare/src/grouter/p3grouter.cc @@ -482,7 +482,7 @@ void p3GRouter::handleLowLevelTransactionAckItem(RsGRouterTransactionAcknItem *t #endif } -void p3GRouter::receiveTurtleData(RsTurtleGenericTunnelItem *gitem, const RsFileHash &/*hash*/, const RsPeerId &virtual_peer_id, RsTurtleGenericTunnelItem::Direction /*direction*/) +void p3GRouter::receiveTurtleData(const RsTurtleGenericTunnelItem *gitem, const RsFileHash &/*hash*/, const RsPeerId &virtual_peer_id, RsTurtleGenericTunnelItem::Direction /*direction*/) { #ifdef GROUTER_DEBUG std::cerr << "p3GRouter::receiveTurtleData() " << std::endl; @@ -496,7 +496,7 @@ void p3GRouter::receiveTurtleData(RsTurtleGenericTunnelItem *gitem, const RsFile // - possibly packs multi-item blocks back together // - converts it into a grouter generic item (by deserialising it) - RsTurtleGenericDataItem *item = dynamic_cast(gitem) ; + const RsTurtleGenericDataItem *item = dynamic_cast(gitem) ; if(item == NULL) { @@ -510,7 +510,8 @@ void p3GRouter::receiveTurtleData(RsTurtleGenericTunnelItem *gitem, const RsFile // Items come out of the pipe in order. We need to recover all chunks before we de-serialise the content and have it handled by handleIncoming() - RsItem *itm = RsGRouterSerialiser().deserialise(item->data_bytes,&item->data_size) ; + uint32_t size = item->data_size ; + RsItem *itm = RsGRouterSerialiser().deserialise(item->data_bytes,&size); if(itm == NULL) { diff --git a/libretroshare/src/grouter/p3grouter.h b/libretroshare/src/grouter/p3grouter.h index 71b2fc138..8a3a54000 100644 --- a/libretroshare/src/grouter/p3grouter.h +++ b/libretroshare/src/grouter/p3grouter.h @@ -209,7 +209,7 @@ protected: //===================================================// virtual bool handleTunnelRequest(const RsFileHash& /*hash*/,const RsPeerId& /*peer_id*/) ; - virtual void receiveTurtleData(RsTurtleGenericTunnelItem */*item*/,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/); + virtual void receiveTurtleData(const RsTurtleGenericTunnelItem */*item*/,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/); virtual void addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction dir) ; virtual void removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id) ; diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 11137f8b0..ba330e334 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -3384,3 +3384,11 @@ void RsGenExchange::removeDeleteExistingMessages( std::list& msgs, Gx } } +void RsGenExchange::turtleGroupRequest(const RsGxsGroupId& group_id) +{ + mNetService->turtleGroupRequest(group_id) ; +} +void RsGenExchange::turtleSearchRequest(const std::string& match_string) +{ + mNetService->turtleSearchRequest(match_string) ; +} diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 491ff017b..98b1d5d30 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -287,6 +287,15 @@ public: */ bool getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats); + /*! + * \brief turtleGroupRequest + * Issues a browadcast group request using the turtle router generic search system. The request is obviously asynchroneous and will be + * handled in RsGenExchange when received. + * \param group_id + */ + void turtleGroupRequest(const RsGxsGroupId& group_id); + void turtleSearchRequest(const std::string& match_string); + protected: bool messagePublicationTest(const RsGxsMsgMetaData&) ; diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 8a46fc89e..b0d1743d6 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5102,3 +5102,12 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid) return true; } + +void RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) +{ + mGxsNetTunnel->turtleGroupRequest(group_id) ; +} +void RsGxsNetService::turtleSearchRequest(const std::string& match_string) +{ + mGxsNetTunnel->turtleSearchRequest(match_string) ; +} diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index fe1c77010..aa8f8288c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -122,6 +122,8 @@ public: virtual void setDefaultKeepAge(uint32_t t) { mDefaultMsgStorePeriod = t ; } virtual void setDefaultSyncAge(uint32_t t) { mDefaultMsgSyncPeriod = t ; } + virtual void turtleGroupRequest(const RsGxsGroupId& group_id); + virtual void turtleSearchRequest(const std::string& match_string); /*! * pauses synchronisation of subscribed groups and request for group id * from peers diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index b81b6a7c0..964f15781 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -389,7 +389,7 @@ bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsP return mHandledHashes.find(hash) != mHandledHashes.end(); } -void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& turtle_virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) +void RsGxsNetTunnelService::receiveTurtleData(const RsTurtleGenericTunnelItem *item, const RsFileHash& hash, const RsPeerId& turtle_virtual_peer_id, RsTurtleGenericTunnelItem::Direction direction) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -424,7 +424,7 @@ void RsGxsNetTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *item,co generateEncryptionKey(group_id,turtle_virtual_peer_id,encryption_master_key); - if(!p3turtle::decryptItem(static_cast(item),encryption_master_key,data,data_size)) + if(!p3turtle::decryptItem(static_cast(item),encryption_master_key,data,data_size)) { GXS_NET_TUNNEL_ERROR() << "Cannot decrypt data!" << std::endl; @@ -852,3 +852,23 @@ RsSerialiser *RsGxsNetTunnelService::setupSerialiser() return ser ; } + +bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_len) +{ + std::cerr << __PRETTY_FUNCTION__ << ": received a request. Code needed to handle it" << std::endl; + return false ; +} +void RsGxsNetTunnelService::receiveSearchResult(unsigned char *search_result_data,uint32_t search_result_data_len) +{ + std::cerr << __PRETTY_FUNCTION__ << ": received a search result. Code needed to handle it" << std::endl; +} + +void RsGxsNetTunnelService::turtleGroupRequest(const RsGxsGroupId& group_id) +{ + std::cerr << __PRETTY_FUNCTION__ << ": handling of turtle group request not implemented yet" << std::endl; +} +void RsGxsNetTunnelService::turtleSearchRequest(const std::string& match_string) +{ + std::cerr << __PRETTY_FUNCTION__ << ": handling of turtle search request not implemented yet" << std::endl; +} + diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 46314da6f..f85b997f5 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -212,13 +212,23 @@ public: */ void dump() const; - // other methods are still missing. - // - derived from p3Config, to load/save data - // - method to respond to tunnel requests, probably using RsGxsNetService - // - method to encrypt/decrypt data and send/receive to/from turtle. - + /*! + * \brief connectToTurtleRouter + * Should be called after allocating a RsGxsNetTunnelService + * \param tr turtle router object + */ virtual void connectToTurtleRouter(p3turtle *tr) ; + void turtleGroupRequest(const RsGxsGroupId& group_id) ; + void turtleSearchRequest(const std::string& match_string) ; + + /*! + * \brief receiveSearchRequest + * See RsTurtleClientService::@ + */ + virtual bool receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_len); + virtual void receiveSearchResult(unsigned char *search_result_data,uint32_t search_result_data_len) ; + // Overloaded from RsTickingThread void data_tick() ; @@ -233,7 +243,7 @@ protected: // interaction with turtle router virtual bool handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) ; - virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; + virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ; void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ; const Bias20Bytes& locked_randomBias() ; diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index faec2577a..59d2bf209 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -81,6 +81,8 @@ public: virtual uint32_t getDefaultSyncAge() =0; virtual uint32_t getDefaultKeepAge() =0; + virtual void turtleGroupRequest(const RsGxsGroupId& group_id)=0; + virtual void turtleSearchRequest(const std::string& match_string)=0; /*! * Initiates a search through the network * This returns messages which contains the search terms set in RsGxsSearch diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index eef365230..a57eef36b 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -685,7 +685,7 @@ void p3GxsTunnelService::removeVirtualPeer(const TurtleFileHash& hash,const Turt } } -void p3GxsTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *gitem,const RsFileHash& hash, const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) +void p3GxsTunnelService::receiveTurtleData(const RsTurtleGenericTunnelItem *gitem, const RsFileHash& hash, const RsPeerId& virtual_peer_id, RsTurtleGenericTunnelItem::Direction direction) { #ifdef DEBUG_GXS_TUNNEL std::cerr << "GxsTunnelService::receiveTurtleData(): Received turtle data. " << std::endl; @@ -697,7 +697,7 @@ void p3GxsTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *gitem,cons (void) direction; #endif - RsTurtleGenericDataItem *item = dynamic_cast(gitem) ; + const RsTurtleGenericDataItem *item = dynamic_cast(gitem) ; if(item == NULL) { diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.h b/libretroshare/src/gxstunnel/p3gxstunnel.h index 32020e619..cff0fd126 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.h +++ b/libretroshare/src/gxstunnel/p3gxstunnel.h @@ -211,7 +211,7 @@ private: // Overloaded from RsTurtleClientService virtual bool handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) ; - virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; + virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ; void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ; diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index 2461d5f1c..5cc525dad 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -231,7 +231,8 @@ void p3Notify::notifyChatLobbyTimeShift (int time_shift) void p3Notify::notifyCustomState (const std::string& peer_id , const std::string& status_string ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyCustomState (peer_id,status_string) ; } void p3Notify::notifyHashingInfo (uint32_t type , const std::string& fileinfo ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHashingInfo (type,fileinfo) ; } void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,files) ; } -void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& groups ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,groups) ; } +#warning MISSING CODE HERE +//void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& groups ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,groups) ; } void p3Notify::notifyPeerHasNewAvatar (std::string peer_id ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerHasNewAvatar(peer_id) ; } void p3Notify::notifyOwnAvatarChanged () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnAvatarChanged() ; } void p3Notify::notifyOwnStatusMessageChanged() { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnStatusMessageChanged() ; } diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index 22e1f143d..30386c95a 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -106,7 +106,8 @@ class p3Notify: public RsNotify void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ; void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) ; void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) ; - void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) ; +#warning MISSING CODE HERE +// void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) ; void notifyPeerHasNewAvatar (std::string /* peer_id */) ; void notifyOwnAvatarChanged () ; void notifyOwnStatusMessageChanged () ; diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index d7efb2937..001328956 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -32,6 +32,7 @@ #include #include "rstypes.h" +#include "rsturtle.h" class RsFiles; extern RsFiles *rsFiles; @@ -213,6 +214,8 @@ class RsFiles virtual uint32_t getMaxUploadSlotsPerFriend()=0; virtual void setFilePermDirectDL(uint32_t perm)=0; virtual uint32_t filePermDirectDL()=0; + virtual TurtleRequestId turtleSearch(const std::string& string_to_match) =0; + virtual TurtleRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) =0; /*** * Control of Downloads Priority. diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index c75235f0e..175c7fc22 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -96,6 +96,9 @@ virtual bool getPostData(const uint32_t &token, std::vector &p //virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0; //virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0; + virtual void turtleGroupRequest(const RsGxsGroupId& group_id)=0; + virtual void turtleSearchRequest(const std::string& match_string)=0; + ////////////////////////////////////////////////////////////////////////////// virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index 6d9db3ef7..ee731a67a 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -228,7 +228,8 @@ class NotifyClient virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {} virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {} virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) {} - virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) {} +#warning MISSING CODE HERE + // virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) {} virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {} virtual void notifyOwnAvatarChanged () {} virtual void notifyOwnStatusMessageChanged () {} diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 0467b452d..1b3cb1b7e 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -54,13 +54,7 @@ struct TurtleFileInfo std::string name ; uint64_t size ; }; -struct TurtleGxsInfo -{ - RsGxsGroupId group_id ; - uint16_t service_id ; - std::string name ; - //RsTlvBinaryData meta ;// is that actually needed? Not sure. Better if it's not. -}; + struct TurtleTunnelRequestDisplayInfo { uint32_t request_id ; // Id of the request @@ -118,8 +112,7 @@ class RsTurtle // the request id, which will be further used by the gui to store results // as they come back. // - virtual TurtleRequestId turtleSearch(const std::string& match_string) = 0 ; - virtual TurtleRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) = 0 ; + virtual TurtleRequestId turtleSearch(unsigned char *search_bin_data,uint32_t search_bin_data_len,RsTurtleClientService *client_service) =0; // Initiates tunnel handling for the given file hash. tunnels. Launches // an exception if an error occurs during the initialization process. The diff --git a/libretroshare/src/rsitems/rsgxsitems.cc b/libretroshare/src/rsitems/rsgxsitems.cc index 9971514ec..141f22167 100644 --- a/libretroshare/src/rsitems/rsgxsitems.cc +++ b/libretroshare/src/rsitems/rsgxsitems.cc @@ -6,6 +6,8 @@ */ +#include "serialiser/rstypeserializer.h" +#include "serialiser/rsbaseserial.h" #include "rsgxsitems.h" #include "gxs/rsgxsdata.h" #include @@ -70,4 +72,58 @@ std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta) return out; } +template<> uint32_t RsTypeSerializer::serial_size(const TurtleGxsInfo& i) +{ + uint32_t s = 0 ; + s += 2 ; // service_id + s += i.group_id.SIZE_IN_BYTES ; + s += GetTlvStringSize(i.name) ; + + return s; +} + +template<> bool RsTypeSerializer::deserialize(const uint8_t data[],uint32_t size,uint32_t& offset,TurtleGxsInfo& i) +{ + uint32_t saved_offset = offset ; + bool ok = true ; + + ok &= getRawUInt16(data, size, &offset, &i.service_id); // service_id + ok &= i.group_id.deserialise(data, size, offset); // group_id + ok &= GetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // group name + + if(!ok) + offset = saved_offset ; + + return ok; +} + +template<> bool RsTypeSerializer::serialize(uint8_t data[],uint32_t size,uint32_t& offset,const TurtleGxsInfo& i) +{ + uint32_t saved_offset = offset ; + bool ok = true ; + + ok &= setRawUInt16(data, size, &offset, i.service_id); // service_id + ok &= i.group_id.serialise(data, size, offset); // group_id + ok &= SetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // group name + + if(!ok) + offset = saved_offset ; + + return ok; +} + +template<> void RsTypeSerializer::print_data(const std::string& n, const TurtleGxsInfo& i) +{ + std::cerr << " [GXS Info ] " << n << " group_id=" << i.group_id << " service=" << std::hex << i.service_id << std::dec << ", name=" << i.name << std::endl; +} + +void RsTurtleGxsSearchResultGroupSummaryItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,result,"result") ; +} +void RsTurtleGxsSearchResultGroupDataItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::TlvMemBlock_proxy prox(encrypted_nxs_group_data,encrypted_nxs_group_data_len) ; + RsTypeSerializer::serial_process(j,ctx,prox,"encrypted_nxs_data") ; +} diff --git a/libretroshare/src/rsitems/rsgxsitems.h b/libretroshare/src/rsitems/rsgxsitems.h index fa461a0e8..74f471533 100644 --- a/libretroshare/src/rsitems/rsgxsitems.h +++ b/libretroshare/src/rsitems/rsgxsitems.h @@ -57,6 +57,82 @@ public: RsMsgMetaData meta; }; +// We should make these items templates or generic classes so that each GXS service will handle them on its own. + +static const uint8_t RS_PKT_SUBTYPE_GXS_SUBSTRING_SEARCH_ITEM = 0x20 ; +static const uint8_t RS_PKT_SUBTYPE_GXS_GROUP_SEARCH_ITEM = 0x21 ; +static const uint8_t RS_PKT_SUBTYPE_GXS_GROUP_SUMMARY_ITEM = 0x22 ; +static const uint8_t RS_PKT_SUBTYPE_GXS_GROUP_DATA_ITEM = 0x23 ; + +class RsGxsTurtleSubStringSearchItem: public RsItem +{ + public: + RsGxsTurtleSubStringSearchItem(uint16_t service): RsItem(RS_PKT_VERSION_SERVICE,service,RS_PKT_SUBTYPE_GXS_SUBSTRING_SEARCH_ITEM) {} + virtual ~RsGxsTurtleSubStringSearchItem() {} + + std::string match_string ; // string to match + + std::string GetKeywords() { return match_string; } + void clear() { match_string.clear() ; } + + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + +class RsGxsTurtleGroupSearchItem: public RsItem +{ + public: + RsGxsTurtleGroupSearchItem(uint16_t service): RsItem(RS_PKT_VERSION_SERVICE,service,RS_PKT_SUBTYPE_GXS_GROUP_SEARCH_ITEM) {} + virtual ~RsGxsTurtleGroupSearchItem() {} + + uint16_t service_id ; // searvice to search + Sha1CheckSum hashed_group_id ; // the group ID is hashed in order to keep it private. + + std::string GetKeywords() { return std::string("Group request for [hashed] ")+hashed_group_id.toStdString() ; } + void clear() { hashed_group_id.clear() ; } + + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + +struct TurtleGxsInfo +{ + uint16_t service_id ; + RsGxsGroupId group_id ; + RsGxsId author; + std::string name ; + std::string description ; + time_t last_post ; + uint32_t number_of_posts ; +}; + +class RsTurtleGxsSearchResultGroupSummaryItem: public RsItem +{ + public: + RsTurtleGxsSearchResultGroupSummaryItem(uint16_t service) : RsItem(RS_PKT_VERSION_SERVICE,service,RS_PKT_SUBTYPE_GXS_GROUP_SUMMARY_ITEM){} + virtual ~RsTurtleGxsSearchResultGroupSummaryItem() {} + + std::list result ; + + void clear() { result.clear() ; } + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + +class RsTurtleGxsSearchResultGroupDataItem: public RsItem +{ + public: + RsTurtleGxsSearchResultGroupDataItem(uint16_t service) : RsItem(RS_PKT_VERSION_SERVICE,service,RS_PKT_SUBTYPE_GXS_GROUP_DATA_ITEM){} + virtual ~RsTurtleGxsSearchResultGroupDataItem() {} + + unsigned char *encrypted_nxs_group_data; // data is encrypted with group ID. Only the requester, or anyone who already know the group id can decrypt. + uint32_t encrypted_nxs_group_data_len ; + + void clear() { free(encrypted_nxs_group_data); encrypted_nxs_group_data=NULL; encrypted_nxs_group_data_len=0; } + protected: + void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); +}; + diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index d2578d470..7d36048de 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1695,3 +1695,10 @@ void p3GxsChannels::handle_event(uint32_t event_type, const std::string &elabel) } } +void p3GxsChannels::turtleGroupRequest(const RsGxsGroupId& group_id) +{ +} +void p3GxsChannels::turtleSearchRequest(const std::string& match_string) +{ +} + diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index 4eb5f5fba..c166dbc2f 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -72,6 +72,9 @@ virtual void service_tick(); virtual bool saveList(bool &cleanup, std::list&saveList); // @see p3Config::saveList(bool &cleanup, std::list&) virtual bool loadList(std::list& loadList); // @see p3Config::loadList(std::list&) + virtual void turtleGroupRequest(const RsGxsGroupId& group_id); + virtual void turtleSearchRequest(const std::string& match_string); + // Overloaded to cache new groups. virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet); diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 5208b32d8..9914d510c 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -156,10 +156,9 @@ void p3turtle::getItemNames(std::map& names) const names.clear(); names[RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST ] = "Filename substring search request"; - names[RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST ] = "GXS search request"; + names[RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST ] = "Generic search request"; names[RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT ] = "File search result"; - names[RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY ] = "GXS group summary"; - names[RS_TURTLE_SUBTYPE_GXS_GROUP_DATA ] = "GXS group data"; + names[RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT ] = "Generic search result"; names[RS_TURTLE_SUBTYPE_OPEN_TUNNEL ] = "Tunnel request"; names[RS_TURTLE_SUBTYPE_TUNNEL_OK ] = "Tunnel response"; names[RS_TURTLE_SUBTYPE_FILE_REQUEST ] = "Data request"; @@ -840,11 +839,11 @@ int p3turtle::handleIncoming() switch(item->PacketSubType()) { case RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST: + case RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST: case RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST: handleSearchRequest(dynamic_cast(item)) ; break ; - case RS_TURTLE_SUBTYPE_GXS_GROUP_DATA : - case RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY : + case RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT : case RS_TURTLE_SUBTYPE_FT_SEARCH_RESULT : handleSearchResult(dynamic_cast(item)) ; break ; @@ -1002,65 +1001,92 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) { - RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ - // Find who actually sent the corresponding request. - // - std::map::iterator it = _search_requests_origins.find(item->request_id) ; -#ifdef P3TURTLE_DEBUG - std::cerr << "Received search result:" << std::endl ; - item->print(std::cerr,0) ; -#endif - if(it == _search_requests_origins.end()) + std::list > results_to_notify_off_mutex ; + { - // This is an error: how could we receive a search result corresponding to a search item we - // have forwarded but that it not in the list ?? + RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ + // Find who actually sent the corresponding request. + // + std::map::iterator it = _search_requests_origins.find(item->request_id) ; - std::cerr << __PRETTY_FUNCTION__ << ": search result has no peer direction!" << std::endl ; - return ; - } - - // Is this result's target actually ours ? - - if(it->second.origin == _own_id) - { - it->second.result_count += item->count() ; - returnSearchResult(item) ; // Yes, so send upward. - } - else - { // Nope, so forward it back. #ifdef P3TURTLE_DEBUG - std::cerr << " Forwarding result back to " << it->second.origin << std::endl; + std::cerr << "Received search result:" << std::endl ; + item->print(std::cerr,0) ; #endif - // We update the total count forwarded back, and chop it to TURTLE_SEARCH_RESULT_MAX_HITS. - - uint32_t n = item->count(); // not so good! - - if(it->second.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + if(it == _search_requests_origins.end()) { - std::cerr << "(WW) exceeded turtle search result to forward. Req=" << std::hex << item->request_id << std::dec << ": dropping item with " << n << " elements." << std::endl; + // This is an error: how could we receive a search result corresponding to a search item we + // have forwarded but that it not in the list ?? + + std::cerr << __PRETTY_FUNCTION__ << ": search result has no peer direction!" << std::endl ; return ; } - if(it->second.result_count + n > TURTLE_SEARCH_RESULT_MAX_HITS) - { - for(uint32_t i=it->second.result_count + n; i>TURTLE_SEARCH_RESULT_MAX_HITS;--i) - item->pop() ; + // Is this result's target actually ours ? - it->second.result_count = TURTLE_SEARCH_RESULT_MAX_HITS ; + if(it->second.origin == _own_id) + { + it->second.result_count += item->count() ; + + results_to_notify_off_mutex.push_back(std::make_pair(item,it->second.client)) ; } else - it->second.result_count += n ; + { // Nope, so forward it back. +#ifdef P3TURTLE_DEBUG + std::cerr << " Forwarding result back to " << it->second.origin << std::endl; +#endif + // We update the total count forwarded back, and chop it to TURTLE_SEARCH_RESULT_MAX_HITS. - RsTurtleSearchResultItem *fwd_item = item->duplicate(); + uint32_t n = item->count(); // not so good! - // Normally here, we should setup the forward adress, so that the owner's - // of the files found can be further reached by a tunnel. + if(it->second.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + { + std::cerr << "(WW) exceeded turtle search result to forward. Req=" << std::hex << item->request_id << std::dec << ": dropping item with " << n << " elements." << std::endl; + return ; + } - fwd_item->PeerId(it->second.origin) ; - fwd_item->depth = 0 ; // obfuscate the depth for non immediate friends. Result will always be 0. This effectively removes the information. + if(it->second.result_count + n > TURTLE_SEARCH_RESULT_MAX_HITS) + { + for(uint32_t i=it->second.result_count + n; i>TURTLE_SEARCH_RESULT_MAX_HITS;--i) + item->pop() ; - sendItem(fwd_item) ; + it->second.result_count = TURTLE_SEARCH_RESULT_MAX_HITS ; + } + else + it->second.result_count += n ; + + RsTurtleSearchResultItem *fwd_item = item->duplicate(); + + // Normally here, we should setup the forward adress, so that the owner's + // of the files found can be further reached by a tunnel. + + fwd_item->PeerId(it->second.origin) ; + fwd_item->depth = 0 ; // obfuscate the depth for non immediate friends. Result will always be 0. This effectively removes the information. + + sendItem(fwd_item) ; + } } + + // now we notify clients off-mutex. + + for(auto it(results_to_notify_off_mutex.begin());it!=results_to_notify_off_mutex.end();++it) + { + // Hack to use the old search result handling in ftServer. Normally ftServer should use the new method with serialized result. + +#warning make sure memory is correctly deleted here + RsTurtleFTSearchResultItem *ftsr = dynamic_cast(it->first) ; + + if(ftsr!=NULL) + { + RsServer::notify()->notifyTurtleSearchResult(ftsr->request_id,ftsr->result) ; + continue ; + } + + RsTurtleGenericSearchResultItem *gnsr = dynamic_cast(it->first) ; + + if(gnsr!=NULL) + (*it).second->receiveSearchResult(gnsr->result_data,gnsr->result_data_len) ; + } } // -----------------------------------------------------------------------------------// @@ -1794,17 +1820,11 @@ void RsTurtleFileSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo & } } -void RsTurtleGxsSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const +void RsTurtleGenericSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const { std::cerr << "(EE) p3turtle: Missing code to perform actual GXS search" << std::endl; } -void RsTurtleGxsGroupRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const -{ - std::cerr << "(EE) p3turtle: Missing code to perform actual retrieval of GXS group" << std::endl; -} - - void RsTurtleStringSearchRequestItem::search(std::list& result) const { /* call to core */ @@ -1939,6 +1959,34 @@ TurtleRequestId p3turtle::turtleSearch(const RsRegularExpression::LinearizedExpr return id ; } +TurtleRequestId p3turtle::turtleSearch(unsigned char *search_bin_data,uint32_t search_bin_data_len,RsTurtleClientService *client_service) +{ + // generate a new search id. + + TurtleRequestId id = generateRandomRequestId() ; + + // Form a request packet that simulates a request from us. + // + RsTurtleGenericSearchRequestItem *item = new RsTurtleGenericSearchRequestItem ; + +#ifdef P3TURTLE_DEBUG + std::cerr << "performing search. OwnId = " << _own_id << std::endl ; +#endif + + item->PeerId(_own_id) ; + item->service_id = client_service->serviceId(); + item->search_data = search_bin_data ; + item->search_data_len = search_bin_data_len ; + item->request_id = id ; + item->depth = 0 ; + + // send it + + handleSearchRequest(item) ; + + return id ; +} + void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *client_service,bool allow_multi_tunnels) { { @@ -1979,36 +2027,26 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie IndicateConfigChanged() ; // initiates saving of handled hashes. } -void p3turtle::returnSearchResult(RsTurtleSearchResultItem *item) -{ #ifdef P3TURTLE_DEBUG std::cerr << " Returning result for search request " << HEX_PRINT(item->request_id) << " upwards." << std::endl ; #endif - RsTurtleFTSearchResultItem *ft_sr = dynamic_cast(item) ; - if(ft_sr != NULL) - { - RsServer::notify()->notifyTurtleSearchResult(ft_sr->request_id,ft_sr->result) ; - return ; - } - - RsTurtleGxsSearchResultGroupSummaryItem *gxs_sr_gs = dynamic_cast(item) ; - - if(gxs_sr_gs != NULL) - { - RsServer::notify()->notifyTurtleSearchResult(gxs_sr_gs->request_id,gxs_sr_gs->result) ; - return ; - } - RsTurtleGxsSearchResultGroupDataItem *gxs_sr_gd = dynamic_cast(item) ; - - if(gxs_sr_gd != NULL) - { -#warning MISSING CODE HERE TO HANDLE ENCRYPTED INCOMING GROUP DATA. - //RsServer::notify()->notifyTurtleSearchResult(gxs_sr_gd->request_id,gxs_sr_gd->encrypted_nxs_group) ; - return ; - } -} +// RsTurtleGxsSearchResultGroupSummaryItem *gxs_sr_gs = dynamic_cast(item) ; +// +// if(gxs_sr_gs != NULL) +// { +// RsServer::notify()->notifyTurtleSearchResult(gxs_sr_gs->request_id,gxs_sr_gs->result) ; +// return ; +// } +// RsTurtleGxsSearchResultGroupDataItem *gxs_sr_gd = dynamic_cast(item) ; +// +// if(gxs_sr_gd != NULL) +// { +//#warning MISSING CODE HERE TO HANDLE ENCRYPTED INCOMING GROUP DATA. +// //RsServer::notify()->notifyTurtleSearchResult(gxs_sr_gd->request_id,gxs_sr_gd->encrypted_nxs_group) ; +// return ; +// } /// Warning: this function should never be called while the turtle mutex is locked. /// Otherwize this is a possible source of cross-lock with the File mutex. diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index b3c4debe4..04d90c812 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -173,6 +173,7 @@ class TurtleSearchRequestInfo int depth ; // depth of the request. Used to optimize tunnel length. uint32_t result_count; // responses to this request. Useful to avoid spamming tunnel responses. std::string keywords; + RsTurtleClientService *client;// client who issues the request. This is null if the request does not have a local origin. }; class TurtleTunnelRequestInfo { @@ -244,11 +245,16 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config // the request id, which will be further used by the gui to store results // as they come back. // - // Eventually, search requests should be handled by client services. We will therefore - // remove the specific file search packets from the turtle router. - // - virtual TurtleSearchRequestId turtleSearch(const std::string& string_to_match) ; - virtual TurtleSearchRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) ; + // The first two methods are old style search requests for FT, while the 3rd one is using a generic search data type, that is only to + // be deserialized by the service. The memory ownership is kept by the calling function. Similarly, the search response will be a + // generic data type that is to be deserialized by the client service. + // + // Eventually, search requests will use the generic system + // even for FT. We need to keep the old method for a while for backward compatibility. + // + virtual TurtleRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) ; + virtual TurtleRequestId turtleSearch(const std::string& string_to_match) ; + virtual TurtleRequestId turtleSearch(unsigned char *search_bin_data,uint32_t search_bin_data_len,RsTurtleClientService *client_service) ; // Initiates tunnel handling for the given file hash. tunnels. Launches // an exception if an error occurs during the initialization process. The @@ -393,9 +399,6 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config /// Performs a search calling local cache and search structure. void performLocalSearch(const std::string& match_string,std::list& result) ; - /// Returns a search result upwards (possibly to the gui) - void returnSearchResult(RsTurtleSearchResultItem *item) ; - /// Returns true if the file with given hash is hosted locally, and accessible in anonymous mode the supplied peer. virtual bool performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& client_peer_id,RsTurtleClientService *& service); diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 175996575..ce3a4450a 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -32,11 +32,8 @@ RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype) c case RS_TURTLE_SUBTYPE_OPEN_TUNNEL : return new RsTurtleOpenTunnelItem(); case RS_TURTLE_SUBTYPE_TUNNEL_OK : return new RsTurtleTunnelOkItem(); case RS_TURTLE_SUBTYPE_GENERIC_DATA : return new RsTurtleGenericDataItem(); - - case RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST : return new RsTurtleGxsSearchRequestItem(); - case RS_TURTLE_SUBTYPE_GXS_GROUP_REQUEST : return new RsTurtleGxsGroupRequestItem(); - case RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY : return new RsTurtleGxsSearchResultGroupSummaryItem(); - case RS_TURTLE_SUBTYPE_GXS_GROUP_DATA : return new RsTurtleGxsSearchResultGroupDataItem(); + case RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST : return new RsTurtleGenericSearchRequestItem(); + case RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT : return new RsTurtleGenericSearchResultItem(); default: break ; @@ -65,21 +62,24 @@ void RsTurtleRegExpSearchRequestItem::serial_process(RsGenericSerializer::Serial RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; RsTypeSerializer::serial_process(j,ctx,expr,"expr") ; } -void RsTurtleGxsSearchRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +void RsTurtleGenericSearchRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; RsTypeSerializer::serial_process(j,ctx,service_id,"service_id") ; - RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_VALUE,match_string,"match_string") ; -} -void RsTurtleGxsGroupRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) -{ - RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; - RsTypeSerializer::serial_process(j,ctx,service_id,"service_id") ; - RsTypeSerializer::serial_process(j,ctx,hashed_group_id,"hashed_group_id") ; -} + RsTypeSerializer::TlvMemBlock_proxy prox(search_data,search_data_len) ; + RsTypeSerializer::serial_process(j,ctx,prox,"search_data") ; +} +RsTurtleSearchRequestItem *RsTurtleGenericSearchRequestItem::clone() const +{ + RsTurtleGenericSearchRequestItem *sr = new RsTurtleGenericSearchRequestItem ; + + sr->search_data = (unsigned char*)rs_malloc(search_data_len) ; + memcpy(sr->search_data,search_data,search_data_len) ; + sr->search_data_len = search_data_len ; + return sr ; +} template<> uint32_t RsTypeSerializer::serial_size(const RsRegularExpression::LinearizedExpression& r) { uint32_t s = 0 ; @@ -164,18 +164,24 @@ void RsTurtleFTSearchResultItem::serial_process(RsGenericSerializer::SerializeJo RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; RsTypeSerializer::serial_process (j,ctx,result ,"result") ; } -void RsTurtleGxsSearchResultGroupSummaryItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +void RsTurtleGenericSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; - RsTypeSerializer::serial_process (j,ctx,result ,"result") ; + + RsTypeSerializer::TlvMemBlock_proxy prox(result_data,result_data_len) ; + RsTypeSerializer::serial_process(j,ctx,prox,"search_data") ; } -void RsTurtleGxsSearchResultGroupDataItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +RsTurtleSearchResultItem *RsTurtleGenericSearchResultItem::duplicate() const { - RsTypeSerializer::serial_process (j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process (j,ctx,depth ,"depth") ; - RsTypeSerializer::serial_process(j,ctx,encrypted_nxs_group,"encrypted_nxs_group") ; + RsTurtleGenericSearchResultItem *sr = new RsTurtleGenericSearchResultItem ; + + sr->result_data = (unsigned char*)rs_malloc(result_data_len) ; + memcpy(sr->result_data,result_data,result_data_len) ; + sr->result_data_len = result_data_len ; + return sr ; } + template<> uint32_t RsTypeSerializer::serial_size(const TurtleFileInfo& i) { uint32_t s = 0 ; @@ -222,52 +228,6 @@ template<> void RsTypeSerializer::print_data(const std::string& n, const TurtleF std::cerr << " [FileInfo ] " << n << " size=" << i.size << " hash=" << i.hash << ", name=" << i.name << std::endl; } -template<> uint32_t RsTypeSerializer::serial_size(const TurtleGxsInfo& i) -{ - uint32_t s = 0 ; - - s += 2 ; // service_id - s += i.group_id.SIZE_IN_BYTES ; - s += GetTlvStringSize(i.name) ; - - return s; -} - -template<> bool RsTypeSerializer::deserialize(const uint8_t data[],uint32_t size,uint32_t& offset,TurtleGxsInfo& i) -{ - uint32_t saved_offset = offset ; - bool ok = true ; - - ok &= getRawUInt16(data, size, &offset, &i.service_id); // service_id - ok &= i.group_id.deserialise(data, size, offset); // group_id - ok &= GetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // group name - - if(!ok) - offset = saved_offset ; - - return ok; -} - -template<> bool RsTypeSerializer::serialize(uint8_t data[],uint32_t size,uint32_t& offset,const TurtleGxsInfo& i) -{ - uint32_t saved_offset = offset ; - bool ok = true ; - - ok &= setRawUInt16(data, size, &offset, i.service_id); // service_id - ok &= i.group_id.serialise(data, size, offset); // group_id - ok &= SetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // group name - - if(!ok) - offset = saved_offset ; - - return ok; -} - -template<> void RsTypeSerializer::print_data(const std::string& n, const TurtleGxsInfo& i) -{ - std::cerr << " [GXS Info ] " << n << " group_id=" << i.group_id << " service=" << std::hex << i.service_id << std::dec << ", name=" << i.name << std::endl; -} - void RsTurtleOpenTunnelItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process (j,ctx,file_hash ,"file_hash") ; diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 885ab04de..035490bc1 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -23,17 +23,15 @@ const uint8_t RS_TURTLE_SUBTYPE_FILE_REQUEST = 0x07 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_DATA = 0x08 ; const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ; const uint8_t RS_TURTLE_SUBTYPE_GENERIC_DATA = 0x0a ; -const uint8_t RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST = 0x0b ; -const uint8_t RS_TURTLE_SUBTYPE_GXS_GROUP_REQUEST = 0x0c ; +const uint8_t RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST = 0x0b ; +const uint8_t RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT = 0x0c ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP = 0x10 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST = 0x11 ; -const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC = 0x14 ; -const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST = 0x15 ; -const uint8_t RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY = 0x16 ; -const uint8_t RS_TURTLE_SUBTYPE_GXS_GROUP_DATA = 0x17 ; - // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC = 0x12 ; // unused // const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC_REQUEST = 0x13 ; +const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC = 0x14 ; +const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST = 0x15 ; + class TurtleSearchRequestInfo ; @@ -106,6 +104,8 @@ class RsTurtleFileSearchRequestItem: public RsTurtleSearchRequestItem virtual ~RsTurtleFileSearchRequestItem() {} virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method + + protected: virtual void search(std::list &) const =0; }; @@ -151,44 +151,29 @@ class RsTurtleRegExpSearchRequestItem: public RsTurtleFileSearchRequestItem void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; -class RsTurtleGxsSearchRequestItem: public RsTurtleSearchRequestItem +class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem { public: - RsTurtleGxsSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GXS_SEARCH_REQUEST) {} - virtual ~RsTurtleGxsSearchRequestItem() {} + RsTurtleGenericSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST) {} + virtual ~RsTurtleGenericSearchRequestItem() { clear(); } - std::string match_string ; // string to match - uint16_t service_id ; // searvice to search + uint16_t service_id ; // service to search + uint32_t search_data_len ; + unsigned char *search_data ; - std::string GetKeywords() { return match_string; } + std::string GetKeywords() { return std::string("Generic search " + RsUtil::BinToHex(search_data,search_data_len,10)); } - virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method - virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleGxsSearchRequestItem(*this) ; } - void clear() { match_string.clear() ; } + virtual RsTurtleSearchRequestItem *clone() const ; + void clear() { free(search_data); search_data=NULL; search_data_len=0; } + virtual void performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const; protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); + + private: + RsTurtleGenericSearchRequestItem(const RsTurtleGenericSearchRequestItem&): RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST) {} // make the object non copi-able. + RsTurtleGenericSearchRequestItem& operator=(const RsTurtleGenericSearchRequestItem&) { return *this;} }; - -class RsTurtleGxsGroupRequestItem: public RsTurtleSearchRequestItem -{ - public: - RsTurtleGxsGroupRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GXS_GROUP_REQUEST) {} - virtual ~RsTurtleGxsGroupRequestItem() {} - - uint16_t service_id ; // searvice to search - Sha1CheckSum hashed_group_id ; // the group ID is hashed in order to keep it private. - - virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleGxsGroupRequestItem(*this) ; } - - virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method - void clear() { hashed_group_id.clear() ; } - std::string GetKeywords() { return hashed_group_id.toStdString(); } - - protected: - void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); -}; - class RsTurtleSearchResultItem: public RsTurtleItem { public: @@ -199,7 +184,6 @@ class RsTurtleSearchResultItem: public RsTurtleItem // If the actual depth is 1, this field will be 1. // If the actual depth is > 1, this field is a larger arbitrary integer. - virtual void clear() =0; virtual uint32_t count() const =0; virtual void pop() =0; @@ -222,33 +206,20 @@ class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; -class RsTurtleGxsSearchResultGroupSummaryItem: public RsTurtleSearchResultItem +class RsTurtleGenericSearchResultItem: public RsTurtleSearchResultItem { public: - RsTurtleGxsSearchResultGroupSummaryItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_GROUP_SUMMARY){} - virtual ~RsTurtleGxsSearchResultGroupSummaryItem() {} + RsTurtleGenericSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT){} + virtual ~RsTurtleGenericSearchResultItem() {} - std::list result ; + uint32_t count() const { return result_data_len/50 ; } // This is a blind size estimate. We should probably use the actual size to limit search results. + virtual void pop() {} - void clear() { result.clear() ; } - uint32_t count() const { return result.size() ; } - virtual void pop() { result.pop_back() ;} - virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleGxsSearchResultGroupSummaryItem(*this) ; } - protected: - void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); -}; -class RsTurtleGxsSearchResultGroupDataItem: public RsTurtleSearchResultItem -{ - public: - RsTurtleGxsSearchResultGroupDataItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GXS_GROUP_DATA){} - virtual ~RsTurtleGxsSearchResultGroupDataItem() {} + unsigned char *result_data ; + uint32_t result_data_len ; - RsTlvBinaryData encrypted_nxs_group; // data is encrypted with group ID. - - uint32_t count() const { return 1 ; } - virtual void pop() { clear(); } - void clear() { encrypted_nxs_group.TlvClear() ; } - virtual RsTurtleSearchResultItem *duplicate() const { return new RsTurtleGxsSearchResultGroupDataItem(*this) ; } + virtual RsTurtleSearchResultItem *duplicate() const ; + void clear() { free(result_data); result_data=NULL; result_data_len=0; } protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; @@ -262,10 +233,10 @@ class RsTurtleOpenTunnelItem: public RsTurtleItem public: RsTurtleOpenTunnelItem() : RsTurtleItem(RS_TURTLE_SUBTYPE_OPEN_TUNNEL), request_id(0), partial_tunnel_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_OPEN_TUNNEL) ;} - TurtleFileHash file_hash ; // hash to match - uint32_t request_id ; // randomly generated request id. + TurtleFileHash file_hash ; // hash to match + uint32_t request_id ; // randomly generated request id. uint32_t partial_tunnel_id ; // uncomplete tunnel id. Will be completed at destination. - uint16_t depth ; // Used for limiting search depth. + uint16_t depth ; // Used for limiting search depth. void clear() { file_hash.clear() ;} protected: diff --git a/libretroshare/src/turtle/turtleclientservice.h b/libretroshare/src/turtle/turtleclientservice.h index 962e57cf0..277c8d5c3 100644 --- a/libretroshare/src/turtle/turtleclientservice.h +++ b/libretroshare/src/turtle/turtleclientservice.h @@ -42,6 +42,18 @@ class p3turtle ; class RsTurtleClientService { public: + /*! + * \brief serviceId + * Returns the ID of the client service. This is used to pass the ID to search requests, from the client services + * \return + * The service ID. + */ + + virtual uint16_t serviceId() const + { + std::cerr << "!!!!!! Received request for service ID in turtle router client, but the client service is not handling it !!!!!!!" << std::endl ; + return 0 ; + } /*! * \brief handleTunnelRequest @@ -52,7 +64,6 @@ class RsTurtleClientService */ virtual bool handleTunnelRequest(const RsFileHash& /*hash*/,const RsPeerId& /*peer_id*/) { return false ; } - /*! * \brief receiveTurtleData * This method is called by the turtle router to send data that comes out of a turtle tunnel, and should @@ -74,11 +85,43 @@ class RsTurtleClientService * By default (if not overloaded), the method will just free the data, as any subclass should do as well. * Note: p3turtle stays owner of the item, so the client should not delete it! */ - virtual void receiveTurtleData(RsTurtleGenericTunnelItem */*item*/,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/) + virtual void receiveTurtleData(const RsTurtleGenericTunnelItem * /* item */,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/) { std::cerr << "!!!!!! Received Data from turtle router, but the client service is not handling it !!!!!!!!!!" << std::endl ; } + /*! + * \brief receiveSearchRequest + * This method is called by the turtle router to notify the client of a search request in the form generic data. The returned + * result contains the serialised generic result returned by the client. + * + * The turtle router keeps the memory ownership over search_request_data + * + * \param search_request_data generic serialized search data + * \param search_request_data_len length of the serialized search data + * \param search_result_data generic serialized search result data + * \param search_result_data_len length of the serialized search result data + * + * \return true if the search is successful. + */ + virtual bool receiveSearchRequest(unsigned char */*search_request_data*/,uint32_t /*search_request_data_len*/,unsigned char *& /*search_result_data*/,uint32_t& /*search_result_data_len*/) + { + std::cerr << "!!!!!! Received search result from turtle router, but the client service who requested it is not handling it !!!!!!!!!!" << std::endl ; + return false; + } + + /*! + * \brief receiveSearchResult + * This method is called by the turtle router to notify the client of a search result. The result is serialized for the current class to read. + * + * \param search_result_data result data. Memory ownership is owned by the turtle router. So do not delete! + * \param search_result_data length of result data + */ + virtual void receiveSearchResult(unsigned char * /*search_result_data*/,uint32_t /*search_result_data_len*/) + { + std::cerr << "!!!!!! Received search result from turtle router, but the client service who requested it is not handling it !!!!!!!!!!" << std::endl ; + } + /*! * \brief serializer * Method for creating specific items of the client service. The diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index bc2f08644..f1c2e2fb6 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -792,7 +792,7 @@ void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression) RsRegularExpression::LinearizedExpression e ; expression->linearize(e) ; - TurtleRequestId req_id = rsTurtle->turtleSearch(e) ; + TurtleRequestId req_id = rsFiles->turtleSearch(e) ; // This will act before turtle results come to the interface, thanks to the signals scheduling policy. initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ; @@ -858,9 +858,9 @@ void SearchDialog::searchKeywords(const QString& keywords) if(ui._anonF2Fsearch_CB->isChecked()) { if(n==1) - req_id = rsTurtle->turtleSearch(words.front()) ; + req_id = rsFiles->turtleSearch(words.front()) ; else - req_id = rsTurtle->turtleSearch(lin_exp) ; + req_id = rsFiles->turtleSearch(lin_exp) ; } else req_id = RSRandom::random_u32() ; // generate a random 32 bits request id diff --git a/retroshare-gui/src/gui/notifyqt.h b/retroshare-gui/src/gui/notifyqt.h index 597231703..56ec5c42a 100644 --- a/retroshare-gui/src/gui/notifyqt.h +++ b/retroshare-gui/src/gui/notifyqt.h @@ -23,7 +23,9 @@ class MessengerWindow; class ToasterItem; class ToasterNotify; class SignatureEventData ; + struct TurtleFileInfo; +struct TurtleGxsInfo; class NotifyQt: public QObject, public NotifyClient { From 6fb459ce642cd04377ee3975560902b9d7f65577 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 10 Jun 2018 22:34:17 +0200 Subject: [PATCH 069/213] added logic for GXS search in RsGxsNetTunnel and Gxs client net service --- libretroshare/src/ft/ftserver.cc | 2 +- libretroshare/src/gxs/rsgxsnetservice.cc | 10 +- libretroshare/src/gxs/rsgxsnetservice.h | 8 + libretroshare/src/gxs/rsgxsnettunnel.cc | 230 ++++++++++++++++-- libretroshare/src/gxs/rsgxsnettunnel.h | 18 +- libretroshare/src/gxs/rsnxs.h | 24 ++ libretroshare/src/turtle/p3turtle.cc | 2 +- .../src/turtle/turtleclientservice.h | 2 +- 8 files changed, 273 insertions(+), 23 deletions(-) diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 3172cfd89..a454be33f 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1462,7 +1462,7 @@ TurtleSearchRequestId ftServer::turtleSearch(const RsRegularExpression::Lineariz return mTurtleRouter->turtleSearch(expr) ; } -#warning we should do this here, but for now it's done by turtle router. +#warning we should do this here, but for now it is done by turtle router. // // Dont delete the item. The client (p3turtle) is doing it after calling this. // // // void ftServer::receiveSearchResult(RsTurtleSearchResultItem *item) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index b0d1743d6..d83ceed54 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5105,9 +5105,15 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid) void RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) { - mGxsNetTunnel->turtleGroupRequest(group_id) ; + mGxsNetTunnel->turtleGroupRequest(group_id,this) ; } void RsGxsNetService::turtleSearchRequest(const std::string& match_string) { - mGxsNetTunnel->turtleSearchRequest(match_string) ; + mGxsNetTunnel->turtleSearchRequest(match_string,this) ; +} + +bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) +{ +#warning MISSING CODE HERE! + return true ; } diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index aa8f8288c..9643f49bf 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -122,8 +122,16 @@ public: virtual void setDefaultKeepAge(uint32_t t) { mDefaultMsgStorePeriod = t ; } virtual void setDefaultSyncAge(uint32_t t) { mDefaultMsgSyncPeriod = t ; } + /*! + * \brief Search methods. + * These four methods are used to request distant search and receive the results. + * \param group_id + */ virtual void turtleGroupRequest(const RsGxsGroupId& group_id); virtual void turtleSearchRequest(const std::string& match_string); + + virtual bool search(const std::string& substring,std::list& group_infos) ; + /*! * pauses synchronisation of subscribed groups and request for group id * from peers diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 964f15781..7cd657a55 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -27,6 +27,7 @@ #include "util/rstime.h" #include "retroshare/rspeers.h" #include "serialiser/rstypeserializer.h" +#include "gxs/rsnxs.h" #include "rsgxsnettunnel.h" #define DEBUG_RSGXSNETTUNNEL 1 @@ -52,9 +53,13 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") const uint16_t RS_SERVICE_TYPE_GXS_NET_TUNNEL = 0x2233 ; -const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER = 0x01 ; -const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE = 0x02 ; -const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS = 0x03 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER = 0x01 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE = 0x02 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS = 0x03 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_SUBSTRING = 0x04 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_REQUEST = 0x05 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY = 0x06 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_DATA = 0x07 ; class RsGxsNetTunnelItem: public RsItem { @@ -107,6 +112,57 @@ public: Bias20Bytes mRandomBias; // Cannot be a simple char[] because of serialization. }; +class RsGxsNetTunnelTurtleSearchSubstringItem: public RsGxsNetTunnelItem +{ +public: + explicit RsGxsNetTunnelTurtleSearchSubstringItem(): RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_SUBSTRING) {} + virtual ~RsGxsNetTunnelTurtleSearchSubstringItem() {} + + uint16_t service ; + std::string substring_match ; + + virtual void clear() { substring_match.clear() ; } + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) + { + RsTypeSerializer::serial_process(j,ctx,service,"service") ; + RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_KEY,substring_match,"substring_match") ; + } +}; + +class RsGxsNetTunnelTurtleSearchGroupRequestItem: public RsGxsNetTunnelItem +{ +public: + explicit RsGxsNetTunnelTurtleSearchGroupRequestItem(): RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_REQUEST) {} + virtual ~RsGxsNetTunnelTurtleSearchGroupRequestItem() {} + + uint16_t service ; + Sha1CheckSum hashed_group_id ; + + virtual void clear() { hashed_group_id.clear() ; } + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) + { + RsTypeSerializer::serial_process(j,ctx,service,"service") ; + RsTypeSerializer::serial_process(j,ctx,hashed_group_id,"hashed_group_id") ; + } +}; + +class RsGxsNetTunnelTurtleSearchGroupSummaryItem: public RsGxsNetTunnelItem +{ +public: + explicit RsGxsNetTunnelTurtleSearchGroupSummaryItem(): RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY) {} + virtual ~RsGxsNetTunnelTurtleSearchGroupSummaryItem() {} + + uint16_t service ; + std::list group_infos; + + virtual void clear() { group_infos.clear() ; } + + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) + { + RsTypeSerializer::serial_process(j,ctx,service,"service") ; + RsTypeSerializer::serial_process(j,ctx,group_infos,"group_infos") ; + } +}; class RsGxsNetTunnelSerializer: public RsServiceSerializer { public: @@ -132,10 +188,32 @@ public: } }; +template<> +void RsTypeSerializer::serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx, RsGxsGroupSummary& gs, const std::string& member_name ) +{ + RsTypeSerializer::serial_process(j,ctx,gs.group_id,member_name+"-group_id") ; // RsGxsGroupId group_id ; + RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME ,gs.group_name,member_name+"-group_name") ; // std::string group_name ; + RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_COMMENT,gs.group_description,member_name+"-group_description") ; // std::string group_description ; + RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_VALUE ,gs.search_context,member_name+"-group_name") ; // std::string search_context ; + RsTypeSerializer::serial_process(j,ctx,gs.author_id ,member_name+"-author_id") ; // RsGxsId author_id ; + RsTypeSerializer::serial_process(j,ctx,gs.publish_ts ,member_name+"-publish_ts") ; // time_t publish_ts ; + RsTypeSerializer::serial_process(j,ctx,gs.number_of_messages,member_name+"-number_of_messages") ; // uint32_t number_of_messages ; + RsTypeSerializer::serial_process(j,ctx,gs.last_message_ts,member_name+"-last_message_ts") ; // time_t last_message_ts ; +} + //===========================================================================================================================================// // Interface with rest of the software // //===========================================================================================================================================// +bool RsGxsNetTunnelService::registerSearchableService(RsNetworkExchangeService *gxs_service) +{ + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + mSearchableServices[gxs_service->serviceType()] = gxs_service ; + + return true; +} + class DataAutoDelete { public: @@ -853,22 +931,144 @@ RsSerialiser *RsGxsNetTunnelService::setupSerialiser() return ser ; } -bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_len) +//===========================================================================================================================================// +// Turtle Search system // +//===========================================================================================================================================// + +TurtleRequestId RsGxsNetTunnelService::turtleGroupRequest(const RsGxsGroupId& group_id,RsNetworkExchangeService *client_service) { - std::cerr << __PRETTY_FUNCTION__ << ": received a request. Code needed to handle it" << std::endl; + Sha1CheckSum hashed_group_id = RsDirUtil::sha1sum(group_id.toByteArray(),group_id.SIZE_IN_BYTES) ; + + GXS_NET_TUNNEL_DEBUG() << ": starting a turtle group request for grp \"" << group_id << "\" hashed to \"" << hashed_group_id << "\"" << std::endl; + + RsGxsNetTunnelTurtleSearchGroupRequestItem search_item ; + search_item.hashed_group_id = hashed_group_id ; + search_item.service = client_service->serviceType() ; + + uint32_t size = RsGxsNetTunnelSerializer().size(&search_item) ; + unsigned char *mem = (unsigned char*)rs_malloc(size) ; + + if(mem == NULL) + return 0 ; + + RsGxsNetTunnelSerializer().serialise(&search_item,mem,&size); + + return mTurtle->turtleSearch(mem,size,this) ; +} + +TurtleRequestId RsGxsNetTunnelService::turtleSearchRequest(const std::string& match_string,RsNetworkExchangeService *client_service) +{ + GXS_NET_TUNNEL_DEBUG() << ": starting a turtle search request for string\"" << match_string << "\"" << std::endl; + + RsGxsNetTunnelTurtleSearchSubstringItem search_item ; + search_item.substring_match = match_string ; + search_item.service = client_service->serviceType() ; + + uint32_t size = RsGxsNetTunnelSerializer().size(&search_item) ; + unsigned char *mem = (unsigned char*)rs_malloc(size) ; + + if(mem == NULL) + return 0 ; + + RsGxsNetTunnelSerializer().serialise(&search_item,mem,&size); + + return mTurtle->turtleSearch(mem,size,this) ; +} + +bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_size) +{ + GXS_NET_TUNNEL_DEBUG() << ": received a request." << std::endl; + + RsItem *item = RsGxsNetTunnelSerializer().deserialise(search_request_data,&search_request_data_len) ; + + RsGxsNetTunnelTurtleSearchSubstringItem *substring_sr = dynamic_cast(item) ; + + if(substring_sr != NULL) + { + auto it = mSearchableServices.find(substring_sr->service) ; + + std::list results ; + + if(it != mSearchableServices.end() && it->second->search(substring_sr->substring_match,results)) + { + RsGxsNetTunnelTurtleSearchGroupSummaryItem search_result_item ; + + search_result_item.service = substring_sr->service ; + search_result_item.group_infos = results ; + + search_result_data_size = RsGxsNetTunnelSerializer().size(&search_result_item) ; + search_result_data = (unsigned char*)rs_malloc(search_result_data_size) ; + + if(search_result_data == NULL) + return false ; + + RsGxsNetTunnelSerializer().serialise(&search_result_item,search_result_data,&search_result_data_size); + + return true ; + } + } + + RsGxsNetTunnelTurtleSearchGroupRequestItem *substring_gr = dynamic_cast(item) ; + + if(substring_gr != NULL) + { +#ifdef TODO + auto it = mSearchableGxsServices.find(substring_sr->service) ; + + RsNxsGrp *grp = NULL ; + + if(it != mSearchableGxsServices.end() && it->second.search(substring_sr->group_id,grp)) + { + RsGxsNetTunnelTurtleSearchGroupDataItem search_result_item ; + + search_result_item.service = substring_sr->service ; + search_result_item.group_infos = results ; + + search_result_data_size = RsGxsNetTunnelSerializer().size(&search_result_item) ; + search_result_data = (unsigned char*)rs_malloc(size) ; + + if(search_result_data == NULL) + return false ; + + RsGxsNetTunnelSerializer().serialise(&search_result_item,search_result_data,&search_result_data_size); + + return true ; + } +#endif + } + return false ; } -void RsGxsNetTunnelService::receiveSearchResult(unsigned char *search_result_data,uint32_t search_result_data_len) + +void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id,unsigned char *search_result_data,uint32_t search_result_data_len) { - std::cerr << __PRETTY_FUNCTION__ << ": received a search result. Code needed to handle it" << std::endl; + RsItem *item = RsGxsNetTunnelSerializer().deserialise(search_result_data,&search_result_data_len); + + RsGxsNetTunnelTurtleSearchGroupSummaryItem *result_gs = dynamic_cast(item) ; + + if(result_gs != NULL) + { + + } } -void RsGxsNetTunnelService::turtleGroupRequest(const RsGxsGroupId& group_id) -{ - std::cerr << __PRETTY_FUNCTION__ << ": handling of turtle group request not implemented yet" << std::endl; -} -void RsGxsNetTunnelService::turtleSearchRequest(const std::string& match_string) -{ - std::cerr << __PRETTY_FUNCTION__ << ": handling of turtle search request not implemented yet" << std::endl; -} + + + + + + + + + + + + + + + + + + + diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index f85b997f5..22917f35b 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -105,6 +105,7 @@ typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; class RsGxsNetTunnelItem ; +class RsNetworkExchangeService ; struct RsGxsNetTunnelVirtualPeerInfo { @@ -159,6 +160,15 @@ public: RsGxsNetTunnelService() ; virtual ~RsGxsNetTunnelService() ; + /*! + * \brief registerSearchableService + * Adds the network exchange service as a possible search source. This is used to allow distant search on the corresponding + * GXS service. + * \return + * always returns true. + */ + bool registerSearchableService(RsNetworkExchangeService *) ; + /*! * \brief Manage tunnels for this group * @param group_id group for which tunnels should be released @@ -219,15 +229,15 @@ public: */ virtual void connectToTurtleRouter(p3turtle *tr) ; - void turtleGroupRequest(const RsGxsGroupId& group_id) ; - void turtleSearchRequest(const std::string& match_string) ; + TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id, RsNetworkExchangeService *client_service) ; + TurtleRequestId turtleSearchRequest(const std::string& match_string,RsNetworkExchangeService *client_service) ; /*! * \brief receiveSearchRequest * See RsTurtleClientService::@ */ virtual bool receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_len); - virtual void receiveSearchResult(unsigned char *search_result_data,uint32_t search_result_data_len) ; + virtual void receiveSearchResult(TurtleSearchRequestId request_id,unsigned char *search_result_data,uint32_t search_result_data_len); // Overloaded from RsTickingThread @@ -270,6 +280,8 @@ private: std::map > > mIncomingData; // list of incoming data items + std::map mSearchableServices ; + /*! * \brief Generates the hash to request tunnels for this group. This hash is only used by turtle, and is used to * hide the real group id. diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 59d2bf209..5dfcde9d6 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -58,6 +58,26 @@ * 2 transfers only between group * - the also group matrix settings which is by default everyone can transfer to each other */ + +/*! + * \brief The RsGxsGroupSymmary struct + * This structure is used to transport group summary information when a GXS service is searched. It contains the group information + * as well as a context string to tell where the information was found. It is more compact than a GroupMeta object, so as to make + * search responses as light as possible. + */ +struct RsGxsGroupSummary +{ + RsGxsGroupId group_id ; + + std::string group_name ; + std::string group_description ; + std::string search_context ; + RsGxsId author_id ; + time_t publish_ts ; + uint32_t number_of_messages ; + time_t last_message_ts ; +}; + class RsNetworkExchangeService { public: @@ -65,6 +85,7 @@ public: RsNetworkExchangeService(){ return;} virtual ~RsNetworkExchangeService() {} + virtual uint16_t serviceType() const =0; /*! * Use this to set how far back synchronisation of messages should take place * @param age in seconds the max age a sync/store item can to be allowed in a synchronisation @@ -83,6 +104,9 @@ public: virtual void turtleGroupRequest(const RsGxsGroupId& group_id)=0; virtual void turtleSearchRequest(const std::string& match_string)=0; + + virtual bool search(const std::string& substring,std::list& group_infos) =0; + /*! * Initiates a search through the network * This returns messages which contains the search terms set in RsGxsSearch diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 9914d510c..1232b950c 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1085,7 +1085,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) RsTurtleGenericSearchResultItem *gnsr = dynamic_cast(it->first) ; if(gnsr!=NULL) - (*it).second->receiveSearchResult(gnsr->result_data,gnsr->result_data_len) ; + (*it).second->receiveSearchResult(gnsr->request_id,gnsr->result_data,gnsr->result_data_len) ; } } diff --git a/libretroshare/src/turtle/turtleclientservice.h b/libretroshare/src/turtle/turtleclientservice.h index 277c8d5c3..9bdd15ad4 100644 --- a/libretroshare/src/turtle/turtleclientservice.h +++ b/libretroshare/src/turtle/turtleclientservice.h @@ -117,7 +117,7 @@ class RsTurtleClientService * \param search_result_data result data. Memory ownership is owned by the turtle router. So do not delete! * \param search_result_data length of result data */ - virtual void receiveSearchResult(unsigned char * /*search_result_data*/,uint32_t /*search_result_data_len*/) + virtual void receiveSearchResult(TurtleSearchRequestId /* request_id */,unsigned char * /*search_result_data*/,uint32_t /*search_result_data_len*/) { std::cerr << "!!!!!! Received search result from turtle router, but the client service who requested it is not handling it !!!!!!!!!!" << std::endl ; } From be1e127a93e3a704c825b4c3a116d989c8c2ab35 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 11 Jun 2018 22:00:03 +0200 Subject: [PATCH 070/213] added test search functions in rsgxsnetservice --- libretroshare/src/gxs/rsgxsnetservice.cc | 32 ++++++++++++++++++++++-- libretroshare/src/gxs/rsgxsnettunnel.cc | 5 ++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index d83ceed54..8636bc6b0 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5112,8 +5112,36 @@ void RsGxsNetService::turtleSearchRequest(const std::string& match_string) mGxsNetTunnel->turtleSearchRequest(match_string,this) ; } +static bool termSearch(const std::string& src, const std::string& substring) +{ + /* always ignore case */ + return src.end() != std::search( src.begin(), src.end(), substring.begin(), substring.end(), RsRegularExpression::CompareCharIC() ); +} + bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) { -#warning MISSING CODE HERE! - return true ; + RsGxsGrpMetaTemporaryMap grpMetaMap; + mDataStore->retrieveGxsGrpMetaData(grpMetaMap); + + RsGroupNetworkStats stats ; + + for(auto it(grpMetaMap.begin());it!=grpMetaMap.end();++it) + if(termSearch(it->second->mGroupName,substring)) + { + getGroupNetworkStats(it->first,stats) ; + + RsGxsGroupSummary s ; + s.group_id = it->first ; + s.group_name = it->second->mGroupName ; + s.group_description = it->second->mGroupName ; // to be filled with something better when we use the real search + s.search_context = it->second->mGroupName ; + s.author_id = it->second->mAuthorId; + s.publish_ts = it->second->mPublishTs; + s.number_of_messages = stats.mMaxVisibleCount ; + s.last_message_ts = stats.mLastGroupModificationTS ; + + group_infos.push_back(s) ; + } + + return !group_infos.empty(); } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 7cd657a55..48382754b 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -1048,7 +1048,12 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id if(result_gs != NULL) { + std::cerr << "Received group summary result for search request " << std::hex << request_id << " for service " << result_gs->service << std::dec << ": " << std::endl; + for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) + std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; + +#warning MISSING CODE HERE - data should be passed up to UI in some way } } From 7a135c5c43750bc8ff279b3434d3dec910254d05 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 13 Jun 2018 22:46:27 +0200 Subject: [PATCH 071/213] added quick and dirty turtle search for channels in Files search tab --- libretroshare/src/gxs/rsgenexchange.h | 2 + libretroshare/src/gxs/rsgxsnetservice.cc | 8 +-- libretroshare/src/gxs/rsgxsnetservice.h | 4 +- libretroshare/src/gxs/rsgxsnettunnel.cc | 2 +- libretroshare/src/gxs/rsnxs.h | 5 +- libretroshare/src/retroshare/rsgxschannels.h | 5 +- libretroshare/src/services/p3gxschannels.cc | 6 +- libretroshare/src/services/p3gxschannels.h | 4 +- .../src/gui/FileTransfer/SearchDialog.cpp | 35 +++++++---- .../src/gui/FileTransfer/SearchDialog.ui | 59 +++++++++++++------ 10 files changed, 86 insertions(+), 44 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 98b1d5d30..1e51d8b04 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -764,6 +764,8 @@ protected: */ int createMessage(RsNxsMsg* msg); + RsNetworkExchangeService *netService() const { return mNetService ; } + private: /*! * convenience function to create sign diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 8636bc6b0..da94cb002 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5103,13 +5103,13 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid) return true; } -void RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) +TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) { - mGxsNetTunnel->turtleGroupRequest(group_id,this) ; + return mGxsNetTunnel->turtleGroupRequest(group_id,this) ; } -void RsGxsNetService::turtleSearchRequest(const std::string& match_string) +TurtleRequestId RsGxsNetService::turtleSearchRequest(const std::string& match_string) { - mGxsNetTunnel->turtleSearchRequest(match_string,this) ; + return mGxsNetTunnel->turtleSearchRequest(match_string,this) ; } static bool termSearch(const std::string& src, const std::string& substring) diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 9643f49bf..db2de16b8 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -127,8 +127,8 @@ public: * These four methods are used to request distant search and receive the results. * \param group_id */ - virtual void turtleGroupRequest(const RsGxsGroupId& group_id); - virtual void turtleSearchRequest(const std::string& match_string); + virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id); + virtual TurtleRequestId turtleSearchRequest(const std::string& match_string); virtual bool search(const std::string& substring,std::list& group_infos) ; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 48382754b..de67547d6 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -958,7 +958,7 @@ TurtleRequestId RsGxsNetTunnelService::turtleGroupRequest(const RsGxsGroupId& gr TurtleRequestId RsGxsNetTunnelService::turtleSearchRequest(const std::string& match_string,RsNetworkExchangeService *client_service) { - GXS_NET_TUNNEL_DEBUG() << ": starting a turtle search request for string\"" << match_string << "\"" << std::endl; + GXS_NET_TUNNEL_DEBUG() << ": starting a turtle search request for string \"" << match_string << "\"" << std::endl; RsGxsNetTunnelTurtleSearchSubstringItem search_item ; search_item.substring_match = match_string ; diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 5dfcde9d6..9d3673f1c 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -36,6 +36,7 @@ #include "services/p3service.h" #include "retroshare/rsreputations.h" #include "retroshare/rsidentity.h" +#include "retroshare/rsturtle.h" #include "rsgds.h" /*! @@ -102,8 +103,8 @@ public: virtual uint32_t getDefaultSyncAge() =0; virtual uint32_t getDefaultKeepAge() =0; - virtual void turtleGroupRequest(const RsGxsGroupId& group_id)=0; - virtual void turtleSearchRequest(const std::string& match_string)=0; + virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)=0; + virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; virtual bool search(const std::string& substring,std::list& group_infos) =0; diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index 175c7fc22..6bad3ba21 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -33,6 +33,7 @@ #include "retroshare/rstokenservice.h" #include "retroshare/rsgxsifacehelper.h" #include "retroshare/rsgxscommon.h" +#include "retroshare/rsturtle.h" @@ -96,8 +97,8 @@ virtual bool getPostData(const uint32_t &token, std::vector &p //virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0; //virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0; - virtual void turtleGroupRequest(const RsGxsGroupId& group_id)=0; - virtual void turtleSearchRequest(const std::string& match_string)=0; + virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)=0; + virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; ////////////////////////////////////////////////////////////////////////////// virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 7d36048de..493779a8c 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1695,10 +1695,12 @@ void p3GxsChannels::handle_event(uint32_t event_type, const std::string &elabel) } } -void p3GxsChannels::turtleGroupRequest(const RsGxsGroupId& group_id) +TurtleRequestId p3GxsChannels::turtleGroupRequest(const RsGxsGroupId& group_id) { + return netService()->turtleGroupRequest(group_id) ; } -void p3GxsChannels::turtleSearchRequest(const std::string& match_string) +TurtleRequestId p3GxsChannels::turtleSearchRequest(const std::string& match_string) { + return netService()->turtleSearchRequest(match_string) ; } diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index c166dbc2f..685439211 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -72,8 +72,8 @@ virtual void service_tick(); virtual bool saveList(bool &cleanup, std::list&saveList); // @see p3Config::saveList(bool &cleanup, std::list&) virtual bool loadList(std::list& loadList); // @see p3Config::loadList(std::list&) - virtual void turtleGroupRequest(const RsGxsGroupId& group_id); - virtual void turtleSearchRequest(const std::string& match_string); + virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id); + virtual TurtleRequestId turtleSearchRequest(const std::string& match_string); // Overloaded to cache new groups. virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet); diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index f1c2e2fb6..6e2bc4223 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -38,6 +38,7 @@ #include "gui/common/RSTreeWidgetItem.h" #include "util/QtVersion.h" +#include "retroshare/rsgxschannels.h" #include #include #include @@ -165,8 +166,10 @@ SearchDialog::SearchDialog(QWidget *parent) QHeaderView_setSectionResizeModeColumn(_smheader, SS_KEYWORDS_COL, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(_smheader, SS_RESULTS_COL, QHeaderView::Interactive); - _smheader->resizeSection ( SS_KEYWORDS_COL, 160 ); - _smheader->resizeSection ( SS_RESULTS_COL, 50 ); + float f = QFontMetricsF(font()).height()/14.0 ; + + _smheader->resizeSection ( SS_KEYWORDS_COL, 160*f ); + _smheader->resizeSection ( SS_RESULTS_COL, 50*f ); ui.searchResultWidget->setColumnCount(SR_COL_COUNT); _smheader = ui.searchResultWidget->header () ; @@ -174,12 +177,12 @@ SearchDialog::SearchDialog(QWidget *parent) QHeaderView_setSectionResizeModeColumn(_smheader, SR_SIZE_COL, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(_smheader, SR_SOURCES_COL, QHeaderView::Interactive); - _smheader->resizeSection ( SR_NAME_COL, 240 ); - _smheader->resizeSection ( SR_SIZE_COL, 75 ); - _smheader->resizeSection ( SR_SOURCES_COL, 75 ); - _smheader->resizeSection ( SR_TYPE_COL, 75 ); - _smheader->resizeSection ( SR_AGE_COL, 90 ); - _smheader->resizeSection ( SR_HASH_COL, 240 ); + _smheader->resizeSection ( SR_NAME_COL, 240*f ); + _smheader->resizeSection ( SR_SIZE_COL, 75*f ); + _smheader->resizeSection ( SR_SOURCES_COL, 75*f ); + _smheader->resizeSection ( SR_TYPE_COL, 75*f ); + _smheader->resizeSection ( SR_AGE_COL, 90*f ); + _smheader->resizeSection ( SR_HASH_COL, 240*f ); // set header text aligment QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem(); @@ -201,10 +204,11 @@ SearchDialog::SearchDialog(QWidget *parent) // load settings processSettings(true); - ui._ownFiles_CB->setMinimumWidth(20); - ui._friendListsearch_SB->setMinimumWidth(20); - ui._anonF2Fsearch_CB->setMinimumWidth(20); - ui.label->setMinimumWidth(20); + ui._channels_CB->setMinimumWidth(20 * f); + ui._ownFiles_CB->setMinimumWidth(20*f); + ui._friendListsearch_SB->setMinimumWidth(20*f); + ui._anonF2Fsearch_CB->setMinimumWidth(20*f); + ui.label->setMinimumWidth(20*f); // workaround for Qt bug, be solved in next Qt release 4.7.0 // https://bugreports.qt-project.org/browse/QTBUG-8270 @@ -862,6 +866,13 @@ void SearchDialog::searchKeywords(const QString& keywords) else req_id = rsFiles->turtleSearch(lin_exp) ; } + else if(ui._channels_CB->isChecked()) + { + if(n==1) + req_id = rsGxsChannels->turtleSearchRequest(words.front()) ; + else + QMessageBox::critical(this,"Cannot search multiple words yet.","Search for multiple words is not implemented yet.") ; + } else req_id = RSRandom::random_u32() ; // generate a random 32 bits request id diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui index 5411dd3c8..e6f6ded74 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui @@ -6,8 +6,8 @@ 0 0 - 758 - 339 + 1531 + 889 @@ -32,7 +32,16 @@ QFrame::Sunken - + + 2 + + + 2 + + + 2 + + 2 @@ -55,15 +64,24 @@ + + 0 + + + 0 + + + 0 + + + 0 + 0 1 - - 0 - @@ -99,6 +117,13 @@ + + + + Channels + + + @@ -307,7 +332,7 @@ Any - + :/images/FileTypeAny.png:/images/FileTypeAny.png @@ -316,7 +341,7 @@ Archive - + :/images/FileTypeArchive.png:/images/FileTypeArchive.png @@ -325,7 +350,7 @@ Audio - + :/images/FileTypeAudio.png:/images/FileTypeAudio.png @@ -334,7 +359,7 @@ CD-Image - + :/images/FileTypeCDImage.png:/images/FileTypeCDImage.png @@ -343,7 +368,7 @@ Document - + :/images/FileTypeDocument.png:/images/FileTypeDocument.png @@ -352,7 +377,7 @@ Picture - + :/images/FileTypePicture.png:/images/FileTypePicture.png @@ -361,7 +386,7 @@ Program - + :/images/FileTypeProgram.png:/images/FileTypeProgram.png @@ -370,7 +395,7 @@ Video - + :/images/FileTypeVideo.png:/images/FileTypeVideo.png @@ -379,7 +404,7 @@ Directory - + :/images/folder16.png:/images/folder16.png @@ -406,7 +431,7 @@ Download selected - + :/images/download16.png:/images/download16.png @@ -432,7 +457,7 @@ - + From 84194b6234c9156f03fb43b193a9aa4b94ef4a84 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 16 Jun 2018 22:39:35 +0200 Subject: [PATCH 072/213] sereral fixes to GXS distant search --- libretroshare/src/ft/ftserver.h | 2 + libretroshare/src/grouter/p3grouter.h | 1 + libretroshare/src/gxs/rsgxsnetservice.cc | 9 +- libretroshare/src/gxs/rsgxsnettunnel.cc | 30 +++- libretroshare/src/gxs/rsgxsnettunnel.h | 8 + libretroshare/src/gxstunnel/p3gxstunnel.h | 2 + libretroshare/src/rsserver/rsinit.cc | 5 + libretroshare/src/services/p3idservice.cc | 1 - libretroshare/src/turtle/p3turtle.cc | 176 +++++++++++++--------- libretroshare/src/turtle/p3turtle.h | 8 +- libretroshare/src/turtle/rsturtleitem.cc | 4 +- libretroshare/src/turtle/rsturtleitem.h | 33 ++-- 12 files changed, 172 insertions(+), 107 deletions(-) diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 0833127cf..cd0101933 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -95,6 +95,8 @@ public: // Implements RsTurtleClientService // + + uint16_t serviceId() const { return RS_SERVICE_TYPE_FILE_TRANSFER ; } virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ; virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; //virtual void receiveSearchResult(RsTurtleSearchResultItem *item);// TODO diff --git a/libretroshare/src/grouter/p3grouter.h b/libretroshare/src/grouter/p3grouter.h index 8a3a54000..a4bc280ff 100644 --- a/libretroshare/src/grouter/p3grouter.h +++ b/libretroshare/src/grouter/p3grouter.h @@ -208,6 +208,7 @@ protected: // Interaction with turtle router // //===================================================// + uint16_t serviceId() const { return RS_SERVICE_TYPE_GROUTER; } virtual bool handleTunnelRequest(const RsFileHash& /*hash*/,const RsPeerId& /*peer_id*/) ; virtual void receiveTurtleData(const RsTurtleGenericTunnelItem */*item*/,const RsFileHash& /*hash*/,const RsPeerId& /*virtual_peer_id*/,RsTurtleGenericTunnelItem::Direction /*direction*/); virtual void addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction dir) ; diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index da94cb002..3a5c9ecb2 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -272,12 +272,12 @@ NXS_NET_DEBUG_8 gxs distant sync ***/ -#define NXS_NET_DEBUG_0 1 -#define NXS_NET_DEBUG_1 1 +//#define NXS_NET_DEBUG_0 1 +//#define NXS_NET_DEBUG_1 1 //#define NXS_NET_DEBUG_2 1 //#define NXS_NET_DEBUG_3 1 //#define NXS_NET_DEBUG_4 1 -#define NXS_NET_DEBUG_5 1 +//#define NXS_NET_DEBUG_5 1 //#define NXS_NET_DEBUG_6 1 //#define NXS_NET_DEBUG_7 1 #define NXS_NET_DEBUG_8 1 @@ -5143,5 +5143,8 @@ bool RsGxsNetService::search(const std::string& substring,std::listturtleSearch(mem,size,this) ; } bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_size) { - GXS_NET_TUNNEL_DEBUG() << ": received a request." << std::endl; + GXS_NET_TUNNEL_DEBUG() << ": received a request." << std::endl; RsItem *item = RsGxsNetTunnelSerializer().deserialise(search_request_data,&search_request_data_len) ; @@ -985,14 +997,20 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d if(substring_sr != NULL) { - auto it = mSearchableServices.find(substring_sr->service) ; + GXS_NET_TUNNEL_DEBUG() << " : type is substring for service " << std::hex << (int)substring_sr->service << std::dec << std::endl; std::list results ; + RS_STACK_MUTEX(mGxsNetTunnelMtx); + + auto it = mSearchableServices.find(substring_sr->service) ; + if(it != mSearchableServices.end() && it->second->search(substring_sr->substring_match,results)) { RsGxsNetTunnelTurtleSearchGroupSummaryItem search_result_item ; + GXS_NET_TUNNEL_DEBUG() << " : " << results.size() << " result found. Sending back." << std::endl; + search_result_item.service = substring_sr->service ; search_result_item.group_infos = results ; @@ -1044,11 +1062,13 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id { RsItem *item = RsGxsNetTunnelSerializer().deserialise(search_result_data,&search_result_data_len); + GXS_NET_TUNNEL_DEBUG() << " : received search result for search request " << std::hex << request_id << "" << std::endl; + RsGxsNetTunnelTurtleSearchGroupSummaryItem *result_gs = dynamic_cast(item) ; if(result_gs != NULL) { - std::cerr << "Received group summary result for search request " << std::hex << request_id << " for service " << result_gs->service << std::dec << ": " << std::endl; + GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl; for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 22917f35b..ade780fe8 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -187,6 +187,14 @@ public: */ bool getVirtualPeers(std::list& peers) ; // returns the virtual peers for this service + /*! + * \brief serviceId + * Overloads the method in RsTurtleClientService. + * \return + * The service id for RsGxsNetTunnel. + */ + uint16_t serviceId() const ; + /*! * \brief sendData * send data to this virtual peer, and takes memory ownership (deletes the item) diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.h b/libretroshare/src/gxstunnel/p3gxstunnel.h index cff0fd126..a5a53b437 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.h +++ b/libretroshare/src/gxstunnel/p3gxstunnel.h @@ -127,6 +127,8 @@ public: explicit p3GxsTunnelService(RsGixs *pids) ; virtual void connectToTurtleRouter(p3turtle *) ; + uint16_t serviceId() const { return RS_SERVICE_TYPE_GXS_TUNNEL ; } + // Creates the invite if the public key of the distant peer is available. // Om success, stores the invite in the map above, so that we can respond to tunnel requests. // diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 7fd67fa27..34b68ef11 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1621,6 +1621,11 @@ int RsServer::StartupRetroShare() serviceCtrl->registerServiceMonitor(mBwCtrl, mBwCtrl->getServiceInfo().mServiceType); /**************************************************************************/ + // Turtle search for GXS services + + mGxsNetTunnel->registerSearchableService(gxschannels_ns) ; + + /**************************************************************************/ //mConfigMgr->addConfiguration("ftserver.cfg", ftserver); // diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 5618568fa..eff0f5cb5 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -47,7 +47,6 @@ #include #include -#define DEBUG_IDS 1 /**** * #define DEBUG_IDS 1 * #define DEBUG_RECOGN 1 diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 1232b950c..233703492 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -930,7 +930,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) #endif std::list search_results ; - item->performLocalSearch(req,search_results) ; + locked_performLocalSearch(item,req,search_results) ; for(auto it(search_results.begin());it!=search_results.end();++it) sendItem(*it) ; @@ -999,6 +999,97 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) #endif } +// This function should be removed in the future, when file search will also use generic search items. + +void p3turtle::locked_performLocalSearch(RsTurtleSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& search_results) +{ + RsTurtleFileSearchRequestItem *ftsearch = dynamic_cast(item) ; + + if(ftsearch != NULL) + { + locked_performLocalSearch_files(ftsearch,req,search_results) ; + return ; + } + + RsTurtleGenericSearchRequestItem *gnsearch = dynamic_cast(item) ; + + if(gnsearch != NULL) + { + locked_performLocalSearch_generic(gnsearch,req,search_results) ; + return ; + } +} + +void p3turtle::locked_performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) +{ + unsigned char *search_result_data = NULL ; + uint32_t search_result_data_len = 0 ; + + auto it = _registered_services.find(item->service_id) ; + + if(it == _registered_services.end()) + return ; + + if(it->second->receiveSearchRequest(item->search_data,item->search_data_len,search_result_data,search_result_data_len)) + { + RsTurtleGenericSearchResultItem *result_item = new RsTurtleGenericSearchResultItem ; + + result_item->result_data = search_result_data ; + result_item->result_data_len = search_result_data_len ; + + result.push_back(result_item) ; + } +} + +void p3turtle::locked_performLocalSearch_files(RsTurtleFileSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) +{ +#ifdef P3TURTLE_DEBUG + std::cerr << "Performing rsFiles->search()" << std::endl ; +#endif + // now, search! + std::list initialResults ; + item->search(initialResults) ; + +#ifdef P3TURTLE_DEBUG + std::cerr << initialResults.size() << " matches found." << std::endl ; +#endif + result.clear() ; + RsTurtleFTSearchResultItem *res_item = NULL ; + uint32_t item_size = 0 ; + + static const uint32_t RSTURTLE_MAX_SEARCH_RESPONSE_SIZE = 10000 ; + + for(auto it(initialResults.begin());it!=initialResults.end();++it) + { + if(res_item == NULL) + { + res_item = new RsTurtleFTSearchResultItem ; + item_size = 0 ; + + res_item->depth = 0 ; + res_item->request_id = item->request_id ; + res_item->PeerId(item->PeerId()) ; // send back to the same guy + + result.push_back(res_item) ; + } + res_item->result.push_back(*it); + + // Let's chop search results items into several chunks of finite size to avoid exceeding streamer's capacity. + // + ++req.result_count ; // increase hit number for this particular search request. + + item_size += 8 /* size */ + it->hash.serial_size() + it->name.size() ; + + if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + { +#ifdef P3TURTLE_DEBUG + std::cerr << " Sending back chunk of size " << item_size << ", for " << res_item->result.size() << " elements." << std::endl ; +#endif + res_item = NULL ; // forces creation of a new item. + } + } +} + void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) { std::list > results_to_notify_off_mutex ; @@ -1771,59 +1862,7 @@ void p3turtle::handleTunnelResult(RsTurtleTunnelOkItem *item) // ------------------------------ IO with libretroshare ----------------------------// // -----------------------------------------------------------------------------------// // -void RsTurtleFileSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const -{ -#ifdef P3TURTLE_DEBUG - std::cerr << "Performing rsFiles->search()" << std::endl ; -#endif - // now, search! - std::list initialResults ; - search(initialResults) ; -#ifdef P3TURTLE_DEBUG - std::cerr << initialResults.size() << " matches found." << std::endl ; -#endif - result.clear() ; - RsTurtleFTSearchResultItem *res_item = NULL ; - uint32_t item_size = 0 ; - - static const uint32_t RSTURTLE_MAX_SEARCH_RESPONSE_SIZE = 10000 ; - - for(auto it(initialResults.begin());it!=initialResults.end();++it) - { - if(res_item == NULL) - { - res_item = new RsTurtleFTSearchResultItem ; - item_size = 0 ; - - res_item->depth = 0 ; - res_item->request_id = request_id ; - res_item->PeerId(PeerId()) ; // send back to the same guy - - result.push_back(res_item) ; - } - res_item->result.push_back(*it); - - // Let's chop search results items into several chunks of finite size to avoid exceeding streamer's capacity. - // - ++req.result_count ; // increase hit number for this particular search request. - - item_size += 8 /* size */ + it->hash.serial_size() + it->name.size() ; - - if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) - { -#ifdef P3TURTLE_DEBUG - std::cerr << " Sending back chunk of size " << item_size << ", for " << res_item->result.size() << " elements." << std::endl ; -#endif - res_item = NULL ; // forces creation of a new item. - } - } -} - -void RsTurtleGenericSearchRequestItem::performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const -{ - std::cerr << "(EE) p3turtle: Missing code to perform actual GXS search" << std::endl; -} void RsTurtleStringSearchRequestItem::search(std::list& result) const { @@ -1967,22 +2006,22 @@ TurtleRequestId p3turtle::turtleSearch(unsigned char *search_bin_data,uint32_t s // Form a request packet that simulates a request from us. // - RsTurtleGenericSearchRequestItem *item = new RsTurtleGenericSearchRequestItem ; + RsTurtleGenericSearchRequestItem item ; #ifdef P3TURTLE_DEBUG std::cerr << "performing search. OwnId = " << _own_id << std::endl ; #endif - item->PeerId(_own_id) ; - item->service_id = client_service->serviceId(); - item->search_data = search_bin_data ; - item->search_data_len = search_bin_data_len ; - item->request_id = id ; - item->depth = 0 ; + item.PeerId(_own_id) ; + item.service_id = client_service->serviceId(); + item.search_data = search_bin_data ; + item.search_data_len = search_bin_data_len ; + item.request_id = id ; + item.depth = 0 ; // send it - handleSearchRequest(item) ; + handleSearchRequest(&item) ; return id ; } @@ -2056,10 +2095,10 @@ bool p3turtle::performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& if(_registered_services.empty()) std::cerr << "Turtle router has no services registered. Tunnel requests cannot be handled." << std::endl; - for(std::list::const_iterator it(_registered_services.begin());it!=_registered_services.end();++it) - if( (*it)->handleTunnelRequest(hash,peer_id)) + for(auto it(_registered_services.begin());it!=_registered_services.end();++it) + if( (*it).second->handleTunnelRequest(hash,peer_id)) { - service = *it ; + service = it->second ; return true ; } @@ -2069,14 +2108,9 @@ bool p3turtle::performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& void p3turtle::registerTunnelService(RsTurtleClientService *service) { -#ifdef P3TURTLE_DEBUG - for(std::list::const_iterator it(_registered_services.begin());it!=_registered_services.end();++it) - if(service == *it) - throw std::runtime_error("p3turtle::registerTunnelService(): Cannot register the same service twice. Please fix the code!") ; -#endif - std::cerr << "p3turtle: registered new tunnel service " << (void*)service << std::endl; + std::cerr << "p3turtle: registered new tunnel service with ID=" << std::hex << service->serviceId() << std::dec << " and pointer " << (void*)service << std::endl; - _registered_services.push_back(service) ; + _registered_services[service->serviceId()] = service ; _serialiser->registerClientService(service) ; } diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index 04d90c812..0c30653f3 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -397,7 +397,9 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config //------ Functions connecting the turtle router to other components.----------// /// Performs a search calling local cache and search structure. - void performLocalSearch(const std::string& match_string,std::list& result) ; + void locked_performLocalSearch (RsTurtleSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) ; + void locked_performLocalSearch_files (RsTurtleFileSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) ; + void locked_performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) ; /// Returns true if the file with given hash is hosted locally, and accessible in anonymous mode the supplied peer. virtual bool performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& client_peer_id,RsTurtleClientService *& service); @@ -419,7 +421,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config std::map _tunnel_requests_origins ; /// stores adequate tunnels for each file hash locally managed - std::map _incoming_file_hashes ; + std::map _incoming_file_hashes ; /// stores file info for each file we provide. std::map _outgoing_tunnel_client_services ; @@ -434,7 +436,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config std::set _hashes_to_remove ; /// List of client services that have regitered. - std::list _registered_services ; + std::map _registered_services ; time_t _last_clean_time ; time_t _last_tunnel_management_time ; diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index ce3a4450a..d600b4877 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -75,9 +75,11 @@ RsTurtleSearchRequestItem *RsTurtleGenericSearchRequestItem::clone() const { RsTurtleGenericSearchRequestItem *sr = new RsTurtleGenericSearchRequestItem ; + memcpy(sr,this,sizeof(RsTurtleGenericSearchRequestItem)) ; + sr->search_data = (unsigned char*)rs_malloc(search_data_len) ; memcpy(sr->search_data,search_data,search_data_len) ; - sr->search_data_len = search_data_len ; + return sr ; } template<> uint32_t RsTypeSerializer::serial_size(const RsRegularExpression::LinearizedExpression& r) diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 035490bc1..c5e3bc727 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -57,26 +57,18 @@ class RsTurtleItem: public RsItem // +---- RsTurtleSearchRequestItem // | | // | +---- RsTurtleFileSearchRequestItem -// | | | -// | | +---- RsTurtleFileSearchRequestItem -// | | | -// | | +---- RsTurtleStringSearchRequestItem -// | | | -// | | +---- RsTurtleReqExpSearchRequestItem +// | | | +// | | +---- RsTurtleStringSearchRequestItem +// | | | +// | | +---- RsTurtleReqExpSearchRequestItem // | | -// | +---- RsTurtleGxsSearchRequestItem -// | | -// | +---- RsTurtleGxsGroupRequestItem +// | +---- RsTurtleGenericSearchRequestItem // | // +---- RsTurtleSearchResultItem // | // +---- RsTurtleFTSearchResultItem // | -// +---- RsTurtleGxsSearchResultItem -// | -// +---- RsTurtleGxsSearchResultGroupSummaryItem -// | -// +---- RsTurtleGxsSearchResultGroupDataItem +// +---- RsTurtleGenericSearchResultItem // class RsTurtleSearchResultItem ; @@ -89,8 +81,6 @@ class RsTurtleSearchRequestItem: public RsTurtleItem virtual RsTurtleSearchRequestItem *clone() const = 0 ; // used for cloning in routing methods - virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const = 0 ; // abstracts the search method - virtual std::string GetKeywords() = 0; uint32_t request_id ; // randomly generated request id. @@ -103,9 +93,6 @@ class RsTurtleFileSearchRequestItem: public RsTurtleSearchRequestItem RsTurtleFileSearchRequestItem(uint32_t subtype) : RsTurtleSearchRequestItem(subtype) {} virtual ~RsTurtleFileSearchRequestItem() {} - virtual void performLocalSearch(TurtleSearchRequestInfo& req,std::list&) const ; // abstracts the search method - - protected: virtual void search(std::list &) const =0; }; @@ -115,8 +102,9 @@ class RsTurtleStringSearchRequestItem: public RsTurtleFileSearchRequestItem RsTurtleStringSearchRequestItem() : RsTurtleFileSearchRequestItem(RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST) {} virtual ~RsTurtleStringSearchRequestItem() {} - std::string match_string ; // string to match + virtual void search(std::list &) const ; + std::string match_string ; // string to match std::string GetKeywords() { return match_string; } virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleStringSearchRequestItem(*this) ; } @@ -124,7 +112,6 @@ class RsTurtleStringSearchRequestItem: public RsTurtleFileSearchRequestItem void clear() { match_string.clear() ; } protected: - virtual void search(std::list &) const ; void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; @@ -144,10 +131,11 @@ class RsTurtleRegExpSearchRequestItem: public RsTurtleFileSearchRequestItem return exs; } + virtual void search(std::list &) const ; + virtual RsTurtleSearchRequestItem *clone() const { return new RsTurtleRegExpSearchRequestItem(*this) ; } void clear() { expr = RsRegularExpression::LinearizedExpression(); } protected: - virtual void search(std::list &) const ; void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); }; @@ -166,7 +154,6 @@ class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem virtual RsTurtleSearchRequestItem *clone() const ; void clear() { free(search_data); search_data=NULL; search_data_len=0; } - virtual void performLocalSearch(TurtleSearchRequestInfo &req, std::list& result) const; protected: void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); From c67084b7dea39b4707f6ce2d9bd9a2608f9422d3 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 17 Jun 2018 21:23:16 +0200 Subject: [PATCH 073/213] fixed mutex problem in turtle-GXS search --- libretroshare/src/turtle/p3turtle.cc | 125 +++++++++++++++--------- libretroshare/src/turtle/p3turtle.h | 16 +-- libretroshare/src/turtle/rsturtleitem.h | 3 + 3 files changed, 89 insertions(+), 55 deletions(-) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 233703492..898491cf2 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -870,8 +870,6 @@ int p3turtle::handleIncoming() // void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) { - RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ - // take a look at the item and test against inconsistent values // - If the item destimation is @@ -891,26 +889,55 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) return ; } - if(_search_requests_origins.size() > MAX_ALLOWED_SR_IN_CACHE) { + RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ + + if(_search_requests_origins.size() > MAX_ALLOWED_SR_IN_CACHE) + { #ifdef P3TURTLE_DEBUG - std::cerr << " Dropping, because the search request cache is full." << std::endl ; + std::cerr << " Dropping, because the search request cache is full." << std::endl ; #endif - std::cerr << " More than " << MAX_ALLOWED_SR_IN_CACHE << " search request in cache. A peer is probably trying to flood your network See the depth charts to find him." << std::endl; - return ; + std::cerr << " More than " << MAX_ALLOWED_SR_IN_CACHE << " search request in cache. A peer is probably trying to flood your network See the depth charts to find him." << std::endl; + return ; + } + + // If the item contains an already handled search request, give up. This + // happens when the same search request gets relayed by different peers + // + if(_search_requests_origins.find(item->request_id) != _search_requests_origins.end()) + { +#ifdef P3TURTLE_DEBUG + std::cerr << " This is a bouncing request. Ignoring and deleting it." << std::endl ; +#endif + return ; + } } - // If the item contains an already handled search request, give up. This - // happens when the same search request gets relayed by different peers - // - if(_search_requests_origins.find(item->request_id) != _search_requests_origins.end()) + // Perform local search off-mutex,because this might call some services that are above turtle in the mutex chain. + + uint32_t search_result_count = 0; + + if(item->PeerId() != _own_id) // is the request not coming from us? { #ifdef P3TURTLE_DEBUG - std::cerr << " This is a bouncing request. Ignoring and deleting it." << std::endl ; + std::cerr << " Request not from us. Performing local search" << std::endl ; #endif - return ; + std::list search_results ; + + performLocalSearch(item,search_result_count,search_results) ; + + for(auto it(search_results.begin());it!=search_results.end();++it) + { + (*it)->request_id = item->request_id ; + (*it)->depth = 0 ; + (*it)->PeerId(item->PeerId()) ; + + sendItem(*it) ; + } } + RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ + // This is a new request. Let's add it to the request map, and forward it to // open peers. @@ -918,23 +945,9 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) req.origin = item->PeerId() ; req.time_stamp = time(NULL) ; req.depth = item->depth ; - req.result_count = 0; + req.result_count = search_result_count; req.keywords = item->GetKeywords() ; - - // If it's not for us, perform a local search. If something found, forward the search result back. - - if(item->PeerId() != _own_id) - { -#ifdef P3TURTLE_DEBUG - std::cerr << " Request not from us. Performing local search" << std::endl ; -#endif - std::list search_results ; - - locked_performLocalSearch(item,req,search_results) ; - - for(auto it(search_results.begin());it!=search_results.end();++it) - sendItem(*it) ; - } + req.service_id = item->serviceId() ; // if enough has been sent back already, do not sarch further @@ -1001,13 +1014,13 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) // This function should be removed in the future, when file search will also use generic search items. -void p3turtle::locked_performLocalSearch(RsTurtleSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& search_results) +void p3turtle::performLocalSearch(RsTurtleSearchRequestItem *item,uint32_t& req_result_count,std::list& search_results) { RsTurtleFileSearchRequestItem *ftsearch = dynamic_cast(item) ; if(ftsearch != NULL) { - locked_performLocalSearch_files(ftsearch,req,search_results) ; + performLocalSearch_files(ftsearch,req_result_count,search_results) ; return ; } @@ -1015,22 +1028,29 @@ void p3turtle::locked_performLocalSearch(RsTurtleSearchRequestItem *item,TurtleS if(gnsearch != NULL) { - locked_performLocalSearch_generic(gnsearch,req,search_results) ; + performLocalSearch_generic(gnsearch,req_result_count,search_results) ; return ; } } -void p3turtle::locked_performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) +void p3turtle::performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item, uint32_t& req_result_count, std::list& result) { unsigned char *search_result_data = NULL ; uint32_t search_result_data_len = 0 ; - auto it = _registered_services.find(item->service_id) ; + RsTurtleClientService *client = NULL ; - if(it == _registered_services.end()) - return ; + { + RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ + auto it = _registered_services.find(item->service_id) ; - if(it->second->receiveSearchRequest(item->search_data,item->search_data_len,search_result_data,search_result_data_len)) + if(it == _registered_services.end()) + return ; + + client = it->second ; + } + + if(client->receiveSearchRequest(item->search_data,item->search_data_len,search_result_data,search_result_data_len)) { RsTurtleGenericSearchResultItem *result_item = new RsTurtleGenericSearchResultItem ; @@ -1041,7 +1061,7 @@ void p3turtle::locked_performLocalSearch_generic(RsTurtleGenericSearchRequestIte } } -void p3turtle::locked_performLocalSearch_files(RsTurtleFileSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) +void p3turtle::performLocalSearch_files(RsTurtleFileSearchRequestItem *item,uint32_t& req_result_count,std::list& result) { #ifdef P3TURTLE_DEBUG std::cerr << "Performing rsFiles->search()" << std::endl ; @@ -1066,21 +1086,17 @@ void p3turtle::locked_performLocalSearch_files(RsTurtleFileSearchRequestItem *it res_item = new RsTurtleFTSearchResultItem ; item_size = 0 ; - res_item->depth = 0 ; - res_item->request_id = item->request_id ; - res_item->PeerId(item->PeerId()) ; // send back to the same guy - result.push_back(res_item) ; } res_item->result.push_back(*it); // Let's chop search results items into several chunks of finite size to avoid exceeding streamer's capacity. // - ++req.result_count ; // increase hit number for this particular search request. + ++req_result_count ; // increase hit number for this particular search request. item_size += 8 /* size */ + it->hash.serial_size() + it->name.size() ; - if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req_result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) { #ifdef P3TURTLE_DEBUG std::cerr << " Sending back chunk of size " << item_size << ", for " << res_item->result.size() << " elements." << std::endl ; @@ -1119,7 +1135,12 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) { it->second.result_count += item->count() ; - results_to_notify_off_mutex.push_back(std::make_pair(item,it->second.client)) ; + auto it2 = _registered_services.find(it->second.service_id) ; + + if(it2 != _registered_services.end()) + results_to_notify_off_mutex.push_back(std::make_pair(item,it2->second)) ; + else + std::cerr << "(EE) cannot find client service for ID " << std::hex << it->second.service_id << std::dec << ": search result item will be dropped." << std::endl; } else { // Nope, so forward it back. @@ -2092,10 +2113,20 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie // bool p3turtle::performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& peer_id,RsTurtleClientService *& service) { - if(_registered_services.empty()) - std::cerr << "Turtle router has no services registered. Tunnel requests cannot be handled." << std::endl; + std::map client_map ; + { + RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ - for(auto it(_registered_services.begin());it!=_registered_services.end();++it) + if(_registered_services.empty()) + { + std::cerr << "Turtle router has no services registered. Tunnel requests cannot be handled." << std::endl; + return false ; + } + + client_map = _registered_services ; + } + + for(auto it(client_map.begin());it!=client_map.end();++it) if( (*it).second->handleTunnelRequest(hash,peer_id)) { service = it->second ; diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index 0c30653f3..be34a56a7 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -169,11 +169,11 @@ class TurtleSearchRequestInfo { public: TurtlePeerId origin ; // where the request came from. - uint32_t time_stamp ; // last time the tunnel was actually used. Used for cleaning old tunnels. - int depth ; // depth of the request. Used to optimize tunnel length. - uint32_t result_count; // responses to this request. Useful to avoid spamming tunnel responses. - std::string keywords; - RsTurtleClientService *client;// client who issues the request. This is null if the request does not have a local origin. + uint32_t time_stamp ; // last time the tunnel was actually used. Used for cleaning old tunnels. + int depth ; // depth of the request. Used to optimize tunnel length. + uint32_t result_count; // responses to this request. Useful to avoid spamming tunnel responses. + std::string keywords; + uint16_t service_id; // ID of the client service who issues the request. This is null if the request does not have a local origin. }; class TurtleTunnelRequestInfo { @@ -397,9 +397,9 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config //------ Functions connecting the turtle router to other components.----------// /// Performs a search calling local cache and search structure. - void locked_performLocalSearch (RsTurtleSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) ; - void locked_performLocalSearch_files (RsTurtleFileSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) ; - void locked_performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item,TurtleSearchRequestInfo& req,std::list& result) ; + void performLocalSearch (RsTurtleSearchRequestItem *item, uint32_t& req_result_count,std::list& result) ; + void performLocalSearch_files (RsTurtleFileSearchRequestItem *item, uint32_t& req_result_count,std::list& result) ; + void performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item, uint32_t& req_result_count,std::list& result) ; /// Returns true if the file with given hash is hosted locally, and accessible in anonymous mode the supplied peer. virtual bool performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& client_peer_id,RsTurtleClientService *& service); diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index c5e3bc727..d35cbb8fd 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -82,6 +82,7 @@ class RsTurtleSearchRequestItem: public RsTurtleItem virtual RsTurtleSearchRequestItem *clone() const = 0 ; // used for cloning in routing methods virtual std::string GetKeywords() = 0; + virtual uint16_t serviceId() = 0 ; uint32_t request_id ; // randomly generated request id. uint16_t depth ; // Used for limiting search depth. @@ -93,6 +94,7 @@ class RsTurtleFileSearchRequestItem: public RsTurtleSearchRequestItem RsTurtleFileSearchRequestItem(uint32_t subtype) : RsTurtleSearchRequestItem(subtype) {} virtual ~RsTurtleFileSearchRequestItem() {} + virtual uint16_t serviceId() { return RS_SERVICE_TYPE_FILE_TRANSFER ; } virtual void search(std::list &) const =0; }; @@ -150,6 +152,7 @@ class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem unsigned char *search_data ; std::string GetKeywords() { return std::string("Generic search " + RsUtil::BinToHex(search_data,search_data_len,10)); } + virtual uint16_t serviceId() { return service_id ; } virtual RsTurtleSearchRequestItem *clone() const ; void clear() { free(search_data); search_data=NULL; search_data_len=0; } From 91fd38d46fbdbaa1c72a454941f4d229879391ac Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 20 Jun 2018 22:30:44 +0200 Subject: [PATCH 074/213] started GUI part for distant network search of groups --- .../src/gui/common/GroupTreeWidget.cpp | 13 +++++++++++++ .../src/gui/common/GroupTreeWidget.h | 2 ++ .../src/gui/common/GroupTreeWidget.ui | 3 +++ .../src/gui/gxs/GxsGroupFrameDialog.cpp | 18 ++++++++++++++++++ .../src/gui/gxs/GxsGroupFrameDialog.h | 5 +++++ .../src/gui/gxschannels/GxsChannelDialog.cpp | 7 +++++++ .../src/gui/gxschannels/GxsChannelDialog.h | 1 + 7 files changed, 49 insertions(+) diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index fc1cfae19..578d3844a 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ +#include + #include "GroupTreeWidget.h" #include "ui_GroupTreeWidget.h" @@ -119,6 +121,10 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) : ui->filterLineEdit->addFilter(QIcon(), tr("Description"), FILTER_DESC_INDEX , tr("Search Description")); ui->filterLineEdit->setCurrentFilter(FILTER_NAME_INDEX); + ui->distantSearchLineEdit->setPlaceholderText(tr("Search entire network...")) ; + + connect(ui->distantSearchLineEdit,SIGNAL(returnPressed()),this,SLOT(distantSearch())) ; + /* Initialize display button */ initDisplayMenu(ui->displayButton); @@ -749,6 +755,13 @@ void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem) } } +void GroupTreeWidget::distantSearch() +{ + emit distantSearchRequested(ui->distantSearchLineEdit->text()); + + ui->distantSearchLineEdit->clear(); +} + void GroupTreeWidget::sort() { resort(NULL); diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index d1a708258..e025f78e0 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -110,6 +110,7 @@ signals: void treeCustomContextMenuRequested(const QPoint &pos); void treeCurrentItemChanged(const QString &id); void treeItemActivated(const QString &id); + void distantSearchRequested(const QString&) ; protected: void changeEvent(QEvent *e); @@ -119,6 +120,7 @@ private slots: void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); void itemActivated(QTreeWidgetItem *item, int column); void filterChanged(); + void distantSearch(); void sort(); diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.ui b/retroshare-gui/src/gui/common/GroupTreeWidget.ui index c4d3948b1..7591c6a1c 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.ui +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.ui @@ -124,6 +124,9 @@ + + + diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index fe2ce45be..bce728e7a 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -94,6 +94,7 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p connect(ui->groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupTreeCustomPopupMenu(QPoint))); connect(ui->groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedGroup(QString))); connect(ui->groupTreeWidget->treeWidget(), SIGNAL(signalMouseMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(groupTreeMiddleButtonClicked(QTreeWidgetItem*))); + connect(ui->groupTreeWidget, SIGNAL(distantSearchRequested(const QString&)), this, SLOT(searchNetwork(const QString&))); connect(ui->messageTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(messageTabCloseRequested(int))); connect(ui->messageTabWidget, SIGNAL(currentChanged(int)), this, SLOT(messageTabChanged(int))); @@ -1078,3 +1079,20 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques } } } + +TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class +{ + std::cerr << "Searching for \"" << search_string.toStdString() << "\". Function is not implemented yet." << std::endl; + return 0; +} + +void GxsGroupFrameDialog::searchNetwork(const QString& search_string) +{ + uint32_t request_id = distantSearch(search_string); + + if(request_id == 0) + return ; + + mSearchGroups[request_id] = ui->groupTreeWidget->addCategoryItem(tr("Search for")+ " \"" + search_string + "\"", QIcon(icon(ICON_SEARCH)), true); +} + diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 2c0dca594..69058382b 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -67,6 +67,7 @@ public: ICON_SUBSCRIBED_GROUP, ICON_POPULAR_GROUP, ICON_OTHER_GROUP, + ICON_SEARCH, ICON_DEFAULT }; @@ -129,11 +130,13 @@ private slots: void sharePublishKey(); void loadComment(const RsGxsGroupId &grpId, const QVector& msg_versions,const RsGxsMessageId &most_recent_msgId, const QString &title); + void searchNetwork(const QString &search_string) ; private: virtual QString text(TextType type) = 0; virtual QString icon(IconType type) = 0; virtual QString settingsGroupName() = 0; + virtual TurtleRequestId distantSearch(const QString& search_string) ; virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue) = 0; virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0; @@ -201,6 +204,8 @@ private: Ui::GxsGroupFrameDialog *ui; std::list mCachedGroupMetas; + + std::map mSearchGroups ; }; #endif diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 4bff7528b..acd9dae0e 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -137,6 +137,8 @@ QString GxsChannelDialog::icon(IconType type) return ":/images/folder_green.png"; case ICON_OTHER_GROUP: return ":/images/folder_yellow.png"; + case ICON_SEARCH: + return ":/images/find.png"; case ICON_DEFAULT: return ":/images/channels.png"; } @@ -334,3 +336,8 @@ void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo groupItemInfo.icon = iconIt.value(); } } + +TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string) +{ + return rsGxsChannels->turtleSearchRequest(search_string.toStdString()) ; +} diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h index e1f3c75d0..3864fba13 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h @@ -51,6 +51,7 @@ protected: virtual QString getHelpString() const ; virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata); + virtual TurtleRequestId distantSearch(const QString& search_string) ; private slots: void toggleAutoDownload(); void setDefaultDirectory(); From c79ceba4eed727a72f9425706628ee97b8b8babb Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 20 Jun 2018 23:26:37 +0200 Subject: [PATCH 075/213] added remove buttons for ongoing search entries --- .../src/gui/common/GroupTreeWidget.cpp | 28 +++++++++++ .../src/gui/common/GroupTreeWidget.h | 6 +++ .../src/gui/gxs/GxsGroupFrameDialog.cpp | 49 +++++++++++++++++-- .../src/gui/gxs/GxsGroupFrameDialog.h | 3 ++ 4 files changed, 83 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 578d3844a..f5fd77daf 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -59,6 +59,8 @@ #define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 8 #define ROLE_COLOR Qt::UserRole + 9 #define ROLE_SAVED_ICON Qt::UserRole + 10 +#define ROLE_SEARCH_STRING Qt::UserRole + 11 +#define ROLE_REQUEST_ID Qt::UserRole + 12 #define FILTER_NAME_INDEX 0 #define FILTER_DESC_INDEX 1 @@ -397,6 +399,32 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc return item; } +void GroupTreeWidget::removeSearchItem(QTreeWidgetItem *item) +{ + ui->treeWidget->takeTopLevelItem(ui->treeWidget->indexOfTopLevelItem(item)) ; +} + +QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, uint32_t id, const QIcon& icon) +{ + QTreeWidgetItem *item = addCategoryItem(search_string,icon,true); + + item->setData(COLUMN_DATA,ROLE_SEARCH_STRING,search_string) ; + item->setData(COLUMN_DATA,ROLE_REQUEST_ID ,id) ; + + return item; +} + +bool GroupTreeWidget::isSearchRequestItem(QPoint &point,uint32_t& search_req_id) +{ + QTreeWidgetItem *item = ui->treeWidget->itemAt(point); + if (item == NULL) + return false; + + search_req_id = item->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt(); + + return search_req_id > 0; +} + QString GroupTreeWidget::itemId(QTreeWidgetItem *item) { if (item == NULL) { diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index e025f78e0..6b782cb7c 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -82,6 +82,10 @@ public: // Add a new category item QTreeWidgetItem *addCategoryItem(const QString &name, const QIcon &icon, bool expand); + // Add a new search item + QTreeWidgetItem *addSearchItem(const QString& search_string, uint32_t id, const QIcon &icon) ; + void removeSearchItem(QTreeWidgetItem *item); + // Get id of item QString itemId(QTreeWidgetItem *item); QString itemIdAt(QPoint &point); @@ -90,6 +94,8 @@ public: // Set the unread count of an item void setUnreadCount(QTreeWidgetItem *item, int unreadCount); + bool isSearchRequestItem(QPoint &point,uint32_t& search_req_id); + QTreeWidgetItem *getItemFromId(const QString &id); QTreeWidgetItem *activateId(const QString &id, bool focus); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index bce728e7a..d9c2c0bdd 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -46,6 +46,7 @@ #define IMAGE_EDIT ":/images/edit_16.png" #define IMAGE_SHARE ":/images/share-icon-16.png" #define IMAGE_TABNEW ":/images/tab-new.png" +#define IMAGE_DELETE ":/images/delete.png" #define IMAGE_COMMENT "" #define TOKEN_TYPE_GROUP_SUMMARY 1 @@ -252,16 +253,55 @@ void GxsGroupFrameDialog::todo() QMessageBox::information(this, "Todo", text(TEXT_TODO)); } +void GxsGroupFrameDialog::removeCurrentSearch() +{ + QAction *action = dynamic_cast(sender()) ; + + if(!action) + return ; + + TurtleRequestId search_request_id = action->data().toUInt(); + + auto it = mSearchGroups.find(search_request_id) ; + + if(it == mSearchGroups.end()) + return ; + + ui->groupTreeWidget->removeSearchItem(it->second) ; + mSearchGroups.erase(it); +} + +void GxsGroupFrameDialog::removeAllSearches() +{ + for(auto it(mSearchGroups.begin());it!=mSearchGroups.end();++it) + ui->groupTreeWidget->removeSearchItem(it->second) ; + + mSearchGroups.clear(); +} void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point) { + // First separately handle the case of search top level items + + TurtleRequestId search_request_id = 0 ; + + if(ui->groupTreeWidget->isSearchRequestItem(point,search_request_id)) + { + QMenu contextMnu(this); + + contextMnu.addAction(QIcon(IMAGE_DELETE), tr("Remove this search"), this, SLOT(removeCurrentSearch()))->setData(search_request_id); + contextMnu.addAction(QIcon(IMAGE_DELETE), tr("Remove all searches"), this, SLOT(removeAllSearches())); + contextMnu.exec(QCursor::pos()); + return ; + } + QString id = ui->groupTreeWidget->itemIdAt(point); if (id.isEmpty()) return; mGroupId = RsGxsGroupId(id.toStdString()); int subscribeFlags = ui->groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString())); - bool isAdmin = IS_GROUP_ADMIN(subscribeFlags); - bool isPublisher = IS_GROUP_PUBLISHER(subscribeFlags); + bool isAdmin = IS_GROUP_ADMIN(subscribeFlags); + bool isPublisher = IS_GROUP_PUBLISHER(subscribeFlags); bool isSubscribed = IS_GROUP_SUBSCRIBED(subscribeFlags); QMenu contextMnu(this); @@ -1088,11 +1128,14 @@ TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) void GxsGroupFrameDialog::searchNetwork(const QString& search_string) { + if(search_string.isNull()) + return ; + uint32_t request_id = distantSearch(search_string); if(request_id == 0) return ; - mSearchGroups[request_id] = ui->groupTreeWidget->addCategoryItem(tr("Search for")+ " \"" + search_string + "\"", QIcon(icon(ICON_SEARCH)), true); + mSearchGroups[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH))); } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 69058382b..4d56ca76e 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -130,7 +130,10 @@ private slots: void sharePublishKey(); void loadComment(const RsGxsGroupId &grpId, const QVector& msg_versions,const RsGxsMessageId &most_recent_msgId, const QString &title); + void searchNetwork(const QString &search_string) ; + void removeAllSearches(); + void removeCurrentSearch(); private: virtual QString text(TextType type) = 0; From 5cb48c27de3592ab8a95a577dad8b25805377867 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 21 Jun 2018 09:26:03 +0200 Subject: [PATCH 076/213] renamed a few constants of GXS notify system into more consistent values --- libretroshare/src/gxs/rsgenexchange.cc | 14 +++++++------- libretroshare/src/retroshare/rsgxsservice.h | 2 +- libretroshare/src/services/p3gxschannels.cc | 8 ++++---- libretroshare/src/services/p3gxscircles.cc | 4 ++-- libretroshare/src/services/p3gxsforums.cc | 6 +++--- libretroshare/src/services/p3postbase.cc | 4 ++-- retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp | 6 +++--- retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index ba330e334..735a09b99 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1643,7 +1643,7 @@ void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId) { RS_STACK_MUTEX(mGenMtx); - RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISHKEY, true); + RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY, true); gc->mGrpIdList.push_back(grpId); mNotifications.push_back(gc); } @@ -2314,7 +2314,7 @@ void RsGenExchange::publishMsgs() if(!msgChangeMap.empty()) { - RsGxsMsgChange* ch = new RsGxsMsgChange(RsGxsNotify::TYPE_PUBLISH, false); + RsGxsMsgChange* ch = new RsGxsMsgChange(RsGxsNotify::TYPE_PUBLISHED, false); ch->msgChangeMap = msgChangeMap; mNotifications.push_back(ch); } @@ -2451,7 +2451,7 @@ void RsGenExchange::processGroupDelete() if(!grpDeleted.empty()) { - RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH, false); + RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISHED, false); gc->mGrpIdList = grpDeleted; mNotifications.push_back(gc); } @@ -2760,7 +2760,7 @@ void RsGenExchange::publishGrps() if(!grpChanged.empty()) { - RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true); + RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVED_NEW, true); gc->mGrpIdList = grpChanged; mNotifications.push_back(gc); #ifdef GEN_EXCH_DEBUG @@ -3026,7 +3026,7 @@ void RsGenExchange::processRecvdMessages() #endif mDataStore->storeMessage(msgs_to_store); - RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVE, false); + RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVED_NEW, false); c->msgChangeMap = msgIds; mNotifications.push_back(c); } @@ -3159,7 +3159,7 @@ void RsGenExchange::processRecvdGroups() if(!grpIds.empty()) { - RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, false); + RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVED_NEW, false); c->mGrpIdList = grpIds; mNotifications.push_back(c); mDataStore->storeGroup(grps_to_store); @@ -3243,7 +3243,7 @@ void RsGenExchange::performUpdateValidation() } // notify the client - RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true); + RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVED_NEW, true); for(uint32_t i=0;i > GxsMsgRelatedMe struct RsGxsNotify { enum NotifyType - { TYPE_PUBLISH, TYPE_RECEIVE, TYPE_PROCESSED, TYPE_PUBLISHKEY }; + { TYPE_PUBLISHED, TYPE_RECEIVED_NEW, TYPE_PROCESSED, TYPE_RECEIVED_PUBLISHKEY }; virtual ~RsGxsNotify() {} virtual NotifyType getType() = 0; diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 493779a8c..a9c54b789 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -237,7 +237,7 @@ void p3GxsChannels::notifyChanges(std::vector &changes) RsGxsMsgChange *msgChange = dynamic_cast(*it); if (msgChange) { - if (msgChange->getType() == RsGxsNotify::TYPE_RECEIVE) + if (msgChange->getType() == RsGxsNotify::TYPE_RECEIVED_NEW) { /* message received */ if (notify) @@ -296,10 +296,10 @@ void p3GxsChannels::notifyChanges(std::vector &changes) switch (grpChange->getType()) { case RsGxsNotify::TYPE_PROCESSED: - case RsGxsNotify::TYPE_PUBLISH: + case RsGxsNotify::TYPE_PUBLISHED: break; - case RsGxsNotify::TYPE_RECEIVE: + case RsGxsNotify::TYPE_RECEIVED_NEW: { /* group received */ std::list &grpList = grpChange->mGrpIdList; @@ -317,7 +317,7 @@ void p3GxsChannels::notifyChanges(std::vector &changes) break; } - case RsGxsNotify::TYPE_PUBLISHKEY: + case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY: { /* group received */ std::list &grpList = grpChange->mGrpIdList; diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 5e27e378d..ac8e3a3a5 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -218,7 +218,7 @@ void p3GxsCircles::notifyChanges(std::vector &changes) std::cerr << " Msgs for Group: " << mit->first << std::endl; #endif force_cache_reload(RsGxsCircleId(mit->first)); - if (notify && (c->getType() == RsGxsNotify::TYPE_RECEIVE) ) + if (notify && (c->getType() == RsGxsNotify::TYPE_RECEIVED_NEW) ) for (std::vector::const_iterator msgIdIt(mit->second.begin()), end(mit->second.end()); msgIdIt != end; ++msgIdIt) { const RsGxsMessageId& msgId = *msgIdIt; @@ -261,7 +261,7 @@ void p3GxsCircles::notifyChanges(std::vector &changes) std::cerr << " forcing cache loading for circle " << *git << " in order to trigger subscribe update." << std::endl; #endif force_cache_reload(RsGxsCircleId(*git)) ; - if (notify && (c->getType() == RsGxsNotify::TYPE_RECEIVE) ) + if (notify && (c->getType() == RsGxsNotify::TYPE_RECEIVED_NEW) ) notify->AddFeedItem(RS_FEED_ITEM_CIRCLE_INVIT_REC,RsGxsCircleId(*git).toStdString(),""); } diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index dd98f88d1..69d33441e 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -197,10 +197,10 @@ void p3GxsForums::notifyChanges(std::vector &changes) switch (c->getType()) { case RsGxsNotify::TYPE_PROCESSED: - case RsGxsNotify::TYPE_PUBLISH: + case RsGxsNotify::TYPE_PUBLISHED: break; - case RsGxsNotify::TYPE_RECEIVE: + case RsGxsNotify::TYPE_RECEIVED_NEW: { RsGxsMsgChange *msgChange = dynamic_cast(c); if (msgChange) @@ -242,7 +242,7 @@ void p3GxsForums::notifyChanges(std::vector &changes) break; } - case RsGxsNotify::TYPE_PUBLISHKEY: + case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY: { RsGxsGroupChange *grpChange = dynamic_cast(*it); if (grpChange) diff --git a/libretroshare/src/services/p3postbase.cc b/libretroshare/src/services/p3postbase.cc index 0c37db1f1..5aaa6d88f 100644 --- a/libretroshare/src/services/p3postbase.cc +++ b/libretroshare/src/services/p3postbase.cc @@ -123,7 +123,7 @@ void p3PostBase::notifyChanges(std::vector &changes) // It could be taken a step further and directly request these msgs for an update. addGroupForProcessing(mit->first); - if (notify && msgChange->getType() == RsGxsNotify::TYPE_RECEIVE) + if (notify && msgChange->getType() == RsGxsNotify::TYPE_RECEIVED_NEW) { std::vector::iterator mit1; for (mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1) @@ -151,7 +151,7 @@ void p3PostBase::notifyChanges(std::vector &changes) std::cerr << std::endl; #endif - if (notify && groupChange->getType() == RsGxsNotify::TYPE_RECEIVE) + if (notify && groupChange->getType() == RsGxsNotify::TYPE_RECEIVED_NEW) { notify->AddFeedItem(RS_FEED_ITEM_POSTED_NEW, git->toStdString()); } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index d9c2c0bdd..e143278d1 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -93,7 +93,7 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p mStateHelper->addWidget(TOKEN_TYPE_GROUP_SUMMARY, ui->loadingLabel, UISTATE_LOADING_VISIBLE); connect(ui->groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupTreeCustomPopupMenu(QPoint))); - connect(ui->groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedGroup(QString))); + connect(ui->groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedCurrentGroup(QString))); connect(ui->groupTreeWidget->treeWidget(), SIGNAL(signalMouseMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(groupTreeMiddleButtonClicked(QTreeWidgetItem*))); connect(ui->groupTreeWidget, SIGNAL(distantSearchRequested(const QString&)), this, SLOT(searchNetwork(const QString&))); connect(ui->messageTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(messageTabCloseRequested(int))); @@ -630,7 +630,7 @@ bool GxsGroupFrameDialog::navigate(const RsGxsGroupId &groupId, const RsGxsMessa return false; } - changedGroup(groupIdString); + changedCurrentGroup(groupIdString); /* search exisiting tab */ GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, false); @@ -691,7 +691,7 @@ GxsCommentDialog *GxsGroupFrameDialog::commentWidget(const RsGxsMessageId& msgId return NULL; } -void GxsGroupFrameDialog::changedGroup(const QString &groupId) +void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId) { if (mInFill) { return; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 4d56ca76e..3e5091857 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -108,7 +108,7 @@ private slots: void restoreGroupKeys(); void newGroup(); - void changedGroup(const QString &groupId); + void changedCurrentGroup(const QString &groupId); void groupTreeMiddleButtonClicked(QTreeWidgetItem *item); void openInNewTab(); void messageTabCloseRequested(int index); From 3981bc8e3b1d3b82bcb3650859e4ade612401214 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 21 Jun 2018 13:48:57 +0200 Subject: [PATCH 077/213] extended notification system to add distant search result notification --- libretroshare/src/gxs/rsgenexchange.cc | 20 +++++++- libretroshare/src/gxs/rsgenexchange.h | 13 ++++- libretroshare/src/gxs/rsgxsnetservice.cc | 50 ++++++++++++++++++- libretroshare/src/gxs/rsgxsnetservice.h | 14 ++++++ libretroshare/src/gxs/rsgxsnettunnel.cc | 25 +++++++--- libretroshare/src/gxs/rsnxs.h | 35 +++++++++++++ libretroshare/src/gxs/rsnxsobserver.h | 15 +++++- libretroshare/src/gxstrans/p3gxstrans.cc | 2 +- libretroshare/src/retroshare/rsgxsservice.h | 14 +++++- libretroshare/src/services/p3gxschannels.cc | 1 + libretroshare/src/services/p3gxsforums.cc | 1 + .../src/gui/gxs/GxsGroupFrameDialog.cpp | 2 +- 12 files changed, 174 insertions(+), 18 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 735a09b99..f7609a8f9 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1571,7 +1571,7 @@ bool RsGenExchange::setAuthenPolicyFlag(const uint8_t &msgFlag, uint32_t& authen return true; } -void RsGenExchange::notifyNewGroups(std::vector &groups) +void RsGenExchange::receiveNewGroups(std::vector &groups) { RS_STACK_MUTEX(mGenMtx) ; @@ -1603,7 +1603,7 @@ void RsGenExchange::notifyNewGroups(std::vector &groups) } -void RsGenExchange::notifyNewMessages(std::vector& messages) +void RsGenExchange::receiveNewMessages(std::vector& messages) { RS_STACK_MUTEX(mGenMtx) ; @@ -1639,6 +1639,13 @@ void RsGenExchange::notifyNewMessages(std::vector& messages) } } +void RsGenExchange::receiveDistantSearchResults(TurtleRequestId id,const RsGxsGroupId &grpId) +{ + RS_STACK_MUTEX(mGenMtx); + + RsGxsDistantSearchResultChange* gc = new RsGxsDistantSearchResultChange(id,grpId); + mNotifications.push_back(gc); +} void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId) { RS_STACK_MUTEX(mGenMtx); @@ -1833,6 +1840,15 @@ uint32_t RsGenExchange::getSyncPeriod(const RsGxsGroupId& grpId) return RS_GXS_DEFAULT_MSG_REQ_PERIOD; } +bool RsGenExchange::getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos) +{ + return (mNetService!=NULL) && mNetService->getDistantSearchResults(id,group_infos) ; +} +bool RsGenExchange::clearDistantSearchResults(const TurtleRequestId& id) +{ + return (mNetService!=NULL) && mNetService->clearDistantSearchResults(id) ; +} + bool RsGenExchange::getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats) { return (!mNetService) || mNetService->getGroupNetworkStats(grpId,stats) ; diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 1e51d8b04..e08ba80bd 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -132,18 +132,24 @@ public: /*! * @param messages messages are deleted after function returns */ - virtual void notifyNewMessages(std::vector& messages); + virtual void receiveNewMessages(std::vector& messages); /*! * @param groups groups are deleted after function returns */ - virtual void notifyNewGroups(std::vector& groups); + virtual void receiveNewGroups(std::vector& groups); /*! * @param grpId group id */ virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId); + /*! + * \brief notifyReceiveDistantSearchResults + * Should be called when new search results arrive. + * \param grpId + */ + virtual void receiveDistantSearchResults(TurtleRequestId id,const RsGxsGroupId &grpId); /*! * @param grpId group id */ @@ -682,6 +688,9 @@ public: virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ; virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats); + virtual bool getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos) ; + virtual bool clearDistantSearchResults(const TurtleRequestId& id); + uint16_t serviceType() const { return mServType ; } uint32_t serviceFullType() const { return ((uint32_t)mServType << 8) + (((uint32_t) RS_PKT_VERSION_SERVICE) << 24); } diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 3a5c9ecb2..e5dfbd05a 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -498,8 +498,8 @@ void RsGxsNetService::processObserverNotifications() mNewPublishKeysToNotify.clear() ; } - if(!grps_copy.empty()) mObserver->notifyNewGroups (grps_copy); - if(!msgs_copy.empty()) mObserver->notifyNewMessages(msgs_copy); + if(!grps_copy.empty()) mObserver->receiveNewGroups (grps_copy); + if(!msgs_copy.empty()) mObserver->receiveNewMessages(msgs_copy); for(std::set::const_iterator it(keys_copy.begin());it!=keys_copy.end();++it) mObserver->notifyReceivePublishKey(*it); @@ -5117,9 +5117,36 @@ static bool termSearch(const std::string& src, const std::string& substring) /* always ignore case */ return src.end() != std::search( src.begin(), src.end(), substring.begin(), substring.end(), RsRegularExpression::CompareCharIC() ); } +void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std::list& group_infos) +{ + RS_STACK_MUTEX(mNxsMutex) ; +#warning We should use some central way to do that. This might be very costly if done often. + + RsGxsGrpMetaTemporaryMap grpMeta; + std::map& search_results_map(mDistantSearchResults[req]) ; + + for(auto it(group_infos.begin());it!=group_infos.end();++it) + if(search_results_map.find((*it).group_id) == search_results_map.end()) + grpMeta[(*it).group_id] = NULL; + + mDataStore->retrieveGxsGrpMetaData(grpMeta); + + std::list filtered_results ; + + // only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure + + for(auto it(group_infos.begin());it!=group_infos.end();++it) + if(grpMeta[(*it).group_id] == NULL) + { + filtered_results.push_back(*it) ; + search_results_map[(*it).group_id] = *it; + mObserver->receiveDistantSearchResults(req,(*it).group_id) ; + } +} bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) { + RS_STACK_MUTEX(mNxsMutex) ; RsGxsGrpMetaTemporaryMap grpMetaMap; mDataStore->retrieveGxsGrpMetaData(grpMetaMap); @@ -5148,3 +5175,22 @@ bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) +{ + RS_STACK_MUTEX(mNxsMutex) ; + auto it = mDistantSearchResults.find(id) ; + + if(it == mDistantSearchResults.end()) + return false ; + + for(auto it2(it->second.begin());it2!=it->second.end();++it2) + group_infos.push_back(it2->second); + return true; +} +bool RsGxsNetService::clearDistantSearchResults(const TurtleRequestId& id) +{ + RS_STACK_MUTEX(mNxsMutex) ; + mDistantSearchResults.erase(id); + return true ; +} diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index db2de16b8..799a2b503 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -131,6 +131,7 @@ public: virtual TurtleRequestId turtleSearchRequest(const std::string& match_string); virtual bool search(const std::string& substring,std::list& group_infos) ; + virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos); /*! * pauses synchronisation of subscribed groups and request for group id @@ -169,6 +170,16 @@ public: */ virtual bool getGroupNetworkStats(const RsGxsGroupId& id,RsGroupNetworkStats& stats) ; + /*! + * \brief getDistantSearchResults + * \param id Id of the search request previously issued + * \param group_infos Groups currently known for this search request. + * \return + * false if the id does not correspond to an ongoing distant search request. + */ + virtual bool getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos) ; + virtual bool clearDistantSearchResults(const TurtleRequestId& id); + /*! * Used to inform the net service that we changed subscription status. That helps * optimising data transfer when e.g. unsubsribed groups are updated less often, etc @@ -598,6 +609,9 @@ private: std::set mNewStatsToNotify ; std::set mNewPublishKeysToNotify ; + // Distant search result map + std::map > mDistantSearchResults ; + void debugDump(); uint32_t mDefaultMsgStorePeriod ; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index a52b2f020..eabc32e3a 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -1066,15 +1066,26 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id RsGxsNetTunnelTurtleSearchGroupSummaryItem *result_gs = dynamic_cast(item) ; - if(result_gs != NULL) + if(result_gs == NULL) { - GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl; - - for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) - std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; - -#warning MISSING CODE HERE - data should be passed up to UI in some way + GXS_NET_TUNNEL_ERROR() << ": deserialized item is not a GroupSummary Item. Smething's wrong here." << std::endl; + return ; } + + GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl; + + for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) + std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; + + auto it = mSearchableServices.find(result_gs->service) ; + + if(it == mSearchableServices.end()) + { + GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gs->service << std::dec << " that is in the searchable services list." << std::endl; + return ; + } + + it->second->receiveTurtleSearchResults(request_id,result_gs->group_infos) ; } diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 9d3673f1c..3f1cc9e25 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -103,9 +103,44 @@ public: virtual uint32_t getDefaultSyncAge() =0; virtual uint32_t getDefaultKeepAge() =0; + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// DISTANT SEARCH FUNCTIONS /// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /*! + * \brief turtleGroupRequest + * Requests a particular group meta data. The request protects the group ID. + * \param group_id + * \return + * returns the turtle request ID that might be associated to some results. + */ virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)=0; + + /*! + * \brief turtleSearchRequest + * Uses distant search to match the substring to the group meta data. + * \param match_string + * \return + * returns the turtle request ID that might be associated to some results. + */ virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; + /*! + * \brief receiveTurtleSearchResults + * Called by turtle (through RsGxsNetTunnel) when new results are received + * \param req Turtle search request ID associated with this result + * \param group_infos Group summary information for the groups returned by the search + */ + virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos)=0; + /*! + * \brief getDistantSearchResults + * \param id + * \param group_infos + * \return + */ + virtual bool getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos)=0 ; + virtual bool clearDistantSearchResults(const TurtleRequestId& id)=0; + virtual bool search(const std::string& substring,std::list& group_infos) =0; /*! diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index 087842ef0..a16bc66af 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -29,6 +29,7 @@ #include #include "rsitems/rsnxsitems.h" +typedef uint32_t TurtleRequestId ; class RsNxsObserver { @@ -42,12 +43,22 @@ public: /*! * @param messages messages are deleted after function returns */ - virtual void notifyNewMessages(std::vector& messages) = 0; + virtual void receiveNewMessages(std::vector& messages) = 0; /*! * @param groups groups are deleted after function returns */ - virtual void notifyNewGroups(std::vector& groups) = 0; + virtual void receiveNewGroups(std::vector& groups) = 0; + + /*! + * \brief receiveDistantSearchResults + * Called when new distant search result arrive. + * \param grpId + */ + virtual void receiveDistantSearchResults(TurtleRequestId& /*id*/,const RsGxsGroupId& /*grpId*/) + { + std::cerr << __PRETTY_FUNCTION__ << ": not overloaded but still called. Nothing will happen." << std::endl; + } /*! * @param grpId group id diff --git a/libretroshare/src/gxstrans/p3gxstrans.cc b/libretroshare/src/gxstrans/p3gxstrans.cc index d0dbb61b0..05c37cdb5 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.cc +++ b/libretroshare/src/gxstrans/p3gxstrans.cc @@ -839,7 +839,7 @@ bool p3GxsTrans::dispatchDecryptedMail( const RsGxsId& authorId, #endif std::vector rcct; rcct.push_back(receipt); - RsGenExchange::notifyNewMessages(rcct); + RsGenExchange::receiveNewMessages(rcct); GxsTransClient* recipientService = NULL; { diff --git a/libretroshare/src/retroshare/rsgxsservice.h b/libretroshare/src/retroshare/rsgxsservice.h index 14f02ed64..83f73887b 100644 --- a/libretroshare/src/retroshare/rsgxsservice.h +++ b/libretroshare/src/retroshare/rsgxsservice.h @@ -6,6 +6,7 @@ #include "retroshare/rstokenservice.h" struct RsMsgMetaData ; +typedef uint32_t TurtleRequestId; typedef std::map > GxsMsgMetaMap; typedef std::map > GxsMsgRelatedMetaMap; @@ -18,7 +19,7 @@ typedef std::map > GxsMsgRelatedMe struct RsGxsNotify { enum NotifyType - { TYPE_PUBLISHED, TYPE_RECEIVED_NEW, TYPE_PROCESSED, TYPE_RECEIVED_PUBLISHKEY }; + { TYPE_PUBLISHED, TYPE_RECEIVED_NEW, TYPE_PROCESSED, TYPE_RECEIVED_PUBLISHKEY, TYPE_RECEIVED_DISTANT_SEARCH_RESULTS }; virtual ~RsGxsNotify() {} virtual NotifyType getType() = 0; @@ -39,6 +40,17 @@ private: bool mMetaChange; }; +class RsGxsDistantSearchResultChange: public RsGxsNotify +{ +public: + RsGxsDistantSearchResultChange(TurtleRequestId id,const RsGxsGroupId& group_id) : mRequestId(id),mGroupId(group_id){} + + NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; } +private: + TurtleRequestId mRequestId ; + RsGxsGroupId mGroupId; +}; + /*! * Relevant to message changes */ diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index a9c54b789..221825e9b 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -295,6 +295,7 @@ void p3GxsChannels::notifyChanges(std::vector &changes) { switch (grpChange->getType()) { + default: case RsGxsNotify::TYPE_PROCESSED: case RsGxsNotify::TYPE_PUBLISHED: break; diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 69d33441e..2fa829c1c 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -196,6 +196,7 @@ void p3GxsForums::notifyChanges(std::vector &changes) switch (c->getType()) { + default: case RsGxsNotify::TYPE_PROCESSED: case RsGxsNotify::TYPE_PUBLISHED: break; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index e143278d1..04e64258b 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -1122,7 +1122,7 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class { - std::cerr << "Searching for \"" << search_string.toStdString() << "\". Function is not implemented yet." << std::endl; + std::cerr << "Searching for \"" << search_string.toStdString() << "\". Function is not overloaded, so nothing will happen." << std::endl; return 0; } From 6ccc7654d688c7eff72e57c247ffec585ecd34b3 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 23 Jun 2018 22:25:36 +0200 Subject: [PATCH 078/213] added code to notify GxsBroadcast system with new distant search results --- libretroshare/src/gxs/rsgenexchange.cc | 8 ++++++++ libretroshare/src/gxs/rsgxsnetservice.cc | 9 ++++++--- libretroshare/src/gxs/rsnxsobserver.h | 2 +- libretroshare/src/retroshare/rsgxsiface.h | 1 + libretroshare/src/retroshare/rsgxsservice.h | 2 +- retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp | 10 ++++++++++ retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h | 1 + .../src/gui/gxs/RsGxsUpdateBroadcastBase.cpp | 12 +++++++++++- .../src/gui/gxs/RsGxsUpdateBroadcastBase.h | 5 +++++ .../src/gui/gxs/RsGxsUpdateBroadcastPage.cpp | 5 +++++ .../src/gui/gxs/RsGxsUpdateBroadcastPage.h | 2 ++ .../src/gui/gxs/RsGxsUpdateBroadcastWidget.cpp | 4 ++++ .../src/gui/gxs/RsGxsUpdateBroadcastWidget.h | 2 ++ retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp | 3 +++ retroshare-gui/src/util/RsGxsUpdateBroadcast.h | 3 +++ 15 files changed, 63 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 8da9e606a..43e515732 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1110,6 +1110,8 @@ void RsGenExchange::receiveChanges(std::vector& changes) RsGxsNotify* n = *vit; RsGxsGroupChange* gc; RsGxsMsgChange* mc; + RsGxsDistantSearchResultChange *gt; + if((mc = dynamic_cast(n)) != NULL) { if (mc->metaChange()) @@ -1132,6 +1134,10 @@ void RsGenExchange::receiveChanges(std::vector& changes) out.mGrps.splice(out.mGrps.end(), gc->mGrpIdList); } } + else if((gt = dynamic_cast(n)) != NULL) + { + out.mDistantSearchReqs.push_back(gt->mRequestId); + } else std::cerr << "(EE) Unknown changes type!!" << std::endl; @@ -1641,6 +1647,8 @@ void RsGenExchange::receiveDistantSearchResults(TurtleRequestId id,const RsGxsGr RsGxsDistantSearchResultChange* gc = new RsGxsDistantSearchResultChange(id,grpId); mNotifications.push_back(gc); + + std::cerr << "RsGenExchange::receiveDistantSearchResults(): received result for request " << std::hex << id << std::dec << std::endl; } void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId) { diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index f456f4d7e..2ac77b279 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5136,7 +5136,8 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: // only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure for(auto it(group_infos.begin());it!=group_infos.end();++it) - if(grpMeta[(*it).group_id] == NULL) +#warning Uncomment when done with testing! +// if(grpMeta[(*it).group_id] == NULL) { filtered_results.push_back(*it) ; search_results_map[(*it).group_id] = *it; @@ -5146,9 +5147,11 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) { - RS_STACK_MUTEX(mNxsMutex) ; RsGxsGrpMetaTemporaryMap grpMetaMap; - mDataStore->retrieveGxsGrpMetaData(grpMetaMap); + { + RS_STACK_MUTEX(mNxsMutex) ; + mDataStore->retrieveGxsGrpMetaData(grpMetaMap); + } RsGroupNetworkStats stats ; diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index a16bc66af..b52d69d65 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -55,7 +55,7 @@ public: * Called when new distant search result arrive. * \param grpId */ - virtual void receiveDistantSearchResults(TurtleRequestId& /*id*/,const RsGxsGroupId& /*grpId*/) + virtual void receiveDistantSearchResults(TurtleRequestId /*id*/,const RsGxsGroupId& /*grpId*/) { std::cerr << __PRETTY_FUNCTION__ << ": not overloaded but still called. Nothing will happen." << std::endl; } diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index 36c660ef8..b9c974f9c 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -44,6 +44,7 @@ public: std::map > mMsgsMeta; std::list mGrps; std::list mGrpsMeta; + std::list mDistantSearchReqs; }; /*! diff --git a/libretroshare/src/retroshare/rsgxsservice.h b/libretroshare/src/retroshare/rsgxsservice.h index affbeea50..17ce356ec 100644 --- a/libretroshare/src/retroshare/rsgxsservice.h +++ b/libretroshare/src/retroshare/rsgxsservice.h @@ -46,7 +46,7 @@ public: RsGxsDistantSearchResultChange(TurtleRequestId id,const RsGxsGroupId& group_id) : mRequestId(id),mGroupId(group_id){} NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; } -private: + TurtleRequestId mRequestId ; RsGxsGroupId mGroupId; }; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 470ffbaab..a8b6e6344 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -245,6 +245,16 @@ void GxsGroupFrameDialog::updateDisplay(bool complete) updateMessageSummaryList(msgIt->first); } } + + updateSearchResults() ; +} + +void GxsGroupFrameDialog::updateSearchResults() +{ + const std::set& reqs = getSearchResults(); + + for(auto it(reqs.begin());it!=reqs.end();++it) + std::cerr << "updating search ID " << std::hex << *it << std::dec << std::endl; } void GxsGroupFrameDialog::todo() diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 3e5091857..f8db16a10 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -152,6 +152,7 @@ private: void initUi(); void updateMessageSummaryList(RsGxsGroupId groupId); + void updateSearchResults(); void openGroupInNewTab(const RsGxsGroupId &groupId); void groupSubscribe(bool subscribe); diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp index ffbd6147e..76274b27a 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp @@ -16,12 +16,19 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl, connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged())); connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list, std::list)), this, SLOT(updateBroadcastGrpsChanged(std::list,std::list))); connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map >, std::map >)), this, SLOT(updateBroadcastMsgsChanged(std::map >,std::map >))); + connect(mUpdateBroadcast, SIGNAL(distantSearchResultsChanged(const std::list&)), this, SLOT(updateBroadcastDistantSearchResultsChanged(const std::list&))); } RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase() { } +void RsGxsUpdateBroadcastBase::updateBroadcastDistantSearchResultsChanged(const std::list& ids) +{ + for(auto it(ids.begin());it!=ids.end();++it) + mTurtleResults.insert(*it); +} + void RsGxsUpdateBroadcastBase::fillComplete() { mFillComplete = true; @@ -37,6 +44,9 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay() return; } + // This is *bad* because if the connection is done asynchronously the client will call mGrpIds, mGrpIdsMeta, etc without the guarranty that the + // the structed havnt' been cleared in the mean time. + emit fillDisplay(mFillComplete); mFillComplete = false; @@ -75,7 +85,7 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged() // The question to whether we should re=load when mGrpIds is not empty is still open. It's not harmful anyway. // This should probably be decided by the service itself. - if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty()) + if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty() || !mTurtleResults.empty()) mFillComplete = true ; securedUpdateDisplay(); diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.h b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.h index 90dd3f507..704ff2157 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.h +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.h @@ -7,6 +7,8 @@ class QShowEvent; class RsGxsIfaceHelper; class RsGxsUpdateBroadcast; +typedef uint32_t TurtleRequestId ; + class RsGxsUpdateBroadcastBase : public QObject { friend class RsGxsUpdateBroadcastPage; @@ -25,6 +27,7 @@ public: const std::map > &getMsgIds() { return mMsgIds; } const std::map > &getMsgIdsMeta() { return mMsgIdsMeta; } void getAllMsgIds(std::map > &msgIds); + const std::set& getSearchResults() { return mTurtleResults ; } protected: void fillComplete(); @@ -39,6 +42,7 @@ private slots: void updateBroadcastChanged(); void updateBroadcastGrpsChanged(const std::list& grpIds, const std::list &grpIdsMeta); void updateBroadcastMsgsChanged(const std::map >& msgIds, const std::map >& msgIdsMeta); + void updateBroadcastDistantSearchResultsChanged(const std::list& ids); void securedUpdateDisplay(); private: @@ -49,4 +53,5 @@ private: std::set mGrpIdsMeta; std::map > mMsgIds; std::map > mMsgIdsMeta; + std::set mTurtleResults; }; diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.cpp b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.cpp index 629148688..c0d19c56f 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.cpp +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.cpp @@ -22,6 +22,11 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update) mBase->setUpdateWhenInvisible(update); } +const std::set& RsGxsUpdateBroadcastPage::getSearchResults() +{ + return mBase->getSearchResults(); +} + const std::set &RsGxsUpdateBroadcastPage::getGrpIdsMeta() { return mBase->getGrpIdsMeta(); diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.h b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.h index 0c67f58ff..e3e9a4563 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.h +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastPage.h @@ -13,6 +13,7 @@ class RsGxsIfaceHelper; class RsGxsUpdateBroadcastBase; +typedef uint32_t TurtleRequestId ; class RsGxsUpdateBroadcastPage : public MainPage { @@ -30,6 +31,7 @@ public: const std::map > &getMsgIds(); const std::map > &getMsgIdsMeta(); void getAllMsgIds(std::map > &msgIds); + const std::set& getSearchResults(); protected: virtual void showEvent(QShowEvent *event); diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.cpp b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.cpp index a6e3e5705..bade31287 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.cpp +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.cpp @@ -29,6 +29,10 @@ const std::set &RsGxsUpdateBroadcastWidget::getGrpIds() return mBase->getGrpIds(); } +const std::set& RsGxsUpdateBroadcastWidget::getSearchResults() +{ + return mBase->getSearchResults(); +} const std::set &RsGxsUpdateBroadcastWidget::getGrpIdsMeta() { return mBase->getGrpIdsMeta(); diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.h b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.h index f0ab07742..f99a34d04 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.h +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastWidget.h @@ -13,6 +13,7 @@ class RsGxsIfaceHelper; class RsGxsUpdateBroadcastBase; +typedef uint32_t TurtleRequestId; class RsGxsUpdateBroadcastWidget : public QWidget { @@ -30,6 +31,7 @@ public: const std::map > &getMsgIds(); const std::map > &getMsgIdsMeta(); void getAllMsgIds(std::map > &msgIds); + const std::set& getSearchResults() ; RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; } diff --git a/retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp b/retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp index 0fdf63d65..6b6295e2e 100644 --- a/retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp +++ b/retroshare-gui/src/util/RsGxsUpdateBroadcast.cpp @@ -79,5 +79,8 @@ void RsGxsUpdateBroadcast::onChangesReceived(const RsGxsChanges& changes) emit grpsChanged(changes.mGrps, changes.mGrpsMeta); } + if(!changes.mDistantSearchReqs.empty()) + emit distantSearchResultsChanged(changes.mDistantSearchReqs) ; + emit changed(); } diff --git a/retroshare-gui/src/util/RsGxsUpdateBroadcast.h b/retroshare-gui/src/util/RsGxsUpdateBroadcast.h index 1622ca606..e08a866c7 100644 --- a/retroshare-gui/src/util/RsGxsUpdateBroadcast.h +++ b/retroshare-gui/src/util/RsGxsUpdateBroadcast.h @@ -8,6 +8,8 @@ class RsGxsIfaceHelper; class RsGxsChanges; +typedef uint32_t TurtleRequestId ; + class RsGxsUpdateBroadcast : public QObject { Q_OBJECT @@ -21,6 +23,7 @@ signals: void changed(); void msgsChanged(const std::map >& msgIds, const std::map >& msgIdsMeta); void grpsChanged(const std::list& grpIds, const std::list& grpIdsMeta); + void distantSearchResultsChanged(const std::list& reqs); private slots: void onChangesReceived(const RsGxsChanges& changes); From 7ad337c8d2806aa6a07a240108b8007494372d76 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 23 Jun 2018 17:13:38 +0200 Subject: [PATCH 079/213] Implement automatic JSON API generation qmake file add jsonapi-generator target to compile JSON API generator qmake files add rs_jsonapi CONFIG option to enable/disable JSON API at compile time RsTypeSerializer pass down same serialization flags when creating new context for nested objects serial job RsGxsChannels expose a few methods through JSON API as example Derive a few GXS types (RsGxsChannelGroup, RsGxsChannelPost, RsGxsFile, RsMsgMetaData) from RsSerializables so they can be used for the JSON API Create RsGenericSerializer::SERIALIZATION_FLAG_YIELDING so JSON objects that miss some fields can be still deserialized, this improve API usability SerializeContext offer friendly constructor with default paramethers Add restbed 4.6 library as git submodule as most systems doesn't have it yet Add a bit of documentation about JSON API into jsonapi-generator/README.adoc Add JsonApiServer class to expose the JSON API via HTTP protocol --- .gitmodules | 3 + RetroShare.pro | 8 +- jsonapi-generator/README.adoc | 227 +++++++++++++++++ .../src/jsonapi-generator-doxygen.conf | 230 +++++++++++++++++ jsonapi-generator/src/jsonapi-generator.cpp | 239 ++++++++++++++++++ jsonapi-generator/src/jsonapi-generator.pro | 6 + .../src/method-wrapper-template.cpp.tmpl | 79 ++++++ libretroshare/src/jsonapi/jsonapi.cpp | 45 ++++ libretroshare/src/jsonapi/jsonapi.h | 62 +++++ libretroshare/src/libretroshare.pro | 58 +++++ libretroshare/src/retroshare/rsgxschannels.h | 121 +++++++-- libretroshare/src/retroshare/rsgxscommon.h | 34 ++- .../src/retroshare/rsgxsifacetypes.h | 20 +- libretroshare/src/serialiser/rsserializer.cc | 1 + libretroshare/src/serialiser/rsserializer.h | 8 +- .../src/serialiser/rstypeserializer.cc | 11 +- .../src/serialiser/rstypeserializer.h | 86 ++++--- libretroshare/src/use_libretroshare.pri | 12 + retroshare-gui/src/gui/settings/WebuiPage.cpp | 11 + retroshare-gui/src/gui/settings/WebuiPage.h | 7 + retroshare.pri | 19 +- supportlibs/restbed | 1 + 22 files changed, 1205 insertions(+), 83 deletions(-) create mode 100644 .gitmodules create mode 100644 jsonapi-generator/README.adoc create mode 100644 jsonapi-generator/src/jsonapi-generator-doxygen.conf create mode 100644 jsonapi-generator/src/jsonapi-generator.cpp create mode 100644 jsonapi-generator/src/jsonapi-generator.pro create mode 100644 jsonapi-generator/src/method-wrapper-template.cpp.tmpl create mode 100644 libretroshare/src/jsonapi/jsonapi.cpp create mode 100644 libretroshare/src/jsonapi/jsonapi.h create mode 160000 supportlibs/restbed diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..265e24998 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "supportlibs/restbed"] + path = supportlibs/restbed + url = https://github.com/Corvusoft/restbed.git diff --git a/RetroShare.pro b/RetroShare.pro index d124ce94d..db82ba58e 100644 --- a/RetroShare.pro +++ b/RetroShare.pro @@ -10,7 +10,13 @@ retrotor { } else { SUBDIRS += libbitdht libbitdht.file = libbitdht/src/libbitdht.pro - libretroshare.depends = openpgpsdk libbitdht + libretroshare.depends = openpgpsdk libbitdht +} + +rs_jsonapi { + SUBDIRS += jsonapi-generator + jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro + libretroshare.depends += jsonapi-generator } SUBDIRS += libretroshare diff --git a/jsonapi-generator/README.adoc b/jsonapi-generator/README.adoc new file mode 100644 index 000000000..dc37a26c6 --- /dev/null +++ b/jsonapi-generator/README.adoc @@ -0,0 +1,227 @@ +RetroShare JSON API +=================== + +:Cxx: C++ + +== How to use RetroShare JSON API + +Look for methods marked with +@jsonapi+ doxygen custom command into ++libretroshare/src/retroshare+. The method path is composed by service instance +pointer name like +rsGxsChannels+ for +RsGxsChannels+, and the method name like ++createGroup+ and pass the input paramethers as a JSON object. + +.paramethers.json +[source,json] +-------------------------------------------------------------------------------- +{ + "group":{ + "mMeta":{ + "mGroupName":"JSON test group", + "mGroupFlags":4, + "mSignFlags":520 + }, + "mDescription":"JSON test group description" + }, + "caller_data":"Here can go any kind of JSON data (even objects) that the caller want to get back together with the response" +} +-------------------------------------------------------------------------------- + +.Calling the JSON API with curl on the terminal +[source,bash] +-------------------------------------------------------------------------------- +curl -H "Content-Type: application/json" --data @paramethers.json \ + http://127.0.0.1:9092/rsGxsChannels/createGroup +-------------------------------------------------------------------------------- + +.JSON API call result +[source,json] +-------------------------------------------------------------------------------- +{ + "caller_data": "Here can go any kind of JSON data (even objects) that the caller want to get back together with the response", + "retval": true, + "token": 3 +} +-------------------------------------------------------------------------------- + + +== Offer new RetroShare services through JSON API + +To offer a retroshare service through the JSON API, first of all one need find +the global pointer to the service instance and document it in doxygen syntax, +plus marking with the custom doxygen command +@jsonapi{RS_VERSION}+ where ++RS_VERSION+ is the retroshare version in which this service became available +with the current semantic (major changes to the service semantic, changes the +meaning of the service itself, so the version should be updated in the +documentation in that case). + +.Service instance pointer in rsgxschannels.h +[source,cpp] +-------------------------------------------------------------------------------- +/** + * Pointer to global instance of RsGxsChannels service implementation + * @jsonapi{development} + */ +extern RsGxsChannels* rsGxsChannels; +-------------------------------------------------------------------------------- + + +Once the service instance itself is known to the JSON API you need to document +in doxygen syntax and mark with the custom doxygen command ++@jsonapi{RS_VERSION}+ the methods of the service that you want to make +available through JSON API. + +.Offering RsGxsChannels::getChannelDownloadDirectory in rsgxschannels.h +[source,cpp] +-------------------------------------------------------------------------------- + /** + * Get download directory for the given channel + * @jsonapi{development} + * @param[in] channelId id of the channel + * @param[out] directory reference to string where to store the path + * @return false on error, true otherwise + */ + virtual bool getChannelDownloadDirectory( const RsGxsGroupId& channelId, + std::string& directory ) = 0; +-------------------------------------------------------------------------------- + +For each paramether you must specify if it is used as input +@param[in]+ as +output +@param[out]+ or both +@param[inout]+. Paramethers and return value +types must be of a type supported by +RsTypeSerializer+ which already support +most basic types (+bool+, +std::string+...), +RsSerializable+ and containers of +them like +std::vector+. Paramethers passed by value and by +reference of those types are both supported, while passing by pointer is not +supported. If your paramether or return +class+/+struct+ type is not supported +yet by +RsTypeSerializer+ most convenient approach is to make it derive from ++RsSerializable+ and implement +serial_process+ method like I did with ++RsGxsChannelGroup+. + +.Deriving RsGxsChannelGroup from RsSerializable in rsgxschannels.h +[source,cpp] +-------------------------------------------------------------------------------- +struct RsGxsChannelGroup : RsSerializable +{ + RsGroupMetaData mMeta; + std::string mDescription; + RsGxsImage mImage; + + bool mAutoDownload; + + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mMeta); + RS_SERIAL_PROCESS(mDescription); + //RS_SERIAL_PROCESS(mImage); + RS_SERIAL_PROCESS(mAutoDownload); + } +}; +-------------------------------------------------------------------------------- + +You can do the same recursively for any member of your +struct+ that is not yet +supported by +RsTypeSerializer+ like I should have done for +RsGxsImage mImage;+ +but didn't have done yet because the day is so beatiful and i want to spend some +time outside :D. + + +== A bit of history + +=== First writings about this + +The previous attempt of exposing a RetroShare JSON API is called +libresapi+ and +unfortunatley it requires a bunch of boilerplate code when we want to expose +something present in the {Cxx} API in the JSON API. + +As an example here you can see the libresapi that exposes part of the retroshare +chat {Cxx} API and lot of boilerplate code just to convert {Cxx} objects to JSON + +https://github.com/RetroShare/RetroShare/blob/v0.6.4/libresapi/src/api/ChatHandler.cpp#L44 + +To avoid the {Cxx} to JSON and back conversion boilerplate code I have worked out +an extension to our {Cxx} serialization code so it is capable to serialize and +deserialize to JSON you can see it in this pull request + +https://github.com/RetroShare/RetroShare/pull/1155 + +So first step toward having a good API is to take advantage of the fact that RS +is now capable of converting C++ objects from and to JSON. + +The current API is accessible via HTTP and unix socket, there is no +authentication in both of them, so anyone having access to the HTTP server or to +the unix socket can access the API without extra restrictions. +Expecially for the HTTP API this is a big risk because also if the http server +listen on 127.0.0.1 every application on the machine (even rogue javascript +running on your web browser) can access that and for example on android it is +not safe at all (because of that I implemented the unix socket access so at +least in android API was reasonably safe) because of this. + +A second step to improve the API would be to implement some kind of API +authentication mechanism (it would be nice that the mechanism is handled at API +level and not at transport level so we can use it for any API trasport not just +HTTP for example) + +The HTTP server used by libresapi is libmicrohttpd server that is very minimal, +it doesn't provide HTTPS nor modern HTTP goodies, like server notifications, +websockets etc. because the lack of support we have a token polling mechanism in +libresapi to avoid polling for every thing but it is still ugly, so if we can +completely get rid of polling in the API that would be really nice. +I have done a crawl to look for a replacement and briefly looked at + +- https://www.gnu.org/software/libmicrohttpd/ +- http://wolkykim.github.io/libasyncd/ +- https://github.com/corvusoft/restbed +- https://code.facebook.com/posts/1503205539947302/introducing-proxygen-facebook-s-c-http-framework/ +- https://github.com/cmouse/yahttp + +taking in account a few metrics like modern HTTP goodies support, license, +platform support, external dependencies and documentation it seemed to me that +restbed is the more appropriate. + +Another source of boilerplate code into libresapi is the mapping between JSON +API requests and C++ API methods as an example you can look at this + +https://github.com/RetroShare/RetroShare/blob/v0.6.4/libresapi/src/api/ChatHandler.cpp#L158 + +and this + +https://github.com/RetroShare/RetroShare/blob/v0.6.4/libresapi/src/api/ApiServer.cpp#L253 + +The abstract logic of this thing is, when libreasapi get a request like ++/chat/initiate_distant_chat+ then call ++ChatHandler::handleInitiateDistantChatConnexion+ which in turn is just a +wrapper of +RsMsgs::initiateDistantChatConnexion+ all this process is basically +implemented as boilerplate code and would be unnecessary in a smarter design of +the API because almost all the information needed is already present in the +C++ API +libretroshare/src/retroshare+. + +So a third step to improve the JSON API would be to remove this source of +boilerplate code by automatizing the mapping between C++ and JSON API call. + +This may result a little tricky as language parsing or other adevanced things +may be required. + +Hope this dive is useful for you + +Cheers + +G10h4ck + +=== Second writings about this + +I have been investigating a bit more about: +[verse, G10h4ck] +________________________________________________________________________________ +So a third step to improve the JSON API would be to remove this source of +boilerplate code by automatizing the mapping between C++ and JSON API call +________________________________________________________________________________ + +After spending some hours investigating this topic the most reasonable approach +seems to: + +1. Properly document headers in +libretroshare/src/retroshare/+ in doxygen syntax +specifying wihich params are input and/or output (doxygen sysntax for this is ++@param[in/out/inout]+) this will be the API documentation too. + +2. At compile time use doxygen to generate XML description of the headers and use +the XML to generate the JSON api server stub. +http://www.stack.nl/~dimitri/doxygen/manual/customize.html#xmlgenerator + +3. Enjoy diff --git a/jsonapi-generator/src/jsonapi-generator-doxygen.conf b/jsonapi-generator/src/jsonapi-generator-doxygen.conf new file mode 100644 index 000000000..e27bf7a40 --- /dev/null +++ b/jsonapi-generator/src/jsonapi-generator-doxygen.conf @@ -0,0 +1,230 @@ +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "libretroshare" +#OUTPUT_DIRECTORY = + +ALIASES += jsonapi{1}="\xmlonly\endxmlonly" + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +#INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = NO + +# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. +# The default value is: YES. + +GENERATE_LATEX = NO + +# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that +# captures the structure of the code including all documentation. +# The default value is: NO. + +GENERATE_XML = YES + + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all +# C-preprocessor directives found in the sources and include files. +# The default value is: YES. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names +# in the source code. If set to NO, only conditional compilation will be +# performed. Macro expansion can be done in a controlled way by setting +# EXPAND_ONLY_PREDEF to YES. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then +# the macro expansion is limited to the macros specified with the PREDEFINED and +# EXPAND_AS_DEFINED tags. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_ONLY_PREDEF = NO + diff --git a/jsonapi-generator/src/jsonapi-generator.cpp b/jsonapi-generator/src/jsonapi-generator.cpp new file mode 100644 index 000000000..e314ef2ea --- /dev/null +++ b/jsonapi-generator/src/jsonapi-generator.cpp @@ -0,0 +1,239 @@ +/* + * RetroShare JSON API + * Copyright (C) 2018 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include + +struct MethodParam +{ + MethodParam() : in(false), out(false) {} + + QString type; + QString name; + bool in; + bool out; +}; + +int main(int argc, char *argv[]) +{ + if(argc != 3) + qFatal("Usage: jsonapi-generator SOURCE_PATH OUTPUT_PATH"); + + QString sourcePath(argv[1]); + QString outputPath(argv[2]); + QString doxPrefix(outputPath+"/xml/"); + + QString wrappersDefFilePath(outputPath + "/jsonapi-wrappers.cpp"); + QFile wrappersDefFile(wrappersDefFilePath); + wrappersDefFile.remove(); + if(!wrappersDefFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) + qFatal(QString("Can't open: " + wrappersDefFilePath).toLatin1().data()); + + QString wrappersDeclFilePath(outputPath + "/jsonapi-wrappers.h"); + QFile wrappersDeclFile(wrappersDeclFilePath); + wrappersDeclFile.remove(); + if(!wrappersDeclFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) + qFatal(QString("Can't open: " + wrappersDeclFilePath).toLatin1().data()); + + QString wrappersRegisterFilePath(outputPath + "/jsonapi-register.inl"); + QFile wrappersRegisterFile(wrappersRegisterFilePath); + wrappersRegisterFile.remove(); + if(!wrappersRegisterFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) + qFatal(QString("Can't open: " + wrappersRegisterFilePath).toLatin1().data()); + + + QDirIterator it(doxPrefix, QStringList() << "*8h.xml", QDir::Files); + while(it.hasNext()) + { + QDomDocument hDoc; + QString hFilePath(it.next()); + QString parseError; int line, column; + QFile hFile(hFilePath); + if (!hFile.open(QIODevice::ReadOnly) || + !hDoc.setContent(&hFile, &parseError, &line, &column)) + { + qWarning() << "Error parsing:" << hFilePath + << parseError << line << column; + continue; + } + + QFileInfo hfi(hFile); + QString headerFileName(hfi.fileName()); + headerFileName.replace(QString("_8h.xml"), QString(".h")); + + QDomNodeList sectiondefs = hDoc.elementsByTagName("sectiondef"); + for(int j = 0; j < sectiondefs.size(); ++j) + { + QDomElement sectDef = sectiondefs.item(j).toElement(); + + if( sectDef.attributes().namedItem("kind").nodeValue() != "var" + || sectDef.elementsByTagName("jsonapi").isEmpty() ) + continue; + + QString instanceName = + sectDef.elementsByTagName("name").item(0).toElement().text(); + QString typeName = + sectDef.elementsByTagName("ref").item(0).toElement().text(); + QString typeFilePath(doxPrefix); + typeFilePath += sectDef.elementsByTagName("ref").item(0) + .attributes().namedItem("refid").nodeValue(); + typeFilePath += ".xml"; + + QDomDocument typeDoc; + QFile typeFile(typeFilePath); + if ( !typeFile.open(QIODevice::ReadOnly) || + !typeDoc.setContent(&typeFile, &parseError, &line, &column) ) + { + qWarning() << "Error parsing:" << typeFilePath + << parseError << line << column; + continue; + } + + QDomNodeList members = typeDoc.elementsByTagName("member"); + for (int i = 0; i < members.size(); ++i) + { + QDomNode member = members.item(i); + QString refid(member.attributes().namedItem("refid").nodeValue()); + QString methodName(member.firstChildElement("name").toElement().text()); + QString wrapperName(instanceName+methodName+"Wrapper"); + + QDomDocument defDoc; + QString defFilePath(doxPrefix + refid.split('_')[0] + ".xml"); + QFile defFile(defFilePath); + if ( !defFile.open(QIODevice::ReadOnly) || + !defDoc.setContent(&defFile, &parseError, &line, &column) ) + { + qWarning() << "Error parsing:" << defFilePath + << parseError << line << column; + continue; + } + + QDomElement memberdef; + QDomNodeList memberdefs = typeDoc.elementsByTagName("memberdef"); + for (int k = 0; k < memberdefs.size(); ++k) + { + QDomElement tmpMBD = memberdefs.item(k).toElement(); + QString tmpId = tmpMBD.attributes().namedItem("id").nodeValue(); + QString tmpKind = tmpMBD.attributes().namedItem("kind").nodeValue(); + bool hasJsonApi = !tmpMBD.elementsByTagName("jsonapi").isEmpty(); + if( tmpId == refid && tmpKind == "function" && hasJsonApi ) + { + memberdef = tmpMBD; + break; + } + } + + if(memberdef.isNull()) continue; + + QString apiPath("/" + instanceName + "/" + methodName); + QString retvalType = memberdef.firstChildElement("type").text(); + QMap paramsMap; + QStringList orderedParamNames; + + QDomNodeList params = memberdef.elementsByTagName("param"); + for (int k = 0; k < params.size(); ++k) + { + QDomElement tmpPE = params.item(k).toElement(); + MethodParam tmpParam; + tmpParam.name = tmpPE.firstChildElement("declname").text(); + QDomElement tmpType = tmpPE.firstChildElement("type"); + QString& pType(tmpParam.type); + pType = tmpType.text(); + if(pType.startsWith("const ")) pType.remove(0,6); + pType.replace(QString("&"), QString()); + pType.replace(QString(" "), QString()); + paramsMap.insert(tmpParam.name, tmpParam); + orderedParamNames.push_back(tmpParam.name); + } + + QDomNodeList parameternames = memberdef.elementsByTagName("parametername"); + for (int k = 0; k < parameternames.size(); ++k) + { + QDomElement tmpPN = parameternames.item(k).toElement(); + MethodParam& tmpParam = paramsMap[tmpPN.text()]; + QString tmpD = tmpPN.attributes().namedItem("direction").nodeValue(); + tmpParam.in = tmpD.contains("in"); + tmpParam.out = tmpD.contains("out"); + } + + qDebug() << instanceName << apiPath << retvalType << typeName + << methodName; + for (const QString& pn : orderedParamNames) + { + const MethodParam& mp(paramsMap[pn]); + qDebug() << "\t" << mp.type << mp.name << mp.in << mp.out; + } + + QString retvalSerialization; + if(retvalType != "void") + retvalSerialization = "\t\t\tRS_SERIAL_PROCESS(retval);"; + + QString paramsDeclaration; + QString inputParamsDeserialization; + QString outputParamsSerialization; + for (const QString& pn : orderedParamNames) + { + const MethodParam& mp(paramsMap[pn]); + paramsDeclaration += "\t\t" + mp.type + " " + mp.name + ";\n"; + if(mp.in) + inputParamsDeserialization += "\t\t\tRS_SERIAL_PROCESS(" + + mp.name + ");\n"; + if(mp.out) + outputParamsSerialization += "\t\t\tRS_SERIAL_PROCESS(" + + mp.name + ");\n"; + } + + QMap substitutionsMap; + substitutionsMap.insert("instanceName", instanceName); + substitutionsMap.insert("methodName", methodName); + substitutionsMap.insert("paramsDeclaration", paramsDeclaration); + substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization); + substitutionsMap.insert("outputParamsSerialization", outputParamsSerialization); + substitutionsMap.insert("retvalSerialization", retvalSerialization); + substitutionsMap.insert("retvalType", retvalType); + substitutionsMap.insert("callParamsList", orderedParamNames.join(", ")); + substitutionsMap.insert("wrapperName", wrapperName); + substitutionsMap.insert("headerFileName", headerFileName); + + QFile templFile(sourcePath + "/method-wrapper-template.cpp.tmpl"); + templFile.open(QIODevice::ReadOnly); + QString wrapperDef(templFile.readAll()); + + QMap::iterator it; + for ( it = substitutionsMap.begin(); + it != substitutionsMap.end(); ++it ) + wrapperDef.replace(QString("$%"+it.key()+"%$"), QString(it.value()), Qt::CaseSensitive); + + wrappersDefFile.write(wrapperDef.toLocal8Bit()); + + QString wrapperDecl("void " + instanceName + methodName + "Wrapper(const std::shared_ptr session);\n"); + wrappersDeclFile.write(wrapperDecl.toLocal8Bit()); + + + QString wrapperReg("registerHandler(\""+apiPath+"\", "+wrapperName+");\n"); + wrappersRegisterFile.write(wrapperReg.toLocal8Bit()); + } + } + } + + return 0; +} diff --git a/jsonapi-generator/src/jsonapi-generator.pro b/jsonapi-generator/src/jsonapi-generator.pro new file mode 100644 index 000000000..c36eeea1d --- /dev/null +++ b/jsonapi-generator/src/jsonapi-generator.pro @@ -0,0 +1,6 @@ +TARGET = jsonapi-generator + +QT *= core xml +QT -= gui + +SOURCES += jsonapi-generator.cpp diff --git a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl new file mode 100644 index 000000000..63a2dfff1 --- /dev/null +++ b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl @@ -0,0 +1,79 @@ +/* + * RetroShare JSON API + * Copyright (C) 2018 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include "retroshare/$%headerFileName%$" + +namespace rb = restbed; + +void $%wrapperName%$(const std::shared_ptr session) +{ + size_t reqSize = session->get_request()->get_header("Content-Length", 0); + session->fetch( reqSize, []( + const std::shared_ptr session, + const rb::Bytes& body ) + { + RsGenericSerializer::SerializeContext cReq( + nullptr, 0, + RsGenericSerializer::SERIALIZATION_FLAG_YIELDING ); + RsJson& jReq(cReq.mJson); + jReq.Parse(reinterpret_cast(body.data()), body.size()); + + RsGenericSerializer::SerializeContext cAns; + RsJson& jAns(cAns.mJson); + + // if caller specified caller_data put it back in the answhere + const char kcd[] = "caller_data"; + if(jReq.HasMember(kcd)) + jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator()); + +$%paramsDeclaration%$ + + // deserialize input parameters from JSON + { + RsGenericSerializer::SerializeContext& ctx(cReq); + RsGenericSerializer::SerializeJob j(RsGenericSerializer::FROM_JSON); +$%inputParamsDeserialization%$ + } + + // call retroshare C++ API + $%retvalType%$ retval = $%instanceName%$->$%methodName%$($%callParamsList%$); + + // serialize out parameters and return value to JSON + { + RsGenericSerializer::SerializeContext& ctx(cAns); + RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON); +$%retvalSerialization%$ +$%outputParamsSerialization%$ + } + + // return them to the API caller + std::stringstream ss; + ss << jAns; + std::string&& ans(ss.str()); + const std::multimap headers + { + { "Content-Type", "text/json" }, + { "Content-Length", std::to_string(ans.length()) } + }; + session->close(rb::OK, ans, headers); + } ); +} + diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp new file mode 100644 index 000000000..fd9687d4d --- /dev/null +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -0,0 +1,45 @@ +/* + * RetroShare JSON API + * Copyright (C) 2018 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "jsonapi.h" + +// Generated at compile time +#include "jsonapi-wrappers.h" + +JsonApiServer::JsonApiServer(uint16_t port) : mPort(port) +{ +// Generated at compile time +#include "jsonapi-register.inl" +} + +void JsonApiServer::run() +{ + std::shared_ptr settings(new rb::Settings); + settings->set_port(mPort); + settings->set_default_header("Connection", "close"); + service.start(settings); +} + +void JsonApiServer::registerHandler(const std::string& path, const std::function)>& handler) +{ + std::shared_ptr resource(new rb::Resource); + resource->set_path(path); + resource->set_method_handler("GET", handler); + resource->set_method_handler("POST", handler); + service.publish(resource); +} diff --git a/libretroshare/src/jsonapi/jsonapi.h b/libretroshare/src/jsonapi/jsonapi.h new file mode 100644 index 000000000..ce421c102 --- /dev/null +++ b/libretroshare/src/jsonapi/jsonapi.h @@ -0,0 +1,62 @@ +/* + * RetroShare JSON API + * Copyright (C) 2018 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "retroshare/rsgxschannels.h" +#include "serialiser/rstypeserializer.h" +#include "util/rsthreads.h" + +namespace rb = restbed; + +void apiVersionHandler(const std::shared_ptr session); +void createChannelHandler(const std::shared_ptr session); + +/** + * Simple usage + * \code{.cpp} + * JsonApiServer jas(9092); + * jas.start("JsonApiServer"); + * \endcode + */ +struct JsonApiServer : RsSingleJobThread +{ + JsonApiServer(uint16_t port); + + /// @see RsSingleJobThread + virtual void run(); + + /** + * @param[in] handler function which will be called to handle the requested + * path, the function must be declared like: + * \code{.cpp} + * void functionName(const shared_ptr session) + * \endcode + */ + void registerHandler( + const std::string& path, + const std::function)>& handler ); + +private: + uint16_t mPort; + rb::Service service; +}; + diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 729c9186d..29acb8e92 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -849,6 +849,64 @@ rs_gxs_trans { SOURCES += gxstrans/p3gxstransitems.cc gxstrans/p3gxstrans.cc } +rs_jsonapi { + JSONAPI_GENERATOR_SRC=$$system_path($$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/)) + JSONAPI_GENERATOR_OUT=$$system_path($$clean_path($${RS_BUILD_PATH}/jsonapi-generator/src/)) + JSONAPI_GENERATOR_EXE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator)) + DOXIGEN_INPUT_DIRECTORY=$$system_path($$clean_path($${PWD}/retroshare/)) + DOXIGEN_CONFIG_SRC=$$system_path($$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/jsonapi-generator-doxygen.conf)) + DOXIGEN_CONFIG_OUT=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator-doxygen.conf)) + WRAPPERS_DEF_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-wrappers.cpp)) + WRAPPERS_DECL_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-wrappers.h)) + WRAPPERS_REG_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-register.inl)) + + restbed.target = $$system_path($$clean_path($${RESTBED_BUILD_PATH}/library/librestbed.a)) + restbed.commands = \ + cd $${RS_SRC_PATH}; git submodule update --init --recursive;\ + mkdir -p $${RESTBED_BUILD_PATH}; cd $${RESTBED_BUILD_PATH};\ + cmake -DBUILD_SSL=OFF -DCMAKE_INSTALL_PREFIX=. -B. -H$${RESTBED_SRC_PATH};\ + make; make install + QMAKE_EXTRA_TARGETS += restbed + libretroshare.depends += restbed + PRE_TARGETDEPS *= $${restbed.target} + + PRE_TARGETDEPS *= $${JSONAPI_GENERATOR_EXE} + INCLUDEPATH *= $${JSONAPI_GENERATOR_OUT} + GENERATED_HEADERS += $${WRAPPERS_DECL_FILE} $${WRAPPERS_REG_FILE} + GENERATED_SOURCES += $${WRAPPERS_DEF_FILE} + + jsonwrappersdecl.target = $${WRAPPERS_DECL_FILE} + jsonwrappersdecl.commands = \ + cp $${DOXIGEN_CONFIG_SRC} $${DOXIGEN_CONFIG_OUT}; \ + echo OUTPUT_DIRECTORY=$${JSONAPI_GENERATOR_OUT} >> $${DOXIGEN_CONFIG_OUT};\ + echo INPUT=$${DOXIGEN_INPUT_DIRECTORY} >> $${DOXIGEN_CONFIG_OUT}; \ + doxygen $${DOXIGEN_CONFIG_OUT}; \ + $${JSONAPI_GENERATOR_EXE} $${JSONAPI_GENERATOR_SRC} $${JSONAPI_GENERATOR_OUT}; + QMAKE_EXTRA_TARGETS += jsonwrappersdecl + libretroshare.depends += jsonwrappersdecl + PRE_TARGETDEPS *= $${WRAPPERS_DECL_FILE} + + jsonwrappersdef.target = $${WRAPPERS_DEF_FILE} + jsonwrappersdef.commands = touch $${WRAPPERS_DEF_FILE} + jsonwrappersdef.depends = jsonwrappersdecl + QMAKE_EXTRA_TARGETS += jsonwrappersdef + libretroshare.depends += jsonwrappersdef + PRE_TARGETDEPS *= $${WRAPPERS_DEF_FILE} + + jsonwrappersreg.target = $${WRAPPERS_REG_FILE} + jsonwrappersreg.commands = touch $${WRAPPERS_REG_FILE} + jsonwrappersreg.depends = jsonwrappersdef + QMAKE_EXTRA_TARGETS += jsonwrappersreg + libretroshare.depends += jsonwrappersreg + PRE_TARGETDEPS *= $${WRAPPERS_REG_FILE} + + # Force recalculation of libretroshare dependencies see https://stackoverflow.com/a/47884045 + QMAKE_EXTRA_TARGETS += libretroshare + + HEADERS += jsonapi/jsonapi.h + SOURCES += jsonapi/jsonapi.cpp +} + diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index c75235f0e..ce394778d 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -6,7 +6,8 @@ * * RetroShare C++ Interface. * - * Copyright 2012-2012 by Robert Fernie. + * Copyright (C) 2012 by Robert Fernie. + * Copyright (C) 2018 Gioacchino Mazzurco * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -33,35 +34,47 @@ #include "retroshare/rstokenservice.h" #include "retroshare/rsgxsifacehelper.h" #include "retroshare/rsgxscommon.h" +#include "serialiser/rsserializable.h" - -/* The Main Interface Class - for information about your Peers */ class RsGxsChannels; -extern RsGxsChannels *rsGxsChannels; +/** + * Pointer to global instance of RsGxsChannels service implementation + * @jsonapi{development} + */ +extern RsGxsChannels* rsGxsChannels; // These should be in rsgxscommon.h - -class RsGxsChannelGroup +struct RsGxsChannelGroup : RsSerializable { - public: RsGroupMetaData mMeta; std::string mDescription; RsGxsImage mImage; bool mAutoDownload; + + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mMeta); + RS_SERIAL_PROCESS(mDescription); + //RS_SERIAL_PROCESS(mImage); + RS_SERIAL_PROCESS(mAutoDownload); + } }; -class RsGxsChannelPost +std::ostream &operator<<(std::ostream& out, const RsGxsChannelGroup& group); + + +struct RsGxsChannelPost : RsSerializable { -public: RsGxsChannelPost() : mCount(0), mSize(0) {} -public: RsMsgMetaData mMeta; - std::set mOlderVersions ; + std::set mOlderVersions; std::string mMsg; // UTF8 encoded. std::list mFiles; @@ -69,18 +82,31 @@ public: uint64_t mSize; // auto calced. RsGxsImage mThumbnail; + + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mMeta); + RS_SERIAL_PROCESS(mOlderVersions); + + RS_SERIAL_PROCESS(mMsg); + RS_SERIAL_PROCESS(mFiles); + RS_SERIAL_PROCESS(mCount); + RS_SERIAL_PROCESS(mSize); + //RS_SERIAL_PROCESS(mThumbnail); + } }; +std::ostream &operator<<(std::ostream& out, const RsGxsChannelPost& post); -std::ostream &operator<<(std::ostream &out, const RsGxsChannelGroup &group); -std::ostream &operator<<(std::ostream &out, const RsGxsChannelPost &post); class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService { - public: +public: explicit RsGxsChannels(RsGxsIface *gxs) - :RsGxsIfaceHelper(gxs) {} + :RsGxsIfaceHelper(gxs) {} virtual ~RsGxsChannels() {} /* Specific Service Data */ @@ -103,7 +129,16 @@ virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) = virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) = 0; virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory)=0; -virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory)=0; + + /** + * Get download directory for the given channel + * @jsonapi{development} + * @param[in] channelId id of the channel + * @param[out] directory reference to string where to store the path + * @return false on error, true otherwise + */ + virtual bool getChannelDownloadDirectory( const RsGxsGroupId& channelId, + std::string& directory ) = 0; //virtual void setChannelAutoDownload(uint32_t& token, const RsGxsGroupId& groupId, bool autoDownload) = 0; @@ -113,19 +148,59 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin //virtual bool groupRestoreKeys(const std::string &groupId); virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set& peers)=0; - // Overloaded subscribe fn. -virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) = 0; + /** + * @brief Request subscription to a group. + * The action is performed asyncronously, so it could fail in a subsequent + * phase even after returning true. + * @jsonapi{development} + * @param[out] token Storage for RsTokenService token to track request + * status. + * @param[in] groupId Channel id + * @param[in] subscribe + * @return false on error, true otherwise + */ + virtual bool subscribeToGroup( uint32_t& token, const RsGxsGroupId &groupId, + bool subscribe ) = 0; -virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group) = 0; -virtual bool createPost(uint32_t &token, RsGxsChannelPost &post) = 0; + /** + * @brief Request channel creation. + * The action is performed asyncronously, so it could fail in a subsequent + * phase even after returning true. + * @jsonapi{development} + * @param[out] token Storage for RsTokenService token to track request + * status. + * @param[in] group Channel data (name, description...) + * @return false on error, true otherwise + */ + virtual bool createGroup(uint32_t& token, RsGxsChannelGroup& group) = 0; -virtual bool updateGroup(uint32_t &token, RsGxsChannelGroup &group) = 0; + /** + * @brief Request post creation. + * The action is performed asyncronously, so it could fail in a subsequent + * phase even after returning true. + * @jsonapi{development} + * @param[out] token Storage for RsTokenService token to track request + * status. + * @param[in] post + * @return false on error, true otherwise + */ + virtual bool createPost(uint32_t& token, RsGxsChannelPost& post) = 0; + + /** + * @brief Request channel change. + * The action is performed asyncronously, so it could fail in a subsequent + * phase even after returning true. + * @jsonapi{development} + * @param[out] token Storage for RsTokenService token to track request + * status. + * @param[in] group Channel data (name, description...) with modifications + * @return false on error, true otherwise + */ + virtual bool updateGroup(uint32_t& token, RsGxsChannelGroup& group) = 0; // File Interface virtual bool ExtraFileHash(const std::string &path, std::string filename) = 0; virtual bool ExtraFileRemove(const RsFileHash &hash) = 0; - - }; diff --git a/libretroshare/src/retroshare/rsgxscommon.h b/libretroshare/src/retroshare/rsgxscommon.h index b1579e406..861299b6f 100644 --- a/libretroshare/src/retroshare/rsgxscommon.h +++ b/libretroshare/src/retroshare/rsgxscommon.h @@ -31,28 +31,39 @@ #include #include "rsgxsifacetypes.h" +#include "serialiser/rsserializable.h" -class RsGxsFile +struct RsGxsFile : RsSerializable { - public: RsGxsFile(); std::string mName; RsFileHash mHash; uint64_t mSize; - //std::string mPath; + + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mName); + RS_SERIAL_PROCESS(mHash); + RS_SERIAL_PROCESS(mSize); + } }; -class RsGxsImage +struct RsGxsImage { - public: - RsGxsImage(); + RsGxsImage(); ~RsGxsImage(); - RsGxsImage(const RsGxsImage& a); // TEMP use copy constructor and duplicate memory. -RsGxsImage &operator=(const RsGxsImage &a); // Need this as well? -//NB: Must make sure that we always use methods - to be consistent about malloc/free for this data. -static uint8_t *allocate(uint32_t size); -static void release(void *data); + /// Use copy constructor and duplicate memory. + RsGxsImage(const RsGxsImage& a); + + RsGxsImage &operator=(const RsGxsImage &a); // Need this as well? + + /** NB: Must make sure that we always use methods - to be consistent about + * malloc/free for this data. */ + static uint8_t *allocate(uint32_t size); + static void release(void *data); void take(uint8_t *data, uint32_t size); // Copies Pointer. void copy(uint8_t *data, uint32_t size); // Allocates and Copies. @@ -61,7 +72,6 @@ static void release(void *data); uint8_t *mData; uint32_t mSize; - }; diff --git a/libretroshare/src/retroshare/rsgxsifacetypes.h b/libretroshare/src/retroshare/rsgxsifacetypes.h index 071b6bd46..6e755bd89 100644 --- a/libretroshare/src/retroshare/rsgxsifacetypes.h +++ b/libretroshare/src/retroshare/rsgxsifacetypes.h @@ -124,7 +124,7 @@ struct RsGroupMetaData : RsSerializable -struct RsMsgMetaData +struct RsMsgMetaData : RsSerializable { RsMsgMetaData() : mPublishTs(0), mMsgFlags(0), mMsgStatus(0), mChildTs(0) {} @@ -155,6 +155,24 @@ struct RsMsgMetaData time_t mChildTs; std::string mServiceString; // Service Specific Free-Form extra storage. + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mGroupId); + RS_SERIAL_PROCESS(mMsgId); + RS_SERIAL_PROCESS(mThreadId); + RS_SERIAL_PROCESS(mParentId); + RS_SERIAL_PROCESS(mOrigMsgId); + RS_SERIAL_PROCESS(mAuthorId); + RS_SERIAL_PROCESS(mMsgName); + RS_SERIAL_PROCESS(mPublishTs); + RS_SERIAL_PROCESS(mMsgFlags); + RS_SERIAL_PROCESS(mMsgStatus); + RS_SERIAL_PROCESS(mChildTs); + RS_SERIAL_PROCESS(mServiceString); + } + const std::ostream &print(std::ostream &out, std::string indent = "", std::string varName = "") const { out << indent << varName << " of RsMsgMetaData Values ###################" << std::endl diff --git a/libretroshare/src/serialiser/rsserializer.cc b/libretroshare/src/serialiser/rsserializer.cc index 164f31342..da0472786 100644 --- a/libretroshare/src/serialiser/rsserializer.cc +++ b/libretroshare/src/serialiser/rsserializer.cc @@ -35,6 +35,7 @@ const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_NONE ( 0 const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_CONFIG ( 0x0001 ); const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_SIGNATURE ( 0x0002 ); const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_SKIP_HEADER ( 0x0004 ); +const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_YIELDING ( 0x0008 ); RsItem *RsServiceSerializer::deserialise(void *data, uint32_t *size) { diff --git a/libretroshare/src/serialiser/rsserializer.h b/libretroshare/src/serialiser/rsserializer.h index 35dc091c3..8ce5a2efe 100644 --- a/libretroshare/src/serialiser/rsserializer.h +++ b/libretroshare/src/serialiser/rsserializer.h @@ -225,7 +225,7 @@ struct RsGenericSerializer : RsSerialType /** Allow shared allocator usage to avoid costly JSON deepcopy for * nested RsSerializable */ SerializeContext( - uint8_t *data, uint32_t size, + uint8_t* data = nullptr, uint32_t size = 0, SerializationFlags flags = SERIALIZATION_FLAG_NONE, RsJson::AllocatorType* allocator = nullptr) : mData(data), mSize(size), mOffset(0), mOk(true), mFlags(flags), @@ -260,6 +260,12 @@ struct RsGenericSerializer : RsSerialType static const SerializationFlags SERIALIZATION_FLAG_SIGNATURE; // 0x0002 static const SerializationFlags SERIALIZATION_FLAG_SKIP_HEADER; // 0x0004 + /** Used for JSON deserialization in JSON API, it causes the deserialization + * to continue even if some field is missing (or incorrect), this way the + * API is more user friendly as some methods need just part of the structs + * they take as parameters. */ + static const SerializationFlags SERIALIZATION_FLAG_YIELDING; // 0x0008 + /** * The following functions overload RsSerialType. * They *should not* need to be further overloaded. diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index e7faa5b52..ac3d0c6e9 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -42,7 +42,8 @@ //static const uint32_t MAX_SERIALIZED_ARRAY_SIZE = 500 ; static const uint32_t MAX_SERIALIZED_CHUNK_SIZE = 10*1024*1024 ; // 10 MB. -#define SAFE_GET_JSON_V() \ +#ifdef RSSERIAL_DEBUG +# define SAFE_GET_JSON_V() \ const char* mName = memberName.c_str(); \ bool ret = jDoc.HasMember(mName); \ if(!ret) \ @@ -50,10 +51,16 @@ static const uint32_t MAX_SERIALIZED_CHUNK_SIZE = 10*1024*1024 ; // 10 MB. std::cerr << __PRETTY_FUNCTION__ << " \"" << memberName \ << "\" not found in JSON:" << std::endl \ << jDoc << std::endl << std::endl; \ - print_stacktrace(); \ return false; \ } \ rapidjson::Value& v = jDoc[mName] +#else // ifdef RSSERIAL_DEBUG +# define SAFE_GET_JSON_V() \ + const char* mName = memberName.c_str(); \ + bool ret = jDoc.HasMember(mName); \ + if(!ret) return false; \ + rapidjson::Value& v = jDoc[mName] +#endif // ifdef RSSERIAL_DEBUG //============================================================================// diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index 3e3c0b251..d809ecd54 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -57,9 +57,7 @@ { \ /* Use same allocator to avoid deep copy */\ RsGenericSerializer::SerializeContext elCtx(\ - nullptr, 0, RsGenericSerializer::FORMAT_BINARY,\ - RsGenericSerializer::SERIALIZATION_FLAG_NONE,\ - &allocator );\ + nullptr, 0, ctx.mFlags, &allocator );\ \ /* If el is const the default serial_process template is matched */ \ /* also when specialization is necessary so the compilation break */ \ @@ -85,7 +83,7 @@ {\ using namespace rapidjson;\ \ - bool& ok(ctx.mOk);\ + bool ok = ctx.mOk || ctx.mFlags & RsGenericSerializer::SERIALIZATION_FLAG_YIELDING;\ Document& jDoc(ctx.mJson);\ Document::AllocatorType& allocator = jDoc.GetAllocator();\ \ @@ -100,19 +98,21 @@ for (auto&& arrEl : jDoc[arrKey].GetArray())\ {\ RsGenericSerializer::SerializeContext elCtx(\ - nullptr, 0, RsGenericSerializer::FORMAT_BINARY,\ - RsGenericSerializer::SERIALIZATION_FLAG_NONE,\ - &allocator );\ + nullptr, 0, ctx.mFlags, &allocator );\ elCtx.mJson.AddMember(arrKey, arrEl, allocator);\ \ T el;\ serial_process(j, elCtx, el, memberName); \ ok = ok && elCtx.mOk;\ \ + ctx.mOk &= ok;\ if(ok) v.INSERT_FUN(el);\ else break;\ }\ }\ +\ + ctx.mOk = false;\ +\ } while(false) std::ostream &operator<<(std::ostream &out, const RsJson &jDoc); @@ -133,8 +133,8 @@ struct RsTypeSerializer template typename std::enable_if::value || !(std::is_base_of::value || std::is_enum::value || std::is_base_of::value)>::type static /*void*/ serial_process( RsGenericSerializer::SerializeJob j, - RsGenericSerializer::SerializeContext& ctx, - T& member, const std::string& member_name) + RsGenericSerializer::SerializeContext& ctx, + T& member, const std::string& member_name ) { switch(j) { @@ -156,7 +156,8 @@ struct RsTypeSerializer ctx.mOk = ctx.mOk && to_JSON(member_name, member, ctx.mJson); break; case RsGenericSerializer::FROM_JSON: - ctx.mOk = ctx.mOk && from_JSON(member_name, member, ctx.mJson); + ctx.mOk &= (ctx.mOk || ctx.mFlags & RsGenericSerializer::SERIALIZATION_FLAG_YIELDING) + && from_JSON(member_name, member, ctx.mJson); break; default: std::cerr << __PRETTY_FUNCTION__ << " Unknown serial job: " @@ -194,8 +195,9 @@ struct RsTypeSerializer to_JSON(member_name, type_id, member, ctx.mJson); break; case RsGenericSerializer::FROM_JSON: - ctx.mOk = ctx.mOk && - from_JSON(member_name, type_id, member, ctx.mJson); + ctx.mOk &= + (ctx.mOk || ctx.mFlags & RsGenericSerializer::SERIALIZATION_FLAG_YIELDING) + && from_JSON(member_name, type_id, member, ctx.mJson); break; default: std::cerr << __PRETTY_FUNCTION__ << " Unknown serial job: " @@ -287,15 +289,11 @@ struct RsTypeSerializer { // Use same allocator to avoid deep copy RsGenericSerializer::SerializeContext kCtx( - nullptr, 0, RsGenericSerializer::FORMAT_BINARY, - RsGenericSerializer::SERIALIZATION_FLAG_NONE, - &allocator ); + nullptr, 0, ctx.mFlags, &allocator ); serial_process(j, kCtx, const_cast(kv.first), "key"); RsGenericSerializer::SerializeContext vCtx( - nullptr, 0, RsGenericSerializer::FORMAT_BINARY, - RsGenericSerializer::SERIALIZATION_FLAG_NONE, - &allocator ); + nullptr, 0, ctx.mFlags, &allocator ); serial_process(j, vCtx, const_cast(kv.second), "value"); if(kCtx.mOk && vCtx.mOk) @@ -316,7 +314,7 @@ struct RsTypeSerializer { using namespace rapidjson; - bool& ok(ctx.mOk); + bool ok = ctx.mOk || ctx.mFlags & RsGenericSerializer::SERIALIZATION_FLAG_YIELDING; Document& jDoc(ctx.mJson); Document::AllocatorType& allocator = jDoc.GetAllocator(); @@ -336,9 +334,7 @@ struct RsTypeSerializer if (!ok) break; RsGenericSerializer::SerializeContext kCtx( - nullptr, 0, RsGenericSerializer::FORMAT_BINARY, - RsGenericSerializer::SERIALIZATION_FLAG_NONE, - &allocator ); + nullptr, 0, ctx.mFlags, &allocator ); if(ok) kCtx.mJson.AddMember("key", kvEl["key"], allocator); @@ -346,9 +342,7 @@ struct RsTypeSerializer ok = ok && (serial_process(j, kCtx, key, "key"), kCtx.mOk); RsGenericSerializer::SerializeContext vCtx( - nullptr, 0, RsGenericSerializer::FORMAT_BINARY, - RsGenericSerializer::SERIALIZATION_FLAG_NONE, - &allocator ); + nullptr, 0, ctx.mFlags, &allocator ); if(ok) vCtx.mJson.AddMember("value", kvEl["value"], allocator); @@ -356,14 +350,20 @@ struct RsTypeSerializer ok = ok && ( serial_process(j, vCtx, value, "value"), vCtx.mOk ); + ctx.mOk &= ok; if(ok) v.insert(std::pair(key,value)); else break; } } + ctx.mOk = false; break; } - default: break; + default: + std::cerr << __PRETTY_FUNCTION__ << " Unknown serial job: " + << static_cast::type>(j) + << std::endl; + exit(EINVAL); } } @@ -566,7 +566,9 @@ struct RsTypeSerializer case RsGenericSerializer::FROM_JSON: { uint32_t f; - ctx.mOk = from_JSON(memberName, f, ctx.mJson); + ctx.mOk &= + (ctx.mOk || ctx.mFlags & RsGenericSerializer::SERIALIZATION_FLAG_YIELDING) + && from_JSON(memberName, f, ctx.mJson); v = t_RsFlags32(f); break; } @@ -623,9 +625,7 @@ struct RsTypeSerializer // Reuse allocator to avoid deep copy later RsGenericSerializer::SerializeContext lCtx( - nullptr, 0, RsGenericSerializer::FORMAT_BINARY, - RsGenericSerializer::SERIALIZATION_FLAG_NONE, - &allocator ); + nullptr, 0, ctx.mFlags, &allocator ); member.serial_process(j, lCtx); @@ -642,28 +642,32 @@ struct RsTypeSerializer } case RsGenericSerializer::FROM_JSON: { - rapidjson::Document& jDoc(ctx.mJson); + RsJson& jDoc(ctx.mJson); const char* mName = memberName.c_str(); - ctx.mOk = ctx.mOk && jDoc.HasMember(mName); + bool hasMember = jDoc.HasMember(mName); + bool yielding = ctx.mFlags & + RsGenericSerializer::SERIALIZATION_FLAG_YIELDING; - if(!ctx.mOk) + if(!hasMember) { - std::cerr << __PRETTY_FUNCTION__ << " \"" << memberName - << "\" not found in JSON:" << std::endl - << jDoc << std::endl << std::endl; - print_stacktrace(); + if(!yielding) + { + std::cerr << __PRETTY_FUNCTION__ << " \"" << memberName + << "\" not found in JSON:" << std::endl + << jDoc << std::endl << std::endl; + print_stacktrace(); + } + ctx.mOk = false; break; } rapidjson::Value& v = jDoc[mName]; - RsGenericSerializer::SerializeContext lCtx( - nullptr, 0, RsGenericSerializer::FORMAT_BINARY, - RsGenericSerializer::SERIALIZATION_FLAG_NONE ); + RsGenericSerializer::SerializeContext lCtx(nullptr, 0, ctx.mFlags); lCtx.mJson.SetObject() = v; // Beware of move semantic!! member.serial_process(j, lCtx); - ctx.mOk = ctx.mOk && lCtx.mOk; + ctx.mOk &= lCtx.mOk; break; } diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index d17e36739..9971cea7d 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -17,6 +17,18 @@ sLibs = mLibs = $$RS_SQL_LIB ssl crypto $$RS_THREAD_LIB $$RS_UPNP_LIB dLibs = +rs_jsonapi { + RS_SRC_PATH=$$system_path($$clean_path($${PWD}/../../)) + RS_BUILD_PATH=$$system_path($$clean_path($${OUT_PWD}/../../)) + RESTBED_SRC_PATH=$$system_path($$clean_path($${RS_SRC_PATH}/supportlibs/restbed)) + RESTBED_BUILD_PATH=$$system_path($$clean_path($${RS_BUILD_PATH}/supportlibs/restbed)) + + INCLUDEPATH *= $$system_path($$clean_path($${RESTBED_BUILD_PATH}/include/)) + QMAKE_LIBDIR *= $$system_path($$clean_path($${RESTBED_BUILD_PATH}/library/)) + # Using sLibs would fail as librestbed.a is generated at compile-time + LIBS *= -L$$system_path($$clean_path($${RESTBED_BUILD_PATH}/library/)) -lrestbed +} + linux-* { mLibs += dl } diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index aea611312..140310be1 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -22,6 +22,9 @@ resource_api::ApiServerMHD* WebuiPage::apiServerMHD = 0; resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0; #endif resource_api::RsControlModule* WebuiPage::controlModule = 0; +#ifdef RS_JSONAPI +JsonApiServer* WebuiPage::jsonApiServer = nullptr; +#endif WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) { @@ -105,6 +108,10 @@ QString WebuiPage::helpText() const // TODO: LIBRESAPI_LOCAL_SERVER Move in appropriate place #ifdef LIBRESAPI_LOCAL_SERVER apiServerLocal = new resource_api::ApiServerLocal(apiServer, resource_api::ApiServerLocal::serverPath()); +#endif +#ifdef RS_JSONAPI + jsonApiServer = new JsonApiServer(9092); + jsonApiServer->start("WebuiPage::jsonApiServer"); #endif return ok; } @@ -126,6 +133,10 @@ QString WebuiPage::helpText() const delete controlModule; controlModule = 0; } +#ifdef RS_JSONAPI + delete jsonApiServer; + jsonApiServer = nullptr; +#endif } /*static*/ void WebuiPage::showWebui() diff --git a/retroshare-gui/src/gui/settings/WebuiPage.h b/retroshare-gui/src/gui/settings/WebuiPage.h index 66af0327b..78961c98d 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.h +++ b/retroshare-gui/src/gui/settings/WebuiPage.h @@ -3,6 +3,10 @@ #include #include "ui_WebuiPage.h" +#ifdef RS_JSONAPI +# include "jsonapi/jsonapi.h" +#endif + namespace resource_api{ class ApiServer; class ApiServerMHD; @@ -55,4 +59,7 @@ private: static resource_api::ApiServerLocal* apiServerLocal; #endif static resource_api::RsControlModule* controlModule; +#ifdef RS_JSONAPI + static JsonApiServer* jsonApiServer; +#endif }; diff --git a/retroshare.pri b/retroshare.pri index 111530a39..81c7c8a28 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -115,6 +115,12 @@ rs_macos10.9:CONFIG -= rs_macos10.11 rs_macos10.10:CONFIG -= rs_macos10.11 rs_macos10.12:CONFIG -= rs_macos10.11 +# To enable JSON API append the following assignation to qmake command line +# "CONFIG+=rs_jsonapi" +CONFIG *= no_rs_jsonapi +rs_jsonapi:CONFIG -= no_rs_jsonapi + + ########################################################################################################################################################### # # V07_NON_BACKWARD_COMPATIBLE_CHANGE_001: @@ -157,7 +163,7 @@ rs_v07_changes { } ################################################################################ -## RetroShare qmake functions goes here as all the rest may use them ########### +## RetroShare qmake functions goes here as all the rest may use them. ########## ################################################################################ ## Qt versions older the 5 are not supported anymore, check if the user is @@ -273,7 +279,12 @@ no_sqlcipher { rs_autologin { DEFINES *= RS_AUTOLOGIN - warning("You have enabled RetroShare auto-login, this is discouraged. The usage of auto-login on some linux distributions may allow someone having access to your session to steal the SSL keys of your node location and therefore compromise your security") + RS_AUTOLOGIN_WARNING_MSG = \ + You have enabled RetroShare auto-login, this is discouraged. The usage \ + of auto-login on some linux distributions may allow someone having \ + access to your session to steal the SSL keys of your node location and \ + therefore compromise your security + warning("$${RS_AUTOLOGIN_WARNING_MSG}") } rs_onlyhiddennode { @@ -313,6 +324,10 @@ rs_chatserver { DEFINES *= RS_CHATSERVER } +rs_jsonapi { + DEFINES *= RS_JSONAPI +} + debug { QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer QMAKE_CFLAGS -= -O2 -fomit-frame-pointer diff --git a/supportlibs/restbed b/supportlibs/restbed new file mode 160000 index 000000000..c27c6726d --- /dev/null +++ b/supportlibs/restbed @@ -0,0 +1 @@ +Subproject commit c27c6726d28c42e2e1b7537ba63eeb23e944789d From e351d7257ebf1489ef491589617c2df71ce3df23 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 24 Jun 2018 16:55:38 +0200 Subject: [PATCH 080/213] added retrieval of search results in UI --- libretroshare/src/gxs/rsgenexchange.cc | 9 ----- libretroshare/src/gxs/rsgenexchange.h | 11 +++--- libretroshare/src/gxs/rsgxsnetservice.cc | 36 ++++++++++--------- libretroshare/src/gxs/rsgxsnetservice.h | 12 ++----- libretroshare/src/gxs/rsnxs.h | 30 ++++++---------- libretroshare/src/retroshare/rsgxschannels.h | 4 +-- libretroshare/src/retroshare/rsgxsiface.h | 20 +++++++++++ libretroshare/src/services/p3gxschannels.cc | 10 ++++++ libretroshare/src/services/p3gxschannels.h | 2 ++ .../src/gui/gxs/GxsGroupFrameDialog.cpp | 11 ++++++ .../src/gui/gxs/GxsGroupFrameDialog.h | 1 + .../src/gui/gxschannels/GxsChannelDialog.cpp | 5 +++ .../src/gui/gxschannels/GxsChannelDialog.h | 1 + 13 files changed, 87 insertions(+), 65 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 43e515732..8a199331c 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1844,15 +1844,6 @@ uint32_t RsGenExchange::getSyncPeriod(const RsGxsGroupId& grpId) return RS_GXS_DEFAULT_MSG_REQ_PERIOD; } -bool RsGenExchange::getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos) -{ - return (mNetService!=NULL) && mNetService->getDistantSearchResults(id,group_infos) ; -} -bool RsGenExchange::clearDistantSearchResults(const TurtleRequestId& id) -{ - return (mNetService!=NULL) && mNetService->clearDistantSearchResults(id) ; -} - bool RsGenExchange::getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats) { return (!mNetService) || mNetService->getGroupNetworkStats(grpId,stats) ; diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index e08ba80bd..805ab5c26 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -121,9 +121,9 @@ public: virtual ~RsGenExchange(); - // Convention that this is implemented here. + // Convention that this is implemented here. // and passes to network service. - virtual RsServiceInfo getServiceInfo() = 0; + virtual RsServiceInfo getServiceInfo() = 0; void setNetworkExchangeService(RsNetworkExchangeService *ns) ; @@ -581,7 +581,7 @@ public: * @param msgs */ void deleteMsgs(uint32_t& token, const GxsMsgReq& msgs); - + protected: /*! * This represents the group before its signature is calculated @@ -665,7 +665,7 @@ public: */ void shareGroupPublishKey(const RsGxsGroupId& grpId,const std::set& peers) ; - + /*! * Returns the local TS of the group as known by the network service. * This is useful to allow various network services to sync their update TS @@ -688,9 +688,6 @@ public: virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ; virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats); - virtual bool getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos) ; - virtual bool clearDistantSearchResults(const TurtleRequestId& id); - uint16_t serviceType() const { return mServType ; } uint32_t serviceFullType() const { return ((uint32_t)mServType << 8) + (((uint32_t) RS_PKT_VERSION_SERVICE) << 24); } diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 2ac77b279..480e9dc2e 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5117,6 +5117,25 @@ static bool termSearch(const std::string& src, const std::string& substring) /* always ignore case */ return src.end() != std::search( src.begin(), src.end(), substring.begin(), substring.end(), RsRegularExpression::CompareCharIC() ); } + +bool RsGxsNetService::retrieveDistantSearchResults(TurtleRequestId req,std::map& group_infos) +{ + RS_STACK_MUTEX(mNxsMutex) ; + + auto it = mDistantSearchResults.find(req) ; + + if(it == mDistantSearchResults.end()) + return false ; + + group_infos = it->second; + return true ; +} +bool RsGxsNetService::clearDistantSearchResults(const TurtleRequestId& id) +{ + RS_STACK_MUTEX(mNxsMutex) ; + mDistantSearchResults.erase(id); + return true ; +} void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std::list& group_infos) { RS_STACK_MUTEX(mNxsMutex) ; @@ -5179,21 +5198,4 @@ bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) -{ - RS_STACK_MUTEX(mNxsMutex) ; - auto it = mDistantSearchResults.find(id) ; - if(it == mDistantSearchResults.end()) - return false ; - - for(auto it2(it->second.begin());it2!=it->second.end();++it2) - group_infos.push_back(it2->second); - return true; -} -bool RsGxsNetService::clearDistantSearchResults(const TurtleRequestId& id) -{ - RS_STACK_MUTEX(mNxsMutex) ; - mDistantSearchResults.erase(id); - return true ; -} diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 799a2b503..05031feb3 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -132,6 +132,8 @@ public: virtual bool search(const std::string& substring,std::list& group_infos) ; virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos); + virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &group_infos); + virtual bool clearDistantSearchResults(const TurtleRequestId& id); /*! * pauses synchronisation of subscribed groups and request for group id @@ -170,16 +172,6 @@ public: */ virtual bool getGroupNetworkStats(const RsGxsGroupId& id,RsGroupNetworkStats& stats) ; - /*! - * \brief getDistantSearchResults - * \param id Id of the search request previously issued - * \param group_infos Groups currently known for this search request. - * \return - * false if the id does not correspond to an ongoing distant search request. - */ - virtual bool getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos) ; - virtual bool clearDistantSearchResults(const TurtleRequestId& id); - /*! * Used to inform the net service that we changed subscription status. That helps * optimising data transfer when e.g. unsubsribed groups are updated less often, etc diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 3f1cc9e25..b483e5748 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -60,25 +60,6 @@ * - the also group matrix settings which is by default everyone can transfer to each other */ -/*! - * \brief The RsGxsGroupSymmary struct - * This structure is used to transport group summary information when a GXS service is searched. It contains the group information - * as well as a context string to tell where the information was found. It is more compact than a GroupMeta object, so as to make - * search responses as light as possible. - */ -struct RsGxsGroupSummary -{ - RsGxsGroupId group_id ; - - std::string group_name ; - std::string group_description ; - std::string search_context ; - RsGxsId author_id ; - time_t publish_ts ; - uint32_t number_of_messages ; - time_t last_message_ts ; -}; - class RsNetworkExchangeService { public: @@ -132,13 +113,22 @@ public: * \param group_infos Group summary information for the groups returned by the search */ virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos)=0; + + /*! + * \brief retrieveTurtleSearchResults + * To be used to retrieve the search results that have been notified (or not) + * \param req request that match the results to retrieve + * \param group_infos results to retrieve. + * \return + * false when the request is unknown. + */ + virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &group_infos)=0; /*! * \brief getDistantSearchResults * \param id * \param group_infos * \return */ - virtual bool getDistantSearchResults(const TurtleRequestId& id,std::list& group_infos)=0 ; virtual bool clearDistantSearchResults(const TurtleRequestId& id)=0; virtual bool search(const std::string& substring,std::list& group_infos) =0; diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index 6bad3ba21..af08f4bb4 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -35,8 +35,6 @@ #include "retroshare/rsgxscommon.h" #include "retroshare/rsturtle.h" - - /* The Main Interface Class - for information about your Peers */ class RsGxsChannels; extern RsGxsChannels *rsGxsChannels; @@ -99,6 +97,8 @@ virtual bool getPostData(const uint32_t &token, std::vector &p virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)=0; virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; + virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &results) =0; + virtual bool clearDistantSearchResults(TurtleRequestId req)=0; ////////////////////////////////////////////////////////////////////////////// virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index b9c974f9c..e822d70d4 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -32,6 +32,26 @@ #include "gxs/rsgxsdata.h" #include "retroshare/rsgxsifacetypes.h" +/*! + * \brief The RsGxsGroupSymmary struct + * This structure is used to transport group summary information when a GXS service is searched. It contains the group information + * as well as a context string to tell where the information was found. It is more compact than a GroupMeta object, so as to make + * search responses as light as possible. + */ +struct RsGxsGroupSummary +{ + RsGxsGroupId group_id ; + + std::string group_name ; + std::string group_description ; + std::string search_context ; + RsGxsId author_id ; + time_t publish_ts ; + uint32_t number_of_messages ; + time_t last_message_ts ; +}; + + /*! * Stores ids of changed gxs groups and messages. It is used to notify the GUI about changes. */ diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index de4bb1fe6..e4f89861e 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1696,3 +1696,13 @@ TurtleRequestId p3GxsChannels::turtleSearchRequest(const std::string& match_stri return netService()->turtleSearchRequest(match_string) ; } +bool p3GxsChannels::clearDistantSearchResults(TurtleRequestId req) +{ + return netService()->clearDistantSearchResults(req); +} +bool p3GxsChannels::retrieveDistantSearchResults(TurtleRequestId req,std::map& results) +{ + return netService()->retrieveDistantSearchResults(req,results); +} + + diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index 961c05fa6..2243e57ee 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -74,6 +74,8 @@ virtual void service_tick(); virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id); virtual TurtleRequestId turtleSearchRequest(const std::string& match_string); + virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &results) ; + virtual bool clearDistantSearchResults(TurtleRequestId req); // Overloaded to cache new groups. virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index a8b6e6344..598bd35fc 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -254,7 +254,18 @@ void GxsGroupFrameDialog::updateSearchResults() const std::set& reqs = getSearchResults(); for(auto it(reqs.begin());it!=reqs.end();++it) + { std::cerr << "updating search ID " << std::hex << *it << std::dec << std::endl; + + std::map group_infos; + + getDistantSearchResults(*it,group_infos) ; + + std::cerr << "retrieved " << std::endl; + + for(auto it2(group_infos.begin());it2!=group_infos.end();++it2) + std::cerr << " " << it2->first << " " << it2->second.group_id << " \"" << it2->second.group_name << "\"" << std::endl; + } } void GxsGroupFrameDialog::todo() diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index f8db16a10..ac04edf59 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -148,6 +148,7 @@ private: virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList &/*actions*/) {} virtual RsGxsCommentService *getCommentService() { return NULL; } virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; } + virtual bool getDistantSearchResults(TurtleRequestId id, std::map& group_infos){ return false ;} void initUi(); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index acd9dae0e..160119ee2 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -341,3 +341,8 @@ TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string) { return rsGxsChannels->turtleSearchRequest(search_string.toStdString()) ; } + +bool GxsChannelDialog::getDistantSearchResults(TurtleRequestId id, std::map& group_infos) +{ + return rsGxsChannels->retrieveDistantSearchResults(id,group_infos); +} diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h index 3864fba13..38b27d805 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h @@ -50,6 +50,7 @@ protected: virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Channel; } virtual QString getHelpString() const ; virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata); + virtual bool getDistantSearchResults(TurtleRequestId id, std::map& group_infos); virtual TurtleRequestId distantSearch(const QString& search_string) ; private slots: From ec95b6d054b459cd7067cc944b45492d8680052e Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 24 Jun 2018 18:03:26 +0200 Subject: [PATCH 081/213] Remove unused misleading GXS request status Something must be really strange to be finished and incomplete at same time.. --- libretroshare/src/gxs/rsgxsdataaccess.cc | 1 - libretroshare/src/retroshare/rstokenservice.h | 1 - 2 files changed, 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 77c0d05d9..4e86e323d 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -33,7 +33,6 @@ const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FAILED = 0; const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PENDING = 1; const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PARTIAL = 2; - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FINISHED_INCOMPLETE = 3; const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE = 4; const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_DONE = 5; // ONCE ALL DATA RETRIEVED. const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_CANCELLED = 6; diff --git a/libretroshare/src/retroshare/rstokenservice.h b/libretroshare/src/retroshare/rstokenservice.h index 079f34023..a720b93d2 100644 --- a/libretroshare/src/retroshare/rstokenservice.h +++ b/libretroshare/src/retroshare/rstokenservice.h @@ -127,7 +127,6 @@ public: static const uint8_t GXS_REQUEST_V2_STATUS_FAILED; static const uint8_t GXS_REQUEST_V2_STATUS_PENDING; static const uint8_t GXS_REQUEST_V2_STATUS_PARTIAL; - static const uint8_t GXS_REQUEST_V2_STATUS_FINISHED_INCOMPLETE; static const uint8_t GXS_REQUEST_V2_STATUS_COMPLETE; static const uint8_t GXS_REQUEST_V2_STATUS_DONE; // ONCE ALL DATA RETRIEVED. static const uint8_t GXS_REQUEST_V2_STATUS_CANCELLED; From b4d2ce82c116b914803705592ebe6479f1c79e22 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 24 Jun 2018 18:56:48 +0200 Subject: [PATCH 082/213] RsTokenService use enum for request status --- libresapi/src/api/ChannelsHandler.cpp | 42 +++++----- libresapi/src/api/ForumHandler.cpp | 12 +-- libresapi/src/api/GxsResponseTask.cpp | 4 +- libresapi/src/api/IdentityHandler.cpp | 26 +++--- libretroshare/src/gxs/gxstokenqueue.cc | 4 +- libretroshare/src/gxs/rsgenexchange.cc | 24 +++--- libretroshare/src/gxs/rsgxsdataaccess.cc | 82 +++++++++---------- libretroshare/src/retroshare/rstokenservice.h | 21 ++--- libretroshare/src/services/p3gxschannels.cc | 4 +- libretroshare/src/services/p3gxscircles.cc | 4 +- libretroshare/src/services/p3gxscommon.cc | 2 +- libretroshare/src/services/p3gxsforums.cc | 4 +- libretroshare/src/services/p3idservice.cc | 8 +- libretroshare/src/services/p3wiki.cc | 6 +- plugins/FeedReader/services/p3FeedReader.cc | 4 +- .../src/gui/gxsforums/GxsForumsFillThread.cpp | 8 +- retroshare-gui/src/util/TokenQueue.cpp | 4 +- .../gxs/gen_exchange/genexchangetester.cc | 12 +-- .../libretroshare/services/gxs/GxsPeerNode.cc | 24 +++--- .../services/gxs/nxsbasic_test.cc | 4 +- 20 files changed, 146 insertions(+), 153 deletions(-) diff --git a/libresapi/src/api/ChannelsHandler.cpp b/libresapi/src/api/ChannelsHandler.cpp index c79d693b1..856594048 100644 --- a/libresapi/src/api/ChannelsHandler.cpp +++ b/libresapi/src/api/ChannelsHandler.cpp @@ -71,12 +71,12 @@ void ChannelsHandler::handleListChannels(Request& /*req*/, Response& resp) tChannels.requestGroupInfo(token, RS_DEPRECATED_TOKREQ_ANSTYPE, opts); time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) + &&(tChannels.requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); std::list grps; - if( tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE + if( tChannels.requestStatus(token) == RsTokenService::COMPLETE && mChannels.getGroupSummary(token, grps) ) { for( RsGroupMetaData& grp : grps ) @@ -136,12 +136,12 @@ void ChannelsHandler::handleGetChannelInfo(Request& req, Response& resp) opts, groupIds ); time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) + &&(tChannels.requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); std::vector grps; - if( tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE + if( tChannels.requestStatus(token) == RsTokenService::COMPLETE && mChannels.getGroupData(token, grps) ) { for( RsGxsChannelGroup& grp : grps ) @@ -210,14 +210,14 @@ void ChannelsHandler::handleGetChannelContent(Request& req, Response& resp) } time_t start = time(NULL); - while((mChannels.getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(mChannels.getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((mChannels.getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) + &&(mChannels.getTokenService()->requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); std::vector posts; std::vector comments; if( mChannels.getTokenService()->requestStatus(token) == - RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE && + RsTokenService::COMPLETE && mChannels.getPostData(token, posts, comments) ) { for( std::vector::iterator vit = posts.begin(); @@ -286,11 +286,11 @@ void ChannelsHandler::handleToggleSubscription(Request& req, Response& resp) RsTokenService& tChannels = *mChannels.getTokenService(); time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) + &&(tChannels.requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) resp.setOk(); else resp.setFail("Unknown GXS error!"); } @@ -353,11 +353,11 @@ void ChannelsHandler::handleCreateChannel(Request& req, Response& resp) RsTokenService& tChannels = *mChannels.getTokenService(); time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) + &&(tChannels.requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) resp.setOk(); else resp.setFail("Unknown GXS error!"); } @@ -436,11 +436,11 @@ void ChannelsHandler::handleTogglePostRead(Request& req, Response& resp) RsTokenService& tChannels = *mChannels.getTokenService(); time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) + &&(tChannels.requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) resp.setOk(); else resp.setFail("Unknown GXS error!"); } @@ -522,11 +522,11 @@ void ChannelsHandler::handleCreatePost(Request &req, Response &resp) RsTokenService& tChannels = *mChannels.getTokenService(); time_t start = time(NULL); - while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((tChannels.requestStatus(token) != RsTokenService::COMPLETE) + &&(tChannels.requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000); - if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(tChannels.requestStatus(token) == RsTokenService::COMPLETE) resp.setOk(); else resp.setFail("Unknown GXS error!"); } diff --git a/libresapi/src/api/ForumHandler.cpp b/libresapi/src/api/ForumHandler.cpp index fa7562691..2304a68ff 100644 --- a/libresapi/src/api/ForumHandler.cpp +++ b/libresapi/src/api/ForumHandler.cpp @@ -38,8 +38,8 @@ void ForumHandler::handleWildcard(Request &req, Response &resp) mRsGxsForums->getTokenService()->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds); time_t start = time(NULL); - while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) + &&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10))) ) { @@ -50,7 +50,7 @@ void ForumHandler::handleWildcard(Request &req, Response &resp) #endif } - if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE) { std::vector grps; ok &= mRsGxsForums->getMsgData(token, grps); @@ -86,8 +86,8 @@ void ForumHandler::handleWildcard(Request &req, Response &resp) mRsGxsForums->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); time_t start = time(NULL); - while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) + &&(mRsGxsForums->getTokenService()->requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10))) ) { @@ -97,7 +97,7 @@ void ForumHandler::handleWildcard(Request &req, Response &resp) usleep(500*1000) ; #endif } - if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(mRsGxsForums->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE) { std::vector grps; ok &= mRsGxsForums->getGroupData(token, grps); diff --git a/libresapi/src/api/GxsResponseTask.cpp b/libresapi/src/api/GxsResponseTask.cpp index dcb4ebb51..0605c63c9 100644 --- a/libresapi/src/api/GxsResponseTask.cpp +++ b/libresapi/src/api/GxsResponseTask.cpp @@ -21,11 +21,11 @@ bool GxsResponseTask::doWork(Request &req, Response &resp) for(std::vector::iterator vit = mWaitingTokens.begin(); vit != mWaitingTokens.end(); ++vit) { uint8_t status = mTokenService->requestStatus(*vit); - if(status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(status != RsTokenService::COMPLETE) { ready = false; } - if(status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + if(status == RsTokenService::FAILED) { std::cerr << "GxsResponseTask::doWork() Error: token failed. aborting." << std::endl; resp.setFail("GxsResponseTask::doWork() Error: token failed."); diff --git a/libresapi/src/api/IdentityHandler.cpp b/libresapi/src/api/IdentityHandler.cpp index ff5e50a1e..97e9b49ea 100644 --- a/libresapi/src/api/IdentityHandler.cpp +++ b/libresapi/src/api/IdentityHandler.cpp @@ -220,15 +220,15 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp) time_t timeout = time(NULL)+10; uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token); - while( rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE && - rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED && + while( rStatus != RsTokenService::COMPLETE && + rStatus != RsTokenService::FAILED && time(NULL) < timeout ) { usleep(50*1000); rStatus = mRsIdentity->getTokenService()->requestStatus(token); } - if(rStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(rStatus == RsTokenService::COMPLETE) { std::vector grps; ok &= mRsIdentity->getGroupData(token, grps); @@ -277,15 +277,15 @@ void IdentityHandler::handleNotOwnIdsRequest(Request & /*req*/, Response &resp) time_t timeout = time(NULL)+10; uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token); - while( rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE && - rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED && + while( rStatus != RsTokenService::COMPLETE && + rStatus != RsTokenService::FAILED && time(NULL) < timeout ) { usleep(50*1000); rStatus = mRsIdentity->getTokenService()->requestStatus(token); } - if(rStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(rStatus == RsTokenService::COMPLETE) { std::vector grps; ok &= mRsIdentity->getGroupData(token, grps); @@ -327,8 +327,8 @@ void IdentityHandler::handleOwnIdsRequest(Request & /*req*/, Response &resp) mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); time_t start = time(NULL); - while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) + &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10))) ) { @@ -339,7 +339,7 @@ void IdentityHandler::handleOwnIdsRequest(Request & /*req*/, Response &resp) #endif } - if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::COMPLETE) { std::vector grps; ok &= mRsIdentity->getGroupData(token, grps); @@ -410,8 +410,8 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp) mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds); time_t start = time(NULL); - while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) + &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10))) ) { @@ -545,8 +545,8 @@ void IdentityHandler::handleSetAvatar(Request& req, Response& resp) mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds); time_t start = time(NULL); - while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) - &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::COMPLETE) + &&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::FAILED) &&((time(NULL) < (start+10))) ) { diff --git a/libretroshare/src/gxs/gxstokenqueue.cc b/libretroshare/src/gxs/gxstokenqueue.cc index b857ee1a8..039509d24 100644 --- a/libretroshare/src/gxs/gxstokenqueue.cc +++ b/libretroshare/src/gxs/gxstokenqueue.cc @@ -59,7 +59,7 @@ void GxsTokenQueue::checkRequests() uint32_t token = it->mToken; uint32_t status = mGenExchange->getTokenService()->requestStatus(token); - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if (status == RsTokenService::COMPLETE) { toload.push_back(*it); it = mQueue.erase(it); @@ -71,7 +71,7 @@ void GxsTokenQueue::checkRequests() #endif ++it; } - else if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + else if (status == RsTokenService::FAILED) { // maybe we should do alternative callback? std::cerr << "GxsTokenQueue::checkRequests() ERROR Request Failed: " << token; diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index ad7e02dcb..dc25d383b 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1987,7 +1987,7 @@ void RsGenExchange::processMsgMetaChanges() if(ok) { - mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE); + mDataAccess->updatePublicRequestStatus(token, RsTokenService::COMPLETE); if (changed) { msgIds[m.msgId.first].insert(m.msgId.second); @@ -1995,7 +1995,7 @@ void RsGenExchange::processMsgMetaChanges() } else { - mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + mDataAccess->updatePublicRequestStatus(token, RsTokenService::FAILED); } { @@ -2041,11 +2041,11 @@ void RsGenExchange::processGrpMetaChanges() if(ok) { - mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE); + mDataAccess->updatePublicRequestStatus(token, RsTokenService::COMPLETE); grpChanged.push_back(g.grpId); }else { - mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + mDataAccess->updatePublicRequestStatus(token, RsTokenService::FAILED); } { @@ -2278,7 +2278,7 @@ void RsGenExchange::publishMsgs() // add to published to allow acknowledgement mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId))); - mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE); + mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::COMPLETE); } else @@ -2288,7 +2288,7 @@ void RsGenExchange::publishMsgs() if(!tryLater) mDataAccess->updatePublicRequestStatus(mit->first, - RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + RsTokenService::FAILED); std::cerr << "RsGenExchange::publishMsgs() failed to publish msg " << std::endl; } @@ -2365,7 +2365,7 @@ void RsGenExchange::processGroupUpdatePublish() if(mit == grpMeta.end() || mit->second == NULL) { std::cerr << "Error! could not find meta of old group to update!" << std::endl; - mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::FAILED); delete gup.grpItem; continue; } @@ -2393,7 +2393,7 @@ void RsGenExchange::processGroupUpdatePublish() std::cerr << "(EE) publish group fails because RS cannot find the private publish and author keys" << std::endl; delete gup.grpItem; - mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::FAILED); } } @@ -2435,8 +2435,8 @@ void RsGenExchange::processGroupDelete() for(; mit != toNotify.end(); ++mit) { GrpNote& note = mit->second; - uint8_t status = note.first ? RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE - : RsTokenService::GXS_REQUEST_V2_STATUS_FAILED; + uint8_t status = note.first ? RsTokenService::COMPLETE + : RsTokenService::FAILED; mGrpNotify.insert(std::make_pair(mit->first, note.second)); mDataAccess->updatePublicRequestStatus(mit->first, status); @@ -2744,8 +2744,8 @@ void RsGenExchange::publishGrps() for(; mit != toNotify.end(); ++mit) { GrpNote& note = mit->second; - uint8_t status = note.first ? RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE - : RsTokenService::GXS_REQUEST_V2_STATUS_FAILED; + uint8_t status = note.first ? RsTokenService::COMPLETE + : RsTokenService::FAILED; mGrpNotify.insert(std::make_pair(mit->first, note.second)); mDataAccess->updatePublicRequestStatus(mit->first, status); diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 4e86e323d..b66a2811a 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -29,14 +29,6 @@ #include "rsgxsdataaccess.h" #include "retroshare/rsgxsflags.h" -// TODO CLEANUP: This should be an enum defined in rstokenservice.h - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FAILED = 0; - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PENDING = 1; - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PARTIAL = 2; - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE = 4; - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_DONE = 5; // ONCE ALL DATA RETRIEVED. - const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_CANCELLED = 6; - /*********** * #define DATA_DEBUG 1 **********/ @@ -316,7 +308,7 @@ void RsGxsDataAccess::storeRequest(GxsRequest* req) { RsStackMutex stack(mDataMutex); /****** LOCKED *****/ - req->status = GXS_REQUEST_V2_STATUS_PENDING; + req->status = PENDING; req->reqTime = time(NULL); mRequests[req->token] = req; @@ -339,7 +331,7 @@ uint32_t RsGxsDataAccess::requestStatus(uint32_t token) } if (!checkRequestStatus(token, status, reqtype, anstype, ts)) - return RsTokenService::GXS_REQUEST_V2_STATUS_FAILED; + return RsTokenService::FAILED; return status; } @@ -354,7 +346,7 @@ bool RsGxsDataAccess::cancelRequest(const uint32_t& token) return false; } - req->status = GXS_REQUEST_V2_STATUS_CANCELLED; + req->status = CANCELLED; return true; } @@ -390,7 +382,7 @@ bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::liststatus == GXS_REQUEST_V2_STATUS_COMPLETE) + else if(req->status == COMPLETE) { GroupMetaReq* gmreq = dynamic_cast(req); @@ -398,7 +390,7 @@ bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::listmGroupMetaData; gmreq->mGroupMetaData.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else { @@ -429,7 +421,7 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list& << "data" << std::endl; return false; } - else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE) + else if(req->status == COMPLETE) { GroupDataReq* gmreq = dynamic_cast(req); GroupSerializedDataReq* gsreq = dynamic_cast(req); @@ -439,13 +431,13 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list& grpData.swap(gsreq->mGroupData); gsreq->mGroupData.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else if(gmreq) { grpData.swap(gmreq->mGroupData); gmreq->mGroupData.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else { @@ -474,7 +466,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat std::cerr << "RsGxsDataAccess::getMsgData() Unable to retrieve group data" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ MsgDataReq* mdreq = dynamic_cast(req); @@ -482,7 +474,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat { msgData.swap(mdreq->mMsgData); mdreq->mMsgData.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else { @@ -508,7 +500,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData std::cerr << "RsGxsDataAccess::getMsgRelatedData() Unable to retrieve group data" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ MsgRelatedInfoReq* mrireq = dynamic_cast(req); @@ -519,7 +511,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData { msgData.swap(mrireq->mMsgDataResult); mrireq->mMsgDataResult.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else { @@ -545,7 +537,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg std::cerr << "RsGxsDataAccess::getMsgSummary() Unable to retrieve group data" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ MsgMetaReq* mmreq = dynamic_cast(req); @@ -553,7 +545,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg { msgInfo.swap(mmreq->mMsgMetaData); mmreq->mMsgMetaData.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else @@ -582,7 +574,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta std::cerr << "RsGxsDataAccess::getMsgRelatedSummary() Unable to retrieve message summary" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ if(req->Options.mReqType != GXS_REQUEST_TYPE_MSG_RELATED_META) return false; @@ -593,7 +585,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta { msgMeta.swap(mrireq->mMsgMetaResult); mrireq->mMsgMetaResult.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else { @@ -621,7 +613,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul std::cerr << "RsGxsDataAccess::getMsgRelatedList() Unable to retrieve message data" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ if(req->Options.mReqType != GXS_REQUEST_TYPE_MSG_RELATED_IDS) return false; @@ -632,7 +624,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul { msgIds.swap(mrireq->mMsgIdResult); mrireq->mMsgIdResult.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else{ std::cerr << "RsGxsDataAccess::getMsgRelatedList() Req found, failed caste" << std::endl; @@ -658,7 +650,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds) std::cerr << "RsGxsDataAccess::getMsgList() Unable to retrieve msg Ids" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ MsgIdReq* mireq = dynamic_cast(req); @@ -666,7 +658,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds) { msgIds.swap(mireq->mMsgIdResult); mireq->mMsgIdResult.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else{ std::cerr << "RsGxsDataAccess::getMsgList() Req found, failed caste" << std::endl; @@ -691,7 +683,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::liststatus == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ GroupIdReq* gireq = dynamic_cast(req); @@ -699,7 +691,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::listmGroupIdResult); gireq->mGroupIdResult.clear(); - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); }else{ std::cerr << "RsGxsDataAccess::getGroupList() Req found, failed caste" << std::endl; @@ -741,21 +733,21 @@ void RsGxsDataAccess::processRequests() switch (req->status) { - case GXS_REQUEST_V2_STATUS_PENDING: + case PENDING: // process request later break; - case GXS_REQUEST_V2_STATUS_PARTIAL: + case PARTIAL: // should not happen - req->status = GXS_REQUEST_V2_STATUS_COMPLETE; + req->status = COMPLETE; break; - case GXS_REQUEST_V2_STATUS_DONE: + case DONE: #ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::processrequests() Clearing Done Request Token: " << req->token; std::cerr << std::endl; #endif toClear.push_back(req->token); break; - case GXS_REQUEST_V2_STATUS_CANCELLED: + case CANCELLED: #ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::processrequests() Clearing Cancelled Request Token: " << req->token; std::cerr << std::endl; @@ -793,10 +785,10 @@ void RsGxsDataAccess::processRequests() for (it = mRequests.begin(); it != mRequests.end(); ++it) { GxsRequest* reqCheck = it->second; - if (reqCheck->status == GXS_REQUEST_V2_STATUS_PENDING) + if (reqCheck->status == PENDING) { req = reqCheck; - req->status = GXS_REQUEST_V2_STATUS_PARTIAL; + req->status = PARTIAL; break; } } @@ -876,9 +868,9 @@ void RsGxsDataAccess::processRequests() { RsStackMutex stack(mDataMutex); /******* LOCKED *******/ - if (req->status == GXS_REQUEST_V2_STATUS_PARTIAL) + if (req->status == PARTIAL) { - req->status = ok ? GXS_REQUEST_V2_STATUS_COMPLETE : GXS_REQUEST_V2_STATUS_FAILED; + req->status = ok ? COMPLETE : FAILED; } } // END OF MUTEX. } @@ -894,14 +886,14 @@ bool RsGxsDataAccess::getGroupStatistic(const uint32_t &token, GxsGroupStatistic std::cerr << "RsGxsDataAccess::getGroupStatistic() Unable to retrieve grp stats" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ GroupStatisticRequest* gsreq = dynamic_cast(req); if(gsreq) { grpStatistic = gsreq->mGroupStatistic; - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else{ std::cerr << "RsGxsDataAccess::getGroupStatistic() Req found, failed caste" << std::endl; @@ -925,14 +917,14 @@ bool RsGxsDataAccess::getServiceStatistic(const uint32_t &token, GxsServiceStati std::cerr << "RsGxsDataAccess::getServiceStatistic() Unable to retrieve service stats" << std::endl; return false; - }else if(req->status == GXS_REQUEST_V2_STATUS_COMPLETE){ + }else if(req->status == COMPLETE){ ServiceStatisticRequest* ssreq = dynamic_cast(req); if(ssreq) { servStatistic = ssreq->mServiceStatistic; - locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); + locked_updateRequestStatus(token, DONE); } else{ std::cerr << "RsGxsDataAccess::getServiceStatistic() Req found, failed caste" << std::endl; @@ -1777,7 +1769,7 @@ bool RsGxsDataAccess::checkRequestStatus(const uint32_t& token, GxsRequest* req = locked_retrieveRequest(token); - if (req == NULL || req->status == GXS_REQUEST_V2_STATUS_CANCELLED) + if (req == NULL || req->status == CANCELLED) return false; anstype = req->ansType; @@ -1852,7 +1844,7 @@ uint32_t RsGxsDataAccess::generatePublicToken() { RsStackMutex stack(mDataMutex); - mPublicToken[token] = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING; + mPublicToken[token] = RsTokenService::PENDING; } return token; diff --git a/libretroshare/src/retroshare/rstokenservice.h b/libretroshare/src/retroshare/rstokenservice.h index a720b93d2..5a9db6aef 100644 --- a/libretroshare/src/retroshare/rstokenservice.h +++ b/libretroshare/src/retroshare/rstokenservice.h @@ -123,18 +123,19 @@ class RsTokenService public: - // TODO CLEANUP: This should be an enum - static const uint8_t GXS_REQUEST_V2_STATUS_FAILED; - static const uint8_t GXS_REQUEST_V2_STATUS_PENDING; - static const uint8_t GXS_REQUEST_V2_STATUS_PARTIAL; - static const uint8_t GXS_REQUEST_V2_STATUS_COMPLETE; - static const uint8_t GXS_REQUEST_V2_STATUS_DONE; // ONCE ALL DATA RETRIEVED. - static const uint8_t GXS_REQUEST_V2_STATUS_CANCELLED; + enum GxsRequestStatus : uint8_t + { + FAILED, + PENDING, + PARTIAL, + COMPLETE, + DONE, /// Once all data has been retrived + CANCELLED + }; -public: - RsTokenService() { return; } - virtual ~RsTokenService() { return; } + RsTokenService() {} + virtual ~RsTokenService() {} /* Data Requests */ diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index dd284a4f1..74fc9d080 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1315,14 +1315,14 @@ void p3GxsChannels::dummy_tick() #endif uint32_t status = RsGenExchange::getTokenService()->requestStatus(mGenToken); - if (status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if (status != RsTokenService::COMPLETE) { #ifdef GXSCHANNELS_DEBUG std::cerr << "p3GxsChannels::dummy_tick() Status: " << status; std::cerr << std::endl; #endif - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + if (status == RsTokenService::FAILED) { #ifdef GXSCHANNELS_DEBUG std::cerr << "p3GxsChannels::dummy_tick() generateDummyMsgs() FAILED"; diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 063361121..5593250f7 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -1656,8 +1656,8 @@ void p3GxsCircles::checkDummyIdData() // check the token. uint32_t status = rsIdentity->getTokenService()->requestStatus(mDummyIdToken); - if ( (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == status) || - (RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) ) + if ( (RsTokenService::FAILED == status) || + (RsTokenService::COMPLETE == status) ) { std::vector ids; if (!rsIdentity->getGroupData(mDummyIdToken, ids)) diff --git a/libretroshare/src/services/p3gxscommon.cc b/libretroshare/src/services/p3gxscommon.cc index e1db6750d..c30b39952 100644 --- a/libretroshare/src/services/p3gxscommon.cc +++ b/libretroshare/src/services/p3gxscommon.cc @@ -572,7 +572,7 @@ void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token) std::cerr << std::endl; pit->second.mStatus = VoteHolder::VOTE_ERROR; - uint32_t status = RsTokenService::GXS_REQUEST_V2_STATUS_FAILED; + uint32_t status = RsTokenService::FAILED; mExchange->updatePublicRequestStatus(pit->second.mReqToken, status); continue; } diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 1be91dc00..57f129449 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -489,12 +489,12 @@ void p3GxsForums::dummy_tick() std::cerr << std::endl; uint32_t status = RsGenExchange::getTokenService()->requestStatus(mGenToken); - if (status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if (status != RsTokenService::COMPLETE) { std::cerr << "p3GxsForums::dummy_tick() Status: " << status; std::cerr << std::endl; - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) + if (status == RsTokenService::FAILED) { std::cerr << "p3GxsForums::dummy_tick() generateDummyMsgs() FAILED"; std::cerr << std::endl; diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 8a3f08195..76c43e5bd 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -1536,7 +1536,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token) std::cerr << "p3IdService::opinion_handlerequest() ERROR getGroupMeta()"; std::cerr << std::endl; - updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + updatePublicRequestStatus(req.mToken, RsTokenService::FAILED); return false; } @@ -1546,7 +1546,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token) std::cerr << std::endl; // error. - updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + updatePublicRequestStatus(req.mToken, RsTokenService::FAILED); return false; } RsGroupMetaData &meta = *(groups.begin()); @@ -1557,7 +1557,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token) std::cerr << std::endl; // error. - updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED); + updatePublicRequestStatus(req.mToken, RsTokenService::FAILED); return false; } @@ -1592,7 +1592,7 @@ bool p3IdService::opinion_handlerequest(uint32_t token) setGroupServiceString(dummyToken, meta.mGroupId, serviceString); cache_update_if_cached(RsGxsId(meta.mGroupId), serviceString); - updatePublicRequestStatus(req.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE); + updatePublicRequestStatus(req.mToken, RsTokenService::COMPLETE); return true; } diff --git a/libretroshare/src/services/p3wiki.cc b/libretroshare/src/services/p3wiki.cc index a707596c1..3e5e427b9 100644 --- a/libretroshare/src/services/p3wiki.cc +++ b/libretroshare/src/services/p3wiki.cc @@ -538,7 +538,7 @@ void p3Wiki::dummyTick() uint32_t status = RsGenExchange::getTokenService()->requestStatus(mAboutToken); - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if (status == RsTokenService::COMPLETE) { std::cerr << "p3Wiki::dummyTick() AboutActive, Lines: " << mAboutLines; std::cerr << std::endl; @@ -605,7 +605,7 @@ void p3Wiki::dummyTick() uint32_t status = RsGenExchange::getTokenService()->requestStatus(mImprovToken); - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if (status == RsTokenService::COMPLETE) { std::cerr << "p3Wiki::dummyTick() ImprovActive, Lines: " << mImprovLines; std::cerr << std::endl; @@ -673,7 +673,7 @@ void p3Wiki::dummyTick() uint32_t status = RsGenExchange::getTokenService()->requestStatus(mMarkdownToken); - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + if (status == RsTokenService::COMPLETE) { std::cerr << "p3Wiki::dummyTick() MarkdownActive, Lines: " << mMarkdownLines; std::cerr << std::endl; diff --git a/plugins/FeedReader/services/p3FeedReader.cc b/plugins/FeedReader/services/p3FeedReader.cc index 256a1e285..b964e0a74 100644 --- a/plugins/FeedReader/services/p3FeedReader.cc +++ b/plugins/FeedReader/services/p3FeedReader.cc @@ -2229,11 +2229,11 @@ bool p3FeedReader::waitForToken(uint32_t token) while (!mStopped) { uint32_t status = service->requestStatus(token); - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) { + if (status == RsTokenService::FAILED) { break; } - if (status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) { + if (status == RsTokenService::COMPLETE) { return true; } diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp index 7e9217a82..774394bcf 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp @@ -112,11 +112,11 @@ void GxsForumsFillThread::run() service->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds); /* wait for the answer */ - uint32_t requestStatus = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING; + uint32_t requestStatus = RsTokenService::PENDING; while (!wasStopped()) { requestStatus = service->requestStatus(token); - if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED || - requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) { + if (requestStatus == RsTokenService::FAILED || + requestStatus == RsTokenService::COMPLETE) { break; } msleep(100); @@ -132,7 +132,7 @@ void GxsForumsFillThread::run() return; } - if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) { + if (requestStatus == RsTokenService::FAILED) { //#TODO return; } diff --git a/retroshare-gui/src/util/TokenQueue.cpp b/retroshare-gui/src/util/TokenQueue.cpp index 3fa5e7ced..2fc453aa7 100644 --- a/retroshare-gui/src/util/TokenQueue.cpp +++ b/retroshare-gui/src/util/TokenQueue.cpp @@ -164,8 +164,8 @@ bool TokenQueue::checkForRequest(uint32_t token) { /* check token */ uint32_t status = mService->requestStatus(token); - return ( (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == status) || - (RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) ); + return ( (RsTokenService::FAILED == status) || + (RsTokenService::COMPLETE == status) ); } bool TokenQueue::activeRequestExist(const uint32_t& userType) const diff --git a/tests/unittests/libretroshare/gxs/gen_exchange/genexchangetester.cc b/tests/unittests/libretroshare/gxs/gen_exchange/genexchangetester.cc index 6fb4cae2a..9d000d443 100644 --- a/tests/unittests/libretroshare/gxs/gen_exchange/genexchangetester.cc +++ b/tests/unittests/libretroshare/gxs/gen_exchange/genexchangetester.cc @@ -42,7 +42,7 @@ void GenExchangeTest::pollForToken(uint32_t token, const RsTokReqOptions &opts, Sleep((int) (timeDelta * 1000)); #endif - if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token))) + if((RsTokenService::COMPLETE == mTokenService->requestStatus(token))) { switch(opts.mReqType) { @@ -81,7 +81,7 @@ void GenExchangeTest::pollForToken(uint32_t token, const RsTokReqOptions &opts, } break; } - else if(RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token)) + else if(RsTokenService::FAILED == mTokenService->requestStatus(token)) { mTokenService->cancelRequest(token); break; @@ -108,12 +108,12 @@ bool GenExchangeTest::pollForMsgAcknowledgement(uint32_t token, Sleep((int) (timeDelta * 1000)); #endif - if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token))) + if((RsTokenService::COMPLETE == mTokenService->requestStatus(token))) { mTestService->acknowledgeTokenMsg(token, msgId); return true; } - else if(RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token)) + else if(RsTokenService::FAILED == mTokenService->requestStatus(token)) { mTokenService->cancelRequest(token); return false; @@ -146,12 +146,12 @@ bool GenExchangeTest::pollForGrpAcknowledgement(uint32_t token, Sleep((int) (timeDelta * 1000)); #endif - if((RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == mTokenService->requestStatus(token))) + if((RsTokenService::COMPLETE == mTokenService->requestStatus(token))) { mTestService->acknowledgeTokenGrp(token, grpId); return true; } - else if(RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == mTokenService->requestStatus(token)) + else if(RsTokenService::FAILED == mTokenService->requestStatus(token)) { mTokenService->cancelRequest(token); return false; diff --git a/tests/unittests/libretroshare/services/gxs/GxsPeerNode.cc b/tests/unittests/libretroshare/services/gxs/GxsPeerNode.cc index 5e8439af8..3be7cd392 100644 --- a/tests/unittests/libretroshare/services/gxs/GxsPeerNode.cc +++ b/tests/unittests/libretroshare/services/gxs/GxsPeerNode.cc @@ -242,7 +242,7 @@ bool GxsPeerNode::createIdentity(const std::string &name, return false; } - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -316,7 +316,7 @@ bool GxsPeerNode::createCircle(const std::string &name, uint32_t token; mGxsCircles->createGroup(token, grp1) ; - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -371,7 +371,7 @@ bool GxsPeerNode::createGroup(const std::string &name, return false; } - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -402,7 +402,7 @@ bool GxsPeerNode::createMsg(const std::string &msgstr, return false; } - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -430,7 +430,7 @@ bool GxsPeerNode::subscribeToGroup(const RsGxsGroupId &groupId, bool subscribe) return false; } - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -453,7 +453,7 @@ bool GxsPeerNode::getGroups(std::vector &groups) uint32_t token; tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -475,7 +475,7 @@ bool GxsPeerNode::getGroupList(std::list &groups) uint32_t token; tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -500,7 +500,7 @@ bool GxsPeerNode::getMsgList(const RsGxsGroupId &id, std::list & grpIds.push_back(id); tokenService->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, grpIds); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -533,7 +533,7 @@ bool GxsPeerNode::getIdentities(std::vector &groups) uint32_t token; tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -553,7 +553,7 @@ bool GxsPeerNode::getIdentitiesList(std::list &groups) uint32_t token; tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -575,7 +575,7 @@ bool GxsPeerNode::getCircles(std::vector &groups) uint32_t token; tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); @@ -595,7 +595,7 @@ bool GxsPeerNode::getCirclesList(std::list &groups) uint32_t token; tokenService->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts); - while(tokenService->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token) != RsTokenService::COMPLETE) { tick(); sleep(1); diff --git a/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc b/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc index 078eba249..9c4069c80 100644 --- a/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc +++ b/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc @@ -118,14 +118,14 @@ TEST(libretroshare_services, DISABLED_GXS_nxs_basic2) uint32_t token2; ASSERT_TRUE(testService->submitTestGroup(token1, grp1)); - while(tokenService->requestStatus(token1) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token1) != RsTokenService::COMPLETE) { tester.tick(); sleep(1); } ASSERT_TRUE(testService->submitTestGroup(token2, grp2)); - while(tokenService->requestStatus(token2) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) + while(tokenService->requestStatus(token2) != RsTokenService::COMPLETE) { tester.tick(); sleep(1); From 08b436e5f47eb1d3e4215cbdc13f60ae1be03c3b Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 24 Jun 2018 23:15:22 +0200 Subject: [PATCH 083/213] added display of searched groups --- .../src/gui/gxs/GxsGroupFrameDialog.cpp | 51 ++++++++++++++++--- .../src/gui/gxs/GxsGroupFrameDialog.h | 3 +- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 598bd35fc..1f2d2fc00 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -263,8 +263,40 @@ void GxsGroupFrameDialog::updateSearchResults() std::cerr << "retrieved " << std::endl; - for(auto it2(group_infos.begin());it2!=group_infos.end();++it2) - std::cerr << " " << it2->first << " " << it2->second.group_id << " \"" << it2->second.group_name << "\"" << std::endl; + auto it2 = mSearchGroupsItems.find(*it); + + std::set& known_groups(mKnownGroups[*it]) ; + + if(mSearchGroupsItems.end() == it2) + { + std::cerr << "GxsGroupFrameDialog::updateSearchResults(): received result notification for req " << std::hex << *it << std::dec << " but no item present!" << std::endl; + continue ; // we could create the item just as well but since this situation is not supposed to happen, I prefer to make this a failure case. + } + + QList group_items ; + + for(auto it3(group_infos.begin());it3!=group_infos.end();++it3) + if(known_groups.end() == known_groups.find(it3->first)) + { + std::cerr << " adding new group " << it3->first << " " << it3->second.group_id << " \"" << it3->second.group_name << "\"" << std::endl; + + known_groups.insert(it3->first) ; + + GroupItemInfo i ; + i.id = QString(it3->second.group_id.toStdString().c_str()) ; + i.name = QString::fromUtf8(it3->second.group_name.c_str()) ; + i.description = QString::fromUtf8(it3->second.group_description.c_str()) ; + i.popularity = 0; // could be set to the number of hits + i.lastpost = QDateTime::fromTime_t(it3->second.last_message_ts); + i.subscribeFlags = 0; // irrelevant here + i.publishKey = false ; // IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ; + i.adminKey = false ; // IS_GROUP_ADMIN(groupInfo.mSubscribeFlags) ; + i.max_visible_posts = it3->second.number_of_messages ; + + group_items.push_back(i); + } + + ui->groupTreeWidget->fillGroupItems(it2->second, group_items); } } @@ -282,21 +314,24 @@ void GxsGroupFrameDialog::removeCurrentSearch() TurtleRequestId search_request_id = action->data().toUInt(); - auto it = mSearchGroups.find(search_request_id) ; + auto it = mSearchGroupsItems.find(search_request_id) ; - if(it == mSearchGroups.end()) + if(it == mSearchGroupsItems.end()) return ; ui->groupTreeWidget->removeSearchItem(it->second) ; - mSearchGroups.erase(it); + mSearchGroupsItems.erase(it); + + mKnownGroups.erase(search_request_id); } void GxsGroupFrameDialog::removeAllSearches() { - for(auto it(mSearchGroups.begin());it!=mSearchGroups.end();++it) + for(auto it(mSearchGroupsItems.begin());it!=mSearchGroupsItems.end();++it) ui->groupTreeWidget->removeSearchItem(it->second) ; - mSearchGroups.clear(); + mSearchGroupsItems.clear(); + mKnownGroups.clear(); } void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point) { @@ -1158,6 +1193,6 @@ void GxsGroupFrameDialog::searchNetwork(const QString& search_string) if(request_id == 0) return ; - mSearchGroups[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH))); + mSearchGroupsItems[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH))); } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index ac04edf59..bcfbabe78 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -210,7 +210,8 @@ private: std::list mCachedGroupMetas; - std::map mSearchGroups ; + std::map mSearchGroupsItems ; + std::map > mKnownGroups; }; #endif From 2f4b9b3e20ef32d013545ca85bcf08aef9e3cd22 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 24 Jun 2018 23:24:52 +0200 Subject: [PATCH 084/213] Convert to RsTokenService::GxsRequestStatus Indicate GxsRequest status with an enum instead of uint_* that make the code less readable and more prone to errors --- libretroshare/src/gxs/rsgenexchange.cc | 15 ++-- libretroshare/src/gxs/rsgenexchange.h | 3 +- libretroshare/src/gxs/rsgxsdataaccess.cc | 74 +++++++------------ libretroshare/src/gxs/rsgxsdataaccess.h | 15 ++-- libretroshare/src/gxs/rsgxsrequesttypes.h | 6 +- libretroshare/src/retroshare/rstokenservice.h | 2 +- libretroshare/src/services/p3gxscommon.cc | 22 +++--- 7 files changed, 63 insertions(+), 74 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index dc25d383b..6f58f2239 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -2414,7 +2414,7 @@ void RsGenExchange::processRoutingClues() void RsGenExchange::processGroupDelete() { - RS_STACK_MUTEX(mGenMtx) ; + RS_STACK_MUTEX(mGenMtx); // get keys for group delete publish typedef std::pair GrpNote; @@ -2435,8 +2435,9 @@ void RsGenExchange::processGroupDelete() for(; mit != toNotify.end(); ++mit) { GrpNote& note = mit->second; - uint8_t status = note.first ? RsTokenService::COMPLETE - : RsTokenService::FAILED; + RsTokenService::GxsRequestStatus status = + note.first ? RsTokenService::COMPLETE + : RsTokenService::FAILED; mGrpNotify.insert(std::make_pair(mit->first, note.second)); mDataAccess->updatePublicRequestStatus(mit->first, status); @@ -2744,8 +2745,9 @@ void RsGenExchange::publishGrps() for(; mit != toNotify.end(); ++mit) { GrpNote& note = mit->second; - uint8_t status = note.first ? RsTokenService::COMPLETE - : RsTokenService::FAILED; + RsTokenService::GxsRequestStatus status = + note.first ? RsTokenService::COMPLETE + : RsTokenService::FAILED; mGrpNotify.insert(std::make_pair(mit->first, note.second)); mDataAccess->updatePublicRequestStatus(mit->first, status); @@ -2781,7 +2783,8 @@ uint32_t RsGenExchange::generatePublicToken() return mDataAccess->generatePublicToken(); } -bool RsGenExchange::updatePublicRequestStatus(const uint32_t &token, const uint32_t &status) +bool RsGenExchange::updatePublicRequestStatus( + uint32_t token, RsTokenService::GxsRequestStatus status ) { return mDataAccess->updatePublicRequestStatus(token, status); } diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 491ff017b..e60b70912 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -468,7 +468,8 @@ public: * @param status * @return false if token could not be found, true if token disposed of */ - bool updatePublicRequestStatus(const uint32_t &token, const uint32_t &status); + bool updatePublicRequestStatus( + uint32_t token, RsTokenService::GxsRequestStatus status); /*! * This gets rid of a publicly issued token diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index b66a2811a..7c092fd68 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -315,15 +315,15 @@ void RsGxsDataAccess::storeRequest(GxsRequest* req) return; } -uint32_t RsGxsDataAccess::requestStatus(uint32_t token) +RsTokenService::GxsRequestStatus RsGxsDataAccess::requestStatus(uint32_t token) { - uint32_t status; + RsTokenService::GxsRequestStatus status; uint32_t reqtype; uint32_t anstype; time_t ts; { - RsStackMutex stack(mDataMutex); + RS_STACK_MUTEX(mDataMutex); // first check public tokens if(mPublicToken.find(token) != mPublicToken.end()) @@ -1761,11 +1761,11 @@ void RsGxsDataAccess::filterGrpList(std::list &grpIds, const RsTok } -bool RsGxsDataAccess::checkRequestStatus(const uint32_t& token, - uint32_t& status, uint32_t& reqtype, uint32_t& anstype, time_t& ts) +bool RsGxsDataAccess::checkRequestStatus( + uint32_t token, GxsRequestStatus& status, uint32_t& reqtype, + uint32_t& anstype, time_t& ts ) { - - RsStackMutex stack(mDataMutex); + RS_STACK_MUTEX(mDataMutex); GxsRequest* req = locked_retrieveRequest(token); @@ -1822,70 +1822,52 @@ void RsGxsDataAccess::tokenList(std::list& tokens) } } -bool RsGxsDataAccess::locked_updateRequestStatus(const uint32_t& token, - const uint32_t& status) +bool RsGxsDataAccess::locked_updateRequestStatus( + uint32_t token, RsTokenService::GxsRequestStatus status ) { - GxsRequest* req = locked_retrieveRequest(token); - if(req) - req->status = status; - else - return false; + if(req) req->status = status; + else return false; return true; } uint32_t RsGxsDataAccess::generatePublicToken() { - uint32_t token; generateToken(token); - { - RsStackMutex stack(mDataMutex); - mPublicToken[token] = RsTokenService::PENDING; - } + { + RS_STACK_MUTEX(mDataMutex); + mPublicToken[token] = RsTokenService::PENDING; + } return token; } -bool RsGxsDataAccess::updatePublicRequestStatus(const uint32_t& token, - const uint32_t& status) +bool RsGxsDataAccess::updatePublicRequestStatus( + uint32_t token, RsTokenService::GxsRequestStatus status ) { - RsStackMutex stack(mDataMutex); - std::map::iterator mit = mPublicToken.find(token); - - if(mit != mPublicToken.end()) - { - mit->second = status; - } - else - { - return false; - } - + RS_STACK_MUTEX(mDataMutex); + std::map::iterator mit = + mPublicToken.find(token); + if(mit != mPublicToken.end()) mit->second = status; + else return false; return true; } -bool RsGxsDataAccess::disposeOfPublicToken(const uint32_t& token) +bool RsGxsDataAccess::disposeOfPublicToken(uint32_t token) { - RsStackMutex stack(mDataMutex); - std::map::iterator mit = mPublicToken.find(token); - - if(mit != mPublicToken.end()) - { - mPublicToken.erase(mit); - } - else - { - return false; - } - + RS_STACK_MUTEX(mDataMutex); + std::map::iterator mit = + mPublicToken.find(token); + if(mit != mPublicToken.end()) mPublicToken.erase(mit); + else return false; return true; } diff --git a/libretroshare/src/gxs/rsgxsdataaccess.h b/libretroshare/src/gxs/rsgxsdataaccess.h index 77f94137e..2cbdabf9f 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.h +++ b/libretroshare/src/gxs/rsgxsdataaccess.h @@ -48,6 +48,8 @@ public: * deprecated and should be removed as soon as possible as it is cause of * many confusions, instead use const RsTokReqOptions::mReqType &opts to * specify the kind of data you are interested in. + * Most of the methods use const uint32_t &token as param type change it to + * uint32_t */ /*! @@ -121,7 +123,7 @@ public: /* Poll */ - uint32_t requestStatus(const uint32_t token); + GxsRequestStatus requestStatus(const uint32_t token); /* Cancel Request */ bool cancelRequest(const uint32_t &token); @@ -296,7 +298,7 @@ private: * @param status the status to set * @return */ - bool locked_updateRequestStatus(const uint32_t &token, const uint32_t &status); + bool locked_updateRequestStatus(uint32_t token, GxsRequestStatus status); /*! * Use to query the status and other values of a given token @@ -307,7 +309,8 @@ private: * @param ts time stamp * @return false if token does not exist, true otherwise */ - bool checkRequestStatus(const uint32_t &token, uint32_t &status, uint32_t &reqtype, uint32_t &anstype, time_t &ts); + bool checkRequestStatus( uint32_t token, GxsRequestStatus &status, + uint32_t &reqtype, uint32_t &anstype, time_t &ts); // special ones for testing (not in final design) /*! @@ -337,14 +340,14 @@ public: * @param status * @return false if token could not be found, true if token disposed of */ - bool updatePublicRequestStatus(const uint32_t &token, const uint32_t &status); + bool updatePublicRequestStatus(uint32_t token, GxsRequestStatus status); /*! * This gets rid of a publicly issued token * @param token * @return false if token could not found, true if token disposed of */ - bool disposeOfPublicToken(const uint32_t &token); + bool disposeOfPublicToken(uint32_t token); private: @@ -484,7 +487,7 @@ private: RsMutex mDataMutex; /* protecting below */ uint32_t mNextToken; - std::map mPublicToken; + std::map mPublicToken; std::map mRequests; diff --git a/libretroshare/src/gxs/rsgxsrequesttypes.h b/libretroshare/src/gxs/rsgxsrequesttypes.h index 5c70c9d52..57e70acea 100644 --- a/libretroshare/src/gxs/rsgxsrequesttypes.h +++ b/libretroshare/src/gxs/rsgxsrequesttypes.h @@ -32,7 +32,9 @@ struct GxsRequest { - GxsRequest() : token(0), reqTime(0), ansType(0), reqType(0), status(0) {} + GxsRequest() : + token(0), reqTime(0), ansType(0), reqType(0), + status(RsTokenService::FAILED) {} virtual ~GxsRequest() {} uint32_t token; @@ -42,7 +44,7 @@ struct GxsRequest uint32_t reqType; RsTokReqOptions Options; - uint32_t status; + RsTokenService::GxsRequestStatus status; }; class GroupMetaReq : public GxsRequest diff --git a/libretroshare/src/retroshare/rstokenservice.h b/libretroshare/src/retroshare/rstokenservice.h index 5a9db6aef..ceefe28ad 100644 --- a/libretroshare/src/retroshare/rstokenservice.h +++ b/libretroshare/src/retroshare/rstokenservice.h @@ -199,7 +199,7 @@ public: * @param token value of token to check status for * @return the current status of request */ - virtual uint32_t requestStatus(const uint32_t token) = 0; + virtual GxsRequestStatus requestStatus(const uint32_t token) = 0; /*! * This request statistics on amount of data held diff --git a/libretroshare/src/services/p3gxscommon.cc b/libretroshare/src/services/p3gxscommon.cc index c30b39952..f5e8668f1 100644 --- a/libretroshare/src/services/p3gxscommon.cc +++ b/libretroshare/src/services/p3gxscommon.cc @@ -556,24 +556,22 @@ void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token) pit = mPendingVotes.find(parentId); if (pit == mPendingVotes.end()) { - std::cerr << "p3GxsCommentService::load_PendingVoteParent() ERROR Finding Pending Vote"; - std::cerr << std::endl; + std::cerr << __PRETTY_FUNCTION__ + << " ERROR Finding Pending Vote" << std::endl; continue; } RsGxsVote vote = pit->second.mVote; if (meta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK) { - std::cerr << "p3GxsCommentService::load_PendingVoteParent() ERROR Already Voted"; - std::cerr << std::endl; - std::cerr << "mGroupId: " << meta.mGroupId; - std::cerr << std::endl; - std::cerr << "mMsgId: " << meta.mMsgId; - std::cerr << std::endl; + std::cerr << __PRETTY_FUNCTION__ << " ERROR Already Voted" + << std::endl + << "mGroupId: " << meta.mGroupId << std::endl + << "mMsgId: " << meta.mMsgId << std::endl; pit->second.mStatus = VoteHolder::VOTE_ERROR; - uint32_t status = RsTokenService::FAILED; - mExchange->updatePublicRequestStatus(pit->second.mReqToken, status); + mExchange->updatePublicRequestStatus( + pit->second.mReqToken, RsTokenService::FAILED ); continue; } @@ -617,8 +615,8 @@ void p3GxsCommentService::completeInternalVote(uint32_t &token) { if (it->second.mVoteToken == token) { - - uint32_t status = mExchange->getTokenService()->requestStatus(token); + RsTokenService::GxsRequestStatus status = + mExchange->getTokenService()->requestStatus(token); mExchange->updatePublicRequestStatus(it->second.mReqToken, status); #ifdef DEBUG_GXSCOMMON From d731b665db6edc7adf5d788667bcc6795a7c3985 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 25 Jun 2018 10:44:39 +0200 Subject: [PATCH 085/213] Expose tokenservice methods trough GxsIfaceHelper --- libretroshare/src/gxstrans/p3gxstrans.h | 15 +- libretroshare/src/retroshare/rsgxschannels.h | 3 +- libretroshare/src/retroshare/rsgxscircles.h | 4 +- libretroshare/src/retroshare/rsgxsforums.h | 3 +- libretroshare/src/retroshare/rsgxsiface.h | 11 +- .../src/retroshare/rsgxsifacehelper.h | 133 ++++++++++++------ libretroshare/src/retroshare/rsgxstrans.h | 2 +- libretroshare/src/retroshare/rsidentity.h | 2 +- libretroshare/src/retroshare/rsposted.h | 2 +- libretroshare/src/retroshare/rstokenservice.h | 21 ++- libretroshare/src/retroshare/rswiki.h | 6 +- libretroshare/src/retroshare/rswire.h | 2 +- libretroshare/src/services/p3gxschannels.cc | 8 +- libretroshare/src/services/p3gxscircles.cc | 20 +-- libretroshare/src/services/p3gxsforums.cc | 3 +- libretroshare/src/services/p3idservice.cc | 14 +- libretroshare/src/services/p3posted.cc | 13 +- 17 files changed, 148 insertions(+), 114 deletions(-) diff --git a/libretroshare/src/gxstrans/p3gxstrans.h b/libretroshare/src/gxstrans/p3gxstrans.h index af79679d9..ff617e264 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.h +++ b/libretroshare/src/gxstrans/p3gxstrans.h @@ -85,7 +85,7 @@ struct MsgSizeCount * @see GxsTransClient::receiveGxsTransMail(...), * @see GxsTransClient::notifyGxsTransSendStatus(...). */ -class p3GxsTrans : public RsGenExchange, public GxsTokenQueue, public p3Config, public RsGxsTrans +struct p3GxsTrans : RsGenExchange, GxsTokenQueue, p3Config, RsGxsTrans { public: p3GxsTrans( RsGeneralDataService* gds, RsNetworkExchangeService* nes, @@ -94,17 +94,16 @@ public: RS_SERVICE_TYPE_GXS_TRANS, &identities, AuthenPolicy()), GxsTokenQueue(this), - RsGxsTrans(this), - mIdService(identities), + RsGxsTrans(static_cast(*this)), + // always check 30 secs after start) + mLastMsgCleanup(time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30), + mIdService(identities), mServClientsMutex("p3GxsTrans client services map mutex"), mOutgoingMutex("p3GxsTrans outgoing queue map mutex"), mIngoingMutex("p3GxsTrans ingoing queue map mutex"), + mCleanupThread(nullptr), mPerUserStatsMutex("p3GxsTrans user stats mutex"), - mDataMutex("p3GxsTrans data mutex") - { - mLastMsgCleanup = time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30; // always check 30 secs after start - mCleanupThread = NULL ; - } + mDataMutex("p3GxsTrans data mutex") {} virtual ~p3GxsTrans(); diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index ce394778d..fb8ce8f06 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -105,8 +105,7 @@ class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService { public: - explicit RsGxsChannels(RsGxsIface *gxs) - :RsGxsIfaceHelper(gxs) {} + explicit RsGxsChannels(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} virtual ~RsGxsChannels() {} /* Specific Service Data */ diff --git a/libretroshare/src/retroshare/rsgxscircles.h b/libretroshare/src/retroshare/rsgxscircles.h index 8ce446200..4147f8637 100644 --- a/libretroshare/src/retroshare/rsgxscircles.h +++ b/libretroshare/src/retroshare/rsgxscircles.h @@ -127,8 +127,8 @@ class RsGxsCircles: public RsGxsIfaceHelper { public: - RsGxsCircles(RsGxsIface *gxs) :RsGxsIfaceHelper(gxs) { return; } - virtual ~RsGxsCircles() { return; } + RsGxsCircles(RsGxsIface& gxs) :RsGxsIfaceHelper(gxs) {} + virtual ~RsGxsCircles() {} /* External Interface (Cached stuff) */ virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0; diff --git a/libretroshare/src/retroshare/rsgxsforums.h b/libretroshare/src/retroshare/rsgxsforums.h index 28558d4ce..1fd2feee2 100644 --- a/libretroshare/src/retroshare/rsgxsforums.h +++ b/libretroshare/src/retroshare/rsgxsforums.h @@ -63,8 +63,7 @@ class RsGxsForums: public RsGxsIfaceHelper { public: - explicit RsGxsForums(RsGxsIface *gxs) - :RsGxsIfaceHelper(gxs) {} + explicit RsGxsForums(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} virtual ~RsGxsForums() {} /* Specific Service Data */ diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index 36c660ef8..79474c189 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -35,9 +35,8 @@ /*! * Stores ids of changed gxs groups and messages. It is used to notify the GUI about changes. */ -class RsGxsChanges +struct RsGxsChanges { -public: RsGxsChanges(): mService(0){} RsTokenService *mService; std::map > mMsgs; @@ -49,13 +48,9 @@ public: /*! * All implementations must offer thread safety */ -class RsGxsIface +struct RsGxsIface { -public: - - virtual ~RsGxsIface(){}; - -public: + virtual ~RsGxsIface() {} /*! * Gxs services should call this for automatic handling of diff --git a/libretroshare/src/retroshare/rsgxsifacehelper.h b/libretroshare/src/retroshare/rsgxsifacehelper.h index fbe12570e..0899c5205 100644 --- a/libretroshare/src/retroshare/rsgxsifacehelper.h +++ b/libretroshare/src/retroshare/rsgxsifacehelper.h @@ -7,6 +7,7 @@ * RetroShare GXS. Convenience interface implementation * * Copyright 2012 by Christopher Evi-Parker + * Copyright (C) 2018 Gioacchino Mazzurco * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,26 +30,24 @@ #include "retroshare/rsgxsiface.h" #include "retroshare/rsreputations.h" #include "rsgxsflags.h" +#include "util/rsdeprecate.h" /*! - * The simple idea of this class is to implement the simple interface functions - * of gen exchange. - * This class provides convenience implementations of: - * - Handle msg and group changes (client class must pass changes sent by RsGenExchange to it) - * - subscription to groups - * - retrieval of msgs and group ids and meta info + * This class only make method of internal members visible tu upper level to + * offer a more friendly API. + * This is just a workaround to awkward GXS API design, do not take it as an + * example for your coding. + * To properly fix the API design many changes with the implied chain reactions + * are necessary, so at this point this workaround seems acceptable. */ -class RsGxsIfaceHelper +struct RsGxsIfaceHelper { -public: - - /*! - * - * @param gxs handle to RsGenExchange instance of service (Usually the service class itself) - */ - RsGxsIfaceHelper(RsGxsIface* gxs) - : mGxs(gxs) - {} + /*! + * @param gxs handle to RsGenExchange instance of service (Usually the + * service class itself) + */ + RsGxsIfaceHelper(RsGxsIface& gxs) : + mGxs(gxs), mTokenService(*gxs.getTokenService()) {} ~RsGxsIfaceHelper(){} @@ -59,15 +58,7 @@ public: */ void receiveChanges(std::vector &changes) { - mGxs->receiveChanges(changes); - } - - /*! - * @return handle to token service for this GXS service - */ - RsTokenService* getTokenService() - { - return mGxs->getTokenService(); + mGxs.receiveChanges(changes); } /* Generic Lists */ @@ -81,7 +72,7 @@ public: bool getGroupList(const uint32_t &token, std::list &groupIds) { - return mGxs->getGroupList(token, groupIds); + return mGxs.getGroupList(token, groupIds); } /*! @@ -93,7 +84,7 @@ public: bool getMsgList(const uint32_t &token, GxsMsgIdResult& msgIds) { - return mGxs->getMsgList(token, msgIds); + return mGxs.getMsgList(token, msgIds); } /*! @@ -104,7 +95,7 @@ public: */ bool getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult &msgIds) { - return mGxs->getMsgRelatedList(token, msgIds); + return mGxs.getMsgRelatedList(token, msgIds); } /*! @@ -115,7 +106,7 @@ public: bool getGroupSummary(const uint32_t &token, std::list &groupInfo) { - return mGxs->getGroupMeta(token, groupInfo); + return mGxs.getGroupMeta(token, groupInfo); } /*! @@ -126,7 +117,7 @@ public: bool getMsgSummary(const uint32_t &token, GxsMsgMetaMap &msgInfo) { - return mGxs->getMsgMeta(token, msgInfo); + return mGxs.getMsgMeta(token, msgInfo); } /*! @@ -136,7 +127,7 @@ public: */ bool getMsgRelatedSummary(const uint32_t &token, GxsMsgRelatedMetaMap &msgInfo) { - return mGxs->getMsgRelatedMeta(token, msgInfo); + return mGxs.getMsgRelatedMeta(token, msgInfo); } /*! @@ -147,7 +138,7 @@ public: */ bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) { - return mGxs->subscribeToGroup(token, grpId, subscribe); + return mGxs.subscribeToGroup(token, grpId, subscribe); } /*! @@ -159,7 +150,7 @@ public: */ bool acknowledgeMsg(const uint32_t& token, std::pair& msgId) { - return mGxs->acknowledgeTokenMsg(token, msgId); + return mGxs.acknowledgeTokenMsg(token, msgId); } /*! @@ -171,7 +162,7 @@ public: */ bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) { - return mGxs->acknowledgeTokenGrp(token, grpId); + return mGxs.acknowledgeTokenGrp(token, grpId); } /*! @@ -182,7 +173,7 @@ public: */ bool getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats) { - return mGxs->getServiceStatistic(token, stats); + return mGxs.getServiceStatistic(token, stats); } /*! @@ -193,7 +184,7 @@ public: */ bool getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats) { - return mGxs->getGroupStatistic(token, stats); + return mGxs.getGroupStatistic(token, stats); } /*! @@ -206,7 +197,7 @@ public: */ void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff) { - return mGxs->setGroupReputationCutOff(token, grpId, CutOff); + return mGxs.setGroupReputationCutOff(token, grpId, CutOff); } /*! @@ -214,36 +205,86 @@ public: */ uint32_t getDefaultStoragePeriod() { - return mGxs->getDefaultStoragePeriod(); + return mGxs.getDefaultStoragePeriod(); } uint32_t getStoragePeriod(const RsGxsGroupId& grpId) { - return mGxs->getStoragePeriod(grpId); + return mGxs.getStoragePeriod(grpId); } void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) { - mGxs->setStoragePeriod(grpId,age_in_secs); + mGxs.setStoragePeriod(grpId,age_in_secs); } uint32_t getDefaultSyncPeriod() { - return mGxs->getDefaultSyncPeriod(); + return mGxs.getDefaultSyncPeriod(); } uint32_t getSyncPeriod(const RsGxsGroupId& grpId) { - return mGxs->getSyncPeriod(grpId); + return mGxs.getSyncPeriod(grpId); } void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) { - mGxs->setSyncPeriod(grpId,age_in_secs); + mGxs.setSyncPeriod(grpId,age_in_secs); } RsReputations::ReputationLevel minReputationForForwardingMessages(uint32_t group_sign_flags,uint32_t identity_flags) { - return mGxs->minReputationForForwardingMessages(group_sign_flags,identity_flags); + return mGxs.minReputationForForwardingMessages(group_sign_flags,identity_flags); } -private: - RsGxsIface* mGxs; + /// @see RsTokenService::requestGroupInfo + bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts, + const std::list &groupIds ) + { return mTokenService.requestGroupInfo(token, 0, opts, groupIds); } + + /// @see RsTokenService::requestGroupInfo + bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts) + { return mTokenService.requestGroupInfo(token, 0, opts); } + + /// @see RsTokenService::requestMsgInfo + bool requestMsgInfo( uint32_t& token, + const RsTokReqOptions& opts, const GxsMsgReq& msgIds ) + { return mTokenService.requestMsgInfo(token, 0, opts, msgIds); } + + /// @see RsTokenService::requestMsgInfo + bool requestMsgInfo( + uint32_t& token, const RsTokReqOptions& opts, + const std::list& grpIds ) + { return mTokenService.requestMsgInfo(token, 0, opts, grpIds); } + + /// @see RsTokenService::requestMsgRelatedInfo + bool requestMsgRelatedInfo( + uint32_t& token, const RsTokReqOptions& opts, + const std::vector& msgIds ) + { return mTokenService.requestMsgRelatedInfo(token, 0, opts, msgIds); } + + /// @see RsTokenService::requestStatus + RsTokenService::GxsRequestStatus requestStatus(uint32_t token) + { return mTokenService.requestStatus(token); } + + /// @see RsTokenService::requestServiceStatistic + void requestServiceStatistic(uint32_t& token) + { mTokenService.requestServiceStatistic(token); } + + /// @see RsTokenService::requestGroupStatistic + void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId) + { mTokenService.requestGroupStatistic(token, grpId); } + + /// @see RsTokenService::cancelRequest + bool cancelRequest(uint32_t token) + { return mTokenService.cancelRequest(token); } + + /** + * @deprecated + * Token service methods are already exposed by this helper, so you should + * not need to get token service pointer directly anymore. + */ + RS_DEPRECATED RsTokenService* getTokenService() { return &mTokenService; } + +private: + RsGxsIface& mGxs; + RsTokenService& mTokenService; }; #endif // RSGXSIFACEIMPL_H diff --git a/libretroshare/src/retroshare/rsgxstrans.h b/libretroshare/src/retroshare/rsgxstrans.h index b78191d97..bee1e11ec 100644 --- a/libretroshare/src/retroshare/rsgxstrans.h +++ b/libretroshare/src/retroshare/rsgxstrans.h @@ -91,7 +91,7 @@ public: std::vector outgoing_records; }; - RsGxsTrans(RsGxsIface *gxs) : RsGxsIfaceHelper(gxs) {} + RsGxsTrans(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} virtual ~RsGxsTrans() {} diff --git a/libretroshare/src/retroshare/rsidentity.h b/libretroshare/src/retroshare/rsidentity.h index 47da42de4..aa4734fc0 100644 --- a/libretroshare/src/retroshare/rsidentity.h +++ b/libretroshare/src/retroshare/rsidentity.h @@ -343,7 +343,7 @@ struct RsIdentityDetails : RsSerializable struct RsIdentity : RsGxsIfaceHelper { - explicit RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {} + explicit RsIdentity(RsGxsIface& gxs): RsGxsIfaceHelper(gxs) {} virtual ~RsIdentity() {} /********************************************************************************************/ diff --git a/libretroshare/src/retroshare/rsposted.h b/libretroshare/src/retroshare/rsposted.h index 586449a47..801ef37fa 100644 --- a/libretroshare/src/retroshare/rsposted.h +++ b/libretroshare/src/retroshare/rsposted.h @@ -78,7 +78,7 @@ class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService //static const uint32_t FLAG_MSGTYPE_POST; //static const uint32_t FLAG_MSGTYPE_MASK; - explicit RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) {} + explicit RsPosted(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} virtual ~RsPosted() {} /* Specific Service Data */ diff --git a/libretroshare/src/retroshare/rstokenservice.h b/libretroshare/src/retroshare/rstokenservice.h index ceefe28ad..604bd87d2 100644 --- a/libretroshare/src/retroshare/rstokenservice.h +++ b/libretroshare/src/retroshare/rstokenservice.h @@ -220,19 +220,14 @@ public: */ virtual void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId) = 0; - - /* Cancel Request */ - - /*! - * If this function returns false, it may be that the request has completed - * already. Useful for very expensive request. This is a blocking operation - * @param token the token of the request to cancel - * @return false if unusuccessful in cancelling request, true if successful - */ - virtual bool cancelRequest(const uint32_t &token) = 0; - - - + /*! + * @brief Cancel Request + * If this function returns false, it may be that the request has completed + * already. Useful for very expensive request. + * @param token the token of the request to cancel + * @return false if unusuccessful in cancelling request, true if successful + */ + virtual bool cancelRequest(const uint32_t &token) = 0; }; #endif // RSTOKENSERVICE_H diff --git a/libretroshare/src/retroshare/rswiki.h b/libretroshare/src/retroshare/rswiki.h index 9db3ff7e6..3baeeb5cb 100644 --- a/libretroshare/src/retroshare/rswiki.h +++ b/libretroshare/src/retroshare/rswiki.h @@ -115,10 +115,10 @@ std::ostream &operator<<(std::ostream &out, const RsWikiComment &comment); class RsWiki: public RsGxsIfaceHelper { - public: +public: - RsWiki(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) { return; } -virtual ~RsWiki() { return; } + RsWiki(RsGxsIface& gxs): RsGxsIfaceHelper(gxs) {} + virtual ~RsWiki() {} /* Specific Service Data */ virtual bool getCollections(const uint32_t &token, std::vector &collections) = 0; diff --git a/libretroshare/src/retroshare/rswire.h b/libretroshare/src/retroshare/rswire.h index d9cdb7832..b01da9919 100644 --- a/libretroshare/src/retroshare/rswire.h +++ b/libretroshare/src/retroshare/rswire.h @@ -108,7 +108,7 @@ class RsWire: public RsGxsIfaceHelper { public: - explicit RsWire(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {} + explicit RsWire(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} virtual ~RsWire() {} /* Specific Service Data */ diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 74fc9d080..ee6c4d2eb 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -68,8 +68,12 @@ RsGxsChannels *rsGxsChannels = NULL; /******************* Startup / Tick ******************************************/ /********************************************************************************/ -p3GxsChannels::p3GxsChannels(RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs) - : RsGenExchange(gds, nes, new RsGxsChannelSerialiser(), RS_SERVICE_GXS_TYPE_CHANNELS, gixs, channelsAuthenPolicy()), RsGxsChannels(this), GxsTokenQueue(this) +p3GxsChannels::p3GxsChannels( + RsGeneralDataService *gds, RsNetworkExchangeService *nes, + RsGixs* gixs ) : + RsGenExchange( gds, nes, new RsGxsChannelSerialiser(), + RS_SERVICE_GXS_TYPE_CHANNELS, gixs, channelsAuthenPolicy() ), + RsGxsChannels(static_cast(*this)), GxsTokenQueue(this) { // For Dummy Msgs. mGenActive = false; diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 5593250f7..54959ddb6 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -111,16 +111,16 @@ RsGxsCircles *rsGxsCircles = NULL; /******************* Startup / Tick ******************************************/ /********************************************************************************/ -p3GxsCircles::p3GxsCircles(RsGeneralDataService *gds, RsNetworkExchangeService *nes, - p3IdService *identities, PgpAuxUtils *pgpUtils) - : RsGxsCircleExchange(gds, nes, new RsGxsCircleSerialiser(), - RS_SERVICE_GXS_TYPE_GXSCIRCLE, identities, circleAuthenPolicy()), - RsGxsCircles(this), GxsTokenQueue(this), RsTickEvent(), - mIdentities(identities), - mPgpUtils(pgpUtils), - mCircleMtx("p3GxsCircles"), - mCircleCache(DEFAULT_MEM_CACHE_SIZE, "GxsCircleCache") - +p3GxsCircles::p3GxsCircles( + RsGeneralDataService *gds, RsNetworkExchangeService *nes, + p3IdService *identities, PgpAuxUtils *pgpUtils) : + RsGxsCircleExchange( + gds, nes, new RsGxsCircleSerialiser(), RS_SERVICE_GXS_TYPE_GXSCIRCLE, + identities, circleAuthenPolicy() ), + RsGxsCircles(static_cast(*this)), GxsTokenQueue(this), + RsTickEvent(), mIdentities(identities), mPgpUtils(pgpUtils), + mCircleMtx("p3GxsCircles"), + mCircleCache(DEFAULT_MEM_CACHE_SIZE, "GxsCircleCache" ) { // Kick off Cache Testing, + Others. //RsTickEvent::schedule_in(CIRCLE_EVENT_CACHETEST, CACHETEST_PERIOD); diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 57f129449..e7f41b950 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -55,7 +55,8 @@ p3GxsForums::p3GxsForums( RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs ) : RsGenExchange( gds, nes, new RsGxsForumSerialiser(), RS_SERVICE_GXS_TYPE_FORUMS, gixs, forumsAuthenPolicy()), - RsGxsForums(this), mGenToken(0), mGenActive(false), mGenCount(0) + RsGxsForums(static_cast(*this)), mGenToken(0), + mGenActive(false), mGenCount(0) { // Test Data disabled in Repo. //RsTickEvent::schedule_in(FORUM_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD); diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 76c43e5bd..9f4f438b6 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -156,12 +156,14 @@ RsIdentity *rsIdentity = NULL; /******************* Startup / Tick ******************************************/ /********************************************************************************/ -p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *nes, PgpAuxUtils *pgpUtils) - : RsGxsIdExchange(gds, nes, new RsGxsIdSerialiser(), RS_SERVICE_GXS_TYPE_GXSID, idAuthenPolicy()), - RsIdentity(this), GxsTokenQueue(this), RsTickEvent(), - mKeyCache(GXSID_MAX_CACHE_SIZE, "GxsIdKeyCache"), - mIdMtx("p3IdService"), mNes(nes), - mPgpUtils(pgpUtils) +p3IdService::p3IdService( + RsGeneralDataService *gds, RsNetworkExchangeService *nes, + PgpAuxUtils *pgpUtils ) : + RsGxsIdExchange( gds, nes, new RsGxsIdSerialiser(), + RS_SERVICE_GXS_TYPE_GXSID, idAuthenPolicy() ), + RsIdentity(static_cast(*this)), GxsTokenQueue(this), + RsTickEvent(), mKeyCache(GXSID_MAX_CACHE_SIZE, "GxsIdKeyCache"), + mIdMtx("p3IdService"), mNes(nes), mPgpUtils(pgpUtils) { mBgSchedule_Mode = 0; mBgSchedule_Active = false; diff --git a/libretroshare/src/services/p3posted.cc b/libretroshare/src/services/p3posted.cc index 555f2147f..c8fe5a5f9 100644 --- a/libretroshare/src/services/p3posted.cc +++ b/libretroshare/src/services/p3posted.cc @@ -40,13 +40,12 @@ RsPosted *rsPosted = NULL; /******************* Startup / Tick ******************************************/ /********************************************************************************/ -p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes, RsGixs* gixs) - :p3PostBase(gds, nes, gixs, new RsGxsPostedSerialiser(), RS_SERVICE_GXS_TYPE_POSTED), - RsPosted(this) -{ - return; -} - +p3Posted::p3Posted( + RsGeneralDataService *gds, RsNetworkExchangeService *nes, + RsGixs* gixs ) : + p3PostBase( gds, nes, gixs, new RsGxsPostedSerialiser(), + RS_SERVICE_GXS_TYPE_POSTED ), + RsPosted(static_cast(*this)) {} const std::string GXS_POSTED_APP_NAME = "gxsposted"; const uint16_t GXS_POSTED_APP_MAJOR_VERSION = 1; From a5d1a154a473b0cd1c1550fa31777412ba453ad9 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 25 Jun 2018 23:08:10 +0200 Subject: [PATCH 086/213] remove channel/posted/forum info when no group is selected --- .../src/gui/Posted/PostedListWidget.cpp | 4 +++ .../src/gui/Posted/PostedListWidget.h | 1 + .../src/gui/gxs/GxsMessageFramePostWidget.h | 1 + .../src/gui/gxs/GxsMessageFrameWidget.cpp | 31 +++++++++++-------- .../src/gui/gxs/GxsMessageFrameWidget.h | 1 + .../gui/gxschannels/GxsChannelPostsWidget.cpp | 14 +++++++++ .../gui/gxschannels/GxsChannelPostsWidget.h | 1 + .../gui/gxsforums/GxsForumThreadWidget.cpp | 22 +++++++++++++ .../src/gui/gxsforums/GxsForumThreadWidget.h | 1 + 9 files changed, 63 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp index d321933eb..f7e47863f 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp @@ -454,6 +454,10 @@ void PostedListWidget::applyRanking() ui->scrollAreaWidgetContents->update(); } +void PostedListWidget::blank() +{ + clearPosts(); +} void PostedListWidget::clearPosts() { /* clear all messages */ diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.h b/retroshare-gui/src/gui/Posted/PostedListWidget.h index 89f95e995..b9102cabb 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.h +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.h @@ -63,6 +63,7 @@ protected: virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread); virtual void insertPosts(const uint32_t &token); virtual void clearPosts(); + virtual void blank(); virtual bool navigatePostItem(const RsGxsMessageId& msgId); /* GxsMessageFrameWidget */ diff --git a/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h b/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h index 2a42cb772..bebdae7cc 100644 --- a/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h +++ b/retroshare-gui/src/gui/gxs/GxsMessageFramePostWidget.h @@ -57,6 +57,7 @@ protected: virtual void groupNameChanged(const QString &/*name*/) {} virtual void clearPosts() = 0; + virtual void blank() = 0; virtual bool navigatePostItem(const RsGxsMessageId& msgId) = 0; /* Thread functions */ diff --git a/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.cpp b/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.cpp index e3b4f3cfe..18db60fa2 100644 --- a/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.cpp @@ -72,21 +72,26 @@ bool GxsMessageFrameWidget::isWaiting() void GxsMessageFrameWidget::setGroupId(const RsGxsGroupId &groupId) { - if (mGroupId == groupId) { - if (!groupId.isNull()) { - return; + if (mGroupId == groupId && !groupId.isNull()) + return; + + if(!groupId.isNull()) + { + mAcknowledgeReadStatusToken = 0; + if (mStateHelper->isLoading(mTokenTypeAcknowledgeReadStatus)) { + mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false); + + emit waitingChanged(this); } + + mGroupId = groupId; + groupIdChanged(); } - - mAcknowledgeReadStatusToken = 0; - if (mStateHelper->isLoading(mTokenTypeAcknowledgeReadStatus)) { - mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false); - - emit waitingChanged(this); - } - - mGroupId = groupId; - groupIdChanged(); + else + { + mGroupId.clear(); + blank(); // clear the displayed data, because no group is selected. + } } void GxsMessageFrameWidget::setAllMessagesRead(bool read) diff --git a/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.h b/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.h index 71d0ae2a1..a99aada3c 100644 --- a/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.h +++ b/retroshare-gui/src/gui/gxs/GxsMessageFrameWidget.h @@ -43,6 +43,7 @@ public: virtual void groupIdChanged() = 0; virtual QString groupName(bool withUnreadCount) = 0; virtual QIcon groupIcon() = 0; + virtual void blank() =0; virtual bool navigate(const RsGxsMessageId& msgId) = 0; virtual bool isLoading(); virtual bool isWaiting(); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index b3f5662b4..379b20823 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -596,6 +596,20 @@ void GxsChannelPostsWidget::clearPosts() ui->fileWidget->clear(); } +void GxsChannelPostsWidget::blank() +{ + mStateHelper->setWidgetEnabled(ui->postButton, false); + mStateHelper->setWidgetEnabled(ui->subscribeToolButton, false); + + clearPosts(); + + groupNameChanged(QString()); + + ui->infoWidget->hide(); + ui->feedWidget->show(); + ui->fileWidget->hide(); +} + bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId) { FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(groupId(), msgId); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h index ddeb474a0..cfd442973 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h @@ -73,6 +73,7 @@ protected: virtual bool useThread() { return mUseThread; } virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count); virtual bool navigatePostItem(const RsGxsMessageId& msgId); + virtual void blank() ; /* GxsMessageFrameWidget */ virtual void setAllMessagesReadDo(bool read, uint32_t &token); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 7b9ff9183..a621872d4 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -299,6 +299,28 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget } +void GxsForumThreadWidget::blank() +{ + ui->progressBar->hide(); + ui->progressText->hide(); + ui->postText->clear() ; + ui->by_label->setId(RsGxsId()) ; + ui->time_label->clear(); + ui->lineRight->hide(); + ui->lineLeft->hide(); + ui->by_text_label->hide(); + ui->by_label->hide(); + ui->postText->setImageBlockWidget(ui->imageBlockWidget) ; + ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages()); + ui->threadTreeWidget->clear(); + ui->forumName->setText(""); + + mStateHelper->setWidgetEnabled(ui->newthreadButton, false); + mStateHelper->setWidgetEnabled(ui->previousButton, false); + mStateHelper->setWidgetEnabled(ui->nextButton, false); + ui->versions_CB->hide(); +} + GxsForumThreadWidget::~GxsForumThreadWidget() { if (mFillThread) { diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h index 71103507e..cbec31440 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h @@ -58,6 +58,7 @@ public: // Callback for all Loads. virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req); + virtual void blank(); protected: bool eventFilter(QObject *obj, QEvent *ev); From 15f39129f1225695a95ada01e4ec3b7185ebc4d5 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 26 Jun 2018 13:20:24 +0200 Subject: [PATCH 087/213] Complete GxsChannels JSON API with blocking methods RsGxsIfaceHelper::requestStatus expose it to JSON API Implemented RsGxsIfaceHelper::waitToken to wait for GXS operations RsItem::serial_process fix doxygen warning as it's a comment not documentation RsTypeSerializer add JSON conversion methods for double [de]serialization not implemented yet RsTypeSerializer_PRIVATE_{FROM,TO}_JSON_ARRAY fix doxygen warning as it's a comment not documentation make GxsChannels::ExtraFileHash a bit more reasonable jsonapi-generator fix unused variable warning if there is no input or output paramethers jsonapi-generator fix generation for inerithed jsonapi methods Convert to RsSerializable some Gxs structs for the JSON API --- .../src/jsonapi-generator-doxygen.conf | 1 - jsonapi-generator/src/jsonapi-generator.cpp | 52 +++++-- .../src/method-wrapper-template.cpp.tmpl | 9 -- libretroshare/src/libretroshare.pro | 2 +- libretroshare/src/retroshare/rsgxschannels.h | 134 +++++++++++++----- libretroshare/src/retroshare/rsgxscommon.h | 27 +++- .../src/retroshare/rsgxsifacehelper.h | 30 +++- libretroshare/src/rsitems/rsitem.h | 2 +- .../src/serialiser/rstypeserializer.cc | 43 ++++++ .../src/serialiser/rstypeserializer.h | 4 +- libretroshare/src/services/p3gxschannels.cc | 62 ++++++-- libretroshare/src/services/p3gxschannels.h | 26 +++- .../gui/gxschannels/CreateGxsChannelMsg.cpp | 6 +- 13 files changed, 316 insertions(+), 82 deletions(-) diff --git a/jsonapi-generator/src/jsonapi-generator-doxygen.conf b/jsonapi-generator/src/jsonapi-generator-doxygen.conf index e27bf7a40..d7fbafebb 100644 --- a/jsonapi-generator/src/jsonapi-generator-doxygen.conf +++ b/jsonapi-generator/src/jsonapi-generator-doxygen.conf @@ -1,6 +1,5 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "libretroshare" -#OUTPUT_DIRECTORY = ALIASES += jsonapi{1}="\xmlonly\endxmlonly" diff --git a/jsonapi-generator/src/jsonapi-generator.cpp b/jsonapi-generator/src/jsonapi-generator.cpp index e314ef2ea..b48ebb386 100644 --- a/jsonapi-generator/src/jsonapi-generator.cpp +++ b/jsonapi-generator/src/jsonapi-generator.cpp @@ -115,9 +115,12 @@ int main(int argc, char *argv[]) QString refid(member.attributes().namedItem("refid").nodeValue()); QString methodName(member.firstChildElement("name").toElement().text()); QString wrapperName(instanceName+methodName+"Wrapper"); + QString defFilePath(doxPrefix + refid.split('_')[0] + ".xml"); + + qDebug() << "Looking for" << typeName << methodName << "into" + << typeFilePath; QDomDocument defDoc; - QString defFilePath(doxPrefix + refid.split('_')[0] + ".xml"); QFile defFile(defFilePath); if ( !defFile.open(QIODevice::ReadOnly) || !defDoc.setContent(&defFile, &parseError, &line, &column) ) @@ -128,7 +131,7 @@ int main(int argc, char *argv[]) } QDomElement memberdef; - QDomNodeList memberdefs = typeDoc.elementsByTagName("memberdef"); + QDomNodeList memberdefs = defDoc.elementsByTagName("memberdef"); for (int k = 0; k < memberdefs.size(); ++k) { QDomElement tmpMBD = memberdefs.item(k).toElement(); @@ -148,6 +151,8 @@ int main(int argc, char *argv[]) QString retvalType = memberdef.firstChildElement("type").text(); QMap paramsMap; QStringList orderedParamNames; + uint hasInput = false; + uint hasOutput = false; QDomNodeList params = memberdef.elementsByTagName("param"); for (int k = 0; k < params.size(); ++k) @@ -171,10 +176,20 @@ int main(int argc, char *argv[]) QDomElement tmpPN = parameternames.item(k).toElement(); MethodParam& tmpParam = paramsMap[tmpPN.text()]; QString tmpD = tmpPN.attributes().namedItem("direction").nodeValue(); - tmpParam.in = tmpD.contains("in"); - tmpParam.out = tmpD.contains("out"); + if(tmpD.contains("in")) + { + tmpParam.in = true; + hasInput = true; + } + if(tmpD.contains("out")) + { + tmpParam.out = true; + hasOutput = true; + } } + if(retvalType != "void") hasOutput = true; + qDebug() << instanceName << apiPath << retvalType << typeName << methodName; for (const QString& pn : orderedParamNames) @@ -183,13 +198,25 @@ int main(int argc, char *argv[]) qDebug() << "\t" << mp.type << mp.name << mp.in << mp.out; } - QString retvalSerialization; - if(retvalType != "void") - retvalSerialization = "\t\t\tRS_SERIAL_PROCESS(retval);"; + QString inputParamsDeserialization; + if(hasInput) + { + inputParamsDeserialization += + "\t\t{\n" + "\t\t\tRsGenericSerializer::SerializeContext& ctx(cReq);\n" + "\t\t\tRsGenericSerializer::SerializeJob j(RsGenericSerializer::FROM_JSON);\n"; + } + + QString outputParamsSerialization; + if(hasOutput) + { + outputParamsSerialization += + "\t\t{\n" + "\t\t\tRsGenericSerializer::SerializeContext& ctx(cAns);\n" + "\t\t\tRsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON);\n"; + } QString paramsDeclaration; - QString inputParamsDeserialization; - QString outputParamsSerialization; for (const QString& pn : orderedParamNames) { const MethodParam& mp(paramsMap[pn]); @@ -202,13 +229,18 @@ int main(int argc, char *argv[]) + mp.name + ");\n"; } + if(hasInput) inputParamsDeserialization += "\t\t}\n"; + if(retvalType != "void") + outputParamsSerialization += + "\t\t\tRS_SERIAL_PROCESS(retval);\n"; + if(hasOutput) outputParamsSerialization += "\t\t}\n"; + QMap substitutionsMap; substitutionsMap.insert("instanceName", instanceName); substitutionsMap.insert("methodName", methodName); substitutionsMap.insert("paramsDeclaration", paramsDeclaration); substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization); substitutionsMap.insert("outputParamsSerialization", outputParamsSerialization); - substitutionsMap.insert("retvalSerialization", retvalSerialization); substitutionsMap.insert("retvalType", retvalType); substitutionsMap.insert("callParamsList", orderedParamNames.join(", ")); substitutionsMap.insert("wrapperName", wrapperName); diff --git a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl index 63a2dfff1..b7fc829e2 100644 --- a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl +++ b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl @@ -47,22 +47,13 @@ void $%wrapperName%$(const std::shared_ptr session) $%paramsDeclaration%$ // deserialize input parameters from JSON - { - RsGenericSerializer::SerializeContext& ctx(cReq); - RsGenericSerializer::SerializeJob j(RsGenericSerializer::FROM_JSON); $%inputParamsDeserialization%$ - } // call retroshare C++ API $%retvalType%$ retval = $%instanceName%$->$%methodName%$($%callParamsList%$); // serialize out parameters and return value to JSON - { - RsGenericSerializer::SerializeContext& ctx(cAns); - RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON); -$%retvalSerialization%$ $%outputParamsSerialization%$ - } // return them to the API caller std::stringstream ss; diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 29acb8e92..a2db59f79 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -853,7 +853,7 @@ rs_jsonapi { JSONAPI_GENERATOR_SRC=$$system_path($$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/)) JSONAPI_GENERATOR_OUT=$$system_path($$clean_path($${RS_BUILD_PATH}/jsonapi-generator/src/)) JSONAPI_GENERATOR_EXE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator)) - DOXIGEN_INPUT_DIRECTORY=$$system_path($$clean_path($${PWD}/retroshare/)) + DOXIGEN_INPUT_DIRECTORY=$$system_path($$clean_path($${PWD})) DOXIGEN_CONFIG_SRC=$$system_path($$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/jsonapi-generator-doxygen.conf)) DOXIGEN_CONFIG_OUT=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator-doxygen.conf)) WRAPPERS_DEF_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-wrappers.cpp)) diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index fb8ce8f06..cc1b1418d 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -108,29 +108,83 @@ public: explicit RsGxsChannels(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {} virtual ~RsGxsChannels() {} - /* Specific Service Data */ -virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; -virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; -virtual bool getPostData(const uint32_t &token, std::vector &posts) = 0; -//Not currently used -//virtual bool getRelatedPosts(const uint32_t &token, std::vector &posts) = 0; - - /* From RsGxsCommentService */ -//virtual bool getCommentData(const uint32_t &token, std::vector &comments) = 0; -//virtual bool getRelatedComments(const uint32_t &token, std::vector &comments) = 0; -//virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0; -//virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0; - - ////////////////////////////////////////////////////////////////////////////// -virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; - -virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) = 0; -virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) = 0; - -virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory)=0; + /** + * @brief Get channels summaries list. Blocking API. + * @jsonapi{development} + * @param[out] channels list where to store the channels + * @return false if something failed, true otherwhise + */ + virtual bool getChannelsSummaries(std::list& channels) = 0; /** - * Get download directory for the given channel + * @brief Get channels information (description, thumbnail...). + * Blocking API. + * @jsonapi{development} + * @param[in] chanIds ids of the channels of which to get the informations + * @param[out] channelsInfo storage for the channels informations + * @return false if something failed, true otherwhise + */ + virtual bool getChannelsInfo( + const std::list& chanIds, + std::vector& channelsInfo ) = 0; + + /** + * @brief Get content of specified channels. Blocking API + * @jsonapi{development} + * @param[in] chanIds id of the channels of which the content is requested + * @param[out] posts storage for the posts + * @param[out] comments storage for the comments + * @return false if something failed, true otherwhise + */ + virtual bool getChannelsContent( + const std::list& chanIds, + std::vector& posts, + std::vector& comments ) = 0; + + /* Specific Service Data + * TODO: change the orrible const uint32_t &token to uint32_t token + * TODO: create a new typedef for token so code is easier to read + */ + virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; + virtual bool getPostData(const uint32_t &token, std::vector &posts) = 0; + + + virtual void setMessageReadStatus( + uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; + + /** + * @brief Enable or disable auto-download for given channel + * @jsonapi{development} + * @param[in] groupId channel id + * @param[in] enable true to enable, false to disable + * @return false if something failed, true otherwhise + */ + virtual bool setChannelAutoDownload( + const RsGxsGroupId &groupId, bool enable) = 0; + + /** + * @brief Get auto-download option value for given channel + * @jsonapi{development} + * @param[in] groupId channel id + * @param[in] enabled storage for the auto-download option value + * @return false if something failed, true otherwhise + */ + virtual bool getChannelAutoDownload( + const RsGxsGroupId &groupId, bool& enabled) = 0; + + /** + * @brief Set download directory for the given channel + * @jsonapi{development} + * @param[in] channelId id of the channel + * @param[in] directory path + * @return false on error, true otherwise + */ + virtual bool setChannelDownloadDirectory( + const RsGxsGroupId& channelId, const std::string& directory) = 0; + + /** + * @brief Get download directory for the given channel * @jsonapi{development} * @param[in] channelId id of the channel * @param[out] directory reference to string where to store the path @@ -139,13 +193,16 @@ virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std: virtual bool getChannelDownloadDirectory( const RsGxsGroupId& channelId, std::string& directory ) = 0; -//virtual void setChannelAutoDownload(uint32_t& token, const RsGxsGroupId& groupId, bool autoDownload) = 0; - -//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask); -//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask); - -//virtual bool groupRestoreKeys(const std::string &groupId); - virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set& peers)=0; + /** + * @brief Share channel publishing key + * This can be used to authorize other peers to post on the channel + * @jsonapi{development} + * param[in] groupId Channel id + * param[in] peers peers to which share the key + * @return false on error, true otherwise + */ + virtual bool groupShareKeys( + const RsGxsGroupId& groupId, const std::set& peers ) = 0; /** * @brief Request subscription to a group. @@ -197,11 +254,22 @@ virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std: */ virtual bool updateGroup(uint32_t& token, RsGxsChannelGroup& group) = 0; - // File Interface -virtual bool ExtraFileHash(const std::string &path, std::string filename) = 0; -virtual bool ExtraFileRemove(const RsFileHash &hash) = 0; + /** + * @brief Share extra file + * Can be used to share extra file attached to a channel post + * @jsonapi{development} + * @param[in] path file path + * @return false on error, true otherwise + */ + virtual bool ExtraFileHash(const std::string& path) = 0; + + /** + * @brief Remove extra file from shared files + * @jsonapi{development} + * @param[in] hash hash of the file to remove + * @return false on error, true otherwise + */ + virtual bool ExtraFileRemove(const RsFileHash& hash) = 0; }; - - #endif diff --git a/libretroshare/src/retroshare/rsgxscommon.h b/libretroshare/src/retroshare/rsgxscommon.h index 861299b6f..0ecd933f0 100644 --- a/libretroshare/src/retroshare/rsgxscommon.h +++ b/libretroshare/src/retroshare/rsgxscommon.h @@ -94,17 +94,23 @@ namespace GXS_SERV { -class RsGxsVote +struct RsGxsVote : RsSerializable { - public: RsGxsVote(); RsMsgMetaData mMeta; uint32_t mVoteType; + + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mMeta); + RS_SERIAL_PROCESS(mVoteType); + } }; -class RsGxsComment +struct RsGxsComment : RsSerializable { - public: RsGxsComment(); RsMsgMetaData mMeta; std::string mComment; @@ -119,6 +125,19 @@ class RsGxsComment // This is filled in if detailed Comment Data is called. std::list mVotes; + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mMeta); + RS_SERIAL_PROCESS(mComment); + RS_SERIAL_PROCESS(mUpVotes); + RS_SERIAL_PROCESS(mDownVotes); + RS_SERIAL_PROCESS(mScore); + RS_SERIAL_PROCESS(mOwnVote); + RS_SERIAL_PROCESS(mVotes); + } + const std::ostream &print(std::ostream &out, std::string indent = "", std::string varName = "") const { out << indent << varName << " of RsGxsComment Values ###################" << std::endl; mMeta.print(out, indent + " ", "mMeta"); diff --git a/libretroshare/src/retroshare/rsgxsifacehelper.h b/libretroshare/src/retroshare/rsgxsifacehelper.h index 0899c5205..5a8c2d5fd 100644 --- a/libretroshare/src/retroshare/rsgxsifacehelper.h +++ b/libretroshare/src/retroshare/rsgxsifacehelper.h @@ -27,6 +27,9 @@ * */ +#include +#include + #include "retroshare/rsgxsiface.h" #include "retroshare/rsreputations.h" #include "rsgxsflags.h" @@ -259,7 +262,10 @@ struct RsGxsIfaceHelper const std::vector& msgIds ) { return mTokenService.requestMsgRelatedInfo(token, 0, opts, msgIds); } - /// @see RsTokenService::requestStatus + /** + * @jsonapi{development} + * @param[in] token + */ RsTokenService::GxsRequestStatus requestStatus(uint32_t token) { return mTokenService.requestStatus(token); } @@ -282,6 +288,28 @@ struct RsGxsIfaceHelper */ RS_DEPRECATED RsTokenService* getTokenService() { return &mTokenService; } +protected: + /** + * Block caller while request is being processed. + * Useful for blocking API implementation. + * @param[in] token token associated to the request caller is waiting for + * @param[in] maxWait maximum waiting time in milliseconds + */ + RsTokenService::GxsRequestStatus waitToken( + uint32_t token, + std::chrono::milliseconds maxWait = std::chrono::milliseconds(500) ) + { + auto timeout = std::chrono::steady_clock::now() + maxWait; + auto st = requestStatus(token); + while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE) + && std::chrono::steady_clock::now() < timeout ) + { + std::this_thread::sleep_for(std::chrono::milliseconds(2)); + st = requestStatus(token); + } + return st; + } + private: RsGxsIface& mGxs; RsTokenService& mTokenService; diff --git a/libretroshare/src/rsitems/rsitem.h b/libretroshare/src/rsitems/rsitem.h index 545870631..557bdf28e 100644 --- a/libretroshare/src/rsitems/rsitem.h +++ b/libretroshare/src/rsitems/rsitem.h @@ -73,7 +73,7 @@ struct RsItem : RsMemoryManagement::SmallObject, RsSerializable inline uint8_t priority_level() const { return _priority_level ;} inline void setPriorityLevel(uint8_t l) { _priority_level = l ;} - /** + /* * TODO: This default implementation should be removed and childs structs * implement ::serial_process(...) as soon as all the codebase is ported to * the new serialization system diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index ac3d0c6e9..0f613cbab 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -335,6 +335,49 @@ bool RsTypeSerializer::from_JSON( const std::string& memberName, return ret; } +template<> /*static*/ +uint32_t RsTypeSerializer::serial_size(const double&) +{ + std::cerr << "Binary [de]serialization not implemented yet for double" + << std::endl; + print_stacktrace(); + return 0; +} + +template<> /*static*/ +bool RsTypeSerializer::serialize(uint8_t[], uint32_t, uint32_t&, const double&) +{ + std::cerr << "Binary [de]serialization not implemented yet for double" + << std::endl; + print_stacktrace(); + return false; +} + +template<> /*static*/ +bool RsTypeSerializer::deserialize(const uint8_t[], uint32_t, uint32_t&, double&) +{ + std::cerr << "Binary [de]serialization not implemented yet for double" + << std::endl; + print_stacktrace(); + return false; +} + +template<> /*static*/ +void RsTypeSerializer::print_data(const std::string& n, const double& V) +{ std::cerr << " [double ] " << n << ": " << V << std::endl; } + +SIMPLE_TO_JSON_DEF(double) + +template<> /*static*/ +bool RsTypeSerializer::from_JSON( const std::string& memberName, + double& member, RsJson& jDoc ) +{ + SAFE_GET_JSON_V(); + ret = ret && v.IsDouble(); + if(ret) member = v.GetDouble(); + return ret; +} + //============================================================================// // std::string // diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index d809ecd54..690a176be 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -41,7 +41,7 @@ #include -/** INTERNAL ONLY helper to avoid copy paste code for std::{vector,list,set} +/* INTERNAL ONLY helper to avoid copy paste code for std::{vector,list,set} * Can't use a template function because T is needed for const_cast */ #define RsTypeSerializer_PRIVATE_TO_JSON_ARRAY() do \ { \ @@ -75,7 +75,7 @@ ctx.mJson.AddMember(arrKey, arr, allocator);\ } while (false) -/** INTERNAL ONLY helper to avoid copy paste code for std::{vector,list,set} +/* INTERNAL ONLY helper to avoid copy paste code for std::{vector,list,set} * Can't use a template function because std::{vector,list,set} has different * name for insert/push_back function */ diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index ee6c4d2eb..994cab506 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -399,10 +399,11 @@ bool p3GxsChannels::getGroupData(const uint32_t &token, std::vector& peers) +bool p3GxsChannels::groupShareKeys( + const RsGxsGroupId &groupId, const std::set& peers ) { - RsGenExchange::shareGroupPublishKey(groupId,peers) ; - return true ; + RsGenExchange::shareGroupPublishKey(groupId,peers); + return true; } @@ -999,6 +1000,50 @@ void p3GxsChannels::handleResponse(uint32_t token, uint32_t req_type) } } +//////////////////////////////////////////////////////////////////////////////// +/// Blocking API implementation begin +//////////////////////////////////////////////////////////////////////////////// + +bool p3GxsChannels::getChannelsSummaries( + std::list& channels ) +{ + uint32_t token; + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; + if( !requestGroupInfo(token, opts) + || waitToken(token) != RsTokenService::COMPLETE ) return false; + return getGroupSummary(token, channels); +} + +bool p3GxsChannels::getChannelsInfo( + const std::list& chanIds, + std::vector& channelsInfo ) +{ + uint32_t token; + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; + if( !requestGroupInfo(token, opts, chanIds) + || waitToken(token) != RsTokenService::COMPLETE ) return false; + return getGroupData(token, channelsInfo); +} + +bool p3GxsChannels::getChannelsContent( + const std::list& chanIds, + std::vector& posts, + std::vector& comments ) +{ + uint32_t token; + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; + if( !requestMsgInfo(token, opts, chanIds) + || waitToken(token) != RsTokenService::COMPLETE ) return false; + return getPostData(token, posts, comments); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Blocking API implementation end +//////////////////////////////////////////////////////////////////////////////// + /********************************************************************************************/ /********************************************************************************************/ @@ -1241,17 +1286,10 @@ bool p3GxsChannels::createPost(uint32_t &token, RsGxsChannelPost &msg) /********************************************************************************************/ /********************************************************************************************/ -bool p3GxsChannels::ExtraFileHash(const std::string &path, std::string filename) +bool p3GxsChannels::ExtraFileHash(const std::string& path) { - /* extract filename */ - filename = RsDirUtil::getTopDir(path); - - TransferRequestFlags flags = RS_FILE_REQ_ANONYMOUS_ROUTING; - if(!rsFiles->ExtraFileHash(path, GXSCHANNEL_STOREPERIOD, flags)) - return false; - - return true; + return rsFiles->ExtraFileHash(path, GXSCHANNEL_STOREPERIOD, flags); } diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index 0e6156f48..a411c37cc 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -94,7 +94,8 @@ virtual bool getPostData(const uint32_t &token, std::vector &p //virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask); //virtual bool groupRestoreKeys(const std::string &groupId); - virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set& peers) ; + virtual bool groupShareKeys( + const RsGxsGroupId &groupId, const std::set& peers); virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group); virtual bool createPost(uint32_t &token, RsGxsChannelPost &post); @@ -149,15 +150,30 @@ virtual void setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsgIdPair& virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read); // File Interface -virtual bool ExtraFileHash(const std::string &path, std::string filename); + virtual bool ExtraFileHash(const std::string& path); virtual bool ExtraFileRemove(const RsFileHash &hash); - protected: + /// Implementation of @see RsGxsChannels::getChannelsSummaries + virtual bool getChannelsSummaries(std::list& channels); + + /// Implementation of @see RsGxsChannels::getChannelsInfo + virtual bool getChannelsInfo( + const std::list& chanIds, + std::vector& channelsInfo ); + + /// Implementation of @see RsGxsChannels::getChannelContent + virtual bool getChannelsContent( + const std::list& chanIds, + std::vector& posts, + std::vector& comments ); + +protected: // Overloaded from GxsTokenQueue for Request callbacks. -virtual void handleResponse(uint32_t token, uint32_t req_type); + virtual void handleResponse(uint32_t token, uint32_t req_type); - private: + +private: static uint32_t channelsAuthenPolicy(); diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index b4470ac5c..6d8105531 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -31,6 +31,7 @@ #include "gui/RetroShareLink.h" #include "util/HandleRichText.h" #include "util/misc.h" +#include "util/rsdir.h" #include @@ -449,11 +450,10 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path) } FileInfo fInfo; - std::string filename; + std::string filename = RsDirUtil::getTopDir(path); uint64_t size = 0; RsFileHash hash ; - - rsGxsChannels->ExtraFileHash(path, filename); + rsGxsChannels->ExtraFileHash(path); // Only path and filename are valid. // Destroyed when fileFrame (this subfileitem) is destroyed From d14a455cf10e88fa5670d994f70df4757de19e13 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 26 Jun 2018 22:01:17 +0200 Subject: [PATCH 088/213] jsonapi-generator fix support for void methods Thanks sehraf for reporting retroshare://forum?name=fucking%20genius&id=8fd22bd8f99754461e7ba1ca8a727995&msgid=503d75bf7ed7fa7568eeae4db5c8d31a7e124c98 --- jsonapi-generator/src/jsonapi-generator.cpp | 14 +++++++++----- .../src/method-wrapper-template.cpp.tmpl | 2 +- libretroshare/src/pqi/authgpg.cc | 13 ++++++++++--- libretroshare/src/pqi/authgpg.h | 15 +++++++-------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/jsonapi-generator/src/jsonapi-generator.cpp b/jsonapi-generator/src/jsonapi-generator.cpp index b48ebb386..e0dd7659d 100644 --- a/jsonapi-generator/src/jsonapi-generator.cpp +++ b/jsonapi-generator/src/jsonapi-generator.cpp @@ -188,7 +188,14 @@ int main(int argc, char *argv[]) } } - if(retvalType != "void") hasOutput = true; + QString functionCall("\t\t"); + if(retvalType != "void") + { + functionCall += retvalType + " retval = "; + hasOutput = true; + } + functionCall += instanceName + "->" + methodName + "("; + functionCall += orderedParamNames.join(", ") + ");\n"; qDebug() << instanceName << apiPath << retvalType << typeName << methodName; @@ -236,15 +243,12 @@ int main(int argc, char *argv[]) if(hasOutput) outputParamsSerialization += "\t\t}\n"; QMap substitutionsMap; - substitutionsMap.insert("instanceName", instanceName); - substitutionsMap.insert("methodName", methodName); substitutionsMap.insert("paramsDeclaration", paramsDeclaration); substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization); substitutionsMap.insert("outputParamsSerialization", outputParamsSerialization); - substitutionsMap.insert("retvalType", retvalType); - substitutionsMap.insert("callParamsList", orderedParamNames.join(", ")); substitutionsMap.insert("wrapperName", wrapperName); substitutionsMap.insert("headerFileName", headerFileName); + substitutionsMap.insert("functionCall", functionCall); QFile templFile(sourcePath + "/method-wrapper-template.cpp.tmpl"); templFile.open(QIODevice::ReadOnly); diff --git a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl index b7fc829e2..417001ec6 100644 --- a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl +++ b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl @@ -50,7 +50,7 @@ $%paramsDeclaration%$ $%inputParamsDeserialization%$ // call retroshare C++ API - $%retvalType%$ retval = $%instanceName%$->$%methodName%$($%callParamsList%$); +$%functionCall%$ // serialize out parameters and return value to JSON $%outputParamsSerialization%$ diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index ccfb8a260..d9254214a 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -100,7 +100,11 @@ std::string pgp_pwd_callback(void * /*hook*/, const char *uid_title, const char return password ; } -void AuthGPG::init(const std::string& path_to_public_keyring,const std::string& path_to_secret_keyring,const std::string& path_to_trustdb,const std::string& pgp_lock_file) +void AuthGPG::init( + const std::string& path_to_public_keyring, + const std::string& path_to_secret_keyring, + const std::string& path_to_trustdb, + const std::string& pgp_lock_file) { if(_instance != NULL) { @@ -108,8 +112,11 @@ void AuthGPG::init(const std::string& path_to_public_keyring,const std::string& std::cerr << "AuthGPG::init() called twice!" << std::endl ; } - PGPHandler::setPassphraseCallback(pgp_pwd_callback) ; - _instance = new AuthGPG(path_to_public_keyring,path_to_secret_keyring,path_to_trustdb,pgp_lock_file) ; +// if(cb) PGPHandler::setPassphraseCallback(cb);else + PGPHandler::setPassphraseCallback(pgp_pwd_callback); + _instance = new AuthGPG( path_to_public_keyring, + path_to_secret_keyring, + path_to_trustdb, pgp_lock_file ); } void AuthGPG::exit() diff --git a/libretroshare/src/pqi/authgpg.h b/libretroshare/src/pqi/authgpg.h index 4ad48c42b..88b2bec59 100644 --- a/libretroshare/src/pqi/authgpg.h +++ b/libretroshare/src/pqi/authgpg.h @@ -89,8 +89,8 @@ public: class AuthGPGService { public: - AuthGPGService() {}; - ~AuthGPGService() {}; + AuthGPGService() {} + ~AuthGPGService() {} virtual AuthGPGOperation *getGPGOperation() = 0; virtual void setGPGOperation(AuthGPGOperation *operation) = 0; @@ -98,12 +98,11 @@ public: class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler { - public: - - static void init( const std::string& path_to_pubring, - const std::string& path_to_secring, - const std::string& path_to_trustdb, - const std::string& pgp_lock_file); +public: + static void init(const std::string& path_to_pubring, + const std::string& path_to_secring, + const std::string& path_to_trustdb, + const std::string& pgp_lock_file); static void exit(); static AuthGPG *getAuthGPG() { return _instance ; } From 00dfa0f3c2c2a4130f2a1c2458f54413aad24860 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 26 Jun 2018 22:20:02 +0200 Subject: [PATCH 089/213] added fallback for GXS GroupMessage UI to look into cached distant group data --- libretroshare/src/gxs/rsgxsnetservice.cc | 36 +++++++++++++++++-- libretroshare/src/gxs/rsgxsnetservice.h | 1 + libretroshare/src/gxs/rsgxsnettunnel.cc | 3 ++ libretroshare/src/gxs/rsnxs.h | 1 + libretroshare/src/retroshare/rsgxschannels.h | 1 + libretroshare/src/retroshare/rsgxsiface.h | 4 +++ .../src/retroshare/rsgxsifacetypes.h | 12 +++---- libretroshare/src/services/p3gxschannels.cc | 35 ++++++++++++++++++ libretroshare/src/services/p3gxschannels.h | 1 + .../gui/gxschannels/GxsChannelPostsWidget.cpp | 12 ++++++- 10 files changed, 96 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 480e9dc2e..3c97cf95d 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5130,6 +5130,20 @@ bool RsGxsNetService::retrieveDistantSearchResults(TurtleRequestId req,std::map< group_infos = it->second; return true ; } +bool RsGxsNetService::retrieveDistantGroupSummary(const RsGxsGroupId& group_id,RsGxsGroupSummary& gs) +{ + for(auto it(mDistantSearchResults.begin());it!=mDistantSearchResults.end();++it) + { + auto it2 = it->second.find(group_id) ; + + if(it2 != it->second.end()) + { + gs = it2->second; + return true ; + } + } + return false ; +} bool RsGxsNetService::clearDistantSearchResults(const TurtleRequestId& id) { RS_STACK_MUTEX(mNxsMutex) ; @@ -5139,7 +5153,6 @@ bool RsGxsNetService::clearDistantSearchResults(const TurtleRequestId& id) void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std::list& group_infos) { RS_STACK_MUTEX(mNxsMutex) ; -#warning We should use some central way to do that. This might be very costly if done often. RsGxsGrpMetaTemporaryMap grpMeta; std::map& search_results_map(mDistantSearchResults[req]) ; @@ -5159,7 +5172,22 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: // if(grpMeta[(*it).group_id] == NULL) { filtered_results.push_back(*it) ; - search_results_map[(*it).group_id] = *it; + + auto it2 = search_results_map.find((*it).group_id) ; + + if(it2 != search_results_map.end()) + { + // update existing data + + it2->second.popularity++ ; + it2->second.number_of_messages = std::max(it2->second.number_of_messages,(*it).number_of_messages) ; + } + else + { + search_results_map[(*it).group_id] = *it; + search_results_map[(*it).group_id].popularity = 1; // number of results so far + } + mObserver->receiveDistantSearchResults(req,(*it).group_id) ; } } @@ -5184,10 +5212,12 @@ bool RsGxsNetService::search(const std::string& substring,std::listsecond->mGroupName ; s.group_description = it->second->mGroupName ; // to be filled with something better when we use the real search s.search_context = it->second->mGroupName ; - s.author_id = it->second->mAuthorId; + s.sign_flags = it->second->mSignFlags; s.publish_ts = it->second->mPublishTs; + s.author_id = it->second->mAuthorId; s.number_of_messages = stats.mMaxVisibleCount ; s.last_message_ts = stats.mLastGroupModificationTS ; + s.popularity = it->second->mPop; group_infos.push_back(s) ; } diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 05031feb3..d6496e795 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -134,6 +134,7 @@ public: virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos); virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &group_infos); virtual bool clearDistantSearchResults(const TurtleRequestId& id); + virtual bool retrieveDistantGroupSummary(const RsGxsGroupId&,RsGxsGroupSummary&); /*! * pauses synchronisation of subscribed groups and request for group id diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index eabc32e3a..cce855165 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -203,8 +203,11 @@ void RsTypeSerializer::serial_process( RsGenericSerializer::SerializeJob j, RsGe RsTypeSerializer::serial_process(j,ctx,gs.publish_ts ,member_name+"-publish_ts") ; // time_t publish_ts ; RsTypeSerializer::serial_process(j,ctx,gs.number_of_messages,member_name+"-number_of_messages") ; // uint32_t number_of_messages ; RsTypeSerializer::serial_process(j,ctx,gs.last_message_ts,member_name+"-last_message_ts") ; // time_t last_message_ts ; + RsTypeSerializer::serial_process(j,ctx,gs.sign_flags,member_name+"-sign_flags") ; // uint32_t sign_flags ; + RsTypeSerializer::serial_process(j,ctx,gs.popularity,member_name+"-popularity") ; // uint32_t popularity ; } + //===========================================================================================================================================// // Interface with rest of the software // //===========================================================================================================================================// diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index b483e5748..046b2e80f 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -130,6 +130,7 @@ public: * \return */ virtual bool clearDistantSearchResults(const TurtleRequestId& id)=0; + virtual bool retrieveDistantGroupSummary(const RsGxsGroupId&,RsGxsGroupSummary&)=0; virtual bool search(const std::string& substring,std::list& group_infos) =0; diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index af08f4bb4..a23275b3b 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -99,6 +99,7 @@ virtual bool getPostData(const uint32_t &token, std::vector &p virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &results) =0; virtual bool clearDistantSearchResults(TurtleRequestId req)=0; + virtual bool retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group)=0; ////////////////////////////////////////////////////////////////////////////// virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index e822d70d4..bdf65c115 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -40,6 +40,8 @@ */ struct RsGxsGroupSummary { + RsGxsGroupSummary() : publish_ts(0), number_of_messages(0),last_message_ts(0),sign_flags(0),popularity(0) {} + RsGxsGroupId group_id ; std::string group_name ; @@ -49,6 +51,8 @@ struct RsGxsGroupSummary time_t publish_ts ; uint32_t number_of_messages ; time_t last_message_ts ; + uint32_t sign_flags ; + uint32_t popularity ; }; diff --git a/libretroshare/src/retroshare/rsgxsifacetypes.h b/libretroshare/src/retroshare/rsgxsifacetypes.h index 071b6bd46..0b0bb3322 100644 --- a/libretroshare/src/retroshare/rsgxsifacetypes.h +++ b/libretroshare/src/retroshare/rsgxsifacetypes.h @@ -69,18 +69,18 @@ struct RsGroupMetaData : RsSerializable RsGxsGroupId mGroupId; std::string mGroupName; - uint32_t mGroupFlags; // Combination of FLAG_PRIVACY_PRIVATE | FLAG_PRIVACY_RESTRICTED | FLAG_PRIVACY_PUBLIC - uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK. + uint32_t mGroupFlags; // Combination of FLAG_PRIVACY_PRIVATE | FLAG_PRIVACY_RESTRICTED | FLAG_PRIVACY_PUBLIC: diffusion + uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK, i.e. what signatures are required for parent and child msgs time_t mPublishTs; // Mandatory. - RsGxsId mAuthorId; // Optional. + RsGxsId mAuthorId; // Author of the group. Left to "000....0" if anonymous // for circles - RsGxsCircleId mCircleId; - uint32_t mCircleType; + RsGxsCircleId mCircleId; // Id of the circle to which the group is restricted + uint32_t mCircleType; // combination of CIRCLE_TYPE_{ PUBLIC,EXTERNAL,YOUR_FRIENDS_ONLY,LOCAL,EXT_SELF,YOUR_EYES_ONLY } // other stuff. - uint32_t mAuthenFlags; + uint32_t mAuthenFlags; // Actually not used yet. RsGxsGroupId mParentGrpId; // BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG. diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index e4f89861e..ee4c89f2f 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1705,4 +1705,39 @@ bool p3GxsChannels::retrieveDistantSearchResults(TurtleRequestId req,std::mapretrieveDistantSearchResults(req,results); } +bool p3GxsChannels::retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group) +{ + RsGxsGroupSummary gs ; + + if(netService()->retrieveDistantGroupSummary(group_id,gs)) + { + // This is a placeholder information by the time we receive the full group meta data. + + distant_group.mDescription = gs.group_description; + + distant_group.mMeta.mGroupId = gs.group_id ; + distant_group.mMeta.mGroupName = gs.group_name; + distant_group.mMeta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_PUBLIC ; + distant_group.mMeta.mSignFlags = gs.sign_flags; + + distant_group.mMeta.mPublishTs = gs.publish_ts; + distant_group.mMeta.mAuthorId = gs.author_id; + + distant_group.mMeta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC ;// guessed, otherwise the group would not be search-able. + + // other stuff. + distant_group.mMeta.mAuthenFlags = 0; // wild guess... + + distant_group.mMeta.mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED ; + + distant_group.mMeta.mPop = gs.popularity; // Popularity = number of friend subscribers + distant_group.mMeta.mVisibleMsgCount = gs.number_of_messages; // Max messages reported by friends + distant_group.mMeta.mLastPost = gs.last_message_ts; // Timestamp for last message. Not used yet. + + return true ; + } + else + return false ; +} + diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index 2243e57ee..7a5e19423 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -76,6 +76,7 @@ virtual void service_tick(); virtual TurtleRequestId turtleSearchRequest(const std::string& match_string); virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &results) ; virtual bool clearDistantSearchResults(TurtleRequestId req); + virtual bool retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group); // Overloaded to cache new groups. virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index 379b20823..d238c7007 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -657,12 +657,22 @@ bool GxsChannelPostsWidget::insertGroupData(const uint32_t &token, RsGroupMetaDa std::vector groups; rsGxsChannels->getGroupData(token, groups); - if (groups.size() == 1) + if(groups.size() == 1) { insertChannelDetails(groups[0]); metaData = groups[0].mMeta; return true; } + else + { + RsGxsChannelGroup distant_group; + if(rsGxsChannels->retrieveDistantGroup(groupId(),distant_group)) + { + insertChannelDetails(distant_group); + metaData = distant_group.mMeta; + return true ; + } + } return false; } From a6edf47e00cbb13c50cf25db7c3797900f52d963 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 26 Jun 2018 22:25:06 +0200 Subject: [PATCH 090/213] removed debug/experimental channel search from files tab --- retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp | 9 --------- retroshare-gui/src/gui/FileTransfer/SearchDialog.ui | 9 +-------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index 6e2bc4223..be61a1dcc 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -38,7 +38,6 @@ #include "gui/common/RSTreeWidgetItem.h" #include "util/QtVersion.h" -#include "retroshare/rsgxschannels.h" #include #include #include @@ -204,7 +203,6 @@ SearchDialog::SearchDialog(QWidget *parent) // load settings processSettings(true); - ui._channels_CB->setMinimumWidth(20 * f); ui._ownFiles_CB->setMinimumWidth(20*f); ui._friendListsearch_SB->setMinimumWidth(20*f); ui._anonF2Fsearch_CB->setMinimumWidth(20*f); @@ -866,13 +864,6 @@ void SearchDialog::searchKeywords(const QString& keywords) else req_id = rsFiles->turtleSearch(lin_exp) ; } - else if(ui._channels_CB->isChecked()) - { - if(n==1) - req_id = rsGxsChannels->turtleSearchRequest(words.front()) ; - else - QMessageBox::critical(this,"Cannot search multiple words yet.","Search for multiple words is not implemented yet.") ; - } else req_id = RSRandom::random_u32() ; // generate a random 32 bits request id diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui index e6f6ded74..b3df60f05 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui @@ -117,13 +117,6 @@ - - - - Channels - - - @@ -448,7 +441,7 @@ LineEditClear QLineEdit -
gui/common/LineEditClear.h
+
gui/common/LineEditClear.h
SearchTreeWidget From 4637fbaff5643b990df4654ae9c3090279962573 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 27 Jun 2018 08:52:03 +0200 Subject: [PATCH 091/213] Add login JSON API Implement a "normal" way to login RsLoginHelper::attemptLogin Implement a way to get locations list RsLoginHelper::getLocations Enable JSON API into retroshare-android-service --- libretroshare/src/retroshare/rsinit.h | 163 +++++++++++++-------- libretroshare/src/rsserver/rsinit.cc | 103 +++++++++---- retroshare-android-service/src/service.cpp | 5 + 3 files changed, 181 insertions(+), 90 deletions(-) diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 18326d3a1..4bd6bfc58 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -47,80 +47,89 @@ #include #include +struct RsLoginHelper; + +/** + * Pointer to global instance of RsLoginHelper + * @jsonapi{development} + */ +extern RsLoginHelper* rsLoginHelper; + /*! * Initialisation Class (not publicly disclosed to RsIFace) */ class RsInit { - public: - /* reorganised RsInit system */ +public: + enum LoadCertificateStatus : uint8_t + { + OK, /// Everything go as expected, no error occurred + ERR_ALREADY_RUNNING, /// Another istance is running already + ERR_CANT_ACQUIRE_LOCK, /// Another istance is already running? + ERR_UNKOWN /// Unkown error, maybe password is wrong? + }; - /*! - * PreLogin - * Call before init retroshare, initialises rsinitconfig's public attributes - */ - static void InitRsConfig() ; + /* reorganised RsInit system */ - /*! - * Should be called to load up ssl cert and private key, and intialises gpg - * this must be called before accessing rsserver (e.g. ::startupretroshare) - * @param argc passed from executable - * @param argv commandline arguments passed to executable - * @param strictCheck set to true if you want rs to continue executing if invalid argument passed and vice versa - * @return RS_INIT_... - */ - static int InitRetroShare(int argc, char **argv, bool strictCheck=true); + /*! + * PreLogin + * Call before init retroshare, initialises rsinitconfig's public attributes + */ + static void InitRsConfig(); - static bool isPortable(); - static bool isWindowsXP(); - static bool collectEntropy(uint32_t bytes) ; + /*! + * Should be called to load up ssl cert and private key, and intialises gpg + * this must be called before accessing rsserver (e.g. ::startupretroshare) + * @param argc passed from executable + * @param argv commandline arguments passed to executable + * @param strictCheck set to true if you want rs to continue executing if + * invalid argument passed and vice versa + * @return RS_INIT_... + */ + static int InitRetroShare(int argc, char **argv, bool strictCheck=true); - /*! - * Setup Hidden Location; - */ - static void SetHiddenLocation(const std::string& hiddenaddress, uint16_t port, bool useBob); + static bool isPortable(); + static bool isWindowsXP(); + static bool collectEntropy(uint32_t bytes) ; - static bool LoadPassword(const std::string& passwd) ; + /* + * Setup Hidden Location; + */ + static void SetHiddenLocation(const std::string& hiddenaddress, uint16_t port, bool useBob); - /*! + static bool LoadPassword(const std::string& passwd) ; + /* + * Final Certificate load. This can be called if: + * a) InitRetroshare() returns RS_INIT_HAVE_ACCOUNT -> autoLoad/password Set. + * b) or LoadPassword() + * + * This uses the preferredId from RsAccounts. + * This wrapper also locks the profile before finalising the login + */ + static LoadCertificateStatus LockAndLoadCertificates( + bool autoLoginNT, std::string& lockFilePath ); - * Final Certificate load. This can be called if: - * a) InitRetroshare() returns RS_INIT_HAVE_ACCOUNT -> autoLoad/password Set. - * b) or LoadPassword() - * - * This uses the preferredId from RsAccounts. - * This wrapper also locks the profile before finalising the login - */ - static int LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath); + // Post Login Options + static bool getStartMinimised(); - /*! - * Post Login Options - */ + static int getSslPwdLen(); + static bool getAutoLogin(); + static void setAutoLogin(bool autoLogin); + static bool RsClearAutoLogin() ; - static bool getStartMinimised(); +private: + /** @brief Lock profile directory + * param[in] accountDir account directory to lock + * param[out] lockFilePath path of the created lock-file + */ + static LoadCertificateStatus LockConfigDirectory( + const std::string& accountDir, std::string& lockFilePath); - static int getSslPwdLen(); - static bool getAutoLogin(); - static void setAutoLogin(bool autoLogin); - static bool RsClearAutoLogin() ; - - private: - -#if 0 - /* Auto Login */ - static bool RsStoreAutoLogin() ; - static bool RsTryAutoLogin() ; -#endif - -// THESE CAN BE REMOVED FROM THE CLASS TOO. - /* Lock/unlock profile directory */ - static int LockConfigDirectory(const std::string& accountDir, std::string& lockFilePath); - static void UnlockConfigDirectory(); - - /* The true LoadCertificates() method */ - static int LoadCertificates(bool autoLoginNT) ; + /// @brief Unlock profile directory + static void UnlockConfigDirectory(); + static int LoadCertificates(bool autoLoginNT); }; @@ -170,9 +179,43 @@ namespace RsAccounts bool GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); +} + + +/** + * This helper class have been implemented because there was not reasonable way + * to login in the API that could be exposed via JSON API + */ +struct RsLoginHelper +{ + /** + * @brief Normal way to attempt login + * @jsonapi{development} + * @param[in] account Id of the account to which attempt login + * @param[in] password Password for the given account + * @return RsInit::OK if login attempt success, error code otherwhise + */ + RsInit::LoadCertificateStatus attemptLogin( + const RsPeerId& account, const std::string& password ); + + struct Location : RsSerializable + { + RsPeerId mLocationId; + RsPgpId mPgpId; + std::string mLocationName; + std::string mPpgName; + + /// @see RsSerializable::serial_process + void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ); + }; + + /** + * @brief Get locations and associated information + * @jsonapi{development} + * @param[out] locations storage for the retrived locations + */ + void getLocations(std::vector& locations); }; - - - #endif diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 095dbaeaf..685afca5b 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -103,7 +103,9 @@ RsDht *rsDht = NULL ; //std::map > RsInit::unsupported_keys ; -class RsInitConfig +RsLoginHelper* rsLoginHelper; + +class RsInitConfig { public: @@ -433,7 +435,8 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */) AuthSSL::AuthSSLInit(); AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL, ""); - rsAccounts = new RsAccountsDetail(); + rsLoginHelper = new RsLoginHelper; + rsAccounts = new RsAccountsDetail; // first check config directories, and set bootstrap values. if(!rsAccounts->setupBaseDirectory(opt_base_dir)) @@ -503,12 +506,21 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */) * 1 : Another instance already has the lock * 2 : Unexpected error */ -int RsInit::LockConfigDirectory(const std::string& accountDir, std::string& lockFilePath) +RsInit::LoadCertificateStatus RsInit::LockConfigDirectory( + const std::string& accountDir, std::string& lockFilePath ) { const std::string lockFile = accountDir + "/" + "lock"; lockFilePath = lockFile; - return RsDirUtil::createLockFile(lockFile,rsInitConfig->lockHandle) ; + int rt = RsDirUtil::createLockFile(lockFile,rsInitConfig->lockHandle); + + switch (rt) + { + case 0: return RsInit::OK; + case 1: return RsInit::ERR_ALREADY_RUNNING; + case 2: return RsInit::ERR_CANT_ACQUIRE_LOCK; + default: return RsInit::ERR_UNKOWN; + } } /* @@ -540,54 +552,45 @@ bool RsInit::LoadPassword(const std::string& inPwd) return true; } - -/** - * Locks the profile directory and tries to finalize the login procedure - * - * Return value: - * 0 : success - * 1 : another instance is already running - * 2 : unexpected error while locking - * 3 : unexpected error while loading certificates - */ -int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath) +RsInit::LoadCertificateStatus RsInit::LockAndLoadCertificates( + bool autoLoginNT, std::string& lockFilePath ) { if (!rsAccounts->lockPreferredAccount()) { - return 3; // invalid PreferredAccount. + return RsInit::ERR_UNKOWN; // invalid PreferredAccount. } - int retVal = 0; + LoadCertificateStatus retVal = RsInit::OK; // Logic that used to be external to RsInit... RsPeerId accountId; if (!rsAccounts->getPreferredAccountId(accountId)) { - retVal = 3; // invalid PreferredAccount; + retVal = RsInit::ERR_UNKOWN; // invalid PreferredAccount; } RsPgpId pgpId; std::string pgpName, pgpEmail, location; - if (retVal == 0 && !rsAccounts->getAccountDetails(accountId, pgpId, pgpName, pgpEmail, location)) - retVal = 3; // invalid PreferredAccount; + if (retVal == RsInit::OK && + !rsAccounts->getAccountDetails( + accountId, pgpId, pgpName, pgpEmail, location ) ) + retVal = RsInit::ERR_UNKOWN; // invalid PreferredAccount; - if (retVal == 0 && !rsAccounts->SelectPGPAccount(pgpId)) - retVal = 3; // PGP Error. + if (retVal == RsInit::OK && !rsAccounts->SelectPGPAccount(pgpId)) + retVal = RsInit::ERR_UNKOWN; // PGP Error. - if(retVal == 0) - retVal = LockConfigDirectory(rsAccounts->PathAccountDirectory(), lockFilePath); + if(retVal == RsInit::OK) + retVal = LockConfigDirectory( + rsAccounts->PathAccountDirectory(), lockFilePath ); - if(retVal == 0 && LoadCertificates(autoLoginNT) != 1) + if(retVal == RsInit::OK && LoadCertificates(autoLoginNT) != 1) { UnlockConfigDirectory(); - retVal = 3; + retVal = RsInit::ERR_UNKOWN; } - if(retVal != 0) - { - rsAccounts->unlockPreferredAccount(); - } + if(retVal != RsInit::OK) rsAccounts->unlockPreferredAccount(); return retVal; } @@ -1900,3 +1903,43 @@ int RsServer::StartupRetroShare() return 1; } +RsInit::LoadCertificateStatus RsLoginHelper::attemptLogin( + const RsPeerId& account, const std::string& password) +{ + if(!rsNotify->cachePgpPassphrase(password)) return RsInit::ERR_UNKOWN; + if(!rsNotify->setDisableAskPassword(true)) return RsInit::ERR_UNKOWN; + if(!RsAccounts::SelectAccount(account)) return RsInit::ERR_UNKOWN; + std::string ignore; + RsInit::LoadCertificateStatus ret = + RsInit::LockAndLoadCertificates(false, ignore); + rsNotify->setDisableAskPassword(false); + if(ret != RsInit::OK) return ret; + if(RsControl::instance()->StartupRetroShare() == 1) return RsInit::OK; + return RsInit::ERR_UNKOWN; +} + +void RsLoginHelper::getLocations(std::vector& store) +{ + std::list locIds; + RsAccounts::GetAccountIds(locIds); + store.clear(); + + for(const RsPeerId& locId : locIds ) + { + Location l; l.mLocationId = locId; + std::string discardPgpMail; + RsAccounts::GetAccountDetails( locId, l.mPgpId, l.mPpgName, + discardPgpMail, l.mLocationName ); + store.push_back(l); + } +} + +void RsLoginHelper::Location::serial_process( + RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) +{ + RS_SERIAL_PROCESS(mLocationId); + RS_SERIAL_PROCESS(mPgpId); + RS_SERIAL_PROCESS(mLocationName); + RS_SERIAL_PROCESS(mPpgName); +} diff --git a/retroshare-android-service/src/service.cpp b/retroshare-android-service/src/service.cpp index 4c36916e7..cd0922d44 100644 --- a/retroshare-android-service/src/service.cpp +++ b/retroshare-android-service/src/service.cpp @@ -30,6 +30,8 @@ #include "api/ApiServerLocal.h" #include "api/RsControlModule.h" +#include "jsonapi/jsonapi.h" + using namespace resource_api; int main(int argc, char *argv[]) @@ -60,6 +62,9 @@ int main(int argc, char *argv[]) ApiServerLocal apiServerLocal(&api, sockPath); (void) apiServerLocal; + JsonApiServer jas(9092); + jas.start("JsonApiServer"); + // This ugly but RsControlModule has no other way to callback for stop QTimer shouldExitTimer; shouldExitTimer.setTimerType(Qt::VeryCoarseTimer); From db06c32e806a8c29f3a571e0f9c125a68172a897 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 28 Jun 2018 10:01:57 +0200 Subject: [PATCH 092/213] turned turtle encryption routine into a generic authenticated encryption method in librs::crypto --- libretroshare/src/crypto/rscrypto.cpp | 212 ++++++++++++++++++++++++++ libretroshare/src/crypto/rscrypto.h | 59 +++++++ libretroshare/src/libretroshare.pro | 6 +- libretroshare/src/turtle/p3turtle.cc | 175 ++------------------- 4 files changed, 287 insertions(+), 165 deletions(-) create mode 100644 libretroshare/src/crypto/rscrypto.cpp create mode 100644 libretroshare/src/crypto/rscrypto.h diff --git a/libretroshare/src/crypto/rscrypto.cpp b/libretroshare/src/crypto/rscrypto.cpp new file mode 100644 index 000000000..0a296673e --- /dev/null +++ b/libretroshare/src/crypto/rscrypto.cpp @@ -0,0 +1,212 @@ +/******************************************************************************* + * libretroshare/src/crypto: crypto.cc * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#include +#include +#include + +#include "rscrypto.h" +#include "util/rsrandom.h" + +//#define CRYPTO_DEBUG 1 + +namespace librs { +namespace crypto { + +#define RSCRYPTO_DEBUG() std::cerr << time(NULL) << " : RSCRYPTO : " << __FUNCTION__ << " : " +#define RSCRYPTO_ERROR() std::cerr << "(EE) RSCRYPTO ERROR : " + +static const uint32_t ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE = 12 ; +static const uint32_t ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE = 16 ; +static const uint32_t ENCRYPTED_MEMORY_HEADER_SIZE = 4 ; +static const uint32_t ENCRYPTED_MEMORY_EDATA_SIZE = 4 ; + +static const uint8_t ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; +static const uint8_t ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; + +bool encryptAuthenticateData(const unsigned char *clear_data,uint32_t clear_data_size,uint8_t *encryption_master_key,unsigned char *& encrypted_data,uint32_t& encrypted_data_len) +{ + uint8_t initialization_vector[ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE] ; + + RSRandom::random_bytes(initialization_vector,ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE) ; + +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << "ftServer::Encrypting ft item." << std::endl; + RSCRYPTO_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE) << std::endl; +#endif + + uint32_t item_serialized_size = clear_data_size;//RsGenericSerializer().size(clear_item) ; + uint32_t total_data_size = ENCRYPTED_MEMORY_HEADER_SIZE + ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_MEMORY_EDATA_SIZE + item_serialized_size + ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE ; + +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << " clear part size : " << size(clear_item) << std::endl; + RSCRYPTO_DEBUG() << " total item size : " << total_data_size << std::endl; +#endif + + encrypted_data = (unsigned char*)rs_malloc( total_data_size ) ; + encrypted_data_len = total_data_size ; + + if(encrypted_data == NULL) + return false ; + + uint8_t *edata = (uint8_t*)encrypted_data; + uint32_t edata_size = item_serialized_size; + uint32_t offset = 0; + + edata[0] = 0xae ; + edata[1] = 0xad ; + edata[2] = ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 + edata[3] = 0x01 ; + + offset += ENCRYPTED_MEMORY_HEADER_SIZE; + uint32_t aad_offset = offset ; + uint32_t aad_size = ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_MEMORY_EDATA_SIZE ; + + memcpy(&edata[offset], initialization_vector, ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE) ; + offset += ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE ; + + edata[offset+0] = (edata_size >> 0) & 0xff ; + edata[offset+1] = (edata_size >> 8) & 0xff ; + edata[offset+2] = (edata_size >> 16) & 0xff ; + edata[offset+3] = (edata_size >> 24) & 0xff ; + + offset += ENCRYPTED_MEMORY_EDATA_SIZE ; + + memcpy(&edata[offset],clear_data,clear_data_size); + +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << " clear item : " << RsUtil::BinToHex(&edata[offset],std::min(50,(int)total_data_size-(int)offset)) << "(...)" << std::endl; +#endif + + uint32_t clear_item_offset = offset ; + offset += edata_size ; + + uint32_t authentication_tag_offset = offset ; + assert(ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE + offset == total_data_size) ; + + //uint8_t encryption_key[32] ; + //deriveEncryptionKey(hash,encryption_key) ; + + if(edata[2] == ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_POLY1305) + librs::crypto::AEAD_chacha20_poly1305(encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; + else if(edata[2] == ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_SHA256) + librs::crypto::AEAD_chacha20_sha256 (encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; + else + return false ; + +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; + RSCRYPTO_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE) << std::endl; + RSCRYPTO_DEBUG() << " final item : " << RsUtil::BinToHex(&edata[0],std::min(50u,total_data_size)) << "(...)" << std::endl; +#endif + + return true ; +} + +// Decrypts the given item using aead-chacha20-poly1305 +bool decryptAuthenticateData(const unsigned char *encrypted_data,uint32_t encrypted_data_len,uint8_t *encryption_master_key, unsigned char *& decrypted_data, uint32_t& decrypted_data_size) +{ + //uint8_t encryption_key[32] ; + //deriveEncryptionKey(hash,encryption_key) ; + + uint8_t *edata = (uint8_t*)encrypted_data; + uint32_t offset = 0; + + if(encrypted_data_len < ENCRYPTED_MEMORY_HEADER_SIZE + ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_MEMORY_EDATA_SIZE) return false ; + + if(edata[0] != 0xae) return false ; + if(edata[1] != 0xad) return false ; + if(edata[2] != ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_POLY1305 && edata[2] != ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_SHA256) return false ; + if(edata[3] != 0x01) return false ; + + offset += ENCRYPTED_MEMORY_HEADER_SIZE ; + uint32_t aad_offset = offset ; + uint32_t aad_size = ENCRYPTED_MEMORY_EDATA_SIZE + ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE ; + + uint8_t *initialization_vector = &edata[offset] ; + +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << "ftServer::decrypting ft item." << std::endl; + RSCRYPTO_DEBUG() << " item data : " << RsUtil::BinToHex(edata,std::min(50u,encrypted_data_len) << "(...)" << std::endl; + RSCRYPTO_DEBUG() << " hash : " << hash << std::endl; + RSCRYPTO_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; + RSCRYPTO_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE) << std::endl; +#endif + + offset += ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE ; + + uint32_t edata_size = 0 ; + edata_size += ((uint32_t)edata[offset+0]) << 0 ; + edata_size += ((uint32_t)edata[offset+1]) << 8 ; + edata_size += ((uint32_t)edata[offset+2]) << 16 ; + edata_size += ((uint32_t)edata[offset+3]) << 24 ; + + if(edata_size + ENCRYPTED_MEMORY_EDATA_SIZE + ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE + ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_MEMORY_HEADER_SIZE != encrypted_data_len) + { + RSCRYPTO_ERROR() << " ERROR: encrypted data size is " << edata_size << ", should be " << encrypted_data_len - (ENCRYPTED_MEMORY_EDATA_SIZE + ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE + ENCRYPTED_MEMORY_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_MEMORY_HEADER_SIZE ) << std::endl; + return false ; + } + + offset += ENCRYPTED_MEMORY_EDATA_SIZE ; + uint32_t clear_item_offset = offset ; + + uint32_t authentication_tag_offset = offset + edata_size ; +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_MEMORY_AUTHENTICATION_TAG_SIZE) << std::endl; +#endif + + bool result ; + + if(edata[2] == ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_POLY1305) + result = librs::crypto::AEAD_chacha20_poly1305(encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; + else if(edata[2] == ENCRYPTED_MEMORY_FORMAT_AEAD_CHACHA20_SHA256) + result = librs::crypto::AEAD_chacha20_sha256 (encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; + else + return false ; + +#ifdef CRYPTO_DEBUG + RSCRYPTO_DEBUG() << " authen. result : " << result << std::endl; + RSCRYPTO_DEBUG() << " decrypted daya : " << RsUtil::BinToHex(&edata[clear_item_offset],std::min(50u,edata_size)) << "(...)" << std::endl; +#endif + + if(!result) + { + RSCRYPTO_ERROR() << "(EE) decryption/authentication went wrong." << std::endl; + return false ; + } + + decrypted_data_size = edata_size ; + decrypted_data = (unsigned char*)rs_malloc(edata_size) ; + + if(decrypted_data == NULL) + { + std::cerr << "Failed to allocate memory for decrypted data chunk of size " << edata_size << std::endl; + return false ; + } + memcpy(decrypted_data,&edata[clear_item_offset],edata_size) ; + + return true ; +} + +} +} + diff --git a/libretroshare/src/crypto/rscrypto.h b/libretroshare/src/crypto/rscrypto.h new file mode 100644 index 000000000..9666aed28 --- /dev/null +++ b/libretroshare/src/crypto/rscrypto.h @@ -0,0 +1,59 @@ + +/******************************************************************************* + * libretroshare/src/crypto: crypto.h * + * * + * libretroshare: retroshare core library * + * * + * Copyright 2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#include "crypto/chacha20.h" + +namespace librs +{ +namespace crypto +{ +/*! + * \brief encryptAuthenticateData + Encrypts/decrypts data, using a autenticated construction + chacha20, based on a given 32 bytes master key. The actual encryption using a randomized key + based on a 96 bits IV. Input values are not touched (memory is not released). Memory ownership of outputs is left to the client. + * \param clear_data input data to encrypt + * \param clear_data_size length of input data + * \param encryption_master_key encryption master key of length 32 bytes. + * \param encrypted_data encrypted data, allocated using malloc + * \param encrypted_data_len length of encrypted data + * \return + * true if everything went well. + */ +bool encryptAuthenticateData(const unsigned char *clear_data,uint32_t clear_data_size,uint8_t *encryption_master_key,unsigned char *& encrypted_data,uint32_t& encrypted_data_size); + +/*! + * \brief decryptAuthenticateData + Encrypts/decrypts data, using a autenticated construction + chacha20, based on a given 32 bytes master key. The actual encryption using a randomized key + based on a 96 bits IV. Input values are not touched (memory is not released). Memory ownership of outputs is left to the client. + * \param encrypted_data input encrypted data + * \param encrypted_data_size input encrypted data length + * \param encryption_master_key encryption master key of length 32 bytes. + * \param decrypted_data decrypted data, allocated using malloc. + * \param decrypted_data_size length of allocated decrypted data. + * \return + * true if decryption + authentication are ok. + */ +bool decryptAuthenticateData(const unsigned char *encrypted_data,uint32_t encrypted_data_size, uint8_t* encryption_master_key, unsigned char *& decrypted_data,uint32_t& decrypted_data_size); +} +} + diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index e34410ed2..ca85b7d83 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -356,7 +356,8 @@ HEADERS += ft/ftchunkmap.h \ ft/ftturtlefiletransferitem.h HEADERS += crypto/chacha20.h \ - crypto/hashstream.h + crypto/hashstream.h \ + crypto/rscrypto.h HEADERS += directory_updater.h \ directory_list.h \ @@ -523,7 +524,8 @@ SOURCES += ft/ftchunkmap.cc \ ft/ftturtlefiletransferitem.cc SOURCES += crypto/chacha20.cpp \ - crypto/hashstream.cc + crypto/hashstream.cc \ + crypto/rscrypto.cpp SOURCES += chat/distantchat.cc \ chat/p3chatservice.cc \ diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 898491cf2..31286de8f 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -34,7 +34,7 @@ #endif #include "rsserver/p3face.h" -#include "crypto/chacha20.h" +#include "crypto/rscrypto.h" #include "pqi/authssl.h" #include "pqi/p3linkmgr.h" @@ -2235,177 +2235,26 @@ std::string p3turtle::getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_i return name; } -static const uint32_t ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE = 12 ; -static const uint32_t ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE = 16 ; -static const uint32_t ENCRYPTED_TURTLE_HEADER_SIZE = 4 ; -static const uint32_t ENCRYPTED_TURTLE_EDATA_SIZE = 4 ; - -static const uint8_t ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; -static const uint8_t ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; - bool p3turtle::encryptData(const unsigned char *clear_data,uint32_t clear_data_size,uint8_t *encryption_master_key,RsTurtleGenericDataItem *& encrypted_item) { - uint8_t initialization_vector[ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE] ; - - RSRandom::random_bytes(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) ; - -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << "ftServer::Encrypting ft item." << std::endl; - TURTLE_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) << std::endl; -#endif - - uint32_t item_serialized_size = clear_data_size;//RsGenericSerializer().size(clear_item) ; - uint32_t total_data_size = ENCRYPTED_TURTLE_HEADER_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE + item_serialized_size + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE ; - -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << " clear part size : " << size(clear_item) << std::endl; - TURTLE_DEBUG() << " total item size : " << total_data_size << std::endl; -#endif + unsigned char *encrypted_data = NULL ; + uint32_t encrypted_data_len = 0 ; + if(!librs::crypto::encryptAuthenticateData(clear_data,clear_data_size,encryption_master_key,encrypted_data,encrypted_data_len)) + { + delete encrypted_item ; + return false ; + } encrypted_item = new RsTurtleGenericDataItem ; - encrypted_item->data_bytes = rs_malloc( total_data_size ) ; - encrypted_item->data_size = total_data_size ; - if(encrypted_item->data_bytes == NULL) - return false ; - - uint8_t *edata = (uint8_t*)encrypted_item->data_bytes ; - uint32_t edata_size = item_serialized_size; - uint32_t offset = 0; - - edata[0] = 0xae ; - edata[1] = 0xad ; - edata[2] = ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256 ; // means AEAD_chacha20_sha256 - edata[3] = 0x01 ; - - offset += ENCRYPTED_TURTLE_HEADER_SIZE; - uint32_t aad_offset = offset ; - uint32_t aad_size = ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE ; - - memcpy(&edata[offset], initialization_vector, ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) ; - offset += ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE ; - - edata[offset+0] = (edata_size >> 0) & 0xff ; - edata[offset+1] = (edata_size >> 8) & 0xff ; - edata[offset+2] = (edata_size >> 16) & 0xff ; - edata[offset+3] = (edata_size >> 24) & 0xff ; - - offset += ENCRYPTED_TURTLE_EDATA_SIZE ; - - memcpy(&edata[offset],clear_data,clear_data_size); - -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << " clear item : " << RsUtil::BinToHex(&edata[offset],std::min(50,(int)total_data_size-(int)offset)) << "(...)" << std::endl; -#endif - - uint32_t clear_item_offset = offset ; - offset += edata_size ; - - uint32_t authentication_tag_offset = offset ; - assert(ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE + offset == total_data_size) ; - - //uint8_t encryption_key[32] ; - //deriveEncryptionKey(hash,encryption_key) ; - - if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305) - librs::crypto::AEAD_chacha20_poly1305(encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; - else if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256) - librs::crypto::AEAD_chacha20_sha256 (encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],true) ; - else - return false ; - -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; - TURTLE_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE) << std::endl; - TURTLE_DEBUG() << " final item : " << RsUtil::BinToHex(&edata[0],std::min(50u,total_data_size)) << "(...)" << std::endl; -#endif - - return true ; + encrypted_item->data_bytes = encrypted_data ; + encrypted_item->data_size = encrypted_data_len ; + return true; } -// Decrypts the given item using aead-chacha20-poly1305 bool p3turtle::decryptItem(const RsTurtleGenericDataItem* encrypted_item, uint8_t *encryption_master_key, unsigned char *& decrypted_data, uint32_t& decrypted_data_size) { - //uint8_t encryption_key[32] ; - //deriveEncryptionKey(hash,encryption_key) ; - - uint8_t *edata = (uint8_t*)encrypted_item->data_bytes ; - uint32_t offset = 0; - - if(encrypted_item->data_size < ENCRYPTED_TURTLE_HEADER_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_EDATA_SIZE) return false ; - - if(edata[0] != 0xae) return false ; - if(edata[1] != 0xad) return false ; - if(edata[2] != ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305 && edata[2] != ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256) return false ; - if(edata[3] != 0x01) return false ; - - offset += ENCRYPTED_TURTLE_HEADER_SIZE ; - uint32_t aad_offset = offset ; - uint32_t aad_size = ENCRYPTED_TURTLE_EDATA_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE ; - - uint8_t *initialization_vector = &edata[offset] ; - -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << "ftServer::decrypting ft item." << std::endl; - TURTLE_DEBUG() << " item data : " << RsUtil::BinToHex(edata,std::min(50u,encrypted_item->data_size)) << "(...)" << std::endl; - TURTLE_DEBUG() << " hash : " << hash << std::endl; - TURTLE_DEBUG() << " encryption key : " << RsUtil::BinToHex(encryption_key,32) << std::endl; - TURTLE_DEBUG() << " random nonce : " << RsUtil::BinToHex(initialization_vector,ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE) << std::endl; -#endif - - offset += ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE ; - - uint32_t edata_size = 0 ; - edata_size += ((uint32_t)edata[offset+0]) << 0 ; - edata_size += ((uint32_t)edata[offset+1]) << 8 ; - edata_size += ((uint32_t)edata[offset+2]) << 16 ; - edata_size += ((uint32_t)edata[offset+3]) << 24 ; - - if(edata_size + ENCRYPTED_TURTLE_EDATA_SIZE + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_HEADER_SIZE != encrypted_item->data_size) - { - TURTLE_ERROR() << " ERROR: encrypted data size is " << edata_size << ", should be " << encrypted_item->data_size - (ENCRYPTED_TURTLE_EDATA_SIZE + ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE + ENCRYPTED_TURTLE_INITIALIZATION_VECTOR_SIZE + ENCRYPTED_TURTLE_HEADER_SIZE ) << std::endl; - return false ; - } - - offset += ENCRYPTED_TURTLE_EDATA_SIZE ; - uint32_t clear_item_offset = offset ; - - uint32_t authentication_tag_offset = offset + edata_size ; -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << " authen. tag : " << RsUtil::BinToHex(&edata[authentication_tag_offset],ENCRYPTED_TURTLE_AUTHENTICATION_TAG_SIZE) << std::endl; -#endif - - bool result ; - - if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_POLY1305) - result = librs::crypto::AEAD_chacha20_poly1305(encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; - else if(edata[2] == ENCRYPTED_TURTLE_FORMAT_AEAD_CHACHA20_SHA256) - result = librs::crypto::AEAD_chacha20_sha256 (encryption_master_key,initialization_vector,&edata[clear_item_offset],edata_size, &edata[aad_offset],aad_size, &edata[authentication_tag_offset],false) ; - else - return false ; - -#ifdef SERVER_DEBUG - TURTLE_DEBUG() << " authen. result : " << result << std::endl; - TURTLE_DEBUG() << " decrypted daya : " << RsUtil::BinToHex(&edata[clear_item_offset],std::min(50u,edata_size)) << "(...)" << std::endl; -#endif - - if(!result) - { - TURTLE_ERROR() << "(EE) decryption/authentication went wrong." << std::endl; - return false ; - } - - decrypted_data_size = edata_size ; - decrypted_data = (unsigned char*)rs_malloc(edata_size) ; - - if(decrypted_data == NULL) - { - std::cerr << "Failed to allocate memory for decrypted data chunk of size " << edata_size << std::endl; - return false ; - } - memcpy(decrypted_data,&edata[clear_item_offset],edata_size) ; - - return true ; + return librs::crypto::decryptAuthenticateData((unsigned char*)encrypted_item->data_bytes,encrypted_item->data_size,encryption_master_key,decrypted_data,decrypted_data_size); } void p3turtle::getInfo( std::vector >& hashes_info, From 0ff80baed3a566d07f48e15db958ff698c0e1ded Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 28 Jun 2018 12:06:43 +0200 Subject: [PATCH 093/213] Extend JSON API with reasonable way to create location --- libretroshare/src/retroshare/rsinit.h | 13 ++++++++++ libretroshare/src/rsserver/rsinit.cc | 35 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 4bd6bfc58..eb176870a 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -216,6 +216,19 @@ struct RsLoginHelper * @param[out] locations storage for the retrived locations */ void getLocations(std::vector& locations); + + /** + * @brief Creates a new RetroShare location + * @jsonapi{development} + * @param[inout] location provide input information to generate the location + * and storage to output the data of the generated location + * @param[in] password to protect and unlock the associated PGP key + * @param[out] errorMessage + * @return true if success, false otherwise + */ + bool createLocation( RsLoginHelper::Location& location, + const std::string& password, + std::string& errorMessage ); }; #endif diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 685afca5b..6c064cd3b 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1934,6 +1934,41 @@ void RsLoginHelper::getLocations(std::vector& store) } } +bool RsLoginHelper::createLocation( + RsLoginHelper::Location& l, const std::string& password, + std::string& errorMessage ) +{ + if(l.mLocationName.empty()) + { + errorMessage = "Location name is needed"; + return false; + } + + if(l.mPgpId.isNull() && l.mPpgName.empty()) + { + errorMessage = "Either PGP name or PGP id is needed"; + return false; + } + + if(l.mPgpId.isNull() && !RsAccounts::GeneratePGPCertificate( + l.mPpgName, "", password, l.mPgpId, 4096, errorMessage) ) + { + errorMessage = "Failure creating PGP key: " + errorMessage; + return false; + } + + if(!rsNotify->cachePgpPassphrase(password)) return false; + if(!rsNotify->setDisableAskPassword(true)) return false; + + bool ret = RsAccounts::GenerateSSLCertificate( + l.mPgpId, "", l.mLocationName, "", false, + RSRandom::random_alphaNumericString( + RsInit::getSslPwdLen() ), l.mLocationId, errorMessage ); + + rsNotify->setDisableAskPassword(false); + return ret; +} + void RsLoginHelper::Location::serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) From d511b6648ebe9412d7f1c5a1892c2b32d5e07c3b Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 28 Jun 2018 15:04:06 +0200 Subject: [PATCH 094/213] Extend JSON API to shutdown retroshare gracefully --- libretroshare/src/jsonapi/jsonapi.cpp | 24 ++++++++++++--- libretroshare/src/jsonapi/jsonapi.h | 20 ++++++++++-- libretroshare/src/retroshare/rsinit.h | 6 ++++ libretroshare/src/rsserver/rsinit.cc | 5 +++ retroshare-android-service/src/service.cpp | 36 +++++++++++++++------- 5 files changed, 74 insertions(+), 17 deletions(-) diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index fd9687d4d..0f298ffc5 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -21,8 +21,16 @@ // Generated at compile time #include "jsonapi-wrappers.h" -JsonApiServer::JsonApiServer(uint16_t port) : mPort(port) +JsonApiServer::JsonApiServer( + uint16_t port, const std::function shutdownCallback) : + mPort(port), mShutdownCallback(shutdownCallback) { + registerHandler("/jsonApiServer/shutdown", + [this](const std::shared_ptr) + { + shutdown(); + }); + // Generated at compile time #include "jsonapi-register.inl" } @@ -32,14 +40,22 @@ void JsonApiServer::run() std::shared_ptr settings(new rb::Settings); settings->set_port(mPort); settings->set_default_header("Connection", "close"); - service.start(settings); + mService.start(settings); } -void JsonApiServer::registerHandler(const std::string& path, const std::function)>& handler) +void JsonApiServer::registerHandler( + const std::string& path, + const std::function)>& handler) { std::shared_ptr resource(new rb::Resource); resource->set_path(path); resource->set_method_handler("GET", handler); resource->set_method_handler("POST", handler); - service.publish(resource); + mService.publish(resource); +} + +void JsonApiServer::shutdown(int exitCode) +{ + mService.stop(); + mShutdownCallback(exitCode); } diff --git a/libretroshare/src/jsonapi/jsonapi.h b/libretroshare/src/jsonapi/jsonapi.h index ce421c102..9c321c22a 100644 --- a/libretroshare/src/jsonapi/jsonapi.h +++ b/libretroshare/src/jsonapi/jsonapi.h @@ -39,12 +39,15 @@ void createChannelHandler(const std::shared_ptr session); */ struct JsonApiServer : RsSingleJobThread { - JsonApiServer(uint16_t port); + JsonApiServer( + uint16_t port, + const std::function shutdownCallback = [](int){} ); /// @see RsSingleJobThread virtual void run(); /** + * @param[in] path Path itno which publish the API call * @param[in] handler function which will be called to handle the requested * path, the function must be declared like: * \code{.cpp} @@ -55,8 +58,21 @@ struct JsonApiServer : RsSingleJobThread const std::string& path, const std::function)>& handler ); + /** + * @brief Shutdown the JSON API server and call shutdownCallback + * @jsonapi{development} + * Beware that this method shout down only the JSON API server instance not + * the whole RetroShare instance, this behaviour can be altered via + * shutdownCallback paramether of @see JsonApiServer::JsonApiServer + * This method is made available also via JSON API with path + * /jsonApiServer/shutdown + * @param exitCode just passed down to the shutdownCallback + */ + void shutdown(int exitCode = 0); + private: uint16_t mPort; - rb::Service service; + rb::Service mService; + const std::function mShutdownCallback; }; diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index eb176870a..25dc1b3f5 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -229,6 +229,12 @@ struct RsLoginHelper bool createLocation( RsLoginHelper::Location& location, const std::string& password, std::string& errorMessage ); + + /** + * @brief Close RetroShare session + * @jsonapi{development} + */ + void closeSession(); }; #endif diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 6c064cd3b..d59fa20ca 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1969,6 +1969,11 @@ bool RsLoginHelper::createLocation( return ret; } +void RsLoginHelper::closeSession() +{ + RsControl::instance()->rsGlobalShutDown(); +} + void RsLoginHelper::Location::serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) diff --git a/retroshare-android-service/src/service.cpp b/retroshare-android-service/src/service.cpp index cd0922d44..7084346b9 100644 --- a/retroshare-android-service/src/service.cpp +++ b/retroshare-android-service/src/service.cpp @@ -30,7 +30,21 @@ #include "api/ApiServerLocal.h" #include "api/RsControlModule.h" -#include "jsonapi/jsonapi.h" +#ifdef RS_JSONAPI +# include "jsonapi/jsonapi.h" +# include "retroshare/rsiface.h" + +JsonApiServer jas(9092, [](int ec) +{ + RsControl::instance()->rsGlobalShutDown(); + QCoreApplication::exit(ec); +}); + +void exitGracefully(int ec) { jas.shutdown(ec); } + +#else // ifdef RS_JSONAPI +void exitGracefully(int ec) { QCoreApplication::exit(ec); } +#endif // ifdef RS_JSONAPI using namespace resource_api; @@ -42,11 +56,11 @@ int main(int argc, char *argv[]) QCoreApplication app(argc, argv); - signal(SIGINT, &QCoreApplication::exit); - signal(SIGTERM, &QCoreApplication::exit); + signal(SIGINT, exitGracefully); + signal(SIGTERM, exitGracefully); #ifdef SIGBREAK - signal(SIGBREAK, &QCoreApplication::exit); -#endif // def SIGBREAK + signal(SIGBREAK, exitGracefully); +#endif // ifdef SIGBREAK ApiServer api; RsControlModule ctrl_mod(argc, argv, api.getStateTokenServer(), &api, true); @@ -55,23 +69,23 @@ int main(int argc, char *argv[]) dynamic_cast(&ctrl_mod), &resource_api::RsControlModule::handleRequest); - QString sockPath = QDir::homePath() + "/.retroshare"; sockPath.append("/libresapi.sock"); qDebug() << "Listening on:" << sockPath; ApiServerLocal apiServerLocal(&api, sockPath); (void) apiServerLocal; - JsonApiServer jas(9092); - jas.start("JsonApiServer"); - // This ugly but RsControlModule has no other way to callback for stop QTimer shouldExitTimer; shouldExitTimer.setTimerType(Qt::VeryCoarseTimer); shouldExitTimer.setInterval(1000); - QObject::connect( &shouldExitTimer, &QTimer::timeout, [&](){ - if(ctrl_mod.processShouldExit()) app.quit(); } ); + QObject::connect( &shouldExitTimer, &QTimer::timeout, [&]() + { if(ctrl_mod.processShouldExit()) exitGracefully(0); } ); shouldExitTimer.start(); +#ifdef RS_JSONAPI + jas.start(); +#endif + return app.exec(); } From 1c63cec7359ec5d7243cef816bbdac85821e3e1f Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 29 Jun 2018 16:02:07 +0200 Subject: [PATCH 095/213] Expose some RsFiles method trought JSON API --- libretroshare/src/retroshare/rsfiles.h | 75 ++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 83301de98..0af09fe2b 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -32,9 +32,15 @@ #include #include "rstypes.h" +#include "serialiser/rsserializable.h" class RsFiles; -extern RsFiles *rsFiles; + +/** + * Pointer to global instance of RsFiles service implementation + * @jsonapi{development} + */ +extern RsFiles* rsFiles; namespace RsRegularExpression { class Expression; } @@ -108,7 +114,7 @@ const TransferRequestFlags RS_FILE_REQ_NO_SEARCH ( 0x02000000 ); // di const uint32_t RS_FILE_EXTRA_DELETE = 0x0010; -struct SharedDirInfo +struct SharedDirInfo : RsSerializable { static bool sameLists(const std::list& l1,const std::list& l2) { @@ -122,10 +128,22 @@ struct SharedDirInfo return it1 == l1.end() && it2 == l2.end() ; } - std::string filename ; - std::string virtualname ; - FileStorageFlags shareflags ; // combnation of DIR_FLAGS_ANONYMOUS_DOWNLOAD | DIR_FLAGS_BROWSABLE | ... - std::list parent_groups ; + std::string filename; + std::string virtualname; + + /// combnation of DIR_FLAGS_ANONYMOUS_DOWNLOAD | DIR_FLAGS_BROWSABLE | ... + FileStorageFlags shareflags; + std::list parent_groups; + + /// @see RsSerializable::serial_process + virtual void serial_process(RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx) + { + RS_SERIAL_PROCESS(filename); + RS_SERIAL_PROCESS(virtualname); + RS_SERIAL_PROCESS(shareflags); + RS_SERIAL_PROCESS(parent_groups); + } }; struct SharedDirStats @@ -282,11 +300,46 @@ public: virtual std::string getDownloadDirectory() = 0; virtual std::string getPartialsDirectory() = 0; - virtual bool getSharedDirectories(std::list& dirs) = 0; - virtual bool setSharedDirectories(const std::list& dirs) = 0; - virtual bool addSharedDirectory(const SharedDirInfo& dir) = 0; - virtual bool updateShareFlags(const SharedDirInfo& dir) = 0; // updates the flags. The directory should already exist ! - virtual bool removeSharedDirectory(std::string dir) = 0; + /** + * @brief Get list of current shared directories + * @jsonapi{development} + * @param[out] dirs storage for the list of share directories + * @return false if something failed, true otherwhise + */ + virtual bool getSharedDirectories(std::list& dirs) = 0; + + /** + * @brief Set shared directories + * @jsonapi{development} + * @param[in] dirs list of shared directories with share options + * @return false if something failed, true otherwhise + */ + virtual bool setSharedDirectories(const std::list& dirs) = 0; + + /** + * @brief Add shared directoryaddSharedDirectory + * @jsonapi{development} + * @param[in] dir directory to share with sharing options + * @return false if something failed, true otherwhise + */ + virtual bool addSharedDirectory(const SharedDirInfo& dir) = 0; + + /** + * @brief Updates shared directory sharing flags. + * The directory should be already shared! + * @jsonapi{development} + * @param dir[in] Shared directory with updated sharing options + * @return false if something failed, true otherwhise + */ + virtual bool updateShareFlags(const SharedDirInfo& dir) = 0; + + /** + * @brief Remove directory from shared list + * @jsonapi{development} + * @param dir[in] Path of the directory to remove from shared list + * @return false if something failed, true otherwhise + */ + virtual bool removeSharedDirectory(std::string dir) = 0; virtual bool getIgnoreLists(std::list& ignored_prefixes, std::list& ignored_suffixes,uint32_t& flags) =0; virtual void setIgnoreLists(const std::list& ignored_prefixes, const std::list& ignored_suffixes,uint32_t flags) =0; From 80a43fe3d59163b7f93092a5589bf1ca4f5897b0 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 30 Jun 2018 21:52:25 +0200 Subject: [PATCH 096/213] added secure retrieval of distant groups --- libretroshare/src/gxs/rsgxsdataaccess.cc | 17 +++ libretroshare/src/gxs/rsgxsdataaccess.h | 8 ++ libretroshare/src/gxs/rsgxsnetservice.cc | 134 ++++++++++++++++++++++- libretroshare/src/gxs/rsgxsnetservice.h | 7 ++ libretroshare/src/gxs/rsgxsnettunnel.cc | 38 +++++-- libretroshare/src/gxs/rsnxs.h | 4 + 6 files changed, 199 insertions(+), 9 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 77c0d05d9..2ba317920 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -1807,6 +1807,23 @@ bool RsGxsDataAccess::updateGroupData(RsNxsGrp* grp) { return mDataStore->updateGroup(grpM); } +bool RsGxsDataAccess::getGroupData(const RsGxsGroupId& grpId, RsNxsGrp *& grp_data) +{ + RsStackMutex stack(mDataMutex); + + std::map grps ; + + grps[grpId] = NULL ; + + if(mDataStore->retrieveNxsGrps(grps, false, true)) // the false here is very important: it removes the private key parts. + { + grp_data = grps.begin()->second; + return true; + } + else + return false ; +} + bool RsGxsDataAccess::addMsgData(RsNxsMsg* msg) { RsStackMutex stack(mDataMutex); diff --git a/libretroshare/src/gxs/rsgxsdataaccess.h b/libretroshare/src/gxs/rsgxsdataaccess.h index 77f94137e..da5da3ca6 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.h +++ b/libretroshare/src/gxs/rsgxsdataaccess.h @@ -156,6 +156,14 @@ public: */ bool addMsgData(RsNxsMsg* msg); + /*! + * This retrieves a group from the gxs data base, this is a blocking call \n + * @param grp the group to add, memory ownership passed to the callee + * @return false if group cound not be retrieved + */ + bool getGroupData(const RsGxsGroupId& grpId,RsNxsGrp *& grp_data); + + public: diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 3c97cf95d..13d2341be 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -254,6 +254,7 @@ #include "retroshare/rsgxscircles.h" #include "retroshare/rspeers.h" #include "pgp/pgpauxutils.h" +#include "crypto/rscrypto.h" #include "util/rsdir.h" #include "util/rstime.h" #include "util/rsmemory.h" @@ -5105,7 +5106,10 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid) TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) { - return mGxsNetTunnel->turtleGroupRequest(group_id,this) ; + TurtleRequestId req = mGxsNetTunnel->turtleGroupRequest(group_id,this) ; + mSearchRequests[req] = group_id; + + return req; } TurtleRequestId RsGxsNetService::turtleSearchRequest(const std::string& match_string) { @@ -5192,6 +5196,58 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: } } +void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len) +{ +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " received encrypted group data for turtle search request " << std::hex << req << std::dec << ": " << RsUtil::BinToHex(encrypted_group_data,encrypted_group_data_len,50) << std::endl; +#endif + auto it = mSearchRequests.find(req); + + if(mSearchRequests.end() == it) + { + std::cerr << "(EE) received search results for unknown request " << std::hex << req << std::dec ; + return; + } + RsGxsGroupId grpId = it->second; + + uint8_t encryption_master_key[32]; + Sha256CheckSum s = RsDirUtil::sha256sum(grpId.toByteArray(),grpId.SIZE_IN_BYTES); + memcpy(encryption_master_key,s.toByteArray(),32); + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " attempting data decryption with master key " << RsUtil::BinToHex(encryption_master_key,32) << std::endl; +#endif + unsigned char *clear_group_data = NULL; + uint32_t clear_group_data_len ; + + if(!librs::crypto::decryptAuthenticateData(encrypted_group_data,encrypted_group_data_len,encryption_master_key,clear_group_data,clear_group_data_len)) + { + std::cerr << "(EE) Could not decrypt data. Something went wrong. Wrong key??" << std::endl; + return ; + } + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " successfuly decrypted data : " << RsUtil::BinToHex(clear_group_data,clear_group_data_len,50) << std::endl; +#endif + RsItem *item = RsNxsSerialiser(mServType).deserialise(clear_group_data,&clear_group_data_len) ; + free(clear_group_data); + clear_group_data = NULL ; + + RsNxsGrp *nxs_grp = dynamic_cast(item) ; + + if(nxs_grp == NULL) + { + std::cerr << "(EE) decrypted item is not a RsNxsGrp. Weird!" << std::endl; + return ; + } + std::vector new_grps(1,nxs_grp); + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " passing the grp data to observer." << std::endl; +#endif + mObserver->receiveNewGroups(new_grps); +} + bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) { RsGxsGrpMetaTemporaryMap grpMetaMap; @@ -5228,4 +5284,80 @@ bool RsGxsNetService::search(const std::string& substring,std::listsecond; + } + else + { + // Now check if the last request was too close in time, in which case, we dont retrieve data. + + if(mLastCacheReloadTS + 60 < time(NULL)) + { + std::cerr << "(WW) Not found in cache, and last cache reload less than 60 secs ago. Returning false. " << std::endl; + return false ; + } + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " reloading group cache information" << std::endl; +#endif + RsNxsGrpDataTemporaryMap grpDataMap; + { + RS_STACK_MUTEX(mNxsMutex) ; + mDataStore->retrieveNxsGrps(grpDataMap, true, true); + } + + for(auto it(grpDataMap.begin());it!=grpDataMap.end();++it) + if(it->second->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ) // only cache subscribed groups + { + RsNxsGrp *grp = it->second ; + delete grp->metaData ; // clean private keys + grp->metaData = NULL ; + + Sha1CheckSum hash(RsDirUtil::sha1sum(it->first.toByteArray(),it->first.SIZE_IN_BYTES)); + + mGroupHashCache[hash] = grp ; + + if(hash == hashed_group_id) + grp_data = grp ; + } + } + + if(!grp_data) + { +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " no group found for hash " << hashed_group_id << ": returning false." << std::endl; +#endif + return false ; + } + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " found corresponding group data group id in cache group_id=" << grp_data->grpId << std::endl; +#endif + // Finally, serialize and encrypt the grp data + + uint32_t size = RsNxsSerialiser(mServType).size(grp_data); + RsTemporaryMemory mem(size) ; + + RsNxsSerialiser(mServType).serialise(grp_data,mem,&size) ; + + uint8_t encryption_master_key[32]; + Sha256CheckSum s = RsDirUtil::sha256sum(grp_data->grpId.toByteArray(),grp_data->grpId.SIZE_IN_BYTES); + memcpy(encryption_master_key,s.toByteArray(),32); + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG___ << " sending data encrypted with master key " << RsUtil::BinToHex(encryption_master_key,32) << std::endl; +#endif + return librs::crypto::encryptAuthenticateData(mem,size,encryption_master_key,encrypted_group_data,encrypted_group_data_len); +} diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index d6496e795..9ab18b4d5 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -131,7 +131,10 @@ public: virtual TurtleRequestId turtleSearchRequest(const std::string& match_string); virtual bool search(const std::string& substring,std::list& group_infos) ; + virtual bool search(const Sha1CheckSum& hashed_group_id,unsigned char *& encrypted_group_data,uint32_t& encrypted_group_data_len); virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos); + virtual void receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len); + virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &group_infos); virtual bool clearDistantSearchResults(const TurtleRequestId& id); virtual bool retrieveDistantGroupSummary(const RsGxsGroupId&,RsGxsGroupSummary&); @@ -609,6 +612,10 @@ private: uint32_t mDefaultMsgStorePeriod ; uint32_t mDefaultMsgSyncPeriod ; + + std::map mGroupHashCache; + std::map mSearchRequests; + time_t mLastCacheReloadTS ; }; #endif // RSGXSNETSERVICE_H diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index cce855165..b6bf3c15a 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -163,6 +163,27 @@ public: RsTypeSerializer::serial_process(j,ctx,group_infos,"group_infos") ; } }; +class RsGxsNetTunnelTurtleSearchGroupDataItem: public RsGxsNetTunnelItem +{ +public: + explicit RsGxsNetTunnelTurtleSearchGroupDataItem(): RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_DATA) {} + virtual ~RsGxsNetTunnelTurtleSearchGroupDataItem() {} + + uint16_t service ; + unsigned char *encrypted_group_data ; + uint32_t encrypted_group_data_len ; + + virtual void clear() { free(encrypted_group_data);encrypted_group_data=NULL;encrypted_group_data_len=0; } + + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) + { + RsTypeSerializer::serial_process(j,ctx,service,"service") ; + + RsTypeSerializer::TlvMemBlock_proxy prox(encrypted_group_data,encrypted_group_data_len) ; + RsTypeSerializer::serial_process(j,ctx,prox,"encrypted_group_data") ; + } +}; + class RsGxsNetTunnelSerializer: public RsServiceSerializer { public: @@ -184,7 +205,7 @@ public: case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_SUBSTRING : return new RsGxsNetTunnelTurtleSearchSubstringItem; case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_REQUEST : return new RsGxsNetTunnelTurtleSearchGroupRequestItem; case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY : return new RsGxsNetTunnelTurtleSearchGroupSummaryItem; - //case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_DATA : return new RsGxsNetTunnelTurtleSearchGroupDataItem; + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_DATA : return new RsGxsNetTunnelTurtleSearchGroupDataItem; default: GXS_NET_TUNNEL_ERROR() << "type ID " << std::hex << (int)item_subtype << std::dec << " is not handled!" << std::endl; return NULL ; @@ -1033,20 +1054,22 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d if(substring_gr != NULL) { -#ifdef TODO - auto it = mSearchableGxsServices.find(substring_sr->service) ; + RS_STACK_MUTEX(mGxsNetTunnelMtx); + auto it = mSearchableServices.find(substring_gr->service) ; - RsNxsGrp *grp = NULL ; + unsigned char *encrypted_group_data = NULL ; + uint32_t encrypted_group_data_len = 0 ; - if(it != mSearchableGxsServices.end() && it->second.search(substring_sr->group_id,grp)) + if(it != mSearchableServices.end() && it->second->search(substring_gr->hashed_group_id,encrypted_group_data,encrypted_group_data_len)) { RsGxsNetTunnelTurtleSearchGroupDataItem search_result_item ; search_result_item.service = substring_sr->service ; - search_result_item.group_infos = results ; + search_result_item.encrypted_group_data = encrypted_group_data ; + search_result_item.encrypted_group_data_len = encrypted_group_data_len; search_result_data_size = RsGxsNetTunnelSerializer().size(&search_result_item) ; - search_result_data = (unsigned char*)rs_malloc(size) ; + search_result_data = (unsigned char*)rs_malloc(search_result_data_size) ; if(search_result_data == NULL) return false ; @@ -1055,7 +1078,6 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d return true ; } -#endif } return false ; diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 046b2e80f..7d617ee30 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -133,6 +133,7 @@ public: virtual bool retrieveDistantGroupSummary(const RsGxsGroupId&,RsGxsGroupSummary&)=0; virtual bool search(const std::string& substring,std::list& group_infos) =0; + virtual bool search(const Sha1CheckSum& hashed_group_id,unsigned char *& encrypted_group_data,uint32_t& encrypted_group_data_len)=0; /*! * Initiates a search through the network @@ -152,6 +153,9 @@ public: */ //virtual int searchGrps(RsGxsSearch* search, uint8_t hops = 1, bool retrieve = 0) = 0; + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// DATA ACCESS FUNCTIONS /// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*! * pauses synchronisation of subscribed groups and request for group id From ce61174d79227588375678bfe446980420f50168 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 9 Jun 2018 18:02:52 +0200 Subject: [PATCH 097/213] DROP before merge. Reduce INTEGRITY_CHECK_PERIOD So it run each two 2 minutes and it's easy to debug deep search --- libretroshare/src/gxs/rsgenexchange.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index ad7e02dcb..69344383d 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -67,7 +67,7 @@ static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key //#define GEN_EXCH_DEBUG 1 static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes -static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes +static const uint32_t INTEGRITY_CHECK_PERIOD = 60*2; // 31 minutes // TODO: Restore this line before merging deep_search RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns, RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs, @@ -1634,7 +1634,6 @@ void RsGenExchange::notifyNewMessages(std::vector& messages) } } } - void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId) { RS_STACK_MUTEX(mGenMtx); From c0e92ddc6b6b8291995e4cdf4c76ea5314f19ead Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 9 Jun 2018 18:06:14 +0200 Subject: [PATCH 098/213] WIP Index GXS channels with xapian Use temporary DB ATM --- libretroshare/src/deep_search/deep_search.h | 106 ++++++++++++ libretroshare/src/gxs/rsgxsutil.cc | 183 +++++++++++++------- libretroshare/src/libretroshare.pro | 4 +- libretroshare/src/rsitems/rsnxsitems.h | 3 +- libretroshare/src/use_libretroshare.pri | 4 + retroshare.pri | 9 + 6 files changed, 247 insertions(+), 62 deletions(-) create mode 100644 libretroshare/src/deep_search/deep_search.h diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h new file mode 100644 index 000000000..6af963c6d --- /dev/null +++ b/libretroshare/src/deep_search/deep_search.h @@ -0,0 +1,106 @@ +#pragma once +/* + * RetroShare Content Search and Indexing. + * Copyright (C) 2018 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include + +#include "retroshare/rsgxschannels.h" + +struct DeepSearch +{ + //DeepSearch(const std::string& dbPath) : mDbPath(dbPath) {} + + static void search(/*query*/) { /*return all matching results*/ } + + + static void indexChannelGroup(const RsGxsChannelGroup& chan) + { + Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN); + + // Set up a TermGenerator that we'll use in indexing. + Xapian::TermGenerator termgenerator; + //termgenerator.set_stemmer(Xapian::Stem("en")); + + // We make a document and tell the term generator to use this. + Xapian::Document doc; + termgenerator.set_document(doc); + + // Index each field with a suitable prefix. + termgenerator.index_text(chan.mMeta.mGroupName, 1, "G"); + termgenerator.index_text(chan.mDescription, 1, "XD"); + + // Index fields without prefixes for general search. + termgenerator.index_text(chan.mMeta.mGroupName); + termgenerator.increase_termpos(); + termgenerator.index_text(chan.mDescription); + + // We use the identifier to ensure each object ends up in the + // database only once no matter how many times we run the + // indexer. + std::string idTerm("Qretroshare://channel?id="); + idTerm += chan.mMeta.mGroupId.toStdString(); + + doc.add_boolean_term(idTerm); + db.replace_document(idTerm, doc); + } + + static void removeChannelFromIndex(RsGxsGroupId grpId) + { + std::string idTerm("Qretroshare://channel?id="); + idTerm += grpId.toStdString(); + + Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN); + db.delete_document(idTerm); + } + + static void indexChannelPost(const RsGxsChannelPost& post) + { + Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN); + + // Set up a TermGenerator that we'll use in indexing. + Xapian::TermGenerator termgenerator; + //termgenerator.set_stemmer(Xapian::Stem("en")); + + // We make a document and tell the term generator to use this. + Xapian::Document doc; + termgenerator.set_document(doc); + + // Index each field with a suitable prefix. + termgenerator.index_text(post.mMeta.mMsgName, 1, "S"); + termgenerator.index_text(post.mMsg, 1, "XD"); + + // Index fields without prefixes for general search. + termgenerator.index_text(post.mMeta.mMsgName); + termgenerator.increase_termpos(); + termgenerator.index_text(post.mMsg); + + // We use the identifier to ensure each object ends up in the + // database only once no matter how many times we run the + // indexer. + std::string idTerm("Qretroshare://channel?id="); + idTerm += post.mMeta.mGroupId.toStdString(); + idTerm += "&msgid="; + idTerm += post.mMeta.mMsgId.toStdString(); + doc.add_boolean_term(idTerm); + db.replace_document(idTerm, doc); + } + + static std::string mDbPath; +}; + +std::string DeepSearch::mDbPath = "/tmp/deep_search_xapian_db"; diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index bb0b1fb05..2c23d9e89 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -31,6 +31,12 @@ #include "pqi/pqihash.h" #include "gxs/rsgixs.h" +#ifdef RS_DEEP_SEARCH +# include "deep_search/deep_search.h" +# include "services/p3gxschannels.h" +# include "rsitems/rsgxschannelitems.h" +#endif + static const uint32_t MAX_GXS_IDS_REQUESTS_NET = 10 ; // max number of requests from cache/net (avoids killing the system!) //#define DEBUG_GXSUTIL 1 @@ -141,20 +147,28 @@ bool RsGxsMessageCleanUp::clean() return mGrpMeta.empty(); } -RsGxsIntegrityCheck::RsGxsIntegrityCheck(RsGeneralDataService* const dataService, RsGenExchange *genex, RsGixs *gixs) : - mDs(dataService),mGenExchangeClient(genex), mDone(false), mIntegrityMutex("integrity"),mGixs(gixs) -{ } +RsGxsIntegrityCheck::RsGxsIntegrityCheck( + RsGeneralDataService* const dataService, RsGenExchange* genex, + RsGixs* gixs ) : + mDs(dataService), mGenExchangeClient(genex), mDone(false), + mIntegrityMutex("integrity"), mGixs(gixs) {} void RsGxsIntegrityCheck::run() { check(); - RsStackMutex stack(mIntegrityMutex); - mDone = true; + RS_STACK_MUTEX(mIntegrityMutex); + mDone = true; } bool RsGxsIntegrityCheck::check() { +#ifdef RS_DEEP_SEARCH + bool isGxsChannels = dynamic_cast(mGenExchangeClient); + std::cout << __PRETTY_FUNCTION__ << " isGxsChannels: " << isGxsChannels + << std::endl; +#endif + // first take out all the groups std::map grp; mDs->retrieveNxsGrps(grp, true, true); @@ -166,67 +180,113 @@ bool RsGxsIntegrityCheck::check() std::set subscribed_groups ; // compute hash and compare to stored value, if it fails then simply add it - // to list - std::map::iterator git = grp.begin(); - for(; git != grp.end(); ++git) - { - RsNxsGrp* grp = git->second; - RsFileHash currHash; - pqihash pHash; - pHash.addData(grp->grp.bin_data, grp->grp.bin_len); - pHash.Complete(currHash); + // to list + for( std::map::iterator git = grp.begin(); + git != grp.end(); ++git ) + { + RsNxsGrp* grp = git->second; + RsFileHash currHash; + pqihash pHash; + pHash.addData(grp->grp.bin_data, grp->grp.bin_len); + pHash.Complete(currHash); - if(currHash == grp->metaData->mHash) - { - // get all message ids of group - if (mDs->retrieveMsgIds(grp->grpId, msgIds[grp->grpId]) == 1) - { - // store the group for retrieveNxsMsgs - grps[grp->grpId]; + if(currHash == grp->metaData->mHash) + { + // get all message ids of group + if (mDs->retrieveMsgIds(grp->grpId, msgIds[grp->grpId]) == 1) + { + // store the group for retrieveNxsMsgs + grps[grp->grpId]; - if(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) - { - subscribed_groups.insert(git->first) ; + if(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) + { + subscribed_groups.insert(git->first); - if(!grp->metaData->mAuthorId.isNull()) - { -#ifdef DEBUG_GXSUTIL - GXSUTIL_DEBUG() << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl; +#ifdef RS_DEEP_SEARCH + if(isGxsChannels) + { + RsGxsChannelGroup cg; + RsGxsGrpMetaData meta; + + meta.deserialise(grp->meta.bin_data, grp->meta.bin_len); + + /* TODO: Apparently a copy of the pointer to + * grp.bin_data is stored into grp.bin_data thus + * breaking the deserialization, skipping the pointer + * (8 bytes on x86_64 debug build) fix the + * deserilization, talk to Cyril how to properly fix + * this.*/ + RsGenericSerializer::SerializeContext ctx( + static_cast(grp->grp.bin_data)+8, + grp->grp.bin_len-8 ); + + RsGxsChannelGroupItem cgIt; + cgIt.serial_process( RsGenericSerializer::DESERIALIZE, + ctx ); + + if(ctx.mOk) + { + cgIt.toChannelGroup(cg, false); + cg.mMeta = meta; + + DeepSearch::indexChannelGroup(cg); + + std::cout << __PRETTY_FUNCTION__ << " ||Channel: " + << meta.mGroupName << " ||Description: " + << cg.mDescription << std::endl; + } + else + std::cout << __PRETTY_FUNCTION__ << " ||Group: " + << meta.mGroupName + << " ||doesn't seems a channel" + << " ||ctx.mOk: " << ctx.mOk + << " ||ctx.mData: " << (void*)ctx.mData + << " ||ctx.mSize: " << ctx.mSize + << " ||grp->grp.bin_data: " << grp->grp.bin_data + << " ||grp->grp.bin_len: " << grp->grp.bin_len + << std::endl; + } #endif - if(rsReputations!=NULL && rsReputations->overallReputationLevel(grp->metaData->mAuthorId) > RsReputations::REPUTATION_LOCALLY_NEGATIVE) - used_gxs_ids.insert(std::make_pair(grp->metaData->mAuthorId,RsIdentityUsage(mGenExchangeClient->serviceType(),RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE,grp->grpId))) ; - } - } - } - else - { - msgIds.erase(msgIds.find(grp->grpId)); - // grpsToDel.push_back(grp->grpId); - } - - } - else - { - grpsToDel.push_back(grp->grpId); - } - - if(!(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) && !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) && !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)) - { - RsGroupNetworkStats stats ; - mGenExchangeClient->getGroupNetworkStats(grp->grpId,stats); - - if(stats.mSuppliers == 0 && stats.mMaxVisibleCount == 0 && stats.mGrpAutoSync) - { + if(!grp->metaData->mAuthorId.isNull()) + { #ifdef DEBUG_GXSUTIL - GXSUTIL_DEBUG() << "Scheduling group \"" << grp->metaData->mGroupName << "\" ID=" << grp->grpId << " in service " << std::hex << mGenExchangeClient->serviceType() << std::dec << " for deletion because it has no suppliers not any visible data at friends." << std::endl; + GXSUTIL_DEBUG() << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl; +#endif + if( rsReputations && rsReputations->overallReputationLevel(grp->metaData->mAuthorId ) > RsReputations::REPUTATION_LOCALLY_NEGATIVE ) + used_gxs_ids.insert(std::make_pair(grp->metaData->mAuthorId, RsIdentityUsage(mGenExchangeClient->serviceType(), RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE,grp->grpId))); + } + } + } + else msgIds.erase(msgIds.find(grp->grpId)); + } + else + { + grpsToDel.push_back(grp->grpId); +#ifdef RS_DEEP_SEARCH + if(isGxsChannels) DeepSearch::removeChannelFromIndex(grp->grpId); +#endif + } + + if( !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) && + !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) && + !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) ) + { + RsGroupNetworkStats stats; + mGenExchangeClient->getGroupNetworkStats(grp->grpId,stats); + + if( stats.mSuppliers == 0 && stats.mMaxVisibleCount == 0 + && stats.mGrpAutoSync ) + { +#ifdef DEBUG_GXSUTIL + GXSUTIL_DEBUG() << "Scheduling group \"" << grp->metaData->mGroupName << "\" ID=" << grp->grpId << " in service " << std::hex << mGenExchangeClient->serviceType() << std::dec << " for deletion because it has no suppliers not any visible data at friends." << std::endl; #endif grpsToDel.push_back(grp->grpId); - } - } + } + } - delete grp; - } + delete grp; + } mDs->removeGroups(grpsToDel); @@ -299,6 +359,10 @@ bool RsGxsIntegrityCheck::check() } } +#ifdef RS_DEEP_SEARCH + // TODO:remove msgsToDel from deep search index too +#endif + mDs->removeMsgs(msgsToDel); { @@ -373,14 +437,13 @@ bool RsGxsIntegrityCheck::check() bool RsGxsIntegrityCheck::isDone() { - RsStackMutex stack(mIntegrityMutex); + RS_STACK_MUTEX(mIntegrityMutex); return mDone; } void RsGxsIntegrityCheck::getDeletedIds(std::list& grpIds, std::map >& msgIds) { - RsStackMutex stack(mIntegrityMutex); - + RS_STACK_MUTEX(mIntegrityMutex); grpIds = mDeletedGrps; msgIds = mDeletedMsgs; } diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 13d8fc8b2..70ded089e 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -846,7 +846,9 @@ rs_gxs_trans { SOURCES += gxstrans/p3gxstransitems.cc gxstrans/p3gxstrans.cc } - +rs_deep_search { + HEADERS += deep_search/deep_search.h +} ########################################################################################################### diff --git a/libretroshare/src/rsitems/rsnxsitems.h b/libretroshare/src/rsitems/rsnxsitems.h index f717a3d09..6c7a72002 100644 --- a/libretroshare/src/rsitems/rsnxsitems.h +++ b/libretroshare/src/rsitems/rsnxsitems.h @@ -293,7 +293,8 @@ public: virtual void clear(); - virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ); RsGxsGroupId grpId; /// group Id, needed to complete version Id (ncvi) static int refcount; diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index 3a3d1acb7..8dcf2d381 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -26,6 +26,10 @@ linux-* { mLibs += dl } +rs_deep_search { + mLibs += xapian +} + static { sLibs *= $$mLibs } else { diff --git a/retroshare.pri b/retroshare.pri index 111530a39..1348464ab 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -115,6 +115,11 @@ rs_macos10.9:CONFIG -= rs_macos10.11 rs_macos10.10:CONFIG -= rs_macos10.11 rs_macos10.12:CONFIG -= rs_macos10.11 +# To disable deep search append the following assignation to qmake command line +# "CONFIG+=no_rs_deep_search" +CONFIG *= rs_deep_search +no_rs_deep_search:CONFIG -= rs_deep_search + ########################################################################################################################################################### # # V07_NON_BACKWARD_COMPATIBLE_CHANGE_001: @@ -313,6 +318,10 @@ rs_chatserver { DEFINES *= RS_CHATSERVER } +rs_deep_search { + DEFINES *= RS_DEEP_SEARCH +} + debug { QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer QMAKE_CFLAGS -= -O2 -fomit-frame-pointer From c15ae864b5d7f82c39267b4762a6b37060b77e87 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 10 Jun 2018 11:00:38 +0200 Subject: [PATCH 099/213] deep_search: use service serializer not serial_process Avoid tricky pointers arithmetic, thanks Cyril for suggestion --- libretroshare/src/gxs/rsgenexchange.cc | 3 +- libretroshare/src/gxs/rsgxsutil.cc | 44 +++++++++++--------------- libretroshare/src/gxs/rsgxsutil.h | 12 ++++--- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 69344383d..7538c19c0 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -206,7 +206,8 @@ void RsGenExchange::tick() if(!mIntegrityCheck) { - mIntegrityCheck = new RsGxsIntegrityCheck(mDataStore,this,mGixs); + mIntegrityCheck = new RsGxsIntegrityCheck( mDataStore, this, + *mSerialiser, mGixs); mIntegrityCheck->start("gxs integrity"); mChecking = true; } diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 2c23d9e89..5e3ed9b83 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -149,9 +149,9 @@ bool RsGxsMessageCleanUp::clean() RsGxsIntegrityCheck::RsGxsIntegrityCheck( RsGeneralDataService* const dataService, RsGenExchange* genex, - RsGixs* gixs ) : - mDs(dataService), mGenExchangeClient(genex), mDone(false), - mIntegrityMutex("integrity"), mGixs(gixs) {} + RsSerialType& serializer, RsGixs* gixs ) : + mDs(dataService), mGenExchangeClient(genex), mSerializer(serializer), + mDone(false), mIntegrityMutex("integrity"), mGixs(gixs) {} void RsGxsIntegrityCheck::run() { @@ -205,28 +205,18 @@ bool RsGxsIntegrityCheck::check() #ifdef RS_DEEP_SEARCH if(isGxsChannels) { - RsGxsChannelGroup cg; RsGxsGrpMetaData meta; - meta.deserialise(grp->meta.bin_data, grp->meta.bin_len); - /* TODO: Apparently a copy of the pointer to - * grp.bin_data is stored into grp.bin_data thus - * breaking the deserialization, skipping the pointer - * (8 bytes on x86_64 debug build) fix the - * deserilization, talk to Cyril how to properly fix - * this.*/ - RsGenericSerializer::SerializeContext ctx( - static_cast(grp->grp.bin_data)+8, - grp->grp.bin_len-8 ); + uint32_t blz = grp->grp.bin_len; + RsItem* rIt = mSerializer.deserialise(grp->grp.bin_data, + &blz); - RsGxsChannelGroupItem cgIt; - cgIt.serial_process( RsGenericSerializer::DESERIALIZE, - ctx ); - - if(ctx.mOk) + if( RsGxsChannelGroupItem* cgIt = + dynamic_cast(rIt) ) { - cgIt.toChannelGroup(cg, false); + RsGxsChannelGroup cg; + cgIt->toChannelGroup(cg, false); cg.mMeta = meta; DeepSearch::indexChannelGroup(cg); @@ -239,12 +229,14 @@ bool RsGxsIntegrityCheck::check() std::cout << __PRETTY_FUNCTION__ << " ||Group: " << meta.mGroupName << " ||doesn't seems a channel" - << " ||ctx.mOk: " << ctx.mOk - << " ||ctx.mData: " << (void*)ctx.mData - << " ||ctx.mSize: " << ctx.mSize - << " ||grp->grp.bin_data: " << grp->grp.bin_data - << " ||grp->grp.bin_len: " << grp->grp.bin_len - << std::endl; + << " ||grp->grp.bin_data: " + << grp->grp.bin_data + << " ||grp->grp.bin_len: " + << grp->grp.bin_len + << " ||rIt: " << rIt << " ||blz: " << blz + << " ||cgIt: " << cgIt << std::endl; + + delete rIt; } #endif diff --git a/libretroshare/src/gxs/rsgxsutil.h b/libretroshare/src/gxs/rsgxsutil.h index 70e832c3e..faea08040 100644 --- a/libretroshare/src/gxs/rsgxsutil.h +++ b/libretroshare/src/gxs/rsgxsutil.h @@ -201,7 +201,9 @@ public: * @param chunkSize * @param sleepPeriod */ - RsGxsIntegrityCheck(RsGeneralDataService* const dataService, RsGenExchange *genex, RsGixs *gixs); + RsGxsIntegrityCheck( RsGeneralDataService* const dataService, + RsGenExchange *genex, RsSerialType& gxsSerialiser, + RsGixs *gixs); bool check(); bool isDone(); @@ -213,13 +215,15 @@ public: private: RsGeneralDataService* const mDs; - RsGenExchange *mGenExchangeClient; + RsGenExchange *mGenExchangeClient; + RsSerialType& mSerializer; + bool mDone; RsMutex mIntegrityMutex; std::list mDeletedGrps; std::map > mDeletedMsgs; - - RsGixs *mGixs ; + + RsGixs* mGixs; }; class GroupUpdate From 0f63283f96f644f475a87315a48583bd8c44267a Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 10 Jun 2018 19:04:11 +0200 Subject: [PATCH 100/213] Add search capability to DeepSearch --- libretroshare/src/deep_search/deep_search.h | 78 +++++++++++++++++++-- libretroshare/src/gxs/rsgxsutil.cc | 23 +++--- libretroshare/src/gxs/rsgxsutil.h | 1 + 3 files changed, 83 insertions(+), 19 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 6af963c6d..ae5a97f2e 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include "retroshare/rsgxschannels.h" @@ -25,7 +26,55 @@ struct DeepSearch { //DeepSearch(const std::string& dbPath) : mDbPath(dbPath) {} - static void search(/*query*/) { /*return all matching results*/ } + struct SearchResult + { + // TODO: Use RsUrl from extra_locators branch instead of plain string + std::string mUrl; + std::string mSnippet; + }; + + /** + * @return search results count + */ + static uint32_t search( const std::string& queryStr, + std::vector& results, + uint32_t maxResults = 100 ) + { + results.clear(); + + // Open the database we're going to search. + Xapian::Database db(mDbPath); + + // Set up a QueryParser with a stemmer and suitable prefixes. + Xapian::QueryParser queryparser; + //queryparser.set_stemmer(Xapian::Stem("en")); + queryparser.set_stemming_strategy(queryparser.STEM_SOME); + // Start of prefix configuration. + //queryparser.add_prefix("title", "S"); + //queryparser.add_prefix("description", "XD"); + // End of prefix configuration. + + // And parse the query. + Xapian::Query query = queryparser.parse_query(queryStr); + + // Use an Enquire object on the database to run the query. + Xapian::Enquire enquire(db); + enquire.set_query(query); + + Xapian::MSet mset = enquire.get_mset(0, maxResults); + + for ( Xapian::MSetIterator m = mset.begin(); m != mset.end(); ++m ) + { + const Xapian::Document& doc = m.get_document(); + + SearchResult s; + s.mUrl = doc.get_value(URL_VALUENO); + s.mSnippet = mset.snippet(doc.get_data()); + results.push_back(s); + } + + return results.size(); + } static void indexChannelGroup(const RsGxsChannelGroup& chan) @@ -49,18 +98,26 @@ struct DeepSearch termgenerator.increase_termpos(); termgenerator.index_text(chan.mDescription); + std::string rsLink("retroshare://channel?id="); + rsLink += chan.mMeta.mGroupId.toStdString(); + + // store the RS link so we are able to retrive it on matching search + doc.add_value(URL_VALUENO, rsLink); + + // Store some fields for display purposes. + doc.set_data(chan.mMeta.mGroupName + "\n" + chan.mDescription); + // We use the identifier to ensure each object ends up in the // database only once no matter how many times we run the - // indexer. - std::string idTerm("Qretroshare://channel?id="); - idTerm += chan.mMeta.mGroupId.toStdString(); - + // indexer. "Q" prefix is a Xapian convention for unique id term. + const std::string idTerm("Q" + rsLink); doc.add_boolean_term(idTerm); db.replace_document(idTerm, doc); } static void removeChannelFromIndex(RsGxsGroupId grpId) { + // "Q" prefix is a Xapian convention for unique id term. std::string idTerm("Qretroshare://channel?id="); idTerm += grpId.toStdString(); @@ -100,6 +157,17 @@ struct DeepSearch db.replace_document(idTerm, doc); } +private: + + enum : Xapian::valueno + { + /// Used to store retroshare url of indexed documents + URL_VALUENO, + + /// @see Xapian::BAD_VALUENO + BAD_VALUENO = Xapian::BAD_VALUENO + }; + static std::string mDbPath; }; diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 5e3ed9b83..2011ff8d9 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -4,6 +4,7 @@ * RetroShare C++ Interface. Generic routines that are useful in GXS * * Copyright 2013-2013 by Christopher Evi-Parker + * Copyright (C) 2018 Gioacchino Mazzurco * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -165,8 +166,6 @@ bool RsGxsIntegrityCheck::check() { #ifdef RS_DEEP_SEARCH bool isGxsChannels = dynamic_cast(mGenExchangeClient); - std::cout << __PRETTY_FUNCTION__ << " isGxsChannels: " << isGxsChannels - << std::endl; #endif // first take out all the groups @@ -220,21 +219,17 @@ bool RsGxsIntegrityCheck::check() cg.mMeta = meta; DeepSearch::indexChannelGroup(cg); - - std::cout << __PRETTY_FUNCTION__ << " ||Channel: " - << meta.mGroupName << " ||Description: " - << cg.mDescription << std::endl; } else - std::cout << __PRETTY_FUNCTION__ << " ||Group: " + { + std::cerr << __PRETTY_FUNCTION__ << " Group: " + << meta.mGroupId.toStdString() << " " << meta.mGroupName - << " ||doesn't seems a channel" - << " ||grp->grp.bin_data: " - << grp->grp.bin_data - << " ||grp->grp.bin_len: " - << grp->grp.bin_len - << " ||rIt: " << rIt << " ||blz: " << blz - << " ||cgIt: " << cgIt << std::endl; + << " doesn't seems a channel, please " + << "report to developers" + << std::endl; + print_stacktrace(); + } delete rIt; } diff --git a/libretroshare/src/gxs/rsgxsutil.h b/libretroshare/src/gxs/rsgxsutil.h index faea08040..694f22116 100644 --- a/libretroshare/src/gxs/rsgxsutil.h +++ b/libretroshare/src/gxs/rsgxsutil.h @@ -4,6 +4,7 @@ * RetroShare C++ Interface. Generic routines that are useful in GXS * * Copyright 2013-2013 by Christopher Evi-Parker + * Copyright (C) 2018 Gioacchino Mazzurco * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public From 5a41b3cb3762450d27dd44d9ba8a754e613ee880 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 11 Jun 2018 13:03:01 +0200 Subject: [PATCH 101/213] Index only public channels --- libretroshare/src/gxs/rsgxsutil.cc | 70 +++++++++++---------- libretroshare/src/retroshare/rsgxscircles.h | 7 +-- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 2011ff8d9..60106b411 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -201,40 +201,6 @@ bool RsGxsIntegrityCheck::check() { subscribed_groups.insert(git->first); -#ifdef RS_DEEP_SEARCH - if(isGxsChannels) - { - RsGxsGrpMetaData meta; - meta.deserialise(grp->meta.bin_data, grp->meta.bin_len); - - uint32_t blz = grp->grp.bin_len; - RsItem* rIt = mSerializer.deserialise(grp->grp.bin_data, - &blz); - - if( RsGxsChannelGroupItem* cgIt = - dynamic_cast(rIt) ) - { - RsGxsChannelGroup cg; - cgIt->toChannelGroup(cg, false); - cg.mMeta = meta; - - DeepSearch::indexChannelGroup(cg); - } - else - { - std::cerr << __PRETTY_FUNCTION__ << " Group: " - << meta.mGroupId.toStdString() << " " - << meta.mGroupName - << " doesn't seems a channel, please " - << "report to developers" - << std::endl; - print_stacktrace(); - } - - delete rIt; - } -#endif - if(!grp->metaData->mAuthorId.isNull()) { #ifdef DEBUG_GXSUTIL @@ -246,6 +212,42 @@ bool RsGxsIntegrityCheck::check() } } else msgIds.erase(msgIds.find(grp->grpId)); + +#ifdef RS_DEEP_SEARCH + if( isGxsChannels + && grp->metaData->mCircleType == GXS_CIRCLE_TYPE_PUBLIC + && grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ) + { + RsGxsGrpMetaData meta; + meta.deserialise(grp->meta.bin_data, grp->meta.bin_len); + + uint32_t blz = grp->grp.bin_len; + RsItem* rIt = mSerializer.deserialise(grp->grp.bin_data, + &blz); + + if( RsGxsChannelGroupItem* cgIt = + dynamic_cast(rIt) ) + { + RsGxsChannelGroup cg; + cgIt->toChannelGroup(cg, false); + cg.mMeta = meta; + + DeepSearch::indexChannelGroup(cg); + } + else + { + std::cerr << __PRETTY_FUNCTION__ << " Group: " + << meta.mGroupId.toStdString() << " " + << meta.mGroupName + << " doesn't seems a channel, please " + << "report to developers" + << std::endl; + print_stacktrace(); + } + + delete rIt; + } +#endif } else { diff --git a/libretroshare/src/retroshare/rsgxscircles.h b/libretroshare/src/retroshare/rsgxscircles.h index 8ce446200..6d93507e8 100644 --- a/libretroshare/src/retroshare/rsgxscircles.h +++ b/libretroshare/src/retroshare/rsgxscircles.h @@ -49,10 +49,9 @@ extern RsGxsCircles *rsGxsCircles; typedef RsPgpId RsPgpId; -// The meaning of the different circle types is: -// -// -static const uint32_t GXS_CIRCLE_TYPE_UNKNOWN = 0x0000 ; // not known. Is treated as public. +/// The meaning of the different circle types is: +/// TODO: convert to enum +static const uint32_t GXS_CIRCLE_TYPE_UNKNOWN = 0x0000 ; /// Used to detect uninizialized values. static const uint32_t GXS_CIRCLE_TYPE_PUBLIC = 0x0001 ; // not restricted to a circle static const uint32_t GXS_CIRCLE_TYPE_EXTERNAL = 0x0002 ; // restricted to an external circle, made of RsGxsId static const uint32_t GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY = 0x0003 ; // restricted to a subset of friend nodes of a given RS node given by a RsPgpId list From 32014eaac1cb0496195956b3305cdc12a4833245 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 12 Jun 2018 14:12:08 +0200 Subject: [PATCH 102/213] Use proper path for DeepSearch xapian DB --- libretroshare/src/deep_search/deep_search.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index ae5a97f2e..3d916a62a 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -21,11 +21,10 @@ #include #include "retroshare/rsgxschannels.h" +#include "retroshare/rsinit.h" struct DeepSearch { - //DeepSearch(const std::string& dbPath) : mDbPath(dbPath) {} - struct SearchResult { // TODO: Use RsUrl from extra_locators branch instead of plain string @@ -43,7 +42,7 @@ struct DeepSearch results.clear(); // Open the database we're going to search. - Xapian::Database db(mDbPath); + Xapian::Database db(dbPath()); // Set up a QueryParser with a stemmer and suitable prefixes. Xapian::QueryParser queryparser; @@ -79,7 +78,7 @@ struct DeepSearch static void indexChannelGroup(const RsGxsChannelGroup& chan) { - Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN); + Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN); // Set up a TermGenerator that we'll use in indexing. Xapian::TermGenerator termgenerator; @@ -121,13 +120,13 @@ struct DeepSearch std::string idTerm("Qretroshare://channel?id="); idTerm += grpId.toStdString(); - Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN); + Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN); db.delete_document(idTerm); } static void indexChannelPost(const RsGxsChannelPost& post) { - Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN); + Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN); // Set up a TermGenerator that we'll use in indexing. Xapian::TermGenerator termgenerator; @@ -168,7 +167,11 @@ private: BAD_VALUENO = Xapian::BAD_VALUENO }; - static std::string mDbPath; + static const std::string& dbPath() + { + static const std::string dbDir = + RsAccounts::AccountDirectory() + "/deep_search_xapian_db"; + return dbDir; + } }; -std::string DeepSearch::mDbPath = "/tmp/deep_search_xapian_db"; From d3e5b760a2e8bf663bd002d85e5e52fed2fd46ec Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 4 Jul 2018 12:08:50 +0200 Subject: [PATCH 103/213] DeepSearch index channels posts too Improve indexing using RsUrl, store some relevant fields in stored url --- libretroshare/src/deep_search/deep_search.h | 87 ++++++++++++--- libretroshare/src/gxs/rsgxsutil.cc | 112 ++++++++++++++------ 2 files changed, 154 insertions(+), 45 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 3d916a62a..7152e34ce 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -17,17 +17,18 @@ * along with this program. If not, see . */ +#include #include #include #include "retroshare/rsgxschannels.h" #include "retroshare/rsinit.h" +#include "util/rsurl.h" struct DeepSearch { struct SearchResult { - // TODO: Use RsUrl from extra_locators branch instead of plain string std::string mUrl; std::string mSnippet; }; @@ -90,6 +91,11 @@ struct DeepSearch // Index each field with a suitable prefix. termgenerator.index_text(chan.mMeta.mGroupName, 1, "G"); + + char date[] = "YYYYMMDD\0"; + std::strftime(date, 9, "%Y%m%d", std::gmtime(&chan.mMeta.mPublishTs)); + termgenerator.index_text(date, 1, "D"); + termgenerator.index_text(chan.mDescription, 1, "XD"); // Index fields without prefixes for general search. @@ -97,8 +103,14 @@ struct DeepSearch termgenerator.increase_termpos(); termgenerator.index_text(chan.mDescription); - std::string rsLink("retroshare://channel?id="); - rsLink += chan.mMeta.mGroupId.toStdString(); + RsUrl chanUrl; chanUrl + .setScheme("retroshare").setPath("/channel") + .setQueryKV("id", chan.mMeta.mGroupId.toStdString()); + const std::string idTerm("Q" + chanUrl.toString()); + + chanUrl.setQueryKV("publishDate", date); + chanUrl.setQueryKV("name", chan.mMeta.mGroupName); + std::string rsLink(chanUrl.toString()); // store the RS link so we are able to retrive it on matching search doc.add_value(URL_VALUENO, rsLink); @@ -109,7 +121,6 @@ struct DeepSearch // We use the identifier to ensure each object ends up in the // database only once no matter how many times we run the // indexer. "Q" prefix is a Xapian convention for unique id term. - const std::string idTerm("Q" + rsLink); doc.add_boolean_term(idTerm); db.replace_document(idTerm, doc); } @@ -117,8 +128,10 @@ struct DeepSearch static void removeChannelFromIndex(RsGxsGroupId grpId) { // "Q" prefix is a Xapian convention for unique id term. - std::string idTerm("Qretroshare://channel?id="); - idTerm += grpId.toStdString(); + RsUrl chanUrl; chanUrl + .setScheme("retroshare").setPath("/channel") + .setQueryKV("id", grpId.toStdString()); + std::string idTerm("Q" + chanUrl.toString()); Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN); db.delete_document(idTerm); @@ -138,24 +151,72 @@ struct DeepSearch // Index each field with a suitable prefix. termgenerator.index_text(post.mMeta.mMsgName, 1, "S"); - termgenerator.index_text(post.mMsg, 1, "XD"); + + char date[] = "YYYYMMDD\0"; + std::strftime(date, 9, "%Y%m%d", std::gmtime(&post.mMeta.mPublishTs)); + termgenerator.index_text(date, 1, "D"); + + // Avoid indexing HTML + bool isPlainMsg = post.mMsg[0] != '<' || post.mMsg[post.mMsg.size() - 1] != '>'; + + if(isPlainMsg) + termgenerator.index_text(post.mMsg, 1, "XD"); // Index fields without prefixes for general search. termgenerator.index_text(post.mMeta.mMsgName); - termgenerator.increase_termpos(); - termgenerator.index_text(post.mMsg); + if(isPlainMsg) + { + termgenerator.increase_termpos(); + termgenerator.index_text(post.mMsg); + } + + for(const RsGxsFile& attachment : post.mFiles) + { + termgenerator.index_text(attachment.mName, 1, "F"); + + termgenerator.increase_termpos(); + termgenerator.index_text(attachment.mName); + } // We use the identifier to ensure each object ends up in the // database only once no matter how many times we run the // indexer. - std::string idTerm("Qretroshare://channel?id="); - idTerm += post.mMeta.mGroupId.toStdString(); - idTerm += "&msgid="; - idTerm += post.mMeta.mMsgId.toStdString(); + RsUrl postUrl; postUrl + .setScheme("retroshare").setPath("/channel") + .setQueryKV("id", post.mMeta.mGroupId.toStdString()) + .setQueryKV("msgid", post.mMeta.mMsgId.toStdString()); + std::string idTerm("Q" + postUrl.toString()); + + postUrl.setQueryKV("publishDate", date); + postUrl.setQueryKV("name", post.mMeta.mMsgName); + std::string rsLink(postUrl.toString()); + + // store the RS link so we are able to retrive it on matching search + doc.add_value(URL_VALUENO, rsLink); + + // Store some fields for display purposes. + if(isPlainMsg) + doc.set_data(post.mMeta.mMsgName + "\n" + post.mMsg); + else doc.set_data(post.mMeta.mMsgName); + doc.add_boolean_term(idTerm); db.replace_document(idTerm, doc); } + static void removeChannelPostFromIndex( + RsGxsGroupId grpId, RsGxsMessageId msgId ) + { + RsUrl postUrl; postUrl + .setScheme("retroshare").setPath("/channel") + .setQueryKV("id", grpId.toStdString()) + .setQueryKV("msgid", msgId.toStdString()); + // "Q" prefix is a Xapian convention for unique id term. + std::string idTerm("Q" + postUrl.toString()); + + Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN); + db.delete_document(idTerm); + } + private: enum : Xapian::valueno diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 60106b411..75b43da83 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -166,6 +166,7 @@ bool RsGxsIntegrityCheck::check() { #ifdef RS_DEEP_SEARCH bool isGxsChannels = dynamic_cast(mGenExchangeClient); + std::set indexedGroups; #endif // first take out all the groups @@ -232,6 +233,7 @@ bool RsGxsIntegrityCheck::check() cgIt->toChannelGroup(cg, false); cg.mMeta = meta; + indexedGroups.insert(grp->grpId); DeepSearch::indexChannelGroup(cg); } else @@ -309,53 +311,99 @@ bool RsGxsIntegrityCheck::check() } if (nxsMsgIt == nxsMsgV.end()) - { - msgsToDel[grpId].insert(msgId); + { + msgsToDel[grpId].insert(msgId); +#ifdef RS_DEEP_SEARCH + if(isGxsChannels) + DeepSearch::removeChannelPostFromIndex(grpId, msgId); +#endif } } } - GxsMsgResult::iterator mit = msgs.begin(); + GxsMsgResult::iterator mit = msgs.begin(); + for(; mit != msgs.end(); ++mit) + { + std::vector& msgV = mit->second; + std::vector::iterator vit = msgV.begin(); - for(; mit != msgs.end(); ++mit) - { - std::vector& msgV = mit->second; - std::vector::iterator vit = msgV.begin(); + for(; vit != msgV.end(); ++vit) + { + RsNxsMsg* msg = *vit; + RsFileHash currHash; + pqihash pHash; + pHash.addData(msg->msg.bin_data, msg->msg.bin_len); + pHash.Complete(currHash); - for(; vit != msgV.end(); ++vit) - { - RsNxsMsg* msg = *vit; - RsFileHash currHash; - pqihash pHash; - pHash.addData(msg->msg.bin_data, msg->msg.bin_len); - pHash.Complete(currHash); - - if(msg->metaData == NULL || currHash != msg->metaData->mHash) - { - std::cerr << "(EE) deleting message data with wrong hash or null meta data. meta=" << (void*)msg->metaData << std::endl; - msgsToDel[msg->grpId].insert(msg->msgId); - } - else if(!msg->metaData->mAuthorId.isNull() && subscribed_groups.find(msg->metaData->mGroupId)!=subscribed_groups.end()) - { -#ifdef DEBUG_GXSUTIL - GXSUTIL_DEBUG() << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl; + if(msg->metaData == NULL || currHash != msg->metaData->mHash) + { + std::cerr << __PRETTY_FUNCTION__ <<" (EE) deleting message data" + << " with wrong hash or null meta data. meta=" + << (void*)msg->metaData << std::endl; + msgsToDel[msg->grpId].insert(msg->msgId); +#ifdef RS_DEEP_SEARCH + if(isGxsChannels) + DeepSearch::removeChannelPostFromIndex(msg->grpId, msg->msgId); #endif - if(rsReputations!=NULL && rsReputations->overallReputationLevel(msg->metaData->mAuthorId) > RsReputations::REPUTATION_LOCALLY_NEGATIVE) - used_gxs_ids.insert(std::make_pair(msg->metaData->mAuthorId,RsIdentityUsage(mGenExchangeClient->serviceType(),RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE,msg->metaData->mGroupId,msg->metaData->mMsgId))) ; - } + } + else if (subscribed_groups.count(msg->metaData->mGroupId)) + { +#ifdef RS_DEEP_SEARCH + if( isGxsChannels + && indexedGroups.count(msg->metaData->mGroupId) ) + { + RsGxsMsgMetaData meta; + meta.deserialise(msg->meta.bin_data, &msg->meta.bin_len); + + uint32_t blz = msg->msg.bin_len; + RsItem* rIt = mSerializer.deserialise(msg->msg.bin_data, + &blz); + + if( RsGxsChannelPostItem* cgIt = + dynamic_cast(rIt) ) + { + RsGxsChannelPost cg; + cgIt->toChannelPost(cg, false); + cg.mMeta = meta; + + DeepSearch::indexChannelPost(cg); + } + else if(dynamic_cast(rIt)) {} + else if(dynamic_cast(rIt)) {} + else + { + std::cerr << __PRETTY_FUNCTION__ << " Message: " + << meta.mMsgId.toStdString() + << " in group: " + << meta.mGroupId.toStdString() << " " + << " doesn't seems a channel post, please " + << "report to developers" + << std::endl; + print_stacktrace(); + } + + delete rIt; + } +#endif + + if(!msg->metaData->mAuthorId.isNull()) + { +#ifdef DEBUG_GXSUTIL + GXSUTIL_DEBUG() << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl; +#endif + if(rsReputations!=NULL && rsReputations->overallReputationLevel(msg->metaData->mAuthorId) > RsReputations::REPUTATION_LOCALLY_NEGATIVE) + used_gxs_ids.insert(std::make_pair(msg->metaData->mAuthorId,RsIdentityUsage(mGenExchangeClient->serviceType(),RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE,msg->metaData->mGroupId,msg->metaData->mMsgId))) ; + } + } delete msg; } } -#ifdef RS_DEEP_SEARCH - // TODO:remove msgsToDel from deep search index too -#endif - mDs->removeMsgs(msgsToDel); { - RsStackMutex stack(mIntegrityMutex); + RS_STACK_MUTEX(mIntegrityMutex); std::vector::iterator grpIt; for(grpIt = grpsToDel.begin(); grpIt != grpsToDel.end(); ++grpIt) From 8ad454723a37fa7a551195d64f312cad903284ac Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 4 Jul 2018 21:42:09 +0200 Subject: [PATCH 104/213] added group data request when search items are selected --- libretroshare/src/gxs/rsgxsnetservice.cc | 24 ++++++++++++++++++- libretroshare/src/gxs/rsgxsnetservice.h | 9 +++++++ .../src/gui/gxs/GxsGroupFrameDialog.cpp | 3 +++ .../src/gui/gxs/GxsGroupFrameDialog.h | 1 + .../src/gui/gxschannels/GxsChannelDialog.cpp | 11 +++++++++ .../src/gui/gxschannels/GxsChannelDialog.h | 2 ++ 6 files changed, 49 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 13d2341be..e58a7c52e 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -304,6 +304,7 @@ static const uint32_t REJECTED_MESSAGE_RETRY_DELAY = 24*3600; // static const uint32_t GROUP_STATS_UPDATE_DELAY = 240; // update unsubscribed group statistics every 3 mins static const uint32_t GROUP_STATS_UPDATE_NB_PEERS = 2; // number of peers to which the group stats are asked static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000; // 200,000 bytes including signature and headers +static const uint32_t MIN_DELAY_BETWEEN_GROUP_SEARCH = 40; // dont search same group more than every 40 secs. static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_UNKNOWN = 0x00 ; static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_NO_ERROR = 0x01 ; @@ -380,6 +381,8 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, mOwnId = mNetMgr->getOwnId(); mUpdateCounter = 0; + mLastCacheReloadTS = 0; + // check the consistency if(mDefaultMsgStorePeriod > 0 && mDefaultMsgSyncPeriod > mDefaultMsgStorePeriod) @@ -5106,7 +5109,25 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid) TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) { + time_t now = time(NULL); + auto it = mSearchedGroups.find(group_id) ; + + if(mSearchedGroups.end() != it && (it->second.ts + MIN_DELAY_BETWEEN_GROUP_SEARCH > now)) + { + std::cerr << "(WW) Last turtle request was " << now - it->second.ts << " secs ago. Not searching again." << std::endl; + return it->second.request_id; + } + +#ifdef NXS_NET_DEBUG_8 + GXSNETDEBUG__G(group_id) << " requesting group id " << group_id << " using turtle" << std::endl; +#endif TurtleRequestId req = mGxsNetTunnel->turtleGroupRequest(group_id,this) ; + + GroupRequestRecord& rec(mSearchedGroups[group_id]) ; + + rec.request_id = req; + rec.ts = now; + mSearchRequests[req] = group_id; return req; @@ -5302,7 +5323,7 @@ bool RsGxsNetService::search(const Sha1CheckSum& hashed_group_id,unsigned char * { // Now check if the last request was too close in time, in which case, we dont retrieve data. - if(mLastCacheReloadTS + 60 < time(NULL)) + if(mLastCacheReloadTS + 60 > time(NULL)) { std::cerr << "(WW) Not found in cache, and last cache reload less than 60 secs ago. Returning false. " << std::endl; return false ; @@ -5315,6 +5336,7 @@ bool RsGxsNetService::search(const Sha1CheckSum& hashed_group_id,unsigned char * { RS_STACK_MUTEX(mNxsMutex) ; mDataStore->retrieveNxsGrps(grpDataMap, true, true); + mLastCacheReloadTS = time(NULL); } for(auto it(grpDataMap.begin());it!=grpDataMap.end();++it) diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 9ab18b4d5..295397ae2 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -59,6 +59,14 @@ class RsGroupNetworkStatsRecord time_t update_TS ; }; +struct GroupRequestRecord +{ + GroupRequestRecord(): ts(0), request_id(0) {} + + time_t ts ; + TurtleRequestId request_id; +}; + /*! * This class implements the RsNetWorkExchangeService * using transactions to handle synchrnisation of Nxs items between @@ -615,6 +623,7 @@ private: std::map mGroupHashCache; std::map mSearchRequests; + std::map mSearchedGroups ; time_t mLastCacheReloadTS ; }; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 1f2d2fc00..2ac49df42 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -767,6 +767,9 @@ void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId) return; } + // send a request for the group, if it has been distant-searched. + checkRequestGroup(mGroupId) ; + /* search exisiting tab */ GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, true); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index bcfbabe78..7908f8b5b 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -95,6 +95,7 @@ protected: virtual RetroShareLink::enumType getLinkType() = 0; virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; } virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata); + virtual void checkRequestGroup(const RsGxsGroupId& grpId) {} private slots: void todo(); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 160119ee2..f839a0a3f 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -346,3 +346,14 @@ bool GxsChannelDialog::getDistantSearchResults(TurtleRequestId id, std::mapretrieveDistantSearchResults(id,group_infos); } + +void GxsChannelDialog::checkRequestGroup(const RsGxsGroupId& grpId) +{ + RsGxsChannelGroup distant_group; + + if( rsGxsChannels->retrieveDistantGroup(grpId,distant_group)) // normally we should also check that the group meta is not already here. + { + std::cerr << "GxsChannelDialog::checkRequestGroup() sending turtle request for group data for group " << grpId << std::endl; + rsGxsChannels->turtleGroupRequest(grpId); + } +} diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h index 38b27d805..43a81aca5 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h @@ -53,6 +53,8 @@ protected: virtual bool getDistantSearchResults(TurtleRequestId id, std::map& group_infos); virtual TurtleRequestId distantSearch(const QString& search_string) ; + virtual void checkRequestGroup(const RsGxsGroupId& grpId) ; + private slots: void toggleAutoDownload(); void setDefaultDirectory(); From 2067b106e4b29fd23f6cc0eebcfb2f85c4b76041 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 4 Jul 2018 23:54:26 +0200 Subject: [PATCH 105/213] fixed missing code in passing turtle group data result to client service --- libretroshare/src/gxs/rsgxsnetservice.cc | 1 + libretroshare/src/gxs/rsgxsnettunnel.cc | 62 +++++++++++++------ libretroshare/src/gxs/rsnxs.h | 8 +++ .../src/gui/gxs/GxsGroupFrameDialog.h | 4 +- 4 files changed, 55 insertions(+), 20 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index e58a7c52e..054795873 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5349,6 +5349,7 @@ bool RsGxsNetService::search(const Sha1CheckSum& hashed_group_id,unsigned char * Sha1CheckSum hash(RsDirUtil::sha1sum(it->first.toByteArray(),it->first.SIZE_IN_BYTES)); mGroupHashCache[hash] = grp ; + it->second = NULL ; // prevents deletion if(hash == hashed_group_id) grp_data = grp ; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index b6bf3c15a..86bee73e7 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -1064,7 +1064,7 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d { RsGxsNetTunnelTurtleSearchGroupDataItem search_result_item ; - search_result_item.service = substring_sr->service ; + search_result_item.service = substring_gr->service ; search_result_item.encrypted_group_data = encrypted_group_data ; search_result_item.encrypted_group_data_len = encrypted_group_data_len; @@ -1091,26 +1091,52 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id RsGxsNetTunnelTurtleSearchGroupSummaryItem *result_gs = dynamic_cast(item) ; - if(result_gs == NULL) + if(result_gs != NULL) + { + GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl; + + for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) + std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; + + auto it = mSearchableServices.find(result_gs->service) ; + + if(it == mSearchableServices.end()) + { + GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gs->service << std::dec << " that is not in the searchable services list." << std::endl; + delete item; + return ; + } + + it->second->receiveTurtleSearchResults(request_id,result_gs->group_infos) ; + + delete item; + return ; + } + + RsGxsNetTunnelTurtleSearchGroupDataItem *result_gd = dynamic_cast(item) ; + + if(result_gd != NULL) { - GXS_NET_TUNNEL_ERROR() << ": deserialized item is not a GroupSummary Item. Smething's wrong here." << std::endl; - return ; + GXS_NET_TUNNEL_DEBUG() << " : result is of type group data for service " << result_gd->service << std::dec << ": " << std::endl; + + auto it = mSearchableServices.find(result_gd->service) ; + + if(it == mSearchableServices.end()) + { + GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gd->service << std::dec << " that is not in the searchable services list." << std::endl; + delete item; + return ; + } + + it->second->receiveTurtleSearchResults(request_id,result_gd->encrypted_group_data,result_gd->encrypted_group_data_len) ; + + result_gd->encrypted_group_data = NULL ; // prevents deletion + delete item; + + return ; } - GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl; - - for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) - std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; - - auto it = mSearchableServices.find(result_gs->service) ; - - if(it == mSearchableServices.end()) - { - GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gs->service << std::dec << " that is in the searchable services list." << std::endl; - return ; - } - - it->second->receiveTurtleSearchResults(request_id,result_gs->group_infos) ; + GXS_NET_TUNNEL_ERROR() << ": deserialized item is of unknown type. Dropping!" << std::endl; } diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 7d617ee30..a6044aa46 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -114,6 +114,14 @@ public: */ virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list& group_infos)=0; + /*! + * \brief receiveTurtleSearchResults + * Called by turtle (through RsGxsNetTunnel) when new data is received + * \param req Turtle search request ID associated with this result + * \param encrypted_group_data Group data + */ + virtual void receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len)=0; + /*! * \brief retrieveTurtleSearchResults * To be used to retrieve the search results that have been notified (or not) diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 7908f8b5b..1dfa8b78e 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -95,7 +95,7 @@ protected: virtual RetroShareLink::enumType getLinkType() = 0; virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; } virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata); - virtual void checkRequestGroup(const RsGxsGroupId& grpId) {} + virtual void checkRequestGroup(const RsGxsGroupId& /* grpId */) {} // overload this one in order to retrieve full group data when the group is browsed private slots: void todo(); @@ -149,7 +149,7 @@ private: virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList &/*actions*/) {} virtual RsGxsCommentService *getCommentService() { return NULL; } virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; } - virtual bool getDistantSearchResults(TurtleRequestId id, std::map& group_infos){ return false ;} + virtual bool getDistantSearchResults(TurtleRequestId /* id */, std::map& /* group_infos */){ return false ;} void initUi(); From 47e760a2c522f9508c65175b01bbed0106f05cab Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Jul 2018 10:11:12 +0200 Subject: [PATCH 106/213] added a few missing mutexes in prevent searches to be shown when already known --- libretroshare/src/gxs/rsgxsnetservice.cc | 3 ++ .../gui/FileTransfer/SharedFilesDialog.cpp | 12 ++--- .../src/gui/gxs/GxsGroupFrameDialog.cpp | 45 +++++++++---------- .../src/gui/gxs/GxsGroupFrameDialog.h | 6 +-- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 054795873..67e031b9e 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5109,6 +5109,8 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid) TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id) { + RS_STACK_MUTEX(mNxsMutex) ; + time_t now = time(NULL); auto it = mSearchedGroups.find(group_id) ; @@ -5157,6 +5159,7 @@ bool RsGxsNetService::retrieveDistantSearchResults(TurtleRequestId req,std::map< } bool RsGxsNetService::retrieveDistantGroupSummary(const RsGxsGroupId& group_id,RsGxsGroupSummary& gs) { + RS_STACK_MUTEX(mNxsMutex) ; for(auto it(mDistantSearchResults.begin());it!=mDistantSearchResults.end();++it) { auto it2 = it->second.find(group_id) ; diff --git a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp index 240839a2e..1cfa95cb6 100644 --- a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp @@ -1140,14 +1140,14 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point ) { shareChannelMenu.setIcon(QIcon(IMAGE_CHANNEL)); - std::list grp_metas ; + std::map grp_metas ; channelDialog->getGroupList(grp_metas) ; std::vector > grplist ; // I dont use a std::map because two or more channels may have the same name. for(auto it(grp_metas.begin());it!=grp_metas.end();++it) - if(IS_GROUP_PUBLISHER((*it).mSubscribeFlags) && IS_GROUP_SUBSCRIBED((*it).mSubscribeFlags)) - grplist.push_back(std::make_pair((*it).mGroupName, (*it).mGroupId)); + if(IS_GROUP_PUBLISHER((*it).second.mSubscribeFlags) && IS_GROUP_SUBSCRIBED((*it).second.mSubscribeFlags)) + grplist.push_back(std::make_pair((*it).second.mGroupName, (*it).second.mGroupId)); std::sort(grplist.begin(),grplist.end(),ChannelCompare()) ; @@ -1164,14 +1164,14 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point ) { shareForumMenu.setIcon(QIcon(IMAGE_FORUMS)); - std::list grp_metas ; + std::map grp_metas ; forumsDialog->getGroupList(grp_metas) ; std::vector > grplist ; // I dont use a std::map because two or more channels may have the same name. for(auto it(grp_metas.begin());it!=grp_metas.end();++it) - if(IS_GROUP_SUBSCRIBED((*it).mSubscribeFlags)) - grplist.push_back(std::make_pair((*it).mGroupName, (*it).mGroupId)); + if(IS_GROUP_SUBSCRIBED((*it).second.mSubscribeFlags)) + grplist.push_back(std::make_pair((*it).second.mGroupName, (*it).second.mGroupId)); std::sort(grplist.begin(),grplist.end(),ChannelCompare()) ; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 2ac49df42..180ffa231 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -123,7 +123,7 @@ GxsGroupFrameDialog::~GxsGroupFrameDialog() delete(ui); } -void GxsGroupFrameDialog::getGroupList(std::list& group_list) +void GxsGroupFrameDialog::getGroupList(std::map &group_list) { group_list = mCachedGroupMetas ; @@ -265,8 +265,6 @@ void GxsGroupFrameDialog::updateSearchResults() auto it2 = mSearchGroupsItems.find(*it); - std::set& known_groups(mKnownGroups[*it]) ; - if(mSearchGroupsItems.end() == it2) { std::cerr << "GxsGroupFrameDialog::updateSearchResults(): received result notification for req " << std::hex << *it << std::dec << " but no item present!" << std::endl; @@ -276,24 +274,22 @@ void GxsGroupFrameDialog::updateSearchResults() QList group_items ; for(auto it3(group_infos.begin());it3!=group_infos.end();++it3) - if(known_groups.end() == known_groups.find(it3->first)) - { + if(mCachedGroupMetas.find(it3->first) == mCachedGroupMetas.end()) + { std::cerr << " adding new group " << it3->first << " " << it3->second.group_id << " \"" << it3->second.group_name << "\"" << std::endl; - known_groups.insert(it3->first) ; - - GroupItemInfo i ; - i.id = QString(it3->second.group_id.toStdString().c_str()) ; - i.name = QString::fromUtf8(it3->second.group_name.c_str()) ; - i.description = QString::fromUtf8(it3->second.group_description.c_str()) ; - i.popularity = 0; // could be set to the number of hits + GroupItemInfo i ; + i.id = QString(it3->second.group_id.toStdString().c_str()) ; + i.name = QString::fromUtf8(it3->second.group_name.c_str()) ; + i.description = QString::fromUtf8(it3->second.group_description.c_str()) ; + i.popularity = 0; // could be set to the number of hits i.lastpost = QDateTime::fromTime_t(it3->second.last_message_ts); i.subscribeFlags = 0; // irrelevant here i.publishKey = false ; // IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ; i.adminKey = false ; // IS_GROUP_ADMIN(groupInfo.mSubscribeFlags) ; i.max_visible_posts = it3->second.number_of_messages ; - group_items.push_back(i); + group_items.push_back(i); } ui->groupTreeWidget->fillGroupItems(it2->second, group_items); @@ -768,7 +764,9 @@ void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId) } // send a request for the group, if it has been distant-searched. - checkRequestGroup(mGroupId) ; + + if(mCachedGroupMetas.find(mGroupId) == mCachedGroupMetas.end()) + checkRequestGroup(mGroupId) ; /* search exisiting tab */ GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, true); @@ -894,7 +892,7 @@ void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupI } } -void GxsGroupFrameDialog::insertGroupsData(const std::list &groupList, const RsUserdata *userdata) +void GxsGroupFrameDialog::insertGroupsData(const std::map &groupList, const RsUserdata *userdata) { if (!mInitialized) { return; @@ -902,20 +900,18 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list &gro mInFill = true; - std::list::const_iterator it; - QList adminList; QList subList; QList popList; QList otherList; std::multimap popMap; - for (it = groupList.begin(); it != groupList.end(); ++it) { + for (auto it = groupList.begin(); it != groupList.end(); ++it) { /* sort it into Publish (Own), Subscribed, Popular and Other */ - uint32_t flags = it->mSubscribeFlags; + uint32_t flags = it->second.mSubscribeFlags; GroupItemInfo groupItemInfo; - groupInfoToGroupItemInfo(*it, groupItemInfo, userdata); + groupInfoToGroupItemInfo(it->second, groupItemInfo, userdata); if (IS_GROUP_SUBSCRIBED(flags)) { @@ -932,7 +928,7 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list &gro else { //popMap.insert(std::make_pair(it->mPop, groupItemInfo)); /* rate the others by popularity */ - popMap.insert(std::make_pair(it->mLastPost, groupItemInfo)); /* rate the others by time of last post */ + popMap.insert(std::make_pair(it->second.mLastPost, groupItemInfo)); /* rate the others by time of last post */ } } @@ -1043,9 +1039,12 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token) RsUserdata *userdata = NULL; loadGroupSummaryToken(token, groupInfo, userdata); - mCachedGroupMetas = groupInfo ; + mCachedGroupMetas.clear(); + for(auto it(groupInfo.begin());it!=groupInfo.end();++it) + mCachedGroupMetas[(*it).mGroupId] = *it; - insertGroupsData(groupInfo, userdata); + insertGroupsData(mCachedGroupMetas, userdata); + updateSearchResults(); mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, false); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 1dfa8b78e..e429d98b2 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -82,7 +82,7 @@ public: virtual QString getHelpString() const =0; - virtual void getGroupList(std::list& groups) ; + virtual void getGroupList(std::map &groups) ; protected: virtual void showEvent(QShowEvent *event); @@ -162,7 +162,7 @@ private: void processSettings(bool load); // New Request/Response Loading Functions. - void insertGroupsData(const std::list &groupList, const RsUserdata *userdata); + void insertGroupsData(const std::map &groupList, const RsUserdata *userdata); void requestGroupSummary(); void loadGroupSummary(const uint32_t &token); @@ -209,7 +209,7 @@ private: /** Qt Designer generated object */ Ui::GxsGroupFrameDialog *ui; - std::list mCachedGroupMetas; + std::map mCachedGroupMetas; std::map mSearchGroupsItems ; std::map > mKnownGroups; From 59c51a250b23d38089fa27658d22c10cabe3da35 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Jul 2018 10:16:48 +0200 Subject: [PATCH 107/213] removed debug switch to allow display of existing distant group search results --- libretroshare/src/gxs/rsgxsnetservice.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 67e031b9e..d8a882945 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5196,8 +5196,7 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: // only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure for(auto it(group_infos.begin());it!=group_infos.end();++it) -#warning Uncomment when done with testing! -// if(grpMeta[(*it).group_id] == NULL) + if(grpMeta[(*it).group_id] == NULL) { filtered_results.push_back(*it) ; From 0e37de3e1145cc20432eda51516f0b5ed1a4b32d Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Jul 2018 11:43:55 +0200 Subject: [PATCH 108/213] made retrieval of group data manual instead of automatic --- libretroshare/src/gxs/rsgxsnettunnel.cc | 8 ++-- libretroshare/src/turtle/p3turtle.cc | 2 +- .../src/gui/common/GroupTreeWidget.cpp | 17 +++++++++ .../src/gui/common/GroupTreeWidget.h | 1 + .../src/gui/gxs/GxsGroupFrameDialog.cpp | 37 ++++++++++++++++--- .../src/gui/gxs/GxsGroupFrameDialog.h | 1 + 6 files changed, 56 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 86bee73e7..90d73e85a 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -94,7 +94,7 @@ public: RsGxsNetTunnelKeepAliveItem() :RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE) {} virtual ~RsGxsNetTunnelKeepAliveItem() {} - virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) {} + virtual void serial_process(RsGenericSerializer::SerializeJob /* j */,RsGenericSerializer::SerializeContext& /* ctx */) {} }; class RsGxsNetTunnelRandomBiasItem: public RsGxsNetTunnelItem @@ -314,7 +314,7 @@ bool RsGxsNetTunnelService::receiveTunnelData(uint16_t service_id, unsigned char return true; } -bool RsGxsNetTunnelService::sendTunnelData(uint16_t service_id,unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) +bool RsGxsNetTunnelService::sendTunnelData(uint16_t /* service_id */,unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer) { RS_STACK_MUTEX(mGxsNetTunnelMtx); // The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router. @@ -398,7 +398,7 @@ bool RsGxsNetTunnelService::requestDistantPeers(uint16_t service_id, const RsGxs return true; } -bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t service_id,const RsGxsGroupId& group_id) +bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t /* service_id */,const RsGxsGroupId& group_id) { RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -492,7 +492,7 @@ void RsGxsNetTunnelService::connectToTurtleRouter(p3turtle *tr) mTurtle->registerTunnelService(this) ; } -bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id) +bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& /* peer_id */) { RS_STACK_MUTEX(mGxsNetTunnelMtx); // We simply check for wether a managed group has a hash that corresponds to the given hash. diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 31286de8f..1fe6adfb0 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1125,7 +1125,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) // This is an error: how could we receive a search result corresponding to a search item we // have forwarded but that it not in the list ?? - std::cerr << __PRETTY_FUNCTION__ << ": search result has no peer direction!" << std::endl ; + std::cerr << __PRETTY_FUNCTION__ << ": search result for request " << std::hex << item->request_id << std::dec << " has no peer direction!" << std::endl ; return ; } diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 4a88eee48..d823298d9 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -430,6 +430,23 @@ QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, ui return item; } +bool GroupTreeWidget::isSearchRequestResult(QPoint &point,QString& group_id,uint32_t& search_req_id) +{ + QTreeWidgetItem *item = ui->treeWidget->itemAt(point); + if (item == NULL) + return false; + + QTreeWidgetItem *parent = item->parent(); + + if(parent == NULL) + return false ; + + search_req_id = parent->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt(); + group_id = itemId(item) ; + + return search_req_id > 0; +} + bool GroupTreeWidget::isSearchRequestItem(QPoint &point,uint32_t& search_req_id) { QTreeWidgetItem *item = ui->treeWidget->itemAt(point); diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index 4ad19f0e1..64506cfb0 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -95,6 +95,7 @@ public: void setUnreadCount(QTreeWidgetItem *item, int unreadCount); bool isSearchRequestItem(QPoint &point,uint32_t& search_req_id); + bool isSearchRequestResult(QPoint &point, QString &group_id, uint32_t& search_req_id); QTreeWidgetItem *getItemFromId(const QString &id); QTreeWidgetItem *activateId(const QString &id, bool focus); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 180ffa231..a1a66eed2 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -47,6 +47,7 @@ #define IMAGE_SHARE ":/images/share-icon-16.png" #define IMAGE_TABNEW ":/images/tab-new.png" #define IMAGE_DELETE ":/images/delete.png" +#define IMAGE_RETRIEVE ":/images/edit_add24.png" #define IMAGE_COMMENT "" #define TOKEN_TYPE_GROUP_SUMMARY 1 @@ -345,6 +346,19 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point) return ; } + // Then check whether we have a searched item, or a normal group + + QString group_id_s ; + + if(ui->groupTreeWidget->isSearchRequestResult(point,group_id_s,search_request_id)) + { + QMenu contextMnu(this); + + contextMnu.addAction(QIcon(IMAGE_RETRIEVE), tr("Request data"), this, SLOT(distantRequestGroupData()))->setData(group_id_s); + contextMnu.exec(QCursor::pos()); + return ; + } + QString id = ui->groupTreeWidget->itemIdAt(point); if (id.isEmpty()) return; @@ -763,11 +777,6 @@ void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId) return; } - // send a request for the group, if it has been distant-searched. - - if(mCachedGroupMetas.find(mGroupId) == mCachedGroupMetas.end()) - checkRequestGroup(mGroupId) ; - /* search exisiting tab */ GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, true); @@ -1198,3 +1207,21 @@ void GxsGroupFrameDialog::searchNetwork(const QString& search_string) mSearchGroupsItems[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH))); } +void GxsGroupFrameDialog::distantRequestGroupData() +{ + QAction *action = dynamic_cast(sender()) ; + + if(!action) + return ; + + RsGxsGroupId group_id(action->data().toString().toStdString()); + + if(group_id.isNull()) + { + std::cerr << "Cannot retrieve group! Group id is null!" << std::endl; + } + + std::cerr << "Explicit request for group " << group_id << std::endl; + checkRequestGroup(group_id) ; +} + diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index e429d98b2..4951caf36 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -108,6 +108,7 @@ private slots: void restoreGroupKeys(); void newGroup(); + void distantRequestGroupData(); void changedCurrentGroup(const QString &groupId); void groupTreeMiddleButtonClicked(QTreeWidgetItem *item); From 0cc87c988046ffc2f947ba3396edaf60add04255 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Jul 2018 12:20:22 +0200 Subject: [PATCH 109/213] fixed bug causing search data result to not be forwarded correctly (missing request id) --- libretroshare/src/turtle/rsturtleitem.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 20e9666f1..182e6deca 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -184,6 +184,8 @@ RsTurtleSearchResultItem *RsTurtleGenericSearchResultItem::duplicate() const sr->result_data = (unsigned char*)rs_malloc(result_data_len) ; memcpy(sr->result_data,result_data,result_data_len) ; sr->result_data_len = result_data_len ; + sr->request_id = request_id ; + sr->depth = depth ; return sr ; } From 4a64ea5f1f3099952bb80de959406c77fd43fe97 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Jul 2018 14:00:04 +0200 Subject: [PATCH 110/213] added optional use of dist sync in GroupFrameDialog --- libretroshare/src/gxs/rsgxsnettunnel.cc | 26 +++---- libretroshare/src/retroshare/rsgxschannels.h | 68 ++++++++----------- .../src/gui/common/GroupTreeWidget.cpp | 5 ++ .../src/gui/common/GroupTreeWidget.h | 1 + .../src/gui/gxs/GxsGroupFrameDialog.cpp | 9 ++- .../src/gui/gxs/GxsGroupFrameDialog.h | 3 +- .../src/gui/gxschannels/GxsChannelDialog.cpp | 2 +- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 90d73e85a..2b234fe57 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -199,9 +199,9 @@ public: switch(item_subtype) { - case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER: return new RsGxsNetTunnelVirtualPeerItem ; - case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE : return new RsGxsNetTunnelKeepAliveItem ; - case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS : return new RsGxsNetTunnelRandomBiasItem ; + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_VIRTUAL_PEER : return new RsGxsNetTunnelVirtualPeerItem ; + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE : return new RsGxsNetTunnelKeepAliveItem ; + case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS : return new RsGxsNetTunnelRandomBiasItem ; case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_SUBSTRING : return new RsGxsNetTunnelTurtleSearchSubstringItem; case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_REQUEST : return new RsGxsNetTunnelTurtleSearchGroupRequestItem; case RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY : return new RsGxsNetTunnelTurtleSearchGroupSummaryItem; @@ -216,16 +216,16 @@ public: template<> void RsTypeSerializer::serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx, RsGxsGroupSummary& gs, const std::string& member_name ) { - RsTypeSerializer::serial_process(j,ctx,gs.group_id,member_name+"-group_id") ; // RsGxsGroupId group_id ; - RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME ,gs.group_name,member_name+"-group_name") ; // std::string group_name ; - RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_COMMENT,gs.group_description,member_name+"-group_description") ; // std::string group_description ; - RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_VALUE ,gs.search_context,member_name+"-group_name") ; // std::string search_context ; - RsTypeSerializer::serial_process(j,ctx,gs.author_id ,member_name+"-author_id") ; // RsGxsId author_id ; - RsTypeSerializer::serial_process(j,ctx,gs.publish_ts ,member_name+"-publish_ts") ; // time_t publish_ts ; - RsTypeSerializer::serial_process(j,ctx,gs.number_of_messages,member_name+"-number_of_messages") ; // uint32_t number_of_messages ; - RsTypeSerializer::serial_process(j,ctx,gs.last_message_ts,member_name+"-last_message_ts") ; // time_t last_message_ts ; - RsTypeSerializer::serial_process(j,ctx,gs.sign_flags,member_name+"-sign_flags") ; // uint32_t sign_flags ; - RsTypeSerializer::serial_process(j,ctx,gs.popularity,member_name+"-popularity") ; // uint32_t popularity ; + RsTypeSerializer::serial_process (j,ctx,gs.group_id ,member_name+"-group_id") ; // RsGxsGroupId group_id ; + RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME ,gs.group_name,member_name+"-group_name") ; // std::string group_name ; + RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_COMMENT ,gs.group_description,member_name+"-group_description") ; // std::string group_description ; + RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_VALUE ,gs.search_context,member_name+"-group_name") ; // std::string search_context ; + RsTypeSerializer::serial_process (j,ctx,gs.author_id ,member_name+"-author_id") ; // RsGxsId author_id ; + RsTypeSerializer::serial_process (j,ctx,gs.publish_ts ,member_name+"-publish_ts") ; // time_t publish_ts ; + RsTypeSerializer::serial_process (j,ctx,gs.number_of_messages,member_name+"-number_of_messages") ; // uint32_t number_of_messages ; + RsTypeSerializer::serial_process (j,ctx,gs.last_message_ts ,member_name+"-last_message_ts") ; // time_t last_message_ts ; + RsTypeSerializer::serial_process(j,ctx,gs.sign_flags ,member_name+"-sign_flags") ; // uint32_t sign_flags ; + RsTypeSerializer::serial_process(j,ctx,gs.popularity ,member_name+"-popularity") ; // uint32_t popularity ; } diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index a23275b3b..c80b75f31 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -76,61 +76,49 @@ std::ostream &operator<<(std::ostream &out, const RsGxsChannelPost &post); class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService { - public: +public: explicit RsGxsChannels(RsGxsIface *gxs) - :RsGxsIfaceHelper(gxs) {} + :RsGxsIfaceHelper(gxs) {} virtual ~RsGxsChannels() {} /* Specific Service Data */ -virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; -virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; -virtual bool getPostData(const uint32_t &token, std::vector &posts) = 0; -//Not currently used -//virtual bool getRelatedPosts(const uint32_t &token, std::vector &posts) = 0; + virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; + virtual bool getPostData(const uint32_t &token, std::vector &posts) = 0; - /* From RsGxsCommentService */ -//virtual bool getCommentData(const uint32_t &token, std::vector &comments) = 0; -//virtual bool getRelatedComments(const uint32_t &token, std::vector &comments) = 0; -//virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0; -//virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0; + ////////////////////////////////////////////////////////////////////////////// + /// Distant synchronisation methods /// + ////////////////////////////////////////////////////////////////////////////// + /// + virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)=0; + virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; + virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &results) =0; + virtual bool clearDistantSearchResults(TurtleRequestId req)=0; + virtual bool retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group)=0; - virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)=0; - virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)=0; - virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map &results) =0; - virtual bool clearDistantSearchResults(TurtleRequestId req)=0; - virtual bool retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group)=0; + ////////////////////////////////////////////////////////////////////////////// + virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; - ////////////////////////////////////////////////////////////////////////////// -virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; + virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) = 0; + virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) = 0; -virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) = 0; -virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) = 0; + virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory)=0; + virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory)=0; -virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory)=0; -virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory)=0; - -//virtual void setChannelAutoDownload(uint32_t& token, const RsGxsGroupId& groupId, bool autoDownload) = 0; - -//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask); -//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask); - -//virtual bool groupRestoreKeys(const std::string &groupId); - virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set& peers)=0; + virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set& peers)=0; // Overloaded subscribe fn. -virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) = 0; + virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) = 0; -virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group) = 0; -virtual bool createPost(uint32_t &token, RsGxsChannelPost &post) = 0; - -virtual bool updateGroup(uint32_t &token, RsGxsChannelGroup &group) = 0; - - // File Interface -virtual bool ExtraFileHash(const std::string &path, std::string filename) = 0; -virtual bool ExtraFileRemove(const RsFileHash &hash) = 0; + virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group) = 0; + virtual bool createPost(uint32_t &token, RsGxsChannelPost &post) = 0; + virtual bool updateGroup(uint32_t &token, RsGxsChannelGroup &group) = 0; + // File Interface + virtual bool ExtraFileHash(const std::string &path, std::string filename) = 0; + virtual bool ExtraFileRemove(const RsFileHash &hash) = 0; }; diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index d823298d9..87be83e91 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -430,6 +430,11 @@ QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, ui return item; } +void GroupTreeWidget::setDistSearchVisible(bool visible) +{ + ui->distantSearchLineEdit->setVisible(visible); +} + bool GroupTreeWidget::isSearchRequestResult(QPoint &point,QString& group_id,uint32_t& search_req_id) { QTreeWidgetItem *item = ui->treeWidget->itemAt(point); diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index 64506cfb0..59e0ae261 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -83,6 +83,7 @@ public: // Add a new category item QTreeWidgetItem *addCategoryItem(const QString &name, const QIcon &icon, bool expand); // Add a new search item + void setDistSearchVisible(bool) ; // shows/hides distant search UI parts. QTreeWidgetItem *addSearchItem(const QString& search_string, uint32_t id, const QIcon &icon) ; void removeSearchItem(QTreeWidgetItem *item); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index a1a66eed2..58e7bb93a 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -67,7 +67,7 @@ */ /** Constructor */ -GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent) +GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent,bool allow_dist_sync) : RsGxsUpdateBroadcastPage(ifaceImpl, parent) { /* Invoke the Qt Designer generated object setup routine */ @@ -75,6 +75,7 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p ui->setupUi(this); mInitialized = false; + mDistSyncAllowed = allow_dist_sync; mInFill = false; mCountChildMsgs = false; mYourGroups = NULL; @@ -96,12 +97,16 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p connect(ui->groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupTreeCustomPopupMenu(QPoint))); connect(ui->groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedCurrentGroup(QString))); connect(ui->groupTreeWidget->treeWidget(), SIGNAL(signalMouseMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(groupTreeMiddleButtonClicked(QTreeWidgetItem*))); - connect(ui->groupTreeWidget, SIGNAL(distantSearchRequested(const QString&)), this, SLOT(searchNetwork(const QString&))); connect(ui->messageTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(messageTabCloseRequested(int))); connect(ui->messageTabWidget, SIGNAL(currentChanged(int)), this, SLOT(messageTabChanged(int))); connect(ui->todoPushButton, SIGNAL(clicked()), this, SLOT(todo())); + ui->groupTreeWidget->setDistSearchVisible(allow_dist_sync) ; + + if(allow_dist_sync) + connect(ui->groupTreeWidget, SIGNAL(distantSearchRequested(const QString&)), this, SLOT(searchNetwork(const QString&))); + /* Set initial size the splitter */ ui->splitter->setStretchFactor(0, 0); ui->splitter->setStretchFactor(1, 1); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 4951caf36..46ff05ec3 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -72,7 +72,7 @@ public: }; public: - GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0); + GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0,bool allow_dist_sync=false); virtual ~GxsGroupFrameDialog(); bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId); @@ -190,6 +190,7 @@ protected: private: bool mInitialized; bool mInFill; + bool mDistSyncAllowed; QString mSettingsName; RsGxsGroupId mGroupId; RsGxsIfaceHelper *mInterface; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index f839a0a3f..8090dc353 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -47,7 +47,7 @@ public: /** Constructor */ GxsChannelDialog::GxsChannelDialog(QWidget *parent) - : GxsGroupFrameDialog(rsGxsChannels, parent) + : GxsGroupFrameDialog(rsGxsChannels, parent,true) { } From 98f8e4da0a296ef3db6bee3b92e9d791f16d430b Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Jul 2018 17:40:06 +0200 Subject: [PATCH 111/213] added per-item type limit for turtle search results --- libretroshare/src/gxs/rsgxsnettunnel.cc | 8 ++- libretroshare/src/gxs/rsgxsnettunnel.h | 2 +- libretroshare/src/turtle/p3turtle.cc | 52 ++++++++++--------- libretroshare/src/turtle/p3turtle.h | 7 +-- libretroshare/src/turtle/rsturtleitem.cc | 6 +++ libretroshare/src/turtle/rsturtleitem.h | 11 ++-- .../src/turtle/turtleclientservice.h | 7 ++- 7 files changed, 59 insertions(+), 34 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 2b234fe57..fc8d5eb79 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -36,6 +36,8 @@ #define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL: " << __FUNCTION__ << " : " #define GXS_NET_TUNNEL_ERROR() std::cerr << "(EE) GXS_NET_TUNNEL ERROR : " +static const uint32_t RS_GXS_NET_TUNNEL_MAX_ALLOWED_HITS_GROUP_DATA = 1; +static const uint32_t RS_GXS_NET_TUNNEL_MAX_ALLOWED_HITS_GROUP_SEARCH = 100; RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { @@ -1011,7 +1013,7 @@ TurtleRequestId RsGxsNetTunnelService::turtleSearchRequest(const std::string& ma return mTurtle->turtleSearch(mem,size,this) ; } -bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_size) +bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_size,uint32_t& max_allowed_hits) { GXS_NET_TUNNEL_DEBUG() << ": received a request." << std::endl; @@ -1023,6 +1025,8 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d { GXS_NET_TUNNEL_DEBUG() << " : type is substring for service " << std::hex << (int)substring_sr->service << std::dec << std::endl; + max_allowed_hits = RS_GXS_NET_TUNNEL_MAX_ALLOWED_HITS_GROUP_SEARCH ; + std::list results ; RS_STACK_MUTEX(mGxsNetTunnelMtx); @@ -1057,6 +1061,8 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d RS_STACK_MUTEX(mGxsNetTunnelMtx); auto it = mSearchableServices.find(substring_gr->service) ; + max_allowed_hits = RS_GXS_NET_TUNNEL_MAX_ALLOWED_HITS_GROUP_DATA ; + unsigned char *encrypted_group_data = NULL ; uint32_t encrypted_group_data_len = 0 ; diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index ade780fe8..0fdff3ccc 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -244,7 +244,7 @@ public: * \brief receiveSearchRequest * See RsTurtleClientService::@ */ - virtual bool receiveSearchRequest(unsigned char *search_request_data,uint32_t search_request_data_len,unsigned char *& search_result_data,uint32_t& search_result_data_len); + virtual bool receiveSearchRequest(unsigned char *search_request_data, uint32_t search_request_data_len, unsigned char *& search_result_data, uint32_t& search_result_data_len, uint32_t &max_allowed_hits); virtual void receiveSearchResult(TurtleSearchRequestId request_id,unsigned char *search_result_data,uint32_t search_result_data_len); // Overloaded from RsTickingThread diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 1fe6adfb0..0db63a7df 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -83,17 +83,18 @@ void TS_dumpState() ; // - The total number of TR per second emmited from self will be MAX_TUNNEL_REQS_PER_SECOND / TIME_BETWEEN_TUNNEL_MANAGEMENT_CALLS = 0.5 // - I updated forward probabilities to higher values, and min them to 1/nb_connected_friends to prevent blocking tunnels. // -static const time_t TUNNEL_REQUESTS_LIFE_TIME = 240 ; /// life time for tunnel requests in the cache. -static const time_t SEARCH_REQUESTS_LIFE_TIME = 240 ; /// life time for search requests in the cache -static const time_t REGULAR_TUNNEL_DIGGING_TIME = 300 ; /// maximum interval between two tunnel digging campaigns. -static const time_t MAXIMUM_TUNNEL_IDLE_TIME = 60 ; /// maximum life time of an unused tunnel. -static const time_t EMPTY_TUNNELS_DIGGING_TIME = 50 ; /// look into tunnels regularly every 50 sec. -static const time_t TUNNEL_SPEED_ESTIMATE_LAPSE = 5 ; /// estimate tunnel speed every 5 seconds -static const time_t TUNNEL_CLEANING_LAPS_TIME = 10 ; /// clean tunnels every 10 secs -static const time_t TIME_BETWEEN_TUNNEL_MANAGEMENT_CALLS = 2 ; /// Tunnel management calls every 2 secs. -static const uint32_t MAX_TUNNEL_REQS_PER_SECOND = 1 ; /// maximum number of tunnel requests issued per second. Was 0.5 before -static const uint32_t MAX_ALLOWED_SR_IN_CACHE = 120 ; /// maximum number of search requests allowed in cache. That makes 2 per sec. -static const uint32_t TURTLE_SEARCH_RESULT_MAX_HITS =5000 ; /// maximum number of search results forwarded back to the source. +static const time_t TUNNEL_REQUESTS_LIFE_TIME = 240 ; /// life time for tunnel requests in the cache. +static const time_t SEARCH_REQUESTS_LIFE_TIME = 240 ; /// life time for search requests in the cache +static const time_t REGULAR_TUNNEL_DIGGING_TIME = 300 ; /// maximum interval between two tunnel digging campaigns. +static const time_t MAXIMUM_TUNNEL_IDLE_TIME = 60 ; /// maximum life time of an unused tunnel. +static const time_t EMPTY_TUNNELS_DIGGING_TIME = 50 ; /// look into tunnels regularly every 50 sec. +static const time_t TUNNEL_SPEED_ESTIMATE_LAPSE = 5 ; /// estimate tunnel speed every 5 seconds +static const time_t TUNNEL_CLEANING_LAPS_TIME = 10 ; /// clean tunnels every 10 secs +static const time_t TIME_BETWEEN_TUNNEL_MANAGEMENT_CALLS = 2 ; /// Tunnel management calls every 2 secs. +static const uint32_t MAX_TUNNEL_REQS_PER_SECOND = 1 ; /// maximum number of tunnel requests issued per second. Was 0.5 before +static const uint32_t MAX_ALLOWED_SR_IN_CACHE = 120 ; /// maximum number of search requests allowed in cache. That makes 2 per sec. +static const uint32_t TURTLE_SEARCH_RESULT_MAX_HITS_FILES =5000 ; /// maximum number of search results forwarded back to the source. +static const uint32_t TURTLE_SEARCH_RESULT_MAX_HITS_DEFAULT= 100 ; /// default maximum number of search results forwarded back source. static const float depth_peer_probability[7] = { 1.0f,0.99f,0.9f,0.7f,0.6f,0.5,0.4f } ; @@ -916,6 +917,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) // Perform local search off-mutex,because this might call some services that are above turtle in the mutex chain. uint32_t search_result_count = 0; + uint32_t max_allowed_hits = TURTLE_SEARCH_RESULT_MAX_HITS_DEFAULT; if(item->PeerId() != _own_id) // is the request not coming from us? { @@ -924,7 +926,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) #endif std::list search_results ; - performLocalSearch(item,search_result_count,search_results) ; + performLocalSearch(item,search_result_count,search_results,max_allowed_hits) ; for(auto it(search_results.begin());it!=search_results.end();++it) { @@ -948,13 +950,14 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) req.result_count = search_result_count; req.keywords = item->GetKeywords() ; req.service_id = item->serviceId() ; + req.max_allowed_hits = max_allowed_hits; // if enough has been sent back already, do not sarch further #ifdef P3TURTLE_DEBUG std::cerr << " result count = " << req.result_count << std::endl; #endif - if(req.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + if(req.result_count >= max_allowed_hits) return ; // If search depth not too large, also forward this search request to all other peers. @@ -1014,13 +1017,13 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) // This function should be removed in the future, when file search will also use generic search items. -void p3turtle::performLocalSearch(RsTurtleSearchRequestItem *item,uint32_t& req_result_count,std::list& search_results) +void p3turtle::performLocalSearch(RsTurtleSearchRequestItem *item,uint32_t& req_result_count,std::list& search_results,uint32_t& max_allowed_hits) { RsTurtleFileSearchRequestItem *ftsearch = dynamic_cast(item) ; if(ftsearch != NULL) { - performLocalSearch_files(ftsearch,req_result_count,search_results) ; + performLocalSearch_files(ftsearch,req_result_count,search_results,max_allowed_hits) ; return ; } @@ -1028,12 +1031,12 @@ void p3turtle::performLocalSearch(RsTurtleSearchRequestItem *item,uint32_t& req_ if(gnsearch != NULL) { - performLocalSearch_generic(gnsearch,req_result_count,search_results) ; + performLocalSearch_generic(gnsearch,req_result_count,search_results,max_allowed_hits) ; return ; } } -void p3turtle::performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item, uint32_t& req_result_count, std::list& result) +void p3turtle::performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item, uint32_t& req_result_count, std::list& result,uint32_t& max_allowed_hits) { unsigned char *search_result_data = NULL ; uint32_t search_result_data_len = 0 ; @@ -1050,7 +1053,7 @@ void p3turtle::performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item client = it->second ; } - if(client->receiveSearchRequest(item->search_data,item->search_data_len,search_result_data,search_result_data_len)) + if(client->receiveSearchRequest(item->search_data,item->search_data_len,search_result_data,search_result_data_len,max_allowed_hits)) { RsTurtleGenericSearchResultItem *result_item = new RsTurtleGenericSearchResultItem ; @@ -1061,7 +1064,7 @@ void p3turtle::performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item } } -void p3turtle::performLocalSearch_files(RsTurtleFileSearchRequestItem *item,uint32_t& req_result_count,std::list& result) +void p3turtle::performLocalSearch_files(RsTurtleFileSearchRequestItem *item,uint32_t& req_result_count,std::list& result,uint32_t& max_allowed_hits) { #ifdef P3TURTLE_DEBUG std::cerr << "Performing rsFiles->search()" << std::endl ; @@ -1078,6 +1081,7 @@ void p3turtle::performLocalSearch_files(RsTurtleFileSearchRequestItem *item,uint uint32_t item_size = 0 ; static const uint32_t RSTURTLE_MAX_SEARCH_RESPONSE_SIZE = 10000 ; + max_allowed_hits = TURTLE_SEARCH_RESULT_MAX_HITS_FILES; for(auto it(initialResults.begin());it!=initialResults.end();++it) { @@ -1096,7 +1100,7 @@ void p3turtle::performLocalSearch_files(RsTurtleFileSearchRequestItem *item,uint item_size += 8 /* size */ + it->hash.serial_size() + it->name.size() ; - if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req_result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + if(item_size > RSTURTLE_MAX_SEARCH_RESPONSE_SIZE || req_result_count >= max_allowed_hits) { #ifdef P3TURTLE_DEBUG std::cerr << " Sending back chunk of size " << item_size << ", for " << res_item->result.size() << " elements." << std::endl ; @@ -1151,18 +1155,18 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) uint32_t n = item->count(); // not so good! - if(it->second.result_count >= TURTLE_SEARCH_RESULT_MAX_HITS) + if(it->second.result_count >= it->second.max_allowed_hits) { std::cerr << "(WW) exceeded turtle search result to forward. Req=" << std::hex << item->request_id << std::dec << ": dropping item with " << n << " elements." << std::endl; return ; } - if(it->second.result_count + n > TURTLE_SEARCH_RESULT_MAX_HITS) + if(it->second.result_count + n > it->second.max_allowed_hits) { - for(uint32_t i=it->second.result_count + n; i>TURTLE_SEARCH_RESULT_MAX_HITS;--i) + for(uint32_t i=it->second.result_count + n; i>it->second.max_allowed_hits;--i) item->pop() ; - it->second.result_count = TURTLE_SEARCH_RESULT_MAX_HITS ; + it->second.result_count = it->second.max_allowed_hits ; } else it->second.result_count += n ; diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index be34a56a7..93d397d67 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -174,6 +174,7 @@ class TurtleSearchRequestInfo uint32_t result_count; // responses to this request. Useful to avoid spamming tunnel responses. std::string keywords; uint16_t service_id; // ID of the client service who issues the request. This is null if the request does not have a local origin. + uint32_t max_allowed_hits;// Max number of hits allowed for this search. This actually depends on the type of search (files, GXS groups, GXS group data, etc) }; class TurtleTunnelRequestInfo { @@ -397,9 +398,9 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config //------ Functions connecting the turtle router to other components.----------// /// Performs a search calling local cache and search structure. - void performLocalSearch (RsTurtleSearchRequestItem *item, uint32_t& req_result_count,std::list& result) ; - void performLocalSearch_files (RsTurtleFileSearchRequestItem *item, uint32_t& req_result_count,std::list& result) ; - void performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item, uint32_t& req_result_count,std::list& result) ; + void performLocalSearch (RsTurtleSearchRequestItem *item, uint32_t& req_result_count,std::list& result,uint32_t& max_allowed_hits) ; + void performLocalSearch_files (RsTurtleFileSearchRequestItem *item, uint32_t& req_result_count, std::list& result, uint32_t &max_allowed_hits) ; + void performLocalSearch_generic(RsTurtleGenericSearchRequestItem *item, uint32_t& req_result_count, std::list& result, uint32_t &max_allowed_hits) ; /// Returns true if the file with given hash is hosted locally, and accessible in anonymous mode the supplied peer. virtual bool performLocalHashSearch(const TurtleFileHash& hash,const RsPeerId& client_peer_id,RsTurtleClientService *& service); diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 182e6deca..cfc775f24 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -50,6 +50,11 @@ RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype) c return NULL ; } +std::string RsTurtleGenericSearchRequestItem::GetKeywords() +{ + return std::string("Generic search : " + RsUtil::BinToHex(search_data,search_data_len,10)); +} + void RsTurtleStringSearchRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_VALUE,match_string,"match_string") ; @@ -67,6 +72,7 @@ void RsTurtleGenericSearchRequestItem::serial_process(RsGenericSerializer::Seria RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; RsTypeSerializer::serial_process(j,ctx,depth,"depth") ; RsTypeSerializer::serial_process(j,ctx,service_id,"service_id") ; + RsTypeSerializer::serial_process(j,ctx,request_type,"request_type") ; RsTypeSerializer::TlvMemBlock_proxy prox(search_data,search_data_len) ; RsTypeSerializer::serial_process(j,ctx,prox,"search_data") ; diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index d35cbb8fd..d8ee48165 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -82,7 +82,7 @@ class RsTurtleSearchRequestItem: public RsTurtleItem virtual RsTurtleSearchRequestItem *clone() const = 0 ; // used for cloning in routing methods virtual std::string GetKeywords() = 0; - virtual uint16_t serviceId() = 0 ; + virtual uint16_t serviceId() const= 0 ; uint32_t request_id ; // randomly generated request id. uint16_t depth ; // Used for limiting search depth. @@ -94,7 +94,7 @@ class RsTurtleFileSearchRequestItem: public RsTurtleSearchRequestItem RsTurtleFileSearchRequestItem(uint32_t subtype) : RsTurtleSearchRequestItem(subtype) {} virtual ~RsTurtleFileSearchRequestItem() {} - virtual uint16_t serviceId() { return RS_SERVICE_TYPE_FILE_TRANSFER ; } + virtual uint16_t serviceId() const { return RS_SERVICE_TYPE_FILE_TRANSFER ; } virtual void search(std::list &) const =0; }; @@ -149,12 +149,15 @@ class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem uint16_t service_id ; // service to search uint32_t search_data_len ; + uint8_t request_type ; // type of request. This is used to limit the number of responses. unsigned char *search_data ; - std::string GetKeywords() { return std::string("Generic search " + RsUtil::BinToHex(search_data,search_data_len,10)); } - virtual uint16_t serviceId() { return service_id ; } + std::string GetKeywords() ; + virtual uint16_t serviceId() const { return service_id ; } virtual RsTurtleSearchRequestItem *clone() const ; + virtual uint32_t requestType() const { return request_type; } + void clear() { free(search_data); search_data=NULL; search_data_len=0; } protected: diff --git a/libretroshare/src/turtle/turtleclientservice.h b/libretroshare/src/turtle/turtleclientservice.h index b3aa37af1..039827ef4 100644 --- a/libretroshare/src/turtle/turtleclientservice.h +++ b/libretroshare/src/turtle/turtleclientservice.h @@ -101,10 +101,15 @@ class RsTurtleClientService * \param search_request_data_len length of the serialized search data * \param search_result_data generic serialized search result data * \param search_result_data_len length of the serialized search result data + * \param max_allowed_hits max number of hits allowed to be sent back and forwarded * * \return true if the search is successful. */ - virtual bool receiveSearchRequest(unsigned char */*search_request_data*/,uint32_t /*search_request_data_len*/,unsigned char *& /*search_result_data*/,uint32_t& /*search_result_data_len*/) + virtual bool receiveSearchRequest(unsigned char */*search_request_data*/, + uint32_t /*search_request_data_len*/, + unsigned char *& /*search_result_data*/, + uint32_t& /*search_result_data_len*/, + uint32_t& /* max_allows_hits */) { std::cerr << "!!!!!! Received search result from turtle router, but the client service who requested it is not handling it !!!!!!!!!!" << std::endl ; return false; From b3dddeafdffaa0b739a7067dccfdccad246ac74e Mon Sep 17 00:00:00 2001 From: chelovechishko Date: Fri, 6 Jul 2018 23:55:12 +0900 Subject: [PATCH 112/213] add missing namespaces --- libretroshare/src/pqi/p3peermgr.cc | 174 +++++++++--------- libretroshare/src/services/p3banlist.cc | 30 +-- retroshare-gui/src/gui/MainWindow.cpp | 10 +- retroshare-gui/src/gui/PluginsPage.h | 12 +- .../src/gui/settings/PluginsPage.cpp | 20 +- retroshare-gui/src/gui/settings/PluginsPage.h | 3 + .../src/gui/settings/rsettingswin.cpp | 2 +- 7 files changed, 133 insertions(+), 118 deletions(-) diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index fb17dddb6..243b26135 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -89,11 +89,11 @@ static const std::string kConfigKeyProxyServerIpAddrTor = "PROXY_SERVER_IPADDR"; static const std::string kConfigKeyProxyServerPortTor = "PROXY_SERVER_PORT"; static const std::string kConfigKeyProxyServerIpAddrI2P = "PROXY_SERVER_IPADDR_I2P"; static const std::string kConfigKeyProxyServerPortI2P = "PROXY_SERVER_PORT_I2P"; - + void printConnectState(std::ostream &out, peerState &peer); peerState::peerState() - :netMode(RS_NET_MODE_UNKNOWN), vs_disc(RS_VS_DISC_FULL), vs_dht(RS_VS_DHT_FULL), lastcontact(0), + :netMode(RS_NET_MODE_UNKNOWN), vs_disc(RS_VS_DISC_FULL), vs_dht(RS_VS_DHT_FULL), lastcontact(0), hiddenNode(false), hiddenPort(0), hiddenType(RS_HIDDEN_TYPE_NONE) { sockaddr_storage_clear(localaddr); @@ -107,13 +107,13 @@ std::string textPeerConnectState(peerState &state) std::string out = "Id: " + state.id.toStdString() + "\n"; rs_sprintf_append(out, "NetMode: %lu\n", state.netMode); rs_sprintf_append(out, "VisState: Disc: %u Dht: %u\n", state.vs_disc, state.vs_dht); - + out += "laddr: "; out += sockaddr_storage_tostring(state.localaddr); out += "\neaddr: "; out += sockaddr_storage_tostring(state.serveraddr); out += "\n"; - + return out; } @@ -136,7 +136,7 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_ mOwnState.netMode = RS_NET_MODE_UPNP; // Default to UPNP. mOwnState.vs_disc = RS_VS_DISC_FULL; mOwnState.vs_dht = RS_VS_DHT_FULL; - + // setup default ProxyServerAddress. // Tor sockaddr_storage_clear(mProxyServerAddressTor); @@ -154,7 +154,7 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_ mProxyServerStatusTor = RS_NET_PROXY_STATUS_UNKNOWN ; mProxyServerStatusI2P = RS_NET_PROXY_STATUS_UNKNOWN; } - + #ifdef PEER_DEBUG std::cerr << "p3PeerMgr() Startup" << std::endl; #endif @@ -222,8 +222,8 @@ bool p3PeerMgrIMPL::forceHiddenNode() struct sockaddr_storage loopback; sockaddr_storage_clear(loopback); sockaddr_storage_ipv4_aton(loopback, "127.0.0.1"); - uint16_t port = sockaddr_storage_port(mOwnState.localaddr); - sockaddr_storage_ipv4_setport(loopback, port); + uint16_t port = sockaddr_storage_port(mOwnState.localaddr); + sockaddr_storage_ipv4_setport(loopback, port); setLocalAddress(AuthSSL::getAuthSSL()->OwnId(), loopback); @@ -254,7 +254,7 @@ bool p3PeerMgrIMPL::setOwnNetworkMode(uint32_t netMode) changed = true; } } - + // Pass on Flags to NetMgr. mNetMgr->setNetworkMode((netMode & RS_NET_MODE_ACTUAL)); return changed; @@ -267,7 +267,7 @@ bool p3PeerMgrIMPL::setOwnVisState(uint16_t vs_disc, uint16_t vs_dht) RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ std::string out; - rs_sprintf(out, "p3PeerMgr::setOwnVisState() Existing vis: %u/%u Input vis: %u/%u", + rs_sprintf(out, "p3PeerMgr::setOwnVisState() Existing vis: %u/%u Input vis: %u/%u", mOwnState.vs_disc, mOwnState.vs_dht, vs_disc, vs_dht); rslog(RSL_WARNING, p3peermgrzone, out); @@ -275,7 +275,7 @@ bool p3PeerMgrIMPL::setOwnVisState(uint16_t vs_disc, uint16_t vs_dht) std::cerr << out.c_str() << std::endl; #endif - if (mOwnState.vs_disc != vs_disc || mOwnState.vs_dht != vs_dht) + if (mOwnState.vs_disc != vs_disc || mOwnState.vs_dht != vs_dht) { mOwnState.vs_disc = vs_disc; mOwnState.vs_dht = vs_dht; @@ -283,7 +283,7 @@ bool p3PeerMgrIMPL::setOwnVisState(uint16_t vs_disc, uint16_t vs_dht) IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ } } - + // Pass on Flags to NetMgr. mNetMgr->setVisState(vs_disc, vs_dht); @@ -575,7 +575,7 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ - if (ssl_id == AuthSSL::getAuthSSL()->OwnId()) + if (ssl_id == AuthSSL::getAuthSSL()->OwnId()) { mOwnState.hiddenNode = true; mOwnState.hiddenDomain = domain; @@ -917,7 +917,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - if (id == AuthSSL::getAuthSSL()->OwnId()) + if (id == AuthSSL::getAuthSSL()->OwnId()) { #ifdef PEER_DEBUG std::cerr << "p3PeerMgrIMPL::addFriend() cannot add own id as a friend." << std::endl; @@ -973,7 +973,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg /* setup connectivity parameters */ it->second.vs_disc = vs_disc; it->second.vs_dht = vs_dht; - + it->second.netMode = netMode; it->second.lastcontact = lastContact; @@ -995,7 +995,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg pstate.id = id; pstate.gpg_id = gpg_id; pstate.name = AuthGPG::getAuthGPG()->getGPGName(gpg_id); - + pstate.vs_disc = vs_disc; pstate.vs_dht = vs_dht; pstate.netMode = netMode; @@ -1018,7 +1018,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg mLinkMgr->addFriend(id, vs_dht != RS_VS_DHT_OFF); } - service_flags &= servicePermissionFlags(gpg_id) ; // Always reduce the permissions. + service_flags &= servicePermissionFlags(gpg_id) ; // Always reduce the permissions. #ifdef RS_CHATSERVER //Defined by chatserver setServicePermissionFlags(gpg_id,RS_NODE_PERM_NONE) ; #else @@ -1029,7 +1029,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg printPeerLists(std::cerr); mLinkMgr->printPeerLists(std::cerr); #endif - + return true; } @@ -1071,10 +1071,10 @@ bool p3PeerMgrIMPL::removeFriend(const RsPgpId &id) } for(std::list::iterator rit = sslid_toRemove.begin(); rit != sslid_toRemove.end(); ++rit) - if (mFriendList.end() != (it = mFriendList.find(*rit))) + if (mFriendList.end() != (it = mFriendList.find(*rit))) mFriendList.erase(it); - std::map::iterator it2 = mFriendsPermissionFlags.find(id) ; + std::map::iterator it2 = mFriendsPermissionFlags.find(id) ; if(it2 != mFriendsPermissionFlags.end()) mFriendsPermissionFlags.erase(it2); @@ -1146,13 +1146,13 @@ bool p3PeerMgrIMPL::removeFriend(const RsPeerId &id, bool removePgpId) } for(std::list::iterator rit = sslid_toRemove.begin(); rit != sslid_toRemove.end(); ++rit) - if (mFriendList.end() != (it = mFriendList.find(*rit))) + if (mFriendList.end() != (it = mFriendList.find(*rit))) mFriendList.erase(it); std::map::iterator it2 ; for(std::list::iterator rit = pgpid_toRemove.begin(); rit != pgpid_toRemove.end(); ++rit) - if (mFriendsPermissionFlags.end() != (it2 = mFriendsPermissionFlags.find(*rit))) + if (mFriendsPermissionFlags.end() != (it2 = mFriendsPermissionFlags.find(*rit))) mFriendsPermissionFlags.erase(it2); #ifdef PEER_DEBUG @@ -1432,7 +1432,7 @@ bool p3PeerMgrIMPL::setLocalAddress( const RsPeerId &id, if (changed) { IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ - + mNetMgr->setLocalAddress(addr); mLinkMgr->setLocalAddress(addr); } @@ -1499,9 +1499,9 @@ bool p3PeerMgrIMPL::setExtAddress( const RsPeerId &id, changed = true; } } - + mNetMgr->setExtAddress(addr); - + return changed; } @@ -1584,12 +1584,16 @@ bool p3PeerMgrIMPL::setDynDNS(const RsPeerId &id, const std::string &dyndns) return changed; } +namespace pqi { + struct ZeroedInt { ZeroedInt() { n=0 ;} int n ; }; +} + bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, const sockaddr_storage &addr) { // The algorithm is the following: @@ -1617,10 +1621,10 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons // Update a list of own IPs: // - remove old values for that same peer // - remove values for non connected peers - + { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - + mReportedOwnAddresses[from] = addr_filtered ; for(std::map::iterator it(mReportedOwnAddresses.begin());it!=mReportedOwnAddresses.end();) @@ -1641,8 +1645,8 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons std::cerr << "p3PeerMgr:: Current external address is calculated to be: " << sockaddr_storage_iptostring(current_best_ext_address_guess) << " (simultaneously reported by " << count << " peers)." << std::endl; } - - // now current + + // now current sockaddr_storage own_addr ; @@ -1665,7 +1669,7 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, from.toStdString(), sockaddr_storage_iptostring(own_addr), sockaddr_storage_iptostring(addr)); } - + // we could also sweep over all connected friends and see if some report a different address. return true ; @@ -1673,46 +1677,46 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons bool p3PeerMgrIMPL::locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage& addr, uint32_t& count) { - std::map addr_counts ; - + std::map addr_counts ; + for(std::map::iterator it(mReportedOwnAddresses.begin());it!=mReportedOwnAddresses.end();++it) ++addr_counts[it->second].n ; #ifdef PEER_DEBUG std::cerr << "Current ext addr statistics:" << std::endl; #endif - + count = 0 ; - - for(std::map::const_iterator it(addr_counts.begin());it!=addr_counts.end();++it) + + for(std::map::const_iterator it(addr_counts.begin());it!=addr_counts.end();++it) { if(uint32_t(it->second.n) > count) { addr = it->first ; count = it->second.n ; } - + #ifdef PEER_DEBUG std::cerr << sockaddr_storage_iptostring(it->first) << " : " << it->second.n << std::endl; #endif } - + return true ; } - + bool p3PeerMgrIMPL::getExtAddressReportedByFriends(sockaddr_storage &addr, uint8_t& /*isstable*/) { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - + uint32_t count ; - + locked_computeCurrentBestOwnExtAddressCandidate(addr,count) ; - + #ifdef PEER_DEBUG std::cerr << "Estimation count = " << count << ". Trusted? = " << (count>=2) << std::endl; #endif - - return count >= 2 ;// 2 is not conservative enough. 3 should be probably better. + + return count >= 2 ;// 2 is not conservative enough. 3 should be probably better. } static bool cleanIpList(std::list& lst,const RsPeerId& pid,p3LinkMgr *link_mgr) @@ -1765,7 +1769,7 @@ bool p3PeerMgrIMPL::updateAddressList(const RsPeerId& id, const pqiIpAddrSet RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ /* check if it is our own ip */ - if (id == getOwnId()) + if (id == getOwnId()) { mOwnState.ipAddrs.updateAddrs(clean_set); return true; @@ -1811,11 +1815,11 @@ bool p3PeerMgrIMPL::updateCurrentAddress(const RsPeerId& id, const pqiIpAddre #ifdef PEER_DEBUG std::cerr << "p3PeerMgrIMPL::updateCurrentAddress() called for id : " << id << std::endl; #endif - + RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - + /* cannot be own id */ - + /* check if it is a friend */ std::map::iterator it; if (mFriendList.end() == (it = mFriendList.find(id))) @@ -1846,23 +1850,23 @@ bool p3PeerMgrIMPL::updateCurrentAddress(const RsPeerId& id, const pqiIpAddre std::cerr << addrstr; std::cerr << std::endl; #endif - + IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ - + return true; } - + bool p3PeerMgrIMPL::updateLastContact(const RsPeerId& id) { #ifdef PEER_DEBUG std::cerr << "p3PeerMgrIMPL::updateLastContact() called for id : " << id << std::endl; #endif - + RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - + /* cannot be own id */ - + /* check if it is a friend */ std::map::iterator it; if (mFriendList.end() == (it = mFriendList.find(id))) @@ -1877,7 +1881,7 @@ bool p3PeerMgrIMPL::updateLastContact(const RsPeerId& id) it->second.lastcontact = time(NULL); IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ - + return true; } @@ -2061,7 +2065,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) getProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr_tor); getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr_i2p); - mPeerMtx.lock(); /****** MUTEX LOCKED *******/ + mPeerMtx.lock(); /****** MUTEX LOCKED *******/ RsPeerNetItem *item = new RsPeerNetItem(); item->clear(); @@ -2088,14 +2092,14 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) item->vs_disc = mOwnState.vs_disc; item->vs_dht = mOwnState.vs_dht; - + item->lastContact = mOwnState.lastcontact; item->localAddrV4.addr = mOwnState.localaddr; item->extAddrV4.addr = mOwnState.serveraddr; sockaddr_storage_clear(item->localAddrV6.addr); sockaddr_storage_clear(item->extAddrV6.addr); - + item->dyndns = mOwnState.dyndns; mOwnState.ipAddrs.mLocal.loadTlv(item->localAddrList); mOwnState.ipAddrs.mExt.loadTlv(item->extAddrList); @@ -2125,20 +2129,20 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) item->vs_dht = (it->second).vs_dht; item->lastContact = (it->second).lastcontact; - + item->localAddrV4.addr = (it->second).localaddr; item->extAddrV4.addr = (it->second).serveraddr; sockaddr_storage_clear(item->localAddrV6.addr); sockaddr_storage_clear(item->extAddrV6.addr); - - + + item->dyndns = (it->second).dyndns; (it->second).ipAddrs.mLocal.loadTlv(item->localAddrList); (it->second).ipAddrs.mExt.loadTlv(item->extAddrList); item->domain_addr = (it->second).hiddenDomain; item->domain_port = (it->second).hiddenPort; - + saveData.push_back(item); #ifdef PEER_DEBUG std::cerr << "p3PeerMgrIMPL::saveList() Peer Config Item:" << std::endl; @@ -2150,7 +2154,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) RsPeerBandwidthLimitsItem *pblitem = new RsPeerBandwidthLimitsItem ; pblitem->peers = mPeerBandwidthLimits ; saveData.push_back(pblitem) ; - + RsPeerServicePermissionItem *sitem = new RsPeerServicePermissionItem ; for(std::map::const_iterator it(mFriendsPermissionFlags.begin());it!=mFriendsPermissionFlags.end();++it) @@ -2158,11 +2162,11 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) sitem->pgp_ids.push_back(it->first) ; sitem->service_flags.push_back(it->second) ; } - + saveData.push_back(sitem) ; // Now save config for network digging strategies - + RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ; RsTlvKeyValue kv; @@ -2199,7 +2203,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) kv.key = kConfigKeyProxyServerPortI2P; kv.value = sockaddr_storage_porttostring(proxy_addr_i2p); vitem->tlvkvs.pairs.push_back(kv) ; - + saveData.push_back(vitem); /* save groups */ @@ -2213,7 +2217,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData) return true; } -bool p3PeerMgrIMPL::getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn) +bool p3PeerMgrIMPL::getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn) { RsPgpId pgp_id ; @@ -2235,7 +2239,7 @@ bool p3PeerMgrIMPL::getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& ma return getMaxRates(pgp_id,maxUp,maxDn) ; } -bool p3PeerMgrIMPL::getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn) +bool p3PeerMgrIMPL::getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn) { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ @@ -2254,25 +2258,25 @@ bool p3PeerMgrIMPL::getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& max return false ; } } -bool p3PeerMgrIMPL::setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn) +bool p3PeerMgrIMPL::setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn) { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ PeerBandwidthLimits& p(mPeerBandwidthLimits[pid]) ; - + if(maxUp == p.max_up_rate_kbs && maxDn == p.max_dl_rate_kbs) return true ; - + std::cerr << "Updating max rates for peer " << pid << " to " << maxUp << " kB/s (up), " << maxDn << " kB/s (dn)" << std::endl; - + p.max_up_rate_kbs = maxUp ; p.max_dl_rate_kbs = maxDn ; - + IndicateConfigChanged(); - + return true ; } - + void p3PeerMgrIMPL::saveDone() { /* clean up the save List */ @@ -2396,7 +2400,7 @@ bool p3PeerMgrIMPL::loadList(std::list& load) #ifdef PEER_DEBUG std::cerr << "setting use_extr_addr_finder to " << useExtAddrFinder << std::endl ; #endif - } + } // Tor else if (kit->key == kConfigKeyProxyServerIpAddrTor) { @@ -2859,13 +2863,13 @@ bool p3PeerMgrIMPL::removeAllFriendLocations(const RsPgpId &gpgid) { return false; } - + std::list::iterator it; for(it = sslIds.begin(); it != sslIds.end(); ++it) { removeFriend(*it, true); } - + return true; } @@ -2877,7 +2881,7 @@ bool p3PeerMgrIMPL::getAssociatedPeers(const RsPgpId &gpg_id, std::list::iterator it; for(it = mFriendList.begin(); it != mFriendList.end(); ++it) @@ -2890,10 +2894,10 @@ bool p3PeerMgrIMPL::getAssociatedPeers(const RsPgpId &gpg_id, std::listfirst << std::endl; #endif - + } } - + return (count > 0); } @@ -2930,10 +2934,10 @@ bool p3PeerMgrIMPL::removeBannedIps() return true ; } -// /* This only removes SSL certs, that are old... Can end up with no Certs per GPG Id +// /* This only removes SSL certs, that are old... Can end up with no Certs per GPG Id // * We are removing the concept of a "DummyId" - There is no need for it. // */ -// +// // bool isDummyFriend(RsPeerId id) // { // bool ret = (id.substr(0,5) == "dummy"); @@ -2974,7 +2978,7 @@ bool p3PeerMgrIMPL::removeUnusedLocations() { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - + // First put a sensible number in all PGP ids for(std::list::const_iterator it = pgpList.begin(); it != pgpList.end(); ++it) @@ -2984,7 +2988,7 @@ bool p3PeerMgrIMPL::removeUnusedLocations() std::cerr << "p3PeerMgr::removeUnusedLocations()" << std::endl; #endif // Then compute the most recently used location for all PGP ids - + for( std::map::iterator it = mFriendList.begin(); it != mFriendList.end(); ++it) { time_t& bst(mostRecentTime[it->second.gpg_id]) ; @@ -3010,4 +3014,4 @@ bool p3PeerMgrIMPL::removeUnusedLocations() return true; } - + diff --git a/libretroshare/src/services/p3banlist.cc b/libretroshare/src/services/p3banlist.cc index b1fc07113..fdfcb05b5 100644 --- a/libretroshare/src/services/p3banlist.cc +++ b/libretroshare/src/services/p3banlist.cc @@ -55,7 +55,7 @@ #define RSBANLIST_DELAY_BETWEEN_TALK_TO_DHT 240 // every 4 mins. /************ IMPLEMENTATION NOTES ********************************* - * + * * Get Bad Peers passed to us (from DHT mainly). * we distribute and track the network list of bad peers. * @@ -113,6 +113,8 @@ void p3BanList::setAutoRangeLimit(int n) IndicateConfigChanged(); } +namespace services { + class ZeroedInt { public: @@ -120,6 +122,8 @@ class ZeroedInt uint32_t n ; }; +} + BanListPeer::BanListPeer() { memset(&addr, 0, sizeof(addr)); @@ -220,14 +224,14 @@ void p3BanList::autoFigureOutBanRanges() std::cerr << "Automatically figuring out IP ranges from banned IPs." << std::endl; #endif - std::map range_map ; + std::map range_map ; for(std::map::iterator it(mBanSet.begin());it!=mBanSet.end();++it) ++range_map[makeBitsRange(it->first,1)].n ; time_t now = time(NULL) ; - for(std::map::const_iterator it=range_map.begin();it!=range_map.end();++it) + for(std::map::const_iterator it=range_map.begin();it!=range_map.end();++it) { #ifdef DEBUG_BANLIST std::cerr << "Ban range: " << sockaddr_storage_iptostring(it->first) << " : " << it->second.n << std::endl; @@ -646,7 +650,7 @@ bool p3BanList::processIncoming() break; case RS_PKT_SUBTYPE_BANLIST_ITEM: { - // Order is important!. + // Order is important!. updated = (recvBanItem((RsBanListItem *) item) || updated); } break; @@ -669,8 +673,8 @@ bool p3BanList::processIncoming() } return true ; -} - +} + bool p3BanList::recvBanItem(RsBanListItem *item) { @@ -681,7 +685,7 @@ bool p3BanList::recvBanItem(RsBanListItem *item) for(it = item->peerList.mList.begin(); it != item->peerList.mList.end(); ++it) { - // Order is important!. + // Order is important!. updated = (addBanEntry(item->PeerId(), it->addr.addr, it->level, it->reason, now - it->age) || updated); } return updated; @@ -961,7 +965,7 @@ bool p3BanList::addBanEntry( const RsPeerId &peerId, it = mBanSources.find(peerId); updated = true; } - + // index is FAMILY + IP - the rest should be Zeros.. struct sockaddr_storage bannedaddr; sockaddr_storage_clear(bannedaddr); @@ -980,7 +984,7 @@ bool p3BanList::addBanEntry( const RsPeerId &peerId, blp.level = level; blp.mTs = time_stamp ; blp.masked_bytes = 0 ; - + it->second.mBanPeers[bannedaddr] = blp; it->second.mLastUpdate = now; updated = true; @@ -1036,7 +1040,7 @@ int p3BanList::condenseBanSources_locked() time_t now = time(NULL); RsPeerId ownId = mServiceCtrl->getOwnId(); - + #ifdef DEBUG_BANLIST std::cerr << "p3BanList::condenseBanSources_locked()"; std::cerr << std::endl; @@ -1062,7 +1066,7 @@ int p3BanList::condenseBanSources_locked() std::cerr << " Condensing Info from peer: " << it->first; std::cerr << std::endl; #endif - + std::map::const_iterator lit; for(lit = it->second.mBanPeers.begin(); lit != it->second.mBanPeers.end(); ++lit) { @@ -1135,7 +1139,7 @@ int p3BanList::condenseBanSources_locked() } } - + #ifdef DEBUG_BANLIST std::cerr << "p3BanList::condenseBanSources_locked() Printing New Set:"; std::cerr << std::endl; @@ -1280,7 +1284,7 @@ int p3BanList::printBanSet_locked(std::ostream &out) int p3BanList::printBanSources_locked(std::ostream &out) { time_t now = time(NULL); - + std::map::const_iterator it; for(it = mBanSources.begin(); it != mBanSources.end(); ++it) { diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index e00417080..ffa7a49fd 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -433,7 +433,7 @@ void MainWindow::initStackedPage() #ifndef RS_RELEASE_VERSION #ifdef PLUGINMGR - addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL); + addPage(pluginsPage = new gui::PluginsPage(ui->stackPages), grp, NULL); #endif #endif @@ -643,10 +643,10 @@ const QList &MainWindow::getUserNotifyList() /*static*/ void MainWindow::displayLobbySystrayMsg(const QString& title,const QString& msg) { - if (_instance == NULL) + if (_instance == NULL) return; - if(Settings->getDisplayTrayChatLobby()) + if(Settings->getDisplayTrayChatLobby()) _instance->displaySystrayMsg(title,msg) ; } @@ -1011,7 +1011,7 @@ void SetForegroundWindowInternal(HWND hWnd) return NULL; } - switch (page) + switch (page) { case Network: return _instance->friendsDialog->networkDialog; @@ -1457,7 +1457,7 @@ void MainWindow::externalLinkActivated(const QUrl &url) int res = mb.exec() ; - if (res == QMessageBox::No) + if (res == QMessageBox::No) return ; if(dontAsk_CB->isChecked()) diff --git a/retroshare-gui/src/gui/PluginsPage.h b/retroshare-gui/src/gui/PluginsPage.h index de90a3d8f..fac165396 100644 --- a/retroshare-gui/src/gui/PluginsPage.h +++ b/retroshare-gui/src/gui/PluginsPage.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ****************************************************************/ @@ -39,6 +39,8 @@ class QScriptEngine; class PluginManager; +namespace gui { + //! A demo widget for showing plugin engine in action :) @@ -46,7 +48,7 @@ class PluginManager; //! loaded plugin widgets. All specific actions moved to //! PluginManagerWidget class. It contains a PluginManager instance, but it's //! supposed that in future a pluginManager will become a global variable -class PluginsPage : public MainPage +class PluginsPage : public MainPage { Q_OBJECT @@ -70,10 +72,10 @@ protected: QVBoxLayout* pluginPageLayout; QGroupBox* pluginPanel; QVBoxLayout* pluginPanelLayout; - + //! Plugin widgets will be loaded into this tabs QTabWidget* pluginTabs ; - + QVBoxLayout* pmLay; QFrame* pmFrame; QSpacerItem* pmSpacer; @@ -82,5 +84,7 @@ protected: PluginManager* pluginManager; }; +} // namespace gui + #endif diff --git a/retroshare-gui/src/gui/settings/PluginsPage.cpp b/retroshare-gui/src/gui/settings/PluginsPage.cpp index cdc326ec0..4be141c6e 100644 --- a/retroshare-gui/src/gui/settings/PluginsPage.cpp +++ b/retroshare-gui/src/gui/settings/PluginsPage.cpp @@ -33,7 +33,7 @@ #include "../MainWindow.h" -PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags) +settings::PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags) : ConfigPage(parent, flags) { ui.setupUi(this); @@ -123,7 +123,7 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags) if(plugin == NULL || plugin->qt_config_panel() == NULL) item->_configure_PB->hide() ; - + if(plugin != NULL){ item->enableButton->hide(); @@ -159,7 +159,7 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags) QObject::connect(ui.enableAll,SIGNAL(toggled(bool)),this,SLOT(toggleEnableAll(bool))) ; } -QString PluginsPage::helpText() const +QString settings::PluginsPage::helpText() const { return tr("

  Plugins

\

Plugins are loaded from the directories listed in the bottom list.

\ @@ -171,11 +171,11 @@ QString PluginsPage::helpText() const

If you want to develop your own plugins, contact the developpers team \ they will be happy to help you out!

") ; } -void PluginsPage::toggleEnableAll(bool b) +void settings::PluginsPage::toggleEnableAll(bool b) { rsPlugins->allowAllPlugins(b) ; } -void PluginsPage::aboutPlugin(int i) +void settings::PluginsPage::aboutPlugin(int i) { std::cerr << "Launching about window for plugin " << i << std::endl; @@ -183,7 +183,7 @@ void PluginsPage::aboutPlugin(int i) if(rsPlugins->plugin(i) != NULL && (dialog = rsPlugins->plugin(i)->qt_about_page()) != NULL) dialog->exec() ; } -void PluginsPage::configurePlugin(int i) +void settings::PluginsPage::configurePlugin(int i) { std::cerr << "Launching configuration window for plugin " << i << std::endl; @@ -191,14 +191,14 @@ void PluginsPage::configurePlugin(int i) rsPlugins->plugin(i)->qt_config_panel()->show() ; } -void PluginsPage::enablePlugin(const QString& hash) +void settings::PluginsPage::enablePlugin(const QString& hash) { std::cerr << "Switching status of plugin " << hash.toStdString() << " to enable" << std::endl; rsPlugins->enablePlugin(RsFileHash(hash.toStdString()) ); } -void PluginsPage::disablePlugin(const QString& hash) +void settings::PluginsPage::disablePlugin(const QString& hash) { std::cerr << "Switching status of plugin " << hash.toStdString() << " to disable " << std::endl; @@ -206,11 +206,11 @@ void PluginsPage::disablePlugin(const QString& hash) } -PluginsPage::~PluginsPage() +settings::PluginsPage::~PluginsPage() { } /** Loads the settings for this page */ -void PluginsPage::load() +void settings::PluginsPage::load() { } diff --git a/retroshare-gui/src/gui/settings/PluginsPage.h b/retroshare-gui/src/gui/settings/PluginsPage.h index 0d8f72dac..0151592af 100644 --- a/retroshare-gui/src/gui/settings/PluginsPage.h +++ b/retroshare-gui/src/gui/settings/PluginsPage.h @@ -24,6 +24,8 @@ #include #include "ui_PluginsPage.h" +namespace settings { + class PluginsPage : public ConfigPage { Q_OBJECT @@ -52,3 +54,4 @@ class PluginsPage : public ConfigPage Ui::PluginsPage ui; }; +} // namespace settings diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 0a2b348f0..7f2dcf115 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -158,7 +158,7 @@ SettingsPage::initStackedWidget() addPage(new ForumPage()); // FORUMS addPage(new PostedPage()); // POSTED RENAME TO LINKS addPage(new NotifyPage()); // NOTIFY - addPage(new PluginsPage() ); // PLUGINS + addPage(new settings::PluginsPage() ); // PLUGINS addPage(new AppearancePage()); // APPEARENCE addPage(new SoundPage() ); // SOUND addPage(new ServicePermissionsPage() ); // PERMISSIONS From fd45d44826ff63b37d09986bf13db3e3b1c693ef Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Jul 2018 11:14:58 +0200 Subject: [PATCH 113/213] added interface to get statistics about GxsNetTunnel --- libretroshare/src/gxs/rsgxsnettunnel.cc | 8 ++++ libretroshare/src/gxs/rsgxsnettunnel.h | 60 ++++--------------------- libretroshare/src/libretroshare.pro | 1 + libretroshare/src/rsserver/rsinit.cc | 2 + 4 files changed, 20 insertions(+), 51 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index fc8d5eb79..85fcec2d8 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -39,6 +39,8 @@ static const uint32_t RS_GXS_NET_TUNNEL_MAX_ALLOWED_HITS_GROUP_DATA = 1; static const uint32_t RS_GXS_NET_TUNNEL_MAX_ALLOWED_HITS_GROUP_SEARCH = 100; +RsGxsDistSync *rsGxsDistSync = NULL; + RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { #warning this is for testing only. In the final version this needs to be initialized with some random content, saved and re-used for a while (e.g. 1 month) @@ -1145,6 +1147,12 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id GXS_NET_TUNNEL_ERROR() << ": deserialized item is of unknown type. Dropping!" << std::endl; } +void RsGxsNetTunnelService::getStatistics( std::map& groups,std::map& virtual_peers,Bias20Bytes& bias ) const +{ + groups = mGroups ; + virtual_peers = mVirtualPeers ; + bias = mRandomBias ; +} diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 0fdff3ccc..53cd42b96 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -27,7 +27,8 @@ #include -#include +#include "turtle/p3turtle.h" +#include "retroshare/rsgxsdistsync.h" /*! * \brief The RsGxsNetTunnelService class takes care of requesting tunnels to the turtle router, through which it is possible to sync @@ -102,59 +103,10 @@ // and there is no way to prevent it. We therefore rely on GXS data integrity system to prevent this to happen. // -typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; - class RsGxsNetTunnelItem ; class RsNetworkExchangeService ; -struct RsGxsNetTunnelVirtualPeerInfo -{ - enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. - RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id - RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. - }; - - RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } - virtual ~RsGxsNetTunnelVirtualPeerInfo(){} - - uint8_t vpid_status ; // status of the peer - time_t last_contact ; // last time some data was sent/recvd - uint8_t side ; // client/server - uint8_t encryption_master_key[32]; - - TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. - - RsGxsGroupId group_id ; // group that virtual peer is providing - uint16_t service_id ; // this is used for checkng consistency of the incoming data -}; - -struct RsGxsNetTunnelGroupInfo -{ - enum GroupStatus { - RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status - RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting - RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available. Data can be read/written - }; - - enum GroupPolicy { - RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set - RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels - RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will only explicitely request tunnels if none available - RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING = 0x03, // group explicitely requests tunnels - }; - - RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} - - GroupPolicy group_policy ; - GroupStatus group_status ; - time_t last_contact ; - TurtleFileHash hash ; - uint16_t service_id ; - - std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. -}; - -class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread, public p3Config +class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread, public p3Config, public RsGxsDistSync { public: RsGxsNetTunnelService() ; @@ -257,6 +209,12 @@ public: bool saveList(bool& cleanup, std::list& save); bool loadList(std::list &load); + // Overloads RsGxsDistSync + + void getStatistics(std::map& groups, // groups on the client and server side + std::map& virtual_peers, // current virtual peers, which group they provide, and how to talk to them through turtle + Bias20Bytes& bias) const; + protected: // interaction with turtle router diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 1b8018167..998f32b51 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -137,6 +137,7 @@ PUBLIC_HEADERS = retroshare/rsdisc.h \ retroshare/rsconfig.h \ retroshare/rsversion.h \ retroshare/rsservicecontrol.h \ + retroshare/rsgxsdistsync.h HEADERS += plugins/pluginmanager.h \ plugins/dlfcn_win32.h \ diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 8ec0d7e8c..877c45488 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -62,6 +62,7 @@ #include #include "gxstunnel/p3gxstunnel.h" +#include "retroshare/rsgxsdistsync.h" #include "file_sharing/p3filelists.h" #define ENABLE_GROUTER @@ -1283,6 +1284,7 @@ int RsServer::StartupRetroShare() #ifdef RS_USE_GXS_DISTANT_SYNC RsGxsNetTunnelService *mGxsNetTunnel = new RsGxsNetTunnelService ; + rsGxsDistSync = mGxsNetTunnel ; #else RsGxsNetTunnelService *mGxsNetTunnel = NULL ; #endif From 34e924f99bc5359ef22dccc37abbdc21315d8918 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Jul 2018 14:40:50 +0200 Subject: [PATCH 114/213] added visualisation for GXS net tunnels (unfinished) --- .../src/gui/statistics/TurtleRouterDialog.cpp | 250 ++++++++++++++---- .../src/gui/statistics/TurtleRouterDialog.h | 44 ++- .../gui/statistics/TurtleRouterStatistics.cpp | 10 +- 3 files changed, 242 insertions(+), 62 deletions(-) diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index 7572bdfae..f7d10374e 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include #include "TurtleRouterDialog.h" #include #include @@ -240,19 +243,14 @@ QTreeWidgetItem *TurtleRouterDialog::findParentHashItem(const std::string& hash) else return items.front() ; } + //=======================================================================================================================// - -GxsTunnelsDialog::GxsTunnelsDialog(QWidget *parent) +TunnelStatisticsDialog::TunnelStatisticsDialog(QWidget *parent) : RsAutoUpdatePage(2000,parent) { -// setupUi(this) ; - m_bProcessSettings = false; - //float fontHeight = QFontMetricsF(font()).height(); - //float fact = fontHeight/14.0; - maxWidth = 200 ; maxHeight = 200 ; @@ -260,14 +258,13 @@ GxsTunnelsDialog::GxsTunnelsDialog(QWidget *parent) processSettings(true); } -GxsTunnelsDialog::~GxsTunnelsDialog() +TunnelStatisticsDialog::~TunnelStatisticsDialog() { - // save settings processSettings(false); } -void GxsTunnelsDialog::processSettings(bool bLoad) +void TunnelStatisticsDialog::processSettings(bool bLoad) { m_bProcessSettings = true; @@ -284,7 +281,77 @@ void GxsTunnelsDialog::processSettings(bool bLoad) m_bProcessSettings = false; } -void GxsTunnelsDialog::updateDisplay() +QString TunnelStatisticsDialog::getPeerName(const RsPeerId &peer_id) +{ + static std::map names ; + + std::map::const_iterator it = names.find(peer_id) ; + + if( it != names.end()) + return it->second ; + else + { + RsPeerDetails detail ; + if(!rsPeers->getPeerDetails(peer_id,detail)) + return tr("Unknown Peer"); + + return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ; + } +} + +QString TunnelStatisticsDialog::getPeerName(const RsGxsId& gxs_id) +{ + static std::map names ; + + std::map::const_iterator it = names.find(gxs_id) ; + + if( it != names.end()) + return it->second ; + else + { + RsIdentityDetails detail ; + + if(!rsIdentity->getIdDetails(gxs_id,detail)) + return tr("Unknown Peer"); + + return (names[gxs_id] = QString::fromUtf8(detail.mNickname.c_str())) ; + } +} + + +QString TunnelStatisticsDialog::speedString(float f) +{ + if(f < 1.0f) + return QString("0 B/s") ; + if(f < 1024.0f) + return QString::number((int)f)+" B/s" ; + + return QString::number(f/1024.0,'f',2) + " KB/s"; +} + +void TunnelStatisticsDialog::paintEvent(QPaintEvent */*event*/) +{ + QStylePainter(this).drawPixmap(0, 0, pixmap); +} + +void TunnelStatisticsDialog::resizeEvent(QResizeEvent *event) +{ + QRect TaskGraphRect = geometry(); + + maxWidth = TaskGraphRect.width(); + maxHeight = TaskGraphRect.height() ; + + QWidget::resizeEvent(event); + update(); +} +//=======================================================================================================================// + +GxsAuthenticatedTunnelsDialog::GxsAuthenticatedTunnelsDialog(QWidget *parent) + : TunnelStatisticsDialog(parent) +{ +} + +void GxsAuthenticatedTunnelsDialog::updateDisplay() { // Request info about ongoing tunnels @@ -334,8 +401,8 @@ void GxsTunnelsDialog::updateDisplay() // draw... painter.drawText(ox+4*cellx,oy+celly,tr("Tunnel ID: %1").arg(QString::fromStdString(tunnel_infos[i].tunnel_id.toStdString()))) ; oy += celly ; - painter.drawText(ox+6*cellx,oy+celly,tr("from: %1").arg(QString::fromStdString(tunnel_infos[i].source_gxs_id.toStdString()))) ; oy += celly ; - painter.drawText(ox+6*cellx,oy+celly,tr("to: %1").arg(QString::fromStdString(tunnel_infos[i].destination_gxs_id.toStdString()))) ; oy += celly ; + painter.drawText(ox+6*cellx,oy+celly,tr("from: %1 (%2)").arg(QString::fromStdString(tunnel_infos[i].source_gxs_id.toStdString())).arg(getPeerName(tunnel_infos[i].source_gxs_id))) ; oy += celly ; + painter.drawText(ox+6*cellx,oy+celly,tr("to: %1 (%2)").arg(QString::fromStdString(tunnel_infos[i].destination_gxs_id.toStdString())).arg(getPeerName(tunnel_infos[i].destination_gxs_id))) ; oy += celly ; painter.drawText(ox+6*cellx,oy+celly,tr("status: %1").arg(QString::number(tunnel_infos[i].tunnel_status))) ; oy += celly ; painter.drawText(ox+6*cellx,oy+celly,tr("total sent: %1 bytes").arg(QString::number(tunnel_infos[i].total_size_sent))) ; oy += celly ; painter.drawText(ox+6*cellx,oy+celly,tr("total recv: %1 bytes").arg(QString::number(tunnel_infos[i].total_size_received))) ; oy += celly ; @@ -350,46 +417,131 @@ void GxsTunnelsDialog::updateDisplay() maxHeight = std::max(oy,10*celly); } -QString GxsTunnelsDialog::getPeerName(const RsPeerId &peer_id) +//=======================================================================================================================// + +GxsNetTunnelsDialog::GxsNetTunnelsDialog(QWidget *parent) + : TunnelStatisticsDialog(parent) { - static std::map names ; +} - std::map::const_iterator it = names.find(peer_id) ; +static QString getGroupStatusString(RsGxsNetTunnelGroupInfo::GroupStatus group_status) +{ + switch(group_status) + { + default: + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN : return QObject::tr("Unknown") ; + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE : return QObject::tr("Idle"); + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE : return QObject::tr("Virtual peers available"); + } + return QString(); +} - if( it != names.end()) - return it->second ; - else +static QString getGroupPolicyString(RsGxsNetTunnelGroupInfo::GroupPolicy group_policy) +{ + switch(group_policy) + { + default: + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN : return QObject::tr("Unknown") ; + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE : return QObject::tr("Passive") ; + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE : return QObject::tr("Active") ; + case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING : return QObject::tr("Requesting peers") ; + } + return QString(); +} + +static QString getLastContactString(time_t last_contact) +{ + time_t now = time(NULL); + + if(last_contact == 0) + return QObject::tr("Never"); + + return QString::number(now - last_contact) + " secs ago" ; +} + +static QString getServiceNameString(uint16_t service_id) +{ + static RsPeerServiceInfo ownServices; + + if(ownServices.mServiceList.find(service_id) == ownServices.mServiceList.end()) + rsServiceControl->getOwnServices(ownServices); + + return QString::fromUtf8(ownServices.mServiceList[service_id].mServiceName.c_str()) ; +} + +void GxsNetTunnelsDialog::updateDisplay() +{ + // Request info about ongoing tunnels + + std::map groups; // groups on the client and server side + std::map virtual_peers; // current virtual peers, which group they provide, and how to talk to them through turtle + Bias20Bytes bias; + + rsGxsDistSync->getStatistics(groups,virtual_peers,bias) ; + + // RsGxsNetTunnelGroupInfo: + // + // enum GroupStatus { + // RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status + // RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting + // RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available. Data can be read/written + // }; + // enum GroupPolicy { + // RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set + // RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels + // RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will only explicitely request tunnels if none available + // RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING = 0x03, // group explicitely requests tunnels + // }; + // + // RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} + // + // GroupPolicy group_policy ; + // GroupStatus group_status ; + // time_t last_contact ; + // RsFileHash hash ; + // uint16_t service_id ; + // std::set virtual_peers ; + + // now draw the shit + QPixmap tmppixmap(maxWidth, maxHeight); + tmppixmap.fill(Qt::transparent); + //setFixedHeight(maxHeight); + + QPainter painter(&tmppixmap); + painter.initFrom(this); + + // extracts the height of the fonts in pixels. This is used to calibrate the size of the objects to draw. + + float fontHeight = QFontMetricsF(font()).height(); + float fact = fontHeight/14.0; + + int cellx = 6*fact ; + int celly = (10+4)*fact ; + int ox=5*fact,oy=5*fact ; + + painter.setPen(QColor::fromRgb(0,0,0)) ; + painter.drawText(ox+2*cellx,oy+celly,tr("GXS Groups:")) ; oy += celly ; + + for(auto it(groups.begin());it!=groups.end();++it) { - RsPeerDetails detail ; - if(!rsPeers->getPeerDetails(peer_id,detail)) - return tr("Unknown Peer"); + // std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl; + // draw... - return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ; + painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6, \t%7 virtual peers.") + .arg(QString::number(it->second.service_id)) + .arg(getServiceNameString(it->second.service_id)) + .arg(QString::fromStdString(it->first.toStdString())) + .arg(getGroupPolicyString(it->second.group_policy)) + .arg(getGroupStatusString(it->second.group_status)) + .arg(getLastContactString(it->second.last_contact)) + .arg(QString::number(it->second.virtual_peers.size())) + ) ; oy += celly ; } -} - -QString GxsTunnelsDialog::speedString(float f) -{ - if(f < 1.0f) - return QString("0 B/s") ; - if(f < 1024.0f) - return QString::number((int)f)+" B/s" ; - - return QString::number(f/1024.0,'f',2) + " KB/s"; -} - -void GxsTunnelsDialog::paintEvent(QPaintEvent */*event*/) -{ - QStylePainter(this).drawPixmap(0, 0, pixmap); -} - -void GxsTunnelsDialog::resizeEvent(QResizeEvent *event) -{ - QRect TaskGraphRect = geometry(); - - maxWidth = TaskGraphRect.width(); - maxHeight = TaskGraphRect.height() ; - - QWidget::resizeEvent(event); - update(); + + painter.drawText(ox+2*cellx,oy+celly,tr("Virtual peers:")) ; oy += celly ; + + // update the pixmap + // + pixmap = tmppixmap; + maxHeight = std::max(oy,10*celly); } diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.h b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.h index 22bc6dd56..d51e69c68 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.h +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.h @@ -37,29 +37,55 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog } ; -class GxsTunnelsDialog: public RsAutoUpdatePage +class TunnelStatisticsDialog: public RsAutoUpdatePage { Q_OBJECT public: - GxsTunnelsDialog(QWidget *parent = NULL) ; - ~GxsTunnelsDialog(); + TunnelStatisticsDialog(QWidget *parent = NULL) ; + ~TunnelStatisticsDialog(); // Cache for peer names. static QString getPeerName(const RsPeerId &peer_id) ; + static QString getPeerName(const RsGxsId& gxs_id); protected: virtual void paintEvent(QPaintEvent *); virtual void resizeEvent(QResizeEvent *event); + + int maxWidth ; + int maxHeight ; + + QPixmap pixmap; + private: void processSettings(bool bLoad); bool m_bProcessSettings; static QString speedString(float f); - virtual void updateDisplay() ; - - int maxWidth ; - int maxHeight ; - - QPixmap pixmap; + virtual void updateDisplay() =0; +} ; + +class GxsAuthenticatedTunnelsDialog: public TunnelStatisticsDialog +{ + Q_OBJECT + +public: + GxsAuthenticatedTunnelsDialog(QWidget *parent = NULL) ; + ~GxsAuthenticatedTunnelsDialog() {} + +private: + virtual void updateDisplay() ; +} ; + +class GxsNetTunnelsDialog: public TunnelStatisticsDialog +{ + Q_OBJECT + +public: + GxsNetTunnelsDialog(QWidget *parent = NULL) ; + ~GxsNetTunnelsDialog() {} + +private: + virtual void updateDisplay() ; } ; diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp index d3e912bbf..ce983f8b5 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp @@ -195,11 +195,13 @@ TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent) _tunnel_statistics_F->setFrameStyle(QFrame::NoFrame); _tunnel_statistics_F->setFocusPolicy(Qt::NoFocus); - routertabWidget->addTab(new TurtleRouterDialog(),QString(tr("Anonymous tunnels"))); - routertabWidget->addTab(new GxsTunnelsDialog(),QString(tr("Authenticated tunnels"))); + routertabWidget->addTab(new TurtleRouterDialog(), QString(tr("File transfer tunnels"))); + routertabWidget->addTab(new GxsAuthenticatedTunnelsDialog(),QString(tr("Authenticated tunnels"))); + routertabWidget->addTab(new GxsNetTunnelsDialog(), QString(tr("GXS sync tunnels") )); + + float fontHeight = QFontMetricsF(font()).height(); + float fact = fontHeight/14.0; - float fontHeight = QFontMetricsF(font()).height(); - float fact = fontHeight/14.0; frmGraph->setMinimumHeight(200*fact); // load settings From cca986ad75f90aa30f7977ca8f157f00adb94f9e Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Jul 2018 15:07:24 +0200 Subject: [PATCH 115/213] added more info to tunnel display --- .../src/gui/statistics/TurtleRouterDialog.cpp | 56 +++++++++++++++++-- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index f7d10374e..fa849c1a8 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -469,6 +469,23 @@ static QString getServiceNameString(uint16_t service_id) return QString::fromUtf8(ownServices.mServiceList[service_id].mServiceName.c_str()) ; } +static QString getVirtualPeerStatusString(uint8_t status) +{ + switch(status) + { + default: + case RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN : return QObject::tr("Unknown") ; + case RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK : return QObject::tr("Tunnel OK") ; + case RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE : return QObject::tr("Tunnel active") ; + } + return QString(); +} + +static QString getMasterKeyString(uint8_t *key) +{ + return QString(); +} + void GxsNetTunnelsDialog::updateDisplay() { // Request info about ongoing tunnels @@ -523,10 +540,6 @@ void GxsNetTunnelsDialog::updateDisplay() painter.drawText(ox+2*cellx,oy+celly,tr("GXS Groups:")) ; oy += celly ; for(auto it(groups.begin());it!=groups.end();++it) - { - // std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl; - // draw... - painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6, \t%7 virtual peers.") .arg(QString::number(it->second.service_id)) .arg(getServiceNameString(it->second.service_id)) @@ -535,11 +548,42 @@ void GxsNetTunnelsDialog::updateDisplay() .arg(getGroupStatusString(it->second.group_status)) .arg(getLastContactString(it->second.last_contact)) .arg(QString::number(it->second.virtual_peers.size())) - ) ; oy += celly ; - } + ),oy+=celly ; + + oy += celly ; + + // struct RsGxsNetTunnelVirtualPeerInfo: + // + // enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. + // RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id + // RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. + // }; + // + // RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } + // virtual ~RsGxsNetTunnelVirtualPeerInfo(){} + // + // uint8_t vpid_status ; // status of the peer + // time_t last_contact ; // last time some data was sent/recvd + // uint8_t side ; // client/server + // uint8_t encryption_master_key[32]; + // + // RsPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. + // + // RsGxsGroupId group_id ; // group that virtual peer is providing + // uint16_t service_id ; // this is used for checkng consistency of the incoming data painter.drawText(ox+2*cellx,oy+celly,tr("Virtual peers:")) ; oy += celly ; + for(auto it(virtual_peers.begin());it!=virtual_peers.end();++it) + painter.drawText(ox+4*cellx,oy+celly,tr("Peer: %1 - Group ID: %2 (service %3),\t status: %4, \tlast contact: %5, \tside %6 \tMaster key: %7.") + .arg(QString::fromStdString(it->first.toStdString())) + .arg(QString::fromStdString(it->second.group_id.toStdString())) + .arg(getServiceNameString(it->second.service_id)) + .arg(getVirtualPeerStatusString(it->second.vpid_status)) + .arg(getLastContactString(it->second.last_contact)) + .arg(getMasterKeyString(it->second.encryption_master_key)) + ),oy+=celly ; + // update the pixmap // pixmap = tmppixmap; From 820841668e72017212cc12a7631e833b5d3a8b3b Mon Sep 17 00:00:00 2001 From: Phenom Date: Sun, 15 Jul 2018 16:37:33 +0200 Subject: [PATCH 116/213] Change Lobby text to Room in CreateLobbyDialog. --- .../src/gui/chat/CreateLobbyDialog.cpp | 2 +- .../src/gui/chat/CreateLobbyDialog.ui | 125 ++++++------------ .../src/gui/qss/stylesheet/Standard.qss | 2 +- 3 files changed, 44 insertions(+), 85 deletions(-) diff --git a/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp b/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp index a9871ab77..b0e5da106 100644 --- a/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp @@ -106,7 +106,7 @@ void CreateLobbyDialog::checkTextFields() break ; } - RsIdentityDetails(idd) ; + RsIdentityDetails idd; rsIdentity->getIdDetails(id,idd) ; diff --git a/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui b/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui index 1d2340e08..77aab56ea 100644 --- a/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui +++ b/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui @@ -11,17 +11,26 @@
- Create Chat Lobby + Create Chat Room :/images/logo/logo_32.png:/images/logo/logo_32.png - + 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -29,11 +38,11 @@ - + - A chat lobby is a decentralized and anonymous chat group. All participants receive all messages. Once the lobby is created you can invite other friends from the Friends tab. + A chat room is a decentralized and anonymous chat group. All participants receive all messages. Once the room is created you can invite other friend nodes with invite button on top right. true @@ -41,16 +50,16 @@ - + - - + + - + - + - Lobby name: + Room name: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -61,9 +70,9 @@ - + - Lobby topic: + Room topic: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -74,7 +83,7 @@ - + Identity to use: @@ -84,7 +93,7 @@ - + Visibility: @@ -113,7 +122,7 @@ - <html><head/><body><p>If you check this, only PGP-signed ids can be used to join and talk in this lobby. This limitation prevents anonymous spamming as it becomes possible for at least some people in the lobby to locate the spammer's node.</p></body></html> + <html><head/><body><p>If you check this, only PGP-signed ids can be used to join and talk in this room. This limitation prevents anonymous spamming as it becomes possible for at least some people in the room to locate the spammer's node.</p></body></html> require PGP-signed identities @@ -121,7 +130,7 @@ - + Qt::LeftToRight @@ -136,7 +145,7 @@ - + Qt::Vertical @@ -152,34 +161,37 @@ - + - + Select the Friends with which you want to group chat. - - - true - + - + 0 - 0 + 4 + + + 20 + 0 + + - 52487 - 524287 + 1677215 + 16777215 - 220 + 0 0 @@ -189,59 +201,6 @@ 0 - - false - - - QDockWidget::NoDockWidgetFeatures - - - Invited friends - - - - - 0 - - - 0 - - - - - - 0 - 4 - - - - - 20 - 0 - - - - - 1677215 - 16777215 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - -
@@ -249,7 +208,7 @@ - + QLayout::SetDefaultConstraint diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index 7d518d4c2..2996d4ee5 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -186,7 +186,7 @@ ChatLobbyDialog QListWidget#participantsList { background: white; } -CreateLobbyDialog QFrame#lobbyFrame { +CreateLobbyDialog QFrame#roomFrame { border: 2px solid #CCCCCC; border-radius:6px; background: white; From aaea97d06f133639b2adbb84e1b2f751698f566b Mon Sep 17 00:00:00 2001 From: Phenom Date: Sun, 15 Jul 2018 16:53:52 +0200 Subject: [PATCH 117/213] Remove unneeded Search: text in FriendSelectionWidget.ui --- .../src/gui/common/FriendSelectionWidget.ui | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/retroshare-gui/src/gui/common/FriendSelectionWidget.ui b/retroshare-gui/src/gui/common/FriendSelectionWidget.ui index 23d98c9b6..d3682f014 100644 --- a/retroshare-gui/src/gui/common/FriendSelectionWidget.ui +++ b/retroshare-gui/src/gui/common/FriendSelectionWidget.ui @@ -10,19 +10,21 @@ 320 - - + + + 0 + + + 0 + + + 0 + + 0 - - - Search : - - - - - + From 1de31493a9ea5823d8c990cdda85b217ea00ee40 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Jul 2018 19:09:12 +0200 Subject: [PATCH 118/213] fixed up display of GXS net tunnel info --- libretroshare/src/gxs/rsgxsnettunnel.cc | 3 +- libretroshare/src/gxs/rsgxsnettunnel.h | 1 + libretroshare/src/retroshare/rsgxsdistsync.h | 92 +++++++++++++++++ libretroshare/src/retroshare/rsturtle.h | 1 + .../src/gui/statistics/TurtleRouterDialog.cpp | 98 ++++++++++++------- 5 files changed, 156 insertions(+), 39 deletions(-) create mode 100644 libretroshare/src/retroshare/rsgxsdistsync.h diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 85fcec2d8..1e04c6621 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -1147,10 +1147,11 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id GXS_NET_TUNNEL_ERROR() << ": deserialized item is of unknown type. Dropping!" << std::endl; } -void RsGxsNetTunnelService::getStatistics( std::map& groups,std::map& virtual_peers,Bias20Bytes& bias ) const +void RsGxsNetTunnelService::getStatistics(std::map& groups, std::map& virtual_peers, std::map &turtle_vpid_to_net_tunnel_vpid, Bias20Bytes& bias ) const { groups = mGroups ; virtual_peers = mVirtualPeers ; + turtle_vpid_to_net_tunnel_vpid = mTurtle2GxsPeer; bias = mRandomBias ; } diff --git a/libretroshare/src/gxs/rsgxsnettunnel.h b/libretroshare/src/gxs/rsgxsnettunnel.h index 53cd42b96..cbac109a9 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.h +++ b/libretroshare/src/gxs/rsgxsnettunnel.h @@ -213,6 +213,7 @@ public: void getStatistics(std::map& groups, // groups on the client and server side std::map& virtual_peers, // current virtual peers, which group they provide, and how to talk to them through turtle + std::map& turtle_vpid_to_net_tunnel_vpid, Bias20Bytes& bias) const; protected: diff --git a/libretroshare/src/retroshare/rsgxsdistsync.h b/libretroshare/src/retroshare/rsgxsdistsync.h new file mode 100644 index 000000000..df597f03a --- /dev/null +++ b/libretroshare/src/retroshare/rsgxsdistsync.h @@ -0,0 +1,92 @@ +/* + * RetroShare C++ Interface. + * + * Copyright 2018 by Cyril Soler + * + * 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". + * + */ + +#pragma once + +#include "retroshare/rsfiles.h" +#include "retroshare/rsturtle.h" + +typedef RsPeerId RsGxsNetTunnelVirtualPeerId ; + +struct RsGxsNetTunnelVirtualPeerInfo +{ + enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. + RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id + RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. + }; + + RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } + virtual ~RsGxsNetTunnelVirtualPeerInfo(){} + + uint8_t vpid_status ; // status of the peer + time_t last_contact ; // last time some data was sent/recvd + uint8_t side ; // client/server + uint8_t encryption_master_key[32]; + + TurtleVirtualPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. + + RsGxsGroupId group_id ; // group that virtual peer is providing + uint16_t service_id ; // this is used for checkng consistency of the incoming data +}; + +struct RsGxsNetTunnelGroupInfo +{ + enum GroupStatus { + RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status + RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting + RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available. Data can be read/written + }; + + enum GroupPolicy { + RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set + RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels + RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will only explicitely request tunnels if none available + RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING = 0x03, // group explicitely requests tunnels + }; + + RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {} + + GroupPolicy group_policy ; + GroupStatus group_status ; + time_t last_contact ; + RsFileHash hash ; + uint16_t service_id ; + + std::set virtual_peers ; // list of which virtual peers provide this group. Can me more than 1. +}; + +// This class is here to provide statistics about GXS dist sync internals. It +// +class RsGxsDistSync +{ + public: + virtual void getStatistics( + std::map& groups, // groups on the client and server side + std::map& virtual_peers, // current virtual peers, which group they provide, and how to talk to them through turtle + std::map& turtle_vpid_to_net_tunnel_vpid, + Bias20Bytes& bias + ) const =0; +}; + +extern RsGxsDistSync *rsGxsDistSync ; + diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 1b3cb1b7e..4130a9bea 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -44,6 +44,7 @@ class RsTurtle; extern RsTurtle *rsTurtle ; typedef uint32_t TurtleRequestId ; +typedef RsPeerId TurtleVirtualPeerId; // This is the structure used to send back results of the turtle search // to the notifyBase class, or send info to the GUI. diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index fa849c1a8..bbabb8fd6 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -481,9 +482,14 @@ static QString getVirtualPeerStatusString(uint8_t status) return QString(); } +static QString getSideString(uint8_t side) +{ + return side?QObject::tr("Client"):QObject::tr("Server") ; +} + static QString getMasterKeyString(uint8_t *key) { - return QString(); + return QString::fromStdString(RsUtil::BinToHex(key,10)); } void GxsNetTunnelsDialog::updateDisplay() @@ -491,10 +497,11 @@ void GxsNetTunnelsDialog::updateDisplay() // Request info about ongoing tunnels std::map groups; // groups on the client and server side + std::map turtle2gxsnettunnel; // convertion table from turtle to net tunnel virtual peer id std::map virtual_peers; // current virtual peers, which group they provide, and how to talk to them through turtle Bias20Bytes bias; - rsGxsDistSync->getStatistics(groups,virtual_peers,bias) ; + rsGxsDistSync->getStatistics(groups,virtual_peers,turtle2gxsnettunnel,bias) ; // RsGxsNetTunnelGroupInfo: // @@ -518,6 +525,29 @@ void GxsNetTunnelsDialog::updateDisplay() // RsFileHash hash ; // uint16_t service_id ; // std::set virtual_peers ; + // + // struct RsGxsNetTunnelVirtualPeerInfo: + // + // enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. + // RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id + // RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. + // }; + // + // RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } + // virtual ~RsGxsNetTunnelVirtualPeerInfo(){} + // + // uint8_t vpid_status ; // status of the peer + // time_t last_contact ; // last time some data was sent/recvd + // uint8_t side ; // client/server + // uint8_t encryption_master_key[32]; + // + // RsPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. + // + // RsGxsGroupId group_id ; // group that virtual peer is providing + // uint16_t service_id ; // this is used for checkng consistency of the incoming data + + // update the pixmap + // // now draw the shit QPixmap tmppixmap(maxWidth, maxHeight); @@ -540,52 +570,44 @@ void GxsNetTunnelsDialog::updateDisplay() painter.drawText(ox+2*cellx,oy+celly,tr("GXS Groups:")) ; oy += celly ; for(auto it(groups.begin());it!=groups.end();++it) - painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6, \t%7 virtual peers.") + { + painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6") .arg(QString::number(it->second.service_id)) .arg(getServiceNameString(it->second.service_id)) .arg(QString::fromStdString(it->first.toStdString())) .arg(getGroupPolicyString(it->second.group_policy)) .arg(getGroupStatusString(it->second.group_status)) .arg(getLastContactString(it->second.last_contact)) - .arg(QString::number(it->second.virtual_peers.size())) ),oy+=celly ; + + for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2) + { + auto it4 = turtle2gxsnettunnel.find(*it2) ; + + if(it4 != turtle2gxsnettunnel.end()) + { + auto it3 = virtual_peers.find(it4->second) ; + + if(virtual_peers.end() != it3) + painter.drawText(ox+6*cellx,oy+celly,tr("Peer: %1:\tstatus: %2/%3, \tlast contact: %4, \tMaster key: %5.") + .arg(QString::fromStdString((*it2).toStdString())) + .arg(getVirtualPeerStatusString(it3->second.vpid_status)) + .arg(getSideString(it3->second.side)) + .arg(getLastContactString(it3->second.last_contact)) + .arg(getMasterKeyString(it3->second.encryption_master_key)) + ),oy+=celly ; + } + else + painter.drawText(ox+6*cellx,oy+celly,tr("Peer: %1: no information available") + .arg(QString::fromStdString((*it2).toStdString())) + ),oy+=celly; + + } + } + oy += celly ; - // struct RsGxsNetTunnelVirtualPeerInfo: - // - // enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status. - // RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id - // RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer. - // }; - // - // RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; } - // virtual ~RsGxsNetTunnelVirtualPeerInfo(){} - // - // uint8_t vpid_status ; // status of the peer - // time_t last_contact ; // last time some data was sent/recvd - // uint8_t side ; // client/server - // uint8_t encryption_master_key[32]; - // - // RsPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid. - // - // RsGxsGroupId group_id ; // group that virtual peer is providing - // uint16_t service_id ; // this is used for checkng consistency of the incoming data - - painter.drawText(ox+2*cellx,oy+celly,tr("Virtual peers:")) ; oy += celly ; - - for(auto it(virtual_peers.begin());it!=virtual_peers.end();++it) - painter.drawText(ox+4*cellx,oy+celly,tr("Peer: %1 - Group ID: %2 (service %3),\t status: %4, \tlast contact: %5, \tside %6 \tMaster key: %7.") - .arg(QString::fromStdString(it->first.toStdString())) - .arg(QString::fromStdString(it->second.group_id.toStdString())) - .arg(getServiceNameString(it->second.service_id)) - .arg(getVirtualPeerStatusString(it->second.vpid_status)) - .arg(getLastContactString(it->second.last_contact)) - .arg(getMasterKeyString(it->second.encryption_master_key)) - ),oy+=celly ; - - // update the pixmap - // pixmap = tmppixmap; maxHeight = std::max(oy,10*celly); } From a52c94d23c0f061c4a6f746a59fc8fc7d78dc8ef Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Jul 2018 19:15:05 +0200 Subject: [PATCH 119/213] improved display of encryption master key --- retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index bbabb8fd6..c8f34c8b9 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -489,7 +489,7 @@ static QString getSideString(uint8_t side) static QString getMasterKeyString(uint8_t *key) { - return QString::fromStdString(RsUtil::BinToHex(key,10)); + return QString::fromStdString(RsUtil::BinToHex(key,32,10)); } void GxsNetTunnelsDialog::updateDisplay() From 55e99ef0d1f9b292ffb0c75816c8b2480c14a9dd Mon Sep 17 00:00:00 2001 From: sehraf Date: Mon, 16 Jul 2018 23:22:04 +0200 Subject: [PATCH 120/213] add auto detection of installed rapidjson --- libretroshare/src/serialiser/rsserializer.h | 4 ++++ libretroshare/src/serialiser/rstypeserializer.cc | 5 ++++- libretroshare/src/serialiser/rstypeserializer.h | 4 ++++ libretroshare/src/use_libretroshare.pri | 10 +++++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/serialiser/rsserializer.h b/libretroshare/src/serialiser/rsserializer.h index 35dc091c3..6bde6930c 100644 --- a/libretroshare/src/serialiser/rsserializer.h +++ b/libretroshare/src/serialiser/rsserializer.h @@ -154,7 +154,11 @@ #include #include #include +#ifdef HAS_RAPIDJSON +#include +#else #include +#endif // HAS_RAPIDJSON #include "retroshare/rsflags.h" #include "serialiser/rsserial.h" diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index 72d20ecc2..79a3eaab0 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -36,8 +36,11 @@ #include #include // for typeid -#include +#ifdef HAS_RAPIDJSON +#include +#else #include +#endif // HAS_RAPIDJSON //static const uint32_t MAX_SERIALIZED_ARRAY_SIZE = 500 ; static const uint32_t MAX_SERIALIZED_CHUNK_SIZE = 10*1024*1024 ; // 10 MB. diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index 3e3c0b251..e91aa0c45 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -35,7 +35,11 @@ #include "serialiser/rsserializer.h" #include "serialiser/rsserializable.h" +#ifdef HAS_RAPIDJSON +#include +#else #include +#endif // HAS_RAPIDJSON #include // for typeid #include #include diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index 3a3d1acb7..7c5af09b7 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -16,7 +16,15 @@ bitdht { # when rapidjson is mainstream on all distribs, we will not need the sources # anymore in the meantime, they are part of the RS directory so that it is # always possible to find them -INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../rapidjson-1.1.0)) +RAPIDJSON_AVAILABLE = $$system(pkg-config --atleast-version 1.1 RapidJSON && echo yes) +isEmpty(RAPIDJSON_AVAILABLE) { + message("using built-in rapidjson") + INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../rapidjson-1.1.0)) +} else { + message("using systems rapidjson") + DEFINES *= HAS_RAPIDJSON +} + sLibs = mLibs = $$RS_SQL_LIB ssl crypto $$RS_THREAD_LIB $$RS_UPNP_LIB From b9436fbef27c941a0818f53280b5e765d0f5aa09 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 17 Jul 2018 10:08:39 +0200 Subject: [PATCH 121/213] fixed leading zeroes problem in title bar --- retroshare-gui/src/rshare.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/rshare.cpp b/retroshare-gui/src/rshare.cpp index ff6038de0..a87ad358f 100644 --- a/retroshare-gui/src/rshare.cpp +++ b/retroshare-gui/src/rshare.cpp @@ -360,7 +360,7 @@ QString Rshare::retroshareVersion(bool withRevision) { QString version = QString("%1.%2.%3%4").arg(RS_MAJOR_VERSION).arg(RS_MINOR_VERSION).arg(RS_BUILD_NUMBER).arg(RS_BUILD_NUMBER_ADD); if (withRevision) { - version += QString(" %1 %2").arg(tr("Revision")).arg(QString::number(RS_REVISION_NUMBER,16)); + version += QString(" %1 %2").arg(tr("Revision")).arg(RS_REVISION_NUMBER,8,16,QChar('0')); } return version; From 9b0a4b966e2d90bb563bd97ead25edec4b873d33 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 18 Jul 2018 21:20:51 +0200 Subject: [PATCH 122/213] removed extra call to loadConfiguration() --- libretroshare/src/rsserver/rsinit.cc | 41 +++++++++++++--------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 877c45488..ba84eda17 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1631,46 +1631,43 @@ int RsServer::StartupRetroShare() //mConfigMgr->addConfiguration("ftserver.cfg", ftserver); // - mConfigMgr->addConfiguration("gpg_prefs.cfg", AuthGPG::getAuthGPG()); + mConfigMgr->addConfiguration("gpg_prefs.cfg" , AuthGPG::getAuthGPG()); mConfigMgr->addConfiguration("gxsnettunnel.cfg", mGxsNetTunnel); - mConfigMgr->loadConfiguration(); - - mConfigMgr->addConfiguration("peers.cfg", mPeerMgr); - mConfigMgr->addConfiguration("general.cfg", mGeneralConfig); - mConfigMgr->addConfiguration("msgs.cfg", msgSrv); - mConfigMgr->addConfiguration("chat.cfg", chatSrv); - mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr); - mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv); - mConfigMgr->addConfiguration("turtle.cfg", tr); + mConfigMgr->addConfiguration("peers.cfg" , mPeerMgr); + mConfigMgr->addConfiguration("general.cfg" , mGeneralConfig); + mConfigMgr->addConfiguration("msgs.cfg" , msgSrv); + mConfigMgr->addConfiguration("chat.cfg" , chatSrv); + mConfigMgr->addConfiguration("p3History.cfg" , mHistoryMgr); + mConfigMgr->addConfiguration("p3Status.cfg" , mStatusSrv); + mConfigMgr->addConfiguration("turtle.cfg" , tr); #ifndef RETROTOR - mConfigMgr->addConfiguration("banlist.cfg", mBanList); + mConfigMgr->addConfiguration("banlist.cfg" , mBanList); #endif mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl); - mConfigMgr->addConfiguration("reputations.cfg", mReputations); + mConfigMgr->addConfiguration("reputations.cfg" , mReputations); #ifdef ENABLE_GROUTER - mConfigMgr->addConfiguration("grouter.cfg", gr); + mConfigMgr->addConfiguration("grouter.cfg" , gr); #endif #ifdef RS_USE_BITDHT - mConfigMgr->addConfiguration("bitdht.cfg", mBitDht); + mConfigMgr->addConfiguration("bitdht.cfg" , mBitDht); #endif #ifdef RS_ENABLE_GXS # ifdef RS_GXS_TRANS mConfigMgr->addConfiguration("gxs_trans_ns.cfg", gxstrans_ns); - mConfigMgr->addConfiguration("gxs_trans.cfg", mGxsTrans); + mConfigMgr->addConfiguration("gxs_trans.cfg" , mGxsTrans); # endif // RS_GXS_TRANS - mConfigMgr->addConfiguration("p3identity.cfg", mGxsIdService); - - mConfigMgr->addConfiguration("identity.cfg", gxsid_ns); - mConfigMgr->addConfiguration("gxsforums.cfg", gxsforums_ns); + mConfigMgr->addConfiguration("p3identity.cfg" , mGxsIdService); + mConfigMgr->addConfiguration("identity.cfg" , gxsid_ns); + mConfigMgr->addConfiguration("gxsforums.cfg" , gxsforums_ns); mConfigMgr->addConfiguration("gxsforums_srv.cfg", mGxsForums); - mConfigMgr->addConfiguration("gxschannels.cfg", gxschannels_ns); + mConfigMgr->addConfiguration("gxschannels.cfg" , gxschannels_ns); mConfigMgr->addConfiguration("gxschannels_srv.cfg", mGxsChannels); - mConfigMgr->addConfiguration("gxscircles.cfg", gxscircles_ns); - mConfigMgr->addConfiguration("posted.cfg", posted_ns); + mConfigMgr->addConfiguration("gxscircles.cfg" , gxscircles_ns); + mConfigMgr->addConfiguration("posted.cfg" , posted_ns); #ifdef RS_USE_WIKI mConfigMgr->addConfiguration("wiki.cfg", wiki_ns); #endif From dac885e24dc7172aae1071c7d45c5e4b541def1d Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 18 Jul 2018 21:22:38 +0200 Subject: [PATCH 123/213] made randomBias initilized with true random bytes at start --- libretroshare/src/gxs/rsgxsnettunnel.cc | 16 +++++++--------- libretroshare/src/pqi/p3cfgmgr.cc | 6 +++--- retroshare-gui/src/gui/common/GroupTreeWidget.ui | 6 +++++- .../src/gui/gxs/GxsGroupFrameDialog.ui | 13 +++++++++++-- .../src/gui/statistics/TurtleRouterDialog.cpp | 7 ++++--- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index 1e04c6621..a35026a74 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -30,7 +30,7 @@ #include "gxs/rsnxs.h" #include "rsgxsnettunnel.h" -//#define DEBUG_RSGXSNETTUNNEL 1 +#define DEBUG_RSGXSNETTUNNEL 1 #define GXS_NET_TUNNEL_NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } #define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL: " << __FUNCTION__ << " : " @@ -43,7 +43,6 @@ RsGxsDistSync *rsGxsDistSync = NULL; RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { -#warning this is for testing only. In the final version this needs to be initialized with some random content, saved and re-used for a while (e.g. 1 month) mRandomBias.clear(); mLastKeepAlive = time(NULL) + (lrand48()%20); // adds some variance in order to avoid doing all this tasks at once across services @@ -779,14 +778,10 @@ const Bias20Bytes& RsGxsNetTunnelService::locked_randomBias() { if(mRandomBias.isNull()) { -#ifdef DEBUG_RSGXSNETTUNNEL -#warning /!\ this is for testing only! Remove this when done! Can not be done at initialization when rsPeer is not started. - RsPeerId ssl_id = rsPeers->getOwnId() ; - mRandomBias = Bias20Bytes(RsDirUtil::sha1sum(ssl_id.toByteArray(),ssl_id.SIZE_IN_BYTES)) ; -#else mRandomBias = Bias20Bytes::random(); -#endif IndicateConfigChanged(); + + std::cerr << "Initialized RsGxsNetTunnel random bias to " << RsUtil::BinToHex(mRandomBias.toByteArray(),mRandomBias.SIZE_IN_BYTES) << std::endl; } return mRandomBias ; @@ -796,7 +791,7 @@ RsGxsNetTunnelVirtualPeerId RsGxsNetTunnelService::locked_makeVirtualPeerId(cons { assert(RsPeerId::SIZE_IN_BYTES <= Sha1CheckSum::SIZE_IN_BYTES) ;// so that we can build the virtual PeerId from a SHA1 sum. - // We compute sha1( SSL_id | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId + // We compute sha1( GroupId | mRandomBias ) and trunk it to 16 bytes in order to compute a RsPeerId Bias20Bytes rb(locked_randomBias()); @@ -934,6 +929,7 @@ bool RsGxsNetTunnelService::saveList(bool& cleanup, std::list& save) { RS_STACK_MUTEX(mGxsNetTunnelMtx); it2->mRandomBias = mRandomBias; + std::cerr << "Saving RsGxsNetTunnel random bias to disc" << std::endl; } save.push_back(it2) ; @@ -952,6 +948,8 @@ bool RsGxsNetTunnelService::loadList(std::list &load) { RS_STACK_MUTEX(mGxsNetTunnelMtx); mRandomBias = rbsi->mRandomBias; + + std::cerr << "Loaded RsGxsNetTunnel random bias from disc: " << RsUtil::BinToHex(mRandomBias.toByteArray(),mRandomBias.SIZE_IN_BYTES) << std::endl; } else GXS_NET_TUNNEL_ERROR() << " unknown item in config file: type=" << std::hex << (*it)->PacketId() << std::dec << std::endl; diff --git a/libretroshare/src/pqi/p3cfgmgr.cc b/libretroshare/src/pqi/p3cfgmgr.cc index 3266f68d4..97d8165a3 100644 --- a/libretroshare/src/pqi/p3cfgmgr.cc +++ b/libretroshare/src/pqi/p3cfgmgr.cc @@ -65,7 +65,7 @@ void p3ConfigMgr::tick() #ifdef CONFIG_DEBUG std::cerr << "p3ConfigMgr::tick() Config Changed - Element: "; - std::cerr << it->first; + std::cerr << *it; std::cerr << std::endl; #endif @@ -111,7 +111,7 @@ void p3ConfigMgr::saveConfig() { #ifdef CONFIG_DEBUG std::cerr << "p3ConfigMgr::globalSaveConfig() Saving Element: "; - std::cerr << it->first; + std::cerr << *it; std::cerr << std::endl; #endif ok &= (*it)->saveConfiguration(); @@ -137,7 +137,7 @@ void p3ConfigMgr::loadConfig() { #ifdef CONFIG_DEBUG std::cerr << "p3ConfigMgr::loadConfig() Element: "; - std::cerr << cit->first <<"Dummy Hash: " << dummyHash; + std::cerr << *cit <<" Dummy Hash: " << dummyHash; std::cerr << std::endl; #endif diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.ui b/retroshare-gui/src/gui/common/GroupTreeWidget.ui index 7591c6a1c..26167dcd7 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.ui +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.ui @@ -125,7 +125,11 @@ - + + + <html><head/><body><p>Searches a single keyword into the reachable network.</p><p>Objects already provided by friend nodes are not reported.</p></body></html> + + diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui index 274207b5c..7431deb97 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.ui @@ -7,7 +7,7 @@ 0 0 619 - 420 + 493 @@ -38,7 +38,16 @@ QFrame::Sunken - + + 2 + + + 2 + + + 2 + + 2 diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index c8f34c8b9..b81264e77 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -487,9 +487,9 @@ static QString getSideString(uint8_t side) return side?QObject::tr("Client"):QObject::tr("Server") ; } -static QString getMasterKeyString(uint8_t *key) +static QString getMasterKeyString(const uint8_t *key,uint32_t size) { - return QString::fromStdString(RsUtil::BinToHex(key,32,10)); + return QString::fromStdString(RsUtil::BinToHex(key,size,10)); } void GxsNetTunnelsDialog::updateDisplay() @@ -567,6 +567,7 @@ void GxsNetTunnelsDialog::updateDisplay() int ox=5*fact,oy=5*fact ; painter.setPen(QColor::fromRgb(0,0,0)) ; + painter.drawText(ox+2*cellx,oy+celly,tr("Random Bias: %1").arg(getMasterKeyString(bias.toByteArray(),20))) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("GXS Groups:")) ; oy += celly ; for(auto it(groups.begin());it!=groups.end();++it) @@ -595,7 +596,7 @@ void GxsNetTunnelsDialog::updateDisplay() .arg(getVirtualPeerStatusString(it3->second.vpid_status)) .arg(getSideString(it3->second.side)) .arg(getLastContactString(it3->second.last_contact)) - .arg(getMasterKeyString(it3->second.encryption_master_key)) + .arg(getMasterKeyString(it3->second.encryption_master_key,32)) ),oy+=celly ; } else From d4fce07e4c2d375ac65415fcb6c1b0450e1b5b62 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 19 Jul 2018 23:46:31 +0200 Subject: [PATCH 124/213] changed lrand48 to RSRandom for cross-plateform compatibility, in rsgxsnettunnel.cc --- libretroshare/src/gxs/rsgxsnettunnel.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index a35026a74..ff3134493 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -45,9 +45,9 @@ RsGxsNetTunnelService::RsGxsNetTunnelService(): mGxsNetTunnelMtx("GxsNetTunnel") { mRandomBias.clear(); - mLastKeepAlive = time(NULL) + (lrand48()%20); // adds some variance in order to avoid doing all this tasks at once across services - mLastAutoWash = time(NULL) + (lrand48()%20); - mLastDump = time(NULL) + (lrand48()%20); + mLastKeepAlive = time(NULL) + (RSRandom::random_u32()%20); // adds some variance in order to avoid doing all this tasks at once across services + mLastAutoWash = time(NULL) + (RSRandom::random_u32()%20); + mLastDump = time(NULL) + (RSRandom::random_u32()%20); } //===========================================================================================================================================// From 3fc9ff3fef95cbca2fab51967280b704d5c8aec8 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 20 Jul 2018 15:29:37 +0200 Subject: [PATCH 125/213] WIP Plug deep search into GXS search --- libretroshare/src/gxs/rsgxsnetservice.cc | 53 ++++++++++++++++++++--- libretroshare/src/retroshare/rsgxsiface.h | 5 ++- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index d8a882945..6818caae6 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -260,6 +260,10 @@ #include "util/rsmemory.h" #include "util/stacktrace.h" +#ifdef RS_DEEP_SEARCH +# include "deep_search/deep_search.h" +#endif + /*** * Use the following defines to debug: NXS_NET_DEBUG_0 shows group update high level information @@ -5271,16 +5275,52 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req,const unsig mObserver->receiveNewGroups(new_grps); } -bool RsGxsNetService::search(const std::string& substring,std::list& group_infos) +bool RsGxsNetService::search( const std::string& substring, + std::list& group_infos ) { + group_infos.clear(); + RsGxsGrpMetaTemporaryMap grpMetaMap; - { + { RS_STACK_MUTEX(mNxsMutex) ; mDataStore->retrieveGxsGrpMetaData(grpMetaMap); - } + } +#ifdef RS_DEEP_SEARCH + std::vector results; + DeepSearch::search(substring, results, 0); + + for(auto dsr : results) + { + RsUrl rUrl(dsr.mUrl); + auto rit = rUrl.query().find("id"); + if(rit != rUrl.query().end()) + { + RsGroupNetworkStats stats; + RsGxsGroupId grpId(rit->second); + RsGxsGrpMetaTemporaryMap::iterator mIt; + if( !grpId.isNull() && + (mIt = grpMetaMap.find(grpId)) != grpMetaMap.end() && + getGroupNetworkStats(grpId, stats) ) + { + RsGxsGrpMetaData& gMeta(*mIt->second); + RsGxsGroupSummary s; + s.group_id = grpId; + s.group_name = gMeta.mGroupName; + s.search_context = dsr.mSnippet; + s.sign_flags = gMeta.mSignFlags; + s.publish_ts = gMeta.mSignFlags; + s.author_id = gMeta.mAuthorId; + s.number_of_messages = stats.mMaxVisibleCount; + s.last_message_ts = stats.mLastGroupModificationTS; + s.popularity = gMeta.mPop; + + group_infos.push_back(s); + } + } + } +#else // RS_DEEP_SEARCH RsGroupNetworkStats stats ; - for(auto it(grpMetaMap.begin());it!=grpMetaMap.end();++it) if(termSearch(it->second->mGroupName,substring)) { @@ -5289,7 +5329,7 @@ bool RsGxsNetService::search(const std::string& substring,std::listfirst ; s.group_name = it->second->mGroupName ; - s.group_description = it->second->mGroupName ; // to be filled with something better when we use the real search + // to be filled with something better when we use the real search s.search_context = it->second->mGroupName ; s.sign_flags = it->second->mSignFlags; s.publish_ts = it->second->mPublishTs; @@ -5298,8 +5338,9 @@ bool RsGxsNetService::search(const std::string& substring,std::listsecond->mPop; - group_infos.push_back(s) ; + group_infos.push_back(s); } +#endif // RS_DEEP_SEARCH #ifdef NXS_NET_DEBUG_8 GXSNETDEBUG___ << " performing local substring search in response to distant request. Found " << group_infos.size() << " responses." << std::endl; diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index bdf65c115..7ccedff36 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -31,6 +31,7 @@ #include "retroshare/rsgxsservice.h" #include "gxs/rsgxsdata.h" #include "retroshare/rsgxsifacetypes.h" +#include "util/rsdeprecate.h" /*! * \brief The RsGxsGroupSymmary struct @@ -44,8 +45,8 @@ struct RsGxsGroupSummary RsGxsGroupId group_id ; - std::string group_name ; - std::string group_description ; + std::string group_name ; + RS_DEPRECATED std::string group_description; std::string search_context ; RsGxsId author_id ; time_t publish_ts ; From 8149ef9e45fe421df333faf976f4587d48f4245e Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 21 Jul 2018 01:17:28 +0200 Subject: [PATCH 126/213] Install xapian dependency in Continuos Integration --- .travis.yml | 4 ++-- appveyor.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ecc0dab7..e11da2148 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,10 +13,10 @@ matrix: before_install: - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update; fi - - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential libssl-dev libsqlcipher-dev libbz2-dev libmicrohttpd-dev libsqlite3-dev libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev libqt5x11extras5-dev libqt5designer5 qttools5-dev; fi + - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential libssl-dev libsqlcipher-dev libbz2-dev libmicrohttpd-dev libsqlite3-dev libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev libqt5x11extras5-dev libqt5designer5 libxapian-dev qttools5-dev; fi - if [ $TRAVIS_OS_NAME == osx ]; then brew update ; fi - - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd sqlcipher; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd sqlcipher xapian; fi - if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt55 ; fi - wget https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz diff --git a/appveyor.yml b/appveyor.yml index 6f26a1c67..8764ef0f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -88,7 +88,7 @@ install: # Configuring MSys2 - set PATH=C:\msys64\usr\bin;%PATH% - set PATH=C:\msys64\mingw32\bin;%PATH% - - pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd + - pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd mingw-w64-xapian-core #- pacman --noconfirm -S mingw-w64-i686-qt5-static mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd #- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH% From 6982ae6cd5be55ab79135f6bfa1adc88f9f621e2 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 21 Jul 2018 13:20:50 +0200 Subject: [PATCH 127/213] Improve retrocompatibility with older xapian --- libretroshare/src/deep_search/deep_search.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 7152e34ce..368aa7e84 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -25,6 +25,13 @@ #include "retroshare/rsinit.h" #include "util/rsurl.h" +#ifndef XAPIAN_AT_LEAST +#define XAPIAN_AT_LEAST(A,B,C) (XAPIAN_MAJOR_VERSION > (A) || \ + (XAPIAN_MAJOR_VERSION == (A) && \ + (XAPIAN_MINOR_VERSION > (B) || \ + (XAPIAN_MINOR_VERSION == (B) && XAPIAN_REVISION >= (C))))) +#endif // ndef XAPIAN_AT_LEAST + struct DeepSearch { struct SearchResult @@ -66,10 +73,11 @@ struct DeepSearch for ( Xapian::MSetIterator m = mset.begin(); m != mset.end(); ++m ) { const Xapian::Document& doc = m.get_document(); - SearchResult s; s.mUrl = doc.get_value(URL_VALUENO); +#if XAPIAN_AT_LEAST(1,3,5) s.mSnippet = mset.snippet(doc.get_data()); +#endif // XAPIAN_AT_LEAST(1,3,5) results.push_back(s); } From 2ab12a2ef57a59fb603cb6ff2f3be03443ef97c2 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 22 Jul 2018 00:21:45 +0200 Subject: [PATCH 128/213] fixed deadlock due to turtle calling addVirtualPeer for client services inside a mutex protected zone (breaks mutex order service > turtle) --- libretroshare/src/turtle/p3turtle.cc | 49 +++++++++++++++------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 0db63a7df..9366d5b34 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1611,8 +1611,6 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) } { - RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ - if(found) { #ifdef P3TURTLE_DEBUG @@ -1621,37 +1619,44 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) // Send back tunnel ok to the same guy // RsTurtleTunnelOkItem *res_item = new RsTurtleTunnelOkItem ; + TurtleVirtualPeerId vpid ; res_item->request_id = item->request_id ; - res_item->tunnel_id = item->partial_tunnel_id ^ generatePersonalFilePrint(item->file_hash,_random_bias,false) ; - res_item->PeerId(item->PeerId()) ; + { + RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ + res_item->tunnel_id = item->partial_tunnel_id ^ generatePersonalFilePrint(item->file_hash,_random_bias,false) ; - TurtleTunnelId t_id = res_item->tunnel_id ; // save it because sendItem deletes the item + res_item->PeerId(item->PeerId()) ; - sendItem(res_item) ; + TurtleTunnelId t_id = res_item->tunnel_id ; // save it because sendItem deletes the item - // Note in the tunnels list that we have an ending tunnel here. - TurtleTunnel tt ; - tt.local_src = item->PeerId() ; - tt.hash = item->file_hash ; - tt.local_dst = _own_id ; // this means us - tt.time_stamp = time(NULL) ; - tt.transfered_bytes = 0 ; - tt.speed_Bps = 0.0f ; + sendItem(res_item) ; - _local_tunnels[t_id] = tt ; + // Note in the tunnels list that we have an ending tunnel here. + TurtleTunnel tt ; + tt.local_src = item->PeerId() ; + tt.hash = item->file_hash ; + tt.local_dst = _own_id ; // this means us + tt.time_stamp = time(NULL) ; + tt.transfered_bytes = 0 ; + tt.speed_Bps = 0.0f ; - // We add a virtual peer for that tunnel+hash combination. - // - locked_addDistantPeer(item->file_hash,t_id) ; + _local_tunnels[t_id] = tt ; - // Store some info string about the tunnel. - // - _outgoing_tunnel_client_services[t_id] = service ; + // We add a virtual peer for that tunnel+hash combination. + // + locked_addDistantPeer(item->file_hash,t_id) ; + + // Store some info string about the tunnel. + // + _outgoing_tunnel_client_services[t_id] = service ; + + vpid = _local_tunnels[t_id].vpid; + } // Notify the client service that there's a new virtual peer id available as a client. // - service->addVirtualPeer(item->file_hash,_local_tunnels[t_id].vpid,RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ; + service->addVirtualPeer(item->file_hash,vpid,RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ; // We return straight, because when something is found, there's no need to digg a tunnel further. // From d03ee1c0b08872312d6ff3bb712e73c55290e4d1 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 19 Aug 2017 19:18:58 +0200 Subject: [PATCH 129/213] Add CommonMark in ChatLobbyDialog --- .gitmodules | 3 + appveyor.yml | 1 + retroshare-gui/src/cmark_export.h | 42 ++++++++++ retroshare-gui/src/cmark_version.h | 7 ++ retroshare-gui/src/config.h | 76 ++++++++++++++++++ retroshare-gui/src/gui/NetworkView.cpp | 2 +- .../src/gui/chat/ChatLobbyDialog.cpp | 2 +- retroshare-gui/src/gui/chat/ChatWidget.cpp | 51 +++++++++--- retroshare-gui/src/gui/chat/ChatWidget.h | 5 +- retroshare-gui/src/gui/chat/ChatWidget.ui | 55 +++++++++---- .../src/gui/common/{html.cpp => rshtml.cpp} | 12 +-- .../src/gui/common/{html.h => rshtml.h} | 10 +-- retroshare-gui/src/gui/common/vmessagebox.cpp | 8 +- retroshare-gui/src/gui/elastic/arrow.cpp | 2 +- retroshare-gui/src/gui/elastic/edge.cpp | 2 +- .../src/gui/elastic/{node.cpp => elnode.cpp} | 2 +- .../src/gui/elastic/{node.h => elnode.h} | 4 +- .../src/gui/elastic/graphwidget.cpp | 2 +- .../src/gui/help/browser/helptextbrowser.cpp | 2 +- retroshare-gui/src/gui/icons.qrc | 1 + .../src/gui/icons/png/markdown-mark.png | Bin 0 -> 9770 bytes retroshare-gui/src/retroshare-gui.pro | 50 ++++++++++-- retroshare-gui/src/rshare.cpp | 2 +- retroshare-gui/src/util/HandleRichText.cpp | 33 ++++++++ retroshare-gui/src/util/HandleRichText.h | 1 + supportlibs/cmark | 1 + 26 files changed, 318 insertions(+), 58 deletions(-) create mode 100644 .gitmodules create mode 100644 retroshare-gui/src/cmark_export.h create mode 100644 retroshare-gui/src/cmark_version.h create mode 100644 retroshare-gui/src/config.h rename retroshare-gui/src/gui/common/{html.cpp => rshtml.cpp} (95%) rename retroshare-gui/src/gui/common/{html.h => rshtml.h} (95%) rename retroshare-gui/src/gui/elastic/{node.cpp => elnode.cpp} (96%) rename retroshare-gui/src/gui/elastic/{node.h => elnode.h} (96%) create mode 100644 retroshare-gui/src/gui/icons/png/markdown-mark.png create mode 160000 supportlibs/cmark diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f7f9e74a2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cmark"] + path = supportlibs/cmark + url = https://github.com/commonmark/cmark.git diff --git a/appveyor.yml b/appveyor.yml index 6f26a1c67..7c13becb2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -85,6 +85,7 @@ environment: # - cmd: echo This is batch again # - cmd: set MY_VAR=12345 install: + - git submodule update --init # Configuring MSys2 - set PATH=C:\msys64\usr\bin;%PATH% - set PATH=C:\msys64\mingw32\bin;%PATH% diff --git a/retroshare-gui/src/cmark_export.h b/retroshare-gui/src/cmark_export.h new file mode 100644 index 000000000..333e5d542 --- /dev/null +++ b/retroshare-gui/src/cmark_export.h @@ -0,0 +1,42 @@ + +#ifndef CMARK_EXPORT_H +#define CMARK_EXPORT_H + +#ifdef CMARK_STATIC_DEFINE +# define CMARK_EXPORT +# define CMARK_NO_EXPORT +#else +# ifndef CMARK_EXPORT +# ifdef libcmark_EXPORTS + /* We are building this library */ +# define CMARK_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define CMARK_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef CMARK_NO_EXPORT +# define CMARK_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef CMARK_DEPRECATED +# define CMARK_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef CMARK_DEPRECATED_EXPORT +# define CMARK_DEPRECATED_EXPORT CMARK_EXPORT CMARK_DEPRECATED +#endif + +#ifndef CMARK_DEPRECATED_NO_EXPORT +# define CMARK_DEPRECATED_NO_EXPORT CMARK_NO_EXPORT CMARK_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef CMARK_NO_DEPRECATED +# define CMARK_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/retroshare-gui/src/cmark_version.h b/retroshare-gui/src/cmark_version.h new file mode 100644 index 000000000..c6fe002fb --- /dev/null +++ b/retroshare-gui/src/cmark_version.h @@ -0,0 +1,7 @@ +#ifndef CMARK_VERSION_H +#define CMARK_VERSION_H + +#define CMARK_VERSION ((0 << 16) | (28 << 8) | 0) +#define CMARK_VERSION_STRING "0.28.0" + +#endif diff --git a/retroshare-gui/src/config.h b/retroshare-gui/src/config.h new file mode 100644 index 000000000..d38c7c7a5 --- /dev/null +++ b/retroshare-gui/src/config.h @@ -0,0 +1,76 @@ +#ifndef CMARK_CONFIG_H +#define CMARK_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define HAVE_STDBOOL_H + +#ifdef HAVE_STDBOOL_H + #include +#elif !defined(__cplusplus) + typedef char bool; +#endif + +#define HAVE___BUILTIN_EXPECT + +#define HAVE___ATTRIBUTE__ + +#ifdef HAVE___ATTRIBUTE__ + #define CMARK_ATTRIBUTE(list) __attribute__ (list) +#else + #define CMARK_ATTRIBUTE(list) +#endif + +#ifndef CMARK_INLINE + #if defined(_MSC_VER) && !defined(__cplusplus) + #define CMARK_INLINE __inline + #else + #define CMARK_INLINE inline + #endif +#endif + +/* snprintf and vsnprintf fallbacks for MSVC before 2015, + due to Valentin Milea http://stackoverflow.com/questions/2915672/ +*/ + +#if defined(_MSC_VER) && _MSC_VER < 1900 + +#include +#include + +#define snprintf c99_snprintf +#define vsnprintf c99_vsnprintf + +CMARK_INLINE int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) +{ + int count = -1; + + if (size != 0) + count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); + if (count == -1) + count = _vscprintf(format, ap); + + return count; +} + +CMARK_INLINE int c99_snprintf(char *outBuf, size_t size, const char *format, ...) +{ + int count; + va_list ap; + + va_start(ap, format); + count = c99_vsnprintf(outBuf, size, format, ap); + va_end(ap); + + return count; +} + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/retroshare-gui/src/gui/NetworkView.cpp b/retroshare-gui/src/gui/NetworkView.cpp index 44c99736d..d0e486293 100644 --- a/retroshare-gui/src/gui/NetworkView.cpp +++ b/retroshare-gui/src/gui/NetworkView.cpp @@ -28,7 +28,7 @@ #include #include -#include "gui/elastic/node.h" +#include "gui/elastic/elnode.h" /******** * #define DEBUG_NETWORKVIEW diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 35a6f0f54..3d98a4b62 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -34,7 +34,7 @@ #include "gui/FriendsDialog.h" #include "gui/MainWindow.h" #include "gui/chat/ChatWidget.h" -#include "gui/common/html.h" +#include "gui/common/rshtml.h" #include "gui/common/FriendSelectionDialog.h" #include "gui/common/RSTreeWidgetItem.h" #include "gui/gxs/GxsIdChooser.h" diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index f35c0425d..4d7c42a66 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -72,8 +72,15 @@ * #define CHAT_DEBUG 1 *****/ -ChatWidget::ChatWidget(QWidget *parent) : - QWidget(parent), sendingBlocked(false), ui(new Ui::ChatWidget) +ChatWidget::ChatWidget(QWidget *parent) + : QWidget(parent) + , completionPosition(0), newMessages(false), typing(false), peerStatus(0) + , sendingBlocked(false), useCMark(false) + , lastStatusSendTime(0) + , firstShow(true), inChatCharFormatChanged(false), firstSearch(true) + , lastUpdateCursorPos(0), lastUpdateCursorEnd(0) + , completer(NULL), notify(NULL) + , ui(new Ui::ChatWidget) { ui->setupUi(this); @@ -84,17 +91,8 @@ ChatWidget::ChatWidget(QWidget *parent) : int butt_size(iconSize.height() + fmm); QSize buttonSize = QSize(butt_size, butt_size); - newMessages = false; - typing = false; - peerStatus = 0; - firstShow = true; - firstSearch = true; - inChatCharFormatChanged = false; - completer = NULL; lastMsgDate = QDate::currentDate(); - lastStatusSendTime = 0 ; - //Resize Tool buttons ui->emoteiconButton->setFixedSize(buttonSize); ui->emoteiconButton->setIconSize(iconSize); @@ -144,7 +142,6 @@ ChatWidget::ChatWidget(QWidget *parent) : connect(ui->actionSearchWithoutLimit, SIGNAL(triggered()), this, SLOT(toogle_SeachWithoutLimit())); connect(ui->searchButton, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuSearchButton(QPoint))); - notify=NULL; ui->notifyButton->setVisible(false); ui->markButton->setToolTip(tr("Mark this selected text
Ctrl+M")); @@ -194,6 +191,7 @@ ChatWidget::ChatWidget(QWidget *parent) : fontmenu->addAction(ui->actionResetFont); fontmenu->addAction(ui->actionNoEmbed); fontmenu->addAction(ui->actionSendAsPlainText); + fontmenu->addAction(ui->actionSend_as_CommonMark); QMenu *menu = new QMenu(); menu->addAction(ui->actionClearChatHistory); @@ -207,6 +205,10 @@ ChatWidget::ChatWidget(QWidget *parent) : ui->chatTextEdit->setOnlyPlainText(ui->actionSendAsPlainText->isChecked()); connect(ui->actionSendAsPlainText, SIGNAL(toggled(bool)), ui->chatTextEdit, SLOT(setOnlyPlainText(bool)) ); + connect(ui->actionSend_as_CommonMark, SIGNAL(toggled(bool)), this, SLOT(setUseCMark(bool)) ); + ui->cmPreview->setVisible(false); + connect(ui->chatTextEdit, SIGNAL(textChanged()), this, SLOT(updateCMPreview()) ); + ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages()); ui->textBrowser->installEventFilter(this); ui->textBrowser->viewport()->installEventFilter(this); @@ -981,6 +983,11 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS; } + //Use CommonMark + if (message.contains("CMark=\"true\"")) { + formatTextFlag |= RSHTML_FORMATTEXT_USE_CMARK; + } + // Always fix colors formatTextFlag |= RSHTML_FORMATTEXT_FIX_COLORS; qreal desiredContrast = Settings->valueFromGroup("Chat", "MinimumContrast", 4.5).toDouble(); @@ -1229,7 +1236,9 @@ void ChatWidget::sendChat() text = chatWidget->toPlainText(); text.replace(QChar(-4),"");//Char used when image on text. } else { - RsHtml::optimizeHtml(chatWidget, text, (ui->actionNoEmbed->isChecked() ? RSHTML_FORMATTEXT_NO_EMBED : 0)); + RsHtml::optimizeHtml(chatWidget, text, + (ui->actionNoEmbed->isChecked() ? RSHTML_FORMATTEXT_NO_EMBED : 0) + + (ui->actionSend_as_CommonMark->isChecked() ? RSHTML_FORMATTEXT_USE_CMARK : 0) ); } std::string msg = text.toUtf8().constData(); @@ -1823,6 +1832,22 @@ bool ChatWidget::setStyle() return false; } +void ChatWidget::setUseCMark(const bool bUseCMark) +{ + useCMark = bUseCMark; + ui->cmPreview->setVisible(useCMark); + updateCMPreview(); +} + +void ChatWidget::updateCMPreview() +{ + if (!useCMark) return; + + QString message = ui->chatTextEdit->toHtml(); + QString formattedMessage = RsHtml().formatText(ui->cmPreview->document(), message, RSHTML_FORMATTEXT_USE_CMARK); + ui->cmPreview->setHtml(formattedMessage); +} + void ChatWidget::quote() { QString text = ui->textBrowser->textCursor().selection().toPlainText(); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.h b/retroshare-gui/src/gui/chat/ChatWidget.h index 8de38620e..127575d73 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.h +++ b/retroshare-gui/src/gui/chat/ChatWidget.h @@ -128,6 +128,8 @@ public: public slots: void updateStatus(const QString &peer_id, int status); + void setUseCMark(const bool bUseCMark); + void updateCMPreview(); private slots: //void pasteCreateMsgLink() ; @@ -222,7 +224,8 @@ private: bool typing; int peerStatus; - bool sendingBlocked; + bool sendingBlocked; + bool useCMark; time_t lastStatusSendTime; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui index 9ea7277ef..16a411eb5 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.ui +++ b/retroshare-gui/src/gui/chat/ChatWidget.ui @@ -268,22 +268,34 @@ border-image: url(:/images/closepressed.png)
- - - - 0 - 0 - + + + Qt::Horizontal - - - 0 - 30 - + + 2 - - Type a message here + + false + + + + 0 + 0 + + + + + 0 + 30 + + + + Type a message here + + + @@ -915,6 +927,21 @@ border-image: url(:/images/closepressed.png) Show Hidden Images + + + true + + + + :/icons/png/markdown-mark.png:/icons/png/markdown-mark.png + + + Send as CommonMark + + + Text will be formatted using CommonMark. + + @@ -945,8 +972,8 @@ border-image: url(:/images/closepressed.png) - + diff --git a/retroshare-gui/src/gui/common/html.cpp b/retroshare-gui/src/gui/common/rshtml.cpp similarity index 95% rename from retroshare-gui/src/gui/common/html.cpp rename to retroshare-gui/src/gui/common/rshtml.cpp index ce71518f9..e0a1cdaf6 100644 --- a/retroshare-gui/src/gui/common/html.cpp +++ b/retroshare-gui/src/gui/common/rshtml.cpp @@ -1,7 +1,7 @@ /**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2008, defnax + * This file is distributed under the following license: + * + * Copyright (c) 2008, defnax * Copyright (c) 2008, Matt Edman, Justin Hipple * * This program is free software; you can redistribute it and/or @@ -21,12 +21,12 @@ ****************************************************************/ /* -** \file html.cpp -** \version $Id: html.cpp 2362 2008-02-29 04:30:11Z edmanm $ +** \file rshtml.cpp +** \version $Id: rshtml.cpp 2362 2008-02-29 04:30:11Z edmanm $ ** \brief HTML formatting functions */ -#include "html.h" +#include "rshtml.h" /** Wraps a string in "

" tags, converts "\n" to "
" and converts "\n\n" diff --git a/retroshare-gui/src/gui/common/html.h b/retroshare-gui/src/gui/common/rshtml.h similarity index 95% rename from retroshare-gui/src/gui/common/html.h rename to retroshare-gui/src/gui/common/rshtml.h index bb217d220..627b81a59 100644 --- a/retroshare-gui/src/gui/common/html.h +++ b/retroshare-gui/src/gui/common/rshtml.h @@ -1,7 +1,7 @@ /**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2008, defnax + * This file is distributed under the following license: + * + * Copyright (c) 2008, defnax * Copyright (c) 2008, Matt Edman, Justin Hipple * * This program is free software; you can redistribute it and/or @@ -21,8 +21,8 @@ ****************************************************************/ /* -** \file html.h -** \version $Id: html.h 2362 2008-02-29 04:30:11Z edmanm $ +** \file rshtml.h +** \version $Id: rshtml.h 2362 2008-02-29 04:30:11Z edmanm $ ** \brief HTML formatting functions */ diff --git a/retroshare-gui/src/gui/common/vmessagebox.cpp b/retroshare-gui/src/gui/common/vmessagebox.cpp index 933310acd..f1465fa4f 100644 --- a/retroshare-gui/src/gui/common/vmessagebox.cpp +++ b/retroshare-gui/src/gui/common/vmessagebox.cpp @@ -1,7 +1,7 @@ /**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2008, defnax + * This file is distributed under the following license: + * + * Copyright (c) 2008, defnax * Copyright (c) 2008, Matt Edman, Justin Hipple * * This program is free software; you can redistribute it and/or @@ -26,7 +26,7 @@ ** \brief Provides a custom Vidalia mesage box */ -#include "html.h" +#include "rshtml.h" #include "vmessagebox.h" diff --git a/retroshare-gui/src/gui/elastic/arrow.cpp b/retroshare-gui/src/gui/elastic/arrow.cpp index 8ef0991d4..f9fc8a95b 100644 --- a/retroshare-gui/src/gui/elastic/arrow.cpp +++ b/retroshare-gui/src/gui/elastic/arrow.cpp @@ -37,7 +37,7 @@ #include #include "arrow.h" -#include "node.h" +#include "elnode.h" #include diff --git a/retroshare-gui/src/gui/elastic/edge.cpp b/retroshare-gui/src/gui/elastic/edge.cpp index e9e60f06b..cee1e1e88 100644 --- a/retroshare-gui/src/gui/elastic/edge.cpp +++ b/retroshare-gui/src/gui/elastic/edge.cpp @@ -42,7 +42,7 @@ #include #include "edge.h" -#include "node.h" +#include "elnode.h" #include diff --git a/retroshare-gui/src/gui/elastic/node.cpp b/retroshare-gui/src/gui/elastic/elnode.cpp similarity index 96% rename from retroshare-gui/src/gui/elastic/node.cpp rename to retroshare-gui/src/gui/elastic/elnode.cpp index 6a3020b21..99bbfd310 100644 --- a/retroshare-gui/src/gui/elastic/node.cpp +++ b/retroshare-gui/src/gui/elastic/elnode.cpp @@ -54,7 +54,7 @@ #include #include "edge.h" -#include "node.h" +#include "elnode.h" #include "graphwidget.h" #define IMAGE_AUTHED ":/images/accepted16.png" diff --git a/retroshare-gui/src/gui/elastic/node.h b/retroshare-gui/src/gui/elastic/elnode.h similarity index 96% rename from retroshare-gui/src/gui/elastic/node.h rename to retroshare-gui/src/gui/elastic/elnode.h index e43fa3521..6e59cf43d 100644 --- a/retroshare-gui/src/gui/elastic/node.h +++ b/retroshare-gui/src/gui/elastic/elnode.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef NODE_H -#define NODE_H +#ifndef ELNODE_H +#define ELNODE_H #include #if QT_VERSION >= 0x040600 diff --git a/retroshare-gui/src/gui/elastic/graphwidget.cpp b/retroshare-gui/src/gui/elastic/graphwidget.cpp index 9aeebbeda..aa8cbf241 100644 --- a/retroshare-gui/src/gui/elastic/graphwidget.cpp +++ b/retroshare-gui/src/gui/elastic/graphwidget.cpp @@ -41,7 +41,7 @@ #include "graphwidget.h" #include "edge.h" -#include "node.h" +#include "elnode.h" #include "fft.h" #include diff --git a/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp b/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp index 60d4ed427..f6b445e1c 100644 --- a/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp +++ b/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp @@ -30,7 +30,7 @@ #include #include #include "gui/common/vmessagebox.h" -#include "gui/common/html.h" +#include "gui/common/rshtml.h" #include #include "helptextbrowser.h" diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index aab1afb40..31e3f816a 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -241,5 +241,6 @@ icons/warning_yellow_128.png icons/yahoo.png icons/yandex.png + icons/png/markdown-mark.png diff --git a/retroshare-gui/src/gui/icons/png/markdown-mark.png b/retroshare-gui/src/gui/icons/png/markdown-mark.png new file mode 100644 index 0000000000000000000000000000000000000000..da4bb71234f38840a6931cc74fddeba0a4c9fdda GIT binary patch literal 9770 zcmeHNc{o&k`~RMqX=W;0n=D~Mww@v(5l)M>ETvLfjBI6%EHN>sy+;&Mlw!&jm3=E@ zN=m3ywya5(tl4+-J7XTA^t{h|UB5rx_qyJ$bIqA^-{1Rlf9`b#{b``5$-aPZ0RVtq zTWi}c0PqL^I6%arl7UzoM*uLX20M1EGZ+k1^1pxo%fNq82JT2!Tu13PIq%Xl1T8$n zc;1^Yn=ChC#{y*7dfz4Q;J5nCUg7!Ov-!0e1$Vs?Dh?voyLE>?mAZ;@~&Aw zBPquw%tbHxC@F8;_29{uw_5Y^tfW1L88-L20r{$@en(IHNVZNIYdvh6It2XrC~w;#*EjF6$Nt2Ci@p zUinPO;JFF#-DsJ9kqwRgXwdq2A1XjH!%WHmf3fShW@ET2uuh;(agiHD-6pXzr^#JVbZo>^dCSM2xfTJXfIz z6dk&}as0)SbsxiYG34iidaqUCkK8`Kx)>yJVU&dcO|oP^=PVw=D#CTwM3KLQmR@)+MR~a?#Boi)FNiy0AqDh`=(7dP<=S(J{GF2@pdo z^8`pBWs~(ha6@P}1034uVqdZV6y5Q#@WeWI7d{BT0m%J@%gd$VX5HHYsd$hq9%>W@ zT%$u4_@rC~&a+Wl;(`HT`wtu}2QI_yXYPxDecwN=bzw8;uG(n@zPmcsVC0;) z09a)Qk8u#__Y?=T!?oWIjDr57jJ*KP&MJMX`3SrFFgGyJw`fddH>e7QKz~`XT?fXQ z91jq-KBWW&Xryba$$XGcUwv`HZ4JixwFLxjX0!*a;Vd@9Vu7se_n0;82HF+?wv^hQ zCIgqN@dCe_;_-D!Kqc7(z!wH6mfJBUU!nlAqo(A@LX2}K1x4`as(wSbpQR4qm&Sn( z3h*8?43JfblA6#>9x^I75dwbM2OMg?;!7G|L16w^MxhwC#L*nU7!hTADLC^X5ojIB zTN^?wZnh!-(RHJ}{G7#9H&hytOLdTg$2I2xQQ26=OH4|y00drFC-!P!oClKtVt%70 zyB_pE6$7NZHXaT#a7`2rh{{D)UBK*?QwF4%PwM={Vpp`#0k<-0@R*X7fRxA)#!;Lo z4}m{RSB%DhM==~g>!HV+XiN$fz)qtK3L-@y_^pu1=&8fVi3ea2DlS@m?98=yH_Kdw`~zQ_M?BV*hU8DKO;Xtif}U#uNF28x4I)h4`? z(uEVxdPhx&z>(6L#_~p8BRZgX=uT4KTNU9)hE`(@+y^tYT74w3Ik9TMz5aSU$89GK z(b7(#@`TJ&YKx^jO>6fjV~|bj+8(+~2Wo7o>*^U4$;b`$cJ>-}+7J9pr1b0rz8(Dj zzD|Mm-hapIf@}Q*Qdi)etR&F@UIFUDVgdgG(^ogVR)KtF6G@eU1g*v^IrCaBzvk=C z&*Q`a_iv{!3u*67m!6P^&x)z@*(h_cfu0ij6&n#>?XwenGzSen<*?%xz%M;+lWDV7 zLkN}KpjqplbyYtE3m(X^+avmZSQ?UgDz~eG(PRO^hYz^+PWV5M%%gG`xa*33@8FNc zBAbjnbJImm-|A5#+!xz*GR6V;4URlrDp@kN5f;+KP_F!m0rX%Mk<(WhD`=(u*~wml z^B^QFY}uy+QOr&m5IpiIzxt~1^3}pN%WrIhAlldG`IX-J>Vx@}^=HEo zAT#tm-*_-zy)J*>H=2Y5V3YFo>G!pKEbpI~WOXkA9M@Afx6Q0x>7RNnJOTKTQ-lKA zmh)zwJh_wyTrgR|+ZIGwFY7vTPeKO#p`;=^U}?X3U_;viHZcFf=$Yz({CyWujVMp& zb|=nlX&lm5&tT!USa1vy)x7ZFoOD*|>lm z%zsHKtWFm`u;gAb>N$(LdaysgY)C>5#p^P8m%5mQTo8vJ$x;c<$Cr`-$J;T1;@12! z!<|QgmQ1Ztv#?p659;nrcc?q!#W#5CR|)4A6_n#k?>$RPc*zrg-YyOxb^d z`RpKnCU4LLxJb+kM`T_Q21WpS&6dp+Po0}7W0@OoTavt%FZ~cz&_%N<@_mNglCK{b z?*}cgBUoiOQ=I%#4bwi8JY{;#U53taH#hOE(9i)(`;!}^&z6R?d-aMnejKoVIiO#P zmw~GV_o|1N9?t~WZQ(Y(7V@SWbN0Rg*cUGG+Tp|fm4J+7BtGIx=+J=h#Fc0*W#BD1 z2t!7=gwY~lMYo}ZSPC{Smf{?d$VCS$Cly+k&@%r}U~oSaXs&)$AkdaeOhs|jIpUm$ zc}PDLQ-}SyAP6(1n7;@|{Gr&4fH@S{b6nF38JIX}v3N3^zZ9%E|5h=TfJuvgk(qy) zG9Hu3sQrG>qJ!TAGR1c?Pg8;L{fm+uWrf1Z?eDz&1F&;z=PU{t`L!rq{1<;;L4n`a z=*dE~sphOgAMaG7{hZEVbclXbS!}u?(R1gH&GcldGqZ7n4Q84}q1$Y_jOXT~o9nMu z^y8Xs#zis*c&$r*^U==%KdzOFNvQ9YTf|_%bhiUR=j9ynCV-d)l!Y(|v{-l>2FDzf zd~}>=7%rJ*s5O_NIm?h4ki^!>4ly{#wGuT%i84K+^TYJWj2-pJ>()WZDZv$pEc@!yp!WgT0c2-u;t_u zLGoG4;wCHMvaIr(&obni)39ikq3~RWKY27~d7N!H+vBC*QXNYM5P3g!L7c$88vr6Q zvp>EH1{f@E1WTvFV23#Z=;)ETUS(jkG0+zI?JEz7sh#tcjSH0zEI%F1DFd?+VtEM{ ztg$?#r)-1=iwGB`ONlb@snD(%vG$wPI73_I$e_Eql zq#qM7y)9?0C9h3??ao=dXe9=Nn_5!;WT{RK9dkuZE!7#HDnAeV^mOklW2j#`ZdM6B zj~?M~f3lDN^I_l0#PUw$r4BkOWW_@@U-~|aXS`=}I62zC+r`_^q>hi)J^B1t(d5vV zu`iKC(<0{T3O%K`U*OBvi{es>w=cM~nfc=BcgpOmrq3AfH zaHk$BRcQV;z(ux&D)2aAKs=KO*EvQ16NHS@_ z7RyvUt3Xw=oJ^_~UpkH_5ntjH*tJL)1eh(PE09nxTt4h%em@uopqJbzHmV}=@S`de z8{@ME#hzBN++O?{{NIRx>9&pZ6ZqUQQON%=%nXh>GWOdr&$azqIm}r0k25C7^Gg!{ znP_&ZS=msYnf?EN(fVKE=Mb&__0$}qISf6gnuw-4)nEofXdh2j!RJej-6 z4Z>u{+AaZT?pRI8%-!UAm@EYgj#-MI-~y*N+gxzWQv3|}gWVi(bFpKVg2iqwIA-pC zVmDce$=x~^+>c*O-1tSLwxoTP*HU;=BqT66~{vt^gxE2M{|1{7~SD!GFnE4w#3h93VWSgR|Y4&ESE$ zo8l2lqQ9KvhRRsbEN-xmiV5O7C1XKP@t_m{eipYM?k2gRJSeAsU>}}^eHk|+6iVbw zi1?-CAN1PKV{F;}$`I_6z3b@ajhOpicyV~lUfLde6o(W%z_ zwco=wr!My$0@|aic0&M*p(6mjWY90oB)~>wURVsx0*?cD90Eb;MMl4Bqu-~|ug+Y* zkX?=aO151`-)75NbnNt$ zw^+joRF1kAj9B+8VEMcNzAvryb6|fyC_XEAGl?UvDe~c~d5Bd?<&|t}LJ!&N?Oz|;U|7bPMg%HWmxUr8Haw`=RW{s(J~j(9M?b8IohR9j!kxIX z!*pTn_^y4+fQR1o=K~MQwwr2t3WL62{T0`rmpyo^XIj2#HTr0E=-TtQakaNTT)@Cr zd3BCCJgQYwKJR&a6cih#F~|!-#wVoA3@hy+T6Fu34=y08api65gyZ%v^4!yIR<_=R4FLgX%W*?wAAgTKSZ-y;jZCLv5ak3R>~6? zDgebIhuz8E{Min%2fJGW2YbT^NT|W~_d=fPvF4WpH#pdvfELK}L~~@;ngFTCYvmO? z1kfyIHKde$eiEURrYoR2hUTNccC5a{v?@YJHAB<-c=zXfptzBn{qSwR_U>m9I)aMw zE-gZ18lc6xj;CE;K+lsD6JQ%^e0%J(G#*(ykVgo+ZEPDFq0`e_(l8t*zy=Q4d{2I- zui`Zk1gW^&wyx`XaR&njRepQn9`mX~oM8d47K;|!{xsbkWw*sMgzBJeE$glxKoEa@ zzohX?)=<H6S>}s_Qn)+2~b#4Ae5qj&5ChXviD^raJDkJLz7l9}A zOAgYW9Z4mvLt{Hds44ZA#tqY(bo*ZOtmhI4L8PsO-+dVFrO-HK=?djK5Q5u&B;1 z^^aV$QFVqQEm~zHIz|ZW81DBS4ws@jH7t>31E1$_Xc8g>>Y{JS*T#C0fl+g70tl<_ zGQkJlE#Uwcdg8H_WDjdR__$#x9U6E3Si%Mr#=qsTOPH{M5?j*=PuTMW7Np*ybWnK= zTv3_ztFdS(yFLxTzV?({>I#FsIAEP3%y5UhPVNUZ1!>AFDZF#TZ2;RfRcClZjdm0~ zuuf{ON{WSQHmU-HYu#>fPVmhWM*)rd;@j7;gg$yN2Be;>#XjIQuzb1!7@Qq^ThxkT z?7>QM0DRmN$5d>=&C9!1pugr{|3JvVQg??bka65wCP!Wtwu3-7;{raBpF!Ed_r3<$^C3*i{T&Sp8uFaq_Iw z#DX=WN9+2(nZp|g>pdZayI*Cj+F5~is(YOos^c9EmX7)eH3pfDqE9VCqlM0@v=ynP z8W0j?mr}Y@avg0&|EEt7BKBsYeW&DlT9JEi34jfwp1SMluuCYLOgsSa5-*qGw~`xZ zV`+(d0NFRqdQ4#zA@HD78*P_pC zt@g)Qxvl{H9q8HTFZ2%vc;Ev!Y;v^+pVe-SR&0ofgBq)o)zrAa&<1Rn+GuskJ%4Ur zYRe)Bp$-I$a!1PVF-~cTMAzfkHMcD1ovnffu1a?4rvbf=t=+X!@7Nv@yNb~$H$0eV z|ETZjU~Cl0-ZfrtN)eq8+8rx6>p~RdK7>AM3gZVA<{uJ|Z5Qcy()U=69kiuMieJ$Q ziA}L7;iwuQATIkDY05r2nS9^qZQQrHLD`=5;+;VQ@*n&Q4QYw39{|NgTknm1xF)-9qZg*3lw7Dc)sx=k*2kJlD>g`Un6}9 z1mtiZz3XLlz!^Tt_Qa|?kI@g48-ITE8Y>Je)pEQ#Qug(e+I*0Gq*b!F_PCXfO$2vc zW^YoSCJwP53~&??k`Gpr+Z9sod8D)88oJgzTsupYe@IRmI0wCM z2y^Zze_0*OC%-F)k=f;r6@Qr3cMBw>wF#9DW?j}l+0qzuNF=v$r}7H5`hnBEYduOW z^gUj<1RWFvWgLw3+Vx#eUA}H^b2!z#gj #include -#include +#include #include #include #include diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 2b3e75b35..046ea47a6 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -38,6 +38,10 @@ #include "util/imageutil.h" #include "util/rstime.h" +//Include for CMark +#include +#include + #include /** @@ -582,6 +586,29 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo // Save Space and Tab because doc loose it. formattedText=saveSpace(formattedText); + if (flag & RSHTML_FORMATTEXT_USE_CMARK) { + // Transform html to plain text + QTextBrowser textBrowser; + textBrowser.setHtml(text); + formattedText = textBrowser.toPlainText(); + // Parse CommonMark + int options = CMARK_OPT_DEFAULT; + cmark_parser *parser = cmark_parser_new(options); + cmark_parser_feed(parser, formattedText.toStdString().c_str(),formattedText.length()); + cmark_node *document = cmark_parser_finish(parser); + cmark_parser_free(parser); + char *result; + result = cmark_render_html(document, options); + // Get result as html + formattedText = QString::fromUtf8(result); + //Clean + cmark_node_mem(document)->free(result); + cmark_node_free(document); + //Get document formed HTML + textBrowser.setHtml(formattedText); + formattedText=textBrowser.toHtml(); + } + QString errorMsg; int errorLine; int errorColumn; QDomDocument doc; @@ -981,6 +1008,12 @@ static void styleCreate(QDomDocument& doc noEmbedAttr.setValue("true"); styleElem.attributes().setNamedItem(noEmbedAttr); } + if (flag & RSHTML_FORMATTEXT_USE_CMARK) { + QDomAttr cMarkAttr; + cMarkAttr = doc.createAttribute("CMark"); + cMarkAttr.setValue("true"); + styleElem.attributes().setNamedItem(cMarkAttr); + } } while(styleElem.childNodes().count()>0) { diff --git a/retroshare-gui/src/util/HandleRichText.h b/retroshare-gui/src/util/HandleRichText.h index a8f8d66ef..afa91f091 100644 --- a/retroshare-gui/src/util/HandleRichText.h +++ b/retroshare-gui/src/util/HandleRichText.h @@ -44,6 +44,7 @@ #define RSHTML_FORMATTEXT_REMOVE_FONT (RSHTML_FORMATTEXT_REMOVE_FONT_WEIGHT | RSHTML_FORMATTEXT_REMOVE_FONT_STYLE | RSHTML_FORMATTEXT_REMOVE_FONT_FAMILY | RSHTML_FORMATTEXT_REMOVE_FONT_SIZE) #define RSHTML_FORMATTEXT_CLEANSTYLE (RSHTML_FORMATTEXT_REMOVE_FONT | RSHTML_FORMATTEXT_REMOVE_COLOR) #define RSHTML_FORMATTEXT_NO_EMBED 0x0400//1024 +#define RSHTML_FORMATTEXT_USE_CMARK 0x0800//2048 /* Flags for RsHtml::optimizeHtml */ #define RSHTML_OPTIMIZEHTML_MASK (RSHTML_FORMATTEXT_CLEANSTYLE | RSHTML_FORMATTEXT_FIX_COLORS | RSHTML_FORMATTEXT_OPTIMIZE) diff --git a/supportlibs/cmark b/supportlibs/cmark new file mode 160000 index 000000000..b9c7a496b --- /dev/null +++ b/supportlibs/cmark @@ -0,0 +1 @@ +Subproject commit b9c7a496ba7dd9c3495bae2ff2855899e47b245d From f97dc8a1258ff66efcc01ae4105f8b653544e35d Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 22 Jul 2018 21:33:40 +0200 Subject: [PATCH 130/213] Properly plug deep search in GXS search Some modifications breaks retrocompatibility of GXS search: remove horrible templated RsTypeSerializer::serial_process for RsGxsGroupSummary with hardcoded member names RsGxsGroupSummary doesn't use old TLV serialization format anymore RsGxsGroupSummary remove unused description member RsGxsGroupSummary derive from RsSerializable and use serialization helper macro Add autor id and signature flags to the index so there is no need to retrive them from GXS, thus improving performances RsGroupNetworkStats initialize members properly RsGxsGroupSummary rename members to follow usual mMemberName convention --- libretroshare/src/deep_search/deep_search.h | 5 ++ libretroshare/src/gxs/rsgds.h | 26 ++++--- libretroshare/src/gxs/rsgxsnetservice.cc | 70 +++++++++++-------- libretroshare/src/gxs/rsgxsnettunnel.cc | 18 +---- libretroshare/src/retroshare/rsgxsiface.h | 48 ++++++++----- libretroshare/src/services/p3gxschannels.cc | 21 +++--- .../src/gui/gxs/GxsGroupFrameDialog.cpp | 23 +++--- 7 files changed, 111 insertions(+), 100 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 368aa7e84..914fce6a2 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -118,6 +118,11 @@ struct DeepSearch chanUrl.setQueryKV("publishDate", date); chanUrl.setQueryKV("name", chan.mMeta.mGroupName); + if(!chan.mMeta.mAuthorId.isNull()) + chanUrl.setQueryKV("authorId", chan.mMeta.mAuthorId.toStdString()); + if(chan.mMeta.mSignFlags) + chanUrl.setQueryKV( "signFlags", + std::to_string(chan.mMeta.mSignFlags) ); std::string rsLink(chanUrl.toString()); // store the RS link so we are able to retrive it on matching search diff --git a/libretroshare/src/gxs/rsgds.h b/libretroshare/src/gxs/rsgds.h index 34e5d2076..84276d7b6 100644 --- a/libretroshare/src/gxs/rsgds.h +++ b/libretroshare/src/gxs/rsgds.h @@ -74,23 +74,21 @@ public: }; /*! - * This is used to query network statistics for a given group. This is useful to e.g. show group - * popularity, or number of visible messages for unsubscribed group. + * This is used to query network statistics for a given group. This is useful + * to e.g. show group popularity, or number of visible messages for unsubscribed + * group. */ - -class RsGroupNetworkStats +struct RsGroupNetworkStats { -public: - RsGroupNetworkStats() - { - mMaxVisibleCount = 0 ; - } + RsGroupNetworkStats() : + mSuppliers(0), mMaxVisibleCount(0), mGrpAutoSync(false), + mAllowMsgSync(false), mLastGroupModificationTS(0) {} - uint32_t mSuppliers ; - uint32_t mMaxVisibleCount ; - bool mGrpAutoSync ; - bool mAllowMsgSync; - time_t mLastGroupModificationTS ; + uint32_t mSuppliers; + uint32_t mMaxVisibleCount; + bool mGrpAutoSync; + bool mAllowMsgSync; + time_t mLastGroupModificationTS; }; typedef std::map > NxsMsgDataResult; diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index b5751b2cd..b6fe8420d 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -243,6 +243,7 @@ #include #include #include +#include #include "rsgxsnetservice.h" #include "gxssecurity.h" @@ -5187,8 +5188,8 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: std::map& search_results_map(mDistantSearchResults[req]) ; for(auto it(group_infos.begin());it!=group_infos.end();++it) - if(search_results_map.find((*it).group_id) == search_results_map.end()) - grpMeta[(*it).group_id] = NULL; + if(search_results_map.find((*it).mGroupId) == search_results_map.end()) + grpMeta[(*it).mGroupId] = NULL; mDataStore->retrieveGxsGrpMetaData(grpMeta); @@ -5197,26 +5198,26 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std: // only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure for(auto it(group_infos.begin());it!=group_infos.end();++it) - if(grpMeta[(*it).group_id] == NULL) + if(grpMeta[(*it).mGroupId] == NULL) { filtered_results.push_back(*it) ; - auto it2 = search_results_map.find((*it).group_id) ; + auto it2 = search_results_map.find((*it).mGroupId) ; if(it2 != search_results_map.end()) { // update existing data - it2->second.popularity++ ; - it2->second.number_of_messages = std::max(it2->second.number_of_messages,(*it).number_of_messages) ; + it2->second.mPopularity++ ; + it2->second.mNumberOfMessages = std::max(it2->second.mNumberOfMessages,(*it).mNumberOfMessages) ; } else { - search_results_map[(*it).group_id] = *it; - search_results_map[(*it).group_id].popularity = 1; // number of results so far + search_results_map[(*it).mGroupId] = *it; + search_results_map[(*it).mGroupId].mPopularity = 1; // number of results so far } - mObserver->receiveDistantSearchResults(req,(*it).group_id) ; + mObserver->receiveDistantSearchResults(req,(*it).mGroupId) ; } } @@ -5277,12 +5278,6 @@ bool RsGxsNetService::search( const std::string& substring, { group_infos.clear(); - RsGxsGrpMetaTemporaryMap grpMetaMap; - { - RS_STACK_MUTEX(mNxsMutex) ; - mDataStore->retrieveGxsGrpMetaData(grpMetaMap); - } - #ifdef RS_DEEP_SEARCH std::vector results; DeepSearch::search(substring, results, 0); @@ -5290,33 +5285,48 @@ bool RsGxsNetService::search( const std::string& substring, for(auto dsr : results) { RsUrl rUrl(dsr.mUrl); - auto rit = rUrl.query().find("id"); + const auto& uQ(rUrl.query()); + auto rit = uQ.find("id"); if(rit != rUrl.query().end()) { RsGroupNetworkStats stats; RsGxsGroupId grpId(rit->second); - RsGxsGrpMetaTemporaryMap::iterator mIt; - if( !grpId.isNull() && - (mIt = grpMetaMap.find(grpId)) != grpMetaMap.end() && - getGroupNetworkStats(grpId, stats) ) + if( !grpId.isNull() && getGroupNetworkStats(grpId, stats) ) { - RsGxsGrpMetaData& gMeta(*mIt->second); RsGxsGroupSummary s; - s.group_id = grpId; - s.group_name = gMeta.mGroupName; - s.search_context = dsr.mSnippet; - s.sign_flags = gMeta.mSignFlags; - s.publish_ts = gMeta.mSignFlags; - s.author_id = gMeta.mAuthorId; - s.number_of_messages = stats.mMaxVisibleCount; - s.last_message_ts = stats.mLastGroupModificationTS; - s.popularity = gMeta.mPop; + + s.mGroupId = grpId; + + if((rit = uQ.find("name")) != uQ.end()) + s.mGroupName = rit->second; + if((rit = uQ.find("signFlags")) != uQ.end()) + s.mSignFlags = std::stoul(rit->second); + if((rit = uQ.find("publishDate")) != uQ.end()) + { + std::istringstream ss(rit->second); + std::tm tm; + ss >> std::get_time(&tm, "%Y%m%d"); + s.mPublishTs = mktime(&tm); + } + if((rit = uQ.find("authorId")) != uQ.end()) + s.mAuthorId = RsGxsId(rit->second); + + s.mSearchContext = dsr.mSnippet; + + s.mNumberOfMessages = stats.mMaxVisibleCount; + s.mLastMessageTs = stats.mLastGroupModificationTS; + s.mPopularity = stats.mSuppliers; group_infos.push_back(s); } } } #else // RS_DEEP_SEARCH + RsGxsGrpMetaTemporaryMap grpMetaMap; + { + RS_STACK_MUTEX(mNxsMutex) ; + mDataStore->retrieveGxsGrpMetaData(grpMetaMap); + } RsGroupNetworkStats stats ; for(auto it(grpMetaMap.begin());it!=grpMetaMap.end();++it) if(termSearch(it->second->mGroupName,substring)) diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index ff3134493..dfa0d8655 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -216,22 +216,6 @@ public: } }; -template<> -void RsTypeSerializer::serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx, RsGxsGroupSummary& gs, const std::string& member_name ) -{ - RsTypeSerializer::serial_process (j,ctx,gs.group_id ,member_name+"-group_id") ; // RsGxsGroupId group_id ; - RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME ,gs.group_name,member_name+"-group_name") ; // std::string group_name ; - RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_COMMENT ,gs.group_description,member_name+"-group_description") ; // std::string group_description ; - RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_VALUE ,gs.search_context,member_name+"-group_name") ; // std::string search_context ; - RsTypeSerializer::serial_process (j,ctx,gs.author_id ,member_name+"-author_id") ; // RsGxsId author_id ; - RsTypeSerializer::serial_process (j,ctx,gs.publish_ts ,member_name+"-publish_ts") ; // time_t publish_ts ; - RsTypeSerializer::serial_process (j,ctx,gs.number_of_messages,member_name+"-number_of_messages") ; // uint32_t number_of_messages ; - RsTypeSerializer::serial_process (j,ctx,gs.last_message_ts ,member_name+"-last_message_ts") ; // time_t last_message_ts ; - RsTypeSerializer::serial_process(j,ctx,gs.sign_flags ,member_name+"-sign_flags") ; // uint32_t sign_flags ; - RsTypeSerializer::serial_process(j,ctx,gs.popularity ,member_name+"-popularity") ; // uint32_t popularity ; -} - - //===========================================================================================================================================// // Interface with rest of the software // //===========================================================================================================================================// @@ -1102,7 +1086,7 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl; for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it) - std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl; + std::cerr << " group " << (*it).mGroupId << ": " << (*it).mGroupName << ", " << (*it).mNumberOfMessages << " messages, last is " << time(NULL)-(*it).mLastMessageTs << " secs ago." << std::endl; auto it = mSearchableServices.find(result_gs->service) ; diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index 7ccedff36..b85f3fbce 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -34,26 +34,42 @@ #include "util/rsdeprecate.h" /*! - * \brief The RsGxsGroupSymmary struct - * This structure is used to transport group summary information when a GXS service is searched. It contains the group information - * as well as a context string to tell where the information was found. It is more compact than a GroupMeta object, so as to make - * search responses as light as possible. + * This structure is used to transport group summary information when a GXS + * service is searched. It contains the group information as well as a context + * string to tell where the information was found. It is more compact than a + * GroupMeta object, so as to make search responses as light as possible. */ -struct RsGxsGroupSummary +struct RsGxsGroupSummary : RsSerializable { - RsGxsGroupSummary() : publish_ts(0), number_of_messages(0),last_message_ts(0),sign_flags(0),popularity(0) {} + RsGxsGroupSummary() : + mPublishTs(0), mNumberOfMessages(0),mLastMessageTs(0), + mSignFlags(0),mPopularity(0) {} - RsGxsGroupId group_id ; + RsGxsGroupId mGroupId; + std::string mGroupName; + RsGxsId mAuthorId; + time_t mPublishTs; + uint32_t mNumberOfMessages; + time_t mLastMessageTs; + uint32_t mSignFlags; + uint32_t mPopularity; - std::string group_name ; - RS_DEPRECATED std::string group_description; - std::string search_context ; - RsGxsId author_id ; - time_t publish_ts ; - uint32_t number_of_messages ; - time_t last_message_ts ; - uint32_t sign_flags ; - uint32_t popularity ; + std::string mSearchContext; + + /// @see RsSerializable::serial_process + void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(mGroupId); + RS_SERIAL_PROCESS(mGroupName); + RS_SERIAL_PROCESS(mAuthorId); + RS_SERIAL_PROCESS(mPublishTs); + RS_SERIAL_PROCESS(mNumberOfMessages); + RS_SERIAL_PROCESS(mLastMessageTs); + RS_SERIAL_PROCESS(mSignFlags); + RS_SERIAL_PROCESS(mPopularity); + RS_SERIAL_PROCESS(mSearchContext); + } }; diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 8474d3111..1c7cf1058 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1703,21 +1703,18 @@ bool p3GxsChannels::retrieveDistantSearchResults(TurtleRequestId req,std::mapretrieveDistantGroupSummary(group_id,gs)) { // This is a placeholder information by the time we receive the full group meta data. - - distant_group.mDescription = gs.group_description; - - distant_group.mMeta.mGroupId = gs.group_id ; - distant_group.mMeta.mGroupName = gs.group_name; + distant_group.mMeta.mGroupId = gs.mGroupId ; + distant_group.mMeta.mGroupName = gs.mGroupName; distant_group.mMeta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_PUBLIC ; - distant_group.mMeta.mSignFlags = gs.sign_flags; + distant_group.mMeta.mSignFlags = gs.mSignFlags; - distant_group.mMeta.mPublishTs = gs.publish_ts; - distant_group.mMeta.mAuthorId = gs.author_id; + distant_group.mMeta.mPublishTs = gs.mPublishTs; + distant_group.mMeta.mAuthorId = gs.mAuthorId; distant_group.mMeta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC ;// guessed, otherwise the group would not be search-able. @@ -1726,9 +1723,9 @@ bool p3GxsChannels::retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChann distant_group.mMeta.mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED ; - distant_group.mMeta.mPop = gs.popularity; // Popularity = number of friend subscribers - distant_group.mMeta.mVisibleMsgCount = gs.number_of_messages; // Max messages reported by friends - distant_group.mMeta.mLastPost = gs.last_message_ts; // Timestamp for last message. Not used yet. + distant_group.mMeta.mPop = gs.mPopularity; // Popularity = number of friend subscribers + distant_group.mMeta.mVisibleMsgCount = gs.mNumberOfMessages; // Max messages reported by friends + distant_group.mMeta.mLastPost = gs.mLastMessageTs; // Timestamp for last message. Not used yet. return true ; } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 58e7bb93a..473b26e7d 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -279,21 +279,22 @@ void GxsGroupFrameDialog::updateSearchResults() QList group_items ; - for(auto it3(group_infos.begin());it3!=group_infos.end();++it3) - if(mCachedGroupMetas.find(it3->first) == mCachedGroupMetas.end()) + for(auto it3(group_infos.begin());it3!=group_infos.end();++it3) + if(mCachedGroupMetas.find(it3->first) == mCachedGroupMetas.end()) { - std::cerr << " adding new group " << it3->first << " " << it3->second.group_id << " \"" << it3->second.group_name << "\"" << std::endl; + std::cerr << " adding new group " << it3->first << " " + << it3->second.mGroupId << " \"" + << it3->second.mGroupName << "\"" << std::endl; - GroupItemInfo i ; - i.id = QString(it3->second.group_id.toStdString().c_str()) ; - i.name = QString::fromUtf8(it3->second.group_name.c_str()) ; - i.description = QString::fromUtf8(it3->second.group_description.c_str()) ; + GroupItemInfo i; + i.id = QString(it3->second.mGroupId.toStdString().c_str()); + i.name = QString::fromUtf8(it3->second.mGroupName.c_str()); i.popularity = 0; // could be set to the number of hits - i.lastpost = QDateTime::fromTime_t(it3->second.last_message_ts); + i.lastpost = QDateTime::fromTime_t(it3->second.mLastMessageTs); i.subscribeFlags = 0; // irrelevant here - i.publishKey = false ; // IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ; - i.adminKey = false ; // IS_GROUP_ADMIN(groupInfo.mSubscribeFlags) ; - i.max_visible_posts = it3->second.number_of_messages ; + i.publishKey = false ; // IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags); + i.adminKey = false ; // IS_GROUP_ADMIN(groupInfo.mSubscribeFlags); + i.max_visible_posts = it3->second.mNumberOfMessages; group_items.push_back(i); } From d9aa37219cc715fc8e8e255712d28e2558ec3e5b Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 22 Jul 2018 21:45:43 +0200 Subject: [PATCH 131/213] Revert "DROP before merge. Reduce INTEGRITY_CHECK_PERIOD" This reverts commit ce61174d79227588375678bfe446980420f50168. --- libretroshare/src/gxs/rsgenexchange.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 2630c7379..3927e6f61 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -59,10 +59,10 @@ static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key #define GXS_MASK "GXS_MASK_HACK" -#define GEN_EXCH_DEBUG 1 +//#define GEN_EXCH_DEBUG 1 static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes -static const uint32_t INTEGRITY_CHECK_PERIOD = 60*2; // 31 minutes // TODO: Restore this line before merging deep_search +static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns, RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs, From 51c25219bb965f2c2e5702664a229e48cae16c8c Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 22 Jul 2018 22:47:30 +0200 Subject: [PATCH 132/213] Fix compiling with old GCC --- libretroshare/src/gxs/rsgxsnetservice.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index b6fe8420d..bd68b53f7 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -243,7 +243,6 @@ #include #include #include -#include #include "rsgxsnetservice.h" #include "gxssecurity.h" @@ -262,6 +261,13 @@ # include "deep_search/deep_search.h" #endif +#include "util/cxx11retrocompat.h" +#if defined(GCC_VERSION) && GCC_VERSION > 50100 +# include +#else +# include +#endif + /*** * Use the following defines to debug: NXS_NET_DEBUG_0 shows group update high level information @@ -5303,9 +5309,15 @@ bool RsGxsNetService::search( const std::string& substring, s.mSignFlags = std::stoul(rit->second); if((rit = uQ.find("publishDate")) != uQ.end()) { + std::tm tm; memset(&tm, 0, sizeof(tm)); +#if defined(GCC_VERSION) && GCC_VERSION > 50100 std::istringstream ss(rit->second); - std::tm tm; ss >> std::get_time(&tm, "%Y%m%d"); +#else // defined(GCC_VERSION) && GCC_VERSION > 50100 + sscanf( rit->second.c_str(), + "%4d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday ); +#endif // defined(GCC_VERSION) && GCC_VERSION > 50100 + s.mPublishTs = mktime(&tm); } if((rit = uQ.find("authorId")) != uQ.end()) From 6f8c2f6f41af9b7b63795d662950669690f30a64 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 22 Jul 2018 23:39:06 +0200 Subject: [PATCH 133/213] Fix compilation if deep_search is disabled --- libretroshare/src/gxs/rsgxsnetservice.cc | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index bd68b53f7..12b218138 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5339,23 +5339,23 @@ bool RsGxsNetService::search( const std::string& substring, RS_STACK_MUTEX(mNxsMutex) ; mDataStore->retrieveGxsGrpMetaData(grpMetaMap); } - RsGroupNetworkStats stats ; - for(auto it(grpMetaMap.begin());it!=grpMetaMap.end();++it) + + RsGroupNetworkStats stats; + for(auto it(grpMetaMap.begin());it!=grpMetaMap.end();++it) if(termSearch(it->second->mGroupName,substring)) { - getGroupNetworkStats(it->first,stats) ; + getGroupNetworkStats(it->first,stats); - RsGxsGroupSummary s ; - s.group_id = it->first ; - s.group_name = it->second->mGroupName ; - // to be filled with something better when we use the real search - s.search_context = it->second->mGroupName ; - s.sign_flags = it->second->mSignFlags; - s.publish_ts = it->second->mPublishTs; - s.author_id = it->second->mAuthorId; - s.number_of_messages = stats.mMaxVisibleCount ; - s.last_message_ts = stats.mLastGroupModificationTS ; - s.popularity = it->second->mPop; + RsGxsGroupSummary s; + s.mGroupId = it->first; + s.mGroupName = it->second->mGroupName; + s.mSearchContext = it->second->mGroupName; + s.mSignFlags = it->second->mSignFlags; + s.mPublishTs = it->second->mPublishTs; + s.mAuthorId = it->second->mAuthorId; + s.mNumberOfMessages = stats.mMaxVisibleCount; + s.mLastMessageTs = stats.mLastGroupModificationTS; + s.mPopularity = it->second->mPop; group_infos.push_back(s); } From e8c9ba52b247bb32348d5b1c2f6b1fdf7d63d364 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 23 Jul 2018 11:18:32 +0200 Subject: [PATCH 134/213] Improve code quality after Cyril review --- libretroshare/src/deep_search/deep_search.h | 23 +++++++++++---------- libretroshare/src/gxs/rsgxsnetservice.cc | 22 ++------------------ libretroshare/src/gxs/rsgxsnettunnel.cc | 3 ++- libretroshare/src/gxs/rsgxsutil.cc | 2 +- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 914fce6a2..3fed67c01 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -99,11 +99,7 @@ struct DeepSearch // Index each field with a suitable prefix. termgenerator.index_text(chan.mMeta.mGroupName, 1, "G"); - - char date[] = "YYYYMMDD\0"; - std::strftime(date, 9, "%Y%m%d", std::gmtime(&chan.mMeta.mPublishTs)); - termgenerator.index_text(date, 1, "D"); - + termgenerator.index_text(timetToXapianDate(chan.mMeta.mPublishTs), 1, "D"); termgenerator.index_text(chan.mDescription, 1, "XD"); // Index fields without prefixes for general search. @@ -116,7 +112,7 @@ struct DeepSearch .setQueryKV("id", chan.mMeta.mGroupId.toStdString()); const std::string idTerm("Q" + chanUrl.toString()); - chanUrl.setQueryKV("publishDate", date); + chanUrl.setQueryKV("publishTs", std::to_string(chan.mMeta.mPublishTs)); chanUrl.setQueryKV("name", chan.mMeta.mGroupName); if(!chan.mMeta.mAuthorId.isNull()) chanUrl.setQueryKV("authorId", chan.mMeta.mAuthorId.toStdString()); @@ -164,10 +160,7 @@ struct DeepSearch // Index each field with a suitable prefix. termgenerator.index_text(post.mMeta.mMsgName, 1, "S"); - - char date[] = "YYYYMMDD\0"; - std::strftime(date, 9, "%Y%m%d", std::gmtime(&post.mMeta.mPublishTs)); - termgenerator.index_text(date, 1, "D"); + termgenerator.index_text(timetToXapianDate(post.mMeta.mPublishTs), 1, "D"); // Avoid indexing HTML bool isPlainMsg = post.mMsg[0] != '<' || post.mMsg[post.mMsg.size() - 1] != '>'; @@ -200,8 +193,9 @@ struct DeepSearch .setQueryKV("msgid", post.mMeta.mMsgId.toStdString()); std::string idTerm("Q" + postUrl.toString()); - postUrl.setQueryKV("publishDate", date); + postUrl.setQueryKV("publishTs", std::to_string(post.mMeta.mPublishTs)); postUrl.setQueryKV("name", post.mMeta.mMsgName); + postUrl.setQueryKV("authorId", post.mMeta.mAuthorId.toStdString()); std::string rsLink(postUrl.toString()); // store the RS link so we are able to retrive it on matching search @@ -247,5 +241,12 @@ private: RsAccounts::AccountDirectory() + "/deep_search_xapian_db"; return dbDir; } + + static std::string timetToXapianDate(const time_t& time) + { + char date[] = "YYYYMMDD\0"; + std::strftime(date, 9, "%Y%m%d", std::gmtime(&time)); + return date; + } }; diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 12b218138..8f4ee033c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -261,13 +261,6 @@ # include "deep_search/deep_search.h" #endif -#include "util/cxx11retrocompat.h" -#if defined(GCC_VERSION) && GCC_VERSION > 50100 -# include -#else -# include -#endif - /*** * Use the following defines to debug: NXS_NET_DEBUG_0 shows group update high level information @@ -5307,19 +5300,8 @@ bool RsGxsNetService::search( const std::string& substring, s.mGroupName = rit->second; if((rit = uQ.find("signFlags")) != uQ.end()) s.mSignFlags = std::stoul(rit->second); - if((rit = uQ.find("publishDate")) != uQ.end()) - { - std::tm tm; memset(&tm, 0, sizeof(tm)); -#if defined(GCC_VERSION) && GCC_VERSION > 50100 - std::istringstream ss(rit->second); - ss >> std::get_time(&tm, "%Y%m%d"); -#else // defined(GCC_VERSION) && GCC_VERSION > 50100 - sscanf( rit->second.c_str(), - "%4d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday ); -#endif // defined(GCC_VERSION) && GCC_VERSION > 50100 - - s.mPublishTs = mktime(&tm); - } + if((rit = uQ.find("publishTs")) != uQ.end()) + s.mPublishTs = static_cast(std::stoll(rit->second)); if((rit = uQ.find("authorId")) != uQ.end()) s.mAuthorId = RsGxsId(rit->second); diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index dfa0d8655..bbe10694b 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -61,8 +61,9 @@ const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE = 0x02 const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_RANDOM_BIAS = 0x03 ; const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_SUBSTRING = 0x04 ; const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_REQUEST = 0x05 ; -const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY = 0x06 ; +// const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY = 0x06; // DEPRECATED const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_DATA = 0x07 ; +const uint8_t RS_PKT_SUBTYPE_GXS_NET_TUNNEL_TURTLE_SEARCH_GROUP_SUMMARY = 0x08; class RsGxsNetTunnelItem: public RsItem { diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 2212ea311..2e7a69079 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -162,7 +162,7 @@ void RsGxsIntegrityCheck::run() bool RsGxsIntegrityCheck::check() { #ifdef RS_DEEP_SEARCH - bool isGxsChannels = dynamic_cast(mGenExchangeClient); + bool isGxsChannels = mGenExchangeClient->serviceType() == RS_SERVICE_GXS_TYPE_CHANNELS; std::set indexedGroups; #endif From 1bc518041cef1a28cd18cddd20ddc4d116a8b7a4 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 29 Jun 2018 16:03:09 +0200 Subject: [PATCH 135/213] Experiment of notification via NotifyClient + JSON API --- libretroshare/src/jsonapi/jsonapi.cpp | 69 +++++++++++++++++++- libretroshare/src/jsonapi/jsonapi.h | 21 ++++-- libretroshare/src/retroshare/rsnotify.h | 66 +++++++++---------- libretroshare/src/retroshare/rsturtle.h | 31 +++++++-- libretroshare/src/serialiser/rsbaseserial.cc | 5 +- 5 files changed, 142 insertions(+), 50 deletions(-) diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index 0f298ffc5..ee4ef1158 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -18,19 +18,40 @@ #include "jsonapi.h" +#include +#include +#include + // Generated at compile time #include "jsonapi-wrappers.h" JsonApiServer::JsonApiServer( uint16_t port, const std::function shutdownCallback) : - mPort(port), mShutdownCallback(shutdownCallback) + mPort(port), mShutdownCallback(shutdownCallback), notifyClientWrapper(*this) { registerHandler("/jsonApiServer/shutdown", - [this](const std::shared_ptr) + [this](const std::shared_ptr) { shutdown(); }); + registerHandler("/jsonApiServer/notifications", + [this](const std::shared_ptr session) + { + const auto headers = std::multimap + { + { "Connection", "keep-alive" }, + { "Cache-Control", "no-cache" }, + { "Content-Type", "text/event-stream" }, + }; + + session->yield(rb::OK, headers, + [this](const std::shared_ptr session) + { + notifySessions.push_back(session); + } ); + } ); + // Generated at compile time #include "jsonapi-register.inl" } @@ -59,3 +80,47 @@ void JsonApiServer::shutdown(int exitCode) mService.stop(); mShutdownCallback(exitCode); } + +void JsonApiServer::cleanClosedNotifySessions() +{ + notifySessions.erase( + std::remove_if( + notifySessions.begin(), notifySessions.end(), + [](const std::shared_ptr &s) + { return s->is_closed(); } ), notifySessions.end()); +} + +JsonApiServer::NotifyClientWrapper::NotifyClientWrapper(JsonApiServer& parent) : + NotifyClient(), mJsonApiServer(parent) +{ + rsNotify->registerNotifyClient(static_cast(this)); +} + +void JsonApiServer::NotifyClientWrapper::notifyTurtleSearchResult( + uint32_t searchId, const std::list& files ) +{ + mJsonApiServer.cleanClosedNotifySessions(); + + RsGenericSerializer::SerializeContext cAns; + RsJson& jAns(cAns.mJson); + + // serialize parameters and method name to JSON + { + std::string methodName("NotifyClient/notifyTurtleSearchResult"); + std::list filesCopy(files); + RsGenericSerializer::SerializeContext& ctx(cAns); + RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON); + RS_SERIAL_PROCESS(methodName); + RS_SERIAL_PROCESS(searchId); +// RS_SERIAL_PROCESS(filesCopy); + } + + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + jAns.Accept(writer); + std::string message(buffer.GetString(), buffer.GetSize()); + message.insert(0, "data: "); message.append("\n\n"); + + for(auto session : mJsonApiServer.notifySessions) + session->yield(message); +} diff --git a/libretroshare/src/jsonapi/jsonapi.h b/libretroshare/src/jsonapi/jsonapi.h index 9c321c22a..bb3f78378 100644 --- a/libretroshare/src/jsonapi/jsonapi.h +++ b/libretroshare/src/jsonapi/jsonapi.h @@ -19,16 +19,12 @@ #include #include #include -#include -#include "retroshare/rsgxschannels.h" -#include "serialiser/rstypeserializer.h" #include "util/rsthreads.h" +#include "retroshare/rsnotify.h" namespace rb = restbed; -void apiVersionHandler(const std::shared_ptr session); -void createChannelHandler(const std::shared_ptr session); /** * Simple usage @@ -74,5 +70,20 @@ private: uint16_t mPort; rb::Service mService; const std::function mShutdownCallback; + + std::list > notifySessions; + void cleanClosedNotifySessions(); + + struct NotifyClientWrapper : NotifyClient + { + NotifyClientWrapper(JsonApiServer& parent); + + void notifyTurtleSearchResult( + uint32_t searchId, const std::list& files); + + private: + JsonApiServer& mJsonApiServer; + }; + NotifyClientWrapper notifyClientWrapper; }; diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index 6c916e034..bba4ff959 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -181,7 +181,7 @@ class RsFeedItem // This mechanism can be used in plugins, new services, etc. // -class NotifyClient ; +struct NotifyClient; class RsNotify { @@ -206,44 +206,42 @@ class RsNotify virtual bool setDisableAskPassword (const bool /*bValue*/) { return false ; } }; -class NotifyClient +struct NotifyClient { - public: - NotifyClient() {} - virtual ~NotifyClient() {} + NotifyClient() {} + virtual ~NotifyClient() {} - virtual void notifyListPreChange (int /* list */, int /* type */) {} - virtual void notifyListChange (int /* list */, int /* type */) {} - virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {} - virtual void notifyChatMessage (const ChatMessage& /* msg */) {} - virtual void notifyChatStatus (const ChatId& /* chat_id */, const std::string& /* status_string */) {} - virtual void notifyChatCleared (const ChatId& /* chat_id */) {} - virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const RsGxsId& /* nickname */,const std::string& /* any string */) {} - virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {} - virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {} - virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {} - virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) {} + virtual void notifyListPreChange (int /* list */, int /* type */) {} + virtual void notifyListChange (int /* list */, int /* type */) {} + virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {} + virtual void notifyChatMessage (const ChatMessage& /* msg */) {} + virtual void notifyChatStatus (const ChatId& /* chat_id */, const std::string& /* status_string */) {} + virtual void notifyChatCleared (const ChatId& /* chat_id */) {} + virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const RsGxsId& /* nickname */,const std::string& /* any string */) {} + virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {} + virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {} + virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {} + virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) {} #warning MISSING CODE HERE - // virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) {} - virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {} - virtual void notifyOwnAvatarChanged () {} - virtual void notifyOwnStatusMessageChanged () {} - virtual void notifyDiskFull (uint32_t /* location */, uint32_t /* size limit in MB */) {} - virtual void notifyPeerStatusChanged (const std::string& /* peer_id */, uint32_t /* status */) {} - virtual void notifyGxsChange (const RsGxsChanges& /* changes */) {} - virtual void notifyConnectionWithoutCert () {} + // virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) {} + virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {} + virtual void notifyOwnAvatarChanged () {} + virtual void notifyOwnStatusMessageChanged () {} + virtual void notifyDiskFull (uint32_t /* location */, uint32_t /* size limit in MB */) {} + virtual void notifyPeerStatusChanged (const std::string& /* peer_id */, uint32_t /* status */) {} + virtual void notifyGxsChange (const RsGxsChanges& /* changes */) {} + virtual void notifyConnectionWithoutCert () {} - /* one or more peers has changed the states */ - virtual void notifyPeerStatusChangedSummary () {} - virtual void notifyDiscInfoChanged () {} + /* one or more peers has changed the states */ + virtual void notifyPeerStatusChangedSummary () {} + virtual void notifyDiscInfoChanged () {} - virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result , std::string /*reason = ""*/) { signature_result = false ;return true; } - virtual void notifyDownloadComplete (const std::string& /* fileHash */) {} - virtual void notifyDownloadCompleteCount (uint32_t /* count */) {} - virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {} - - virtual bool askForPassword (const std::string& /* title */, const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;} - virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */,bool /* first_time */) { return false ;} + virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result , std::string /*reason = ""*/) { signature_result = false ;return true; } + virtual void notifyDownloadComplete (const std::string& /* fileHash */) {} + virtual void notifyDownloadCompleteCount (uint32_t /* count */) {} + virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {} + virtual bool askForPassword (const std::string& /* title */, const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;} + virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */,bool /* first_time */) { return false ;} }; #endif diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 91cc75adc..c183e454c 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -29,12 +29,18 @@ #include "serialiser/rstlvbinary.h" #include "retroshare/rstypes.h" #include "retroshare/rsgxsifacetypes.h" +#include "serialiser/rsserializable.h" namespace RsRegularExpression { class LinearizedExpression ; } class RsTurtleClientService ; class RsTurtle; -extern RsTurtle *rsTurtle ; + +/** + * Pointer to global instance of RsTurtle service implementation + * @jsonapi{development} + */ +extern RsTurtle* rsTurtle; typedef uint32_t TurtleRequestId ; typedef RsPeerId TurtleVirtualPeerId; @@ -42,11 +48,20 @@ typedef RsPeerId TurtleVirtualPeerId; // This is the structure used to send back results of the turtle search // to the notifyBase class, or send info to the GUI. -struct TurtleFileInfo +struct TurtleFileInfo //: RsSerializable { - RsFileHash hash ; - std::string name ; - uint64_t size ; + RsFileHash hash; + std::string name; + uint64_t size; +/* + /// @see RsSerializable::serial_process + void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RS_SERIAL_PROCESS(hash); + RS_SERIAL_PROCESS(name); + RS_SERIAL_PROCESS(size); + }*/ }; struct TurtleTunnelRequestDisplayInfo @@ -90,7 +105,7 @@ class TurtleTrafficStatisticsInfo // class RsTurtle { - public: +public: RsTurtle() {} virtual ~RsTurtle() {} @@ -106,7 +121,9 @@ class RsTurtle // the request id, which will be further used by the gui to store results // as they come back. // - virtual TurtleRequestId turtleSearch(unsigned char *search_bin_data,uint32_t search_bin_data_len,RsTurtleClientService *client_service) =0; + virtual TurtleRequestId turtleSearch( + unsigned char *search_bin_data, uint32_t search_bin_data_len, + RsTurtleClientService* client_service ) = 0; // Initiates tunnel handling for the given file hash. tunnels. Launches // an exception if an error occurs during the initialization process. The diff --git a/libretroshare/src/serialiser/rsbaseserial.cc b/libretroshare/src/serialiser/rsbaseserial.cc index a5b84518f..65528c801 100644 --- a/libretroshare/src/serialiser/rsbaseserial.cc +++ b/libretroshare/src/serialiser/rsbaseserial.cc @@ -244,9 +244,10 @@ bool getRawString(const void *data, uint32_t size, uint32_t *offset, std::string } /* check there is space for string */ - if(len > size || size-len < *offset) // better than if(size < *offset + len) because it avoids integer overflow + if(len > size || size-len < *offset) // better than if(size < *offset + len) because it avoids integer overflow { - std::cerr << "getRawString() not enough size" << std::endl; + std::cerr << "getRawString() not enough size" << std::endl; + print_stacktrace(); return false; } uint8_t *buf = &(((uint8_t *) data)[*offset]); From 3272ee07198d97bf10a9c97f16d548879f6a670b Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 23 Jul 2018 17:20:13 +0200 Subject: [PATCH 136/213] disabled compilation of cmark until it gets fixed --- retroshare-gui/src/retroshare-gui.pro | 3 ++- retroshare-gui/src/util/HandleRichText.cpp | 7 +++++++ retroshare.pri | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index b51139ea4..8899de337 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -2,7 +2,7 @@ TEMPLATE = app QT += network xml -CONFIG += qt gui uic qrc resources idle cmark +CONFIG += qt gui uic qrc resources idle CONFIG += console TARGET = retroshare DEFINES += TARGET=\\\"$${TARGET}\\\" @@ -1371,6 +1371,7 @@ gxsgui { } cmark { + DEFINES *= USE_CMARK HEADERS += \ ../../supportlibs/cmark/src/buffer.h \ diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 046ea47a6..8f7f158ab 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -38,9 +38,14 @@ #include "util/imageutil.h" #include "util/rstime.h" +// #define USE_CMARK + +#ifdef USE_CMARK //Include for CMark +// This needs to be fixed: use system library if available, etc. #include #include +#endif #include @@ -586,6 +591,7 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo // Save Space and Tab because doc loose it. formattedText=saveSpace(formattedText); +#ifdef USE_CMARK if (flag & RSHTML_FORMATTEXT_USE_CMARK) { // Transform html to plain text QTextBrowser textBrowser; @@ -608,6 +614,7 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo textBrowser.setHtml(formattedText); formattedText=textBrowser.toHtml(); } +#endif QString errorMsg; int errorLine; int errorColumn; diff --git a/retroshare.pri b/retroshare.pri index 901df373a..79527a7c8 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -30,11 +30,19 @@ no_retroshare_gui:CONFIG -= retroshare_gui CONFIG *= gxsdistsync +# disabled by the time we fix compilation +CONFIG *= no_cmark + # To disable RetroShare-nogui append the following # assignation to qmake command line "CONFIG+=no_retroshare_nogui" CONFIG *= retroshare_nogui no_retroshare_nogui:CONFIG -= retroshare_nogui +# To disable cmark append the following +# assignation to qmake command line "CONFIG+=no_cmark" +CONFIG *= cmark +no_cmark:CONFIG -= cmark + # To enable RetroShare plugins append the following # assignation to qmake command line "CONFIG+=retroshare_plugins" CONFIG *= no_retroshare_plugins From e2bb3aef1ba0437c9d72ab61a3c76c00d41a72e4 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 23 Jul 2018 17:20:57 +0200 Subject: [PATCH 137/213] disabled compilation of cmark until it gets fixed --- retroshare-gui/src/util/HandleRichText.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 8f7f158ab..fad9ea8f9 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -38,8 +38,6 @@ #include "util/imageutil.h" #include "util/rstime.h" -// #define USE_CMARK - #ifdef USE_CMARK //Include for CMark // This needs to be fixed: use system library if available, etc. From b85359d60a741b1a6439e0b86e9ccfd959849f5f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 24 Jul 2018 14:24:50 +0200 Subject: [PATCH 138/213] Added missing include to TurtleRouterDialog.cpp --- retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index b81264e77..53c008016 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -10,6 +10,7 @@ #include #include #include // for sort +#include #include "gui/settings/rsharesettings.h" From 7128a04525d3c21beb446f28c0233e3e826199f1 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 23 Jul 2018 21:54:07 +0200 Subject: [PATCH 139/213] Added Xapian to Windows build environment --- build_scripts/Windows/build-libs/Makefile | 30 +++++++++++++++++++++-- libretroshare/src/use_libretroshare.pri | 1 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/build_scripts/Windows/build-libs/Makefile b/build_scripts/Windows/build-libs/Makefile index 6ed67ed56..697d4c286 100755 --- a/build_scripts/Windows/build-libs/Makefile +++ b/build_scripts/Windows/build-libs/Makefile @@ -13,12 +13,13 @@ SQLCIPHER_VERSION=2.2.1 LIBMICROHTTPD_VERSION=0.9.59 FFMPEG_VERSION=3.4 RAPIDJSON_VERSION=1.1.0 +XAPIAN_VERSION=1.4.7 DOWNLOAD_PATH?=download BUILD_PATH=build LIBS_PATH?=libs -all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson copylibs +all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian copylibs download: \ $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \ @@ -35,7 +36,8 @@ download: \ $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \ $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \ $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz \ - $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz + $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz \ + $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz clean: rm -r -f $(BUILD_PATH) @@ -360,6 +362,30 @@ $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION): $(DOWNLOAD_PATH)/rapidjson-$(RAPID rm -r -f rapidjson-$(RAPIDJSON_VERSION) mv $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION) +xapian: $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION) + +$(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz: + wget --no-check-certificate https://oligarchy.co.uk/xapian/$(XAPIAN_VERSION)/xapian-core-$(XAPIAN_VERSION).tar.xz -O $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz + +$(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION): $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz + # prepare + rm -r -f $(BUILD_PATH)/xapian-core-* + tar xvf $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz + # build + #cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp" + #cd xapian-core-$(XAPIAN_VERSION) && make install + cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static + cd xapian-core-$(XAPIAN_VERSION) && make + # copy files + mkdir -p $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include + cp -r xapian-core-$(XAPIAN_VERSION)/include/* $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include/ + rm $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include/Makefile* + mkdir -p $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/lib + cp -r xapian-core-$(XAPIAN_VERSION)/.libs/libxapian.a $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/lib/ + # cleanup + rm -r -f xapian-core-$(XAPIAN_VERSION) + mv $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION) + copylibs: rm -r -f $(LIBS_PATH) ; \ mkdir -p $(LIBS_PATH) ; \ diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index ef7f1877f..d613a2aa3 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -53,6 +53,7 @@ linux-* { rs_deep_search { mLibs += xapian + win32-g++:mLibs += rpcrt4 } static { From e6acb52d17895e09297340db3c5444e7a7482ecd Mon Sep 17 00:00:00 2001 From: sehraf Date: Thu, 28 Jun 2018 20:32:53 +0200 Subject: [PATCH 140/213] add simple chat support --- libretroshare/src/retroshare/rsmsgs.h | 330 +++++++++++++++++++++----- 1 file changed, 268 insertions(+), 62 deletions(-) diff --git a/libretroshare/src/retroshare/rsmsgs.h b/libretroshare/src/retroshare/rsmsgs.h index 340606bb8..a459a489c 100644 --- a/libretroshare/src/retroshare/rsmsgs.h +++ b/libretroshare/src/retroshare/rsmsgs.h @@ -92,7 +92,7 @@ const ChatLobbyFlags RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ( 0x00000010 ) ; // requi typedef uint64_t ChatLobbyId ; typedef uint64_t ChatLobbyMsgId ; -typedef std::string ChatLobbyNickName ; +typedef std::string ChatLobbyNickName ; typedef uint64_t MessageId ; @@ -279,7 +279,7 @@ struct DistantChatPeerInfo // Identifier for an chat endpoint like // neighbour peer, distant peer, chatlobby, broadcast -class ChatId +class ChatId : RsSerializable { public: ChatId(); @@ -310,17 +310,28 @@ public: // this defines from which peer the status string came from RsPeerId broadcast_status_peer_id; private: - enum Type { TYPE_NOT_SET, - TYPE_PRIVATE, // private chat with directly connected friend, peer_id is valid - TYPE_PRIVATE_DISTANT, // private chat with distant peer, gxs_id is valid - TYPE_LOBBY, // chat lobby id, lobby_id is valid - TYPE_BROADCAST // message to/from all connected peers - }; + enum Type : uint8_t + { TYPE_NOT_SET, + TYPE_PRIVATE, // private chat with directly connected friend, peer_id is valid + TYPE_PRIVATE_DISTANT, // private chat with distant peer, gxs_id is valid + TYPE_LOBBY, // chat lobby id, lobby_id is valid + TYPE_BROADCAST // message to/from all connected peers + }; Type type; RsPeerId peer_id; DistantChatPeerId distant_chat_id; ChatLobbyId lobby_id; + + // RsSerializable interface +public: + void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) { + RS_SERIAL_PROCESS(broadcast_status_peer_id); + RS_SERIAL_PROCESS(type); + RS_SERIAL_PROCESS(peer_id); + RS_SERIAL_PROCESS(distant_chat_id); + RS_SERIAL_PROCESS(lobby_id); + } }; class ChatMessage @@ -340,49 +351,90 @@ public: //bool system_message; }; -class ChatLobbyInvite +class ChatLobbyInvite : RsSerializable { - public: - ChatLobbyId lobby_id ; - RsPeerId peer_id ; - std::string lobby_name ; - std::string lobby_topic ; - ChatLobbyFlags lobby_flags ; +public: + ChatLobbyId lobby_id ; + RsPeerId peer_id ; + std::string lobby_name ; + std::string lobby_topic ; + ChatLobbyFlags lobby_flags ; + + // RsSerializable interface +public: + void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) { + RS_SERIAL_PROCESS(lobby_id); + RS_SERIAL_PROCESS(peer_id); + RS_SERIAL_PROCESS(lobby_name); + RS_SERIAL_PROCESS(lobby_topic); + RS_SERIAL_PROCESS(lobby_flags); + } }; -class VisibleChatLobbyRecord +class VisibleChatLobbyRecord : RsSerializable { public: VisibleChatLobbyRecord(): lobby_id(0), total_number_of_peers(0), last_report_time(0){} - ChatLobbyId lobby_id ; // unique id of the lobby - std::string lobby_name ; // name to use for this lobby - std::string lobby_topic ; // topic to use for this lobby - std::set participating_friends ; // list of direct friend who participate. + ChatLobbyId lobby_id ; // unique id of the lobby + std::string lobby_name ; // name to use for this lobby + std::string lobby_topic ; // topic to use for this lobby + std::set participating_friends ; // list of direct friend who participate. - uint32_t total_number_of_peers ; // total number of particpating peers. Might not be - time_t last_report_time ; // last time the lobby was reported. - ChatLobbyFlags lobby_flags ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE + uint32_t total_number_of_peers ; // total number of particpating peers. Might not be + time_t last_report_time ; // last time the lobby was reported. + ChatLobbyFlags lobby_flags ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE + + // RsSerializable interface +public: + void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) { + RS_SERIAL_PROCESS(lobby_id); + RS_SERIAL_PROCESS(lobby_name); + RS_SERIAL_PROCESS(lobby_topic); + RS_SERIAL_PROCESS(participating_friends); + + RS_SERIAL_PROCESS(total_number_of_peers); + RS_SERIAL_PROCESS(last_report_time); + RS_SERIAL_PROCESS(lobby_flags); + } }; -class ChatLobbyInfo +class ChatLobbyInfo : RsSerializable { - public: - ChatLobbyId lobby_id ; // unique id of the lobby - std::string lobby_name ; // name to use for this lobby - std::string lobby_topic ; // topic to use for this lobby - std::set participating_friends ; // list of direct friend who participate. Used to broadcast sent messages. - RsGxsId gxs_id ; // ID to sign messages +public: + ChatLobbyId lobby_id ; // unique id of the lobby + std::string lobby_name ; // name to use for this lobby + std::string lobby_topic ; // topic to use for this lobby + std::set participating_friends ; // list of direct friend who participate. Used to broadcast sent messages. + RsGxsId gxs_id ; // ID to sign messages - ChatLobbyFlags lobby_flags ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE - std::map gxs_ids ; // list of non direct friend who participate. Used to display only. - time_t last_activity ; // last recorded activity. Useful for removing dead lobbies. + ChatLobbyFlags lobby_flags ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE + std::map gxs_ids ; // list of non direct friend who participate. Used to display only. + time_t last_activity ; // last recorded activity. Useful for removing dead lobbies. + + // RsSerializable interface +public: + void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) { + RS_SERIAL_PROCESS(lobby_id); + RS_SERIAL_PROCESS(lobby_name); + RS_SERIAL_PROCESS(lobby_topic); + RS_SERIAL_PROCESS(participating_friends); + RS_SERIAL_PROCESS(gxs_id); + + RS_SERIAL_PROCESS(lobby_flags); + RS_SERIAL_PROCESS(gxs_ids); + RS_SERIAL_PROCESS(last_activity); + } }; std::ostream &operator<<(std::ostream &out, const Rs::Msgs::MessageInfo &info); class RsMsgs; +/** + * @brief Pointer to retroshare's message service + * @jsonapi{development} + */ extern RsMsgs *rsMsgs; class RsMsgs @@ -438,15 +490,59 @@ virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags) = 0; // sendChat for broadcast, private, lobby and private distant chat // note: for lobby chat, you first have to subscribe to a lobby // for private distant chat, it is reqired to have an active distant chat session -virtual bool sendChat(ChatId id, std::string msg) = 0; -virtual uint32_t getMaxMessageSecuritySize(int type) = 0; -virtual void sendStatusString(const ChatId& id,const std::string& status_string) = 0; -virtual void clearChatLobby(const ChatId& id) = 0; + /** + * @brief sendChat send a chat message to a given id + * @jsonapi{development} + * @param[in] id id to send the message + * @param[in] msg message to send + * @return true on success + */ + virtual bool sendChat(ChatId id, std::string msg) = 0; -virtual void setCustomStateString(const std::string& status_string) = 0 ; -virtual std::string getCustomStateString() = 0 ; -virtual std::string getCustomStateString(const RsPeerId& peer_id) = 0 ; + /** + * @brief getMaxMessageSecuritySize get the maximum size of a chta message + * @jsonapi{development} + * @param[in] type chat type + * @return maximum size or zero for infinite + */ + virtual uint32_t getMaxMessageSecuritySize(int type) = 0; + + /** + * @brief sendStatusString send a status string + * @jsonapi{development} + * @param[in] id chat id to send the status string to + * @param[in] status_string status string + */ + virtual void sendStatusString(const ChatId &id, const std::string &status_string) = 0; + + /** + * @brief clearChatLobby clear a chat lobby + * @jsonapi{development} + * @param[in] id chat lobby id to clear + */ + virtual void clearChatLobby(const ChatId &id) = 0; + + /** + * @brief setCustomStateString set your custom status message + * @jsonapi{development} + * @param[in] status_string status message + */ + virtual void setCustomStateString(const std::string &status_string) = 0; + + /** + * @brief getCustomStateString get your custom status message + * @return status message + */ + virtual std::string getCustomStateString() = 0; + + /** + * @brief getCustomStateString get the custom status message from a peer + * @jsonapi{development} + * @param[in] peer_id peer id to the peer you want to get the status message from + * @return status message + */ + virtual std::string getCustomStateString(const RsPeerId &peer_id) = 0; // get avatar data for peer pid virtual void getAvatarData(const RsPeerId& pid,unsigned char *& data,int& size) = 0 ; @@ -454,29 +550,139 @@ virtual void getAvatarData(const RsPeerId& pid,unsigned char *& data,int& size) virtual void setOwnAvatarData(const unsigned char *data,int size) = 0 ; virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ; -/****************************************/ -/* Chat lobbies */ -/****************************************/ + /****************************************/ + /* Chat lobbies */ + /****************************************/ + /** + * @brief joinVisibleChatLobby join a lobby that is visible + * @jsonapi{development} + * @param[in] lobby_id lobby to join to + * @param[in] own_id chat id to use + * @return true on success + */ + virtual bool joinVisibleChatLobby(const ChatLobbyId &lobby_id, const RsGxsId &own_id) = 0 ; -virtual bool joinVisibleChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& own_id) = 0 ; -/// get ids of subscribed lobbies -virtual void getChatLobbyList(std::list& cl_list) = 0; -/// get lobby info of a subscribed chat lobby. Returns true if lobby id is valid. -virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) = 0 ; -/// get info about all lobbies, subscribed and unsubscribed -virtual void getListOfNearbyChatLobbies(std::vector& public_lobbies) = 0 ; -virtual void invitePeerToLobby(const ChatLobbyId& lobby_id,const RsPeerId& peer_id) = 0; -virtual bool acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& identity) = 0 ; -virtual void denyLobbyInvite(const ChatLobbyId& id) = 0 ; -virtual void getPendingChatLobbyInvites(std::list& invites) = 0; -virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) = 0; -virtual bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& nick) = 0; -virtual bool getIdentityForChatLobby(const ChatLobbyId& lobby_id,RsGxsId& nick) = 0 ; -virtual bool setDefaultIdentityForChatLobby(const RsGxsId& nick) = 0; -virtual void getDefaultIdentityForChatLobby(RsGxsId& id) = 0 ; -virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe) = 0 ; -virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id) = 0 ; -virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set& invited_friends,ChatLobbyFlags lobby_privacy_type) = 0 ; + /** + * @brief getChatLobbyList get ids of subscribed lobbies + * @jsonapi{development} + * @param[out] cl_list lobby list + */ + virtual void getChatLobbyList(std::list &cl_list) = 0; + + /** + * @brief getChatLobbyInfo get lobby info of a subscribed chat lobby. Returns true if lobby id is valid. + * @jsonapi{development} + * @param[in] id id to get infos from + * @param[out] info lobby infos + * @return true on success + */ + virtual bool getChatLobbyInfo(const ChatLobbyId &id, ChatLobbyInfo &info) = 0 ; + + /** + * @brief getListOfNearbyChatLobbies get info about all lobbies, subscribed and unsubscribed + * @jsonapi{development} + * @param[out] public_lobbies list of all visible lobbies + */ + virtual void getListOfNearbyChatLobbies(std::vector &public_lobbies) = 0 ; + + /** + * @brief invitePeerToLobby invite a peer to join a lobby + * @jsonapi{development} + * @param[in] lobby_id lobby it to invite into + * @param[in] peer_id peer to invite + */ + virtual void invitePeerToLobby(const ChatLobbyId &lobby_id, const RsPeerId &peer_id) = 0; + + /** + * @brief acceptLobbyInvite accept a chat invite + * @jsonapi{development} + * @param[in] id chat lobby id you were invited into and you want to join + * @param[in] identity chat identity to use + * @return true on success + */ + virtual bool acceptLobbyInvite(const ChatLobbyId &id, const RsGxsId &identity) = 0 ; + + /** + * @brief denyLobbyInvite deny a chat lobby invite + * @jsonapi{development} + * @param[in] id chat lobby id you were invited into + */ + virtual void denyLobbyInvite(const ChatLobbyId &id) = 0 ; + + /** + * @brief getPendingChatLobbyInvites get a list of all pending chat lobby invites + * @jsonapi{development} + * @param[out] invites list of all pending chat lobby invites + */ + virtual void getPendingChatLobbyInvites(std::list &invites) = 0; + + /** + * @brief unsubscribeChatLobby leave a chat lobby + * @jsonapi{development} + * @param[in] lobby_id lobby to leave + */ + virtual void unsubscribeChatLobby(const ChatLobbyId &lobby_id) = 0; + + /** + * @brief setIdentityForChatLobby set the chat identit + * @jsonapi{development} + * @param[in] lobby_id lobby to change the chat idnetity for + * @param[in] nick new chat identity + * @return true on success + */ + virtual bool setIdentityForChatLobby(const ChatLobbyId &lobby_id, const RsGxsId &nick) = 0; + + /** + * @brief getIdentityForChatLobby + * @jsonapi{development} + * @param[in] lobby_id lobby to get the chat id from + * @param[out] nick chat identity + * @return true on success + */ + virtual bool getIdentityForChatLobby(const ChatLobbyId &lobby_id, RsGxsId &nick) = 0 ; + + /** + * @brief setDefaultIdentityForChatLobby set the default identity used for chat lobbies + * @jsonapi{development} + * @param[in] nick chat identitiy to use + * @return true on success + */ + virtual bool setDefaultIdentityForChatLobby(const RsGxsId &nick) = 0; + + /** + * @brief getDefaultIdentityForChatLobby get the default identity used for chat lobbies + * @jsonapi{development} + * @param[out] id chat identitiy to use + */ + virtual void getDefaultIdentityForChatLobby(RsGxsId &id) = 0 ; + + /** + * @brief setLobbyAutoSubscribe enable or disable auto subscribe for a chat lobby + * @jsonapi{development} + * @param[in] lobby_id lobby to auto (un)subscribe + * @param[in] autoSubscribe set value for auto subscribe + */ + virtual void setLobbyAutoSubscribe(const ChatLobbyId &lobby_id, const bool autoSubscribe) = 0 ; + + /** + * @brief getLobbyAutoSubscribe get current value of auto subscribe + * @jsonapi{development} + * @param[in] lobby_id lobby to get value from + * @return wether lobby has auto subscribe enabled or disabled + */ + virtual bool getLobbyAutoSubscribe(const ChatLobbyId &lobby_id) = 0 ; + + /** + * @brief createChatLobby create a new chat lobby + * @jsonapi{development} + * @param[in] lobby_name lobby name + * @param[in] lobby_identity chat id to use for new lobby + * @param[in] lobby_topic lobby toppic + * @param[in] invited_friends list of friends to invite + * @param[in] lobby_privacy_type flag for new chat lobby + * @return chat id of new lobby + */ + virtual ChatLobbyId createChatLobby(const std::string &lobby_name, const RsGxsId &lobby_identity, const std::string &lobby_topic, const std::set &invited_friends, ChatLobbyFlags lobby_privacy_type) = 0 ; /****************************************/ /* Distant chat */ From a21c2724f5bb958e02ed0cf0c631d67b4ebf2aeb Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 23 Jul 2018 17:20:13 +0200 Subject: [PATCH 141/213] disabled compilation of cmark until it gets fixed --- retroshare-gui/src/retroshare-gui.pro | 3 ++- retroshare-gui/src/util/HandleRichText.cpp | 7 +++++++ retroshare.pri | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index b51139ea4..8899de337 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -2,7 +2,7 @@ TEMPLATE = app QT += network xml -CONFIG += qt gui uic qrc resources idle cmark +CONFIG += qt gui uic qrc resources idle CONFIG += console TARGET = retroshare DEFINES += TARGET=\\\"$${TARGET}\\\" @@ -1371,6 +1371,7 @@ gxsgui { } cmark { + DEFINES *= USE_CMARK HEADERS += \ ../../supportlibs/cmark/src/buffer.h \ diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 046ea47a6..8f7f158ab 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -38,9 +38,14 @@ #include "util/imageutil.h" #include "util/rstime.h" +// #define USE_CMARK + +#ifdef USE_CMARK //Include for CMark +// This needs to be fixed: use system library if available, etc. #include #include +#endif #include @@ -586,6 +591,7 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo // Save Space and Tab because doc loose it. formattedText=saveSpace(formattedText); +#ifdef USE_CMARK if (flag & RSHTML_FORMATTEXT_USE_CMARK) { // Transform html to plain text QTextBrowser textBrowser; @@ -608,6 +614,7 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo textBrowser.setHtml(formattedText); formattedText=textBrowser.toHtml(); } +#endif QString errorMsg; int errorLine; int errorColumn; diff --git a/retroshare.pri b/retroshare.pri index 34f6dfee6..b448f6b24 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -30,11 +30,19 @@ no_retroshare_gui:CONFIG -= retroshare_gui CONFIG *= gxsdistsync +# disabled by the time we fix compilation +CONFIG *= no_cmark + # To disable RetroShare-nogui append the following # assignation to qmake command line "CONFIG+=no_retroshare_nogui" CONFIG *= retroshare_nogui no_retroshare_nogui:CONFIG -= retroshare_nogui +# To disable cmark append the following +# assignation to qmake command line "CONFIG+=no_cmark" +CONFIG *= cmark +no_cmark:CONFIG -= cmark + # To enable RetroShare plugins append the following # assignation to qmake command line "CONFIG+=retroshare_plugins" CONFIG *= no_retroshare_plugins From f6ca7b2a07761efddc431e739838cd9b7be704f6 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 23 Jul 2018 17:20:57 +0200 Subject: [PATCH 142/213] disabled compilation of cmark until it gets fixed --- retroshare-gui/src/util/HandleRichText.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 8f7f158ab..fad9ea8f9 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -38,8 +38,6 @@ #include "util/imageutil.h" #include "util/rstime.h" -// #define USE_CMARK - #ifdef USE_CMARK //Include for CMark // This needs to be fixed: use system library if available, etc. From 7af507589185938b7aa73e0e3b89d11d36f71262 Mon Sep 17 00:00:00 2001 From: sehraf Date: Tue, 24 Jul 2018 20:59:04 +0200 Subject: [PATCH 143/213] fix jsonapi.h --- libretroshare/src/jsonapi/jsonapi.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/jsonapi/jsonapi.h b/libretroshare/src/jsonapi/jsonapi.h index 9c321c22a..ad0576b1f 100644 --- a/libretroshare/src/jsonapi/jsonapi.h +++ b/libretroshare/src/jsonapi/jsonapi.h @@ -19,7 +19,12 @@ #include #include #include -#include + +#ifdef HAS_RAPIDJSON + #include +#else + #include +#endif // HAS_RAPIDJSON #include "retroshare/rsgxschannels.h" #include "serialiser/rstypeserializer.h" From 0f758902cde48dac9b8de553aeb5189e9e0adec7 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 24 Jul 2018 23:47:32 +0200 Subject: [PATCH 144/213] started cleaning the mess with rsAccounts: only exposed useful functionality of rsAccount beyond a static class and removed all references to rsAccounts in the code --- libresapi/src/api/ApiServerMHD.cpp | 2 +- libresapi/src/api/RsControlModule.cpp | 2 +- libretroshare/src/file_sharing/hash_cache.cc | 3 +- libretroshare/src/file_sharing/p3filelists.cc | 4 +- libretroshare/src/ft/ftserver.cc | 7 +- libretroshare/src/retroshare/rsinit.h | 89 ++++++++---- libretroshare/src/rsserver/rsaccounts.cc | 94 +++++++++--- libretroshare/src/rsserver/rsaccounts.h | 53 +++---- libretroshare/src/rsserver/rsinit.cc | 136 ++++++++---------- libretroshare/src/rsserver/rsloginhandler.cc | 6 +- libretroshare/src/util/rsdiscspace.cc | 6 +- plugins/VOIP/VOIPPlugin.cpp | 2 +- retroshare-gui/src/gui/GenCertDialog.cpp | 2 +- retroshare-gui/src/gui/SoundManager.cpp | 2 +- retroshare-gui/src/gui/chat/ChatStyle.cpp | 2 +- .../src/gui/common/RSTextBrowser.cpp | 2 +- retroshare-gui/src/lang/languagesupport.cpp | 2 +- retroshare-gui/src/main.cpp | 75 +++++----- retroshare-gui/src/rshare.cpp | 4 +- 19 files changed, 279 insertions(+), 214 deletions(-) diff --git a/libresapi/src/api/ApiServerMHD.cpp b/libresapi/src/api/ApiServerMHD.cpp index 83861fe6c..c14c4ea71 100644 --- a/libresapi/src/api/ApiServerMHD.cpp +++ b/libresapi/src/api/ApiServerMHD.cpp @@ -94,7 +94,7 @@ namespace resource_api{ std::string getDefaultDocroot() { - return RsAccounts::DataDirectory(false) + "/webui"; + return RsAccounts::systemDataDirectory(false) + "/webui"; } const char* API_ENTRY_PATH = "/api/v2"; diff --git a/libresapi/src/api/RsControlModule.cpp b/libresapi/src/api/RsControlModule.cpp index 1972cf4e1..da0413b3e 100644 --- a/libresapi/src/api/RsControlModule.cpp +++ b/libresapi/src/api/RsControlModule.cpp @@ -539,7 +539,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp) mPassword = pgp_password; mFixedPassword = pgp_password; } - bool ssl_ok = RsAccounts::GenerateSSLCertificate(pgp_id, "", ssl_name, "", hidden_port!=0, ssl_password, ssl_id, err_string); + bool ssl_ok = RsAccounts::createNewAccount(pgp_id, "", ssl_name, "", hidden_port!=0, ssl_password, ssl_id, err_string); // clear fixed password to restore normal password operation // { diff --git a/libretroshare/src/file_sharing/hash_cache.cc b/libretroshare/src/file_sharing/hash_cache.cc index c67216e86..d40f49581 100644 --- a/libretroshare/src/file_sharing/hash_cache.cc +++ b/libretroshare/src/file_sharing/hash_cache.cc @@ -27,6 +27,7 @@ #include "hash_cache.h" #include "filelist_io.h" #include "file_sharing_defaults.h" +#include "retroshare/rsinit.h" //#define HASHSTORAGE_DEBUG 1 @@ -478,7 +479,7 @@ bool HashStorage::try_load_import_old_hash_cache() { // compute file name - std::string base_dir = rsAccounts->PathAccountDirectory(); + std::string base_dir = RsAccounts::AccountDirectory(); std::string old_cache_filename = base_dir + "/" + "file_cache.bin" ; // check for unencrypted diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 9458643f1..7448ffd0d 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -29,7 +29,7 @@ #include "retroshare/rsids.h" #include "retroshare/rspeers.h" -#include "rsserver/rsaccounts.h" +#include "retroshare/rsinit.h" #include "rsserver/p3face.h" @@ -48,7 +48,7 @@ p3FileDatabase::p3FileDatabase(p3ServiceControl *mpeers) { // make sure the base directory exists - std::string base_dir = rsAccounts->PathAccountDirectory(); + std::string base_dir = RsAccounts::AccountDirectory(); if(base_dir.empty()) throw std::runtime_error("Cannot create base directory to store/access file sharing files.") ; diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 6eccb6c2e..276446d1f 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -39,12 +39,12 @@ #include "retroshare/rstypes.h" #include "retroshare/rspeers.h" +#include "retroshare/rsinit.h" #include "rsitems/rsfiletransferitems.h" #include "rsitems/rsserviceids.h" #include "rsserver/p3face.h" -#include "rsserver/rsaccounts.h" #include "turtle/p3turtle.h" #include "util/rsdebug.h" @@ -148,8 +148,9 @@ void ftServer::SetupFtServer() mFtController = new ftController(mFtDataplex, mServiceCtrl, getServiceInfo().mServiceType); mFtController -> setFtSearchNExtra(mFtSearch, mFtExtra); - std::string emergencySaveDir = rsAccounts->PathAccountDirectory(); - std::string emergencyPartialsDir = rsAccounts->PathAccountDirectory(); + std::string emergencySaveDir = RsAccounts::AccountDirectory(); + std::string emergencyPartialsDir = RsAccounts::AccountDirectory(); + if (emergencySaveDir != "") { emergencySaveDir += "/"; diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index aeb487fb2..9384e716f 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -121,51 +121,78 @@ class RsInit -/* Seperate Class for dealing with Accounts */ +/* Seperate static Class for dealing with Accounts */ -namespace RsAccounts +class RsAccountsDetail ; + +class RsAccounts { - /** - * @brief ConfigDirectory (normally ~/.retroshare) you can call this method - * even before initialisation (you can't with some other methods) - * @see RsAccountsDetail::PathBaseDirectory() - */ - std::string ConfigDirectory(); +public: + // Should be called once before everything else. + + static bool init(const std::string &opt_base_dir, int& error_code); /** - * @brief DataDirectory - * you can call this method even before initialisation (you can't with some other methods) - * @param check if set to true and directory does not exist, return empty string - * @return path where global platform independent files are stored, like bdboot.txt or webinterface files - */ - std::string DataDirectory(bool check = true); + * @brief ConfigDirectory (normally ~/.retroshare) you can call this method + * even before initialisation (you can't with some other methods) + * + * On linux: ~/.retroshare/ + * + * @see RsAccountsDetail::PathBaseDirectory() + */ + static std::string ConfigDirectory(); - std::string PGPDirectory(); - std::string AccountDirectory(); + /** + * @brief DataDirectory + * you can call this method even before initialisation (you can't with some other methods) + * @param check if set to true and directory does not exist, return empty string + * @return path where global platform independent files are stored, like bdboot.txt or webinterface files + */ + static std::string systemDataDirectory(bool check = true); + static std::string PGPDirectory(); // PGP Accounts. - int GetPGPLogins(std::list &pgpIds); - int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email); - bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString); + static int GetPGPLogins(std::list &pgpIds); + static int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email); + static bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString); // PGP Support Functions. - bool ExportIdentity(const std::string& fname,const RsPgpId& pgp_id) ; - bool ImportIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ; - bool ImportIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ; - void GetUnsupportedKeys(std::map > &unsupported_keys); - bool CopyGnuPGKeyrings() ; + static bool ExportIdentity(const std::string& fname,const RsPgpId& pgp_id) ; + static bool ImportIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ; + static bool ImportIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ; + static void GetUnsupportedKeys(std::map > &unsupported_keys); + static bool CopyGnuPGKeyrings() ; // Rs Accounts - bool SelectAccount(const RsPeerId& id); + static bool SelectAccount(const RsPeerId& id); + static bool GetPreferredAccountId(RsPeerId &id); + static bool GetAccountIds(std::list &ids); - bool GetPreferredAccountId(RsPeerId &id); - bool GetAccountIds(std::list &ids); - bool GetAccountDetails(const RsPeerId &id, - RsPgpId &gpgId, std::string &gpgName, - std::string &gpgEmail, std::string &location); + static bool GetAccountDetails(const RsPeerId &id, RsPgpId &gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location); - bool GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); + static bool createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); + static void storeSelectedAccount() ; + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // All methods bellow can only be called ones SelectAccount() as been called. // + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + static bool getCurrentAccountOptions(bool& is_hidden,bool& is_tor_auto,bool& is_first_time) ; + + static bool checkCreateAccountDirectory(); // Generate the hierarchy of directories below ~/.retroshare/[SSL dir]/ + + static std::string AccountDirectory(); // linux: ~/.retroshare/[SSL dir]/ + static std::string AccountKeysDirectory(); // linux: ~/.retroshare/[SSL dir]/keys/ + static std::string AccountPathCertFile(); // linux: ~/.retroshare/[SSL dir]/keys/user_cert.pem + static std::string AccountPathKeyFile(); // linux: ~/.retroshare/[SSL dir]/keys/user_pk.pem + static std::string AccountLocationName(); + + static bool lockPreferredAccount() ; // are these methods any useful?? + static void unlockPreferredAccount() ; + +private: + static RsAccountsDetail *rsAccounts ; }; diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index f9965cee4..ee2c91e1a 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -49,7 +49,7 @@ #include // Global singleton declaration of data. -RsAccountsDetail *rsAccounts; +RsAccountsDetail *RsAccounts::rsAccounts; /* Uses private class - so must be hidden */ static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map >& unsupported_keys); @@ -105,7 +105,7 @@ bool RsAccountsDetail::checkAccountDirectory() return false; } - return setupAccount(PathAccountDirectory()); + return setupAccount(getCurrentAccountPathAccountDirectory()); } #warning we need to clean that up. Login should only ask for a SSL id, instead of a std::string. @@ -219,7 +219,7 @@ std::string RsAccountsDetail::PathBaseDirectory() } -std::string RsAccountsDetail::PathAccountDirectory() +std::string RsAccountsDetail::getCurrentAccountPathAccountDirectory() { std::string path; @@ -235,9 +235,9 @@ std::string RsAccountsDetail::PathAccountDirectory() return path; } -std::string RsAccountsDetail::PathAccountKeysDirectory() +std::string RsAccountsDetail::getCurrentAccountPathAccountKeysDirectory() { - std::string path = PathAccountDirectory(); + std::string path = getCurrentAccountPathAccountDirectory(); if (path.empty()) { return path; @@ -247,9 +247,9 @@ std::string RsAccountsDetail::PathAccountKeysDirectory() return path; } -std::string RsAccountsDetail::PathKeyFile() +std::string RsAccountsDetail::getCurrentAccountPathKeyFile() { - std::string path = PathAccountKeysDirectory(); + std::string path = getCurrentAccountPathAccountKeysDirectory(); if (path.empty()) { return path; @@ -259,9 +259,9 @@ std::string RsAccountsDetail::PathKeyFile() return path; } -std::string RsAccountsDetail::PathCertFile() +std::string RsAccountsDetail::getCurrentAccountPathCertFile() { - std::string path = PathAccountKeysDirectory(); + std::string path = getCurrentAccountPathAccountKeysDirectory(); if (path.empty()) { return path; @@ -270,7 +270,7 @@ std::string RsAccountsDetail::PathCertFile() return path; } -std::string RsAccountsDetail::LocationName() +std::string RsAccountsDetail::getCurrentAccountLocationName() { std::map::const_iterator it; it = mAccounts.find(mPreferredId); @@ -450,7 +450,7 @@ bool RsAccountsDetail::storePreferredAccount() * */ -bool RsAccountsDetail::getPreferredAccountId(RsPeerId &id) +bool RsAccountsDetail::getCurrentAccountId(RsPeerId &id) { id = mPreferredId; return (!mPreferredId.isNull()); @@ -479,7 +479,7 @@ bool RsAccountsDetail::getAccountIds(std::list &ids) } -bool RsAccountsDetail::getAccountDetails(const RsPeerId &id, +bool RsAccountsDetail::getCurrentAccountDetails(const RsPeerId &id, RsPgpId &gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location) { @@ -496,14 +496,16 @@ bool RsAccountsDetail::getAccountDetails(const RsPeerId &id, return false; } -bool RsAccountsDetail::getAccountOptions(bool &ishidden, bool &isFirstTimeRun) +bool RsAccountsDetail::getCurrentAccountOptions(bool &ishidden,bool& isautotor, bool &isFirstTimeRun) { std::map::iterator it; it = mAccounts.find(mPreferredId); if (it != mAccounts.end()) { - ishidden = it->second.mIsHiddenLoc; + ishidden = it->second.mIsHiddenLoc; isFirstTimeRun = it->second.mFirstRun; + isautotor = it->second.mIsAutoTor; + return true; } return false; @@ -598,7 +600,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map & std::string lochex = (*it).substr(6); // rest of string. bool hidden_location = false; + bool auto_tor = false; bool valid_prefix = false; + if (prefix == "LOC06_") { valid_prefix = true; @@ -607,6 +611,8 @@ bool RsAccountsDetail::getAvailableAccounts(std::map & { valid_prefix = true; hidden_location = true; + + auto_tor = RsDirUtil::checkDirectory(PathDataDirectory()+"/hidden_service"); } else { @@ -626,7 +632,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map & AccountDetails tmpId; tmpId.mIsHiddenLoc = hidden_location; + tmpId.mIsAutoTor = auto_tor; tmpId.mAccountDir = *it; + if (checkAccount(accountdir, tmpId,unsupported_keys)) { #ifdef GPG_DEBUG @@ -692,7 +700,7 @@ static bool checkAccount(const std::string &accountdir, AccountDetails &account, std::cerr << "issuerName: " << account.mPgpId << " id: " << account.mSslId << std::endl; #endif - if(! rsAccounts->GetPGPLoginDetails(account.mPgpId, account.mPgpName, account.mPgpEmail)) + if(! RsAccounts::GetPGPLoginDetails(account.mPgpId, account.mPgpName, account.mPgpEmail)) return false ; if(!AuthGPG::getAuthGPG()->haveSecretKey(account.mPgpId)) @@ -1259,11 +1267,51 @@ bool RsInit::LoadPassword(const std::string& id, const std::string& inPwd) * PUBLIC INTERFACE FUNCTIONS ********************************************************************************/ +bool RsAccounts::init(const std::string& opt_base_dir,int& error_code) +{ + rsAccounts = new RsAccountsDetail ; + + // first check config directories, and set bootstrap values. + if(!rsAccounts->setupBaseDirectory(opt_base_dir)) + { + error_code = RS_INIT_BASE_DIR_ERROR ; + return false ; + } + + // Setup PGP stuff. + std::string pgp_dir = rsAccounts->PathPGPDirectory(); + + if(!RsDirUtil::checkCreateDirectory(pgp_dir)) + throw std::runtime_error("Cannot create pgp directory " + pgp_dir) ; + + AuthGPG::init( pgp_dir + "/retroshare_public_keyring.gpg", + pgp_dir + "/retroshare_secret_keyring.gpg", + pgp_dir + "/retroshare_trustdb.gpg", + pgp_dir + "/lock"); + + // load Accounts. + if (!rsAccounts->loadAccounts()) + { + error_code = RS_INIT_NO_KEYRING ; + return false ; + } + return true; +} + // Directories. std::string RsAccounts::ConfigDirectory() { return RsAccountsDetail::PathBaseDirectory(); } -std::string RsAccounts::DataDirectory(bool check) { return RsAccountsDetail::PathDataDirectory(check); } +std::string RsAccounts::systemDataDirectory(bool check) { return RsAccountsDetail::PathDataDirectory(check); } std::string RsAccounts::PGPDirectory() { return rsAccounts->PathPGPDirectory(); } -std::string RsAccounts::AccountDirectory() { return rsAccounts->PathAccountDirectory(); } +std::string RsAccounts::AccountDirectory() { return rsAccounts->getCurrentAccountPathAccountDirectory(); } +std::string RsAccounts::AccountKeysDirectory() { return rsAccounts->getCurrentAccountPathAccountKeysDirectory(); } +std::string RsAccounts::AccountPathCertFile() { return rsAccounts->getCurrentAccountPathCertFile(); } +std::string RsAccounts::AccountPathKeyFile() { return rsAccounts->getCurrentAccountPathKeyFile(); } +std::string RsAccounts::AccountLocationName() { return rsAccounts->getCurrentAccountLocationName(); } + +bool RsAccounts::lockPreferredAccount() { return rsAccounts->lockPreferredAccount();} // are these methods any useful?? +void RsAccounts::unlockPreferredAccount() { rsAccounts->unlockPreferredAccount(); } + +bool RsAccounts::checkCreateAccountDirectory() { return rsAccounts->checkAccountDirectory(); } // PGP Accounts. int RsAccounts::GetPGPLogins(std::list &pgpIds) @@ -1307,6 +1355,7 @@ bool RsAccounts::CopyGnuPGKeyrings() return rsAccounts->copyGnuPGKeyrings(); } +void RsAccounts::storeSelectedAccount() { rsAccounts->storePreferredAccount() ;} // Rs Accounts bool RsAccounts::SelectAccount(const RsPeerId &id) { @@ -1315,7 +1364,12 @@ bool RsAccounts::SelectAccount(const RsPeerId &id) bool RsAccounts::GetPreferredAccountId(RsPeerId &id) { - return rsAccounts->getPreferredAccountId(id); + return rsAccounts->getCurrentAccountId(id); +} + +bool RsAccounts::getCurrentAccountOptions(bool& is_hidden,bool& is_tor_auto,bool& is_first_time) +{ + return rsAccounts->getCurrentAccountOptions(is_hidden,is_tor_auto,is_first_time); } bool RsAccounts::GetAccountIds(std::list &ids) @@ -1327,10 +1381,10 @@ bool RsAccounts::GetAccountDetails(const RsPeerId &id, RsPgpId &pgpId, std::string &pgpName, std::string &pgpEmail, std::string &location) { - return rsAccounts->getAccountDetails(id, pgpId, pgpName, pgpEmail, location); + return rsAccounts->getCurrentAccountDetails(id, pgpId, pgpName, pgpEmail, location); } -bool RsAccounts::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString) +bool RsAccounts::createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString) { return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, passwd, sslId, errString); } diff --git a/libretroshare/src/rsserver/rsaccounts.h b/libretroshare/src/rsserver/rsaccounts.h index 2ec87b3e6..38a5925ad 100644 --- a/libretroshare/src/rsserver/rsaccounts.h +++ b/libretroshare/src/rsserver/rsaccounts.h @@ -49,6 +49,7 @@ class AccountDetails std::string mLocation; bool mIsHiddenLoc; bool mFirstRun; + bool mIsAutoTor; }; @@ -58,9 +59,6 @@ class RsAccountsDetail RsAccountsDetail(); // These functions are externally accessible via RsAccounts namespace. - - - // These functions are accessible from inside libretroshare. bool setupBaseDirectory(std::string alt_basedir); @@ -87,52 +85,43 @@ class RsAccountsDetail // PGP Path is only dependent on BaseDirectory. std::string PathPGPDirectory(); - // Below are dependent on mPreferredId. - std::string PathAccountDirectory(); - std::string PathAccountKeysDirectory(); - std::string PathKeyFile(); - std::string PathCertFile(); - std::string LocationName(); + // Generate a new account based on a given PGP key returns its SSL id and sets it to be the preferred account. + + bool GenerateSSLCertificate(const RsPgpId& gpg_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); // PGP Accounts. int GetPGPLogins(std::list &pgpIds); - int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email); + int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email); bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString); - - bool SelectPGPAccount(const RsPgpId& pgpId); + bool SelectPGPAccount(const RsPgpId& pgpId); // PGP Support Functions. bool exportIdentity(const std::string& fname,const RsPgpId& pgp_id) ; bool importIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ; bool importIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ; - void getUnsupportedKeys(std::map > &unsupported_keys); + void getUnsupportedKeys(std::map > &unsupported_keys); bool copyGnuPGKeyrings() ; - // Selecting Rs Account. + bool getAccountIds(std::list &ids); bool selectAccountByString(const std::string &prefUserString); bool selectId(const RsPeerId& preferredId); - - // Details of Rs Account. - bool getPreferredAccountId(RsPeerId &id); - bool getAccountDetails(const RsPeerId &id, RsPgpId& gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location); - - bool getAccountOptions(bool &ishidden, bool &isFirstTimeRun); - - - bool getAccountIds(std::list &ids); - - bool GenerateSSLCertificate(const RsPgpId& gpg_id, - const std::string& org, const std::string& loc, - const std::string& country, const bool ishiddenloc, - const std::string& passwd, RsPeerId &sslId, - std::string &errString); - - // From init file. bool storePreferredAccount(); bool loadPreferredAccount(); + // Details of current Rs Account. + bool getCurrentAccountId(RsPeerId &id); + bool getCurrentAccountDetails(const RsPeerId &id, RsPgpId& gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location); + bool getCurrentAccountOptions(bool &ishidden, bool &isautotor, bool &isFirstTimeRun); + + std::string getCurrentAccountPathAccountDirectory(); + std::string getCurrentAccountPathAccountKeysDirectory(); + std::string getCurrentAccountPathKeyFile(); + std::string getCurrentAccountPathCertFile(); + std::string getCurrentAccountLocationName(); + + private: bool checkPreferredId(); @@ -155,6 +144,4 @@ class RsAccountsDetail std::map > mUnsupportedKeys ; }; -// Global singleton declaration of data. -extern RsAccountsDetail *rsAccounts; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 29dcaba79..2a8ae144f 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -431,26 +431,10 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */) AuthSSL::AuthSSLInit(); AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL, ""); - rsAccounts = new RsAccountsDetail(); + int error_code ; - // first check config directories, and set bootstrap values. - if(!rsAccounts->setupBaseDirectory(opt_base_dir)) - return RS_INIT_BASE_DIR_ERROR ; - - // Setup PGP stuff. - std::string pgp_dir = rsAccounts->PathPGPDirectory(); - - if(!RsDirUtil::checkCreateDirectory(pgp_dir)) - throw std::runtime_error("Cannot create pgp directory " + pgp_dir) ; - - AuthGPG::init( pgp_dir + "/retroshare_public_keyring.gpg", - pgp_dir + "/retroshare_secret_keyring.gpg", - pgp_dir + "/retroshare_trustdb.gpg", - pgp_dir + "/lock"); - - // load Accounts. - if (!rsAccounts->loadAccounts()) - return RS_INIT_NO_KEYRING ; + if(!RsAccounts::init(opt_base_dir,error_code)) + return error_code ; // choose alternative account. if(prefUserString != "") @@ -464,7 +448,7 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */) return RS_INIT_AUTH_FAILED ; } - if(rsAccounts->selectId(ssl_id)) + if(RsAccounts::SelectAccount(ssl_id)) { std::cerr << "Auto-selectng account ID " << ssl_id << std::endl; return RS_INIT_HAVE_ACCOUNT; @@ -474,7 +458,7 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */) #ifdef RS_AUTOLOGIN /* check that we have selected someone */ RsPeerId preferredId; - bool existingUser = rsAccounts->getPreferredAccountId(preferredId); + bool existingUser = RsAccounts::GetPreferredAccountId(preferredId); if (existingUser) { @@ -550,44 +534,43 @@ bool RsInit::LoadPassword(const std::string& inPwd) */ int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath) { - if (!rsAccounts->lockPreferredAccount()) + try { - return 3; // invalid PreferredAccount. + if (!RsAccounts::lockPreferredAccount()) + throw 3; // invalid PreferredAccount. + + // Logic that used to be external to RsInit... + RsPeerId accountId; + if (!RsAccounts::GetPreferredAccountId(accountId)) + throw 3; // invalid PreferredAccount; + + RsPgpId pgpId; + std::string pgpName, pgpEmail, location; + + if(!RsAccounts::GetAccountDetails(accountId, pgpId, pgpName, pgpEmail, location)) + throw 3; // invalid PreferredAccount; + + if(0 == AuthGPG::getAuthGPG() -> GPGInit(pgpId)) + throw 3; // PGP Error. + + int retVal = LockConfigDirectory(RsAccounts::AccountDirectory(), lockFilePath); + + if(retVal > 0) + throw retVal ; + + if(LoadCertificates(autoLoginNT) != 1) + { + UnlockConfigDirectory(); + throw 3; + } + + return 0; } - - int retVal = 0; - - // Logic that used to be external to RsInit... - RsPeerId accountId; - if (!rsAccounts->getPreferredAccountId(accountId)) - { - retVal = 3; // invalid PreferredAccount; - } - - RsPgpId pgpId; - std::string pgpName, pgpEmail, location; - - if (retVal == 0 && !rsAccounts->getAccountDetails(accountId, pgpId, pgpName, pgpEmail, location)) - retVal = 3; // invalid PreferredAccount; - - if (retVal == 0 && !rsAccounts->SelectPGPAccount(pgpId)) - retVal = 3; // PGP Error. - - if(retVal == 0) - retVal = LockConfigDirectory(rsAccounts->PathAccountDirectory(), lockFilePath); - - if(retVal == 0 && LoadCertificates(autoLoginNT) != 1) - { - UnlockConfigDirectory(); - retVal = 3; - } - - if(retVal != 0) - { - rsAccounts->unlockPreferredAccount(); - } - - return retVal; + catch(int retVal) + { + RsAccounts::unlockPreferredAccount(); + return retVal ; + } } @@ -603,20 +586,20 @@ int RsInit::LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath int RsInit::LoadCertificates(bool autoLoginNT) { RsPeerId preferredId; - if (!rsAccounts->getPreferredAccountId(preferredId)) + if (!RsAccounts::GetPreferredAccountId(preferredId)) { std::cerr << "No Account Selected" << std::endl; return 0; } - if (rsAccounts->PathCertFile() == "") + if (RsAccounts::AccountPathCertFile() == "") { std::cerr << "RetroShare needs a certificate" << std::endl; return 0; } - if (rsAccounts->PathKeyFile() == "") + if (RsAccounts::AccountPathKeyFile() == "") { std::cerr << "RetroShare needs a key" << std::endl; return 0; @@ -638,9 +621,10 @@ int RsInit::LoadCertificates(bool autoLoginNT) } } - std::cerr << "rsAccounts->PathKeyFile() : " << rsAccounts->PathKeyFile() << std::endl; + std::cerr << "rsAccounts->PathKeyFile() : " << RsAccounts::AccountPathKeyFile() << std::endl; - if(0 == AuthSSL::getAuthSSL() -> InitAuth(rsAccounts->PathCertFile().c_str(), rsAccounts->PathKeyFile().c_str(), rsInitConfig->passwd.c_str(), rsAccounts->LocationName())) + if(0 == AuthSSL::getAuthSSL() -> InitAuth(RsAccounts::AccountPathCertFile().c_str(), RsAccounts::AccountPathKeyFile().c_str(), rsInitConfig->passwd.c_str(), + RsAccounts::AccountLocationName())) { std::cerr << "SSL Auth Failed!"; return 0 ; @@ -665,7 +649,7 @@ int RsInit::LoadCertificates(bool autoLoginNT) rsInitConfig->gxs_passwd = rsInitConfig->passwd; rsInitConfig->passwd = ""; - rsAccounts->storePreferredAccount(); + RsAccounts::storeSelectedAccount(); return 1; } @@ -909,7 +893,7 @@ int RsServer::StartupRetroShare() std::cerr << "set the debugging to crashMode." << std::endl; if ((!rsInitConfig->haveLogFile) && (!rsInitConfig->outStderr)) { - std::string crashfile = rsAccounts->PathAccountDirectory(); + std::string crashfile = RsAccounts::AccountDirectory(); crashfile += "/" + configLogFileName; setDebugCrashMode(crashfile.c_str()); } @@ -921,7 +905,7 @@ int RsServer::StartupRetroShare() } /* check account directory */ - if (!rsAccounts->checkAccountDirectory()) + if (!RsAccounts::checkCreateAccountDirectory()) { std::cerr << "RsServer::StartupRetroShare() - Fatal Error....." << std::endl; std::cerr << "checkAccount failed!" << std::endl; @@ -933,8 +917,8 @@ int RsServer::StartupRetroShare() // Load up Certificates, and Old Configuration (if present) std::cerr << "Load up Certificates, and Old Configuration (if present)." << std::endl; - std::string emergencySaveDir = rsAccounts->PathAccountDirectory(); - std::string emergencyPartialsDir = rsAccounts->PathAccountDirectory(); + std::string emergencySaveDir = RsAccounts::AccountDirectory(); + std::string emergencyPartialsDir = RsAccounts::AccountDirectory(); if (emergencySaveDir != "") { emergencySaveDir += "/"; @@ -948,13 +932,15 @@ int RsServer::StartupRetroShare() /**************************************************************************/ std::cerr << "Load Configuration" << std::endl; - mConfigMgr = new p3ConfigMgr(rsAccounts->PathAccountDirectory()); + mConfigMgr = new p3ConfigMgr(RsAccounts::AccountDirectory()); mGeneralConfig = new p3GeneralConfig(); // Get configuration options from rsAccounts. bool isHiddenNode = false; bool isFirstTimeRun = false; - rsAccounts->getAccountOptions(isHiddenNode, isFirstTimeRun); + bool isTorAuto = false; + + RsAccounts::getCurrentAccountOptions(isHiddenNode,isTorAuto, isFirstTimeRun); /**************************************************************************/ /* setup classes / structures */ @@ -1032,12 +1018,12 @@ int RsServer::StartupRetroShare() #define BITDHT_FILTERED_IP_FILENAME "bdfilter.txt" - std::string bootstrapfile = rsAccounts->PathAccountDirectory(); + std::string bootstrapfile = RsAccounts::AccountDirectory(); if (bootstrapfile != "") bootstrapfile += "/"; bootstrapfile += BITDHT_BOOTSTRAP_FILENAME; - std::string filteredipfile = rsAccounts->PathAccountDirectory(); + std::string filteredipfile = RsAccounts::AccountDirectory(); if (filteredipfile != "") filteredipfile += "/"; filteredipfile += BITDHT_FILTERED_IP_FILENAME; @@ -1077,7 +1063,7 @@ int RsServer::StartupRetroShare() bdbootRF.close(); } #else - std::string installfile = rsAccounts->PathDataDirectory(); + std::string installfile = RsAccounts::systemDataDirectory(); installfile += "/"; installfile += BITDHT_BOOTSTRAP_FILENAME; @@ -1208,7 +1194,7 @@ int RsServer::StartupRetroShare() /****** New Ft Server **** !!! */ ftServer *ftserver = new ftServer(mPeerMgr, serviceCtrl); - ftserver->setConfigDirectory(rsAccounts->PathAccountDirectory()); + ftserver->setConfigDirectory(RsAccounts::AccountDirectory()); ftserver->SetupFtServer() ; @@ -1229,7 +1215,7 @@ int RsServer::StartupRetroShare() #if !defined(WINDOWS_SYS) && defined(PLUGIN_DIR) plugins_directories.push_back(std::string(PLUGIN_DIR)) ; #endif - std::string extensions_dir = rsAccounts->PathBaseDirectory() + "/extensions6/" ; + std::string extensions_dir = RsAccounts::ConfigDirectory() + "/extensions6/" ; plugins_directories.push_back(extensions_dir) ; if(!RsDirUtil::checkCreateDirectory(extensions_dir)) @@ -1272,7 +1258,7 @@ int RsServer::StartupRetroShare() #ifdef RS_ENABLE_GXS - std::string currGxsDir = rsAccounts->PathAccountDirectory() + "/gxs"; + std::string currGxsDir = RsAccounts::AccountDirectory() + "/gxs"; RsDirUtil::checkCreateDirectory(currGxsDir); RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(serviceCtrl); diff --git a/libretroshare/src/rsserver/rsloginhandler.cc b/libretroshare/src/rsserver/rsloginhandler.cc index ed952791f..f94c7115b 100644 --- a/libretroshare/src/rsserver/rsloginhandler.cc +++ b/libretroshare/src/rsserver/rsloginhandler.cc @@ -3,7 +3,7 @@ #include #include "rsloginhandler.h" #include "util/rsdir.h" -#include "rsaccounts.h" +#include "retroshare/rsinit.h" //#define DEBUG_RSLOGINHANDLER 1 @@ -91,7 +91,7 @@ bool RsLoginHandler::getSSLPasswdFromGPGFile(const RsPeerId& ssl_id,std::string& std::string RsLoginHandler::getSSLPasswdFileName(const RsPeerId& /*ssl_id*/) { - return rsAccounts->PathAccountKeysDirectory() + "/" + "ssl_passphrase.pgp"; + return RsAccounts::AccountKeysDirectory() + "/" + "ssl_passphrase.pgp"; } #ifdef RS_AUTOLOGIN @@ -755,7 +755,7 @@ bool RsLoginHandler::clearAutoLogin(const RsPeerId& ssl_id) std::string RsLoginHandler::getAutologinFileName(const RsPeerId& /*ssl_id*/) { - return rsAccounts->PathAccountKeysDirectory() + "/" + "help.dta" ; + return RsAccounts::AccountKeysDirectory() + "/" + "help.dta" ; } #endif // RS_AUTOLOGIN diff --git a/libretroshare/src/util/rsdiscspace.cc b/libretroshare/src/util/rsdiscspace.cc index 9e325ea7b..bf89d30bb 100644 --- a/libretroshare/src/util/rsdiscspace.cc +++ b/libretroshare/src/util/rsdiscspace.cc @@ -25,7 +25,7 @@ #include "rsserver/p3face.h" #include "retroshare/rsfiles.h" #include "retroshare/rsiface.h" -#include "rsserver/rsaccounts.h" +#include "retroshare/rsinit.h" #include "rsdiscspace.h" #include @@ -166,13 +166,13 @@ bool RsDiscSpace::checkForDiscSpace(RsDiscSpace::DiscLocation loc) #endif break ; - case RS_CONFIG_DIRECTORY: rs = crossSystemDiskStats(rsAccounts->PathAccountDirectory().c_str(),free_blocks,block_size) ; + case RS_CONFIG_DIRECTORY: rs = crossSystemDiskStats(RsAccounts::AccountDirectory().c_str(),free_blocks,block_size) ; #ifdef DEBUG_RSDISCSPACE std::cerr << " path = " << RsInit::RsConfigDirectory() << std::endl ; #endif break ; - case RS_PGP_DIRECTORY: rs = crossSystemDiskStats(rsAccounts->PathPGPDirectory().c_str(),free_blocks,block_size) ; + case RS_PGP_DIRECTORY: rs = crossSystemDiskStats(RsAccounts::PGPDirectory().c_str(),free_blocks,block_size) ; #ifdef DEBUG_RSDISCSPACE std::cerr << " path = " << RsInit::RsPGPDirectory() << std::endl ; #endif diff --git a/plugins/VOIP/VOIPPlugin.cpp b/plugins/VOIP/VOIPPlugin.cpp index bc4129e7f..96be0d3ac 100644 --- a/plugins/VOIP/VOIPPlugin.cpp +++ b/plugins/VOIP/VOIPPlugin.cpp @@ -216,7 +216,7 @@ QTranslator* VOIPPlugin::qt_translator(QApplication */*app*/, const QString& lan void VOIPPlugin::qt_sound_events(SoundEvents &events) const { - QDir baseDir = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/sounds"); + QDir baseDir = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/sounds"); events.addEvent(QApplication::translate("VOIP", "VOIP") , QApplication::translate("VOIP", "Incoming audio call") diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index 133bfbc4a..22206b1b4 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -620,7 +620,7 @@ void GenCertDialog::genPerson() std::string err; this->hide();//To show dialog asking password PGP Key. std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl; - bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err); + bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err); if (okGen) { diff --git a/retroshare-gui/src/gui/SoundManager.cpp b/retroshare-gui/src/gui/SoundManager.cpp index 79a2056af..5c538c4c4 100644 --- a/retroshare-gui/src/gui/SoundManager.cpp +++ b/retroshare-gui/src/gui/SoundManager.cpp @@ -76,7 +76,7 @@ SoundManager::SoundManager() : QObject() void SoundManager::soundEvents(SoundEvents &events) { - QDir baseDir = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/sounds"); + QDir baseDir = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/sounds"); events.mDefaultPath = baseDir.absolutePath(); diff --git a/retroshare-gui/src/gui/chat/ChatStyle.cpp b/retroshare-gui/src/gui/chat/ChatStyle.cpp index 46db56f36..3cda190be 100644 --- a/retroshare-gui/src/gui/chat/ChatStyle.cpp +++ b/retroshare-gui/src/gui/chat/ChatStyle.cpp @@ -149,7 +149,7 @@ static QStringList getBaseDirList() // Search chat styles in config dir and data dir (is application dir for portable) QStringList baseDirs; baseDirs.append(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())); - baseDirs.append(QString::fromUtf8(RsAccounts::DataDirectory().c_str())); + baseDirs.append(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str())); return baseDirs; } diff --git a/retroshare-gui/src/gui/common/RSTextBrowser.cpp b/retroshare-gui/src/gui/common/RSTextBrowser.cpp index 8c59c815c..5e1a80740 100644 --- a/retroshare-gui/src/gui/common/RSTextBrowser.cpp +++ b/retroshare-gui/src/gui/common/RSTextBrowser.cpp @@ -107,7 +107,7 @@ QVariant RSTextBrowser::loadResource(int type, const QUrl &name) if(fi.exists() && fi.isFile()) { QString cpath = fi.canonicalFilePath(); if (cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive) - || cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive)) + || cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive)) return QTextBrowser::loadResource(type, name); }} diff --git a/retroshare-gui/src/lang/languagesupport.cpp b/retroshare-gui/src/lang/languagesupport.cpp index 27f720050..a2f6b9ed8 100644 --- a/retroshare-gui/src/lang/languagesupport.cpp +++ b/retroshare-gui/src/lang/languagesupport.cpp @@ -31,7 +31,7 @@ static QMap translatorPlugins; -#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::DataDirectory().c_str()) +#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) /** Initializes the list of available languages. */ QMap diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index acd56d9ef..604c15026 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -349,48 +349,57 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); SoundManager::create(); -#ifdef RETROTOR - // Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service + bool is_hidden_node = false; + bool is_auto_tor = false ; + bool is_first_time = false ; - QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ; + RsAccounts::getCurrentAccountOptions(is_hidden_node,is_auto_tor,is_first_time); - Tor::TorManager *torManager = Tor::TorManager::instance(); - torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/")); - torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run - - RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ; - - torManager->setupHiddenService(); - - if(! torManager->start() || torManager->hasError()) +#ifdef UNFINISHED + if(RsAccounts::AccountType() == RS_ACCOUNT_TYPE_HIDDEN_TOR_AUTO) { - QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ; - return 1 ; - } + // Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service - { - TorControlDialog tcd(torManager) ; - QString error_msg ; - tcd.show(); + QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ; - while(tcd.checkForTor(error_msg) != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails. + Tor::TorManager *torManager = Tor::TorManager::instance(); + torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/")); + torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run + + RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ; + + torManager->setupHiddenService(); + + if(! torManager->start() || torManager->hasError()) { - QCoreApplication::processEvents(); - rstime::rs_usleep(0.2*1000*1000) ; - - if(!error_msg.isNull()) - { - QMessageBox::critical(NULL,QObject::tr("Cannot start Tor"),QObject::tr("Sorry but Tor cannot be started on your system!\n\nThe error reported is:\"")+error_msg+"\"") ; - return 1; - } + QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ; + return 1 ; } - tcd.hide(); - - if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) { - QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ; - return 1 ; + TorControlDialog tcd(torManager) ; + QString error_msg ; + tcd.show(); + + while(tcd.checkForTor(error_msg) != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails. + { + QCoreApplication::processEvents(); + rstime::rs_usleep(0.2*1000*1000) ; + + if(!error_msg.isNull()) + { + QMessageBox::critical(NULL,QObject::tr("Cannot start Tor"),QObject::tr("Sorry but Tor cannot be started on your system!\n\nThe error reported is:\"")+error_msg+"\"") ; + return 1; + } + } + + tcd.hide(); + + if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) + { + QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ; + return 1 ; + } } } #endif diff --git a/retroshare-gui/src/rshare.cpp b/retroshare-gui/src/rshare.cpp index e83d9eeb7..f1b08396a 100644 --- a/retroshare-gui/src/rshare.cpp +++ b/retroshare-gui/src/rshare.cpp @@ -748,7 +748,7 @@ void Rshare::loadStyleSheet(const QString &sheetName) /* external stylesheet */ file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()), name, sheetName)); if (!file.exists()) { - file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::DataDirectory().c_str()), name, sheetName)); + file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()), name, sheetName)); } } if (file.open(QFile::ReadOnly)) { @@ -787,7 +787,7 @@ void Rshare::getAvailableStyleSheets(QMap &styleSheets) styleSheets.insert(name, name); } } - fileInfoList = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss")); + fileInfoList = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss")); foreach (fileInfo, fileInfoList) { if (fileInfo.isFile()) { QString name = fileInfo.baseName(); From b4dd89dd877524ab1befb8e4f277c11a10a80a55 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 25 Jul 2018 00:27:39 +0200 Subject: [PATCH 145/213] Fix deep search returning 0 results --- libretroshare/src/deep_search/deep_search.h | 23 +++++++++++++++++++-- libretroshare/src/gxs/rsgxsnetservice.cc | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 3fed67c01..edbf546e9 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -41,6 +41,8 @@ struct DeepSearch }; /** + * @param[in] maxResults maximum number of acceptable search results, 0 for + * no limits * @return search results count */ static uint32_t search( const std::string& queryStr, @@ -49,8 +51,24 @@ struct DeepSearch { results.clear(); + Xapian::Database db; + // Open the database we're going to search. - Xapian::Database db(dbPath()); + try { db = Xapian::Database(dbPath()); } + catch(Xapian::DatabaseOpeningError e) + { + std::cerr << __PRETTY_FUNCTION__ << " " << e.get_msg() + << ", probably nothing has been indexed yet."<< std::endl; + return 0; + } + catch(Xapian::DatabaseError e) + { + std::cerr << __PRETTY_FUNCTION__ << " " << e.get_msg() + << " this is fishy, maybe " << dbPath() + << " has been corrupted (deleting it may help in that " + << "case without loosing data)" << std::endl; + return 0; + } // Set up a QueryParser with a stemmer and suitable prefixes. Xapian::QueryParser queryparser; @@ -68,7 +86,8 @@ struct DeepSearch Xapian::Enquire enquire(db); enquire.set_query(query); - Xapian::MSet mset = enquire.get_mset(0, maxResults); + Xapian::MSet mset = enquire.get_mset( + 0, maxResults ? maxResults : db.get_doccount() ); for ( Xapian::MSetIterator m = mset.begin(); m != mset.end(); ++m ) { diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 8f4ee033c..cb8af6064 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5279,7 +5279,7 @@ bool RsGxsNetService::search( const std::string& substring, #ifdef RS_DEEP_SEARCH std::vector results; - DeepSearch::search(substring, results, 0); + DeepSearch::search(substring, results); for(auto dsr : results) { From d2a62b03ee110a3009933a32a425c0b4808200d0 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 25 Jul 2018 00:27:39 +0200 Subject: [PATCH 146/213] Fix deep search returning 0 results --- libretroshare/src/deep_search/deep_search.h | 23 +++++++++++++++++++-- libretroshare/src/gxs/rsgxsnetservice.cc | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/deep_search/deep_search.h b/libretroshare/src/deep_search/deep_search.h index 3fed67c01..edbf546e9 100644 --- a/libretroshare/src/deep_search/deep_search.h +++ b/libretroshare/src/deep_search/deep_search.h @@ -41,6 +41,8 @@ struct DeepSearch }; /** + * @param[in] maxResults maximum number of acceptable search results, 0 for + * no limits * @return search results count */ static uint32_t search( const std::string& queryStr, @@ -49,8 +51,24 @@ struct DeepSearch { results.clear(); + Xapian::Database db; + // Open the database we're going to search. - Xapian::Database db(dbPath()); + try { db = Xapian::Database(dbPath()); } + catch(Xapian::DatabaseOpeningError e) + { + std::cerr << __PRETTY_FUNCTION__ << " " << e.get_msg() + << ", probably nothing has been indexed yet."<< std::endl; + return 0; + } + catch(Xapian::DatabaseError e) + { + std::cerr << __PRETTY_FUNCTION__ << " " << e.get_msg() + << " this is fishy, maybe " << dbPath() + << " has been corrupted (deleting it may help in that " + << "case without loosing data)" << std::endl; + return 0; + } // Set up a QueryParser with a stemmer and suitable prefixes. Xapian::QueryParser queryparser; @@ -68,7 +86,8 @@ struct DeepSearch Xapian::Enquire enquire(db); enquire.set_query(query); - Xapian::MSet mset = enquire.get_mset(0, maxResults); + Xapian::MSet mset = enquire.get_mset( + 0, maxResults ? maxResults : db.get_doccount() ); for ( Xapian::MSetIterator m = mset.begin(); m != mset.end(); ++m ) { diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 8f4ee033c..cb8af6064 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5279,7 +5279,7 @@ bool RsGxsNetService::search( const std::string& substring, #ifdef RS_DEEP_SEARCH std::vector results; - DeepSearch::search(substring, results, 0); + DeepSearch::search(substring, results); for(auto dsr : results) { From d1a375cbd02e04b60b89958e7a5449514b011c07 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 25 Jul 2018 11:37:40 +0200 Subject: [PATCH 147/213] removed RETROTOR #ifdef and started using RsAccounts::isTorAuto() instead. Unfinished yet. --- RetroShare.pro | 13 +- libretroshare/src/pqi/pqisslpersongrp.cc | 3 - libretroshare/src/retroshare/rsinit.h | 2 + libretroshare/src/rsserver/rsaccounts.cc | 35 ++- libretroshare/src/rsserver/rsinit.cc | 274 ++++++++++-------- retroshare-gui/src/gui/GenCertDialog.cpp | 13 +- retroshare-gui/src/gui/MainWindow.cpp | 28 +- .../src/gui/settings/ServerPage.cpp | 27 +- .../src/gui/settings/rsharesettings.h | 2 - .../src/gui/statusbar/torstatus.cpp | 88 +++--- retroshare-gui/src/main.cpp | 56 ++-- retroshare-gui/src/retroshare-gui.pro | 12 +- retroshare.pri | 11 +- 13 files changed, 294 insertions(+), 270 deletions(-) diff --git a/RetroShare.pro b/RetroShare.pro index d53d37a71..0b009cfd5 100644 --- a/RetroShare.pro +++ b/RetroShare.pro @@ -23,13 +23,9 @@ TEMPLATE = subdirs SUBDIRS += openpgpsdk openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro -retrotor { - libretroshare.depends = openpgpsdk -} else { - SUBDIRS += libbitdht - libbitdht.file = libbitdht/src/libbitdht.pro - libretroshare.depends = openpgpsdk libbitdht -} +SUBDIRS += libbitdht +libbitdht.file = libbitdht/src/libbitdht.pro +libretroshare.depends = openpgpsdk libbitdht SUBDIRS += libretroshare libretroshare.file = libretroshare/src/libretroshare.pro @@ -45,15 +41,12 @@ retroshare_gui { retroshare_gui.target = retroshare_gui } -retrotor { -} else { retroshare_nogui { SUBDIRS += retroshare_nogui retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro retroshare_nogui.depends = libretroshare libresapi retroshare_nogui.target = retroshare_nogui } -} retroshare_android_service { SUBDIRS += retroshare_android_service diff --git a/libretroshare/src/pqi/pqisslpersongrp.cc b/libretroshare/src/pqi/pqisslpersongrp.cc index e907feb28..7016a2fa6 100644 --- a/libretroshare/src/pqi/pqisslpersongrp.cc +++ b/libretroshare/src/pqi/pqisslpersongrp.cc @@ -32,9 +32,6 @@ static struct RsLog::logInfo pqipersongrpzoneInfo = {RsLog::Default, "pqipersong /**** * #define PQI_DISABLE_UDP 1 ***/ -#ifdef RETROTOR -#define PQI_DISABLE_UDP 1 -#endif /********************************** SSL Specific features ***************************/ diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 9384e716f..325eb7e98 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -181,6 +181,8 @@ public: static bool getCurrentAccountOptions(bool& is_hidden,bool& is_tor_auto,bool& is_first_time) ; static bool checkCreateAccountDirectory(); // Generate the hierarchy of directories below ~/.retroshare/[SSL dir]/ + static bool isHiddenNode() ; // true if the running node is a hidden node. Used to choose which services to start. + static bool isTorAuto() ; // true if the running node is a hidden node using automated Tor management static std::string AccountDirectory(); // linux: ~/.retroshare/[SSL dir]/ static std::string AccountKeysDirectory(); // linux: ~/.retroshare/[SSL dir]/keys/ diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index ee2c91e1a..052c78a68 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -67,11 +67,8 @@ RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("") bool RsAccountsDetail::loadAccounts() { int failing_accounts ; -#ifdef RETROTOR - getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,true); -#else +#warning we might need some switch here for hidden nodes only getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false); -#endif loadPreferredAccount(); checkPreferredId(); @@ -612,7 +609,7 @@ bool RsAccountsDetail::getAvailableAccounts(std::map & valid_prefix = true; hidden_location = true; - auto_tor = RsDirUtil::checkDirectory(PathDataDirectory()+"/hidden_service"); + auto_tor = RsDirUtil::checkDirectory(mBaseDirectory+"/"+*it+"/hidden_service"); } else { @@ -1371,6 +1368,34 @@ bool RsAccounts::getCurrentAccountOptions(bool& is_hidden,bool& is_tor_auto,bool { return rsAccounts->getCurrentAccountOptions(is_hidden,is_tor_auto,is_first_time); } +bool RsAccounts::isHiddenNode() +{ + bool hidden = false ; + bool is_tor_only = false ; + bool is_first_time = false ; + + if(!getCurrentAccountOptions(hidden,is_tor_only,is_first_time)) + { + std::cerr << "(EE) Critical problem: RsAccounts::getCurrentAccountOptions() called but no account chosen!" << std::endl; + throw std::runtime_error("inconsistent configuration") ; + } + + return hidden ; +} +bool RsAccounts::isTorAuto() +{ + bool hidden = false ; + bool is_tor_only = false ; + bool is_first_time = false ; + + if(!getCurrentAccountOptions(hidden,is_tor_only,is_first_time)) + { + std::cerr << "(EE) Critical problem: RsAccounts::getCurrentAccountOptions() called but no account chosen!" << std::endl; + throw std::runtime_error("inconsistent configuration") ; + } + + return is_tor_only ; +} bool RsAccounts::GetAccountIds(std::list &ids) { diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 2a8ae144f..f4458e42f 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -657,7 +657,7 @@ int RsInit::LoadCertificates(bool autoLoginNT) bool RsInit::RsClearAutoLogin() { RsPeerId preferredId; - if (!rsAccounts->getPreferredAccountId(preferredId)) + if (!RsAccounts::getSelectedAccountId(preferredId)) { std::cerr << "RsInit::RsClearAutoLogin() No Account Selected" << std::endl; return 0; @@ -817,11 +817,8 @@ RsGRouter *rsGRouter = NULL ; #include "pqi/p3linkmgr.h" #include "pqi/p3netmgr.h" -#ifndef RETROTOR #include "tcponudp/tou.h" #include "tcponudp/rsudpstack.h" -#endif - #ifdef RS_USE_BITDHT #include "dht/p3bitdht.h" @@ -868,6 +865,17 @@ RsControl *RsControl::instance() int RsServer::StartupRetroShare() { + RsPeerId ownId = AuthSSL::getAuthSSL()->OwnId(); + + std::cerr << "========================================================================" << std::endl; + std::cerr << "== RsInit:: starting up Retroshare core ==" << std::endl; + std::cerr << "== ==" << std::endl; + std::cerr << "== Account/SSL ID : " << ownId << " ==" << std::endl; + std::cerr << "== Node type : " << (RsAccounts::isHiddenNode()?"Hidden":"Normal") << " ==" << std::endl; + if(RsAccounts::isHiddenNode()) + std::cerr << "== Tor/I2P configuration : " << (RsAccounts::isTorAuto()?"Tor Auto":"Manual ") << " ==" << std::endl; + std::cerr << "========================================================================" << std::endl; + /**************************************************************************/ /* STARTUP procedure */ /**************************************************************************/ @@ -883,8 +891,6 @@ int RsServer::StartupRetroShare() return false ; } - RsPeerId ownId = AuthSSL::getAuthSSL()->OwnId(); - /**************************************************************************/ /* Any Initial Configuration (Commandline Options) */ /**************************************************************************/ @@ -981,36 +987,40 @@ int RsServer::StartupRetroShare() sockaddr_clear(&tmpladdr); tmpladdr.sin_port = htons(rsInitConfig->port); + rsUdpStack *mDhtStack = NULL ; + if(!RsAccounts::isHiddenNode()) + { #ifdef LOCALNET_TESTING - rsUdpStack *mDhtStack = new rsUdpStack(UDP_TEST_RESTRICTED_LAYER, tmpladdr); + mDhtStack = new rsUdpStack(UDP_TEST_RESTRICTED_LAYER, tmpladdr); - /* parse portRestrictions */ - unsigned int lport, uport; + /* parse portRestrictions */ + unsigned int lport, uport; - if (doPortRestrictions) - { - if (2 == sscanf(portRestrictions.c_str(), "%u-%u", &lport, &uport)) + if (doPortRestrictions) { - std::cerr << "Adding Port Restriction (" << lport << "-" << uport << ")"; - std::cerr << std::endl; - } - else - { - std::cerr << "Failed to parse Port Restrictions ... exiting"; - std::cerr << std::endl; - exit(1); - } + if (2 == sscanf(portRestrictions.c_str(), "%u-%u", &lport, &uport)) + { + std::cerr << "Adding Port Restriction (" << lport << "-" << uport << ")"; + std::cerr << std::endl; + } + else + { + std::cerr << "Failed to parse Port Restrictions ... exiting"; + std::cerr << std::endl; + exit(1); + } - RestrictedUdpLayer *url = (RestrictedUdpLayer *) mDhtStack->getUdpLayer(); - url->addRestrictedPortRange(lport, uport); - } + RestrictedUdpLayer *url = (RestrictedUdpLayer *) mDhtStack->getUdpLayer(); + url->addRestrictedPortRange(lport, uport); + } #else //LOCALNET_TESTING #ifdef RS_USE_BITDHT - rsUdpStack *mDhtStack = new rsUdpStack(tmpladdr); + mDhtStack = new rsUdpStack(tmpladdr); #endif #endif //LOCALNET_TESTING + } #ifdef RS_USE_BITDHT @@ -1090,96 +1100,105 @@ int RsServer::StartupRetroShare() /* construct the rest of the stack, important to build them in the correct order! */ /* MOST OF THIS IS COMMENTED OUT UNTIL THE REST OF libretroshare IS READY FOR IT! */ - UdpSubReceiver *udpReceivers[RSUDP_NUM_TOU_RECVERS]; - int udpTypes[RSUDP_NUM_TOU_RECVERS]; + p3BitDht *mBitDht = NULL ; + rsDht = NULL ; + rsFixedUdpStack *mProxyStack = NULL ; -#ifdef RS_USE_DHT_STUNNER - // FIRST DHT STUNNER. - UdpStunner *mDhtStunner = new UdpStunner(mDhtStack); - mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */ - mDhtStack->addReceiver(mDhtStunner); - -#ifdef LOCALNET_TESTING - mDhtStunner->SetAcceptLocalNet(); -#endif -#endif // RS_USE_DHT_STUNNER - - - // NEXT BITDHT. - p3BitDht *mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile); - - /* install external Pointer for Interface */ - rsDht = mBitDht; - - // NEXT THE RELAY (NEED to keep a reference for installing RELAYS) - UdpRelayReceiver *mRelay = new UdpRelayReceiver(mDhtStack); - udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX] = mRelay; /* RELAY Connections (DHT Port) */ - udpTypes[RSUDP_TOU_RECVER_RELAY_IDX] = TOU_RECEIVER_TYPE_UDPRELAY; - mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX]); - - // LAST ON THIS STACK IS STANDARD DIRECT TOU - udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX] = new UdpPeerReceiver(mDhtStack); /* standard DIRECT Connections (DHT Port) */ - udpTypes[RSUDP_TOU_RECVER_DIRECT_IDX] = TOU_RECEIVER_TYPE_UDPPEER; - mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX]); - - // NOW WE BUILD THE SECOND STACK. - // Create the Second UdpStack... Port should be random (but openable!). - // We do this by binding to xx.xx.xx.xx:0 which which gives us a random port. - - struct sockaddr_in sndladdr; - sockaddr_clear(&sndladdr); - -#ifdef LOCALNET_TESTING - - // // HACK Proxy Port near Dht Port - For Relay Testing. - // uint16_t rndport = rsInitConfig->port + 3; - // sndladdr.sin_port = htons(rndport); - - rsFixedUdpStack *mProxyStack = new rsFixedUdpStack(UDP_TEST_RESTRICTED_LAYER, sndladdr); - - /* portRestrictions already parsed */ - if (doPortRestrictions) + if(!RsAccounts::isHiddenNode()) { - RestrictedUdpLayer *url = (RestrictedUdpLayer *) mProxyStack->getUdpLayer(); - url->addRestrictedPortRange(lport, uport); - } -#else - rsFixedUdpStack *mProxyStack = new rsFixedUdpStack(sndladdr); -#endif + UdpSubReceiver *udpReceivers[RSUDP_NUM_TOU_RECVERS]; + int udpTypes[RSUDP_NUM_TOU_RECVERS]; #ifdef RS_USE_DHT_STUNNER - // FIRSTLY THE PROXY STUNNER. - UdpStunner *mProxyStunner = new UdpStunner(mProxyStack); - mProxyStunner->setTargetStunPeriod(300); /* slow (5mins) */ - mProxyStack->addReceiver(mProxyStunner); + // FIRST DHT STUNNER. + UdpStunner *mDhtStunner = new UdpStunner(mDhtStack); + mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */ + mDhtStack->addReceiver(mDhtStunner); #ifdef LOCALNET_TESTING - mProxyStunner->SetAcceptLocalNet(); + mDhtStunner->SetAcceptLocalNet(); #endif #endif // RS_USE_DHT_STUNNER - // FINALLY THE PROXY UDP CONNECTIONS - udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX] = new UdpPeerReceiver(mProxyStack); /* PROXY Connections (Alt UDP Port) */ - udpTypes[RSUDP_TOU_RECVER_PROXY_IDX] = TOU_RECEIVER_TYPE_UDPPEER; - mProxyStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX]); + // NEXT BITDHT. - // REAL INITIALISATION - WITH THREE MODES - tou_init((void **) udpReceivers, udpTypes, RSUDP_NUM_TOU_RECVERS); + + mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile); + + // NEXT THE RELAY (NEED to keep a reference for installing RELAYS) + UdpRelayReceiver *mRelay = new UdpRelayReceiver(mDhtStack); + udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX] = mRelay; /* RELAY Connections (DHT Port) */ + udpTypes[RSUDP_TOU_RECVER_RELAY_IDX] = TOU_RECEIVER_TYPE_UDPRELAY; + mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_RELAY_IDX]); + + // LAST ON THIS STACK IS STANDARD DIRECT TOU + udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX] = new UdpPeerReceiver(mDhtStack); /* standard DIRECT Connections (DHT Port) */ + udpTypes[RSUDP_TOU_RECVER_DIRECT_IDX] = TOU_RECEIVER_TYPE_UDPPEER; + mDhtStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_DIRECT_IDX]); + + /* install external Pointer for Interface */ + rsDht = mBitDht; + + // NOW WE BUILD THE SECOND STACK. + // Create the Second UdpStack... Port should be random (but openable!). + // We do this by binding to xx.xx.xx.xx:0 which which gives us a random port. + + struct sockaddr_in sndladdr; + sockaddr_clear(&sndladdr); + +#ifdef LOCALNET_TESTING + + // // HACK Proxy Port near Dht Port - For Relay Testing. + // uint16_t rndport = rsInitConfig->port + 3; + // sndladdr.sin_port = htons(rndport); + + mProxyStack = new rsFixedUdpStack(UDP_TEST_RESTRICTED_LAYER, sndladdr); + + /* portRestrictions already parsed */ + if (doPortRestrictions) + { + RestrictedUdpLayer *url = (RestrictedUdpLayer *) mProxyStack->getUdpLayer(); + url->addRestrictedPortRange(lport, uport); + } +#else + mProxyStack = new rsFixedUdpStack(sndladdr); +#endif #ifdef RS_USE_DHT_STUNNER - mBitDht->setupConnectBits(mDhtStunner, mProxyStunner, mRelay); + // FIRSTLY THE PROXY STUNNER. + UdpStunner *mProxyStunner = new UdpStunner(mProxyStack); + mProxyStunner->setTargetStunPeriod(300); /* slow (5mins) */ + mProxyStack->addReceiver(mProxyStunner); + +#ifdef LOCALNET_TESTING + mProxyStunner->SetAcceptLocalNet(); +#endif +#endif // RS_USE_DHT_STUNNER + + + // FINALLY THE PROXY UDP CONNECTIONS + udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX] = new UdpPeerReceiver(mProxyStack); /* PROXY Connections (Alt UDP Port) */ + udpTypes[RSUDP_TOU_RECVER_PROXY_IDX] = TOU_RECEIVER_TYPE_UDPPEER; + mProxyStack->addReceiver(udpReceivers[RSUDP_TOU_RECVER_PROXY_IDX]); + + // REAL INITIALISATION - WITH THREE MODES + tou_init((void **) udpReceivers, udpTypes, RSUDP_NUM_TOU_RECVERS); + +#ifdef RS_USE_DHT_STUNNER + mBitDht->setupConnectBits(mDhtStunner, mProxyStunner, mRelay); #else // RS_USE_DHT_STUNNER - mBitDht->setupConnectBits(mRelay); + mBitDht->setupConnectBits(mRelay); #endif // RS_USE_DHT_STUNNER #ifdef RS_USE_DHT_STUNNER - mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner)); + mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner)); #endif // RS_USE_DHT_STUNNER -// #else //RS_USE_BITDHT -// /* install NULL Pointer for rsDht Interface */ -// rsDht = NULL; + // #else //RS_USE_BITDHT + // /* install NULL Pointer for rsDht Interface */ + // rsDht = NULL; #endif //RS_USE_BITDHT + } /**************************** BITDHT ***********************************/ @@ -1210,7 +1229,7 @@ int RsServer::StartupRetroShare() std::vector plugins_directories ; #ifdef __APPLE__ - plugins_directories.push_back(rsAccounts->PathDataDirectory()) ; + plugins_directories.push_back(RsAccounts::systemPathDataDirectory()) ; #endif #if !defined(WINDOWS_SYS) && defined(PLUGIN_DIR) plugins_directories.push_back(std::string(PLUGIN_DIR)) ; @@ -1543,13 +1562,17 @@ int RsServer::StartupRetroShare() #endif // new services to test. -#ifndef RETROTOR - p3BanList *mBanList = new p3BanList(serviceCtrl, mNetMgr); - rsBanList = mBanList ; - pqih -> addService(mBanList, true); -#else - rsBanList = NULL ; -#endif + + p3BanList *mBanList = NULL; + + if(!RsAccounts::isHiddenNode()) + { + mBanList = new p3BanList(serviceCtrl, mNetMgr); + rsBanList = mBanList ; + pqih -> addService(mBanList, true); + } + else + rsBanList = NULL ; #ifdef RS_USE_BITDHT mBitDht->setupPeerSharer(mBanList); @@ -1567,30 +1590,32 @@ int RsServer::StartupRetroShare() /**************************************************************************/ + if(!RsAccounts::isHiddenNode()) + { #ifdef RS_USE_BITDHT - mNetMgr->addNetAssistConnect(1, mBitDht); - mNetMgr->addNetListener(mDhtStack); - mNetMgr->addNetListener(mProxyStack); - + mNetMgr->addNetAssistConnect(1, mBitDht); + mNetMgr->addNetListener(mDhtStack); + mNetMgr->addNetListener(mProxyStack); #endif #ifdef RS_ENABLE_ZEROCONF - p3ZeroConf *mZeroConf = new p3ZeroConf( - AuthGPG::getAuthGPG()->getGPGOwnId(), ownId, - mLinkMgr, mNetMgr, mPeerMgr); - mNetMgr->addNetAssistConnect(2, mZeroConf); - mNetMgr->addNetListener(mZeroConf); + p3ZeroConf *mZeroConf = new p3ZeroConf( + AuthGPG::getAuthGPG()->getGPGOwnId(), ownId, + mLinkMgr, mNetMgr, mPeerMgr); + mNetMgr->addNetAssistConnect(2, mZeroConf); + mNetMgr->addNetListener(mZeroConf); #endif #ifdef RS_ENABLE_ZCNATASSIST - // Apple's UPnP & NAT-PMP assistance. - p3zcNatAssist *mZcNatAssist = new p3zcNatAssist(); - mNetMgr->addNetAssistFirewall(1, mZcNatAssist); + // Apple's UPnP & NAT-PMP assistance. + p3zcNatAssist *mZcNatAssist = new p3zcNatAssist(); + mNetMgr->addNetAssistFirewall(1, mZcNatAssist); #else - // Original UPnP Interface. - pqiNetAssistFirewall *mUpnpMgr = new upnphandler(); - mNetMgr->addNetAssistFirewall(1, mUpnpMgr); + // Original UPnP Interface. + pqiNetAssistFirewall *mUpnpMgr = new upnphandler(); + mNetMgr->addNetAssistFirewall(1, mUpnpMgr); #endif + } /**************************************************************************/ /* need to Monitor too! */ @@ -1623,9 +1648,10 @@ int RsServer::StartupRetroShare() mConfigMgr->addConfiguration("p3History.cfg" , mHistoryMgr); mConfigMgr->addConfiguration("p3Status.cfg" , mStatusSrv); mConfigMgr->addConfiguration("turtle.cfg" , tr); -#ifndef RETROTOR - mConfigMgr->addConfiguration("banlist.cfg" , mBanList); -#endif + + if(!RsAccounts::isHiddenNode()) + mConfigMgr->addConfiguration("banlist.cfg" , mBanList); + mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl); mConfigMgr->addConfiguration("reputations.cfg" , mReputations); #ifdef ENABLE_GROUTER @@ -1896,6 +1922,10 @@ int RsServer::StartupRetroShare() /* Startup this thread! */ start("rs main") ; + std::cerr << "========================================================================" << std::endl; + std::cerr << "== RsInit:: Retroshare core started ==" << std::endl; + std::cerr << "========================================================================" << std::endl; + return 1; } diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index 22206b1b4..def31196e 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -195,10 +195,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) ui.nodeType_CB->setCurrentIndex(1); ui.nodeType_CB->setEnabled(false); #endif -#ifdef RETROTOR - ui.adv_checkbox->setChecked(false); - ui.adv_checkbox->setVisible(true); -#endif +//#ifdef RETROTOR +// ui.adv_checkbox->setChecked(false); +// ui.adv_checkbox->setVisible(true); +//#endif initKeyList(); setupState(); @@ -258,12 +258,7 @@ void GenCertDialog::mouseMoveEvent(QMouseEvent *e) void GenCertDialog::setupState() { bool adv_state = ui.adv_checkbox->isChecked(); - -#ifdef RETROTOR - bool retrotor = true ; -#else bool retrotor = false ; -#endif if(!adv_state) { diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index ffa7a49fd..07d0b01a5 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -84,12 +84,13 @@ #include "statusbar/ToasterDisable.h" #include "statusbar/SysTrayStatus.h" #include "statusbar/torstatus.h" -#include -#include -#include -#include -#include +#include "retroshare/rsstatus.h" +#include "retroshare/rsiface.h" +#include "retroshare/rspeers.h" +#include "retroshare/rsfiles.h" +#include "retroshare/rsnotify.h" +#include "retroshare/rsinit.h" #include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxsforums/GxsForumsDialog.h" @@ -250,14 +251,15 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) if(hiddenmode) { -#ifdef RETROTOR - torstatus = new TorStatus(); - torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool()); - statusBar()->addWidget(torstatus); - torstatus->getTorStatus(); -#else - torstatus = NULL ; -#endif + if(RsAccounts::isHiddenNode()) + { + torstatus = new TorStatus(); + torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool()); + statusBar()->addWidget(torstatus); + torstatus->getTorStatus(); + } + else + torstatus = NULL ; natstatus = NULL ; dhtstatus = NULL ; diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index dcfe29426..7cd537c68 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -29,11 +29,12 @@ #include -#include -#include -#include -#include -#include +#include "retroshare/rsbanlist.h" +#include "retroshare/rsconfig.h" +#include "retroshare/rsdht.h" +#include "retroshare/rspeers.h" +#include "retroshare/rsturtle.h" +#include "retroshare/rsinit.h" #include #include @@ -62,15 +63,6 @@ /// // Tabs numbers *after* non relevant tabs are removed. So do not use them to add/remove tabs!! -#ifdef RETROTOR -static const uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0; -static const uint32_t TAB_HIDDEN_SERVICE_INCOMING = 1; - -static const uint32_t TAB_NETWORK = 0; -static const uint32_t TAB_HIDDEN_SERVICE = 1; -static const uint32_t TAB_IP_FILTERS = 99; // This is a trick: these tabs do not exist, so enabling/disabling them has no effect -static const uint32_t TAB_RELAYS = 99; -#else const static uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0; const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 2; @@ -78,7 +70,6 @@ const static uint32_t TAB_NETWORK = 0; const static uint32_t TAB_IP_FILTERS = 1; const static uint32_t TAB_HIDDEN_SERVICE = 2; const static uint32_t TAB_RELAYS = 3; -#endif //#define SERVER_DEBUG 1 @@ -90,7 +81,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) manager = NULL ; -#ifdef RETROTOR + if(RsAccounts::isTorAuto()) + { // Here we use absolute numbers instead of consts defined above, because the consts correspond to the tab number *after* this tab removal. ui.tabWidget->removeTab(3) ; // remove relays. Not useful in Tor mode. @@ -109,7 +101,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) ui.hiddenpage_outHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ; ui.hiddenpage_inHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ; -#endif + } + ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ; ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_STATUS,new QTableWidgetItem(tr("Status"))) ; ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_ORIGIN,new QTableWidgetItem(tr("Origin"))) ; diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index 99e33b5f2..0dfd3dc7f 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -187,9 +187,7 @@ public: /** Sets whether the bandwidth graph is always on top. */ void setBWGraphAlwaysOnTop(bool alwaysOnTop); -#ifdef RETROTOR void setHiddenServiceKey() ; -#endif uint getNewsFeedFlags(); void setNewsFeedFlags(uint flags); diff --git a/retroshare-gui/src/gui/statusbar/torstatus.cpp b/retroshare-gui/src/gui/statusbar/torstatus.cpp index 399243ac4..26c9a896a 100644 --- a/retroshare-gui/src/gui/statusbar/torstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/torstatus.cpp @@ -26,12 +26,11 @@ #include #include "retroshare/rsconfig.h" +#include "retroshare/rsinit.h" #include "util/misc.h" -#ifdef RETROTOR #include "TorControl/TorManager.h" #include "TorControl/TorControl.h" -#endif #include @@ -86,53 +85,56 @@ void TorStatus::getTorStatus() int S = QFontMetricsF(torstatusLabel->font()).height(); -#ifdef RETROTOR - // get Tor status - int tor_control_status = Tor::TorManager::instance()->control()->status(); - int torstatus = Tor::TorManager::instance()->control()->torStatus(); - - QString tor_control_status_str,torstatus_str ; - bool tor_control_ok ; - - switch(tor_control_status) + if(RsAccounts::isTorAuto()) { - default: - case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ; - case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ; - case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ; - case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ; - case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ; - } + // get Tor status + int tor_control_status = Tor::TorManager::instance()->control()->status(); + int torstatus = Tor::TorManager::instance()->control()->torStatus(); - switch(torstatus) - { - default: - case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ; - case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ; - case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ; - } + QString tor_control_status_str,torstatus_str ; + bool tor_control_ok ; + + switch(tor_control_status) + { + default: + case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ; + case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ; + case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ; + case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ; + case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ; + } + + switch(torstatus) + { + default: + case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ; + case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ; + case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ; + } #define MIN_RS_NET_SIZE 10 - if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok) + if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok) + { + // RED - some issue. + torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation)); + torstatusLabel->setToolTip( text + tr("Tor is currently offline")); + } + else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok) + { + torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation)); + torstatusLabel->setToolTip( text + tr("Tor is OK")); + } + else // torstatus == Tor::TorControl::TorUnknown + { + // GRAY. + torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation)); + torstatusLabel->setToolTip( text + tr("No tor configuration")); + } + } + else { - // RED - some issue. - torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation)); + torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation)); torstatusLabel->setToolTip( text + tr("Tor is currently offline")); } - else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok) - { - torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation)); - torstatusLabel->setToolTip( text + tr("Tor is OK")); - } - else // torstatus == Tor::TorControl::TorUnknown - { - // GRAY. - torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation)); - torstatusLabel->setToolTip( text + tr("No tor configuration")); - } -#else - torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation)); - torstatusLabel->setToolTip( text + tr("Tor is currently offline")); -#endif } diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index 604c15026..ad3298eab 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -51,10 +51,8 @@ # include "gui/settings/WebuiPage.h" #endif -#ifdef RETROTOR -# include "TorControl/TorManager.h" -# include "TorControl/TorControlWindow.h" -#endif +#include "TorControl/TorManager.h" +#include "TorControl/TorControlWindow.h" #include "retroshare/rsidentity.h" #include "retroshare/rspeers.h" @@ -355,8 +353,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); RsAccounts::getCurrentAccountOptions(is_hidden_node,is_auto_tor,is_first_time); -#ifdef UNFINISHED - if(RsAccounts::AccountType() == RS_ACCOUNT_TYPE_HIDDEN_TOR_AUTO) + if(is_auto_tor) { // Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service @@ -402,7 +399,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); } } } -#endif QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/); @@ -418,33 +414,35 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); return 1; } -#ifdef RETROTOR - // Tor works with viable hidden service. Let's use it! + if(is_auto_tor) + { + // Tor works with viable hidden service. Let's use it! - QString service_id ; - QString onion_address ; - uint16_t service_port ; - uint16_t service_target_port ; - uint16_t proxy_server_port ; - QHostAddress service_target_address ; - QHostAddress proxy_server_address ; + QString service_id ; + QString onion_address ; + uint16_t service_port ; + uint16_t service_target_port ; + uint16_t proxy_server_port ; + QHostAddress service_target_address ; + QHostAddress proxy_server_address ; - torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port); - torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ; + Tor::TorManager *torManager = Tor::TorManager::instance(); + torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port); + torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ; - std::cerr << "Got hidden service info: " << std::endl; - std::cerr << " onion address : " << onion_address.toStdString() << std::endl; - std::cerr << " service_id : " << service_id.toStdString() << std::endl; - std::cerr << " service port : " << service_port << std::endl; - std::cerr << " target port : " << service_target_port << std::endl; - std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl; + std::cerr << "Got hidden service info: " << std::endl; + std::cerr << " onion address : " << onion_address.toStdString() << std::endl; + std::cerr << " service_id : " << service_id.toStdString() << std::endl; + std::cerr << " service port : " << service_port << std::endl; + std::cerr << " target port : " << service_target_port << std::endl; + std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl; - std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl; + std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl; - rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port); - rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port); - rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ; -#endif + rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port); + rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port); + rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ; + } Rshare::initPlugins(); diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 8899de337..d973e5de8 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -19,11 +19,9 @@ libresapihttpserver { !include("../../libretroshare/src/use_libretroshare.pri"):error("Including") -retrotor { - FORMS += TorControl/TorControlWindow.ui - SOURCES += TorControl/TorControlWindow.cpp - HEADERS += TorControl/TorControlWindow.h -} +FORMS += TorControl/TorControlWindow.ui +SOURCES += TorControl/TorControlWindow.cpp +HEADERS += TorControl/TorControlWindow.h #QMAKE_CFLAGS += -fmudflap #LIBS *= /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflap.a /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflapth.a @@ -285,7 +283,8 @@ wikipoos { LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a } -retrotor { +# Tor controller + HEADERS += TorControl/AddOnionCommand.h \ TorControl/AuthenticateCommand.h \ TorControl/GetConfCommand.h \ @@ -324,7 +323,6 @@ SOURCES += TorControl/AddOnionCommand.cpp \ TorControl/SecureRNG.cpp \ TorControl/Settings.cpp \ TorControl/StrUtil.cpp -} # Input HEADERS += rshare.h \ diff --git a/retroshare.pri b/retroshare.pri index 79527a7c8..1e237f97c 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -91,15 +91,6 @@ no_sqlcipher:CONFIG -= sqlcipher CONFIG *= no_rs_autologin rs_autologin:CONFIG -= no_rs_autologin -# To build RetroShare Tor only version with automatic hidden node setup append -# the following assignation to qmake command line "CONFIG+=retrotor" -CONFIG *= no_retrotor -retrotor { - CONFIG -= no_retrotor - CONFIG *= rs_onlyhiddennode - DEFINES *= RETROTOR -} - # To have only hidden node generation append the following assignation # to qmake command line "CONFIG+=rs_onlyhiddennode" CONFIG *= no_rs_onlyhiddennode @@ -144,7 +135,7 @@ rs_macos10.10:CONFIG -= rs_macos10.11 rs_macos10.12:CONFIG -= rs_macos10.11 # To disable deep search append the following assignation to qmake command line -# "CONFIG+=no_rs_deep_search" +CONFIG+=no_rs_deep_search CONFIG *= rs_deep_search no_rs_deep_search:CONFIG -= rs_deep_search From 62b9a74324c0f7d1eec24ac4710cb1220b230e6c Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 25 Jul 2018 15:31:18 +0200 Subject: [PATCH 148/213] fixed running with TorControl in new mode --- libretroshare/src/rsserver/rsinit.cc | 14 +- .../src/gui/settings/ServerPage.cpp | 19 +- retroshare-gui/src/gui/settings/ServerPage.ui | 910 +++++++++--------- 3 files changed, 472 insertions(+), 471 deletions(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index f4458e42f..201da127c 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1574,10 +1574,6 @@ int RsServer::StartupRetroShare() else rsBanList = NULL ; -#ifdef RS_USE_BITDHT - mBitDht->setupPeerSharer(mBanList); -#endif - p3BandwidthControl *mBwCtrl = new p3BandwidthControl(pqih); pqih -> addService(mBwCtrl, true); @@ -1593,6 +1589,8 @@ int RsServer::StartupRetroShare() if(!RsAccounts::isHiddenNode()) { #ifdef RS_USE_BITDHT + mBitDht->setupPeerSharer(mBanList); + mNetMgr->addNetAssistConnect(1, mBitDht); mNetMgr->addNetListener(mDhtStack); mNetMgr->addNetListener(mProxyStack); @@ -1649,7 +1647,7 @@ int RsServer::StartupRetroShare() mConfigMgr->addConfiguration("p3Status.cfg" , mStatusSrv); mConfigMgr->addConfiguration("turtle.cfg" , tr); - if(!RsAccounts::isHiddenNode()) + if(mBanList != NULL) mConfigMgr->addConfiguration("banlist.cfg" , mBanList); mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl); @@ -1659,7 +1657,8 @@ int RsServer::StartupRetroShare() #endif #ifdef RS_USE_BITDHT - mConfigMgr->addConfiguration("bitdht.cfg" , mBitDht); + if(mBitDht != NULL) + mConfigMgr->addConfiguration("bitdht.cfg" , mBitDht); #endif #ifdef RS_ENABLE_GXS @@ -1886,7 +1885,8 @@ int RsServer::StartupRetroShare() //mDhtMgr->start(); #ifdef RS_USE_BITDHT - mBitDht->start(); + if(mBitDht != NULL) + mBitDht->start(); #endif /**************************************************************************/ diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 7cd537c68..a7885922c 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -64,11 +64,12 @@ // Tabs numbers *after* non relevant tabs are removed. So do not use them to add/remove tabs!! const static uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0; -const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 2; +const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 1; +const static uint32_t TAB_HIDDEN_SERVICE_I2P_BOB = 2; const static uint32_t TAB_NETWORK = 0; -const static uint32_t TAB_IP_FILTERS = 1; -const static uint32_t TAB_HIDDEN_SERVICE = 2; +const static uint32_t TAB_HIDDEN_SERVICE = 1; +const static uint32_t TAB_IP_FILTERS = 2; const static uint32_t TAB_RELAYS = 3; //#define SERVER_DEBUG 1 @@ -85,10 +86,11 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) { // Here we use absolute numbers instead of consts defined above, because the consts correspond to the tab number *after* this tab removal. - ui.tabWidget->removeTab(3) ; // remove relays. Not useful in Tor mode. - ui.tabWidget->removeTab(1) ; // remove IP filters. Not useful in Tor mode. + ui.tabWidget->removeTab(TAB_RELAYS) ; // remove relays. Not useful in Tor mode. + ui.tabWidget->removeTab(TAB_IP_FILTERS) ; // remove IP filters. Not useful in Tor mode. + + ui.hiddenServiceTab->removeTab(TAB_HIDDEN_SERVICE_I2P_BOB) ; // remove the Automatic I2P/BOB tab - ui.hiddenServiceTab->removeTab(1) ; // remove the Automatic I2P/BOB tab ui.hiddenpage_proxyAddress_i2p->hide() ; ui.hiddenpage_proxyLabel_i2p->hide() ; ui.hiddenpage_proxyPort_i2p->hide() ; @@ -130,7 +132,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) for(std::list::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it) ui.IPServersLV->addItem(QString::fromStdString(*it)) ; - ui.hiddenServiceTab->setTabEnabled(TAB_HIDDEN_SERVICE_INCOMING, false); ui.gbBob->setEnabled(false); ui.swBobAdvanced->setCurrentIndex(0); @@ -333,8 +334,8 @@ void ServerPage::load() if (mIsHiddenNode) { mHiddenType = detail.hiddenType; - ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter - ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay + //ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter + //ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay loadHiddenNode(); return; } diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui index f8f55423f..b4315a704 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.ui +++ b/retroshare-gui/src/gui/settings/ServerPage.ui @@ -26,7 +26,7 @@ - 0 + 1 @@ -525,277 +525,6 @@ behind a firewall or a VPN. IPServersLV ipAddressList - - - IP Filters - - - - - - Activate IP filtering - - - - - - - 0 - - - - IP blacklist - - - - - - Qt::CustomContextMenu - - - <html><head/><body><p>This list gets automatically filled with information gathered at multiple sources: masquerading peers reported by the DHT, IP ranges entered by you, and IP ranges reported by your friends. Default settings should protect you against large scale traffic relaying.</p><p>Automatically guessing masquerading IPs can put your friends IPs in the blacklist. In this case, use the context menu to whitelist them.</p></body></html> - - - true - - - QAbstractItemView::SingleSelection - - - false - - - true - - - - IP range - - - - - Status - - - - - Origin - - - - - Reason - - - - - Comment - - - - - - - - <html><head/><body><p>This is very drastic, be careful. Since masquerading IPs might be actual real IPs, this option might cause disconnection, and will probably force you to add your friends' IPs into the whitelist.</p></body></html> - - - Ban every IP reported by your friends - - - - - - - <html><head/><body><p>Another drastic option. If you use it, be prepared to add your friends' IPs into the whitelist when needed.</p></body></html> - - - Ban every masquerading IP reported by your DHT - - - - - - - - - <html><head/><body><p>If used alone, this option protects you quite well from large scale IP masquerading.</p></body></html> - - - Automatically ban ranges of DHT masquerading IPs starting at - - - - - - - IPs - - - 2 - - - 255 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - IP whitelist - - - - - - Qt::CustomContextMenu - - - <html><head/><body><p>White listed IPs are gathered from the following sources: IPs coming inside a manually exchanged certificate, IP ranges entered by you in this window, or in the security feed items.</p><p>The default behavior for Retroshare is to (1) always allow connection to peers with IP in the whitelist, even if that IP is also blacklisted; (2) optionally require IPs to be in the whitelist. You can change this behavior for each peer in the &quot;Details&quot; window of each Retroshare node. </p></body></html> - - - true - - - QAbstractItemView::SingleSelection - - - false - - - true - - - - IP range - - - - - Status - - - - - Origin - - - - - Reason - - - - - Comment - - - - - - - - - - - - Manual input - - - - - - - - - 0 - 0 - - - - <html><head/><body><p>Enter an IP range. Accepted formats:</p><p>193.190.209.15</p><p>193.190.209.15/24</p><p>193.190.209.15/16</p></body></html> - - - - - - - 16 - - - 32 - - - 8 - - - 24 - - - - - - - - 0 - 0 - - - - <html><head/><body><p>Enter any comment you'd like</p></body></html> - - - - - - - Add to blacklist - - - - - - - Add to whitelist - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Hidden Service Configuration @@ -810,7 +539,7 @@ behind a firewall or a VPN. - 0 + 1 @@ -981,6 +710,204 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why + + + Incoming + + + + + + <html><head/><body><p>Setup your hidden address (and port if needed)</p></body></html> + + + + + + + + + 10 + + + 65535 + + + + + + + + + <html><head/><body><p>This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &quot;security warning&quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it, which you should interpret as a sign of good communication.</p></body></html> + + + Test + + + + + + + + + 10 + + + 65535 + + + + + + + Service Address + + + + + + + Local Address + + + + + + + <html><head/><body><p>This is your hidden address. It should look like <span style=" font-weight:600;">[something].onion</span> or <span style=" font-weight:600;">[something].b32.i2p. </span>If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. <span style=" font-weight:600;">/var/lib/tor/[service name]/hostname</span>. For I2P: Setup a server tunnel ( http://127.0.0.1:7657/i2ptunnelmgr ) and copy it's base32 address when it is started (should end with .b32.i2p)</p></body></html> + + + + + + + <html><head/><body><p>This is the local address to which the hidden service points at your localhost. Most of the time, <span style=" font-weight:600;">127.0.0.1</span> is the right answer.</p></body></html> + + + + + + + + + + 16 + 16 + + + + + + + :/images/ledoff1.png + + + + + + + <html><head/><body><p>This led turns green only if you launch an active test using the above button. </p><p>When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) </p><p>network. Congratulations!</p></body></html> + + + incoming ok + + + + + + + + + + + + + Expected Configuration: + + + + + + + + 0 + 0 + + + + + 0 + 10 + + + + + 16777215 + 50 + + + + Qt::ScrollBarAlwaysOff + + + true + + + Please fill in a service address + + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + true + + + To Receive Connections, you must first setup a Tor/I2P Hidden Service. + +For Tor: See torrc and documentation for HOWTO details. + +For I2P: See http://127.0.0.1:7657/i2ptunnelmgr for setting up a server tunnel: +Tunnel Wizard -> Server Tunnel -> Standard -> enter a name -> enter the address and port your RS is using (see Local Address above) -> check 'Auto Start' -> finish! + +Once this is done, paste the Onion/I2P (Base32) Address in the box above. +This is your external address on the Tor/I2P network. +Finally make sure that the Ports match the configuration. + +If you have issues connecting over Tor check the Tor logs too. + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + Automatic I2P/BOB @@ -1456,204 +1383,277 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + + + + + + + IP Filters + + + + + + Activate IP filtering + + + + + + + 0 + + - Incoming + IP blacklist - + - - - <html><head/><body><p>Setup your hidden address (and port if needed)</p></body></html> + + + Qt::CustomContextMenu - - - - - - - - 10 - - - 65535 - - - - - - - - - <html><head/><body><p>This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &quot;security warning&quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it, which you should interpret as a sign of good communication.</p></body></html> - - - Test - - - - - - - - - 10 - - - 65535 - - - - - - - Service Address - - - - - - - Local Address - - - - - - - <html><head/><body><p>This is your hidden address. It should look like <span style=" font-weight:600;">[something].onion</span> or <span style=" font-weight:600;">[something].b32.i2p. </span>If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. <span style=" font-weight:600;">/var/lib/tor/[service name]/hostname</span>. For I2P: Setup a server tunnel ( http://127.0.0.1:7657/i2ptunnelmgr ) and copy it's base32 address when it is started (should end with .b32.i2p)</p></body></html> - - - - - - - <html><head/><body><p>This is the local address to which the hidden service points at your localhost. Most of the time, <span style=" font-weight:600;">127.0.0.1</span> is the right answer.</p></body></html> - - - - - - - - - - 16 - 16 - - - - - - - :/images/ledoff1.png - - - - - - - <html><head/><body><p>This led turns green only if you launch an active test using the above button. </p><p>When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) </p><p>network. Congratulations!</p></body></html> - - - incoming ok - - - - - - - - - - - - - Expected Configuration: - - - - - - - - 0 - 0 - - - - - 0 - 10 - - - - - 16777215 - 50 - - - - Qt::ScrollBarAlwaysOff - - - true - - - Please fill in a service address - - - - - - - - - - 0 - 0 - + + <html><head/><body><p>This list gets automatically filled with information gathered at multiple sources: masquerading peers reported by the DHT, IP ranges entered by you, and IP ranges reported by your friends. Default settings should protect you against large scale traffic relaying.</p><p>Automatically guessing masquerading IPs can put your friends IPs in the blacklist. In this case, use the context menu to whitelist them.</p></body></html> - - - 16777215 - 16777215 - - - + true - - To Receive Connections, you must first setup a Tor/I2P Hidden Service. - -For Tor: See torrc and documentation for HOWTO details. - -For I2P: See http://127.0.0.1:7657/i2ptunnelmgr for setting up a server tunnel: -Tunnel Wizard -> Server Tunnel -> Standard -> enter a name -> enter the address and port your RS is using (see Local Address above) -> check 'Auto Start' -> finish! - -Once this is done, paste the Onion/I2P (Base32) Address in the box above. -This is your external address on the Tor/I2P network. -Finally make sure that the Ports match the configuration. - -If you have issues connecting over Tor check the Tor logs too. + + QAbstractItemView::SingleSelection + + + false + + + true + + + + IP range + + + + + Status + + + + + Origin + + + + + Reason + + + + + Comment + + + + + + + + <html><head/><body><p>This is very drastic, be careful. Since masquerading IPs might be actual real IPs, this option might cause disconnection, and will probably force you to add your friends' IPs into the whitelist.</p></body></html> + + + Ban every IP reported by your friends - - - Qt::Vertical + + + <html><head/><body><p>Another drastic option. If you use it, be prepared to add your friends' IPs into the whitelist when needed.</p></body></html> - - - 20 - 40 - + + Ban every masquerading IP reported by your DHT - + + + + + + + + <html><head/><body><p>If used alone, this option protects you quite well from large scale IP masquerading.</p></body></html> + + + Automatically ban ranges of DHT masquerading IPs starting at + + + + + + + IPs + + + 2 + + + 255 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + IP whitelist + + + + + + Qt::CustomContextMenu + + + <html><head/><body><p>White listed IPs are gathered from the following sources: IPs coming inside a manually exchanged certificate, IP ranges entered by you in this window, or in the security feed items.</p><p>The default behavior for Retroshare is to (1) always allow connection to peers with IP in the whitelist, even if that IP is also blacklisted; (2) optionally require IPs to be in the whitelist. You can change this behavior for each peer in the &quot;Details&quot; window of each Retroshare node. </p></body></html> + + + true + + + QAbstractItemView::SingleSelection + + + false + + + true + + + + IP range + + + + + Status + + + + + Origin + + + + + Reason + + + + + Comment + + + + + + + + + + + + Manual input + + + + + + + + + 0 + 0 + + + + <html><head/><body><p>Enter an IP range. Accepted formats:</p><p>193.190.209.15</p><p>193.190.209.15/24</p><p>193.190.209.15/16</p></body></html> + + + + + + + 16 + + + 32 + + + 8 + + + 24 + + + + + + + + 0 + 0 + + + + <html><head/><body><p>Enter any comment you'd like</p></body></html> + + + + + + + Add to blacklist + + + + + + + Add to whitelist + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + From 74ec558c455ded7a3481145f58694cfa3ef06c9d Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 26 Jul 2018 09:39:26 +0200 Subject: [PATCH 149/213] reworked GenCertDialog with node type on top level --- retroshare-gui/src/gui/GenCertDialog.cpp | 28 +++++--- retroshare-gui/src/gui/GenCertDialog.ui | 91 +++++++++++------------- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index def31196e..cfe33b349 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -258,26 +258,34 @@ void GenCertDialog::mouseMoveEvent(QMouseEvent *e) void GenCertDialog::setupState() { bool adv_state = ui.adv_checkbox->isChecked(); - bool retrotor = false ; if(!adv_state) { ui.reuse_existing_node_CB->setChecked(false) ; - ui.nodeType_CB->setCurrentIndex(retrotor?1:0) ; ui.keylength_comboBox->setCurrentIndex(0) ; } - bool hidden_state = ui.nodeType_CB->currentIndex()==1; + bool hidden_state = ui.nodeType_CB->currentIndex()==1 || ui.nodeType_CB->currentIndex()==2; bool generate_new = !ui.reuse_existing_node_CB->isChecked(); + bool tor_auto = ui.nodeType_CB->currentIndex()==1; genNewGPGKey = generate_new; + switch(ui.nodeType_CB->currentIndex()) + { + case 0: ui.nodeTypeExplanation_TE->setText(tr("Your IP is visible to trusted nodes only. You can optionally connect to hidden nodes if running Tor on your machine.")); + break; + case 1: ui.nodeTypeExplanation_TE->setText(tr("Your IP is hidden. All traffic happens over the Tor network. Best choice if you cannot trust friend nodes with your own IP.")); + break; + case 2: ui.nodeTypeExplanation_TE->setText(tr("Hidden node for advanced users only, that allows to use other proxy solutions such as I2P.")); + break; + } + //ui.no_node_label->setVisible(false); setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node")); //ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node")); - ui.label_nodeType->setVisible(adv_state && !retrotor) ; - ui.nodeType_CB->setVisible(adv_state && !retrotor) ; + ui.nodeType_CB->setVisible(true); ui.reuse_existing_node_CB->setEnabled(adv_state) ; ui.importIdentity_PB->setVisible(adv_state && !generate_new) ; ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ; @@ -313,13 +321,13 @@ void GenCertDialog::setupState() ui.entropy_bar->setVisible(true); ui.genButton->setVisible(true); - ui.hiddenaddr_input->setVisible(hidden_state && !retrotor); - ui.hiddenaddr_label->setVisible(hidden_state && !retrotor); + ui.hiddenaddr_input->setVisible(hidden_state && !tor_auto); + ui.hiddenaddr_label->setVisible(hidden_state && !tor_auto); - ui.hiddenport_label->setVisible(hidden_state && !retrotor); - ui.hiddenport_spinBox->setVisible(hidden_state && !retrotor); + ui.hiddenport_label->setVisible(hidden_state && !tor_auto); + ui.hiddenport_spinBox->setVisible(hidden_state && !tor_auto); - ui.cbUseBob->setVisible(hidden_state && !retrotor); + ui.cbUseBob->setVisible(hidden_state && !tor_auto); if(!mAllFieldsOk) { diff --git a/retroshare-gui/src/gui/GenCertDialog.ui b/retroshare-gui/src/gui/GenCertDialog.ui index 28ce3bd88..9e93de934 100644 --- a/retroshare-gui/src/gui/GenCertDialog.ui +++ b/retroshare-gui/src/gui/GenCertDialog.ui @@ -6,8 +6,8 @@ 0 0 - 569 - 426 + 978 + 826 @@ -50,10 +50,7 @@ QFrame::Raised - - - 9 - + @@ -71,7 +68,32 @@ - + + + + + + 0 + 0 + + + + + Standard node + + + + + Hidden node (over Tor) + + + + + Hidden node (Tor/I2P - Manually configured) + + + + @@ -110,6 +132,19 @@ + + + + TextLabel + + + Qt::RichText + + + true + + + @@ -233,26 +268,6 @@ - - - - - 0 - 0 - - - - - Standard node - - - - - TOR/I2P Hidden node - - - - @@ -675,28 +690,6 @@ - - - - - 24 - 24 - - - - - - - :/icons/svg/netgraph.svg - - - true - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - From 22bc40e3ccc23a9a520f5259d95930a4e4291a55 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 26 Jul 2018 19:25:30 +0200 Subject: [PATCH 150/213] udated GenCertDialog with new layout --- retroshare-gui/src/gui/GenCertDialog.cpp | 22 +++++++---- retroshare-gui/src/gui/GenCertDialog.ui | 50 +++++++++++------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index cfe33b349..71b655a35 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -136,7 +136,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) //ui.headerFrame->setHeaderText(tr("Create a new profile")); connect(ui.reuse_existing_node_CB, SIGNAL(triggered()), this, SLOT(switchReuseExistingNode())); - connect(ui.adv_checkbox, SIGNAL(triggered()), this, SLOT(setupState())); + connect(ui.adv_checkbox, SIGNAL(toggled(bool)), this, SLOT(setupState())); connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState())); connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson())); @@ -181,10 +181,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) * mark last one as default. */ - QMenu *menu = new QMenu(tr("Advanced options")); - menu->addAction(ui.adv_checkbox); - menu->addAction(ui.reuse_existing_node_CB); - ui.optionsButton->setMenu(menu); + //QMenu *menu = new QMenu(tr("Advanced options")); + //menu->addAction(ui.adv_checkbox); + //menu->addAction(ui.reuse_existing_node_CB); + // ui.optionsButton->setMenu(menu); mAllFieldsOk = false ; mEntropyOk = false ; @@ -263,7 +263,14 @@ void GenCertDialog::setupState() { ui.reuse_existing_node_CB->setChecked(false) ; ui.keylength_comboBox->setCurrentIndex(0) ; +// ui.nodeType_CB->setCurrentIndex(0); } + ui.reuse_existing_node_CB->setVisible(adv_state) ; + +// ui.nodeType_CB->setVisible(adv_state) ; +// ui.nodeType_LB->setVisible(adv_state) ; +// ui.nodeTypeExplanation_TE->setVisible(adv_state) ; + bool hidden_state = ui.nodeType_CB->currentIndex()==1 || ui.nodeType_CB->currentIndex()==2; bool generate_new = !ui.reuse_existing_node_CB->isChecked(); bool tor_auto = ui.nodeType_CB->currentIndex()==1; @@ -272,11 +279,11 @@ void GenCertDialog::setupState() switch(ui.nodeType_CB->currentIndex()) { - case 0: ui.nodeTypeExplanation_TE->setText(tr("Your IP is visible to trusted nodes only. You can optionally connect to hidden nodes if running Tor on your machine.")); + case 0: ui.nodeTypeExplanation_TE->setText(tr("Your IP is visible to trusted nodes only. You can also connect to hidden nodes if running Tor on your machine. Best choice for sharing with trusted friends.")); break; case 1: ui.nodeTypeExplanation_TE->setText(tr("Your IP is hidden. All traffic happens over the Tor network. Best choice if you cannot trust friend nodes with your own IP.")); break; - case 2: ui.nodeTypeExplanation_TE->setText(tr("Hidden node for advanced users only, that allows to use other proxy solutions such as I2P.")); + case 2: ui.nodeTypeExplanation_TE->setText(tr("Hidden node for advanced users only. Allows to use other proxy solutions such as I2P.")); break; } @@ -285,7 +292,6 @@ void GenCertDialog::setupState() setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node")); //ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node")); - ui.nodeType_CB->setVisible(true); ui.reuse_existing_node_CB->setEnabled(adv_state) ; ui.importIdentity_PB->setVisible(adv_state && !generate_new) ; ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ; diff --git a/retroshare-gui/src/gui/GenCertDialog.ui b/retroshare-gui/src/gui/GenCertDialog.ui index 9e93de934..6c030db02 100644 --- a/retroshare-gui/src/gui/GenCertDialog.ui +++ b/retroshare-gui/src/gui/GenCertDialog.ui @@ -69,6 +69,19 @@ + + + + + 75 + true + + + + Node type: + + + @@ -108,13 +121,9 @@ - + - Options - - - - :/icons/svg/options.svg:/icons/svg/options.svg + advanced options @@ -122,12 +131,6 @@ 24 - - false - - - true - @@ -372,6 +375,13 @@ + + + + Use existing profile... + + + @@ -722,22 +732,6 @@ - - - true - - - Advanced options - - - - - true - - - Use existing profile - - name_input From cc1a05ddc925b0872c8bc8760985c20f45a0d67b Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 27 Jul 2018 12:33:06 +0200 Subject: [PATCH 151/213] fixed certificate creation in TorAuto mode --- libresapi/src/api/RsControlModule.cpp | 4 +++- libretroshare/src/retroshare/rsinit.h | 2 +- libretroshare/src/rsserver/rsaccounts.cc | 7 ++++--- libretroshare/src/rsserver/rsaccounts.h | 2 +- retroshare-gui/src/TorControl/TorControl.h | 14 +++++++------- retroshare-gui/src/TorControl/TorManager.cpp | 9 +++++++-- retroshare-gui/src/TorControl/TorManager.h | 11 ++++++----- retroshare-gui/src/gui/GenCertDialog.cpp | 18 +++++++++++++----- retroshare-gui/src/main.cpp | 2 +- 9 files changed, 43 insertions(+), 26 deletions(-) diff --git a/libresapi/src/api/RsControlModule.cpp b/libresapi/src/api/RsControlModule.cpp index da0413b3e..5caca6b8b 100644 --- a/libresapi/src/api/RsControlModule.cpp +++ b/libresapi/src/api/RsControlModule.cpp @@ -467,6 +467,8 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp) req.mStream << makeKeyValueReference("hidden_adress", hidden_address) << makeKeyValueReference("hidden_port", hidden_port_str); uint16_t hidden_port = 0; + bool auto_tor = false ; // to be set by API, so disabled until then. + if(hidden_address.empty() != hidden_port_str.empty()) { resp.setFail("you must both specify string hidden_adress and string hidden_port to create a hidden node."); @@ -539,7 +541,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp) mPassword = pgp_password; mFixedPassword = pgp_password; } - bool ssl_ok = RsAccounts::createNewAccount(pgp_id, "", ssl_name, "", hidden_port!=0, ssl_password, ssl_id, err_string); + bool ssl_ok = RsAccounts::createNewAccount(pgp_id, "", ssl_name, "", hidden_port!=0, auto_tor!=0, ssl_password, ssl_id, err_string); // clear fixed password to restore normal password operation // { diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 325eb7e98..db0e8fab8 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -170,7 +170,7 @@ public: static bool GetAccountDetails(const RsPeerId &id, RsPgpId &gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location); - static bool createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); + static bool createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc,bool is_auto_tor, const std::string& passwd, RsPeerId &sslId, std::string &errString); static void storeSelectedAccount() ; diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index 052c78a68..f6120e788 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -988,7 +988,7 @@ bool RsAccountsDetail::copyGnuPGKeyrings() /* Create SSL Certificates */ -bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString) +bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc,bool isautotor, const std::string& passwd, RsPeerId &sslId, std::string &errString) { /* select the PGP Identity first */ if (!SelectPGPAccount(pgp_id)) @@ -1141,6 +1141,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s newAccount.mLocation = loc; newAccount.mIsHiddenLoc = ishiddenloc; + newAccount.mIsAutoTor = isautotor; newAccount.mFirstRun = true; @@ -1409,9 +1410,9 @@ bool RsAccounts::GetAccountDetails(const RsPeerId &id, return rsAccounts->getCurrentAccountDetails(id, pgpId, pgpName, pgpEmail, location); } -bool RsAccounts::createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString) +bool RsAccounts::createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc, bool isautotor, const std::string& passwd, RsPeerId &sslId, std::string &errString) { - return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, passwd, sslId, errString); + return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, isautotor, passwd, sslId, errString); } /********************************************************************************* diff --git a/libretroshare/src/rsserver/rsaccounts.h b/libretroshare/src/rsserver/rsaccounts.h index 38a5925ad..518885a47 100644 --- a/libretroshare/src/rsserver/rsaccounts.h +++ b/libretroshare/src/rsserver/rsaccounts.h @@ -87,7 +87,7 @@ class RsAccountsDetail // Generate a new account based on a given PGP key returns its SSL id and sets it to be the preferred account. - bool GenerateSSLCertificate(const RsPgpId& gpg_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString); + bool GenerateSSLCertificate(const RsPgpId& gpg_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc, bool is_auto_tor,const std::string& passwd, RsPeerId &sslId, std::string &errString); // PGP Accounts. diff --git a/retroshare-gui/src/TorControl/TorControl.h b/retroshare-gui/src/TorControl/TorControl.h index 4a47384fa..5d208656e 100644 --- a/retroshare-gui/src/TorControl/TorControl.h +++ b/retroshare-gui/src/TorControl/TorControl.h @@ -67,17 +67,17 @@ public: enum Status { Error = -1, - NotConnected, - Connecting, - Authenticating, - Connected + NotConnected = 0x00, + Connecting = 0x01, + Authenticating = 0x02, + Connected = 0x03 }; enum TorStatus { - TorUnknown, - TorOffline, - TorReady + TorUnknown = 0x00, + TorOffline = 0x01, + TorReady = 0x02 }; diff --git a/retroshare-gui/src/TorControl/TorManager.cpp b/retroshare-gui/src/TorControl/TorManager.cpp index 96c45b88b..b538964e9 100644 --- a/retroshare-gui/src/TorControl/TorManager.cpp +++ b/retroshare-gui/src/TorControl/TorManager.cpp @@ -118,12 +118,17 @@ TorProcess *TorManager::process() return d->process; } -QString TorManager::dataDirectory() const +bool TorManager::isTorAvailable() +{ + return !instance()->d->torExecutablePath().isNull(); +} + +QString TorManager::torDataDirectory() const { return d->dataDir; } -void TorManager::setDataDirectory(const QString &path) +void TorManager::setTorDataDirectory(const QString &path) { d->dataDir = QDir::fromNativeSeparators(path); diff --git a/retroshare-gui/src/TorControl/TorManager.h b/retroshare-gui/src/TorControl/TorManager.h index d81d60d57..3db1036d3 100644 --- a/retroshare-gui/src/TorControl/TorManager.h +++ b/retroshare-gui/src/TorControl/TorManager.h @@ -58,18 +58,18 @@ class TorManager : public QObject Q_PROPERTY(Tor::TorControl* control READ control CONSTANT) Q_PROPERTY(bool hasError READ hasError NOTIFY errorChanged) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorChanged) - Q_PROPERTY(QString dataDirectory READ dataDirectory WRITE setDataDirectory) + Q_PROPERTY(QString torDataDirectory READ torDataDirectory WRITE setTorDataDirectory) public: - - explicit TorManager(QObject *parent = 0); + static bool isTorAvailable() ; static TorManager *instance(); TorProcess *process(); TorControl *control(); - QString dataDirectory() const; - void setDataDirectory(const QString &path); + + QString torDataDirectory() const; + void setTorDataDirectory(const QString &path); QString hiddenServiceDirectory() const; void setHiddenServiceDirectory(const QString &path); @@ -100,6 +100,7 @@ signals: void errorChanged(); private: + explicit TorManager(QObject *parent = 0); TorManagerPrivate *d; }; diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index 71b655a35..24a1c746e 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -34,6 +34,7 @@ #include #include "gui/settings/rsharesettings.h" +#include "TorControl/TorManager.h" #include "util/misc.h" #include @@ -479,7 +480,6 @@ void GenCertDialog::genPerson() /* Check the data from the GUI. */ std::string genLoc = ui.node_input->text().toUtf8().constData(); RsPgpId PGPId; - bool isHiddenLoc = false; if(ui.nickname_input->isVisible()) { @@ -512,18 +512,26 @@ void GenCertDialog::genPerson() } } - if (ui.nodeType_CB->currentIndex()==1) + bool isHiddenLoc = (ui.nodeType_CB->currentIndex()>0); + bool isAutoTor = (ui.nodeType_CB->currentIndex()==1); + + if(isAutoTor && !Tor::TorManager::isTorAvailable()) + { + QMessageBox::critical(this,tr("Tor is not available"),tr("No Tor executable has been found on your system. You need to install Tor before creating a hidden identity.")) ; + return ; + } + + if(isHiddenLoc) { std::string hl = ui.hiddenaddr_input->text().toStdString(); uint16_t port = ui.hiddenport_spinBox->value(); + bool useBob = ui.cbUseBob->isChecked(); if (useBob && hl.empty()) hl = "127.0.0.1"; RsInit::SetHiddenLocation(hl, port, useBob); /* parses it */ - - isHiddenLoc = true; } @@ -629,7 +637,7 @@ void GenCertDialog::genPerson() std::string err; this->hide();//To show dialog asking password PGP Key. std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl; - bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err); + bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err); if (okGen) { diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index ad3298eab..17c8ee507 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -360,7 +360,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ; Tor::TorManager *torManager = Tor::TorManager::instance(); - torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/")); + torManager->setTorDataDirectory(Rshare::dataDirectory() + QString("/tor/")); torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ; From d7c7e35d71510771af00aa64fb2517bc05b99699 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 27 Jul 2018 15:15:04 +0200 Subject: [PATCH 152/213] fixed compilation on MacOS --- libretroshare/src/rsserver/rsinit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 201da127c..2c63704b4 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1229,7 +1229,7 @@ int RsServer::StartupRetroShare() std::vector plugins_directories ; #ifdef __APPLE__ - plugins_directories.push_back(RsAccounts::systemPathDataDirectory()) ; + plugins_directories.push_back(RsAccounts::systemDataDirectory()) ; #endif #if !defined(WINDOWS_SYS) && defined(PLUGIN_DIR) plugins_directories.push_back(std::string(PLUGIN_DIR)) ; From 1297d2e1068e165fb894a94d38b335da623af09a Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 30 Jul 2018 10:47:36 +0200 Subject: [PATCH 153/213] fixed double calls to pthread_exit() (one being implicit after return from main thread method) -- patch from sss --- libretroshare/src/util/extaddrfinder.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/libretroshare/src/util/extaddrfinder.cc b/libretroshare/src/util/extaddrfinder.cc index d0395c710..fbed6fe85 100644 --- a/libretroshare/src/util/extaddrfinder.cc +++ b/libretroshare/src/util/extaddrfinder.cc @@ -196,7 +196,6 @@ void* doExtAddrSearch(void *p) af->mFoundTS = time(NULL) ; af->mSearching = false ; } - pthread_exit(NULL); return NULL ; } @@ -213,7 +212,6 @@ void* doExtAddrSearch(void *p) af->mFoundTS = time(NULL) ; af->mSearching = false ; } - pthread_exit(NULL); return NULL ; } @@ -224,7 +222,6 @@ void* doExtAddrSearch(void *p) af->mSearching = false ; } - pthread_exit(NULL); return NULL ; } From ecd45215c70d976aa92b49ddf6eebb5d825af6b7 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 31 Jul 2018 14:13:01 +0200 Subject: [PATCH 154/213] disallow empty file when loading shared file list in order to avoid malloc of size 0 --- libretroshare/src/file_sharing/filelist_io.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/file_sharing/filelist_io.cc b/libretroshare/src/file_sharing/filelist_io.cc index a8bb35a9d..baf34f710 100644 --- a/libretroshare/src/file_sharing/filelist_io.cc +++ b/libretroshare/src/file_sharing/filelist_io.cc @@ -194,10 +194,10 @@ bool FileListIO::loadEncryptedDataFromFile(const std::string& fname,unsigned cha { uint64_t file_size ; - if(!RsDirUtil::checkFile( fname,file_size,false ) ) + if(!RsDirUtil::checkFile( fname,file_size,true ) ) { #ifdef FIM_DEBUG - std::cerr << "Encrypted file " << fname << " not available." << std::endl; + std::cerr << "Encrypted file " << fname << " not available or empty." << std::endl; #endif return false; } From 0d4eafde31c6a6709bc9d02b8e66804fa9b4f423 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 31 Jul 2018 18:08:24 +0200 Subject: [PATCH 155/213] fixed compilation on ubuntu with xapian --- retroshare.pri | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/retroshare.pri b/retroshare.pri index 1e237f97c..5f54fd123 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -340,6 +340,12 @@ rs_chatserver { rs_deep_search { DEFINES *= RS_DEEP_SEARCH + + linux { + exists("/usr/include/xapian-1.3") { + INCLUDEPATH += /usr/include/xapian-1.3 + } + } } debug { From 5f66a45a151daba6d8d49daaa282238cc1e7d8ac Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 1 Aug 2018 18:40:40 +0200 Subject: [PATCH 156/213] Disable CMark Button on ChatWidget if not defined. --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 4d7c42a66..65a3597c3 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -191,7 +191,9 @@ ChatWidget::ChatWidget(QWidget *parent) fontmenu->addAction(ui->actionResetFont); fontmenu->addAction(ui->actionNoEmbed); fontmenu->addAction(ui->actionSendAsPlainText); + #ifdef USE_CMARK fontmenu->addAction(ui->actionSend_as_CommonMark); + #endif QMenu *menu = new QMenu(); menu->addAction(ui->actionClearChatHistory); @@ -205,9 +207,11 @@ ChatWidget::ChatWidget(QWidget *parent) ui->chatTextEdit->setOnlyPlainText(ui->actionSendAsPlainText->isChecked()); connect(ui->actionSendAsPlainText, SIGNAL(toggled(bool)), ui->chatTextEdit, SLOT(setOnlyPlainText(bool)) ); +#ifdef USE_CMARK connect(ui->actionSend_as_CommonMark, SIGNAL(toggled(bool)), this, SLOT(setUseCMark(bool)) ); - ui->cmPreview->setVisible(false); connect(ui->chatTextEdit, SIGNAL(textChanged()), this, SLOT(updateCMPreview()) ); +#endif + ui->cmPreview->setVisible(false); ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages()); ui->textBrowser->installEventFilter(this); @@ -983,10 +987,12 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS; } +#ifdef USE_CMARK //Use CommonMark if (message.contains("CMark=\"true\"")) { formatTextFlag |= RSHTML_FORMATTEXT_USE_CMARK; } +#endif // Always fix colors formatTextFlag |= RSHTML_FORMATTEXT_FIX_COLORS; From 50867d25034c25065621042115089a64ed711c27 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 1 Aug 2018 20:31:48 +0200 Subject: [PATCH 157/213] fixed clicking on external url in MessageWidget --- retroshare-gui/src/gui/msgs/MessageWidget.cpp | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp index 8fbf30039..cf359199e 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp +++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "gui/notifyqt.h" #include "gui/RetroShareLink.h" @@ -756,18 +757,19 @@ void MessageWidget::anchorClicked(const QUrl &url) { RetroShareLink link(url); - if (link.valid() == false) { - return; + if(link.valid()) + { + if (link.type() == RetroShareLink::TYPE_CERTIFICATE && currMsgFlags & RS_MSG_USER_REQUEST) { + std::cerr << "(WW) Calling some disabled code in MessageWidget::anchorClicked(). Please contact the developpers." << std::endl; + // link.setSubType(RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST); + } + + QList links; + links.append(link); + RetroShareLink::process(links); } - - if (link.type() == RetroShareLink::TYPE_CERTIFICATE && currMsgFlags & RS_MSG_USER_REQUEST) { - std::cerr << "(WW) Calling some disabled code in MessageWidget::anchorClicked(). Please contact the developpers." << std::endl; - // link.setSubType(RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST); - } - - QList links; - links.append(link); - RetroShareLink::process(links); + else + QDesktopServices::openUrl(url) ; } void MessageWidget::loadImagesAlways() From 97194fd092d295ec7f142ff579d044aad6cd31bb Mon Sep 17 00:00:00 2001 From: sehraf Date: Wed, 1 Aug 2018 20:30:28 +0200 Subject: [PATCH 158/213] Add wrapper function to convert uint16_t service IDs to internal unsigned int. Use it when looking up service names. --- libretroshare/src/pqi/p3servicecontrol.cc | 9 +++++++-- libretroshare/src/retroshare/rsservicecontrol.h | 2 ++ .../src/gui/statistics/BandwidthStatsWidget.cpp | 2 +- retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/pqi/p3servicecontrol.cc b/libretroshare/src/pqi/p3servicecontrol.cc index bfcb09031..5207b9829 100644 --- a/libretroshare/src/pqi/p3servicecontrol.cc +++ b/libretroshare/src/pqi/p3servicecontrol.cc @@ -1369,13 +1369,18 @@ RsServiceInfo::RsServiceInfo( const uint16_t min_version_major, const uint16_t min_version_minor) :mServiceName(service_name), - mServiceType((((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) service_type) << 8)), + mServiceType(RsServiceInfoUIn16ToFullServiceId(service_type)), mVersionMajor(version_major), mVersionMinor(version_minor), mMinVersionMajor(min_version_major), mMinVersionMinor(min_version_minor) { - return; + return; +} + +unsigned int RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType) +{ + return (((uint32_t) RS_PKT_VERSION_SERVICE) << 24) + (((uint32_t) serviceType) << 8); } diff --git a/libretroshare/src/retroshare/rsservicecontrol.h b/libretroshare/src/retroshare/rsservicecontrol.h index b081e3305..1e22449ae 100644 --- a/libretroshare/src/retroshare/rsservicecontrol.h +++ b/libretroshare/src/retroshare/rsservicecontrol.h @@ -53,6 +53,8 @@ class RsServiceInfo // minimum version can communicate with. uint16_t mMinVersionMajor; uint16_t mMinVersionMinor; + + static unsigned int RsServiceInfoUIn16ToFullServiceId(uint16_t serviceType); }; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index 8c04ed9d0..9e7a063f5 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -117,7 +117,7 @@ void BandwidthStatsWidget::updateComboBoxes() { if(*it != ui.service_CB->itemData(indx).toInt()) { - QString sname = QString::fromUtf8(service_info_map.mServiceList[ ((*it)<<8) + 0x02000000].mServiceName.c_str()) ; + QString sname = QString::fromUtf8(service_info_map.mServiceList[RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(*it)].mServiceName.c_str()) ; if(ui.service_CB->count() <= indx) ui.service_CB->addItem(sname + " (0x"+QString::number(*it,16)+")",QVariant(*it)) ; diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp index 53c008016..522b5115e 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterDialog.cpp @@ -468,7 +468,7 @@ static QString getServiceNameString(uint16_t service_id) if(ownServices.mServiceList.find(service_id) == ownServices.mServiceList.end()) rsServiceControl->getOwnServices(ownServices); - return QString::fromUtf8(ownServices.mServiceList[service_id].mServiceName.c_str()) ; + return QString::fromUtf8(ownServices.mServiceList[RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id)].mServiceName.c_str()) ; } static QString getVirtualPeerStatusString(uint8_t status) @@ -574,7 +574,7 @@ void GxsNetTunnelsDialog::updateDisplay() for(auto it(groups.begin());it!=groups.end();++it) { painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6") - .arg(QString::number(it->second.service_id)) + .arg("0x" + QString::number(it->second.service_id, 16)) .arg(getServiceNameString(it->second.service_id)) .arg(QString::fromStdString(it->first.toStdString())) .arg(getGroupPolicyString(it->second.group_policy)) From 985be3504eac07c5cbbd6640eaf38652308affc4 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 1 Aug 2018 23:04:20 +0200 Subject: [PATCH 159/213] fixed compilation with RS_AUTO_LOGIN --- libretroshare/src/rsserver/rsinit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 2c63704b4..c7a112f42 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -657,7 +657,7 @@ int RsInit::LoadCertificates(bool autoLoginNT) bool RsInit::RsClearAutoLogin() { RsPeerId preferredId; - if (!RsAccounts::getSelectedAccountId(preferredId)) + if (!RsAccounts::GetPreferredAccountId(preferredId)) { std::cerr << "RsInit::RsClearAutoLogin() No Account Selected" << std::endl; return 0; From f21d35b6fa6b428a63ee3e5b98bee920becef2f7 Mon Sep 17 00:00:00 2001 From: Phenom Date: Thu, 2 Aug 2018 00:39:45 +0200 Subject: [PATCH 160/213] Fix AppVeyor Compilation --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f1c1c29b4..b0b602cd1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -89,7 +89,7 @@ install: # Configuring MSys2 - set PATH=C:\msys64\usr\bin;%PATH% - set PATH=C:\msys64\mingw32\bin;%PATH% - - pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd mingw-w64-xapian-core + - pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd mingw-w64-i686-xapian-core #- pacman --noconfirm -S mingw-w64-i686-qt5-static mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd #- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH% From cc51298de62f3fa3c7bc256351983c99934627bc Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 2 Aug 2018 14:13:14 +0200 Subject: [PATCH 161/213] fixed warning about badly overloaded function in rsexpr.h --- libretroshare/src/retroshare/rsexpr.h | 22 +++++++++++----------- libretroshare/src/util/rsexpr.cc | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libretroshare/src/retroshare/rsexpr.h b/libretroshare/src/retroshare/rsexpr.h index 628e3f3c4..7c391a4be 100644 --- a/libretroshare/src/retroshare/rsexpr.h +++ b/libretroshare/src/retroshare/rsexpr.h @@ -181,7 +181,7 @@ public: StringExpression(enum StringOperator op, const std::list &t, bool ic): Op(op),terms(t), IgnoreCase(ic){} virtual void linearize(LinearizedExpression& e) const ; - virtual std::string toStdString(const std::string& varstr) const; + virtual std::string toStdStringWithParam(const std::string& varstr) const; protected: bool evalStr(const std::string &str); @@ -197,7 +197,7 @@ public: RelExpression(enum RelOperator op, T lv, T hv): Op(op), LowerValue(lv), HigherValue(hv) {} virtual void linearize(LinearizedExpression& e) const ; - virtual std::string toStdString(const std::string& typestr) const; + virtual std::string toStdStringWithParam(const std::string& typestr) const; protected: bool evalRel(T val); @@ -229,7 +229,7 @@ bool RelExpression::evalRel(T val) { } template -std::string RelExpression::toStdString(const std::string& typestr) const +std::string RelExpression::toStdStringWithParam(const std::string& typestr) const { std::string LowerValueStr = RsUtil::NumberToString(LowerValue) ; @@ -275,7 +275,7 @@ public: StringExpression(op,t,ic) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString() const { return StringExpression::toStdString("NAME"); } + virtual std::string toStdString() const { return StringExpression::toStdStringWithParam("NAME"); } virtual void linearize(LinearizedExpression& e) const { @@ -290,7 +290,7 @@ public: StringExpression(op,t,ic) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString()const { return StringExpression::toStdString("PATH"); } + virtual std::string toStdString()const { return StringExpression::toStdStringWithParam("PATH"); } virtual void linearize(LinearizedExpression& e) const { @@ -305,7 +305,7 @@ public: StringExpression(op,t,ic) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString()const { return StringExpression::toStdString("EXTENSION"); } + virtual std::string toStdString()const { return StringExpression::toStdStringWithParam("EXTENSION"); } virtual void linearize(LinearizedExpression& e) const { @@ -320,7 +320,7 @@ public: StringExpression(op,t, true) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString() const { return StringExpression::toStdString("HASH"); } + virtual std::string toStdString() const { return StringExpression::toStdStringWithParam("HASH"); } virtual void linearize(LinearizedExpression& e) const { @@ -342,7 +342,7 @@ public: RelExpression(op,lv,hv) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString() const { return RelExpression::toStdString("DATE"); } + virtual std::string toStdString() const { return RelExpression::toStdStringWithParam("DATE"); } virtual void linearize(LinearizedExpression& e) const { @@ -359,7 +359,7 @@ public: RelExpression(op,lv,hv) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString() const { return RelExpression::toStdString("SIZE"); } + virtual std::string toStdString() const { return RelExpression::toStdStringWithParam("SIZE"); } virtual void linearize(LinearizedExpression& e) const { @@ -376,7 +376,7 @@ public: RelExpression(op,lv,hv) {} bool eval(const ExpFileEntry& file); - virtual std::string toStdString() const { return RelExpression::toStdString("SIZE"); } + virtual std::string toStdString() const { return RelExpression::toStdStringWithParam("SIZE"); } virtual void linearize(LinearizedExpression& e) const { @@ -392,7 +392,7 @@ public: PopExpression(const LinearizedExpression& e) ; bool eval(const ExpFileEntry& file); - virtual std::string toStdString() const { return RelExpression::toStdString("POPULARITY"); } + virtual std::string toStdString() const { return RelExpression::toStdStringWithParam("POPULARITY"); } virtual void linearize(LinearizedExpression& e) const { diff --git a/libretroshare/src/util/rsexpr.cc b/libretroshare/src/util/rsexpr.cc index 73d441325..801e4fcb0 100644 --- a/libretroshare/src/util/rsexpr.cc +++ b/libretroshare/src/util/rsexpr.cc @@ -128,7 +128,7 @@ static bool StrContains( const std::string & str1, const std::string & str2, } -std::string StringExpression::toStdString(const std::string& varstr) const +std::string StringExpression::toStdStringWithParam(const std::string& varstr) const { std::string strlist ; for (auto iter = terms.begin(); iter != terms.end(); ++iter ) From ce39f4d7f007618cbcaaf3ae909323e7975c6964 Mon Sep 17 00:00:00 2001 From: zapek Date: Fri, 3 Aug 2018 15:15:17 +0200 Subject: [PATCH 162/213] added a working procedure to compile on Windows using MSYS2 --- WindowsMSys2_InstallGuide.md | 102 ++++++++++++++++------------------- 1 file changed, 45 insertions(+), 57 deletions(-) diff --git a/WindowsMSys2_InstallGuide.md b/WindowsMSys2_InstallGuide.md index 3eb0085a5..182a3b073 100644 --- a/WindowsMSys2_InstallGuide.md +++ b/WindowsMSys2_InstallGuide.md @@ -1,88 +1,76 @@ ## Compilation on Windows -### Qt Installation +The preferred build method on Windows is by using MSYS2 which is a collection +of packages providing unix-like tools to build native Windows software. -Install Qt via: [Qt Download](http://www.qt.io/download/) +Requirements: about 12 GB of free space -Use default options. -Add to the PATH environment variable - - ;C:\Qt\5.5\mingw492_32\bin;C:\Qt\Tools\mingw492_32\bin;C:\Qt\Tools\mingw492_32\opt\bin - -Depends on wich version of Qt you use. -Change build-all-mingw32make.bat with these values too if you don't use MSys2. +The resulting binary is a 32-bit build of Retroshare which will also work +fine on a 64-bit system. ### MSYS2 INSTALLATION -Choose your MSYS2 installer here: [MSYS2](http://msys2.github.io/) +Download MSYS2 from [MSYS2](http://www.msys2.org/). Get the i686 version +if you run a 32-bit Windows or the x86_64 if you run a 64-bit Windows. -Follow install procedure. -Don't forget to sync & Update pacman. +Run the installer and install MSYS2. - pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime +At the end of the installation, it'll automatically open an MSYS shell terminal. +You can also find it on the start menu as MSYS2 MSYS. This is the shell you'll +use to install packages with pacman and do maintenance but NOT to build +RetroShare. -Restart console +First, update your MSYS2 environment to the latest version by typing: - pacman -Su + pacman -Syu -Install all default programms +Close the terminal window. - pacman -S base-devel git mercurial cvs wget p7zip gcc perl ruby python2 +Run MSYS2 MSYS again and finish updating with: -Choose only w64-i686 if you want only compilation in 32b architecture. + pacman -Su - pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain +Install the default programs needed to build: -### Install other binutils: - pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc - pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3 - pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex - pacman -S mingw-w64-i686-speexdsp mingw-w64-x86_64-speexdsp - pacman -S mingw-w64-i686-opencv mingw-w64-x86_64-opencv - pacman -S mingw-w64-i686-ffmpeg mingw-w64-x86_64-ffmpeg - pacman -S mingw-w64-i686-libmicrohttpd mingw-w64-x86_64-libmicrohttpd - pacman -S mingw-w64-i686-libxslt mingw-w64-x86_64-libxslt + pacman -S base-devel git wget p7zip gcc perl ruby python2 -Add MSYS2 to PATH environment variable depends your windows +Install the 32-bit toolchain: - ;C:\msys64\mingw32\bin - ;C:\msys32\mingw32\bin + pacman -S mingw-w64-i686-toolchain +Install all needed dependencies: -### Git Installation + pacman -S mingw-w64-i686-miniupnpc + pacman -S mingw-w64-i686-libmicrohttpd + pacman -S mingw-w64-i686-libxslt + pacman -S mingw-w64-i686-xapian-core + pacman -S mingw-w64-i686-sqlcipher + pacman -S mingw-w64-i686-qt5 -Install Git Gui or other client: [Git Scm](https://git-scm.com/download/win) +We're done installing MSYS2, close the shell terminal. -Create a new directory named: +### BUILDING RETROSHARE - C:\Development\GIT +Now run the MSYS2 MinGW 32-bit shell terminal (it's in the start menu). +We will use it to checkout Retroshare and build it: -Right-click on it and choose: *Git Bash Here* + git clone https://github.com/RetroShare/RetroShare.git -Paste this text on git console: -git clone https://github.com/RetroShare/RetroShare.git +Go to the RetroShare directory and configure to your liking, for example: + + cd RetroShare + qmake -r -Wall -spec win32-g++ "CONFIG+=debug" "DEFINES+=RS_AUTOLOGIN" +Now we're ready to build Retroshare. Use the '-j' option with the number of +cores you have for a faster build, for instance if you have 4 cores: -### Last Settings + mingw32-make -j4 +Note: as of 2018-08-03 the build might fail once in libres during the HTML generation. +If you get it, just run mingw32-make again and it will pass. -In QtCreator Option Git add its path: *C:\Program Files\Git\bin* -and select "Pull" with "Rebase" +Make sure your current Retroshare is not running. Then just run: + retroshare-gui/src/debug/retroshare.exe -Open an MSys2 32|64 shell -Move to build_scripts: - - cd /c/Development/GIT/RetroShare/msys2_build_libs/ - -### Compile missing library - make - -You can now compile RS into Qt Creator - -For using, and debugging Plugins, you can use [Symlinker](http://amd989.github.io/Symlinker/) to link -the files in - - \build-RetroShare-Desktop_Qt_X_Y_Z_MinGW_32bit-Debug\plugins\PluginName\debug\*.dll -to -*%appdata%\RetroShare\extensions6* +You'll get debug output in the terminal and a running Retroshare instance. From 80885504677a0d862f04f7edab7ca32ae515bb91 Mon Sep 17 00:00:00 2001 From: zapek Date: Fri, 3 Aug 2018 19:33:09 +0200 Subject: [PATCH 163/213] removed the note about the build possibly failing while generating the webui files because I have a fix that I will commit next --- WindowsMSys2_InstallGuide.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/WindowsMSys2_InstallGuide.md b/WindowsMSys2_InstallGuide.md index 182a3b073..a589ada86 100644 --- a/WindowsMSys2_InstallGuide.md +++ b/WindowsMSys2_InstallGuide.md @@ -66,9 +66,6 @@ cores you have for a faster build, for instance if you have 4 cores: mingw32-make -j4 -Note: as of 2018-08-03 the build might fail once in libres during the HTML generation. -If you get it, just run mingw32-make again and it will pass. - Make sure your current Retroshare is not running. Then just run: retroshare-gui/src/debug/retroshare.exe From 2848359f77efc70c57fb8c56be8f2e34ad3198bf Mon Sep 17 00:00:00 2001 From: zapek Date: Fri, 3 Aug 2018 20:09:32 +0200 Subject: [PATCH 164/213] fixed webui files generation under MSYS2 --- libresapi/src/libresapi.pro | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index b07846411..873320c51 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -110,7 +110,7 @@ libresapihttpserver { QMAKE_EXTRA_COMPILERS += create_webfiles_html create_webfiles_js create_webfiles_css } - win32 { + win32-x { DEFINES *= WINDOWS_SYS INCLUDEPATH += . $$INC_DIR @@ -126,6 +126,19 @@ libresapihttpserver { system($$MAKE_SRC\\init.bat .) } + win32 { + DEFINES *= WINDOWS_SYS + INCLUDEPATH += . $$INC_DIR + + PRO_PATH=$$shell_path($$_PRO_FILE_PWD_) + MAKE_SRC=$$shell_path($$PRO_PATH/webui-src/make-src) + + QMAKE_POST_LINK=$$MAKE_SRC/build.sh $$PRO_PATH + + # create dummy files + system($$MAKE_SRC/init.sh .) + } + linux { CONFIG += link_pkgconfig PKGCONFIG *= libmicrohttpd From 146f9201647842d14dfc94ffd3171f33cf036031 Mon Sep 17 00:00:00 2001 From: zapek Date: Fri, 3 Aug 2018 21:21:53 +0200 Subject: [PATCH 165/213] changed win32-x to appveyor --- libresapi/src/libresapi.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index 873320c51..ba728f9a5 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -110,7 +110,7 @@ libresapihttpserver { QMAKE_EXTRA_COMPILERS += create_webfiles_html create_webfiles_js create_webfiles_css } - win32-x { + appveyor { DEFINES *= WINDOWS_SYS INCLUDEPATH += . $$INC_DIR From 0b821a4199dbd2aa17873d531f632f38faef00a1 Mon Sep 17 00:00:00 2001 From: zapek Date: Fri, 3 Aug 2018 21:29:00 +0200 Subject: [PATCH 166/213] changed to use CONFIG+=rs_autologin for the windows build instructions instead of setting defines --- WindowsMSys2_InstallGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WindowsMSys2_InstallGuide.md b/WindowsMSys2_InstallGuide.md index a589ada86..31cd5caef 100644 --- a/WindowsMSys2_InstallGuide.md +++ b/WindowsMSys2_InstallGuide.md @@ -59,7 +59,7 @@ We will use it to checkout Retroshare and build it: Go to the RetroShare directory and configure to your liking, for example: cd RetroShare - qmake -r -Wall -spec win32-g++ "CONFIG+=debug" "DEFINES+=RS_AUTOLOGIN" + qmake -r -Wall -spec win32-g++ "CONFIG+=debug" "CONFIG+=rs_autologin" Now we're ready to build Retroshare. Use the '-j' option with the number of cores you have for a faster build, for instance if you have 4 cores: From 93ab975b7210705401de8b1c8dbd684e2750bd97 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 6 Aug 2018 22:59:37 +0200 Subject: [PATCH 167/213] reverted commit 5925aa06fed41e770630811dd4d5d021882b7ae7 by request from Phenom --- .../src/gui/common/RSTextBrowser.cpp | 55 ++++--------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/retroshare-gui/src/gui/common/RSTextBrowser.cpp b/retroshare-gui/src/gui/common/RSTextBrowser.cpp index 5e1a80740..4d58e07d7 100644 --- a/retroshare-gui/src/gui/common/RSTextBrowser.cpp +++ b/retroshare-gui/src/gui/common/RSTextBrowser.cpp @@ -251,53 +251,22 @@ bool RSTextBrowser::checkImage(QPoint pos, QString &imageStr) */ QString RSTextBrowser::anchorForPosition(const QPoint &pos) const { - // Many calls when time label shows up QTextCursor cursor = cursorForPosition(pos); cursor.select(QTextCursor::WordUnderCursor); - QString word = cursor.selectedText(); QString anchor = ""; - if (word.isEmpty()) - return anchor; - - // For finding positions - QTextCursor cursor_line = cursorForPosition(pos); - cursor_line.select(QTextCursor::LineUnderCursor); - QString line = cursor_line.selectedText(); - // End of nickname (more or less, of course, because some can has colon in - // name) - int end_of_name = line.indexOf(": ") + 1; - // Start of nickname (after time) - int space_index = line.indexOf(' ') + 1; - int word_index = line.indexOf(word) + 1; - int once = 1; - cursor_line.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor, once); - bool after_name = cursor_line.position() + end_of_name < cursor.position(); - bool cursor_after_time = space_index < word_index; - bool cursor_within_name = word_index <= end_of_name; - if (!after_name && cursor_after_time && cursor_within_name) { - cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor, once); - cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, - space_index); - cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, - end_of_name - space_index); - if (cursor.selectedText().isEmpty()) { - return anchor; + if (!cursor.selectedText().isEmpty()){ + QRegExp rx(" Date: Sun, 17 Jun 2018 17:51:58 +0200 Subject: [PATCH 168/213] Optimized Windows build environment --- .../{build-retrotor.bat => build-tor.bat} | 4 +- build_scripts/Windows/build.bat | 4 +- .../Windows/build/build-installer.bat | 3 +- build_scripts/Windows/build/build.bat | 13 +- build_scripts/Windows/build/clean.bat | 2 + build_scripts/Windows/build/env.bat | 82 +++++-- build_scripts/Windows/build/git-log.bat | 7 +- build_scripts/Windows/build/pack.bat | 24 +- build_scripts/Windows/compilingForWindows.txt | 224 ------------------ .../Windows/env/tools/prepare-tools.bat | 2 +- build_scripts/Windows/installer/ifexist.nsh | 15 ++ .../Windows/installer/retroshare-Qt4.nsi | 44 +++- .../Windows/installer/retroshare-Qt5.nsi | 44 +++- build_scripts/Windows/tools/depends.bat | 12 +- 14 files changed, 185 insertions(+), 295 deletions(-) rename build_scripts/Windows/{build-retrotor.bat => build-tor.bat} (85%) delete mode 100644 build_scripts/Windows/compilingForWindows.txt create mode 100644 build_scripts/Windows/installer/ifexist.nsh diff --git a/build_scripts/Windows/build-retrotor.bat b/build_scripts/Windows/build-tor.bat similarity index 85% rename from build_scripts/Windows/build-retrotor.bat rename to build_scripts/Windows/build-tor.bat index f00014187..c074d6289 100644 --- a/build_scripts/Windows/build-retrotor.bat +++ b/build_scripts/Windows/build-tor.bat @@ -13,11 +13,11 @@ call "%~dp0build-libs\build-libs.bat" if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL% %cecho% info "Build %SourceName%" -call "%~dp0build\build.bat" retrotor +call "%~dp0build\build.bat" release tor version autologin plugins if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% %cecho% info "Pack %SourceName%" -call "%~dp0build\pack.bat" retrotor +call "%~dp0build\pack.bat" release tor if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL% exit /B 0 diff --git a/build_scripts/Windows/build.bat b/build_scripts/Windows/build.bat index 642f21454..dd9d0dddf 100644 --- a/build_scripts/Windows/build.bat +++ b/build_scripts/Windows/build.bat @@ -13,11 +13,11 @@ call "%~dp0build-libs\build-libs.bat" if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL% %cecho% info "Build %SourceName%" -call "%~dp0build\build.bat" standard +call "%~dp0build\build.bat" release version autologin plugins if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% %cecho% info "Pack %SourceName%" -call "%~dp0build\pack.bat" standard +call "%~dp0build\pack.bat" release if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL% %cecho% info "Build installer" diff --git a/build_scripts/Windows/build/build-installer.bat b/build_scripts/Windows/build/build-installer.bat index c986adbba..720aae3e4 100644 --- a/build_scripts/Windows/build/build-installer.bat +++ b/build_scripts/Windows/build/build-installer.bat @@ -9,7 +9,7 @@ call "%EnvPath%\env.bat" if errorlevel 1 goto error_env :: Initialize environment -call "%~dp0env.bat" standard +call "%~dp0env.bat" release if errorlevel 2 exit /B 2 if errorlevel 1 goto error_env @@ -29,6 +29,7 @@ set NSIS_PARAM=%NSIS_PARAM% /DQTDIR="%QtPath%\.." set NSIS_PARAM=%NSIS_PARAM% /DMINGWDIR="%MinGWPath%\.." set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%" set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%" +set NSIS_PARAM=%NSIS_PARAM% /DEXTERNAL_LIB_DIR="%BuildLibsPath%\libs" :: Scan version from source set RsRevision= diff --git a/build_scripts/Windows/build/build.bat b/build_scripts/Windows/build/build.bat index 3fa8fb49a..86ed635f1 100644 --- a/build_scripts/Windows/build/build.bat +++ b/build_scripts/Windows/build/build.bat @@ -22,6 +22,7 @@ set /P LibsGCCVersion=<"%BuildLibsPath%\libs\gcc-version" if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1 :: Check git executable +if "%ParamVersion%"=="0" goto found_git set GitPath= call "%ToolsPath%\find-in-path.bat" GitPath git.exe if "%GitPath%" NEQ "" goto found_git @@ -33,7 +34,7 @@ echo. echo === Version echo. -title Build - %SourceName%%RsType%-%RsBuildConfig% [Version] +title Build - %SourceName%-%RsBuildConfig% [Version] pushd "%SourcePath%\retroshare-gui\src\gui\images" :: Touch resource file @@ -47,10 +48,12 @@ echo. echo === qmake echo. -title Build - %SourceName%%RsType%-%RsBuildConfig% [qmake] +title Build - %SourceName%-%RsBuildConfig% [qmake] -set RS_QMAKE_CONFIG=%RsBuildConfig% version_detail_bash_script rs_autologin retroshare_plugins -if "%RsRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% retrotor +set RS_QMAKE_CONFIG=%RsBuildConfig% +if "%ParamVersion%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% version_detail_bash_script +if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_autologin +if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% retroshare_plugins qmake "%SourcePath%\RetroShare.pro" -r -spec win32-g++ "CONFIG+=%RS_QMAKE_CONFIG%" "EXTERNAL_LIB_DIR=%BuildLibsPath%\libs" if errorlevel 1 goto error @@ -59,7 +62,7 @@ echo. echo === make echo. -title Build - %SourceName%%RsType%-%RsBuildConfig% [make] +title Build - %SourceName%-%RsBuildConfig% [make] if exist "%EnvJomExe%" ( "%EnvJomExe%" diff --git a/build_scripts/Windows/build/clean.bat b/build_scripts/Windows/build/clean.bat index d8b725535..e8d5aa7b8 100644 --- a/build_scripts/Windows/build/clean.bat +++ b/build_scripts/Windows/build/clean.bat @@ -7,7 +7,9 @@ call "%~dp0..\env.bat" if errorlevel 1 goto error_env call "%EnvPath%\env.bat" if errorlevel 1 goto error_env + call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 if errorlevel 1 goto error_env if not exist "%RsBuildPath%" exit /B 0 diff --git a/build_scripts/Windows/build/env.bat b/build_scripts/Windows/build/env.bat index b0c765e03..074c976c3 100644 --- a/build_scripts/Windows/build/env.bat +++ b/build_scripts/Windows/build/env.bat @@ -1,16 +1,52 @@ -if "%~1"=="standard" ( - set RsRetroTor= - set RsType= -) else ( - if "%~1"=="retrotor" ( - set RsRetroTor=1 - set RsType=-tor - ) else ( - echo. - echo Usage: standard^|retrotor - echo. - exit /B 2 +:: Process commandline parameter +set ParamRelease=0 +set ParamDebug=0 +set ParamVersion=0 +set ParamAutologin=0 +set ParamPlugins=0 +set ParamTor=0 + +:parameter_loop +if "%~1" NEQ "" ( + for /f "tokens=1,2 delims==" %%a in ("%~1") do ( + if "%%~a"=="release" ( + set ParamRelease=1 + ) else if "%%~a"=="debug" ( + set ParamDebug=1 + ) else if "%%~a"=="version" ( + set ParamVersion=1 + ) else if "%%~a"=="autologin" ( + set ParamAutologin=1 + ) else if "%%~a"=="plugins" ( + set ParamPlugins=1 + ) else if "%%~a"=="tor" ( + set ParamTor=1 + ) else ( + echo. + echo Unknown parameter %1 + goto :usage + ) ) + shift /1 + goto parameter_loop +) + +if "%ParamRelease%"=="1" ( + if "%ParamDebug%"=="1" ( + echo. + echo Release or Debug? + goto :usage + ) + + set RsBuildConfig=release +) else if "%ParamDebug%"=="1" ( + set RsBuildConfig=debug +) else goto :usage + +if "%ParamTor%"=="1" ( + set RsType=-tor +) else ( + set RsType= ) set BuildPath=%EnvRootPath%\builds @@ -39,8 +75,7 @@ if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1 set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion% -set RsBuildConfig=release -set RsBuildPath=%BuildPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig% +set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig% set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig% set RsPackPath=%DeployPath% set RsArchiveAdd= @@ -50,4 +85,21 @@ call "%~dp0env-mod.bat" if errorlevel 1 exit /B %ERRORLEVEL% :no_mod -exit /B 0 \ No newline at end of file +exit /B 0 + +:usage +echo. +echo Usage: release^|debug [version autologin plugins] +echo. +echo Mandatory parameter +echo release^|debug Build release or debug version +echo. +echo Optional parameter (need clean when changed) +echo version Create version information from git +echo autologin Build with autologin +echo plugins Build plugins +echo. +echo Parameter for pack +echo tor Pack tor version +echo. +exit /B 2 diff --git a/build_scripts/Windows/build/git-log.bat b/build_scripts/Windows/build/git-log.bat index 5923397f1..d711ededb 100644 --- a/build_scripts/Windows/build/git-log.bat +++ b/build_scripts/Windows/build/git-log.bat @@ -1,6 +1,3 @@ -:: Usage: -:: call git-log.bat standard|retrotor [no-ask] - @echo off setlocal @@ -13,7 +10,9 @@ call "%~dp0..\env.bat" if errorlevel 1 goto error_env call "%EnvPath%\env.bat" if errorlevel 1 goto error_env -call "%~dp0env.bat" %1 + +call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 if errorlevel 1 goto error_env :: Check git executable diff --git a/build_scripts/Windows/build/pack.bat b/build_scripts/Windows/build/pack.bat index 8122cc2e0..bd526035c 100644 --- a/build_scripts/Windows/build/pack.bat +++ b/build_scripts/Windows/build/pack.bat @@ -62,8 +62,8 @@ set RsDate= for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2% -if "%RsRetroTor%"=="1" ( - :: Check Retrotor +if "%ParamTor%"=="1" ( + :: Check for tor executable if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" ( echo Tor binary not found. Please download Tor Expert Bundle from echo https://www.torproject.org/download/download.html.en @@ -121,7 +121,7 @@ for /D %%D in ("%RsBuildPath%\plugins\*") do ( ) echo copy external binaries -copy "%RootPath%\libs\bin\*.dll" "%RsDeployPath%" %Quite% +copy "%BuildLibsPath%\libs\bin\*.dll" "%RsDeployPath%" %Quite% echo copy dependencies call :copy_dependencies "%RsDeployPath%\retroshare.exe" "%RsDeployPath%" @@ -180,7 +180,7 @@ if exist "%SourcePath%\libresapi\src\webui" ( xcopy /S "%SourcePath%\libresapi\src\webui" "%RsDeployPath%\webui" %Quite% ) -if "%RsRetroTor%"=="1" ( +if "%ParamTor%"=="1" ( echo copy tor echo n | copy /-y "%EnvDownloadPath%\tor\Tor\*.*" "%RsDeployPath%" %Quite% ) @@ -217,13 +217,19 @@ if exist "%~1\%RsBuildConfig%\%~n1.dll" ( goto :EOF :copy_dependencies +set CopyDependenciesCopiedSomething=0 for /F "usebackq" %%A in (`%ToolsPath%\depends.bat list %1`) do ( - if exist "%QtPath%\%%A" ( - copy "%QtPath%\%%A" %2 %Quite% - ) else ( - if exist "%MinGWPath%\%%A" ( - copy "%MinGWPath%\%%A" %2 %Quite% + if not exist "%~2\%%A" ( + if exist "%QtPath%\%%A" ( + set CopyDependenciesCopiedSomething=1 + copy "%QtPath%\%%A" %2 %Quite% + ) else ( + if exist "%MinGWPath%\%%A" ( + set CopyDependenciesCopiedSomething=1 + copy "%MinGWPath%\%%A" %2 %Quite% + ) ) ) ) +if "%CopyDependenciesCopiedSomething%"=="1" goto copy_dependencies goto :EOF diff --git a/build_scripts/Windows/compilingForWindows.txt b/build_scripts/Windows/compilingForWindows.txt deleted file mode 100644 index 963f24107..000000000 --- a/build_scripts/Windows/compilingForWindows.txt +++ /dev/null @@ -1,224 +0,0 @@ - -Compling for Windows. ------------------------------------ -For Version V0.5.0+ we are switching to GPGme libraries. -This documents a clean compilation of V0.5 for Windows. - -Tested on: WinXP July 2009. - -You will need: - * Qt4.5 Development Libraries (from TrollTech) - * MinGw/MinSys full installation (from sourceforge.net) - * Cygwin (for OpenSSL compilation / SVN / Unix Tools) - * OpenSSL standard libraries. - * GPG Windows Install (includes gpg.exe) - * MiniUpnp library - * gpgme Library. - * libgpg-error Library. - - -This compilation is a little tricky as different environments -are needed to compile different libraries. -a) Cygwin: libssl.a libcrypto.a -b) MinGW/MSYS: libgpg-error, libgpgme.a, libretroshare.a, libminiupnp.a -c) Qt/MinGW: Retroshare.exe - - -/***************** Installation of Development Tools **************/ -In this section we install: cygwin, mingw/msys and Qt4.5 - -1) Install Cygwin - a) download the installer and run. - b) be sure to select from the development packages: - * mingw - * svn - * gcc/gdb - * make - links: - http://www.cygwin.org/ - -2) install the MinGW/Msys package. - a) Download MinGW-5.1.4 installer and run. - b) Download MSYS-1.0.11 installer and run. - - links: - http://downloads.sourceforge.net/mingw/MinGW-5.1.4.exe - http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe - http://www.mingw.org/ - http://sourceforge.net/projects/mingw/files/ - -3) Install Qt4.5 LGPL Version. (Qt SDK 2009.03) - a) Download from website and run. - b) Select all options (including MinGW) - - links: - http://www.qtsoftware.com/downloads - -/***************** Installation of Development Tools **************/ -/******************* Compiling Support Libraries ******************/ - -1) Compile OpenSSL using Cygwin. - a) launch cygwin xterm - b) untar openssl source package. - c) Configure mingw - d) make. - -2) Compile gpg-error - a) Download from gpg - b) load up MinGW/MSYS Bash shell. - c) extract code. - d) configure - e) make - f) make install - - The library will end up in /local/lib - -3) Compile gpgme - a) Download from gpg - b) load up MinGW/MSYS Bash shell. - c) extract code. - d) configure - e) make - f) make install - - The library will end up in /local/lib - - -4) Compile MiniUPnP. - up to release v1.3 now. - links: - http://miniupnp.free.fr/ - http://miniupnp.free.fr/files/ - -5) Install pthreads - - links: - http://sourceware.org/pthreads-win32/ - ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.exe - -/******************* Compiling Support Libraries ******************/ -/*********************** Compiling Retroshare *********************/ - -1) Setup Source Code TAR (TODO: Update for windows). - This is useful as it provides a standard structure to work against, - we will update this with the required support libraries soon. - - a) Open MSYS Bash shell, and change to this location. - c:/msys/1.0/home/XXX/retroshare - b) create a working directory under this. - 1) c:/msys/1.0/home/XXX/miniupnpc-1.3 - 2) c:/msys/1.0/home/XXX/pthreads-w32-2-8-0-release - 3) c:/msys/1.0/home/XXX/zlib-1.2.3 - 4) c:/msys/1.0/home/XXX/gpgme-1.1.8 - 5) c:/msys/1.0/home/XXX/libgpg-error-1.7 - c) Install OpenSSL to this directory (get from http://www.slproweb.com/download/Win32OpenSSL-0_9_8k.exe) - 1) c:/msys/1.0/home/XXX/OpenSSL - d) get the latest svn trunk and unzip to (get from http://retroshare.svn.sourceforge.net/viewvc/retroshare/trunk.tar.gz) . - 1) c:/msys/1.0/home/XXX/retroshare - -2) Compile libretroshare - a) change to the libretroshare directory. - 1) cd c:/msys/1.0/home/XXX/retroshare/libretroshare/src - b) modify support directory paths to point at correct locations. - 1) open scripts/config.mk and enable OS = Win # MinGw. - 2) open scripts/config-mingw.mk - 3) disable lines (line 20-29) - 4) enable lines 34-42 and 118-119 - #### Enable this section for compiling with MSYS/MINGW compile - SRC_ROOT=/home/linux - - SSL_DIR=$(SRC_ROOT)/OpenSSL - GPGME_DIR=$(SRC_ROOT)/gpgme-1.1.8 - GPG_ERROR_DIR=$(SRC_ROOT)/libgpg-error-1.7 - - ZLIB_DIR=$(SRC_ROOT)/zlib-1.2.3 - UPNPC_DIR=$(SRC_ROOT)/miniupnpc-1.0 - PTHREADS_DIR=$(SRC_ROOT)/pthreads-w32-2-8-0-release - - ### Enable this for GPGME and GPG ERROR dirs - CFLAGS += -I$(GPGME_DIR)/src - CFLAGS += -I$(GPG_ERROR_DIR)/src - 5) Edit your SRC_ROOT to your /home/xxxx dir - - - c) compile libretroshare - 1) make - -3) Copy all the required support libraries into the library directory: - c:/msys/1.0/home/XXX/lib - - This should include: - - gpg-error / gpgme libraries: - libgpg-error.a - libgpg-error.dll.a - libgpg-error.la - libgpgme.dll.a - libgpgme.la - - openssl libraries: - libcrypto.a - libssl.a - - miniupnpc / pthreads / libz - - libminiupnpc.a - miniupnpc.dll - libpthreadGCE2.a - pthreadGCE2.dll - libz.a - - extra library from cygwin. (renamed from libcrypt32.a) - libcrypt32-cygwin.a - - libretroshare - libretroshare.a - - -4) Compile GUI. - -/*********************** Compiling Retroshare *********************/ -/************************ Running Retroshare **********************/ - -1) Collect Relevant DLL's with Application. - a) make retroshare application directory. - b) copy Retroshare.exe executable into directory. - c) Copy required DLL's into that directory. - These include: - - mingw runtime: - mingwm10.dll - - gpgme/gpg-error: - libgpg-error-0.dll - libgpgme-11.dll - - other support libraries: - miniupnpc.dll - pthreadGCE2.dll - - Qt DLLs: - QtCore4.dll, - QtGui4.dll,... - etc. - - d) You should be able to run Retroshare from this directory now! - -2) Install gpg4win package... for gpg.exe - -3) Create an OpenGPG identity using gpa or Enigmail or other PGP tool. - -4) You should be able to use Retroshare on your PC now. - -/************************ Running Retroshare **********************/ -/******************************** FAQs ****************************/ -Ask and it might be answered! -/******************************** FAQs ****************************/ - -This is obviously a work in progress - -drBob. - - - - - diff --git a/build_scripts/Windows/env/tools/prepare-tools.bat b/build_scripts/Windows/env/tools/prepare-tools.bat index 587327f0e..1846bc591 100644 --- a/build_scripts/Windows/env/tools/prepare-tools.bat +++ b/build_scripts/Windows/env/tools/prepare-tools.bat @@ -53,7 +53,7 @@ if not exist "%EnvToolsPath%\cecho.exe" ( echo Download cecho installation - if not exist "%EnvDownloadPath%\%CEchoInstall%" call "%ToolsPath%\winhttpjs.bat" "%CEchoUrl%" -saveTo "%EnvDownloadPath%\%CEchoInstall%" + if not exist "%EnvDownloadPath%\%CEchoInstall%" call "%ToolsPath%\download-file.bat" "%CEchoUrl%" "%EnvDownloadPath%\%CEchoInstall%" if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error echo Unpack cecho diff --git a/build_scripts/Windows/installer/ifexist.nsh b/build_scripts/Windows/installer/ifexist.nsh new file mode 100644 index 000000000..18786f3b3 --- /dev/null +++ b/build_scripts/Windows/installer/ifexist.nsh @@ -0,0 +1,15 @@ +; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation +!macro !defineifexist _VAR_NAME _FILE_NAME + !tempfile _TEMPFILE + !ifdef NSIS_WIN32_MAKENSIS + ; Windows - cmd.exe + !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"' + !else + ; Posix - sh + !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi' + !endif + !include '${_TEMPFILE}' + !delfile '${_TEMPFILE}' + !undef _TEMPFILE +!macroend +!define !defineifexist "!insertmacro !defineifexist" \ No newline at end of file diff --git a/build_scripts/Windows/installer/retroshare-Qt4.nsi b/build_scripts/Windows/installer/retroshare-Qt4.nsi index fef0d90e8..971917d4a 100644 --- a/build_scripts/Windows/installer/retroshare-Qt4.nsi +++ b/build_scripts/Windows/installer/retroshare-Qt4.nsi @@ -1,6 +1,8 @@ ; Script generated with the Venis Install Wizard & modified by defnax ; Reworked by Thunder +!include ifexist.nsh + # Needed defines ;!define BUILDADD "" ;!define RELEASEDIR "" @@ -197,9 +199,9 @@ Section $(Section_Main) Section_Main File "${MINGWDIR}\bin\libwinpthread-1.dll" ; External binaries - File "${SOURCEDIR}\..\libs\bin\miniupnpc.dll" - File "${SOURCEDIR}\..\libs\bin\libeay32.dll" - File "${SOURCEDIR}\..\libs\bin\ssleay32.dll" + File "${EXTERNAL_LIB_DIR}\bin\miniupnpc.dll" + File "${EXTERNAL_LIB_DIR}\bin\libeay32.dll" + File "${EXTERNAL_LIB_DIR}\bin\ssleay32.dll" ; Other files File "${SOURCEDIR}\retroshare-gui\src\changelog.txt" @@ -234,17 +236,33 @@ Section $(Section_Main) Section_Main SectionEnd # Plugins -SectionGroup $(Section_Plugins) Section_Plugins -Section $(Section_Plugin_FeedReader) Section_Plugin_FeedReader - SetOutPath "$DataDir\extensions6" - File "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll" -SectionEnd +${!defineifexist} PLUGIN_FEEDREADER_EXISTS "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll" +${!defineifexist} PLUGIN_VOIP_EXISTS "${RELEASEDIR}\plugins\VOIP\release\VOIP.dll" -Section $(Section_Plugin_VOIP) Section_Plugin_VOIP - SetOutPath "$DataDir\extensions6" - File "${RELEASEDIR}\plugins\VOIP\release\VOIP.dll" -SectionEnd -SectionGroupEnd +!ifdef PLUGIN_FEEDREADER_EXISTS +!define /ifndef PLUGIN_EXISTS +!endif +!ifdef PLUGIN_VOIP_EXISTS +!define /ifndef PLUGIN_EXISTS +!endif + +!ifdef PLUGIN_EXISTS + SectionGroup $(Section_Plugins) Section_Plugins + !ifdef PLUGIN_FEEDREADER_EXISTS + Section $(Section_Plugin_FeedReader) Section_Plugin_FeedReader + SetOutPath "$DataDir\extensions6" + File "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll" + SectionEnd + !endif + + !ifdef PLUGIN_VOIP_EXISTS + Section $(Section_Plugin_VOIP) Section_Plugin_VOIP + SetOutPath "$DataDir\extensions6" + File "${RELEASEDIR}\plugins\VOIP\release\VOIP.dll" + SectionEnd + !endif + SectionGroupEnd +!endif # Data (Styles) Section $(Section_Data) Section_Data diff --git a/build_scripts/Windows/installer/retroshare-Qt5.nsi b/build_scripts/Windows/installer/retroshare-Qt5.nsi index 94dae3603..244baf6dc 100644 --- a/build_scripts/Windows/installer/retroshare-Qt5.nsi +++ b/build_scripts/Windows/installer/retroshare-Qt5.nsi @@ -1,6 +1,8 @@ ; Script generated with the Venis Install Wizard & modified by defnax ; Reworked by Thunder +!include ifexist.nsh + # Needed defines ;!define BUILDADD "" ;!define RELEASEDIR "" @@ -212,9 +214,9 @@ Section $(Section_Main) Section_Main File "${MINGWDIR}\bin\libwinpthread-1.dll" ; External binaries - File "${SOURCEDIR}\..\libs\bin\miniupnpc.dll" - File "${SOURCEDIR}\..\libs\bin\libeay32.dll" - File "${SOURCEDIR}\..\libs\bin\ssleay32.dll" + File "${EXTERNAL_LIB_DIR}\bin\miniupnpc.dll" + File "${EXTERNAL_LIB_DIR}\bin\libeay32.dll" + File "${EXTERNAL_LIB_DIR}\bin\ssleay32.dll" ; Other files File "${SOURCEDIR}\retroshare-gui\src\changelog.txt" @@ -256,17 +258,33 @@ Section $(Section_Main) Section_Main SectionEnd # Plugins -SectionGroup $(Section_Plugins) Section_Plugins -Section $(Section_Plugin_FeedReader) Section_Plugin_FeedReader - SetOutPath "$DataDir\extensions6" - File "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll" -SectionEnd +${!defineifexist} PLUGIN_FEEDREADER_EXISTS "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll" +${!defineifexist} PLUGIN_VOIP_EXISTS "${RELEASEDIR}\plugins\VOIP\release\VOIP.dll" -Section $(Section_Plugin_VOIP) Section_Plugin_VOIP - SetOutPath "$DataDir\extensions6" - File "${RELEASEDIR}\plugins\VOIP\release\VOIP.dll" -SectionEnd -SectionGroupEnd +!ifdef PLUGIN_FEEDREADER_EXISTS +!define /ifndef PLUGIN_EXISTS +!endif +!ifdef PLUGIN_VOIP_EXISTS +!define /ifndef PLUGIN_EXISTS +!endif + +!ifdef PLUGIN_EXISTS + SectionGroup $(Section_Plugins) Section_Plugins + !ifdef PLUGIN_FEEDREADER_EXISTS + Section $(Section_Plugin_FeedReader) Section_Plugin_FeedReader + SetOutPath "$DataDir\extensions6" + File "${RELEASEDIR}\plugins\FeedReader\release\FeedReader.dll" + SectionEnd + !endif + + !ifdef PLUGIN_VOIP_EXISTS + Section $(Section_Plugin_VOIP) Section_Plugin_VOIP + SetOutPath "$DataDir\extensions6" + File "${RELEASEDIR}\plugins\VOIP\release\VOIP.dll" + SectionEnd + !endif + SectionGroupEnd +!endif # Data (Styles) Section $(Section_Data) Section_Data diff --git a/build_scripts/Windows/tools/depends.bat b/build_scripts/Windows/tools/depends.bat index 3f1bb3d08..8238c974c 100644 --- a/build_scripts/Windows/tools/depends.bat +++ b/build_scripts/Windows/tools/depends.bat @@ -1,15 +1,15 @@ :: Usage: :: call depends.bat [list^|missing] file -setlocal - if "%2"=="" ( echo Usage: %~nx0 [list^|missing] File - goto :exit + exit /B 1 ) -if not exist "%EnvDependsExe%" echo depends.exe not found in %EnvToolsPath%.& goto exit -if not exist "%EnvCutExe%" echo cut.exe not found in %EnvToolsPath%.& goto exit +setlocal + +if not exist "%EnvDependsExe%" echo depends.exe not found in %EnvToolsPath%.& exit /B 1 +if not exist "%EnvCutExe%" echo cut.exe not found in %EnvToolsPath%.& exit /B 1 start /wait "" "%EnvDependsExe%" /c /oc:"%~dp0depends.tmp" %2 if "%1"=="missing" ( @@ -33,5 +33,5 @@ if "%1"=="list" ( if exist "%~dp0depends.tmp" del /Q "%~dp0depends.tmp" if exist "%~dp0depends1.tmp" del /Q "%~dp0depends1.tmp" -:exit endlocal +exit /B 0 \ No newline at end of file From 7bdc61e3e3ab23e75d4a4dc0dc8f1352dd7bb891 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 14 Jun 2018 14:22:23 +0200 Subject: [PATCH 169/213] Added Windows build environment with MSYS2 --- build_scripts/Windows-msys2/build-tor.bat | 23 + build_scripts/Windows-msys2/build.bat | 23 + build_scripts/Windows-msys2/build/build.bat | 81 +++ build_scripts/Windows-msys2/build/clean.bat | 25 + .../Windows-msys2/build/env-base.bat | 97 +++ build_scripts/Windows-msys2/build/env.bat | 29 + build_scripts/Windows-msys2/build/git-log.bat | 118 ++++ build_scripts/Windows-msys2/build/pack.bat | 222 +++++++ build_scripts/Windows-msys2/env.bat | 19 + build_scripts/Windows-msys2/env/env-msys2.bat | 37 ++ build_scripts/Windows-msys2/env/env.bat | 26 + .../Windows-msys2/env/tools/prepare-msys2.bat | 57 ++ .../Windows-msys2/env/tools/prepare-tools.bat | 79 +++ .../env/tools/root/update-msys2.bat | 19 + build_scripts/Windows-msys2/tools/cecho.bat | 6 + build_scripts/Windows-msys2/tools/depends.bat | 40 ++ .../Windows-msys2/tools/download-file.bat | 13 + .../Windows-msys2/tools/find-in-path.bat | 26 + .../Windows-msys2/tools/get-git-ref.bat | 39 ++ .../Windows-msys2/tools/get-qt-version.bat | 27 + .../Windows-msys2/tools/get-rs-version.bat | 33 + .../Windows-msys2/tools/msys2-path.bat | 20 + .../Windows-msys2/tools/remove-dir.bat | 15 + .../Windows-msys2/tools/winhttpjs.bat | 584 ++++++++++++++++++ 24 files changed, 1658 insertions(+) create mode 100644 build_scripts/Windows-msys2/build-tor.bat create mode 100644 build_scripts/Windows-msys2/build.bat create mode 100644 build_scripts/Windows-msys2/build/build.bat create mode 100644 build_scripts/Windows-msys2/build/clean.bat create mode 100644 build_scripts/Windows-msys2/build/env-base.bat create mode 100644 build_scripts/Windows-msys2/build/env.bat create mode 100644 build_scripts/Windows-msys2/build/git-log.bat create mode 100644 build_scripts/Windows-msys2/build/pack.bat create mode 100644 build_scripts/Windows-msys2/env.bat create mode 100644 build_scripts/Windows-msys2/env/env-msys2.bat create mode 100644 build_scripts/Windows-msys2/env/env.bat create mode 100644 build_scripts/Windows-msys2/env/tools/prepare-msys2.bat create mode 100644 build_scripts/Windows-msys2/env/tools/prepare-tools.bat create mode 100644 build_scripts/Windows-msys2/env/tools/root/update-msys2.bat create mode 100644 build_scripts/Windows-msys2/tools/cecho.bat create mode 100644 build_scripts/Windows-msys2/tools/depends.bat create mode 100644 build_scripts/Windows-msys2/tools/download-file.bat create mode 100644 build_scripts/Windows-msys2/tools/find-in-path.bat create mode 100644 build_scripts/Windows-msys2/tools/get-git-ref.bat create mode 100644 build_scripts/Windows-msys2/tools/get-qt-version.bat create mode 100644 build_scripts/Windows-msys2/tools/get-rs-version.bat create mode 100644 build_scripts/Windows-msys2/tools/msys2-path.bat create mode 100644 build_scripts/Windows-msys2/tools/remove-dir.bat create mode 100644 build_scripts/Windows-msys2/tools/winhttpjs.bat diff --git a/build_scripts/Windows-msys2/build-tor.bat b/build_scripts/Windows-msys2/build-tor.bat new file mode 100644 index 000000000..125cec8ee --- /dev/null +++ b/build_scripts/Windows-msys2/build-tor.bat @@ -0,0 +1,23 @@ +@echo off + +setlocal + +:: Initialize environment +call "%~dp0env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env + +%cecho% info "Build %SourceName%" +call "%~dp0build\build.bat" 32 release tor version autologin plugins +if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% + +%cecho% info "Pack %SourceName%" +call "%~dp0build\pack.bat" 32 release tor +if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL% + +exit /B 0 + +:error_env +echo Failed to initialize environment. +exit /B 1 diff --git a/build_scripts/Windows-msys2/build.bat b/build_scripts/Windows-msys2/build.bat new file mode 100644 index 000000000..31ece29fb --- /dev/null +++ b/build_scripts/Windows-msys2/build.bat @@ -0,0 +1,23 @@ +@echo off + +setlocal + +:: Initialize environment +call "%~dp0env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env + +%cecho% info "Build %SourceName%" +call "%~dp0build\build.bat" 32 release version autologin plugins +if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% + +%cecho% info "Pack %SourceName%" +call "%~dp0build\pack.bat" 32 release +if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL% + +exit /B 0 + +:error_env +echo Failed to initialize environment. +exit /B 1 diff --git a/build_scripts/Windows-msys2/build/build.bat b/build_scripts/Windows-msys2/build/build.bat new file mode 100644 index 000000000..37032013c --- /dev/null +++ b/build_scripts/Windows-msys2/build/build.bat @@ -0,0 +1,81 @@ +@echo off + +setlocal + +:: Initialize environment +call "%~dp0..\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env-msys2.bat" +if errorlevel 1 goto error_env + +:: Initialize base environment +call "%~dp0env-base.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +:: Install needed things +%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-libmicrohttpd mingw-w64-%RsMSYS2Architecture%-xapian-core" + +:: Plugins +if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg" + +:: Initialize environment +call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +echo. +echo === Version +echo. + +title Build - %SourceName%-%RsBuildConfig% [Version] + +pushd "%SourcePath%\retroshare-gui\src\gui\images" +:: Touch resource file +copy /b retroshare_win.rc +,, +popd + +if not exist "%RsBuildPath%" mkdir "%RsBuildPath%" +pushd "%RsBuildPath%" + +echo. +echo === qmake +echo. + +title Build - %SourceName%-%RsBuildConfig% [qmake] + +set RS_QMAKE_CONFIG="CONFIG+=%RsBuildConfig%" +if "%ParamVersion%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=version_detail_bash_script" +if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin" +if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retroshare_plugins" +if "%ParamRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retrotor" + +call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath +call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path +%EnvMSYS2Cmd% "qmake "%MSYS2SourcePath%/RetroShare.pro" -r -spec win32-g++ %RS_QMAKE_CONFIG%" +if errorlevel 1 goto error + +echo. +echo === make +echo. + +title Build - %SourceName%-%RsBuildConfig% [make] + +%EnvMSYS2Cmd% "make -j 4" + +:error +popd + +title %COMSPEC% + +if errorlevel 1 echo.& echo Build failed& echo. +exit /B %ERRORLEVEL% + +:error_env +echo Failed to initialize environment. +endlocal +exit /B 1 diff --git a/build_scripts/Windows-msys2/build/clean.bat b/build_scripts/Windows-msys2/build/clean.bat new file mode 100644 index 000000000..935495580 --- /dev/null +++ b/build_scripts/Windows-msys2/build/clean.bat @@ -0,0 +1,25 @@ +@echo off + +setlocal + +:: Initialize environment +call "%~dp0..\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env-msys2.bat" +if errorlevel 1 goto error_env + +call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +if not exist "%RsBuildPath%" exit /B 0 +call "%ToolsPath%\remove-dir.bat" "%RsBuildPath%" + +exit /B %ERRORLEVEL% + +:error_env +echo Failed to initialize environment. +endlocal +exit /B 1 diff --git a/build_scripts/Windows-msys2/build/env-base.bat b/build_scripts/Windows-msys2/build/env-base.bat new file mode 100644 index 000000000..4c7226a7f --- /dev/null +++ b/build_scripts/Windows-msys2/build/env-base.bat @@ -0,0 +1,97 @@ +:: Process commandline parameter +set Param32=0 +set Param64=0 +set ParamRelease=0 +set ParamDebug=0 +set ParamVersion=0 +set ParamAutologin=0 +set ParamPlugins=0 +set ParamTor=0 + +:parameter_loop +if "%~1" NEQ "" ( + for /f "tokens=1,2 delims==" %%a in ("%~1") do ( + if "%%~a"=="32" ( + set Param32=1 + ) else if "%%~a"=="64" ( + set Param64=1 + ) else if "%%~a"=="release" ( + set ParamRelease=1 + ) else if "%%~a"=="debug" ( + set ParamDebug=1 + ) else if "%%~a"=="version" ( + set ParamVersion=1 + ) else if "%%~a"=="autologin" ( + set ParamAutologin=1 + ) else if "%%~a"=="plugins" ( + set ParamPlugins=1 + ) else if "%%~a"=="tor" ( + set ParamTor=1 + ) else ( + echo. + echo Unknown parameter %1 + goto :usage + ) + ) + shift /1 + goto parameter_loop +) + +if "%Param32%"=="1" ( + if "%Param64%"=="1" ( + echo. + echo 32-bit or 64-bit? + goto :usage + ) + + set RsBit=32 + set RsArchitecture=x86 + set RsMSYS2Architecture=i686 +) + +if "%Param64%"=="1" ( + set RsBit=64 + set RsArchitecture=x64 + set RsMSYS2Architecture=x86_64 +) + +if "%RsBit%"=="" goto :usage + +if "%ParamRelease%"=="1" ( + if "%ParamDebug%"=="1" ( + echo. + echo Release or Debug? + goto :usage + ) + + set RsBuildConfig=release +) else if "%ParamDebug%"=="1" ( + set RsBuildConfig=debug +) else goto :usage + +if "%ParamTor%"=="1" ( + set RsType=-tor +) else ( + set RsType= +) + + +exit /B 0 + +:usage +echo. +echo Usage: 32^|64 release^|debug [version autologin plugins] +echo. +echo Mandatory parameter +echo 32^|64 32-bit or 64-bit Version +echo release^|debug Build release or debug version +echo. +echo Optional parameter (need clean when changed) +echo version Create version information from git +echo autologin Build with autologin +echo plugins Build plugins +echo. +echo Parameter for pack +echo tor Pack tor version +echo. +exit /B 2 diff --git a/build_scripts/Windows-msys2/build/env.bat b/build_scripts/Windows-msys2/build/env.bat new file mode 100644 index 000000000..81912fb38 --- /dev/null +++ b/build_scripts/Windows-msys2/build/env.bat @@ -0,0 +1,29 @@ +call "%~dp0env-base.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +set MSYSTEM=MINGW%RsBit% + +set BuildPath=%EnvRootPath%\builds +set DeployPath=%EnvRootPath%\deploy + +if not exist "%BuildPath%" mkdir "%BuildPath%" +if not exist "%DeployPath%" mkdir "%DeployPath%" + +:: Get Qt version +call "%ToolsPath%\get-qt-version.bat" QtVersion +if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1 + +set RsMinGWPath=%EnvMSYS2BasePath%\mingw%RsBit% + +set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsArchitecture%-%RsBuildConfig% +set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsArchitecture%-%RsBuildConfig% +set RsPackPath=%DeployPath% +set RsArchiveAdd= + +if not exist "%~dp0env-mod.bat" goto no_mod +call "%~dp0env-mod.bat" +if errorlevel 1 exit /B %ERRORLEVEL% +:no_mod + +exit /B 0 diff --git a/build_scripts/Windows-msys2/build/git-log.bat b/build_scripts/Windows-msys2/build/git-log.bat new file mode 100644 index 000000000..9c7814ebe --- /dev/null +++ b/build_scripts/Windows-msys2/build/git-log.bat @@ -0,0 +1,118 @@ +@echo off + +setlocal + +set NoAsk= +if "%~2"=="no-ask" set NoAsk=1 + +:: Initialize environment +call "%~dp0..\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env-msys2.bat" +if errorlevel 1 goto error_env + +call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +:: Check git executable +set GitPath= +call "%ToolsPath%\find-in-path.bat" GitPath git.exe +if "%GitPath%"=="" echo Git executable not found in PATH.& exit /B 1 + +:: Get compiled revision +set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat +if not exist "%GetRsVersion%" ( + echo File not found + echo %GetRsVersion% + exit /B 1 +) + +call "%GetRsVersion%" RS_REVISION_STRING RsRevision +if "%RsRevision%"=="" echo Revision not found.& exit /B 1 + +:: Get compiled version +call "%GetRsVersion%" RS_REVISION_STRING RsRevision +if "%RsRevision%"=="" echo Revision not found.& exit /B 1 + +call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion +if "%RsMajorVersion%"=="" echo Major version not found.& exit /B 1 + +call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion +if "%RsMinorVersion%"=="" echo Minor version not found.& exit /B 1 + +call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber +if "%RsBuildNumber%"=="" echo Build number not found.& exit /B 1 + +call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd + +set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd% + +:: Check WMIC is available +wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& exit /B 1 + +:: Use WMIC to retrieve date in format YYYYMMDD +set RsDate= +for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I +set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2% + +:: Get last revision +set RsLastRefFile=%BuildPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%-LastRef.txt +set RsLastRef= +if exist "%RsLastRefFile%" set /P RsLastRef=<"%RsLastRefFile%" + +if "%NoAsk%"=="1" goto no_ask_for_last_revision +if not "%RsLastRef%"=="" echo Last Revision was %RsLastRef% +set /P RsLastRefInput=Last Revision: +if "%RsLastRefInput%" NEQ "" set RsLastRef=%RsLastRefInput% +:no_ask_for_last_revision + +:: Get current revision +pushd "%SourcePath%" +call "%ToolsPath%\get-git-ref.bat" RsRef +popd + +if errorlevel 1 exit /B 1 +if "%RsRef%"=="" echo Cannot get git revision.& exit /B 1 + +echo. +echo Creating log from %RsLastRef% +echo to %RsRef% + +if "%NoAsk%"=="1" goto no_confirm +choice /M "Do you want to proceed?" +if %errorlevel%==2 exit /B 1 +:no_confirm + +if "%RsBuildConfig%" NEQ "release" ( + set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%-msys2%RsArchiveAdd%-%RsBuildConfig%.txt +) else ( + set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%-msys2%RsArchiveAdd%.txt +) + +title %SourceName%-%RsBuildConfig% [git log] + +pushd "%SourcePath%" +if "%RsLastRef%"=="" ( + git log %RsRef% >"%RsGitLog%" +) else ( + if "%RsLastRef%"=="%RsRef%" ( + git log %RsRef% --max-count=1 >"%RsGitLog%" + ) else ( + git log %RsLastRef%..%RsRef% >"%RsGitLog%" + ) +) +popd + +title %COMSPEC% + +echo %RsRef%>"%RsLastRefFile%" + +exit /B %ERRORLEVEL% + +:error_env +echo Failed to initialize environment. +endlocal +exit /B 1 diff --git a/build_scripts/Windows-msys2/build/pack.bat b/build_scripts/Windows-msys2/build/pack.bat new file mode 100644 index 000000000..675226459 --- /dev/null +++ b/build_scripts/Windows-msys2/build/pack.bat @@ -0,0 +1,222 @@ +@echo off + +setlocal + +set Quite=^>nul + +:: Initialize environment +call "%~dp0..\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env-msys2.bat" +if errorlevel 1 goto error_env + +:: Initialize environment +call "%~dp0env.bat" %* +if errorlevel 2 exit /B 2 +if errorlevel 1 goto error_env + +:: Remove deploy path +if exist "%RsDeployPath%" rmdir /S /Q "%RsDeployPath%" + +:: Check compilation +if not exist "%RsBuildPath%\Makefile" echo Project is not compiled.& goto error + +:: Get compiled revision +set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat +if not exist "%GetRsVersion%" ( + echo File not found + echo %GetRsVersion% + goto error +) + +call "%GetRsVersion%" RS_REVISION_STRING RsRevision +if "%RsRevision%"=="" echo Revision not found.& goto error + +:: Get compiled version +call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion +if "%RsMajorVersion%"=="" echo Major version not found.& goto error + +call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion +if "%RsMinorVersion%"=="" echo Minor version not found.& goto error + +call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber +if "%RsBuildNumber%"=="" echo Build number not found.& goto error + +call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd + +set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd% + +:: Check WMIC is available +wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error + +:: Use WMIC to retrieve date in format YYYYMMDD +set RsDate= +for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I +set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2% + +if "%ParamTor%"=="1" ( + :: Check for tor executable + if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" ( + echo Tor binary not found. Please download Tor Expert Bundle from + echo https://www.torproject.org/download/download.html.en + echo and unpack to + echo %EnvDownloadPath%\tor + goto error + ) +) + +set QtMainVersion=%QtVersion:~0,1% +set QtSharePath=%RsMinGWPath%\share\qt%QtMainVersion%\ + +rem Qt 4 = QtSvg4.dll +rem Qt 5 = Qt5Svg.dll +set QtMainVersion1= +set QtMainVersion2= +if "%QtMainVersion%"=="4" set QtMainVersion2=4 +if "%QtMainVersion%"=="5" set QtMainVersion1=5 + +if "%RsBuildConfig%" NEQ "release" ( + set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z +) else ( + set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z +) + +if exist "%Archive%" del /Q "%Archive%" + +:: Create deploy path +mkdir "%RsDeployPath%" + +title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files] + +set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc +set Extensions= +for /f %%e in ('type "%ExtensionsFile%" ^| sed.exe -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| sed.exe -n "1,1p"') do set Extensions=%%e +if "%Extensions%"=="" echo Folder for extensions not found in %ExtensionsFile%& goto error + +:: Copy files +mkdir "%RsDeployPath%\Data\%Extensions%" +mkdir "%RsDeployPath%\imageformats" +mkdir "%RsDeployPath%\qss" +mkdir "%RsDeployPath%\stylesheets" +mkdir "%RsDeployPath%\sounds" +mkdir "%RsDeployPath%\translations" + +copy nul "%RsDeployPath%\portable" %Quite% + +echo copy binaries +copy "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\RetroShare*.exe" "%RsDeployPath%" %Quite% +copy "%RsBuildPath%\retroshare-nogui\src\%RsBuildConfig%\retroshare*-nogui.exe" "%RsDeployPath%" %Quite% + +echo copy extensions +for /D %%D in ("%RsBuildPath%\plugins\*") do ( + call :copy_extension "%%D" "%RsDeployPath%\Data\%Extensions%" + call :copy_dependencies "%RsDeployPath%\Data\%Extensions%\%%~nxD.dll" "%RsDeployPath%" +) + +echo copy dependencies +call :copy_dependencies "%RsDeployPath%\retroshare.exe" "%RsDeployPath%" + +echo copy Qt DLL's +copy "%RsMinGWPath%\bin\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite% + +if "%QtMainVersion%"=="5" ( + mkdir "%RsDeployPath%\platforms" + copy "%QtSharePath%\plugins\platforms\qwindows.dll" "%RsDeployPath%\platforms" %Quite% + mkdir "%RsDeployPath%\audio" + copy "%QtSharePath%\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite% +) + +if exist "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" ( + echo Copy styles + mkdir "%RsDeployPath%\styles" %Quite% + copy "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite% +) + +copy "%QtSharePath%\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite% +del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite% + +echo copy qss +xcopy /S "%SourcePath%\retroshare-gui\src\qss" "%RsDeployPath%\qss" %Quite% + +echo copy stylesheets +xcopy /S "%SourcePath%\retroshare-gui\src\gui\qss\chat" "%RsDeployPath%\stylesheets" %Quite% +rmdir /S /Q "%RsDeployPath%\stylesheets\compact" %Quite% +rmdir /S /Q "%RsDeployPath%\stylesheets\standard" %Quite% +rmdir /S /Q "%RsDeployPath%\stylesheets\__MACOSX__Bubble" %Quite% + +echo copy sounds +xcopy /S "%SourcePath%\retroshare-gui\src\sounds" "%RsDeployPath%\sounds" %Quite% + +echo copy translation +copy "%SourcePath%\retroshare-gui\src\translations\qt_tr.qm" "%RsDeployPath%\translations" %Quite% +copy "%QtSharePath%\translations\qt_*.qm" "%RsDeployPath%\translations" %Quite% +if "%QtMainVersion%"=="5" ( + copy "%QtSharePath%\translations\qtbase_*.qm" "%RsDeployPath%\translations" %Quite% + copy "%QtSharePath%\translations\qtscript_*.qm" "%RsDeployPath%\translations" %Quite% + copy "%QtSharePath%\translations\qtquick1_*.qm" "%RsDeployPath%\translations" %Quite% + copy "%QtSharePath%\translations\qtmultimedia_*.qm" "%RsDeployPath%\translations" %Quite% + copy "%QtSharePath%\translations\qtxmlpatterns_*.qm" "%RsDeployPath%\translations" %Quite% +) + +echo copy bdboot.txt +copy "%SourcePath%\libbitdht\src\bitdht\bdboot.txt" "%RsDeployPath%" %Quite% + +echo copy changelog.txt +copy "%SourcePath%\retroshare-gui\src\changelog.txt" "%RsDeployPath%" %Quite% + +if exist "%SourcePath%\libresapi\src\webui" ( + echo copy webui + mkdir "%RsDeployPath%\webui" + xcopy /S "%SourcePath%\libresapi\src\webui" "%RsDeployPath%\webui" %Quite% +) + +if "%ParamTor%"=="1" ( + echo copy tor + echo n | copy /-y "%EnvDownloadPath%\tor\Tor\*.*" "%RsDeployPath%" %Quite% +) + +rem pack files +title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files] + +"%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*" + +title %COMSPEC% + +call :cleanup + +endlocal +exit /B 0 + +:error +call :Cleanup +endlocal +exit /B 1 + +:cleanup +goto :EOF + +:error_env +echo Failed to initialize environment. +endlocal +exit /B 1 + +:copy_extension +if exist "%~1\%RsBuildConfig%\%~n1.dll" ( + copy "%~1\%RsBuildConfig%\%~n1.dll" %2 %Quite% +) +goto :EOF + +:copy_dependencies +set CopyDependenciesCopiedSomething=0 +for /F "usebackq" %%A in (`%ToolsPath%\depends.bat list %1`) do ( + if not exist "%~2\%%A" ( + if exist "%RsMinGWPath%\bin\%%A" ( + set CopyDependenciesCopiedSomething=1 + copy "%RsMinGWPath%\bin\%%A" %2 %Quite% + ) + ) +) +if "%CopyDependenciesCopiedSomething%"=="1" goto copy_dependencies +goto :EOF diff --git a/build_scripts/Windows-msys2/env.bat b/build_scripts/Windows-msys2/env.bat new file mode 100644 index 000000000..b8beb566d --- /dev/null +++ b/build_scripts/Windows-msys2/env.bat @@ -0,0 +1,19 @@ +call :make_path SourcePath "%~dp0..\.." +call :make_path RootPath "%SourcePath%\.." +call :source_name SourceName "%SourcePath%" +set ToolsPath=%~dp0tools +set EnvPath=%~dp0env + +exit /B 0 + +:make_path +setlocal +set Var=%~1 +pushd %2 +set CD=%cd% +popd +endlocal & set %Var%=%CD% +goto :EOF + +:source_name +set %~1=%~nx2 diff --git a/build_scripts/Windows-msys2/env/env-msys2.bat b/build_scripts/Windows-msys2/env/env-msys2.bat new file mode 100644 index 000000000..ff08ff961 --- /dev/null +++ b/build_scripts/Windows-msys2/env/env-msys2.bat @@ -0,0 +1,37 @@ +:: Usage: +:: call env-msys2.bat [reinstall|clean] + +:: Initialize environment +call "%~dp0env.bat" +if errorlevel 1 goto error_env + +IF DEFINED ProgramFiles(x86) ( + :: x64 + set MSYS2Architecture=x86_64 + set MSYS2Base=64 +) else ( + :: x86 + set MSYS2Architecture=i686 + set MSYS2Base=32 +) + +set CHERE_INVOKING=1 + +set EnvMSYS2Path=%EnvRootPath%\msys2 +set EnvMSYS2BasePath=%EnvMSYS2Path%\msys%MSYS2Base% + +call "%~dp0tools\prepare-msys2.bat" %1 +if errorlevel 1 exit /B %ERRORLEVEL% + +set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe +if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env + +set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc + +set PATH=%EnvMSYS2BasePath%\usr\bin;%PATH% + +exit /B 0 + +:error_env +echo Failed to initialize environment. +exit /B 1 diff --git a/build_scripts/Windows-msys2/env/env.bat b/build_scripts/Windows-msys2/env/env.bat new file mode 100644 index 000000000..11cbcb986 --- /dev/null +++ b/build_scripts/Windows-msys2/env/env.bat @@ -0,0 +1,26 @@ +:: Initialize environment +call "%~dp0..\env.bat" +if errorlevel 1 goto error_env + +set EnvRootPath=%RootPath%\%SourceName%-msys2 +set EnvToolsPath=%EnvRootPath%\tools +set EnvTempPath=%EnvRootPath%\tmp +set EnvDownloadPath=%EnvRootPath%\download + +set EnvWgetExe=%EnvToolsPath%\wget.exe +set EnvSevenZipExe=%EnvToolsPath%\7z.exe +set EnvDependsExe=%EnvToolsPath%\depends.exe +set EnvCEchoExe=%EnvToolsPath%\cecho.exe +set cecho=call "%ToolsPath%\cecho.bat" + +:: Create folders +if not exist "%EnvRootPath%" mkdir "%EnvRootPath%" +if not exist "%EnvToolsPath%" mkdir "%EnvToolsPath%" +if not exist "%EnvDownloadPath%" mkdir "%EnvDownloadPath%" + +call "%~dp0tools\prepare-tools.bat" +exit /B %ERRORLEVEL% + +:error_env +echo Failed to initialize environment. +exit /B 1 diff --git a/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat b/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat new file mode 100644 index 000000000..a7b7cd4b1 --- /dev/null +++ b/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat @@ -0,0 +1,57 @@ +:: Usage: +:: call prepare-msys2.bat [reinstall|clean] + +setlocal enabledelayedexpansion + +if "%EnvMSYS2Path%"=="" exit /B 1 +if "%MSYS2Architecture%"=="" exit /B 1 +if "%MSYS2Base%"=="" exit /B 1 +if not exist "%EnvRootPath%"=="" exit /B 1 + +copy "%~dp0root\update-msys2.bat" "%EnvRootPath%" >nul + +if "%~1"=="clean" ( + %cecho% info "Clean MSYS2" + call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%" + goto exit +) + +if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" ( + if "%~1"=="reinstall" ( + choice /M "Found existing MSYS2 version. Do you want to proceed?" + if !ERRORLEVEL!==2 goto exit + ) else ( + goto exit + ) +) + +set MSYS2Install=msys2-base-%MSYS2Architecture%-20180531.tar.xz +set MSYS2Url=http://sourceforge.net/projects/msys2/files/Base/%MSYS2Architecture%/%MSYS2Install%/download + +%cecho% info "Remove previous MSYS2 version" +call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%" + +%cecho% info "Download installation files" +if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" +if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error + +%cecho% info "Unpack MSYS2" +"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%" + +set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh + +%cecho% info "Initialize MSYS2" +"%MSYS2SH%" -lc "pacman -Sy" +"%MSYS2SH%" -lc "pacman --noconfirm --needed -S bash pacman pacman-mirrors msys2-runtime" + +call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat" +call "%EnvRootPath%\update-msys2.bat" +call "%EnvRootPath%\update-msys2.bat" + +:exit +endlocal +exit /B 0 + +:error +endlocal +exit /B 1 diff --git a/build_scripts/Windows-msys2/env/tools/prepare-tools.bat b/build_scripts/Windows-msys2/env/tools/prepare-tools.bat new file mode 100644 index 000000000..e8788d52d --- /dev/null +++ b/build_scripts/Windows-msys2/env/tools/prepare-tools.bat @@ -0,0 +1,79 @@ +setlocal + +if "%EnvRootPath%"=="" exit /B 1 + +set CEchoUrl=https://github.com/lordmulder/cecho/releases/download/2015-10-10/cecho.2015-10-10.zip +set CEchoInstall=cecho.2015-10-10.zip +set SevenZipUrl=https://sourceforge.net/projects/sevenzip/files/7-Zip/18.05/7z1805.msi/download +set SevenZipInstall=7z1805.msi +set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe +set WgetInstall=wget.exe +set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip +set DependsInstall=depends22_x86.zip + +if not exist "%EnvToolsPath%\wget.exe" ( + echo Download Wget installation + + if not exist "%EnvDownloadPath%\%WgetInstall%" call "%ToolsPath%\winhttpjs.bat" %WgetUrl% -saveTo "%EnvDownloadPath%\%WgetInstall%" + if not exist "%EnvDownloadPath%\%WgetInstall%" %cecho% error "Cannot download Wget installation" & goto error + + echo Copy Wget + copy "%EnvDownloadPath%\wget.exe" "%EnvToolsPath%" +) + +if not exist "%EnvToolsPath%\7z.exe" ( + call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" + mkdir "%EnvTempPath%" + + echo Download 7z installation + + if not exist "%EnvDownloadPath%\%SevenZipInstall%" call "%ToolsPath%\download-file.bat" "%SevenZipUrl%" "%EnvDownloadPath%\%SevenZipInstall%" + if not exist "%EnvDownloadPath%\%SevenZipInstall%" echo Cannot download 7z installation& goto error + + echo Unpack 7z + msiexec /a "%EnvDownloadPath%\%SevenZipInstall%" /qb TARGETDIR="%EnvTempPath%" + copy "%EnvTempPath%\Files\7-Zip\7z.dll" "%EnvToolsPath%" + copy "%EnvTempPath%\Files\7-Zip\7z.exe" "%EnvToolsPath%" + + call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +) + +if not exist "%EnvToolsPath%\cecho.exe" ( + call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" + mkdir "%EnvTempPath%" + + echo Download cecho installation + + if not exist "%EnvDownloadPath%\%CEchoInstall%" call "%ToolsPath%\download-file.bat" "%CEchoUrl%" "%EnvDownloadPath%\%CEchoInstall%" + if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error + + echo Unpack cecho + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" + copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" + + call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +) + +if not exist "%EnvToolsPath%\depends.exe" ( + call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" + mkdir "%EnvTempPath%" + + %cecho% info "Download Dependency Walker installation" + + if not exist "%EnvDownloadPath%\%DependsInstall%" call "%ToolsPath%\winhttpjs.bat" %DependsUrl% -saveTo "%EnvDownloadPath%\%DependsInstall%" + if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error + + %cecho% info "Unpack Dependency Walker" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" + copy "%EnvTempPath%\*" "%EnvToolsPath%" + + call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +) + +:exit +endlocal +exit /B 0 + +:error +endlocal +exit /B 1 diff --git a/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat b/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat new file mode 100644 index 000000000..1441ea388 --- /dev/null +++ b/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat @@ -0,0 +1,19 @@ +@echo off + +setlocal + +if exist "%~dp0msys2\msys32" call :update 32 +if exist "%~dp0msys2\msys64" call :update 64 + +goto :EOF + +:update +set MSYSSH=%~dp0msys2\msys%~1\usr\bin\sh + +echo Update MSYS2 %~1 +"%MSYSSH%" -lc "pacman -Sy" +"%MSYSSH%" -lc "pacman --noconfirm -Su" + +:exit +endlocal +goto :EOF diff --git a/build_scripts/Windows-msys2/tools/cecho.bat b/build_scripts/Windows-msys2/tools/cecho.bat new file mode 100644 index 000000000..f25966de7 --- /dev/null +++ b/build_scripts/Windows-msys2/tools/cecho.bat @@ -0,0 +1,6 @@ +:: Usage: +:: call cecho.bat [info|error|std] "text" + +if "%~1"=="std" echo %~2 +if "%~1"=="info" "%EnvCEchoExe%" green "%~2" +if "%~1"=="error" "%EnvCEchoExe%" red "%~2" diff --git a/build_scripts/Windows-msys2/tools/depends.bat b/build_scripts/Windows-msys2/tools/depends.bat new file mode 100644 index 000000000..cd5e97ffd --- /dev/null +++ b/build_scripts/Windows-msys2/tools/depends.bat @@ -0,0 +1,40 @@ +:: Usage: +:: call depends.bat [list^|missing] file + +if "%2"=="" ( + echo Usage: %~nx0 [list^|missing] File + exit /B 1 +) + +setlocal + +if not exist "%EnvDependsExe%" echo depends.exe not found in %EnvToolsPath%.& exit /B 1 + +set CutPath= +call "%ToolsPath%\find-in-path.bat" CutPath cut.exe +if "%CutPath%"=="" echo cut.exe not found in PATH.& exit /B 1 + +start /wait "" "%EnvDependsExe%" /c /oc:"%~dp0depends.tmp" %2 +if "%1"=="missing" ( + cut.exe --delimiter=, --fields=1,2 "%~dp0depends.tmp" >"%~dp0depends1.tmp" + for /F "tokens=1,2 delims=," %%A in (%~sdp0depends1.tmp) do ( + if "%%A"=="?" ( + echo %%~B + ) + ) +) + +if "%1"=="list" ( + cut.exe --delimiter=, --fields=2 "%~dp0depends.tmp" >"%~dp0depends1.tmp" + for /F "tokens=1 delims=," %%A in (%~sdp0depends1.tmp) do ( + if "%%A" NEQ "Module" ( + echo %%~A + ) + ) +) + +if exist "%~dp0depends.tmp" del /Q "%~dp0depends.tmp" +if exist "%~dp0depends1.tmp" del /Q "%~dp0depends1.tmp" + +endlocal +exit /B 0 \ No newline at end of file diff --git a/build_scripts/Windows-msys2/tools/download-file.bat b/build_scripts/Windows-msys2/tools/download-file.bat new file mode 100644 index 000000000..b0e93be5f --- /dev/null +++ b/build_scripts/Windows-msys2/tools/download-file.bat @@ -0,0 +1,13 @@ +:: Usage: +:: call download-file.bat url file + +if "%~2"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +::"%EnvCurlExe%" -L -k "%~1" -o "%~2" +"%EnvWgetExe%" --no-check-certificate --continue "%~1" --output-document="%~2" + +exit /B %ERRORLEVEL% diff --git a/build_scripts/Windows-msys2/tools/find-in-path.bat b/build_scripts/Windows-msys2/tools/find-in-path.bat new file mode 100644 index 000000000..895a10a3d --- /dev/null +++ b/build_scripts/Windows-msys2/tools/find-in-path.bat @@ -0,0 +1,26 @@ +:: Usage: +:: call find-in-path.bat variable file + +setlocal + +set Var=%~1 +set File=%~2 + +if "%File%"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +set FoundPath= + +SET PathTemp="%Path:;=";"%" +FOR %%P IN (%PathTemp%) DO ( + IF EXIST "%%~P.\%File%" ( + set FoundPath=%%~P + goto :found + ) +) + +:found +endlocal & set %Var%=%FoundPath% diff --git a/build_scripts/Windows-msys2/tools/get-git-ref.bat b/build_scripts/Windows-msys2/tools/get-git-ref.bat new file mode 100644 index 000000000..fbf1ae600 --- /dev/null +++ b/build_scripts/Windows-msys2/tools/get-git-ref.bat @@ -0,0 +1,39 @@ +REM Usage: +REM call get-git-ref.bat Variable [Branch] + +setlocal + +set Variable=%~1 +if "%Variable%"=="" ( + echo. + echo Parameter error + exit /B 1 +) + +set Ref= + +:: Check git executable +set GitPath= +call "%~dp0find-in-path.bat" GitPath git.exe +if "%GitPath%"=="" ( + echo. + echo Git executable not found in PATH. + goto exit +) + +set GitParameter= +set Branch=%~2 +if "%Branch%"=="" ( + set Branch=HEAD + set GitParameter=--head +) + +for /F "tokens=1*" %%A in ('git show-ref %GitParameter% %Branch%') do ( + if "%%B"=="%Branch%" ( + set Ref=%%A + ) +) + +:exit +endlocal & set %Variable%=%Ref% +exit /B 0 diff --git a/build_scripts/Windows-msys2/tools/get-qt-version.bat b/build_scripts/Windows-msys2/tools/get-qt-version.bat new file mode 100644 index 000000000..33abcb53f --- /dev/null +++ b/build_scripts/Windows-msys2/tools/get-qt-version.bat @@ -0,0 +1,27 @@ +:: Usage: +:: call get-qt-version.bat variable + +setlocal + +set Var=%~1 +if "%Var%"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +set QtVersion= + +%EnvMSYS2Cmd% "qmake -version" >"%~dp0qtversion.tmp" +for /F "tokens=1,2,3,4" %%A in (%~sdp0qtversion.tmp) do ( + if "%%A"=="Using" ( + set QtVersion=%%D + goto exit + ) +) + +:exit +if exist "%~dp0qtversion.tmp" del /Q "%~dp0qtversion.tmp" + +endlocal & set %Var%=%QtVersion% +exit /B 0 \ No newline at end of file diff --git a/build_scripts/Windows-msys2/tools/get-rs-version.bat b/build_scripts/Windows-msys2/tools/get-rs-version.bat new file mode 100644 index 000000000..82fe88262 --- /dev/null +++ b/build_scripts/Windows-msys2/tools/get-rs-version.bat @@ -0,0 +1,33 @@ +:: Usage: +:: call get-rs-version.bat Define Variable + +setlocal + +set Define=%~1 +set Variable=%~2 +if "%Variable%"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +set Result= +set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h" + +if not exist "%VersionFile%" ( + echo. + echo Version file doesn't exist. + echo %VersionFile% + exit /B1 +) + +for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do ( + if "%%A"=="#define" ( + if "%%B"=="%Define%" ( + set Result=%%~C + ) + ) +) + +endlocal & set %Variable%=%Result% +exit /B 0 \ No newline at end of file diff --git a/build_scripts/Windows-msys2/tools/msys2-path.bat b/build_scripts/Windows-msys2/tools/msys2-path.bat new file mode 100644 index 000000000..3649b32d3 --- /dev/null +++ b/build_scripts/Windows-msys2/tools/msys2-path.bat @@ -0,0 +1,20 @@ +:: Usage: +:: call msys2-path.bat path variable + +setlocal + +set WinPath=%~1 +set MSYS2Var=%~2 + +if "%MSYS2Var%"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +set MSYS2Path=/%WinPath:~0,1%/%WinPath:~3% +set MSYS2Path=%MSYS2Path:\=/% + +endlocal & set %MSYS2Var%=%MSYS2Path% + +exit /B 0 diff --git a/build_scripts/Windows-msys2/tools/remove-dir.bat b/build_scripts/Windows-msys2/tools/remove-dir.bat new file mode 100644 index 000000000..2bcb14c51 --- /dev/null +++ b/build_scripts/Windows-msys2/tools/remove-dir.bat @@ -0,0 +1,15 @@ +:: Usage: +:: call remove-dir.bat path + +if "%~1"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +if exist %1 ( + del /s /f /q %1 >nul + rmdir /s /q %1 +) + +exit /B 0 diff --git a/build_scripts/Windows-msys2/tools/winhttpjs.bat b/build_scripts/Windows-msys2/tools/winhttpjs.bat new file mode 100644 index 000000000..0c1847fac --- /dev/null +++ b/build_scripts/Windows-msys2/tools/winhttpjs.bat @@ -0,0 +1,584 @@ +@if (@X) == (@Y) @end /* JScript comment + @echo off + + rem :: the first argument is the script name as it will be used for proper help message + cscript //E:JScript //nologo "%~f0" "%~nx0" %* + + exit /b %errorlevel% + +@if (@X)==(@Y) @end JScript comment */ + +// used resources + +// update 12.10.15 +// osvikvi(https://github.com/osvikvi) has nodited that the -password option is not set , so this is fixed + +//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384058(v=vs.85).aspx +//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384055(v=vs.85).aspx +//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384059(v=vs.85).aspx + +// global variables and constants + + +// ---------------------------------- +// -- asynch requests not included -- +// ---------------------------------- + + +//todo - save responceStream instead of responceBody !! +//todo - set all winthttp options ->//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx +//todo - log all options +//todo - improve help message . eventual verbose option + + +var ARGS = WScript.Arguments; +var scriptName = ARGS.Item(0); + +var url = ""; +var saveTo = ""; + +var user = 0; +var pass = 0; + +var proxy = 0; +var bypass = 0; +var proxy_user = 0; +var proxy_pass = 0; + +var certificate = 0; + +var force = true; + +var body = ""; + +//ActiveX objects +var WinHTTPObj = new ActiveXObject("WinHttp.WinHttpRequest.5.1"); +var FileSystemObj = new ActiveXObject("Scripting.FileSystemObject"); +var AdoDBObj = new ActiveXObject("ADODB.Stream"); + +// HttpRequest SetCredentials flags. +var proxy_settings = 0; + +// +HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0; +HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1; + +//timeouts and their default values +var RESOLVE_TIMEOUT = 0; +var CONNECT_TIMEOUT = 90000; +var SEND_TIMEOUT = 90000; +var RECEIVE_TIMEOUT = 90000; + +//HttpRequestMethod +var http_method = 'GET'; + +//header +var header_file = ""; + +//report +var reportfile = ""; + +//test-this: +var use_stream = false; + +//autologon policy +var autologon_policy = 1; //0,1,2 + + +//headers will be stored as multi-dimensional array +var headers = []; + +//user-agent +var ua = ""; + +//escape URL +var escape = false; + +function printHelp() { + WScript.Echo(scriptName + " - sends HTTP request and saves the request body as a file and/or a report of the sent request"); + WScript.Echo(scriptName + " url [-force yes|no] [-user username -password password] [-proxy proxyserver:port] [-bypass bypass_list]"); + WScript.Echo(" [-proxyuser proxy_username -proxypassword proxy_password] [-certificate certificateString]"); + WScript.Echo(" [-method GET|POST|PATCH|DELETE|HEAD|OPTIONS|CONNECT]"); + WScript.Echo(" [-saveTo file] - to print response to console use con"); + + WScript.Echo(" [-sendTimeout int(milliseconds)]"); + WScript.Echo(" [-resolveTimeout int(milliseconds)]"); + WScript.Echo(" [-connectTimeout int(milliseconds)]"); + WScript.Echo(" [-receiveTimeout int(milliseconds)]"); + + WScript.Echo(" [-autologonPolicy 1|2|3]"); + WScript.Echo(" [-proxySettings 1|2|3] (https://msdn.microsoft.com/en-us/library/windows/desktop/aa384059(v=vs.85).aspx)"); + + //header + WScript.Echo(" [-headers-file header_file]"); + //reportfile + WScript.Echo(" [-reportfile reportfile]"); + WScript.Echo(" [-ua user-agent]"); + WScript.Echo(" [-ua-file user-agent-file]"); + + WScript.Echo(" [-escape yes|no]"); + + WScript.Echo(" [-body body-string]"); + WScript.Echo(" [-body-file body-file]"); + + WScript.Echo("-force - decide to not or to overwrite if the local files exists"); + + WScript.Echo("proxyserver:port - the proxy server"); + WScript.Echo("bypass- bypass list"); + WScript.Echo("proxy_user , proxy_password - credentials for proxy server"); + WScript.Echo("user , password - credentials for the server"); + WScript.Echo("certificate - location of SSL certificate"); + WScript.Echo("method - what HTTP method will be used.Default is GET"); + WScript.Echo("saveTo - save the responce as binary file"); + WScript.Echo(" "); + WScript.Echo("Header file should contain key:value pairs.Lines starting with \"#\" will be ignored."); + WScript.Echo("value should NOT be enclosed with quotes"); + WScript.Echo(" "); + WScript.Echo("Examples:"); + + WScript.Echo(scriptName + " http://somelink.com/somefile.zip -saveTo c:\\somefile.zip -certificate \"LOCAL_MACHINE\\Personal\\My Middle-Tier Certificate\""); + WScript.Echo(scriptName + " http://somelink.com/something.html -method POST -certificate \"LOCAL_MACHINE\\Personal\\My Middle-Tier Certificate\" -header c:\\header_file -reportfile c:\\reportfile.txt"); + WScript.Echo(scriptName + "\"http://somelink\" -method POST -header hdrs.txt -reportfile reportfile2.txt -saveTo responsefile2 -ua \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\" -body-file some.json"); + +} + +function parseArgs() { + // + if (ARGS.Length < 2) { + WScript.Echo("insufficient arguments"); + printHelp(); + WScript.Quit(43); + } + // !!! + url = ARGS.Item(1); + // !!! + if (ARGS.Length % 2 != 0) { + WScript.Echo("illegal arguments"); + printHelp(); + WScript.Quit(44); + } + + for (var i = 2; i < ARGS.Length - 1; i = i + 2) { + var arg = ARGS.Item(i).toLowerCase(); + var next = ARGS.Item(i + 1); + + + try { + switch (arg) { // the try-catch is set mainly because of the parseInts + case "-force": + if (next == "no") { + force = false; + } + break; + case "-escape": + if (next == "yes") { + escape = true; + } + break; + case "-saveto": + saveTo = next; + break; + case "-user": + case "-u": + user = next; + break; + case "-pass": + case "-password": + case "-p": + pass = next; + break; + case "-proxy": + proxy = next; + break; + case "-bypass": + bypass = next; + break; + case "-proxyuser": + case "-pu": + proxy_user = next; + break; + case "-proxypassword": + case "-pp": + proxy_pass = next; + break; + case "-ua": + ua = next; + break; + case "-ua-file": + ua = readFile(next); + break; + case "-body": + body = next; + break; + case "-usestream": + //WScript.Echo("~~"); + if (next.toLowerCase() === "yes") { + use_stream = true + }; + break; + case "-body-file": + body = readFile(next); + break; + case "-certificate": + certificate = next; + break; + case "-method": + switch (next.toLowerCase()) { + case "post": + http_method = 'POST'; + break; + case "get": + http_method = 'GET'; + break; + case "head": + http_method = 'HEAD'; + break; + case "put": + http_method = 'PUT'; + break; + case "options": + http_method = 'OPTIONS'; + break; + case "connect": + http_method = 'CONNECT'; + break; + case "patch": + http_method = 'PATCH'; + break; + case "delete": + http_method = 'DELETE'; + break; + default: + WScript.Echo("Invalid http method passed " + next); + WScript.Echo("possible values are GET,POST,DELETE,PUT,CONNECT,PATCH,HEAD,OPTIONS"); + WScript.Quit(1326); + break; + } + break; + case "-headers-file": + case "-header": + headers = readPropFile(next); + break; + case "-reportfile": + reportfile = next; + break; + //timeouts + case "-sendtimeout": + SEND_TIMEOUT = parseInt(next); + break; + case "-connecttimeout": + CONNECT_TIMEOUT = parseint(next); + break; + case "-resolvetimeout": + RESOLVE_TIMEOUT = parseInt(next); + break; + case "-receivetimeout": + RECEIVE_TIMEOUT = parseInt(next); + break; + + case "-autologonpolicy": + autologon_policy = parseInt(next); + if (autologon_policy > 2 || autologon_policy < 0) { + WScript.Echo("out of autologon policy range"); + WScript.Quit(87); + }; + break; + case "-proxysettings": + proxy_settings = parseInt(next); + if (proxy_settings > 2 || proxy_settings < 0) { + WScript.Echo("out of proxy settings range"); + WScript.Quit(87); + }; + break; + default: + WScript.Echo("Invalid command line switch: " + arg); + WScript.Quit(1405); + break; + } + } catch (err) { + WScript.Echo(err.message); + WScript.Quit(1348); + } + } +} + +stripTrailingSlash = function(path) { + while (path.substr(path.length - 1, path.length) == '\\') { + path = path.substr(0, path.length - 1); + } + return path; +} + +function existsItem(path) { + return FileSystemObj.FolderExists(path) || FileSystemObj.FileExists(path); +} + +function deleteItem(path) { + if (FileSystemObj.FileExists(path)) { + FileSystemObj.DeleteFile(path); + return true; + } else if (FileSystemObj.FolderExists(path)) { + FileSystemObj.DeleteFolder(stripTrailingSlash(path)); + return true; + } else { + return false; + } +} + +//------------------------------- +//---------------------- +//---------- +//----- +//-- +function request(url) { + + try { + + WinHTTPObj.Open(http_method, url, false); + if (proxy != 0 && bypass != 0) { + WinHTTPObj.SetProxy(proxy_settings, proxy, bypass); + } + + if (proxy != 0) { + WinHTTPObj.SetProxy(proxy_settings, proxy); + } + + if (user != 0 && pass != 0) { + WinHTTPObj.SetCredentials(user, pass, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER); + } + + if (proxy_user != 0 && proxy_pass != 0) { + WinHTTPObj.SetCredentials(proxy_user, proxy_pass, HTTPREQUEST_SETCREDENTIALS_FOR_PROXY); + } + + if (certificate != 0) { + WinHTTPObj.SetClientCertificate(certificate); + } + + //set autologin policy + WinHTTPObj.SetAutoLogonPolicy(autologon_policy); + //set timeouts + WinHTTPObj.SetTimeouts(RESOLVE_TIMEOUT, CONNECT_TIMEOUT, SEND_TIMEOUT, RECEIVE_TIMEOUT); + + if (headers.length !== 0) { + WScript.Echo("Sending with headers:"); + for (var i = 0; i < headers.length; i++) { + WinHTTPObj.SetRequestHeader(headers[i][0], headers[i][1]); + WScript.Echo(headers[i][0] + ":" + headers[i][1]); + } + WScript.Echo(""); + } + + if (ua !== "") { + //user-agent option from: + //WinHttpRequestOption enumeration + // other options can be added like bellow + //https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx + WinHTTPObj.Option(0) = ua; + } + if (escape) { + WinHTTPObj.Option(3) = true; + } + if (trim(body) === "") { + WinHTTPObj.Send(); + } else { + WinHTTPObj.Send(body); + } + + var status = WinHTTPObj.Status + } catch (err) { + WScript.Echo(err.message); + WScript.Quit(666); + } + + //////////////////////// + // report // + //////////////////////// + + if (reportfile != "") { + + //var report_string=""; + var n = "\r\n"; + var report_string = "Status:" + n; + report_string = report_string + " " + WinHTTPObj.Status; + report_string = report_string + " " + WinHTTPObj.StatusText + n; + report_string = report_string + " " + n; + report_string = report_string + "Response:" + n; + report_string = report_string + WinHTTPObj.ResponseText + n; + report_string = report_string + " " + n; + report_string = report_string + "Headers:" + n; + report_string = report_string + WinHTTPObj.GetAllResponseHeaders() + n; + + WinHttpRequestOption_UserAgentString = 0; // Name of the user agent + WinHttpRequestOption_URL = 1; // Current URL + WinHttpRequestOption_URLCodePage = 2; // Code page + WinHttpRequestOption_EscapePercentInURL = 3; // Convert percents + // in the URL + // rest of the options can be seen and eventually added using this as reference + // https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx + + report_string = report_string + "URL:" + n; + report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_URL) + n; + + report_string = report_string + "URL Code Page:" + n; + report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_URLCodePage) + n; + + report_string = report_string + "User Agent:" + n; + report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_UserAgentString) + n; + + report_string = report_string + "Escapped URL:" + n; + report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_EscapePercentInURL) + n; + + prepareateFile(force, reportfile); + + WScript.Echo("Writing report to " + reportfile); + + writeFile(reportfile, report_string); + + } + + switch (status) { + case 200: + WScript.Echo("Status: 200 OK"); + break; + default: + WScript.Echo("Status: " + status); + WScript.Echo("Status was not OK. More info -> https://en.wikipedia.org/wiki/List_of_HTTP_status_codes"); + } + + //if as binary + if (saveTo.toLowerCase() === "con") { + WScript.Echo(WinHTTPObj.ResponseText); + } + if (saveTo !== "" && saveTo.toLowerCase() !== "con") { + prepareateFile(force, saveTo); + try { + + if (use_stream) { + writeBinFile(saveTo, WinHTTPObj.ResponseStream); + } else { + writeBinFile(saveTo, WinHTTPObj.ResponseBody); + } + + } catch (err) { + WScript.Echo("Failed to save the file as binary.Attempt to save it as text"); + AdoDBObj.Close(); + prepareateFile(true, saveTo); + writeFile(saveTo, WinHTTPObj.ResponseText); + } + } + WScript.Quit(status); +} + +//-- +//----- +//---------- +//---------------------- +//------------------------------- + +function prepareateFile(force, file) { + if (force && existsItem(file)) { + if (!deleteItem(file)) { + WScript.Echo("Unable to delete " + file); + WScript.Quit(8); + } + } else if (existsItem(file)) { + WScript.Echo("Item " + file + " already exist"); + WScript.Quit(9); + } +} + +function writeBinFile(fileName, data) { + AdoDBObj.Type = 1; + AdoDBObj.Open(); + AdoDBObj.Position = 0; + AdoDBObj.Write(data); + AdoDBObj.SaveToFile(fileName, 2); + AdoDBObj.Close(); +} + +function writeFile(fileName, data) { + AdoDBObj.Type = 2; + AdoDBObj.CharSet = "iso-8859-1"; + AdoDBObj.Open(); + AdoDBObj.Position = 0; + AdoDBObj.WriteText(data); + AdoDBObj.SaveToFile(fileName, 2); + AdoDBObj.Close(); +} + + +function readFile(fileName) { + //check existence + try { + if (!FileSystemObj.FileExists(fileName)) { + WScript.Echo("file " + fileName + " does not exist!"); + WScript.Quit(13); + } + if (FileSystemObj.GetFile(fileName).Size === 0) { + return ""; + } + var fileR = FileSystemObj.OpenTextFile(fileName, 1); + var content = fileR.ReadAll(); + fileR.Close(); + return content; + } catch (err) { + WScript.Echo("Error while reading file: " + fileName); + WScript.Echo(err.message); + WScript.Echo("Will return empty string"); + return ""; + } +} + +function readPropFile(fileName) { + //check existence + resultArray = []; + if (!FileSystemObj.FileExists(fileName)) { + WScript.Echo("(headers)file " + fileName + " does not exist!"); + WScript.Quit(15); + } + if (FileSystemObj.GetFile(fileName).Size === 0) { + return resultArray; + } + var fileR = FileSystemObj.OpenTextFile(fileName, 1); + var line = ""; + var k = ""; + var v = ""; + var lineN = 0; + var index = 0; + try { + WScript.Echo("parsing headers form " + fileName + " property file "); + while (!fileR.AtEndOfStream) { + line = fileR.ReadLine(); + lineN++; + index = line.indexOf(":"); + if (line.indexOf("#") === 0 || trim(line) === "") { + continue; + } + if (index === -1 || index === line.length - 1 || index === 0) { + WScript.Echo("Invalid line " + lineN); + WScript.Quit(93); + } + k = trim(line.substring(0, index)); + v = trim(line.substring(index + 1, line.length)); + resultArray.push([k, v]); + } + fileR.Close(); + return resultArray; + } catch (err) { + WScript.Echo("Error while reading headers file: " + fileName); + WScript.Echo(err.message); + WScript.Echo("Will return empty array"); + return resultArray; + } +} + +function trim(str) { + return str.replace(/^\s+/, '').replace(/\s+$/, ''); +} + +function main() { + parseArgs(); + request(url); +} +main(); From b7f5d4286f166d25dbf812e9ec2826a96ebdf10c Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 16 Aug 2018 14:26:41 +0200 Subject: [PATCH 170/213] RsGxsNetService::receiveTurtleSearchResults fix deadlock Avoid notifing observer while the mutex is locked by storing results in a temporary set --- libretroshare/src/gxs/rsgxsnetservice.cc | 62 +++++++++++++----------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index cb8af6064..df19a900d 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -5181,43 +5181,51 @@ bool RsGxsNetService::clearDistantSearchResults(const TurtleRequestId& id) } void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std::list& group_infos) { - RS_STACK_MUTEX(mNxsMutex) ; + std::set groupsToNotifyResults; - RsGxsGrpMetaTemporaryMap grpMeta; - std::map& search_results_map(mDistantSearchResults[req]) ; + { + RS_STACK_MUTEX(mNxsMutex); - for(auto it(group_infos.begin());it!=group_infos.end();++it) - if(search_results_map.find((*it).mGroupId) == search_results_map.end()) - grpMeta[(*it).mGroupId] = NULL; + RsGxsGrpMetaTemporaryMap grpMeta; + std::map& + search_results_map(mDistantSearchResults[req]); - mDataStore->retrieveGxsGrpMetaData(grpMeta); + for(auto it(group_infos.begin());it!=group_infos.end();++it) + if(search_results_map.find((*it).mGroupId) == search_results_map.end()) + grpMeta[(*it).mGroupId] = NULL; - std::list filtered_results ; + mDataStore->retrieveGxsGrpMetaData(grpMeta); - // only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure + // only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure - for(auto it(group_infos.begin());it!=group_infos.end();++it) - if(grpMeta[(*it).mGroupId] == NULL) - { - filtered_results.push_back(*it) ; + for(auto it(group_infos.begin());it!=group_infos.end();++it) + if(grpMeta[(*it).mGroupId] == NULL) + { + const RsGxsGroupId& grpId((*it).mGroupId); - auto it2 = search_results_map.find((*it).mGroupId) ; + groupsToNotifyResults.insert(grpId); - if(it2 != search_results_map.end()) - { - // update existing data + auto it2 = search_results_map.find(grpId); - it2->second.mPopularity++ ; - it2->second.mNumberOfMessages = std::max(it2->second.mNumberOfMessages,(*it).mNumberOfMessages) ; - } - else - { - search_results_map[(*it).mGroupId] = *it; - search_results_map[(*it).mGroupId].mPopularity = 1; // number of results so far - } + if(it2 != search_results_map.end()) + { + // update existing data - mObserver->receiveDistantSearchResults(req,(*it).mGroupId) ; - } + it2->second.mPopularity++; + it2->second.mNumberOfMessages = std::max( + it2->second.mNumberOfMessages, + (*it).mNumberOfMessages ); + } + else + { + search_results_map[grpId] = *it; + search_results_map[grpId].mPopularity = 1; // number of results so far + } + } + } // end RS_STACK_MUTEX(mNxsMutex); + + for(const RsGxsGroupId& grpId : groupsToNotifyResults) + mObserver->receiveDistantSearchResults(req, grpId); } void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len) From 50e03a539c76c1278dc19c280cb5ffa3b2929e6d Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 16 Aug 2018 18:49:36 +0200 Subject: [PATCH 171/213] basic infrastructure for banning unwanted file content --- libretroshare/src/file_sharing/p3filelists.cc | 41 +++++++++++++++++ libretroshare/src/file_sharing/p3filelists.h | 10 +++++ .../src/file_sharing/rsfilelistitems.cc | 19 +++++--- .../src/file_sharing/rsfilelistitems.h | 20 ++++++--- libretroshare/src/ft/ftserver.cc | 18 +++++++- libretroshare/src/ft/ftserver.h | 7 ++- libretroshare/src/retroshare/rsfiles.h | 11 +++++ .../src/gui/FileTransfer/SearchDialog.cpp | 44 ++++++++++++++----- .../src/gui/FileTransfer/SearchDialog.h | 1 + 9 files changed, 146 insertions(+), 25 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 7448ffd0d..7e7be3632 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1855,6 +1855,47 @@ bool p3FileDatabase::locked_generateAndSendSyncRequest(RemoteDirectoryStorage *r } +// Unwanted content filtering system + +bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) +{ + { + RS_STACK_MUTEX(mFLSMtx) ; + BannedFileEntry& entry(mPrimaryBanList[real_file_hash]) ; // primary list (user controlled) of files banned from FT search and forwarding. map + + entry.filename = filename ; + entry.size = file_size ; + entry.ban_time_stamp = time(NULL); + + RsFileHash hash_of_hash ; + ftServer::encryptHash(real_file_hash,hash_of_hash) ; + + mBannedFileList.insert(real_file_hash) ; + mBannedFileList.insert(hash_of_hash) ; + } + + IndicateConfigChanged(); + return true; +} +bool p3FileDatabase::unbanFile(const RsFileHash& real_file_hash) +{ + { + RS_STACK_MUTEX(mFLSMtx) ; + mPrimaryBanList.erase(real_file_hash) ; + } + + IndicateConfigChanged(); + return true; +} +bool p3FileDatabase::getPrimaryBannedFilesList(std::map& banned_files) +{ + RS_STACK_MUTEX(mFLSMtx) ; + banned_files = mPrimaryBanList; + + return true ; +} + + diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 44e5ec4b4..87297094d 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -132,6 +132,10 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub void setMaxShareDepth(int i) ; int maxShareDepth() const ; + bool banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) ; + bool unbanFile(const RsFileHash& real_file_hash); + bool getPrimaryBannedFilesList(std::map& banned_files) ; + // computes/gathers statistics about shared directories int getSharedDirStatistics(const RsPeerId& pid,SharedDirStats& stats); @@ -244,5 +248,11 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub std::string mFileSharingDir ; time_t mLastCleanupTime; time_t mLastDataRecvTS ; + + // file filtering. Not explicitly related to shared files, but + // + + std::map mPrimaryBanList ; // primary list (user controlled) of files banned from FT search and forwarding. map + std::set mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends. }; diff --git a/libretroshare/src/file_sharing/rsfilelistitems.cc b/libretroshare/src/file_sharing/rsfilelistitems.cc index 49aa4edff..a0e1eb695 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.cc +++ b/libretroshare/src/file_sharing/rsfilelistitems.cc @@ -34,12 +34,16 @@ void RsFileListsSyncRequestItem::serial_process(RsGenericSerializer::SerializeJo } void RsFileListsSyncResponseItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { - RsTypeSerializer::serial_process (j,ctx,entry_hash,"entry_hash") ; - RsTypeSerializer::serial_process (j,ctx,checksum,"checksum") ; - RsTypeSerializer::serial_process (j,ctx,flags ,"flags") ; + RsTypeSerializer::serial_process (j,ctx,entry_hash, "entry_hash") ; + RsTypeSerializer::serial_process (j,ctx,checksum, "checksum") ; + RsTypeSerializer::serial_process (j,ctx,flags, "flags") ; RsTypeSerializer::serial_process (j,ctx,last_known_recurs_modf_TS,"last_known_recurs_modf_TS") ; - RsTypeSerializer::serial_process (j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process(j,ctx,directory_content_data,"directory_content_data") ; + RsTypeSerializer::serial_process (j,ctx,request_id, "request_id") ; + RsTypeSerializer::serial_process(j,ctx,directory_content_data, "directory_content_data") ; +} +void RsFileListsBannedHashesItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,encrypted_hashes,"encrypted_hashes") ; } RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const @@ -49,8 +53,9 @@ RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const switch(type) { - case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: return new RsFileListsSyncRequestItem(); - case RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM: return new RsFileListsSyncResponseItem(); + case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: return new RsFileListsSyncRequestItem(); + case RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM: return new RsFileListsSyncResponseItem(); + case RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM: return new RsFileListsBannedHashesItem(); default: return NULL ; } diff --git a/libretroshare/src/file_sharing/rsfilelistitems.h b/libretroshare/src/file_sharing/rsfilelistitems.h index 337bde15f..68a7d2d8c 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.h +++ b/libretroshare/src/file_sharing/rsfilelistitems.h @@ -34,11 +34,10 @@ #include "serialiser/rsserializer.h" -// These items have "flag type" numbers, but this is not used. - -const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM = 0x01; -const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM = 0x02; -const uint8_t RS_PKT_SUBTYPE_FILELISTS_CONFIG_ITEM = 0x03; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM = 0x01; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM = 0x02; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_CONFIG_ITEM = 0x03; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM = 0x04; /*! * Base class for filelist sync items @@ -103,6 +102,17 @@ public: RsTlvBinaryData directory_content_data ; // encoded binary data. This allows to vary the encoding format, in a way that is transparent to the serialiser. }; +class RsFileListsBannedHashesItem: public RsFileListsItem +{ +public: + RsFileListsBannedHashesItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM){} + + virtual void clear(); + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); + + std::set encrypted_hashes ;// hash of hash for each banned file. +}; + class RsFileListsSerialiser : public RsServiceSerializer { public: diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 276446d1f..90ba9beac 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1825,10 +1825,24 @@ int ftServer::handleIncoming() bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr) { /* add all the subbits to config mgr */ - cfgmgr->addConfiguration("ft_database.cfg", mFileDatabase); - cfgmgr->addConfiguration("ft_extra.cfg", mFtExtra); + cfgmgr->addConfiguration("ft_database.cfg" , mFileDatabase); + cfgmgr->addConfiguration("ft_extra.cfg" , mFtExtra ); cfgmgr->addConfiguration("ft_transfers.cfg", mFtController); return true; } +// Offensive content file filtering + +int ftServer::banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) +{ + return mFileDatabase->banFile(real_file_hash,filename,file_size) ; +} +int ftServer::unbanFile(const RsFileHash& real_file_hash) +{ + return mFileDatabase->unbanFile(real_file_hash) ; +} +bool ftServer::getPrimaryBannedFilesList(std::map& banned_files) +{ + return mFileDatabase->getPrimaryBannedFilesList(banned_files) ; +} diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 57920cc02..7e9ccde6a 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -192,6 +192,10 @@ public: virtual int SearchBoolExp(RsRegularExpression::Expression * exp, std::list &results,FileSearchFlags flags,const RsPeerId& peer_id); virtual int getSharedDirStatistics(const RsPeerId& pid, SharedDirStats& stats) ; + virtual int banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) ; + virtual int unbanFile(const RsFileHash& real_file_hash); + virtual bool getPrimaryBannedFilesList(std::map& banned_files) ; + /*** * Utility Functions ***/ @@ -237,6 +241,8 @@ public: virtual bool ignoreDuplicates() ; virtual void setIgnoreDuplicates(bool ignore) ; + static bool encryptHash(const RsFileHash& hash, RsFileHash& hash_of_hash); + /***************************************************************/ /*************** Data Transfer Interface ***********************/ /***************************************************************/ @@ -282,7 +288,6 @@ protected: // fnds out what is the real hash of encrypted hash hash bool findRealHash(const RsFileHash& hash, RsFileHash& real_hash); bool findEncryptedHash(const RsPeerId& virtual_peer_id, RsFileHash& encrypted_hash); - bool encryptHash(const RsFileHash& hash, RsFileHash& hash_of_hash); bool checkUploadLimit(const RsPeerId& pid,const RsFileHash& hash); private: diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 520dd22bf..0af2708d6 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -162,6 +162,13 @@ public: uint64_t mTotalSize ; }; +struct BannedFileEntry +{ + uint64_t size ; + std::string filename ; + time_t ban_time_stamp; +}; + class RsFiles { public: @@ -261,6 +268,10 @@ public: virtual int SearchBoolExp(RsRegularExpression::Expression * exp, std::list &results,FileSearchFlags flags,const RsPeerId& peer_id) = 0; virtual int getSharedDirStatistics(const RsPeerId& pid, SharedDirStats& stats) =0; + virtual int banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) =0; + virtual int unbanFile(const RsFileHash& real_file_hash)=0; + virtual bool getPrimaryBannedFilesList(std::map& banned_files) =0; + /*** * Utility Functions. ***/ diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index be61a1dcc..e844f9866 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -54,6 +54,7 @@ #define IMAGE_COLLVIEW ":/images/library_view.png" #define IMAGE_COLLOPEN ":/images/library.png" #define IMAGE_COPYLINK ":/images/copyrslink.png" +#define IMAGE_BANFILE ":/icons/biohazard_red.png" /* Key for UI Preferences */ #define UI_PREF_ADVANCED_SEARCH "UIOptions/AdvancedSearch" @@ -327,6 +328,7 @@ void SearchDialog::searchResultWidgetCustomPopupMenu( QPoint /*point*/ ) QMenu contextMnu(this) ; contextMnu.addAction(QIcon(IMAGE_START), tr("Download"), this, SLOT(download())) ; + contextMnu.addAction(QIcon(IMAGE_BANFILE), tr("Mark as bad"), this, SLOT(ban())) ; contextMnu.addSeparator();//-------------------------------------- contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyResultLink())) ; @@ -406,22 +408,44 @@ void SearchDialog::download() std::cout << "isuing file request from search dialog: -" << (item->text(SR_NAME_COL)).toStdString() << "-" << hash << "-" << (item->text(SR_SIZE_COL)).toULongLong() << "-ids=" ; - for(std::list::const_iterator it(srcIds.begin()); it!=srcIds.end(); ++it) { + for(std::list::const_iterator it(srcIds.begin()); it!=srcIds.end(); ++it) std::cout << *it << "-" << std::endl; - }//for(std::list::const_iterator - //QColor foreground = QColor(0, 128, 0); // green + QColor foreground = textColorDownloading(); QBrush brush(foreground); for (int i = 0; i < item->columnCount(); ++i) - { item->setForeground(i, brush); - } - }//if(!rsFiles -> FileRequest( - }//if (item->text(SR_HASH_COL).isEmpty()) - }//for (int i = 0 - if (attemptDownloadLocal) { + } + } + } + if (attemptDownloadLocal) QMessageBox::information(this, tr("Download Notice"), tr("Skipping Local Files")) ; - }//if (attemptDownloadLocal) +} + +void SearchDialog::ban() +{ + /* should also be able to handle multi-selection */ + + QList itemsForDownload = ui.searchResultWidget->selectedItems() ; + int numdls = itemsForDownload.size() ; + QTreeWidgetItem * item ; + + for (int i = 0; i < numdls; ++i) + { + item = itemsForDownload.at(i) ; + // call the download + // * + if(!item->text(SR_HASH_COL).isEmpty()) + { + std::cerr << "SearchDialog::download() Calling File Ban" << std::endl ; + + RsFileHash hash( item->text(SR_HASH_COL).toStdString()) ; + + rsFiles -> banFile( hash, (item->text(SR_NAME_COL)).toUtf8().constData() , (item->text(SR_SIZE_COL)).toULongLong()); + + ui.searchResultWidget->takeItem(item) ; + } + } } void SearchDialog::collCreate() diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.h b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h index 57846692c..968b0e725 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h @@ -75,6 +75,7 @@ private slots: void searchSummaryWidgetCustomPopupMenu( QPoint point ); void download(); + void ban(); void collCreate(); void collModif(); From e17c4d0e40b4e3df766e82f444b5999dd7df0e46 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 16 Aug 2018 22:22:47 +0200 Subject: [PATCH 172/213] added a dialog to edit banned files --- .../src/file_sharing/rsfilelistitems.h | 2 +- .../gui/FileTransfer/BannedFilesDialog.cpp | 36 ++++++++++++++ .../src/gui/FileTransfer/BannedFilesDialog.h | 46 ++++++++++++++++++ .../src/gui/FileTransfer/BannedFilesDialog.ui | 48 +++++++++++++++++++ .../src/gui/FileTransfer/SearchDialog.cpp | 10 +++- .../src/gui/FileTransfer/SearchDialog.h | 1 + .../src/gui/FileTransfer/SearchDialog.ui | 18 +++++++ .../src/gui/FileTransfer/TransfersDialog.h | 6 +-- retroshare-gui/src/retroshare-gui.pro | 3 ++ 9 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp create mode 100644 retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h create mode 100644 retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui diff --git a/libretroshare/src/file_sharing/rsfilelistitems.h b/libretroshare/src/file_sharing/rsfilelistitems.h index 68a7d2d8c..20ea2f649 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.h +++ b/libretroshare/src/file_sharing/rsfilelistitems.h @@ -107,7 +107,7 @@ class RsFileListsBannedHashesItem: public RsFileListsItem public: RsFileListsBannedHashesItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM){} - virtual void clear(); + virtual void clear() { encrypted_hashes.clear(); } virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); std::set encrypted_hashes ;// hash of hash for each banned file. diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp new file mode 100644 index 000000000..49981410c --- /dev/null +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp @@ -0,0 +1,36 @@ +/******************************************************************************* + * retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#include "retroshare/rsfiles.h" + +#include "BannedFilesDialog.h" + +BannedFilesDialog::BannedFilesDialog(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); +} + +BannedFilesDialog::~BannedFilesDialog() {} + +void BannedFilesDialog::unbanFile() +{ +#warning Code missing here +} diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h new file mode 100644 index 000000000..a76efb7b9 --- /dev/null +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h @@ -0,0 +1,46 @@ +/******************************************************************************* + * retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h * + * * + * Copyright 2018 by Retroshare Team * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#pragma once + +#include "RsAutoUpdatePage.h" +#include "ui_BannedFilesDialog.h" + +class BannedFilesDialog: public QDialog +{ + Q_OBJECT + +public: + /** Default Constructor */ + BannedFilesDialog(QWidget *parent = 0); + /** Default Destructor */ + ~BannedFilesDialog(); + +private slots: + void unbanFile(); + + /** management of the adv search dialog object when switching search modes */ + //void hideEvent(QHideEvent * event); + +private: + /** Qt Designer generated object */ + Ui::BannedFilesDialog ui; +}; + diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui new file mode 100644 index 000000000..1b3833f58 --- /dev/null +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui @@ -0,0 +1,48 @@ + + + BannedFilesDialog + + + + 0 + 0 + 923 + 810 + + + + + + + true + + + + Filename + + + + + Hash + + + + + Size + + + + + Banned since... + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index e844f9866..f017529b1 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -26,6 +26,7 @@ #include "rshare.h" #include "SearchDialog.h" +#include "gui/FileTransfer/BannedFilesDialog.h" #include "gui/RSHumanReadableDelegate.h" #include "gui/RetroShareLink.h" #include "retroshare-gui/RsAutoUpdatePage.h" @@ -118,6 +119,7 @@ SearchDialog::SearchDialog(QWidget *parent) connect( ui.searchResultWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchResultWidgetCustomPopupMenu( QPoint ) ) ); connect( ui.searchSummaryWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchSummaryWidgetCustomPopupMenu( QPoint ) ) ); + connect( ui.showBannedFiles_TB, SIGNAL( clicked() ), this, SLOT( openBannedFiles() ) ); connect( ui.lineEdit, SIGNAL( returnPressed ( void ) ), this, SLOT( searchKeywords( void ) ) ); connect( ui.lineEdit, SIGNAL( textChanged ( const QString& ) ), this, SLOT( checkText( const QString& ) ) ); @@ -443,11 +445,17 @@ void SearchDialog::ban() rsFiles -> banFile( hash, (item->text(SR_NAME_COL)).toUtf8().constData() , (item->text(SR_SIZE_COL)).toULongLong()); - ui.searchResultWidget->takeItem(item) ; + ui.searchResultWidget->takeTopLevelItem(ui.searchResultWidget->indexOfTopLevelItem(item)) ; } } } +void SearchDialog::openBannedFiles() +{ + BannedFilesDialog d ; + d.exec(); +} + void SearchDialog::collCreate() { std::vector dirVec; diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.h b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h index 968b0e725..001ae3903 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.h @@ -87,6 +87,7 @@ private slots: void recommendtofriends(); void checkText(const QString&); + void openBannedFiles(); void copyResultLink(); void copySearchLink(); void openFolderSearch(); diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui index b3df60f05..47e221bf5 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.ui @@ -170,6 +170,23 @@ + + + + + 0 + 0 + + + + + + + + :/icons/biohazard_red.png:/icons/biohazard_red.png + + + @@ -450,6 +467,7 @@ + diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.h b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.h index 51bc205d3..f98a96daa 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.h @@ -55,7 +55,8 @@ public: /* Fixed numbers for load and save the last page */ SearchTab = 0, /** Network page. */ LocalSharedFilesTab = 1, /** Network new graph. */ - RemoteSharedFilesTab = 2 /** Old group chat page. */ + RemoteSharedFilesTab = 2, /** Old group chat page. */ + DownloadTab = 3 }; @@ -108,9 +109,6 @@ private slots: void expandAllUL(); void collapseAllUL(); -// void rootdecorated(); -// void rootisnotdecorated(); - void pauseFileTransfer(); void resumeFileTransfer(); void dlOpenFolder(); diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index d973e5de8..b5b17d159 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -365,6 +365,7 @@ HEADERS += rshare.h \ gui/FileTransfer/DLListDelegate.h \ gui/FileTransfer/ULListDelegate.h \ gui/FileTransfer/TransfersDialog.h \ + gui/FileTransfer/BannedFilesDialog.h \ gui/statistics/TurtleRouterDialog.h \ gui/statistics/TurtleRouterStatistics.h \ gui/statistics/dhtgraph.h \ @@ -597,6 +598,7 @@ FORMS += gui/StartDialog.ui \ gui/FileTransfer/DetailsDialog.ui \ gui/FileTransfer/SearchDialog.ui \ gui/FileTransfer/SharedFilesDialog.ui \ + gui/FileTransfer/BannedFilesDialog.ui \ gui/MainWindow.ui \ gui/NetworkView.ui \ gui/MessengerWindow.ui \ @@ -743,6 +745,7 @@ SOURCES += main.cpp \ gui/FileTransfer/xprogressbar.cpp \ gui/FileTransfer/DetailsDialog.cpp \ gui/FileTransfer/TransferUserNotify.cpp \ + gui/FileTransfer/BannedFilesDialog.cpp \ gui/MainPage.cpp \ gui/HelpDialog.cpp \ gui/LogoBar.cpp \ From a7ee85495db4a266eedbd6384ffd999bdf25820e Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 16 Aug 2018 23:18:29 +0200 Subject: [PATCH 173/213] added fill routine for banned files list --- .../gui/FileTransfer/BannedFilesDialog.cpp | 41 +++++++++++++++++++ .../src/gui/FileTransfer/BannedFilesDialog.h | 3 ++ 2 files changed, 44 insertions(+) diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp index 49981410c..bda425ab3 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp @@ -18,14 +18,25 @@ * * *******************************************************************************/ +#include + #include "retroshare/rsfiles.h" #include "BannedFilesDialog.h" +#define COLUMN_FILE_NAME 0 +#define COLUMN_FILE_HASH 1 +#define COLUMN_FILE_SIZE 2 +#define COLUMN_FILE_TIME 3 + BannedFilesDialog::BannedFilesDialog(QWidget *parent) : QDialog(parent) { ui.setupUi(this); + + fillFilesList() ; + + connect(ui.bannedFiles_TW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(bannedFilesContextMenu(QPoint))); } BannedFilesDialog::~BannedFilesDialog() {} @@ -34,3 +45,33 @@ void BannedFilesDialog::unbanFile() { #warning Code missing here } + +void BannedFilesDialog::bannedFilesContextMenu() +{ + QMenu menu(this); + + QAction *action = menu.addAction(QIcon(":/images/FeedAdd.png"), tr("Remove"), this, SLOT(unbanFile())); + + menu.exec(QCursor::pos()); +} + +void BannedFilesDialog::fillFilesList() +{ + std::map banned_files ; + + rsFiles->getPrimaryBannedFilesList(banned_files); + int row=0; + + for(auto it(banned_files.begin());it!=banned_files.end();++it) + { + ui.bannedFiles_TW->setItem(row, COLUMN_FILE_NAME, new QTableWidgetItem(QIcon(),QString::fromUtf8(it->second.filename.c_str()),0)); + ui.bannedFiles_TW->setItem(row, COLUMN_FILE_HASH, new QTableWidgetItem(QIcon(),QString::fromStdString(it->first.toStdString()),0)); + ui.bannedFiles_TW->setItem(row, COLUMN_FILE_SIZE, new QTableWidgetItem(QIcon(),QString::number(it->second.size),0)); + ui.bannedFiles_TW->setItem(row, COLUMN_FILE_TIME, new QTableWidgetItem(QIcon(),QString::number(it->second.ban_time_stamp),0)); + + row++; + + // ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->setData(ROLE_RECIPIENT_ID, QString::fromStdString(id)); + // ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->setData(ROLE_RECIPIENT_TYPE, dest_type); + } +} diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h index a76efb7b9..4dfe95adc 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h @@ -38,8 +38,11 @@ private slots: /** management of the adv search dialog object when switching search modes */ //void hideEvent(QHideEvent * event); + void bannedFilesContextMenu(); private: + void fillFilesList(); + /** Qt Designer generated object */ Ui::BannedFilesDialog ui; }; From 4b6f751b09a76159295b1fac373564df1be01be1 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 16 Aug 2018 23:34:29 +0200 Subject: [PATCH 174/213] Implement JSON API generation for async API calls Move JSON helpers to util/rsjson.* for better usability Implement JSON ostream manipulator to print compact and pretty JSON Use lambdas for API wrappers, integrate better and avoid namespace pollution Removed experimental JSON API for notify client wrapper, notifications can be implemented automatically with moderns async API calls Implement and automatically expose to JSON API RsGxsChannels::turtleSearchRequest( const std::string& matchString, const std::function& multiCallback, std::time_t maxWait ) --- .../async-method-wrapper-template.cpp.tmpl | 73 ++++++++++ jsonapi-generator/src/jsonapi-generator.cpp | 137 ++++++++++++++---- .../src/method-wrapper-template.cpp.tmpl | 12 +- libretroshare/src/jsonapi/jsonapi.cpp | 79 ++-------- libretroshare/src/jsonapi/jsonapi.h | 16 -- libretroshare/src/libretroshare.pro | 33 ++--- libretroshare/src/retroshare/rsgxschannels.h | 15 ++ libretroshare/src/retroshare/rsgxsiface.h | 1 + libretroshare/src/serialiser/rsserializer.h | 8 +- .../src/serialiser/rstypeserializer.cc | 13 -- .../src/serialiser/rstypeserializer.h | 7 +- libretroshare/src/services/p3gxschannels.cc | 63 +++++++- libretroshare/src/services/p3gxschannels.h | 40 ++++- libretroshare/src/util/rsjson.cc | 68 +++++++++ libretroshare/src/util/rsjson.h | 56 +++++++ 15 files changed, 444 insertions(+), 177 deletions(-) create mode 100644 jsonapi-generator/src/async-method-wrapper-template.cpp.tmpl create mode 100644 libretroshare/src/util/rsjson.cc create mode 100644 libretroshare/src/util/rsjson.h diff --git a/jsonapi-generator/src/async-method-wrapper-template.cpp.tmpl b/jsonapi-generator/src/async-method-wrapper-template.cpp.tmpl new file mode 100644 index 000000000..8dd03a505 --- /dev/null +++ b/jsonapi-generator/src/async-method-wrapper-template.cpp.tmpl @@ -0,0 +1,73 @@ +/* + * RetroShare JSON API + * Copyright (C) 2018 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +registerHandler("$%apiPath%$", + [$%captureVars%$](const std::shared_ptr session) +{ + const std::multimap headers + { + { "Connection", "keep-alive" }, + { "Content-Type", "text/event-stream" } + }; + session->yield(rb::OK, headers); + + size_t reqSize = session->get_request()->get_header("Content-Length", 0); + session->fetch( reqSize, [$%captureVars%$]( + const std::shared_ptr session, + const rb::Bytes& body ) + { + RsGenericSerializer::SerializeContext cReq( + nullptr, 0, + RsGenericSerializer::SERIALIZATION_FLAG_YIELDING ); + RsJson& jReq(cReq.mJson); + jReq.Parse(reinterpret_cast(body.data()), body.size()); + + RsGenericSerializer::SerializeContext cAns; + RsJson& jAns(cAns.mJson); + + // if caller specified caller_data put it back in the answhere + const char kcd[] = "caller_data"; + if(jReq.HasMember(kcd)) + jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator()); + +$%paramsDeclaration%$ + +$%inputParamsDeserialization%$ + + $%callbackName%$ = [session]($%callbackParams%$) + { +$%callbackParamsSerialization%$ + + std::stringstream message; + message << "data: " << compactJSON << ctx.mJson << "\n\n"; + session->yield(message.str()); + $%sessionEarlyClose%$ + }; + +$%functionCall%$ + +$%outputParamsSerialization%$ + + // return them to the API caller + std::stringstream message; + message << "data: " << compactJSON << cAns.mJson << "\n\n"; + session->yield(message.str()); + $%sessionDelayedClose%$ + } ); +}); + diff --git a/jsonapi-generator/src/jsonapi-generator.cpp b/jsonapi-generator/src/jsonapi-generator.cpp index e0dd7659d..9d6a04bad 100644 --- a/jsonapi-generator/src/jsonapi-generator.cpp +++ b/jsonapi-generator/src/jsonapi-generator.cpp @@ -25,12 +25,15 @@ struct MethodParam { - MethodParam() : in(false), out(false) {} + MethodParam() : + in(false), out(false), isMultiCallback(false), isSingleCallback(false){} QString type; QString name; bool in; bool out; + bool isMultiCallback; + bool isSingleCallback; }; int main(int argc, char *argv[]) @@ -42,24 +45,18 @@ int main(int argc, char *argv[]) QString outputPath(argv[2]); QString doxPrefix(outputPath+"/xml/"); - QString wrappersDefFilePath(outputPath + "/jsonapi-wrappers.cpp"); + QString wrappersDefFilePath(outputPath + "/jsonapi-wrappers.inl"); QFile wrappersDefFile(wrappersDefFilePath); wrappersDefFile.remove(); if(!wrappersDefFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) qFatal(QString("Can't open: " + wrappersDefFilePath).toLatin1().data()); - QString wrappersDeclFilePath(outputPath + "/jsonapi-wrappers.h"); - QFile wrappersDeclFile(wrappersDeclFilePath); - wrappersDeclFile.remove(); - if(!wrappersDeclFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) - qFatal(QString("Can't open: " + wrappersDeclFilePath).toLatin1().data()); - - QString wrappersRegisterFilePath(outputPath + "/jsonapi-register.inl"); - QFile wrappersRegisterFile(wrappersRegisterFilePath); - wrappersRegisterFile.remove(); - if(!wrappersRegisterFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) - qFatal(QString("Can't open: " + wrappersRegisterFilePath).toLatin1().data()); - + QString cppApiIncludesFilePath(outputPath + "/jsonapi-includes.inl"); + QFile cppApiIncludesFile(cppApiIncludesFilePath); + cppApiIncludesFile.remove(); + if(!cppApiIncludesFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)) + qFatal(QString("Can't open: " + cppApiIncludesFilePath).toLatin1().data()); + QSet cppApiIncludesSet; QDirIterator it(doxPrefix, QStringList() << "*8h.xml", QDir::Files); while(it.hasNext()) @@ -151,21 +148,45 @@ int main(int argc, char *argv[]) QString retvalType = memberdef.firstChildElement("type").text(); QMap paramsMap; QStringList orderedParamNames; - uint hasInput = false; - uint hasOutput = false; + bool hasInput = false; + bool hasOutput = false; + bool hasSingleCallback = false; + bool hasMultiCallback = false; + QString callbackName; + QString callbackParams; QDomNodeList params = memberdef.elementsByTagName("param"); for (int k = 0; k < params.size(); ++k) { QDomElement tmpPE = params.item(k).toElement(); MethodParam tmpParam; - tmpParam.name = tmpPE.firstChildElement("declname").text(); - QDomElement tmpType = tmpPE.firstChildElement("type"); + QString& pName(tmpParam.name); QString& pType(tmpParam.type); + pName = tmpPE.firstChildElement("declname").text(); + QDomElement tmpType = tmpPE.firstChildElement("type"); pType = tmpType.text(); if(pType.startsWith("const ")) pType.remove(0,6); - pType.replace(QString("&"), QString()); - pType.replace(QString(" "), QString()); + if(pType.startsWith("std::function")) + { + if(pType.endsWith('&')) pType.chop(1); + if(pName.startsWith("multiCallback")) + { + tmpParam.isMultiCallback = true; + hasMultiCallback = true; + } + else if(pName.startsWith("callback")) + { + tmpParam.isSingleCallback = true; + hasSingleCallback = true; + } + callbackName = pName; + callbackParams = pType; + } + else + { + pType.replace(QString("&"), QString()); + pType.replace(QString(" "), QString()); + } paramsMap.insert(tmpParam.name, tmpParam); orderedParamNames.push_back(tmpParam.name); } @@ -242,6 +263,58 @@ int main(int argc, char *argv[]) "\t\t\tRS_SERIAL_PROCESS(retval);\n"; if(hasOutput) outputParamsSerialization += "\t\t}\n"; + QString captureVars; + + QString sessionEarlyClose; + if(hasSingleCallback) + sessionEarlyClose = "session->close();"; + + QString sessionDelayedClose; + if(hasMultiCallback) + { + sessionDelayedClose = "mService.schedule( [session](){session->close();}, std::chrono::seconds(maxWait+120) );"; + captureVars = "this"; + } + + QString callbackParamsSerialization; + + if(hasSingleCallback || hasMultiCallback || + ((callbackParams.indexOf('(')+2) < callbackParams.indexOf(')'))) + { + QString& cbs(callbackParamsSerialization); + + callbackParams = callbackParams.split('(')[1]; + callbackParams = callbackParams.split(')')[0]; + + cbs += "RsGenericSerializer::SerializeContext ctx;\n"; + + for (QString cbPar : callbackParams.split(',')) + { + bool isConst(cbPar.startsWith("const ")); + QChar pSep(' '); + bool isRef(cbPar.contains('&')); + if(isRef) pSep = '&'; + int sepIndex = cbPar.lastIndexOf(pSep)+1; + QString cpt(cbPar.mid(0, sepIndex)); + cpt.remove(0,6); + QString cpn(cbPar.mid(sepIndex)); + + cbs += "\t\t\tRsTypeSerializer::serial_process("; + cbs += "RsGenericSerializer::TO_JSON, ctx, "; + if(isConst) + { + cbs += "const_cast<"; + cbs += cpt; + cbs += ">("; + } + cbs += cpn; + if(isConst) cbs += ")"; + cbs += ", \""; + cbs += cpn; + cbs += "\" );\n"; + } + } + QMap substitutionsMap; substitutionsMap.insert("paramsDeclaration", paramsDeclaration); substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization); @@ -249,8 +322,20 @@ int main(int argc, char *argv[]) substitutionsMap.insert("wrapperName", wrapperName); substitutionsMap.insert("headerFileName", headerFileName); substitutionsMap.insert("functionCall", functionCall); + substitutionsMap.insert("apiPath", apiPath); + substitutionsMap.insert("sessionEarlyClose", sessionEarlyClose); + substitutionsMap.insert("sessionDelayedClose", sessionDelayedClose); + substitutionsMap.insert("captureVars", captureVars); + substitutionsMap.insert("callbackName", callbackName); + substitutionsMap.insert("callbackParams", callbackParams); + substitutionsMap.insert("callbackParamsSerialization", callbackParamsSerialization); - QFile templFile(sourcePath + "/method-wrapper-template.cpp.tmpl"); + QString templFilePath(sourcePath); + if(hasMultiCallback || hasSingleCallback) + templFilePath.append("/async-method-wrapper-template.cpp.tmpl"); + else templFilePath.append("/method-wrapper-template.cpp.tmpl"); + + QFile templFile(templFilePath); templFile.open(QIODevice::ReadOnly); QString wrapperDef(templFile.readAll()); @@ -261,15 +346,13 @@ int main(int argc, char *argv[]) wrappersDefFile.write(wrapperDef.toLocal8Bit()); - QString wrapperDecl("void " + instanceName + methodName + "Wrapper(const std::shared_ptr session);\n"); - wrappersDeclFile.write(wrapperDecl.toLocal8Bit()); - - - QString wrapperReg("registerHandler(\""+apiPath+"\", "+wrapperName+");\n"); - wrappersRegisterFile.write(wrapperReg.toLocal8Bit()); + cppApiIncludesSet.insert("#include \"retroshare/" + headerFileName + "\"\n"); } } } + for(const QString& incl : cppApiIncludesSet) + cppApiIncludesFile.write(incl.toLocal8Bit()); + return 0; } diff --git a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl index 417001ec6..f9be77d76 100644 --- a/jsonapi-generator/src/method-wrapper-template.cpp.tmpl +++ b/jsonapi-generator/src/method-wrapper-template.cpp.tmpl @@ -16,14 +16,8 @@ * along with this program. If not, see . */ -#include -#include -#include -#include "retroshare/$%headerFileName%$" - -namespace rb = restbed; - -void $%wrapperName%$(const std::shared_ptr session) +registerHandler("$%apiPath%$", + [$%captureVars%$](const std::shared_ptr session) { size_t reqSize = session->get_request()->get_header("Content-Length", 0); session->fetch( reqSize, []( @@ -66,5 +60,5 @@ $%outputParamsSerialization%$ }; session->close(rb::OK, ans, headers); } ); -} +}); diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index ee4ef1158..3c2ee6cda 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -18,16 +18,19 @@ #include "jsonapi.h" -#include -#include -#include +#include +#include +#include + +#include "util/rsjson.h" +#include "retroshare/rsgxschannels.h" // Generated at compile time -#include "jsonapi-wrappers.h" +#include "jsonapi-includes.inl" JsonApiServer::JsonApiServer( uint16_t port, const std::function shutdownCallback) : - mPort(port), mShutdownCallback(shutdownCallback), notifyClientWrapper(*this) + mPort(port), mShutdownCallback(shutdownCallback) { registerHandler("/jsonApiServer/shutdown", [this](const std::shared_ptr) @@ -35,32 +38,16 @@ JsonApiServer::JsonApiServer( shutdown(); }); - registerHandler("/jsonApiServer/notifications", - [this](const std::shared_ptr session) - { - const auto headers = std::multimap - { - { "Connection", "keep-alive" }, - { "Cache-Control", "no-cache" }, - { "Content-Type", "text/event-stream" }, - }; - - session->yield(rb::OK, headers, - [this](const std::shared_ptr session) - { - notifySessions.push_back(session); - } ); - } ); - // Generated at compile time -#include "jsonapi-register.inl" +#include "jsonapi-wrappers.inl" } void JsonApiServer::run() { std::shared_ptr settings(new rb::Settings); settings->set_port(mPort); - settings->set_default_header("Connection", "close"); +// settings->set_default_header("Connection", "close"); + settings->set_default_header("Cache-Control", "no-cache"); mService.start(settings); } @@ -80,47 +67,3 @@ void JsonApiServer::shutdown(int exitCode) mService.stop(); mShutdownCallback(exitCode); } - -void JsonApiServer::cleanClosedNotifySessions() -{ - notifySessions.erase( - std::remove_if( - notifySessions.begin(), notifySessions.end(), - [](const std::shared_ptr &s) - { return s->is_closed(); } ), notifySessions.end()); -} - -JsonApiServer::NotifyClientWrapper::NotifyClientWrapper(JsonApiServer& parent) : - NotifyClient(), mJsonApiServer(parent) -{ - rsNotify->registerNotifyClient(static_cast(this)); -} - -void JsonApiServer::NotifyClientWrapper::notifyTurtleSearchResult( - uint32_t searchId, const std::list& files ) -{ - mJsonApiServer.cleanClosedNotifySessions(); - - RsGenericSerializer::SerializeContext cAns; - RsJson& jAns(cAns.mJson); - - // serialize parameters and method name to JSON - { - std::string methodName("NotifyClient/notifyTurtleSearchResult"); - std::list filesCopy(files); - RsGenericSerializer::SerializeContext& ctx(cAns); - RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON); - RS_SERIAL_PROCESS(methodName); - RS_SERIAL_PROCESS(searchId); -// RS_SERIAL_PROCESS(filesCopy); - } - - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - jAns.Accept(writer); - std::string message(buffer.GetString(), buffer.GetSize()); - message.insert(0, "data: "); message.append("\n\n"); - - for(auto session : mJsonApiServer.notifySessions) - session->yield(message); -} diff --git a/libretroshare/src/jsonapi/jsonapi.h b/libretroshare/src/jsonapi/jsonapi.h index bb3f78378..f06f7e459 100644 --- a/libretroshare/src/jsonapi/jsonapi.h +++ b/libretroshare/src/jsonapi/jsonapi.h @@ -21,7 +21,6 @@ #include #include "util/rsthreads.h" -#include "retroshare/rsnotify.h" namespace rb = restbed; @@ -70,20 +69,5 @@ private: uint16_t mPort; rb::Service mService; const std::function mShutdownCallback; - - std::list > notifySessions; - void cleanClosedNotifySessions(); - - struct NotifyClientWrapper : NotifyClient - { - NotifyClientWrapper(JsonApiServer& parent); - - void notifyTurtleSearchResult( - uint32_t searchId, const std::list& files); - - private: - JsonApiServer& mJsonApiServer; - }; - NotifyClientWrapper notifyClientWrapper; }; diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 2e2d0feed..8b5c879db 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -776,10 +776,12 @@ SOURCES += gxstunnel/p3gxstunnel.cc \ # new serialization code HEADERS += serialiser/rsserializable.h \ serialiser/rsserializer.h \ - serialiser/rstypeserializer.h + serialiser/rstypeserializer.h \ + util/rsjson.h SOURCES += serialiser/rsserializer.cc \ - serialiser/rstypeserializer.cc + serialiser/rstypeserializer.cc \ + util/rsjson.cc # Identity Service HEADERS += retroshare/rsidentity.h \ @@ -874,9 +876,8 @@ rs_jsonapi { DOXIGEN_INPUT_DIRECTORY=$$system_path($$clean_path($${PWD})) DOXIGEN_CONFIG_SRC=$$system_path($$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/jsonapi-generator-doxygen.conf)) DOXIGEN_CONFIG_OUT=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator-doxygen.conf)) - WRAPPERS_DEF_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-wrappers.cpp)) - WRAPPERS_DECL_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-wrappers.h)) - WRAPPERS_REG_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-register.inl)) + WRAPPERS_INCL_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-includes.inl)) + WRAPPERS_REG_FILE=$$system_path($$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-wrappers.inl)) restbed.target = $$system_path($$clean_path($${RESTBED_BUILD_PATH}/library/librestbed.a)) restbed.commands = \ @@ -890,30 +891,22 @@ rs_jsonapi { PRE_TARGETDEPS *= $${JSONAPI_GENERATOR_EXE} INCLUDEPATH *= $${JSONAPI_GENERATOR_OUT} - GENERATED_HEADERS += $${WRAPPERS_DECL_FILE} $${WRAPPERS_REG_FILE} - GENERATED_SOURCES += $${WRAPPERS_DEF_FILE} + GENERATED_HEADERS += $${WRAPPERS_INCL_FILE} - jsonwrappersdecl.target = $${WRAPPERS_DECL_FILE} - jsonwrappersdecl.commands = \ + jsonwrappersincl.target = $${WRAPPERS_INCL_FILE} + jsonwrappersincl.commands = \ cp $${DOXIGEN_CONFIG_SRC} $${DOXIGEN_CONFIG_OUT}; \ echo OUTPUT_DIRECTORY=$${JSONAPI_GENERATOR_OUT} >> $${DOXIGEN_CONFIG_OUT};\ echo INPUT=$${DOXIGEN_INPUT_DIRECTORY} >> $${DOXIGEN_CONFIG_OUT}; \ doxygen $${DOXIGEN_CONFIG_OUT}; \ $${JSONAPI_GENERATOR_EXE} $${JSONAPI_GENERATOR_SRC} $${JSONAPI_GENERATOR_OUT}; - QMAKE_EXTRA_TARGETS += jsonwrappersdecl - libretroshare.depends += jsonwrappersdecl - PRE_TARGETDEPS *= $${WRAPPERS_DECL_FILE} - - jsonwrappersdef.target = $${WRAPPERS_DEF_FILE} - jsonwrappersdef.commands = touch $${WRAPPERS_DEF_FILE} - jsonwrappersdef.depends = jsonwrappersdecl - QMAKE_EXTRA_TARGETS += jsonwrappersdef - libretroshare.depends += jsonwrappersdef - PRE_TARGETDEPS *= $${WRAPPERS_DEF_FILE} + QMAKE_EXTRA_TARGETS += jsonwrappersincl + libretroshare.depends += jsonwrappersincl + PRE_TARGETDEPS *= $${WRAPPERS_INCL_FILE} jsonwrappersreg.target = $${WRAPPERS_REG_FILE} jsonwrappersreg.commands = touch $${WRAPPERS_REG_FILE} - jsonwrappersreg.depends = jsonwrappersdef + jsonwrappersreg.depends = jsonwrappersincl QMAKE_EXTRA_TARGETS += jsonwrappersreg libretroshare.depends += jsonwrappersreg PRE_TARGETDEPS *= $${WRAPPERS_REG_FILE} diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index f7d2430a6..754ea7a28 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -25,6 +25,7 @@ #include #include #include +#include #include "retroshare/rstokenservice.h" #include "retroshare/rsgxsifacehelper.h" @@ -266,6 +267,20 @@ public: */ virtual bool ExtraFileRemove(const RsFileHash& hash) = 0; + /** + * @brief Request remote channels search + * @jsonapi{development} + * @param[in] matchString string to look for in the search + * @param multiCallback function that will be called each time a search + * result is received + * @param[in] maxWait maximum wait time in seconds for search results + * @return false on error, true otherwise + */ + virtual bool turtleSearchRequest( + const std::string& matchString, + const std::function& multiCallback, + std::time_t maxWait = 300 ) = 0; + ////////////////////////////////////////////////////////////////////////////// /// Distant synchronisation methods /// ////////////////////////////////////////////////////////////////////////////// diff --git a/libretroshare/src/retroshare/rsgxsiface.h b/libretroshare/src/retroshare/rsgxsiface.h index 4adc3fce7..7fbf4b691 100644 --- a/libretroshare/src/retroshare/rsgxsiface.h +++ b/libretroshare/src/retroshare/rsgxsiface.h @@ -32,6 +32,7 @@ #include "gxs/rsgxsdata.h" #include "retroshare/rsgxsifacetypes.h" #include "util/rsdeprecate.h" +#include "serialiser/rsserializable.h" /*! * This structure is used to transport group summary information when a GXS diff --git a/libretroshare/src/serialiser/rsserializer.h b/libretroshare/src/serialiser/rsserializer.h index 357d075dc..09803eaa6 100644 --- a/libretroshare/src/serialiser/rsserializer.h +++ b/libretroshare/src/serialiser/rsserializer.h @@ -151,15 +151,11 @@ #include #include #include -#ifdef HAS_RAPIDJSON -#include -#else -#include -#endif // HAS_RAPIDJSON #include "retroshare/rsflags.h" #include "serialiser/rsserial.h" #include "util/rsdeprecate.h" +#include "util/rsjson.h" struct RsItem; @@ -198,8 +194,6 @@ class RsRawSerialiser: public RsSerialType virtual RsItem * deserialise(void *data, uint32_t *size); }; -typedef rapidjson::Document RsJson; - /// Top class for all services and config serializers. struct RsGenericSerializer : RsSerialType { diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index 69908e117..9c2ebc37b 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -660,16 +660,3 @@ bool RsTypeSerializer::from_JSON( const std::string& /*memberName*/, RsTypeSerializer::TlvMemBlock_proxy&, RsJson& /*jDoc*/) { return true; } - - -//============================================================================// -// RsJson std:ostream support // -//============================================================================// - -std::ostream &operator<<(std::ostream &out, const RsJson &jDoc) -{ - rapidjson::StringBuffer buffer; buffer.Clear(); - rapidjson::PrettyWriter writer(buffer); - jDoc.Accept(writer); - return out << buffer.GetString(); -} diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index de488480c..d1ccd8520 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -31,12 +31,8 @@ #include "serialiser/rsserializer.h" #include "serialiser/rsserializable.h" +#include "util/rsjson.h" -#ifdef HAS_RAPIDJSON -#include -#else -#include -#endif // HAS_RAPIDJSON #include // for typeid #include #include @@ -116,7 +112,6 @@ \ } while(false) -std::ostream &operator<<(std::ostream &out, const RsJson &jDoc); struct RsTypeSerializer { diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 26c892b71..386fe4ee0 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -69,7 +69,8 @@ p3GxsChannels::p3GxsChannels( RsGixs* gixs ) : RsGenExchange( gds, nes, new RsGxsChannelSerialiser(), RS_SERVICE_GXS_TYPE_CHANNELS, gixs, channelsAuthenPolicy() ), - RsGxsChannels(static_cast(*this)), GxsTokenQueue(this) + RsGxsChannels(static_cast(*this)), GxsTokenQueue(this), + mSearchCallbacksMapMutex("GXS channels search") { // For Dummy Msgs. mGenActive = false; @@ -351,8 +352,6 @@ static time_t last_dummy_tick = 0; GxsTokenQueue::checkRequests(); mCommentService->comment_tick(); - - return; } bool p3GxsChannels::getGroupData(const uint32_t &token, std::vector &groups) @@ -1560,6 +1559,8 @@ void p3GxsChannels::dummy_tick() } } + + cleanTimedOutSearches(); } @@ -1775,4 +1776,60 @@ bool p3GxsChannels::retrieveDistantGroup(const RsGxsGroupId& group_id,RsGxsChann return false ; } +bool p3GxsChannels::turtleSearchRequest( + const std::string& matchString, + const std::function& multiCallback, + std::time_t maxWait ) +{ + if(matchString.empty()) + { + std::cerr << __PRETTY_FUNCTION__ << " match string can't be empty!" + << std::endl; + return false; + } + TurtleRequestId sId = turtleSearchRequest(matchString); + + RS_STACK_MUTEX(mSearchCallbacksMapMutex); + mSearchCallbacksMap.emplace( + sId, + std::make_pair( + multiCallback, + std::chrono::system_clock::now() + + std::chrono::seconds(maxWait) ) ); + + return true; +} + +void p3GxsChannels::receiveDistantSearchResults( + TurtleRequestId id, const RsGxsGroupId& grpId ) +{ + std::cerr << __PRETTY_FUNCTION__ << "(" << id << ", " << grpId << ")" + << std::endl; + + RsGenExchange::receiveDistantSearchResults(id, grpId); + RsGxsGroupSummary gs; + gs.mGroupId = grpId; + netService()->retrieveDistantGroupSummary(grpId, gs); + + { + RS_STACK_MUTEX(mSearchCallbacksMapMutex); + auto cbpt = mSearchCallbacksMap.find(id); + if(cbpt != mSearchCallbacksMap.end()) + cbpt->second.first(gs); + } // end RS_STACK_MUTEX(mSearchCallbacksMapMutex); +} + +void p3GxsChannels::cleanTimedOutSearches() +{ + RS_STACK_MUTEX(mSearchCallbacksMapMutex); + auto now = std::chrono::system_clock::now(); + for( auto cbpt = mSearchCallbacksMap.begin(); + cbpt != mSearchCallbacksMap.end(); ) + if(cbpt->second.second <= now) + { + clearDistantSearchResults(cbpt->first); + cbpt = mSearchCallbacksMap.erase(cbpt); + } + else ++cbpt; +} diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index 3fb68d6dd..4f24f88b9 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -54,14 +54,14 @@ class p3GxsChannels: public RsGenExchange, public RsGxsChannels, public GxsTokenQueue, public p3Config, public RsTickEvent /* only needed for testing - remove after */ { - public: +public: + p3GxsChannels( RsGeneralDataService* gds, RsNetworkExchangeService* nes, + RsGixs* gixs ); + virtual RsServiceInfo getServiceInfo(); - p3GxsChannels(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs); -virtual RsServiceInfo getServiceInfo(); + virtual void service_tick(); -virtual void service_tick(); - - protected: +protected: virtual RsSerialiser* setupSerialiser(); // @see p3Config::setupSerialiser() @@ -82,7 +82,7 @@ virtual void notifyChanges(std::vector& changes); // Overloaded from RsTickEvent. virtual void handle_event(uint32_t event_type, const std::string &elabel); - public: +public: virtual bool getGroupData(const uint32_t &token, std::vector &groups); virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts); @@ -110,6 +110,18 @@ virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled); virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory); virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory); + /// @see RsGxsChannels::turtleSearchRequest + virtual bool turtleSearchRequest(const std::string& matchString, + const std::function& multiCallback, + std::time_t maxWait = 300 ); + + /** + * Receive results from turtle search @see RsGenExchange @see RsNxsObserver + * @see p3turtle::handleSearchResult + */ + void receiveDistantSearchResults( TurtleRequestId id, + const RsGxsGroupId& grpId ); + /* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */ virtual bool getCommentData(uint32_t token, std::vector &msgs) { return mCommentService->getGxsCommentData(token, msgs); } @@ -236,8 +248,20 @@ bool generateGroup(uint32_t &token, std::string groupName); std::vector mGenRefs; RsGxsMessageId mGenThreadId; - p3GxsCommentService *mCommentService; + p3GxsCommentService *mCommentService; std::map mKnownChannels; + + /** Store search callbacks with timeout*/ + std::map< + TurtleRequestId, + std::pair< + std::function, + std::chrono::system_clock::time_point > + > mSearchCallbacksMap; + RsMutex mSearchCallbacksMapMutex; + + /// Cleanup mSearchCallbacksMap + void cleanTimedOutSearches(); }; #endif diff --git a/libretroshare/src/util/rsjson.cc b/libretroshare/src/util/rsjson.cc new file mode 100644 index 000000000..37f6282e4 --- /dev/null +++ b/libretroshare/src/util/rsjson.cc @@ -0,0 +1,68 @@ +/******************************************************************************* + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + +#include "util/rsjson.h" + +#ifdef HAS_RAPIDJSON +# include +# include +# include +#else +# include +# include +# include +#endif // HAS_RAPIDJSON + + +inline int getJsonManipulatorStatePosition() +{ + static int p = std::ios_base::xalloc(); + return p; +} + +std::ostream& compactJSON(std::ostream &out) +{ + out.iword(getJsonManipulatorStatePosition()) = 1; + return out; +} + +std::ostream& prettyJSON(std::ostream &out) +{ + out.iword(getJsonManipulatorStatePosition()) = 0; + return out; +} + +std::ostream& operator<<(std::ostream &out, const RsJson &jDoc) +{ + rapidjson::StringBuffer buffer; buffer.Clear(); + if(out.iword(getJsonManipulatorStatePosition())) + { + rapidjson::Writer writer(buffer); + jDoc.Accept(writer); + } + else + { + rapidjson::PrettyWriter writer(buffer); + jDoc.Accept(writer); + } + + return out << buffer.GetString(); +} diff --git a/libretroshare/src/util/rsjson.h b/libretroshare/src/util/rsjson.h new file mode 100644 index 000000000..c52584b7e --- /dev/null +++ b/libretroshare/src/util/rsjson.h @@ -0,0 +1,56 @@ +/******************************************************************************* + * * + * libretroshare: retroshare core library * + * * + * Copyright (C) 2018 Gioacchino Mazzurco * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program 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 Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ +#pragma once + +#include + +#ifdef HAS_RAPIDJSON +# include +#else +# include +#endif // HAS_RAPIDJSON + +/** + * Use this type for JSON documents representations in RetroShare code + */ +typedef rapidjson::Document RsJson; + +/** + * Print out RsJson to a stream, use std::stringstream to get the string + * @param[out] out output stream + * @param[in] jDoc JSON document to print + * @return same output stream passed as out parameter + */ +std::ostream &operator<<(std::ostream &out, const RsJson &jDoc); + +/** + * Stream manipulator to print RsJson in compact format + * @param[out] out output stream + * @return same output stream passed as out parameter + */ +std::ostream& compactJSON(std::ostream &out); + +/** + * Stream manipulator to print RsJson in human readable format + * @param[out] out output stream + * @return same output stream passed as out parameter + */ +std::ostream& prettyJSON(std::ostream &out); From a2804a70ec0b6e4b97e7d9fc682096fba6eff276 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 19 Aug 2018 15:09:43 +0200 Subject: [PATCH 175/213] added context menu and removal feature for banned files --- .../gui/FileTransfer/BannedFilesDialog.cpp | 23 ++++++++++----- .../src/gui/FileTransfer/BannedFilesDialog.h | 2 +- .../src/gui/FileTransfer/BannedFilesDialog.ui | 29 +++++++++++++++---- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp index bda425ab3..5be060b09 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp @@ -19,6 +19,7 @@ *******************************************************************************/ #include +#include #include "retroshare/rsfiles.h" @@ -43,14 +44,21 @@ BannedFilesDialog::~BannedFilesDialog() {} void BannedFilesDialog::unbanFile() { -#warning Code missing here + int row = ui.bannedFiles_TW->currentRow(); + + QTableWidgetItem *item = ui.bannedFiles_TW->item(row, COLUMN_FILE_HASH); + + RsFileHash hash(item->data(Qt::UserRole).toString().toStdString()) ; + rsFiles->unbanFile(hash) ; + + fillFilesList(); } -void BannedFilesDialog::bannedFilesContextMenu() +void BannedFilesDialog::bannedFilesContextMenu(QPoint) { QMenu menu(this); - QAction *action = menu.addAction(QIcon(":/images/FeedAdd.png"), tr("Remove"), this, SLOT(unbanFile())); + menu.addAction(QIcon(":/images/FeedAdd.png"), tr("Remove"), this, SLOT(unbanFile())); menu.exec(QCursor::pos()); } @@ -62,16 +70,17 @@ void BannedFilesDialog::fillFilesList() rsFiles->getPrimaryBannedFilesList(banned_files); int row=0; + ui.bannedFiles_TW->setRowCount(banned_files.size()) ; + for(auto it(banned_files.begin());it!=banned_files.end();++it) { ui.bannedFiles_TW->setItem(row, COLUMN_FILE_NAME, new QTableWidgetItem(QIcon(),QString::fromUtf8(it->second.filename.c_str()),0)); ui.bannedFiles_TW->setItem(row, COLUMN_FILE_HASH, new QTableWidgetItem(QIcon(),QString::fromStdString(it->first.toStdString()),0)); ui.bannedFiles_TW->setItem(row, COLUMN_FILE_SIZE, new QTableWidgetItem(QIcon(),QString::number(it->second.size),0)); - ui.bannedFiles_TW->setItem(row, COLUMN_FILE_TIME, new QTableWidgetItem(QIcon(),QString::number(it->second.ban_time_stamp),0)); + ui.bannedFiles_TW->setItem(row, COLUMN_FILE_TIME, new QTableWidgetItem(QIcon(),QDateTime::fromTime_t(it->second.ban_time_stamp).toString(),0)); + + ui.bannedFiles_TW->item(row, COLUMN_FILE_HASH)->setData(Qt::UserRole, QString::fromStdString(it->first.toStdString())); row++; - - // ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->setData(ROLE_RECIPIENT_ID, QString::fromStdString(id)); - // ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->setData(ROLE_RECIPIENT_TYPE, dest_type); } } diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h index 4dfe95adc..cdcb4f6ee 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h @@ -38,7 +38,7 @@ private slots: /** management of the adv search dialog object when switching search modes */ //void hideEvent(QHideEvent * event); - void bannedFilesContextMenu(); + void bannedFilesContextMenu(QPoint); private: void fillFilesList(); diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui index 1b3833f58..435168023 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui @@ -10,12 +10,34 @@ 810 - + + + + + <html><head/><body><p>The list below contains files you have chosen to ban from your local network. You will not forward search results for these files nor forward data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &quot;Trust my friends for banning unwanted content&quot;.</p></body></html> + + + Qt::AlignJustify|Qt::AlignVCenter + + + true + + + + + Qt::CustomContextMenu + + + true + true + + false + Filename @@ -40,9 +62,6 @@ - - - - + From af7556610a96d0b30b2550d2841800544e77d00e Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 19 Aug 2018 15:52:35 +0200 Subject: [PATCH 176/213] added option whether to trust friend nodes for banned files --- .../src/file_sharing/file_sharing_defaults.h | 24 +++++++++-------- libretroshare/src/file_sharing/p3filelists.cc | 26 +++++++++++++++++++ libretroshare/src/file_sharing/p3filelists.h | 3 +++ .../src/gui/settings/TransferPage.ui | 7 +++++ 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/libretroshare/src/file_sharing/file_sharing_defaults.h b/libretroshare/src/file_sharing/file_sharing_defaults.h index 09bf937d5..77bdbb3ff 100644 --- a/libretroshare/src/file_sharing/file_sharing_defaults.h +++ b/libretroshare/src/file_sharing/file_sharing_defaults.h @@ -29,16 +29,17 @@ static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP = 60 ; // 60 se static const uint32_t DELAY_BEFORE_DELETE_NON_EMPTY_REMOTE_DIR = 60*24*86400 ; // delete non empty remoe directories after 60 days of inactivity static const uint32_t DELAY_BEFORE_DELETE_EMPTY_REMOTE_DIR = 5*24*86400 ; // delete empty remote directories after 5 days of inactivity -static const std::string HASH_CACHE_DURATION_SS = "HASH_CACHE_DURATION" ; // key string to store hash remembering time -static const std::string WATCH_FILE_DURATION_SS = "WATCH_FILES_DELAY" ; // key to store delay before re-checking for new files -static const std::string WATCH_FILE_ENABLED_SS = "WATCH_FILES_ENABLED"; // key to store ON/OFF flags for file whatch -static const std::string FOLLOW_SYMLINKS_SS = "FOLLOW_SYMLINKS"; // dereference symbolic links, or just ignore them. -static const std::string IGNORE_DUPLICATES = "IGNORE_DUPLICATES"; // do not index files that are referenced multiple times because of links -static const std::string WATCH_HASH_SALT_SS = "WATCH_HASH_SALT"; // Salt that is used to hash directory names -static const std::string IGNORED_PREFIXES_SS = "IGNORED_PREFIXES"; // ignore file prefixes -static const std::string IGNORED_SUFFIXES_SS = "IGNORED_SUFFIXES"; // ignore file suffixes -static const std::string IGNORE_LIST_FLAGS_SS = "IGNORED_FLAGS"; // ignore file flags -static const std::string MAX_SHARE_DEPTH = "MAX_SHARE_DEPTH"; // maximum depth of shared directories +static const std::string HASH_CACHE_DURATION_SS = "HASH_CACHE_DURATION" ; // key string to store hash remembering time +static const std::string WATCH_FILE_DURATION_SS = "WATCH_FILES_DELAY" ; // key to store delay before re-checking for new files +static const std::string WATCH_FILE_ENABLED_SS = "WATCH_FILES_ENABLED"; // key to store ON/OFF flags for file whatch +static const std::string TRUST_FRIEND_NODES_FOR_BANNED_FILES_SS = "TRUST_FRIEND_NODES_FOR_BANNED_FILES"; // should we trust friends for banned files or not +static const std::string FOLLOW_SYMLINKS_SS = "FOLLOW_SYMLINKS"; // dereference symbolic links, or just ignore them. +static const std::string IGNORE_DUPLICATES = "IGNORE_DUPLICATES"; // do not index files that are referenced multiple times because of links +static const std::string WATCH_HASH_SALT_SS = "WATCH_HASH_SALT"; // Salt that is used to hash directory names +static const std::string IGNORED_PREFIXES_SS = "IGNORED_PREFIXES"; // ignore file prefixes +static const std::string IGNORED_SUFFIXES_SS = "IGNORED_SUFFIXES"; // ignore file suffixes +static const std::string IGNORE_LIST_FLAGS_SS = "IGNORED_FLAGS"; // ignore file flags +static const std::string MAX_SHARE_DEPTH = "MAX_SHARE_DEPTH"; // maximum depth of shared directories static const std::string FILE_SHARING_DIR_NAME = "file_sharing" ; // hard-coded directory name to store friend file lists, hash cache, etc. static const std::string HASH_CACHE_FILE_NAME = "hash_cache.bin" ; // hard-coded directory name to store encrypted hash cache. @@ -61,6 +62,7 @@ static const uint64_t ENTRY_INDEX_BIT_MASK_64BITS = 0x0000000 static const uint32_t DELAY_BEFORE_DROP_REQUEST = 600; // every 10 min -static const bool FOLLOW_SYMLINKS_DEFAULT = true; +static const bool FOLLOW_SYMLINKS_DEFAULT = true; +static const bool TRUST_FRIEND_NODES_FOR_BANNED_FILES_DEFAULT = true; static const uint32_t FL_BASE_TMP_SECTION_SIZE = 4096 ; diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 7e7be3632..e6cbdb2b5 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -72,6 +72,7 @@ p3FileDatabase::p3FileDatabase(p3ServiceControl *mpeers) mLastRemoteDirSweepTS = 0 ; mLastCleanupTime = 0 ; mLastDataRecvTS = 0 ; + mTrustFriendNodesForBannedFiles = TRUST_FRIEND_NODES_FOR_BANNED_FILES_DEFAULT; // This is for the transmission of data @@ -369,6 +370,14 @@ cleanup = true; { RsTlvKeyValue kv; + kv.key = TRUST_FRIEND_NODES_FOR_BANNED_FILES_SS; + kv.value = trustFriendNodesForBannedFiles()?"YES":"NO" ; + + rskv->tlvkvs.pairs.push_back(kv); + } + { + RsTlvKeyValue kv; + kv.key = WATCH_HASH_SALT_SS; kv.value = mLocalDirWatcher->hashSalt().toStdString(); @@ -462,6 +471,10 @@ bool p3FileDatabase::loadList(std::list& load) { setWatchEnabled(kit->value == "YES") ; } + else if(kit->key == TRUST_FRIEND_NODES_FOR_BANNED_FILES_SS) + { + setTrustFriendNodesForBannedFiles(kit->value == "YES") ; + } else if(kit->key == WATCH_HASH_SALT_SS) { std::cerr << "Initing directory watcher with saved secret salt..." << std::endl; @@ -1895,6 +1908,19 @@ bool p3FileDatabase::getPrimaryBannedFilesList(std::map& banned_files) ; + bool trustFriendNodesForBannedFiles() const ; + void setTrustFriendNodesForBannedFiles(bool b) ; // computes/gathers statistics about shared directories @@ -254,5 +256,6 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub std::map mPrimaryBanList ; // primary list (user controlled) of files banned from FT search and forwarding. map std::set mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends. + bool mTrustFriendNodesForBannedFiles ; }; diff --git a/retroshare-gui/src/gui/settings/TransferPage.ui b/retroshare-gui/src/gui/settings/TransferPage.ui index 529a6e260..2f6dd0dae 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.ui +++ b/retroshare-gui/src/gui/settings/TransferPage.ui @@ -447,6 +447,13 @@ + + + + Trust friend nodes with banned files + + + From e5e566051b37bd0804fc100019f757a0837bb0ca Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 19 Aug 2018 21:11:17 +0200 Subject: [PATCH 177/213] added logic to compute ban list from friend nodes and own opinions --- libretroshare/src/file_sharing/p3filelists.cc | 71 +++++++++++++++++++ libretroshare/src/file_sharing/p3filelists.h | 13 ++++ .../src/gui/FileTransfer/BannedFilesDialog.ui | 2 +- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index e6cbdb2b5..13a3dc370 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1922,6 +1922,77 @@ void p3FileDatabase::setTrustFriendNodesForBannedFiles(bool b) mTrustFriendNodesForBannedFiles = b; } +void p3FileDatabase::checkSendBannedFilesInfo() +{ + RS_STACK_MUTEX(mFLSMtx) ; + + // 1 - compare records to list of online friends, send own info of not already + + std::list online_friends ; + rsPeers->getOnlineList(online_friends); + + std::set peers ; + for(auto it(online_friends.begin());it!=online_friends.end();++it) // convert to std::set for efficient search + peers.insert(*it) ; + + for(auto it(mPeerBannedFiles.begin());it!=mPeerBannedFiles.end();) + { + if(peers.find(it->first) == peers.end()) // friend not online, remove his record + { + it = mPeerBannedFiles.erase(it) ; + continue; + } + + if(it->second.mLastSent == 0) // has ban info already been sent? If not do it. + { + locked_sendBanInfo(it->first); + it->second.mLastSent = time(NULL); + } + + peers.erase(it->first); // friend has been handled -> remove from list + ++it; + } + + // 2 - add a new record for friends not already in the record map + + for(auto it(peers.begin());it!=peers.end();++it) + { + locked_sendBanInfo(*it); + mPeerBannedFiles[*it].mLastSent = time(NULL); + } + + // 3 - update list of banned hashes if it has changed somehow + + if(mBannedFilesChanged) + { + mBannedFileList.clear(); + + // Add all H(H(f)) from friends + + for(auto it(mPeerBannedFiles.begin());it!=mPeerBannedFiles.end();++it) + for(auto it2(it->second.mBannedHashOfHash.begin());it2!=it->second.mBannedHashOfHash.end();++it2) + mBannedFileList.insert(*it2); + + // Add H(f) and H(H(f)) from our primary list + + for(auto it(mPrimaryBanList.begin());it!=mPrimaryBanList.end();++it) + { + mBannedFileList.insert(it->first) ; + + RsFileHash hash_of_hash ; + ftServer::encryptHash(it->first,hash_of_hash) ; + + mBannedFileList.insert(hash_of_hash) ; + } + + mBannedFilesChanged = false ; + } +} +void p3FileDatabase::locked_sendBanInfo(const RsPeerId& peer) +{ +#warning TODO: add code to send ban info to friends +} + diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 40aac7d87..243c7ee78 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -65,6 +65,13 @@ class RsFileListsSyncResponseItem ; class HashStorage ; +struct PeerBannedFilesEntry +{ + std::set mBannedHashOfHash; + uint32_t mRecordNumber ; // used for when a friend sends multiple packets in separate items. + time_t mLastSent; +}; + class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, public RsSharedFileService { public: @@ -174,6 +181,8 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub void tickRecv(); void tickSend(); + void checkSendBannedFilesInfo(); + private: p3ServiceControl *mServCtrl ; RsPeerId mOwnId ; @@ -255,7 +264,11 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub // std::map mPrimaryBanList ; // primary list (user controlled) of files banned from FT search and forwarding. map + std::map mPeerBannedFiles ; // records of which files other peers ban, stored as H(H(f)) std::set mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends. bool mTrustFriendNodesForBannedFiles ; + bool mBannedFilesChanged; + + void locked_sendBanInfo(const RsPeerId& pid); }; diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui index 435168023..ff7deec7f 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui @@ -14,7 +14,7 @@ - <html><head/><body><p>The list below contains files you have chosen to ban from your local network. You will not forward search results for these files nor forward data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &quot;Trust my friends for banning unwanted content&quot;.</p></body></html> + <html><head/><body><p>The list below contains files you have chosen to ban from your local network. You will not forward search results and data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &quot;Trust my friends for banning unwanted content&quot;.</p></body></html> Qt::AlignJustify|Qt::AlignVCenter From 0b176a0fe59cd0a47416764175e4203588c98977 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 20 Aug 2018 23:30:05 +0200 Subject: [PATCH 178/213] added sending of banned file info --- libretroshare/src/file_sharing/p3filelists.cc | 52 ++++++++++++++++--- libretroshare/src/file_sharing/p3filelists.h | 6 ++- .../src/file_sharing/rsfilelistitems.cc | 1 + .../src/file_sharing/rsfilelistitems.h | 1 + 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 13a3dc370..5b3247f75 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1415,8 +1415,8 @@ void p3FileDatabase::tickRecv() { switch(item->PacketSubType()) { - case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: handleDirSyncRequest( dynamic_cast(item) ) ; - break ; + case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: handleDirSyncRequest( dynamic_cast(item) ) ; break ; + case RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM : handleBannedFilesInfo( dynamic_cast(item) ) ; break ; case RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM: { RsFileListsSyncResponseItem *sitem = dynamic_cast(item); @@ -1969,9 +1969,10 @@ void p3FileDatabase::checkSendBannedFilesInfo() // Add all H(H(f)) from friends - for(auto it(mPeerBannedFiles.begin());it!=mPeerBannedFiles.end();++it) - for(auto it2(it->second.mBannedHashOfHash.begin());it2!=it->second.mBannedHashOfHash.end();++it2) - mBannedFileList.insert(*it2); + if(mTrustFriendNodesForBannedFiles) + for(auto it(mPeerBannedFiles.begin());it!=mPeerBannedFiles.end();++it) + for(auto it2(it->second.mBannedHashOfHash.begin());it2!=it->second.mBannedHashOfHash.end();++it2) + mBannedFileList.insert(*it2); // Add H(f) and H(H(f)) from our primary list @@ -1989,10 +1990,47 @@ void p3FileDatabase::checkSendBannedFilesInfo() } } - void p3FileDatabase::locked_sendBanInfo(const RsPeerId& peer) { -#warning TODO: add code to send ban info to friends + RsFileListsBannedHashesItem *item = NULL; + uint32_t session_id = RSRandom::random_u32(); + + for(auto it(mPrimaryBanList.begin());it!=mPrimaryBanList.end();++it) + { + RsFileHash hash_of_hash ; + + ftServer::encryptHash(it->first,hash_of_hash) ; + + if(!item) + { + RsFileListsBannedHashesItem *item = new RsFileListsBannedHashesItem ; + + item->PeerId(peer); + item->session_id = session_id ; + } + + item->encrypted_hashes.insert(hash_of_hash) ; + + if(item->encrypted_hashes.size() >= 200) + { + sendItem(item); + item = NULL ; + } + } + + if(item) + sendItem(item); } +void p3FileDatabase::handleBannedFilesInfo(RsFileListsBannedHashesItem *item) +{ + RS_STACK_MUTEX(mFLSMtx) ; + + // 1 - localize the friend in the banned file map + + // 2 - replace/update the list, depending on the session_id + + // 3 - tell the updater that the banned file list has changed +#warning missing code here! +} diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 243c7ee78..336208910 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -62,13 +62,14 @@ class LocalDirectoryStorage ; class RsFileListsSyncRequestItem ; class RsFileListsSyncResponseItem ; +class RsFileListsBannedHashesItem ; class HashStorage ; struct PeerBannedFilesEntry { std::set mBannedHashOfHash; - uint32_t mRecordNumber ; // used for when a friend sends multiple packets in separate items. + uint32_t mSessionId ; // used for when a friend sends multiple packets in separate items. time_t mLastSent; }; @@ -260,7 +261,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub time_t mLastCleanupTime; time_t mLastDataRecvTS ; - // file filtering. Not explicitly related to shared files, but + // file filtering. Not explicitly related to shared files, but has its place here // std::map mPrimaryBanList ; // primary list (user controlled) of files banned from FT search and forwarding. map @@ -270,5 +271,6 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub bool mBannedFilesChanged; void locked_sendBanInfo(const RsPeerId& pid); + void handleBannedFilesInfo(RsFileListsBannedHashesItem *item); }; diff --git a/libretroshare/src/file_sharing/rsfilelistitems.cc b/libretroshare/src/file_sharing/rsfilelistitems.cc index a0e1eb695..e39ffc275 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.cc +++ b/libretroshare/src/file_sharing/rsfilelistitems.cc @@ -43,6 +43,7 @@ void RsFileListsSyncResponseItem::serial_process(RsGenericSerializer::SerializeJ } void RsFileListsBannedHashesItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { + RsTypeSerializer::serial_process(j,ctx,session_id ,"session_id") ; RsTypeSerializer::serial_process(j,ctx,encrypted_hashes,"encrypted_hashes") ; } diff --git a/libretroshare/src/file_sharing/rsfilelistitems.h b/libretroshare/src/file_sharing/rsfilelistitems.h index 20ea2f649..3b9074ca7 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.h +++ b/libretroshare/src/file_sharing/rsfilelistitems.h @@ -110,6 +110,7 @@ public: virtual void clear() { encrypted_hashes.clear(); } virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); + uint32_t session_id ; // used to allow to send in multiple parts. std::set encrypted_hashes ;// hash of hash for each banned file. }; From 365464623a6bea9ca7bc307af62625d415e35b3e Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 21 Aug 2018 11:20:02 +0200 Subject: [PATCH 179/213] added load/save of banned files and handling of banned files information from friends --- libretroshare/src/file_sharing/p3filelists.cc | 40 ++++++++++++++++--- libretroshare/src/file_sharing/p3filelists.h | 2 +- .../src/file_sharing/rsfilelistitems.cc | 18 +++++++-- .../src/file_sharing/rsfilelistitems.h | 21 ++++++++-- 4 files changed, 67 insertions(+), 14 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 5b3247f75..cc9f6cfc3 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -305,6 +305,15 @@ cleanup = true; } } + { + RS_STACK_MUTEX(mFLSMtx) ; + + RsFileListsBannedHashesConfigItem *item = new RsFileListsBannedHashesConfigItem ; + + item->primary_banned_files_list = mPrimaryBanList; + sList.push_back(item) ; + } + RsConfigKeyValueSet *rskv = new RsConfigKeyValueSet(); /* basic control parameters */ @@ -546,6 +555,14 @@ bool p3FileDatabase::loadList(std::list& load) dirList.push_back(info) ; } + RsFileListsBannedHashesConfigItem *fb = dynamic_cast(*it) ; + + if(fb) + { + mPrimaryBanList = fb->primary_banned_files_list ; + mBannedFilesChanged = true; + } + delete *it ; } @@ -1868,7 +1885,9 @@ bool p3FileDatabase::locked_generateAndSendSyncRequest(RemoteDirectoryStorage *r } -// Unwanted content filtering system +//=========================================================================================================================// +// Unwanted content filtering system // +//=========================================================================================================================// bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) { @@ -1943,13 +1962,13 @@ void p3FileDatabase::checkSendBannedFilesInfo() continue; } - if(it->second.mLastSent == 0) // has ban info already been sent? If not do it. + if(it->second.mLastSent == 0) // has ban info already been sent? If not do it. { locked_sendBanInfo(it->first); it->second.mLastSent = time(NULL); } - peers.erase(it->first); // friend has been handled -> remove from list + peers.erase(it->first); // friend has been handled -> remove from list ++it; } @@ -2022,15 +2041,26 @@ void p3FileDatabase::locked_sendBanInfo(const RsPeerId& peer) sendItem(item); } - void p3FileDatabase::handleBannedFilesInfo(RsFileListsBannedHashesItem *item) { RS_STACK_MUTEX(mFLSMtx) ; // 1 - localize the friend in the banned file map + PeerBannedFilesEntry& pbfe(mPeerBannedFiles[item->PeerId()]) ; + + if(pbfe.mSessionId != item->session_id) + pbfe.mBannedHashOfHash.clear(); + + pbfe.mSessionId = item->session_id ; + // 2 - replace/update the list, depending on the session_id + for(auto it(item->encrypted_hashes.begin());it!=item->encrypted_hashes.end();++it) + pbfe.mBannedHashOfHash.insert(*it); + // 3 - tell the updater that the banned file list has changed -#warning missing code here! + + mBannedFilesChanged = true ; } + diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 336208910..65ed7b6ef 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -261,7 +261,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub time_t mLastCleanupTime; time_t mLastDataRecvTS ; - // file filtering. Not explicitly related to shared files, but has its place here + // File filtering. Not explicitly related to shared files, but has its place here // std::map mPrimaryBanList ; // primary list (user controlled) of files banned from FT search and forwarding. map diff --git a/libretroshare/src/file_sharing/rsfilelistitems.cc b/libretroshare/src/file_sharing/rsfilelistitems.cc index e39ffc275..c443d1f3a 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.cc +++ b/libretroshare/src/file_sharing/rsfilelistitems.cc @@ -46,7 +46,16 @@ void RsFileListsBannedHashesItem::serial_process(RsGenericSerializer::SerializeJ RsTypeSerializer::serial_process(j,ctx,session_id ,"session_id") ; RsTypeSerializer::serial_process(j,ctx,encrypted_hashes,"encrypted_hashes") ; } - +void RsFileListsBannedHashesConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) +{ + RsTypeSerializer::serial_process(j,ctx,primary_banned_files_list,"primary_banned_files_list") ; +} +template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx,BannedFileEntry& entry,const std::string& /*name*/) +{ + RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,entry.filename ,"entry.file_name") ; + RsTypeSerializer::serial_process(j,ctx, entry.size ,"entry.size") ; + RsTypeSerializer::serial_process (j,ctx, entry.ban_time_stamp,"entry.ban_time_stamp") ; +} RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const { if(service != RS_SERVICE_TYPE_FILE_DATABASE) @@ -54,9 +63,10 @@ RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const switch(type) { - case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: return new RsFileListsSyncRequestItem(); - case RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM: return new RsFileListsSyncResponseItem(); - case RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM: return new RsFileListsBannedHashesItem(); + case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: return new RsFileListsSyncRequestItem(); + case RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM: return new RsFileListsSyncResponseItem(); + case RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM: return new RsFileListsBannedHashesItem(); + case RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_CONFIG_ITEM: return new RsFileListsBannedHashesConfigItem(); default: return NULL ; } diff --git a/libretroshare/src/file_sharing/rsfilelistitems.h b/libretroshare/src/file_sharing/rsfilelistitems.h index 3b9074ca7..a8c84e18b 100644 --- a/libretroshare/src/file_sharing/rsfilelistitems.h +++ b/libretroshare/src/file_sharing/rsfilelistitems.h @@ -33,11 +33,13 @@ #include "gxs/rsgxsdata.h" #include "serialiser/rsserializer.h" +#include "retroshare/rsfiles.h" -const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM = 0x01; -const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM = 0x02; -const uint8_t RS_PKT_SUBTYPE_FILELISTS_CONFIG_ITEM = 0x03; -const uint8_t RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM = 0x04; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM = 0x01; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM = 0x02; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_CONFIG_ITEM = 0x03; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_ITEM = 0x04; +const uint8_t RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_CONFIG_ITEM = 0x05; /*! * Base class for filelist sync items @@ -114,6 +116,17 @@ public: std::set encrypted_hashes ;// hash of hash for each banned file. }; +class RsFileListsBannedHashesConfigItem: public RsFileListsItem +{ +public: + RsFileListsBannedHashesConfigItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_BANNED_HASHES_CONFIG_ITEM){} + + virtual void clear() { primary_banned_files_list.clear(); } + virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx); + + std::map primary_banned_files_list ; +}; + class RsFileListsSerialiser : public RsServiceSerializer { public: From 8f7bacbb351cf2b39506533c512b211802503c87 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 22 Aug 2018 17:00:22 +0200 Subject: [PATCH 180/213] Remove #pragma once in .cc file It was probably introduced by copy paste error on license cleanup --- libretroshare/src/gxstunnel/rsgxstunnelitems.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/libretroshare/src/gxstunnel/rsgxstunnelitems.cc b/libretroshare/src/gxstunnel/rsgxstunnelitems.cc index a86625f0f..c43e4baae 100644 --- a/libretroshare/src/gxstunnel/rsgxstunnelitems.cc +++ b/libretroshare/src/gxstunnel/rsgxstunnelitems.cc @@ -19,7 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once #include #include From ab6a5c07cce1a01ca40614690d2e63c97e17c6ca Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 22 Aug 2018 17:22:27 +0200 Subject: [PATCH 181/213] RsLoginHelper::createLocation expose capability of creating hidden locations --- libretroshare/src/retroshare/rsinit.h | 7 +++++-- libretroshare/src/rsserver/rsaccounts.cc | 5 ++++- libretroshare/src/rsserver/rsinit.cc | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 2f2810e73..292ecab96 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -252,12 +252,15 @@ struct RsLoginHelper * @param[inout] location provide input information to generate the location * and storage to output the data of the generated location * @param[in] password to protect and unlock the associated PGP key + * @param[in] makeHidden pass true to create an hidden location + * @param[in] makeAutoTor pass true to create an automatically configured + * Tor hidden location * @param[out] errorMessage * @return true if success, false otherwise */ bool createLocation( RsLoginHelper::Location& location, - const std::string& password, - std::string& errorMessage ); + const std::string& password, bool makeHidden, + bool makeAutoTor, std::string& errorMessage ); /** * @brief Close RetroShare session diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index f6120e788..c989d0bca 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -1410,7 +1410,10 @@ bool RsAccounts::GetAccountDetails(const RsPeerId &id, return rsAccounts->getCurrentAccountDetails(id, pgpId, pgpName, pgpEmail, location); } -bool RsAccounts::createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc, bool isautotor, const std::string& passwd, RsPeerId &sslId, std::string &errString) +bool RsAccounts::createNewAccount( + const RsPgpId& pgp_id, const std::string& org, const std::string& loc, + const std::string& country, bool ishiddenloc, bool isautotor, + const std::string& passwd, RsPeerId &sslId, std::string &errString ) { return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, isautotor, passwd, sslId, errString); } diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index c2c23bd8b..c6b12d1b2 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1967,7 +1967,7 @@ void RsLoginHelper::getLocations(std::vector& store) bool RsLoginHelper::createLocation( RsLoginHelper::Location& l, const std::string& password, - std::string& errorMessage ) + bool makeHidden, bool makeAutoTor, std::string& errorMessage ) { if(l.mLocationName.empty()) { @@ -1992,7 +1992,7 @@ bool RsLoginHelper::createLocation( if(!rsNotify->setDisableAskPassword(true)) return false; bool ret = RsAccounts::createNewAccount( - l.mPgpId, "", l.mLocationName, "", false, false, + l.mPgpId, "", l.mLocationName, "", makeHidden, makeAutoTor, RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()), l.mLocationId, errorMessage ); From 3055897425839643990e7b05c2a087e005d5314d Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 22 Aug 2018 21:57:56 +0200 Subject: [PATCH 182/213] added filter in p3turtle against banned hashes in tunnel requests and search results --- libretroshare/src/file_sharing/p3filelists.cc | 11 +++++++ libretroshare/src/file_sharing/p3filelists.h | 1 + libretroshare/src/ft/ftserver.cc | 5 +++ libretroshare/src/ft/ftserver.h | 1 + libretroshare/src/retroshare/rsfiles.h | 1 + libretroshare/src/turtle/p3turtle.cc | 31 +++++++++++++++++++ 6 files changed, 50 insertions(+) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index cc9f6cfc3..e1ddd059c 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1919,6 +1919,17 @@ bool p3FileDatabase::unbanFile(const RsFileHash& real_file_hash) IndicateConfigChanged(); return true; } + +bool p3FileDatabase::isFileBanned(const RsFileHash& hash) +{ + RS_STACK_MUTEX(mFLSMtx) ; + + RsFileHash hash_of_hash ; + ftServer::encryptHash(hash,hash_of_hash) ; + + return mBannedFileList.find(hash) != mBannedFileList.end() || mBannedFileList.find(hash_of_hash) != mBannedFileList.end() ; +} + bool p3FileDatabase::getPrimaryBannedFilesList(std::map& banned_files) { RS_STACK_MUTEX(mFLSMtx) ; diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 65ed7b6ef..c58c9989a 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -142,6 +142,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub bool banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) ; bool unbanFile(const RsFileHash& real_file_hash); + bool isFileBanned(const RsFileHash& hash) ; bool getPrimaryBannedFilesList(std::map& banned_files) ; bool trustFriendNodesForBannedFiles() const ; void setTrustFriendNodesForBannedFiles(bool b) ; diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 90ba9beac..d517a0114 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1846,3 +1846,8 @@ bool ftServer::getPrimaryBannedFilesList(std::map& b { return mFileDatabase->getPrimaryBannedFilesList(banned_files) ; } + +bool ftServer::isHashBanned(const RsFileHash& hash) +{ + return mFileDatabase->isFileBanned(hash); +} diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 7e9ccde6a..8e420092f 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -195,6 +195,7 @@ public: virtual int banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) ; virtual int unbanFile(const RsFileHash& real_file_hash); virtual bool getPrimaryBannedFilesList(std::map& banned_files) ; + virtual bool isHashBanned(const RsFileHash& hash); /*** * Utility Functions diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 0af2708d6..918f1ab2f 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -271,6 +271,7 @@ public: virtual int banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) =0; virtual int unbanFile(const RsFileHash& real_file_hash)=0; virtual bool getPrimaryBannedFilesList(std::map& banned_files) =0; + virtual bool isHashBanned(const RsFileHash& hash) =0; /*** * Utility Functions. diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index fcb77b134..36b4383a9 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1109,6 +1109,27 @@ void p3turtle::performLocalSearch_files(RsTurtleFileSearchRequestItem *item,uint void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) { + // Filter out banned hashes from the result. + + RsTurtleFTSearchResultItem *ftsr_tmp = dynamic_cast(item) ; + + if(ftsr_tmp != NULL) + { + for(auto it(ftsr_tmp->result.begin());it!=ftsr_tmp->result.end();) + if( rsFiles->isHashBanned((*it).hash) ) + { + std::cerr << "(II) filtering out banned hash " << (*it).hash << " from turtle result " << std::hex << item->request_id << std::dec << std::endl; + it = ftsr_tmp->result.erase(it); + } + else + ++it; + + if(ftsr_tmp->result.empty()) + return ; + } + + // Then handle the result + std::list > results_to_notify_off_mutex ; { @@ -1525,6 +1546,16 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) item->print(std::cerr,0) ; #endif + // check first if the hash is in the ban list. If so, drop the request. + + if(rsFiles->isHashBanned(item->file_hash)) + { +#ifdef P3TURTLE_DEBUG + std::cerr << "(II) Rejecting tunnel request to ban hash " << item->file_hash << std::endl; +#endif + return ; + } + #ifdef TUNNEL_STATISTICS if(TS_request_bounces.find(item->request_id) != TS_request_bounces.end()) TS_request_bounces[item->request_id].push_back(time(NULL)) ; From 3b72f912e4e1a842dd738156afaf578dea44d60a Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 23 Aug 2018 01:39:26 +0200 Subject: [PATCH 183/213] Improve API Manually expose /rsFiles/getFileData to stream/preview files Automatically expose a bunch of methods via JSON API Implement serial_process for std::pair --- libretroshare/src/ft/ftserver.cc | 4 +- libretroshare/src/ft/ftserver.h | 4 +- libretroshare/src/jsonapi/jsonapi.cpp | 78 +++++++++++- libretroshare/src/retroshare/rsfiles.h | 114 +++++++++++++----- libretroshare/src/retroshare/rsgxschannels.h | 7 ++ .../src/serialiser/rstypeserializer.h | 80 ++++++++++++ libretroshare/src/turtle/p3turtle.cc | 4 +- 7 files changed, 252 insertions(+), 39 deletions(-) diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 276446d1f..28516cede 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -425,7 +425,7 @@ void ftServer::requestDirUpdate(void *ref) } /* Directory Handling */ -bool ftServer::setDownloadDirectory(std::string path) +bool ftServer::setDownloadDirectory(const std::string& path) { return mFtController->setDownloadDirectory(path); } @@ -435,7 +435,7 @@ std::string ftServer::getDownloadDirectory() return mFtController->getDownloadDirectory(); } -bool ftServer::setPartialsDirectory(std::string path) +bool ftServer::setPartialsDirectory(const std::string& path) { return mFtController->setPartialsDirectory(path); } diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 57920cc02..c952ea54a 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -205,8 +205,8 @@ public: * Directory Handling ***/ virtual void requestDirUpdate(void *ref) ; // triggers the update of the given reference. Used when browsing. - virtual bool setDownloadDirectory(std::string path); - virtual bool setPartialsDirectory(std::string path); + virtual bool setDownloadDirectory(const std::string& path); + virtual bool setPartialsDirectory(const std::string& path); virtual std::string getDownloadDirectory(); virtual std::string getPartialsDirectory(); diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index 3c2ee6cda..255fd0548 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -21,9 +21,11 @@ #include #include #include +#include #include "util/rsjson.h" -#include "retroshare/rsgxschannels.h" +#include "retroshare/rsfiles.h" +#include "util/radix64.h" // Generated at compile time #include "jsonapi-includes.inl" @@ -38,6 +40,80 @@ JsonApiServer::JsonApiServer( shutdown(); }); + registerHandler("/rsFiles/getFileData", + [](const std::shared_ptr session) + { + size_t reqSize = session->get_request()->get_header("Content-Length", 0); + session->fetch( reqSize, []( + const std::shared_ptr session, + const rb::Bytes& body ) + { + RsGenericSerializer::SerializeContext cReq( + nullptr, 0, + RsGenericSerializer::SERIALIZATION_FLAG_YIELDING ); + RsJson& jReq(cReq.mJson); + jReq.Parse(reinterpret_cast(body.data()), body.size()); + + RsGenericSerializer::SerializeContext cAns; + RsJson& jAns(cAns.mJson); + + // if caller specified caller_data put it back in the answhere + const char kcd[] = "caller_data"; + if(jReq.HasMember(kcd)) + jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator()); + + RsFileHash hash; + uint64_t offset; + uint32_t requested_size; + bool retval = false; + std::string errorMessage; + std::string base64data; + + // deserialize input parameters from JSON + { + RsGenericSerializer::SerializeContext& ctx(cReq); + RsGenericSerializer::SerializeJob j(RsGenericSerializer::FROM_JSON); + RS_SERIAL_PROCESS(hash); + RS_SERIAL_PROCESS(offset); + RS_SERIAL_PROCESS(requested_size); + } + + if(requested_size > 10485760) + errorMessage = "requested_size is too big! Better less then 1M"; + else + { + std::vector buffer(requested_size); + + // call retroshare C++ API + retval = rsFiles->getFileData( + hash, offset, requested_size, buffer.data()); + + Radix64::encode(buffer.data(), requested_size, base64data); + } + + // serialize out parameters and return value to JSON + { + RsGenericSerializer::SerializeContext& ctx(cAns); + RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON); + RS_SERIAL_PROCESS(retval); + RS_SERIAL_PROCESS(requested_size); + RS_SERIAL_PROCESS(base64data); + if(!errorMessage.empty()) RS_SERIAL_PROCESS(errorMessage); + } + + // return them to the API caller + std::stringstream ss; + ss << jAns; + std::string&& ans(ss.str()); + const std::multimap headers + { + { "Content-Type", "text/json" }, + { "Content-Length", std::to_string(ans.length()) } + }; + session->close(rb::OK, ans, headers); + } ); + }); + // Generated at compile time #include "jsonapi-wrappers.inl" } diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index c56574dc0..6cd835375 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -19,8 +19,7 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#ifndef RS_FILES_GUI_INTERFACE_H -#define RS_FILES_GUI_INTERFACE_H +#pragma once #include #include @@ -186,31 +185,61 @@ public: RsFiles() {} virtual ~RsFiles() {} - /** - * Provides file data for the gui: media streaming or rpc clients. - * It may return unverified chunks. This allows streaming without having to wait for hashes or completion of the file. - * This function returns an unspecified amount of bytes. Either as much data as available or a sensible maximum. Expect a block size of around 1MiB. - * To get more data, call this function repeatedly with different offsets. - * Returns false in case - * - the files is not available on the local node - * - not downloading - * - the requested data was not downloaded yet - * - end of file was reached - * @param hash hash of a file. The file has to be available on this node or it has to be in downloading state. - * @param offset where the desired block starts - * @param requested_size size of pre-allocated data. Will be updated by the function. - * @param data pre-allocated memory chunk of size 'requested_size' by the client - */ - virtual bool getFileData(const RsFileHash& hash, uint64_t offset, uint32_t& requested_size,uint8_t *data)=0; + /** + * Provides file data for the gui, media streaming or rpc clients. + * It may return unverified chunks. This allows streaming without having to + * wait for hashes or completion of the file. + * This function returns an unspecified amount of bytes. Either as much data + * as available or a sensible maximum. Expect a block size of around 1MiB. + * To get more data, call this function repeatedly with different offsets. + * jsonapi{development} note the missing @ the wrapper for this is written + * manually not autogenerated @see JsonApiServer. + * @param[in] hash hash of the file. The file has to be available on this node + * or it has to be in downloading state. + * @param[in] offset where the desired block starts + * @param[inout] requested_size size of pre-allocated data. Will be updated + * by the function. + * @param data pre-allocated memory chunk of size 'requested_size' by the + * client + * @return Returns false in case + * - the files is not available on the local node + * - not downloading + * - the requested data was not downloaded yet + * - end of file was reached + */ + virtual bool getFileData( const RsFileHash& hash, uint64_t offset, + uint32_t& requested_size, uint8_t* data ) = 0; /*** * Control of Downloads. ***/ virtual bool alreadyHaveFile(const RsFileHash& hash, FileInfo &info) = 0; - /// Returns false is we already have the file. Otherwise, initiates the dl and returns true. - virtual bool FileRequest(const std::string& fname, const RsFileHash& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list& srcIds) = 0; - virtual bool FileCancel(const RsFileHash& hash) = 0; + + /** + * @brief Initiate downloading of a file + * @jsonapi{development} + * @param[in] fileName + * @param[in] hash + * @param[in] size + * @param[in] destPath in not empty specify a destination path + * @param[in] flags you usually want RS_FILE_REQ_ANONYMOUS_ROUTING + * @param[in] srcIds eventually specify known sources + * @return false if we already have the file, true otherwhise + */ + virtual bool FileRequest( + const std::string& fileName, const RsFileHash& hash, uint64_t size, + const std::string& destPath, TransferRequestFlags flags, + const std::list& srcIds ) = 0; + + /** + * @brief Cancel file downloading + * @jsonapi{development} + * @param[in] hash + * @return false if the file is not in the download queue, true otherwhise + */ + virtual bool FileCancel(const RsFileHash& hash) = 0; + virtual bool setDestinationDirectory(const RsFileHash& hash,const std::string& new_path) = 0; virtual bool setDestinationName(const RsFileHash& hash,const std::string& new_name) = 0; virtual bool setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy) = 0; @@ -293,10 +322,35 @@ public: ***/ virtual void requestDirUpdate(void *ref) =0 ; // triggers the update of the given reference. Used when browsing. - virtual bool setDownloadDirectory(std::string path) = 0; - virtual bool setPartialsDirectory(std::string path) = 0; - virtual std::string getDownloadDirectory() = 0; - virtual std::string getPartialsDirectory() = 0; + /** + * @brief Set default complete downloads directory + * @jsonapi{development} + * @param[in] path directory path + * @return false if something failed, true otherwhise + */ + virtual bool setDownloadDirectory(const std::string& path) = 0; + + /** + * @brief Set partial downloads directory + * @jsonapi{development} + * @param[in] path directory path + * @return false if something failed, true otherwhise + */ + virtual bool setPartialsDirectory(const std::string& path) = 0; + + /** + * @brief Get default complete downloads directory + * @jsonapi{development} + * @return default completed downloads directory path + */ + virtual std::string getDownloadDirectory() = 0; + + /** + * @brief Get partial downloads directory + * @jsonapi{development} + * @return partials downloads directory path + */ + virtual std::string getPartialsDirectory() = 0; /** * @brief Get list of current shared directories @@ -315,7 +369,7 @@ public: virtual bool setSharedDirectories(const std::list& dirs) = 0; /** - * @brief Add shared directoryaddSharedDirectory + * @brief Add shared directory * @jsonapi{development} * @param[in] dir directory to share with sharing options * @return false if something failed, true otherwhise @@ -326,7 +380,7 @@ public: * @brief Updates shared directory sharing flags. * The directory should be already shared! * @jsonapi{development} - * @param dir[in] Shared directory with updated sharing options + * @param[in] dir Shared directory with updated sharing options * @return false if something failed, true otherwhise */ virtual bool updateShareFlags(const SharedDirInfo& dir) = 0; @@ -334,7 +388,7 @@ public: /** * @brief Remove directory from shared list * @jsonapi{development} - * @param dir[in] Path of the directory to remove from shared list + * @param[in] dir Path of the directory to remove from shared list * @return false if something failed, true otherwhise */ virtual bool removeSharedDirectory(std::string dir) = 0; @@ -359,8 +413,4 @@ public: virtual bool ignoreDuplicates() = 0; virtual void setIgnoreDuplicates(bool ignore) = 0; - }; - - -#endif diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index 754ea7a28..75a5edab4 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -146,6 +146,13 @@ public: virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; virtual bool getPostData(const uint32_t &token, std::vector &posts) = 0; + /** + * @brief toggle message read status + * @jsonapi{development} + * @param[out] token GXS token queue token + * @param[in] msgId + * @param[in] read + */ virtual void setMessageReadStatus( uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index d1ccd8520..fd4984ef6 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -363,6 +363,86 @@ struct RsTypeSerializer } } + /// std::pair + template + static void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx, + std::pair& p, + const std::string& memberName ) + { + switch(j) + { + case RsGenericSerializer::SIZE_ESTIMATE: // fallthrough + case RsGenericSerializer::DESERIALIZE: // fallthrough + case RsGenericSerializer::SERIALIZE: // fallthrough + case RsGenericSerializer::PRINT: + serial_process(j, ctx, p.first, "pair::first"); + serial_process(j, ctx, p.second, "pair::second"); + break; + case RsGenericSerializer::TO_JSON: + { + RsJson& jDoc(ctx.mJson); + RsJson::AllocatorType& allocator = jDoc.GetAllocator(); + + // Reuse allocator to avoid deep copy later + RsGenericSerializer::SerializeContext lCtx( + nullptr, 0, ctx.mFlags, &allocator ); + + serial_process(j, ctx, p.first, "first"); + serial_process(j, ctx, p.second, "second"); + + rapidjson::Value key; + key.SetString(memberName.c_str(), memberName.length(), allocator); + + /* Because the passed allocator is reused it doesn't go out of scope + * and there is no need of deep copy and we can take advantage of + * the much faster rapidjson move semantic */ + jDoc.AddMember(key, lCtx.mJson, allocator); + + ctx.mOk = ctx.mOk && lCtx.mOk; + break; + } + case RsGenericSerializer::FROM_JSON: + { + RsJson& jDoc(ctx.mJson); + const char* mName = memberName.c_str(); + bool hasMember = jDoc.HasMember(mName); + bool yielding = ctx.mFlags & + RsGenericSerializer::SERIALIZATION_FLAG_YIELDING; + + if(!hasMember) + { + if(!yielding) + { + std::cerr << __PRETTY_FUNCTION__ << " \"" << memberName + << "\" not found in JSON:" << std::endl + << jDoc << std::endl << std::endl; + print_stacktrace(); + } + ctx.mOk = false; + break; + } + + rapidjson::Value& v = jDoc[mName]; + + RsGenericSerializer::SerializeContext lCtx(nullptr, 0, ctx.mFlags); + lCtx.mJson.SetObject() = v; // Beware of move semantic!! + + serial_process(j, ctx, p.first, "first"); + serial_process(j, ctx, p.second, "second"); + ctx.mOk &= lCtx.mOk; + + break; + } + default: + std::cerr << __PRETTY_FUNCTION__ << " Unknown serial job: " + << static_cast::type>(j) + << std::endl; + exit(EINVAL); + break; + } + } + /// std::vector template static void serial_process( RsGenericSerializer::SerializeJob j, diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index fcb77b134..f5ff375ce 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1112,7 +1112,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) std::list > results_to_notify_off_mutex ; { - RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ + RS_STACK_MUTEX(mTurtleMtx); // Find who actually sent the corresponding request. // std::map::iterator it = _search_requests_origins.find(item->request_id) ; @@ -1178,7 +1178,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) sendItem(fwd_item) ; } - } + } // mTurtleMtx end // now we notify clients off-mutex. From 18feb23c77b8b5005ea18365ecdaa0ac8da56319 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 23 Aug 2018 14:20:24 +0200 Subject: [PATCH 184/213] Suggest shallow submodules for jsonapi dependencies --- libretroshare/src/libretroshare.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 8b5c879db..7008803c2 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -881,7 +881,7 @@ rs_jsonapi { restbed.target = $$system_path($$clean_path($${RESTBED_BUILD_PATH}/library/librestbed.a)) restbed.commands = \ - cd $${RS_SRC_PATH}; git submodule update --init --recursive;\ + cd $${RS_SRC_PATH}; git submodule update --init --recursive --recommend-shallow;\ mkdir -p $${RESTBED_BUILD_PATH}; cd $${RESTBED_BUILD_PATH};\ cmake -DBUILD_SSL=OFF -DCMAKE_INSTALL_PREFIX=. -B. -H$${RESTBED_SRC_PATH};\ make; make install From 4d30d4f32b24f40380c4a5df8685735af235ae15 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 23 Aug 2018 15:47:01 +0200 Subject: [PATCH 185/213] Avoid cloning huge unused restbed openssl dependency --- libretroshare/src/libretroshare.pro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 7008803c2..68bf97161 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -881,7 +881,12 @@ rs_jsonapi { restbed.target = $$system_path($$clean_path($${RESTBED_BUILD_PATH}/library/librestbed.a)) restbed.commands = \ - cd $${RS_SRC_PATH}; git submodule update --init --recursive --recommend-shallow;\ + cd $${RS_SRC_PATH};\ + git submodule update --init --recommend-shallow supportlibs/restbed;\ + cd $${RESTBED_SRC_PATH};\ + git submodule update --init --recommend-shallow dependency/asio;\ + git submodule update --init --recommend-shallow dependency/catch;\ + git submodule update --init --recommend-shallow dependency/kashmir;\ mkdir -p $${RESTBED_BUILD_PATH}; cd $${RESTBED_BUILD_PATH};\ cmake -DBUILD_SSL=OFF -DCMAKE_INSTALL_PREFIX=. -B. -H$${RESTBED_SRC_PATH};\ make; make install From afeb408f7a5cee73d3c37daaf8986687c5f1e8d6 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 23 Aug 2018 22:38:21 +0200 Subject: [PATCH 186/213] Expose more RsFiles via JSON API FileInfo remove dead static members --- libretroshare/src/retroshare/rsfiles.h | 132 ++++++++++++++--- libretroshare/src/retroshare/rstypes.h | 196 ++++++++++++++++--------- 2 files changed, 238 insertions(+), 90 deletions(-) diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 6cd835375..a4a8bfea2 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -192,8 +192,11 @@ public: * This function returns an unspecified amount of bytes. Either as much data * as available or a sensible maximum. Expect a block size of around 1MiB. * To get more data, call this function repeatedly with different offsets. - * jsonapi{development} note the missing @ the wrapper for this is written - * manually not autogenerated @see JsonApiServer. + * + * jsonapi{development} + * note the missing @ the wrapper for this is written manually not + * autogenerated @see JsonApiServer. + * * @param[in] hash hash of the file. The file has to be available on this node * or it has to be in downloading state. * @param[in] offset where the desired block starts @@ -240,13 +243,67 @@ public: */ virtual bool FileCancel(const RsFileHash& hash) = 0; - virtual bool setDestinationDirectory(const RsFileHash& hash,const std::string& new_path) = 0; - virtual bool setDestinationName(const RsFileHash& hash,const std::string& new_name) = 0; - virtual bool setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy) = 0; - virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) = 0; - virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() = 0; - virtual uint32_t freeDiskSpaceLimit() const =0; - virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) =0; + /** + * @brief Set destination directory for given file + * @jsonapi{development} + * @param[in] hash file identifier + * @param[in] newPath + * @return false if some error occurred, true otherwise + */ + virtual bool setDestinationDirectory( + const RsFileHash& hash, const std::string& newPath ) = 0; + + /** + * @brief Set name for dowloaded file + * @jsonapi{development} + * @param[in] hash file identifier + * @param[in] newName + * @return false if some error occurred, true otherwise + */ + virtual bool setDestinationName( + const RsFileHash& hash, const std::string& newName ) = 0; + + /** + * @brief Set chunk strategy for file, useful to set streaming mode to be + * able of see video or other media preview while it is still downloading + * @jsonapi{development} + * @param[in] hash file identifier + * @param[in] newStrategy + * @return false if some error occurred, true otherwise + */ + virtual bool setChunkStrategy( + const RsFileHash& hash, + FileChunksInfo::ChunkStrategy newStrategy ) = 0; + + /** + * @brief Set default chunk strategy + * @jsonapi{development} + * @param[in] strategy + */ + virtual void setDefaultChunkStrategy( + FileChunksInfo::ChunkStrategy strategy ) = 0; + + /** + * @brief Get default chunk strategy + * @jsonapi{development} + * @return current default chunck strategy + */ + virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() = 0; + + /** + * @brief Get free disk space limit + * @jsonapi{development} + * @return current current minimum free space on disk in MB + */ + virtual uint32_t freeDiskSpaceLimit() const = 0; + + /** + * @brief Set minimum free disk space limit + * @jsonapi{development} + * @param[in] minimumFreeMB minimum free space in MB + */ + virtual void setFreeDiskSpaceLimit(uint32_t minimumFreeMB) = 0; + virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0; virtual bool FileClearCompleted() = 0; virtual void setDefaultEncryptionPolicy(uint32_t policy)=0; // RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT/PERMISSIVE @@ -267,21 +324,56 @@ public: virtual bool changeDownloadSpeed(const RsFileHash& hash, int speed) = 0; virtual bool getDownloadSpeed(const RsFileHash& hash, int & speed) = 0; virtual bool clearDownload(const RsFileHash& hash) = 0; -// virtual void getDwlDetails(std::list & details) = 0; - /*** - * Download / Upload Details. - ***/ - virtual void FileDownloads(std::list &hashs) = 0; - virtual bool FileUploads(std::list &hashs) = 0; - virtual bool FileDetails(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) = 0; + /** + * @brief Get incoming files list + * @jsonapi{development} + * @param[out] hashs storage for files identifiers list + */ + virtual void FileDownloads(std::list& hashs) = 0; + + /** + * @brief Get outgoing files list + * @jsonapi{development} + * @param[out] hashs storage for files identifiers list + * @return false if some error occurred, true otherwise + */ + virtual bool FileUploads(std::list& hashs) = 0; + + /** + * @brief Get file details + * @jsonapi{development} + * @param[in] hash file identifier + * @param[in] hintflags filtering hint (RS_FILE_HINTS_EXTRA|...|RS_FILE_HINTS_LOCAL) + * @param[out] info storage for file information + * @return true if file found, false otherwise + */ + virtual bool FileDetails( + const RsFileHash &hash, FileSearchFlags hintflags, FileInfo& info ) = 0; + virtual bool isEncryptedSource(const RsPeerId& virtual_peer_id) =0; - /// Gives chunk details about the downloaded file with given hash. - virtual bool FileDownloadChunksDetails(const RsFileHash& hash,FileChunksInfo& info) = 0 ; + /** + * @brief Get chunk details about the downloaded file with given hash. + * @jsonapi{development} + * @param[in] hash file identifier + * @param[out] info storage for file information + * @return true if file found, false otherwise + */ + virtual bool FileDownloadChunksDetails( + const RsFileHash& hash, FileChunksInfo& info) = 0; - /// details about the upload with given hash - virtual bool FileUploadChunksDetails(const RsFileHash& hash,const RsPeerId& peer_id,CompressedChunkMap& map) = 0 ; + /** + * @brief Get details about the upload with given hash + * @jsonapi{development} + * @param[in] hash file identifier + * @param[in] peer_id peer identifier + * @param[out] map storage for chunk info + * @return true if file found, false otherwise + */ + virtual bool FileUploadChunksDetails( + const RsFileHash& hash, const RsPeerId& peer_id, + CompressedChunkMap& map ) = 0; /*** * Extra List Access diff --git a/libretroshare/src/retroshare/rstypes.h b/libretroshare/src/retroshare/rstypes.h index 443f2e2b3..b1b35748c 100644 --- a/libretroshare/src/retroshare/rstypes.h +++ b/libretroshare/src/retroshare/rstypes.h @@ -65,15 +65,25 @@ const uint32_t RS_CONFIG_DIRECTORY = 0x0002 ; const uint32_t RS_PGP_DIRECTORY = 0x0003 ; const uint32_t RS_DIRECTORY_COUNT = 0x0004 ; -class TransferInfo +struct TransferInfo : RsSerializable { - public: - /**** Need Some of these Fields ****/ - RsPeerId peerId; - std::string name; /* if has alternative name? */ - double tfRate; /* kbytes */ - int status; /* FT_STATE_... */ - uint64_t transfered ; // used when no chunkmap data is available + /**** Need Some of these Fields ****/ + RsPeerId peerId; + std::string name; /* if has alternative name? */ + double tfRate; /* kbytes */ + int status; /* FT_STATE_... */ + uint64_t transfered ; // used when no chunkmap data is available + + /// @see RsSerializable + void serial_process(RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx) + { + RS_SERIAL_PROCESS(peerId); + RS_SERIAL_PROCESS(name); + RS_SERIAL_PROCESS(tfRate); + RS_SERIAL_PROCESS(status); + RS_SERIAL_PROCESS(transfered); + } }; enum QueueMove { QUEUE_TOP = 0x00, @@ -82,9 +92,11 @@ enum QueueMove { QUEUE_TOP = 0x00, QUEUE_BOTTOM = 0x03 }; -enum DwlSpeed { SPEED_LOW = 0x00, - SPEED_NORMAL = 0x01, - SPEED_HIGH = 0x02 +enum DwlSpeed : uint8_t +{ + SPEED_LOW = 0x00, + SPEED_NORMAL = 0x01, + SPEED_HIGH = 0x02 }; @@ -171,54 +183,76 @@ const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK ( DIR_FLAGS_ANONYMOUS_DOW const FileStorageFlags DIR_FLAGS_LOCAL ( 0x1000 ); const FileStorageFlags DIR_FLAGS_REMOTE ( 0x2000 ); -class FileInfo +struct FileInfo : RsSerializable { - /* old BaseInfo Entries */ - public: + FileInfo(): + mId(0), searchId(0), size(0), avail(0), rank(0), age(0), + queue_position(0), transfered(0), tfRate(0), downloadStatus(0), + priority(SPEED_NORMAL), lastTS(0) {} - FileInfo() : mId(0), searchId(0), size(0), avail(0), rank(0), age(0), queue_position(0), - transfered(0), tfRate(0), downloadStatus(0), priority(SPEED_NORMAL), lastTS(0){} -// RsCertId id; /* key for matching everything */ + /// Combination of the four RS_DIR_FLAGS_*. Updated when the file is a local stored file. + FileStorageFlags storage_permission_flags; - FileStorageFlags storage_permission_flags; // Combination of the four RS_DIR_FLAGS_*. Updated when the file is a local stored file. - TransferRequestFlags transfer_info_flags ; // various flags from RS_FILE_HINTS_* + /// various flags from RS_FILE_HINTS_* + TransferRequestFlags transfer_info_flags; - /* allow this to be tweaked by the GUI Model */ - mutable unsigned int mId; /* (GUI) Model Id -> unique number */ + /** allow this to be tweaked by the GUI Model + * (GUI) Model Id -> unique number + */ + mutable unsigned int mId; - /* Old FileInfo Entries */ - public: - static const int kRsFiStatusNone = 0; - static const int kRsFiStatusStall = 1; - static const int kRsFiStatusProgress = 2; - static const int kRsFiStatusDone = 2; + /// 0 if none + int searchId; - /* FileInfo(); */ + std::string path; + std::string fname; + RsFileHash hash; + std::string ext; - int searchId; /* 0 if none */ - std::string path; - std::string fname; - RsFileHash hash; - std::string ext; + uint64_t size; + uint64_t avail; /// how much we have - uint64_t size; - uint64_t avail; /* how much we have */ + double rank; + int age; + uint32_t queue_position; - double rank; - int age; - uint32_t queue_position ; + /* Transfer Stuff */ + uint64_t transfered; + double tfRate; /// in kbytes + uint32_t downloadStatus; /// FT_STATE_DOWNLOADING & co. See rstypes.h + std::vector peers; - /* Transfer Stuff */ - uint64_t transfered; - double tfRate; /* in kbytes */ - uint32_t downloadStatus; // FT_STATE_DOWNLOADING & co. See rstypes.h - std::vector peers; + DwlSpeed priority; + time_t lastTS; - DwlSpeed priority ; - time_t lastTS; - - std::list parent_groups ; + std::list parent_groups; + + /// @see RsSerializable + void serial_process(RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx) + { + RS_SERIAL_PROCESS(storage_permission_flags); + RS_SERIAL_PROCESS(transfer_info_flags); + RS_SERIAL_PROCESS(mId); + RS_SERIAL_PROCESS(searchId); + RS_SERIAL_PROCESS(path); + RS_SERIAL_PROCESS(fname); + RS_SERIAL_PROCESS(hash); + RS_SERIAL_PROCESS(ext); + RS_SERIAL_PROCESS(size); + RS_SERIAL_PROCESS(avail); + RS_SERIAL_PROCESS(rank); + RS_SERIAL_PROCESS(age); + RS_SERIAL_PROCESS(queue_position); + RS_SERIAL_PROCESS(transfered); + RS_SERIAL_PROCESS(tfRate); + RS_SERIAL_PROCESS(downloadStatus); + RS_SERIAL_PROCESS(peers); + RS_SERIAL_PROCESS(priority); + RS_SERIAL_PROCESS(lastTS); + RS_SERIAL_PROCESS(parent_groups); + } }; std::ostream &operator<<(std::ostream &out, const FileInfo& info); @@ -268,36 +302,58 @@ class FileDetail class CompressedChunkMap ; -class FileChunksInfo +struct FileChunksInfo : RsSerializable { - public: - enum ChunkState { CHUNK_CHECKING=3, CHUNK_DONE=2, CHUNK_ACTIVE=1, CHUNK_OUTSTANDING=0 } ; - enum ChunkStrategy { CHUNK_STRATEGY_STREAMING, CHUNK_STRATEGY_RANDOM, CHUNK_STRATEGY_PROGRESSIVE } ; + enum ChunkState : uint8_t + { + CHUNK_OUTSTANDING = 0, + CHUNK_ACTIVE = 1, + CHUNK_DONE = 2, + CHUNK_CHECKING = 3 + }; - struct SliceInfo - { - uint32_t start ; - uint32_t size ; - RsPeerId peer_id ; - }; + enum ChunkStrategy : uint8_t + { + CHUNK_STRATEGY_STREAMING, + CHUNK_STRATEGY_RANDOM, + CHUNK_STRATEGY_PROGRESSIVE + }; - uint64_t file_size ; // real size of the file - uint32_t chunk_size ; // size of chunks - uint32_t strategy ; + struct SliceInfo + { + uint32_t start; + uint32_t size; + RsPeerId peer_id; + }; - // dl state of chunks. Only the last chunk may have size < chunk_size - std::vector chunks ; + uint64_t file_size; /// real size of the file + uint32_t chunk_size; /// size of chunks + ChunkStrategy strategy; - // For each source peer, gives the compressed bit map of have/don't have sate - std::map compressed_peer_availability_maps ; + /// dl state of chunks. Only the last chunk may have size < chunk_size + std::vector chunks; - // For each chunk (by chunk number), gives the completion of the chunk. - // - std::vector > active_chunks ; + /// For each source peer, gives the compressed bit map of have/don't have sate + std::map compressed_peer_availability_maps; - // The list of pending requests, chunk per chunk (by chunk id) - // - std::map > pending_slices ; + /// For each chunk (by chunk number), gives the completion of the chunk. + std::vector > active_chunks; + + /// The list of pending requests, chunk per chunk (by chunk id) + std::map > pending_slices; + + /// @see RsSerializable + void serial_process(RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx) + { + RS_SERIAL_PROCESS(file_size); + RS_SERIAL_PROCESS(chunk_size); + RS_SERIAL_PROCESS(strategy); + RS_SERIAL_PROCESS(chunks); + RS_SERIAL_PROCESS(compressed_peer_availability_maps); + RS_SERIAL_PROCESS(active_chunks); + //RS_SERIAL_PROCESS(pending_slices); + } }; class CompressedChunkMap : public RsSerializable From afb92999d8da08fcac8651a9ebaed71f732f1f8c Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 24 Aug 2018 00:31:25 +0200 Subject: [PATCH 187/213] Enable JSON conversion for RsGxsImage via MemBlockProxy --- libretroshare/src/retroshare/rsfiles.h | 13 ++++--- libretroshare/src/retroshare/rsgxschannels.h | 4 +- libretroshare/src/retroshare/rsgxscommon.h | 12 +++++- .../src/serialiser/rstypeserializer.cc | 37 +++++++++++++++---- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index a4a8bfea2..4fca503a7 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -213,11 +213,14 @@ public: virtual bool getFileData( const RsFileHash& hash, uint64_t offset, uint32_t& requested_size, uint8_t* data ) = 0; - /*** - * Control of Downloads. - ***/ - - virtual bool alreadyHaveFile(const RsFileHash& hash, FileInfo &info) = 0; + /** + * @brief Check if we already have a file + * @jsonapi{development} + * @param[in] hash file identifier + * @param[out] info storage for the possibly found file information + * @return true if the file is already present, false otherwise + */ + virtual bool alreadyHaveFile(const RsFileHash& hash, FileInfo &info) = 0; /** * @brief Initiate downloading of a file diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index 75a5edab4..383ebc7df 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -56,7 +56,7 @@ struct RsGxsChannelGroup : RsSerializable { RS_SERIAL_PROCESS(mMeta); RS_SERIAL_PROCESS(mDescription); - //RS_SERIAL_PROCESS(mImage); + RS_SERIAL_PROCESS(mImage); RS_SERIAL_PROCESS(mAutoDownload); } }; @@ -90,7 +90,7 @@ struct RsGxsChannelPost : RsSerializable RS_SERIAL_PROCESS(mFiles); RS_SERIAL_PROCESS(mCount); RS_SERIAL_PROCESS(mSize); - //RS_SERIAL_PROCESS(mThumbnail); + RS_SERIAL_PROCESS(mThumbnail); } }; diff --git a/libretroshare/src/retroshare/rsgxscommon.h b/libretroshare/src/retroshare/rsgxscommon.h index 0ecd933f0..57b17ed35 100644 --- a/libretroshare/src/retroshare/rsgxscommon.h +++ b/libretroshare/src/retroshare/rsgxscommon.h @@ -50,7 +50,7 @@ struct RsGxsFile : RsSerializable } }; -struct RsGxsImage +struct RsGxsImage : RsSerializable { RsGxsImage(); ~RsGxsImage(); @@ -70,8 +70,16 @@ struct RsGxsImage void clear(); // Frees. void shallowClear(); // Clears Pointer. - uint8_t *mData; uint32_t mSize; + uint8_t* mData; + + /// @see RsSerializable + virtual void serial_process( RsGenericSerializer::SerializeJob j, + RsGenericSerializer::SerializeContext& ctx ) + { + RsTypeSerializer::TlvMemBlock_proxy b(mData, mSize); + RsTypeSerializer::serial_process(j, ctx, b, "mData"); + } }; diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index 9c2ebc37b..9a21eef0f 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -25,7 +25,7 @@ #include "serialiser/rsbaseserial.h" #include "serialiser/rstlvkeys.h" #include "serialiser/rsserializable.h" - +#include "util/radix64.h" #include "util/rsprint.h" #include @@ -646,9 +646,12 @@ bool RsTypeSerializer::to_JSON( rapidjson::Value key; key.SetString(memberName.c_str(), memberName.length(), allocator); + std::string encodedValue; + Radix64::encode( reinterpret_cast(member.first), + member.second, encodedValue ); + rapidjson::Value value; - const char* tName = typeid(member).name(); - value.SetString(tName, allocator); + value.SetString(encodedValue.data(), allocator); jDoc.AddMember(key, value, allocator); @@ -656,7 +659,27 @@ bool RsTypeSerializer::to_JSON( } template<> /*static*/ -bool RsTypeSerializer::from_JSON( const std::string& /*memberName*/, - RsTypeSerializer::TlvMemBlock_proxy&, - RsJson& /*jDoc*/) -{ return true; } +bool RsTypeSerializer::from_JSON( const std::string& memberName, + RsTypeSerializer::TlvMemBlock_proxy& member, + RsJson& jDoc) +{ + SAFE_GET_JSON_V(); + ret = ret && v.IsString(); + if(ret) + { + std::string encodedValue = v.GetString(); + std::vector decodedValue = Radix64::decode(encodedValue); + member.second = decodedValue.size(); + + if(member.second == 0) + { + member.first = nullptr; + return ret; + } + + member.first = rs_malloc(member.second); + ret = ret && member.first && + memcpy(member.first, decodedValue.data(), member.second); + } + return ret; +} From 8eebe53d75cb9df2e5a7a67b5d8f62082e88b5d8 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 24 Aug 2018 16:12:05 +0200 Subject: [PATCH 188/213] moved UI notification for turtle FT search results into ftServer, in order to allow easier libresAPI calls --- libretroshare/src/ft/ftserver.cc | 7 +++++++ libretroshare/src/ft/ftserver.h | 2 +- libretroshare/src/turtle/p3turtle.cc | 11 ++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 276446d1f..bb3a2dca3 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1820,6 +1820,13 @@ int ftServer::handleIncoming() ********************************** *********************************/ +void ftServer::receiveSearchResult(RsTurtleFTSearchResultItem *item) +{ + // @Gio: add your thing here + + RsServer::notify()->notifyTurtleSearchResult(item->request_id,item->result) ; +} + /***************************** CONFIG ****************************/ bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr) diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 57920cc02..d20a29171 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -96,7 +96,7 @@ public: uint16_t serviceId() const { return RS_SERVICE_TYPE_FILE_TRANSFER ; } virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ; virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; - //virtual void receiveSearchResult(RsTurtleSearchResultItem *item);// TODO + virtual void receiveSearchResult(RsTurtleFTSearchResultItem *item); virtual RsItem *create_item(uint16_t service,uint8_t item_type) const ; virtual RsServiceSerializer *serializer() { return this ; } diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index fcb77b134..c14b46e6c 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1191,7 +1191,16 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) if(ftsr!=NULL) { - RsServer::notify()->notifyTurtleSearchResult(ftsr->request_id,ftsr->result) ; + ftServer *client = dynamic_cast((*it).second) ; + + if(!client) + { + std::cerr << "(EE) received turtle FT search result but the service is not a ftServer!!" << std::endl; + continue; + } + //RsServer::notify()->notifyTurtleSearchResult(ftsr->request_id,ftsr->result) ; + + client->receiveSearchResult(ftsr); continue ; } From b98246ee2184c0bdecc261a0da3c1a259d20eccd Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 00:19:26 +0200 Subject: [PATCH 189/213] Fix location creation via JSON API To complete location creation login is needed --- libretroshare/src/rsserver/rsinit.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index c6b12d1b2..bad35c91a 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1988,13 +1988,18 @@ bool RsLoginHelper::createLocation( return false; } + std::string sslPassword = + RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()); + if(!rsNotify->cachePgpPassphrase(password)) return false; if(!rsNotify->setDisableAskPassword(true)) return false; bool ret = RsAccounts::createNewAccount( l.mPgpId, "", l.mLocationName, "", makeHidden, makeAutoTor, - RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()), - l.mLocationId, errorMessage ); + sslPassword, l.mLocationId, errorMessage ); + + ret = ret && RsInit::LoadPassword(sslPassword); + ret = ret && RsInit::OK == attemptLogin(l.mLocationId, password); rsNotify->setDisableAskPassword(false); return ret; From 4d03b906b88ea63770561568c4da2f6298110bfb Mon Sep 17 00:00:00 2001 From: sehraf Date: Sat, 25 Aug 2018 16:51:49 +0200 Subject: [PATCH 190/213] convert values properly to string --- libretroshare/src/serialiser/rstypeserializer.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index 9a21eef0f..f620f7af0 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -169,23 +169,23 @@ template<> void RsTypeSerializer::print_data(const std::string& n, const bool & } template<> void RsTypeSerializer::print_data(const std::string& n, const int32_t& V) { - std::cerr << " [int32_t ] " << n << ": " << V << std::endl; + std::cerr << " [int32_t ] " << n << ": " << std::to_string(V) << std::endl; } template<> void RsTypeSerializer::print_data(const std::string& n, const uint8_t & V) { - std::cerr << " [uint8_t ] " << n << ": " << V << std::endl; + std::cerr << " [uint8_t ] " << n << ": " << std::to_string(V) << std::endl; } template<> void RsTypeSerializer::print_data(const std::string& n, const uint16_t& V) { - std::cerr << " [uint16_t ] " << n << ": " << V << std::endl; + std::cerr << " [uint16_t ] " << n << ": " << std::to_string(V) << std::endl; } template<> void RsTypeSerializer::print_data(const std::string& n, const uint32_t& V) { - std::cerr << " [uint32_t ] " << n << ": " << V << std::endl; + std::cerr << " [uint32_t ] " << n << ": " << std::to_string(V) << std::endl; } template<> void RsTypeSerializer::print_data(const std::string& n, const uint64_t& V) { - std::cerr << " [uint64_t ] " << n << ": " << V << std::endl; + std::cerr << " [uint64_t ] " << n << ": " << std::to_string(V) << std::endl; } template<> void RsTypeSerializer::print_data(const std::string& n, const time_t& V) { From 588295e1e541b438af17db985887ffcef71121bf Mon Sep 17 00:00:00 2001 From: sehraf Date: Sat, 25 Aug 2018 16:52:46 +0200 Subject: [PATCH 191/213] make RsGroupInfo serializable --- libretroshare/src/retroshare/rspeers.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h index 01fb7ba8d..a77a5c4b3 100644 --- a/libretroshare/src/retroshare/rspeers.h +++ b/libretroshare/src/retroshare/rspeers.h @@ -293,16 +293,25 @@ public: std::string cipher_version; }; -class RsGroupInfo +class RsGroupInfo : RsSerializable { public: - RsGroupInfo(); + RsGroupInfo(); - RsNodeGroupId id; - std::string name; - uint32_t flag; + RsNodeGroupId id; + std::string name; + uint32_t flag; - std::set peerIds; + std::set peerIds; + + // RsSerializable interface +public: + void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) { + RS_SERIAL_PROCESS(id); + RS_SERIAL_PROCESS(name); + RS_SERIAL_PROCESS(flag); + RS_SERIAL_PROCESS(peerIds); + } }; std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail); From a8b2532d3b0c792748e6205a6d99f3d7e4a8df07 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 17:04:42 +0200 Subject: [PATCH 192/213] Fix warning #pragma once used in main file Probably a copy paste error made during license cleanup --- libretroshare/src/plugins/dlfcn_win32.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/libretroshare/src/plugins/dlfcn_win32.cc b/libretroshare/src/plugins/dlfcn_win32.cc index 83404e965..b669cfa54 100644 --- a/libretroshare/src/plugins/dlfcn_win32.cc +++ b/libretroshare/src/plugins/dlfcn_win32.cc @@ -19,7 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#pragma once #ifdef WINDOWS_SYS From c754435944d77b149ae5560640989263d94ad625 Mon Sep 17 00:00:00 2001 From: sehraf Date: Sat, 25 Aug 2018 17:10:01 +0200 Subject: [PATCH 193/213] fix deserialisation and improve PRINT job --- .../src/serialiser/rstypeserializer.h | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index fd4984ef6..fc13d42e4 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -94,21 +94,25 @@ {\ for (auto&& arrEl : jDoc[arrKey].GetArray())\ {\ + Value arrKeyT;\ + arrKeyT.SetString(memberName.c_str(), memberName.length());\ +\ RsGenericSerializer::SerializeContext elCtx(\ nullptr, 0, ctx.mFlags, &allocator );\ - elCtx.mJson.AddMember(arrKey, arrEl, allocator);\ + elCtx.mJson.AddMember(arrKeyT, arrEl, allocator);\ \ T el;\ serial_process(j, elCtx, el, memberName); \ ok = ok && elCtx.mOk;\ -\ ctx.mOk &= ok;\ if(ok) v.INSERT_FUN(el);\ else break;\ }\ }\ -\ - ctx.mOk = false;\ + else\ + {\ + ctx.mOk = false;\ + }\ \ } while(false) @@ -351,8 +355,10 @@ struct RsTypeSerializer else break; } } - - ctx.mOk = false; + else + { + ctx.mOk = false; + } break; } default: @@ -479,10 +485,12 @@ struct RsTypeSerializer case RsGenericSerializer::PRINT: { if(v.empty()) - std::cerr << " Empty array"<< std::endl; - else - std::cerr << " Array of " << v.size() << " elements:" + std::cerr << " Empty vector \"" << memberName << "\"" << std::endl; + else + std::cerr << " Vector of " << v.size() << " elements: \"" + << memberName << "\"" << std::endl; + for(uint32_t i=0;i Date: Sat, 25 Aug 2018 17:53:30 +0200 Subject: [PATCH 194/213] fix proxy indicators not being updated --- retroshare-gui/src/gui/settings/ServerPage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index a7885922c..b2ffd555b 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -191,7 +191,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) std::cerr << std::endl; #endif - connect(ui.discComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses())); connect(ui.netModeComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses())); connect(ui.localAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses())); @@ -231,6 +230,10 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode())); QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode())); + + // when the network menu is opened and the hidden service tab is already selected updateOutProxyIndicator() won't be called and thus resulting in wrong proxy indicators. + if (ui.tabWidget->currentIndex() == TAB_HIDDEN_SERVICE) + updateOutProxyIndicator(); } void ServerPage::saveAndTestInProxy() From 9557a5246e92b3f28fd978f7ff7d02a9f78978f2 Mon Sep 17 00:00:00 2001 From: sehraf Date: Sat, 25 Aug 2018 17:54:34 +0200 Subject: [PATCH 195/213] remove unnecessary locking, print log entries also to stdout --- libretroshare/src/util/rsdebug.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/util/rsdebug.cc b/libretroshare/src/util/rsdebug.cc index aade16282..434b06363 100644 --- a/libretroshare/src/util/rsdebug.cc +++ b/libretroshare/src/util/rsdebug.cc @@ -142,11 +142,12 @@ void rslog(const RsLog::logLvl lvl, RsLog::logInfo *info, const std::string &msg if(info->lvl == RsLog::None) return; - RsStackMutex stack(logMtx); /******** LOCKED ****************/ - bool process = info->lvl == RsLog::Default ? (lvl <= defaultLevel) : lvl <= info->lvl; - if(process) + if(!process) + return; + { + RsStackMutex stack(logMtx); /******** LOCKED ****************/ time_t t = time(NULL); if (debugMode == RS_DEBUG_LOGCRASH) @@ -179,6 +180,9 @@ void rslog(const RsLog::logLvl lvl, RsLog::logInfo *info, const std::string &msg fprintf(ofd, "(%s Z: %s, lvl: %u): %s \n", timestr2.c_str(), info->name.c_str(), (unsigned int)info->lvl, msg.c_str()); fflush(ofd); + + fprintf(stdout, "(%s Z: %s, lvl: %u): %s \n", + timestr2.c_str(), info->name.c_str(), (unsigned int)info->lvl, msg.c_str()); lineCount++; } } From c50405c070585525cf6b6556aa10cbce42e6b8fe Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 17:58:04 +0200 Subject: [PATCH 196/213] Expose /rsFiles/turtleSearchRequest via JSON API Expose new async C++ API RsFiles::turtleSearchRequest with callback Modernize TurtleFileInfo serialization code keeping retrocompatibility --- libretroshare/src/ft/ftserver.cc | 55 ++++++++++++++++++++++-- libretroshare/src/ft/ftserver.h | 20 +++++++++ libretroshare/src/retroshare/rsfiles.h | 22 +++++++++- libretroshare/src/retroshare/rsturtle.h | 27 ++++++------ libretroshare/src/turtle/rsturtleitem.cc | 49 --------------------- 5 files changed, 107 insertions(+), 66 deletions(-) diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 044380e81..49c476607 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -71,7 +71,8 @@ ftServer::ftServer(p3PeerMgr *pm, p3ServiceControl *sc) mPeerMgr(pm), mServiceCtrl(sc), mFileDatabase(NULL), mFtController(NULL), mFtExtra(NULL), - mFtDataplex(NULL), mFtSearch(NULL), srvMutex("ftServer") + mFtDataplex(NULL), mFtSearch(NULL), srvMutex("ftServer"), + mSearchCallbacksMapMutex("ftServer callbacks map") { addSerialType(new RsFileTransferSerialiser()) ; } @@ -1630,6 +1631,7 @@ int ftServer::tick() mFtDataplex->deleteUnusedServers() ; mFtDataplex->handlePendingCrcRequests() ; mFtDataplex->dispatchReceivedChunkCheckSum() ; + cleanTimedOutSearches(); } return moreToTick; @@ -1822,9 +1824,21 @@ int ftServer::handleIncoming() void ftServer::receiveSearchResult(RsTurtleFTSearchResultItem *item) { - // @Gio: add your thing here + bool hasCallback = false; - RsServer::notify()->notifyTurtleSearchResult(item->request_id,item->result) ; + { + RS_STACK_MUTEX(mSearchCallbacksMapMutex); + auto cbpt = mSearchCallbacksMap.find(item->request_id); + if(cbpt != mSearchCallbacksMap.end()) + { + hasCallback = true; + cbpt->second.first(item->result); + } + } // end RS_STACK_MUTEX(mSearchCallbacksMapMutex); + + if(!hasCallback) + RsServer::notify()->notifyTurtleSearchResult( + item->request_id, item->result ); } /***************************** CONFIG ****************************/ @@ -1839,3 +1853,38 @@ bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr) return true; } +bool ftServer::turtleSearchRequest( + const std::string& matchString, + const std::function& results)>& multiCallback, + std::time_t maxWait ) +{ + if(matchString.empty()) + { + std::cerr << __PRETTY_FUNCTION__ << " match string can't be empty!" + << std::endl; + return false; + } + + TurtleRequestId sId = turtleSearch(matchString); + + RS_STACK_MUTEX(mSearchCallbacksMapMutex); + mSearchCallbacksMap.emplace( + sId, + std::make_pair( + multiCallback, + std::chrono::system_clock::now() + + std::chrono::seconds(maxWait) ) ); + + return true; +} + +void ftServer::cleanTimedOutSearches() +{ + RS_STACK_MUTEX(mSearchCallbacksMapMutex); + auto now = std::chrono::system_clock::now(); + for( auto cbpt = mSearchCallbacksMap.begin(); + cbpt != mSearchCallbacksMap.end(); ) + if(cbpt->second.second <= now) + cbpt = mSearchCallbacksMap.erase(cbpt); + else ++cbpt; +} diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index f79ffe8b5..5745d3d2b 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include "ft/ftdata.h" #include "turtle/turtleclientservice.h" @@ -143,6 +145,12 @@ public: virtual void setFilePermDirectDL(uint32_t perm) ; virtual uint32_t filePermDirectDL() ; + /// @see RsFiles + virtual bool turtleSearchRequest( + const std::string& matchString, + const std::function& results)>& multiCallback, + std::time_t maxWait = 300 ); + virtual TurtleSearchRequestId turtleSearch(const std::string& string_to_match) ; virtual TurtleSearchRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) ; @@ -313,6 +321,18 @@ private: std::map mEncryptedHashes ; // This map is such that sha1(it->second) = it->first std::map mEncryptedPeerIds ; // This map holds the hash to be used with each peer id std::map > mUploadLimitMap ; + + /** Store search callbacks with timeout*/ + std::map< + TurtleRequestId, + std::pair< + std::function& results)>, + std::chrono::system_clock::time_point > + > mSearchCallbacksMap; + RsMutex mSearchCallbacksMapMutex; + + /// Cleanup mSearchCallbacksMap + void cleanTimedOutSearches(); }; diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 4fca503a7..b7bbe728f 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "rstypes.h" #include "serialiser/rsserializable.h" @@ -315,8 +317,24 @@ public: virtual uint32_t getMaxUploadSlotsPerFriend()=0; virtual void setFilePermDirectDL(uint32_t perm)=0; virtual uint32_t filePermDirectDL()=0; - virtual TurtleRequestId turtleSearch(const std::string& string_to_match) =0; - virtual TurtleRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) =0; + + /** + * @brief Request remote files search + * @jsonapi{development} + * @param[in] matchString string to look for in the search + * @param multiCallback function that will be called each time a search + * result is received + * @param[in] maxWait maximum wait time in seconds for search results + * @return false on error, true otherwise + */ + virtual bool turtleSearchRequest( + const std::string& matchString, + const std::function& results)>& multiCallback, + std::time_t maxWait = 300 ) = 0; + + virtual TurtleRequestId turtleSearch(const std::string& string_to_match) = 0; + virtual TurtleRequestId turtleSearch( + const RsRegularExpression::LinearizedExpression& expr) = 0; /*** * Control of Downloads Priority. diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index c183e454c..6f5ac469c 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -38,30 +38,33 @@ class RsTurtle; /** * Pointer to global instance of RsTurtle service implementation - * @jsonapi{development} */ extern RsTurtle* rsTurtle; typedef uint32_t TurtleRequestId ; typedef RsPeerId TurtleVirtualPeerId; -// This is the structure used to send back results of the turtle search -// to the notifyBase class, or send info to the GUI. - -struct TurtleFileInfo //: RsSerializable +/** + * This is the structure used to send back results of the turtle search, + * to other peers, to the notifyBase class, to the search caller or to the GUI. + */ +struct TurtleFileInfo : RsSerializable { - RsFileHash hash; - std::string name; - uint64_t size; -/* + uint64_t size; /// File size + RsFileHash hash; /// File hash + std::string name; /// File name + /// @see RsSerializable::serial_process void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) { - RS_SERIAL_PROCESS(hash); - RS_SERIAL_PROCESS(name); RS_SERIAL_PROCESS(size); - }*/ + RS_SERIAL_PROCESS(hash); + + // Use String TLV serial process for retrocompatibility + RsTypeSerializer::serial_process( + j, ctx, TLV_TYPE_STR_NAME, name, "name" ); + } }; struct TurtleTunnelRequestDisplayInfo diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 3c51f7c29..7b5717eae 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -216,55 +216,6 @@ RsTurtleSearchResultItem *RsTurtleGenericSearchResultItem::duplicate() const return sr ; } -template<> uint32_t RsTypeSerializer::serial_size(const TurtleFileInfo& i) -{ - uint32_t s = 0 ; - - s += 8 ; // size - s += i.hash.SIZE_IN_BYTES ; - s += GetTlvStringSize(i.name) ; - - return s; -} - -template<> bool RsTypeSerializer::deserialize(const uint8_t data[],uint32_t size,uint32_t& offset,TurtleFileInfo& i) -{ - uint32_t saved_offset = offset ; - bool ok = true ; - - ok &= getRawUInt64(data, size, &offset, &i.size); // file size - ok &= i.hash.deserialise(data, size, offset); // file hash - ok &= GetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // file name - - if(!ok) - offset = saved_offset ; - - return ok; -} - -template<> bool RsTypeSerializer::serialize(uint8_t data[],uint32_t size,uint32_t& offset,const TurtleFileInfo& i) -{ - uint32_t saved_offset = offset ; - bool ok = true ; - - ok &= setRawUInt64(data, size, &offset, i.size); // file size - ok &= i.hash.serialise(data, size, offset); // file hash - ok &= SetTlvString(data, size, &offset, TLV_TYPE_STR_NAME, i.name); // file name - - if(!ok) - offset = saved_offset ; - - return ok; -} - -template<> void RsTypeSerializer::print_data(const std::string& n, const TurtleFileInfo& i) -{ - std::cerr << " [FileInfo ] " << n << " size=" << i.size << " hash=" << i.hash << ", name=" << i.name << std::endl; -} - -RS_TYPE_SERIALIZER_TO_JSON_NOT_IMPLEMENTED_DEF(TurtleFileInfo) -RS_TYPE_SERIALIZER_FROM_JSON_NOT_IMPLEMENTED_DEF(TurtleFileInfo) - void RsTurtleOpenTunnelItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process (j,ctx,file_hash ,"file_hash") ; From f5d306c7b155e15f0fba9b295ac1c9ad3a658ca0 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 18:39:32 +0200 Subject: [PATCH 197/213] Made JSON API port configurable from retroshare-gui Use port used by webui + 2 --- retroshare-gui/src/gui/settings/WebuiPage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index 140310be1..1d2dd6013 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -110,7 +110,8 @@ QString WebuiPage::helpText() const apiServerLocal = new resource_api::ApiServerLocal(apiServer, resource_api::ApiServerLocal::serverPath()); #endif #ifdef RS_JSONAPI - jsonApiServer = new JsonApiServer(9092); + // Use same port of libresapi + 2 + jsonApiServer = new JsonApiServer(Settings->getWebinterfacePort() + 2); jsonApiServer->start("WebuiPage::jsonApiServer"); #endif return ok; From c14d89890144e167daac2b8ce4587de84468ebda Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 25 Aug 2018 18:44:29 +0200 Subject: [PATCH 198/213] added some debug info to file control system and fixes a problem with sending TS --- .../src/file_sharing/file_sharing_defaults.h | 8 +- libretroshare/src/file_sharing/p3filelists.cc | 81 ++++++++++++++++--- libretroshare/src/file_sharing/p3filelists.h | 1 + libretroshare/src/gxs/rsgxsnettunnel.cc | 2 +- libretroshare/src/retroshare/rsfiles.h | 2 + libretroshare/src/turtle/p3turtle.cc | 2 - 6 files changed, 78 insertions(+), 18 deletions(-) diff --git a/libretroshare/src/file_sharing/file_sharing_defaults.h b/libretroshare/src/file_sharing/file_sharing_defaults.h index 77bdbb3ff..6633e348f 100644 --- a/libretroshare/src/file_sharing/file_sharing_defaults.h +++ b/libretroshare/src/file_sharing/file_sharing_defaults.h @@ -21,10 +21,10 @@ ******************************************************************************/ #pragma once -static const uint32_t DELAY_BETWEEN_DIRECTORY_UPDATES = 600 ; // 10 minutes -static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORY_SYNC_REQ = 120 ; // 2 minutes -static const uint32_t DELAY_BETWEEN_LOCAL_DIRECTORIES_TS_UPDATE = 20 ; // 20 sec. But we only update for real if something has changed. -static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP = 60 ; // 60 sec. +static const uint32_t DELAY_BETWEEN_DIRECTORY_UPDATES = 600 ; // 10 minutes +static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORY_SYNC_REQ = 120 ; // 2 minutes +static const uint32_t DELAY_BETWEEN_LOCAL_DIRECTORIES_TS_UPDATE = 20 ; // 20 sec. But we only update for real if something has changed. +static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP = 60 ; // 60 sec. static const uint32_t DELAY_BEFORE_DELETE_NON_EMPTY_REMOTE_DIR = 60*24*86400 ; // delete non empty remoe directories after 60 days of inactivity static const uint32_t DELAY_BEFORE_DELETE_EMPTY_REMOTE_DIR = 5*24*86400 ; // delete empty remote directories after 5 days of inactivity diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index e1ddd059c..5e0d2cffc 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -37,6 +37,7 @@ #define P3FILELISTS_ERROR() std::cerr << "***ERROR***" << " : FILE_LISTS : " << __FUNCTION__ << " : " //#define DEBUG_P3FILELISTS 1 +#define DEBUG_CONTENT_FILTERING 1 static const uint32_t P3FILELISTS_UPDATE_FLAG_NOTHING_CHANGED = 0x0000 ; static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_MAP_CHANGED = 0x0001 ; @@ -73,6 +74,7 @@ p3FileDatabase::p3FileDatabase(p3ServiceControl *mpeers) mLastCleanupTime = 0 ; mLastDataRecvTS = 0 ; mTrustFriendNodesForBannedFiles = TRUST_FRIEND_NODES_FOR_BANNED_FILES_DEFAULT; + mLastPrimaryBanListChangeTimeStamp = 0; // This is for the transmission of data @@ -561,6 +563,7 @@ bool p3FileDatabase::loadList(std::list& load) { mPrimaryBanList = fb->primary_banned_files_list ; mBannedFilesChanged = true; + mLastPrimaryBanListChangeTimeStamp = time(NULL); } delete *it ; @@ -1891,19 +1894,27 @@ bool p3FileDatabase::locked_generateAndSendSyncRequest(RemoteDirectoryStorage *r bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string& filename, uint64_t file_size) { +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " setting file \"" << filename << "\" size=" << file_size << " hash=" << real_file_hash << " as banned." << std::endl; +#endif { RS_STACK_MUTEX(mFLSMtx) ; BannedFileEntry& entry(mPrimaryBanList[real_file_hash]) ; // primary list (user controlled) of files banned from FT search and forwarding. map - entry.filename = filename ; - entry.size = file_size ; - entry.ban_time_stamp = time(NULL); + if(entry.ban_time_stamp == 0) + { + entry.filename = filename ; + entry.size = file_size ; + entry.ban_time_stamp = time(NULL); - RsFileHash hash_of_hash ; - ftServer::encryptHash(real_file_hash,hash_of_hash) ; + RsFileHash hash_of_hash ; + ftServer::encryptHash(real_file_hash,hash_of_hash) ; - mBannedFileList.insert(real_file_hash) ; - mBannedFileList.insert(hash_of_hash) ; + mBannedFileList.insert(real_file_hash) ; + mBannedFileList.insert(hash_of_hash) ; + + mLastPrimaryBanListChangeTimeStamp = time(NULL); + } } IndicateConfigChanged(); @@ -1911,9 +1922,13 @@ bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string } bool p3FileDatabase::unbanFile(const RsFileHash& real_file_hash) { +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " unbanning file with hash " << real_file_hash << std::endl; +#endif { RS_STACK_MUTEX(mFLSMtx) ; mPrimaryBanList.erase(real_file_hash) ; + mLastPrimaryBanListChangeTimeStamp = time(NULL); } IndicateConfigChanged(); @@ -1927,7 +1942,12 @@ bool p3FileDatabase::isFileBanned(const RsFileHash& hash) RsFileHash hash_of_hash ; ftServer::encryptHash(hash,hash_of_hash) ; - return mBannedFileList.find(hash) != mBannedFileList.end() || mBannedFileList.find(hash_of_hash) != mBannedFileList.end() ; + bool res = mBannedFileList.find(hash) != mBannedFileList.end() || mBannedFileList.find(hash_of_hash) != mBannedFileList.end() ; + +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " is file banned(" << hash << "): " << (res?"YES":"NO") << std::endl; +#endif + return res ; } bool p3FileDatabase::getPrimaryBannedFilesList(std::map& banned_files) @@ -1943,10 +1963,14 @@ bool p3FileDatabase::trustFriendNodesForBannedFiles() const RS_STACK_MUTEX(mFLSMtx) ; return mTrustFriendNodesForBannedFiles; } + void p3FileDatabase::setTrustFriendNodesForBannedFiles(bool b) { if(b != mTrustFriendNodesForBannedFiles) + { IndicateConfigChanged(); + mBannedFilesChanged = true; + } RS_STACK_MUTEX(mFLSMtx) ; mTrustFriendNodesForBannedFiles = b; @@ -1958,6 +1982,11 @@ void p3FileDatabase::checkSendBannedFilesInfo() // 1 - compare records to list of online friends, send own info of not already +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " Checking banned file list: " << std::endl; +#endif + + time_t now = time(NULL); std::list online_friends ; rsPeers->getOnlineList(online_friends); @@ -1970,13 +1999,19 @@ void p3FileDatabase::checkSendBannedFilesInfo() if(peers.find(it->first) == peers.end()) // friend not online, remove his record { it = mPeerBannedFiles.erase(it) ; +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " Peer " << it->first << " is offline: removign record." << std::endl; +#endif continue; } - if(it->second.mLastSent == 0) // has ban info already been sent? If not do it. + if(it->second.mLastSent < mLastPrimaryBanListChangeTimeStamp) // has ban info already been sent? If not do it. { +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " Peer " << it->first << " is online and hasn't been sent since last change: sending..." << std::endl; +#endif locked_sendBanInfo(it->first); - it->second.mLastSent = time(NULL); + it->second.mLastSent = now; } peers.erase(it->first); // friend has been handled -> remove from list @@ -1988,7 +2023,10 @@ void p3FileDatabase::checkSendBannedFilesInfo() for(auto it(peers.begin());it!=peers.end();++it) { locked_sendBanInfo(*it); - mPeerBannedFiles[*it].mLastSent = time(NULL); + mPeerBannedFiles[*it].mLastSent = now; +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " Peer " << *it << " is online and hasn't been sent info at all: sending..." << std::endl; +#endif } // 3 - update list of banned hashes if it has changed somehow @@ -1997,13 +2035,22 @@ void p3FileDatabase::checkSendBannedFilesInfo() { mBannedFileList.clear(); +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " Creating banned file list: " << std::endl; +#endif // Add all H(H(f)) from friends if(mTrustFriendNodesForBannedFiles) for(auto it(mPeerBannedFiles.begin());it!=mPeerBannedFiles.end();++it) for(auto it2(it->second.mBannedHashOfHash.begin());it2!=it->second.mBannedHashOfHash.end();++it2) + { mBannedFileList.insert(*it2); +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " from " << it->first << ": H(H(f)) = " << *it2 << std::endl; +#endif + } + // Add H(f) and H(H(f)) from our primary list for(auto it(mPrimaryBanList.begin());it!=mPrimaryBanList.end();++it) @@ -2014,6 +2061,10 @@ void p3FileDatabase::checkSendBannedFilesInfo() ftServer::encryptHash(it->first,hash_of_hash) ; mBannedFileList.insert(hash_of_hash) ; + +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " primary: H(f) = " << it->first << ": H(H(f)) = " << hash_of_hash << std::endl; +#endif } mBannedFilesChanged = false ; @@ -2056,6 +2107,9 @@ void p3FileDatabase::handleBannedFilesInfo(RsFileListsBannedHashesItem *item) { RS_STACK_MUTEX(mFLSMtx) ; +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " received banned files info from peer " << item->PeerId() << ", session id = " << std::hex << item->session_id << std::dec << ": " << item->encrypted_hashes.size() << " files:" << std::endl; +#endif // 1 - localize the friend in the banned file map PeerBannedFilesEntry& pbfe(mPeerBannedFiles[item->PeerId()]) ; @@ -2068,7 +2122,12 @@ void p3FileDatabase::handleBannedFilesInfo(RsFileListsBannedHashesItem *item) // 2 - replace/update the list, depending on the session_id for(auto it(item->encrypted_hashes.begin());it!=item->encrypted_hashes.end();++it) + { pbfe.mBannedHashOfHash.insert(*it); +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " added H(H(f)) = " << *it << std::endl; +#endif + } // 3 - tell the updater that the banned file list has changed diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index c58c9989a..0c9424c2f 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -270,6 +270,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub std::set mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends. bool mTrustFriendNodesForBannedFiles ; bool mBannedFilesChanged; + time_t mLastPrimaryBanListChangeTimeStamp; void locked_sendBanInfo(const RsPeerId& pid); void handleBannedFilesInfo(RsFileListsBannedHashesItem *item); diff --git a/libretroshare/src/gxs/rsgxsnettunnel.cc b/libretroshare/src/gxs/rsgxsnettunnel.cc index bbe10694b..026ba822b 100644 --- a/libretroshare/src/gxs/rsgxsnettunnel.cc +++ b/libretroshare/src/gxs/rsgxsnettunnel.cc @@ -30,7 +30,7 @@ #include "gxs/rsnxs.h" #include "rsgxsnettunnel.h" -#define DEBUG_RSGXSNETTUNNEL 1 +// #define DEBUG_RSGXSNETTUNNEL 1 #define GXS_NET_TUNNEL_NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; } #define GXS_NET_TUNNEL_DEBUG() std::cerr << time(NULL) << " : GXS_NET_TUNNEL: " << __FUNCTION__ << " : " diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 918f1ab2f..e516bea27 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -164,6 +164,8 @@ public: struct BannedFileEntry { + BannedFileEntry() : size(0),filename(""),ban_time_stamp(0) {} + uint64_t size ; std::string filename ; time_t ban_time_stamp; diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 36b4383a9..112363ea9 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -1550,9 +1550,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) if(rsFiles->isHashBanned(item->file_hash)) { -#ifdef P3TURTLE_DEBUG std::cerr << "(II) Rejecting tunnel request to ban hash " << item->file_hash << std::endl; -#endif return ; } From 85c3332faee92c27d5c0563212a98a7516906a57 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 19:13:34 +0200 Subject: [PATCH 199/213] Add JSON API support to retroshare-nogui --- retroshare-nogui/src/retroshare.cc | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/retroshare-nogui/src/retroshare.cc b/retroshare-nogui/src/retroshare.cc index 65d8c6168..527c480df 100644 --- a/retroshare-nogui/src/retroshare.cc +++ b/retroshare-nogui/src/retroshare.cc @@ -48,6 +48,11 @@ #include "TerminalApiClient.h" #endif +#ifdef RS_JSONAPI +# include +# include "jsonapi/jsonapi.h" +#endif // RS_JSONAPI + /* Basic instructions for running libretroshare as background thread. * ******************************************************************* * * This allows your program to communicate with authenticated peers. @@ -60,6 +65,32 @@ int main(int argc, char **argv) { +#ifdef RS_JSONAPI + JsonApiServer* jsonApiServer = nullptr; + uint16_t jsonApiPort = 0; + + { + argstream jsonApiArgs(argc, argv); + jsonApiArgs >> parameter( + "jsonApiPort", jsonApiPort, "jsonApiPort", + "Enable JSON API on the specified port", false ); + jsonApiArgs >> help('h', "help", "Display this Help"); + + if (jsonApiArgs.helpRequested()) + std::cerr << jsonApiArgs.usage() << std::endl; + } + + if(jsonApiPort) + { + jsonApiServer = new JsonApiServer( jsonApiPort, [](int /*ec*/) + { + std::raise(SIGTERM); + } ); + + jsonApiServer->start("JSON API Server"); + } +#endif // RS_JSONAPI + #ifdef ENABLE_WEBUI std::string docroot = resource_api::getDefaultDocroot(); From b5eabf7af7ae7c97df188dcb53665ecf4560c3d4 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 25 Aug 2018 20:18:54 +0200 Subject: [PATCH 200/213] improved banned files UI and fixed deadlock --- libretroshare/src/file_sharing/p3filelists.cc | 20 +++++++++++++------ .../src/gui/FileTransfer/BannedFilesDialog.ui | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 5e0d2cffc..87f03f05a 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -185,15 +185,19 @@ int p3FileDatabase::tick() if(last_print_time + 20 < now) { - RS_STACK_MUTEX(mFLSMtx) ; + { + RS_STACK_MUTEX(mFLSMtx) ; #ifdef DEBUG_FILE_HIERARCHY - mLocalSharedDirs->print(); + mLocalSharedDirs->print(); #endif - last_print_time = now ; + last_print_time = now ; + } #warning mr-alice 2016-08-19: "This should be removed, but it's necessary atm for updating the GUI" RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0); + + checkSendBannedFilesInfo(); } if(mUpdateFlags) @@ -1939,13 +1943,17 @@ bool p3FileDatabase::isFileBanned(const RsFileHash& hash) { RS_STACK_MUTEX(mFLSMtx) ; + if(mBannedFileList.empty()) // quick exit + return false ; + RsFileHash hash_of_hash ; ftServer::encryptHash(hash,hash_of_hash) ; bool res = mBannedFileList.find(hash) != mBannedFileList.end() || mBannedFileList.find(hash_of_hash) != mBannedFileList.end() ; #ifdef DEBUG_CONTENT_FILTERING - P3FILELISTS_DEBUG() << " is file banned(" << hash << "): " << (res?"YES":"NO") << std::endl; + if(res) + P3FILELISTS_DEBUG() << " is file banned(" << hash << "): " << (res?"YES":"NO") << std::endl; #endif return res ; } @@ -2014,7 +2022,7 @@ void p3FileDatabase::checkSendBannedFilesInfo() it->second.mLastSent = now; } - peers.erase(it->first); // friend has been handled -> remove from list + peers.erase(it->first); // friend has been handled -> remove from list ++it; } @@ -2084,7 +2092,7 @@ void p3FileDatabase::locked_sendBanInfo(const RsPeerId& peer) if(!item) { - RsFileListsBannedHashesItem *item = new RsFileListsBannedHashesItem ; + item = new RsFileListsBannedHashesItem ; item->PeerId(peer); item->session_id = session_id ; diff --git a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui index ff7deec7f..78d81df79 100644 --- a/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui +++ b/retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui @@ -14,7 +14,7 @@ - <html><head/><body><p>The list below contains files you have chosen to ban from your local network. You will not forward search results and data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &quot;Trust my friends for banning unwanted content&quot;.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Collaborative file control</span>: the list below contains files you choose to ban from your <span style=" font-weight:600;">local</span> network: you will not forward search results nor data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &quot;Trust my friends for banning unwanted content&quot;. This feature cannot globally hide a file unless a signficant proportion of users in the same network decide to ban it.</p></body></html> Qt::AlignJustify|Qt::AlignVCenter From 2fab33d37f73f160c10e04e3eaa7014d106f7a27 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 25 Aug 2018 20:52:06 +0200 Subject: [PATCH 201/213] fixed a few bugs in ban file list management --- libretroshare/src/file_sharing/p3filelists.cc | 25 +++++++++++++------ libretroshare/src/file_sharing/p3filelists.h | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 87f03f05a..156490e18 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -566,7 +566,7 @@ bool p3FileDatabase::loadList(std::list& load) if(fb) { mPrimaryBanList = fb->primary_banned_files_list ; - mBannedFilesChanged = true; + mBannedFileListNeedsUpdate = true; mLastPrimaryBanListChangeTimeStamp = time(NULL); } @@ -1918,6 +1918,7 @@ bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string mBannedFileList.insert(hash_of_hash) ; mLastPrimaryBanListChangeTimeStamp = time(NULL); + mBannedFileListNeedsUpdate = true ; } } @@ -1933,6 +1934,7 @@ bool p3FileDatabase::unbanFile(const RsFileHash& real_file_hash) RS_STACK_MUTEX(mFLSMtx) ; mPrimaryBanList.erase(real_file_hash) ; mLastPrimaryBanListChangeTimeStamp = time(NULL); + mBannedFileListNeedsUpdate = true ; } IndicateConfigChanged(); @@ -1977,7 +1979,7 @@ void p3FileDatabase::setTrustFriendNodesForBannedFiles(bool b) if(b != mTrustFriendNodesForBannedFiles) { IndicateConfigChanged(); - mBannedFilesChanged = true; + mBannedFileListNeedsUpdate = true; } RS_STACK_MUTEX(mFLSMtx) ; @@ -1991,7 +1993,7 @@ void p3FileDatabase::checkSendBannedFilesInfo() // 1 - compare records to list of online friends, send own info of not already #ifdef DEBUG_CONTENT_FILTERING - P3FILELISTS_DEBUG() << " Checking banned file list: " << std::endl; + P3FILELISTS_DEBUG() << " Checking banned files information: " << std::endl; #endif time_t now = time(NULL); @@ -2039,12 +2041,12 @@ void p3FileDatabase::checkSendBannedFilesInfo() // 3 - update list of banned hashes if it has changed somehow - if(mBannedFilesChanged) + if(mBannedFileListNeedsUpdate) { mBannedFileList.clear(); #ifdef DEBUG_CONTENT_FILTERING - P3FILELISTS_DEBUG() << " Creating banned file list: " << std::endl; + P3FILELISTS_DEBUG() << " Creating local banned file list: " << std::endl; #endif // Add all H(H(f)) from friends @@ -2075,15 +2077,22 @@ void p3FileDatabase::checkSendBannedFilesInfo() #endif } - mBannedFilesChanged = false ; + mBannedFileListNeedsUpdate = false ; } + +#ifdef DEBUG_CONTENT_FILTERING + P3FILELISTS_DEBUG() << " Final list of locally banned hashes contains: " << mBannedFileList.size() << " elements." << std::endl; +#endif } void p3FileDatabase::locked_sendBanInfo(const RsPeerId& peer) { - RsFileListsBannedHashesItem *item = NULL; + RsFileListsBannedHashesItem *item = new RsFileListsBannedHashesItem ; uint32_t session_id = RSRandom::random_u32(); + item->session_id = session_id ; + item->PeerId(peer); + for(auto it(mPrimaryBanList.begin());it!=mPrimaryBanList.end();++it) { RsFileHash hash_of_hash ; @@ -2139,6 +2148,6 @@ void p3FileDatabase::handleBannedFilesInfo(RsFileListsBannedHashesItem *item) // 3 - tell the updater that the banned file list has changed - mBannedFilesChanged = true ; + mBannedFileListNeedsUpdate = true ; } diff --git a/libretroshare/src/file_sharing/p3filelists.h b/libretroshare/src/file_sharing/p3filelists.h index 0c9424c2f..a8ac377ea 100644 --- a/libretroshare/src/file_sharing/p3filelists.h +++ b/libretroshare/src/file_sharing/p3filelists.h @@ -269,7 +269,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub std::map mPeerBannedFiles ; // records of which files other peers ban, stored as H(H(f)) std::set mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends. bool mTrustFriendNodesForBannedFiles ; - bool mBannedFilesChanged; + bool mBannedFileListNeedsUpdate; time_t mLastPrimaryBanListChangeTimeStamp; void locked_sendBanInfo(const RsPeerId& pid); From e878ba99b20e3e47c904f71d39badb5395d60d53 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 22:24:49 +0200 Subject: [PATCH 202/213] Add support for default parameters value in jsonapi-generator --- jsonapi-generator/src/jsonapi-generator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jsonapi-generator/src/jsonapi-generator.cpp b/jsonapi-generator/src/jsonapi-generator.cpp index 9d6a04bad..2fdcd329e 100644 --- a/jsonapi-generator/src/jsonapi-generator.cpp +++ b/jsonapi-generator/src/jsonapi-generator.cpp @@ -30,6 +30,7 @@ struct MethodParam QString type; QString name; + QString defval; bool in; bool out; bool isMultiCallback; @@ -163,6 +164,8 @@ int main(int argc, char *argv[]) QString& pName(tmpParam.name); QString& pType(tmpParam.type); pName = tmpPE.firstChildElement("declname").text(); + QDomElement tmpDefval = tmpPE.firstChildElement("defval"); + if(!tmpDefval.isNull()) tmpParam.defval = tmpDefval.text(); QDomElement tmpType = tmpPE.firstChildElement("type"); pType = tmpType.text(); if(pType.startsWith("const ")) pType.remove(0,6); @@ -248,7 +251,10 @@ int main(int argc, char *argv[]) for (const QString& pn : orderedParamNames) { const MethodParam& mp(paramsMap[pn]); - paramsDeclaration += "\t\t" + mp.type + " " + mp.name + ";\n"; + paramsDeclaration += "\t\t" + mp.type + " " + mp.name; + if(!mp.defval.isEmpty()) + paramsDeclaration += "(" + mp.defval + ")"; + paramsDeclaration += ";\n"; if(mp.in) inputParamsDeserialization += "\t\t\tRS_SERIAL_PROCESS(" + mp.name + ");\n"; From 8fd903ac9072d4035172e8c1b69c4016883f6b31 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 22:25:36 +0200 Subject: [PATCH 203/213] Improve JSON API documentation --- jsonapi-generator/README.adoc | 68 ++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/jsonapi-generator/README.adoc b/jsonapi-generator/README.adoc index dc37a26c6..b31db9b7b 100644 --- a/jsonapi-generator/README.adoc +++ b/jsonapi-generator/README.adoc @@ -112,17 +112,77 @@ struct RsGxsChannelGroup : RsSerializable { RS_SERIAL_PROCESS(mMeta); RS_SERIAL_PROCESS(mDescription); - //RS_SERIAL_PROCESS(mImage); + RS_SERIAL_PROCESS(mImage); RS_SERIAL_PROCESS(mAutoDownload); } }; -------------------------------------------------------------------------------- You can do the same recursively for any member of your +struct+ that is not yet -supported by +RsTypeSerializer+ like I should have done for +RsGxsImage mImage;+ -but didn't have done yet because the day is so beatiful and i want to spend some -time outside :D. +supported by +RsTypeSerializer+. +Some Retroshare {Cxx} API functions are asyncronous, historically RetroShare +didn't follow a policy on how to expose asyncronous API so differents services +and some times even differents method of the same service follow differents +asyncronous patterns, thus making automatic generation of JSON API wrappers for +those methods impractical. Instead of dealing with all those differents patterns +I have chosed to support only one new pattern taking advantage of modern {Cxx}11 +and restbed features. On the {Cxx}11 side lambdas and +std::function+s are used, +on the restbed side Server Side Events are used to send asyncronous results. + +Lets see an example so it will be much esier to understand. + +.RsGxsChannels::turtleSearchRequest asyncronous API +[source,cpp] +-------------------------------------------------------------------------------- + /** + * @brief Request remote channels search + * @jsonapi{development} + * @param[in] matchString string to look for in the search + * @param multiCallback function that will be called each time a search + * result is received + * @param[in] maxWait maximum wait time in seconds for search results + * @return false on error, true otherwise + */ + virtual bool turtleSearchRequest( + const std::string& matchString, + const std::function& multiCallback, + std::time_t maxWait = 300 ) = 0; +-------------------------------------------------------------------------------- + ++RsGxsChannels::turtleSearchRequest(...)+ is an asyncronous method because it +send a channel search request on turtle network and then everytime a result is +received from the network +multiCallback+ is called and the result is passed as +parameter. To be supported by the automatic JSON API wrappers generator an +asyncronous method need a parameter of type +std::function+ called ++callback+ if the callback will be called only once or +multiCallback+ if the +callback is expected to be called more then once like in this case. +A second mandatory parameter is +maxWait+ of type +std::time_t+ it indicates the +maximum amount of time in seconds for which the caller is willing to wait for +results, in case the timeout is reached the callback will not be called anymore. + +[IMPORTANT] +================================================================================ ++callback+ and +multiCallback+ parameters documentation must *not* specify ++[in]+, +[out]+, +[inout]+, in Doxygen documentation as this would fool the +automatic wrapper generator, and ultimately break the compilation. +================================================================================ + +.RsFiles::turtleSearchRequest asyncronous JSON API usage example +[source,bash] +-------------------------------------------------------------------------------- +$ cat turtle_search.json +{ + "matchString":"linux" +} +$ curl --data @turtle_search.json http://127.0.0.1:9092/rsFiles/turtleSearchRequest +data: {"retval":true} + +data: {"results":[{"size":157631,"hash":"69709b4d01025584a8def5cd78ebbd1a3cf3fd05","name":"kill_bill_linux_1024x768.jpg"},{"size":192560,"hash":"000000000000000000009a93e5be8486c496f46c","name":"coffee_box_linux2.jpg"},{"size":455087,"hash":"9a93e5be8486c496f46c00000000000000000000","name":"Linux.png"},{"size":182004,"hash":"e8845280912ebf3779e400000000000000000000","name":"Linux_2_6.png"}]} + +data: {"results":[{"size":668,"hash":"e8845280912ebf3779e400000000000000000000","name":"linux.png"},{"size":70,"hash":"e8845280912ebf3779e400000000000000000000","name":"kali-linux-2016.2-amd64.txt.sha1sum"},{"size":3076767744,"hash":"e8845280912ebf3779e400000000000000000000","name":"kali-linux-2016.2-amd64.iso"},{"size":2780872,"hash":"e8845280912ebf3779e400000000000000000000","name":"openwrt-ar71xx-generic-vmlinux.bin"},{"size":917504,"hash":"e8845280912ebf3779e400000000000000000000","name":"openwrt-ar71xx-generic-vmlinux.lzma"},{"size":2278404096,"hash":"e8845280912ebf3779e400000000000000000000","name":"gentoo-linux-livedvd-amd64-multilib-20160704.iso"},{"size":151770333,"hash":"e8845280912ebf3779e400000000000000000000","name":"flashtool-0.9.23.0-linux.tar.7z"},{"size":2847372,"hash":"e8845280912ebf3779e400000000000000000000","name":"openwrt-ar71xx-generic-vmlinux.elf"},{"size":1310720,"hash":"e8845280912ebf3779e400000000000000000000","name":"openwrt-ar71xx-generic-vmlinux.gz"},{"size":987809,"hash":"e8845280912ebf3779e400000000000000000000","name":"openwrt-ar71xx-generic-vmlinux-lzma.elf"}]} + +-------------------------------------------------------------------------------- == A bit of history From 45306910d4b3ddb80cabfd7362da7e06687d00ef Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sat, 25 Aug 2018 23:31:16 +0200 Subject: [PATCH 204/213] Update Appveyod build badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c726983e5..3d98c2312 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Build Status | Platform | Build Status | | :------------- | :------------- | | GNU/Linux, MacOS, (via travis-ci) | [![Build Status](https://travis-ci.org/RetroShare/RetroShare.svg?branch=master)](https://travis-ci.org/RetroShare/RetroShare) | -| Windows, `MSys2` (via appveyor) | [![Build status](https://ci.appveyor.com/api/projects/status/fu7q0ye6pge53579?svg=true)](https://ci.appveyor.com/project/PhenomRetroShare/retroshare-59qxh) | +| Windows, `MSys2` (via appveyor) | [![Build status](https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true)](https://ci.appveyor.com/project/G10h4ck/retroshare-u4lmn) | Compilation on Windows ---------------------------- From 1dfe64443f97938f1b6419455bbdcbb2c84c5bcc Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 26 Aug 2018 11:39:26 +0200 Subject: [PATCH 205/213] Improve documentation --- jsonapi-generator/src/jsonapi-generator.cpp | 2 +- libretroshare/src/retroshare/rsinit.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jsonapi-generator/src/jsonapi-generator.cpp b/jsonapi-generator/src/jsonapi-generator.cpp index 2fdcd329e..4977f850f 100644 --- a/jsonapi-generator/src/jsonapi-generator.cpp +++ b/jsonapi-generator/src/jsonapi-generator.cpp @@ -292,7 +292,7 @@ int main(int argc, char *argv[]) callbackParams = callbackParams.split('(')[1]; callbackParams = callbackParams.split(')')[0]; - cbs += "RsGenericSerializer::SerializeContext ctx;\n"; + cbs += "\t\t\tRsGenericSerializer::SerializeContext ctx;\n"; for (QString cbPar : callbackParams.split(',')) { diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 292ecab96..c99978aea 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -247,15 +247,16 @@ struct RsLoginHelper void getLocations(std::vector& locations); /** - * @brief Creates a new RetroShare location + * @brief Creates a new RetroShare location, and log in once is created * @jsonapi{development} * @param[inout] location provide input information to generate the location * and storage to output the data of the generated location * @param[in] password to protect and unlock the associated PGP key - * @param[in] makeHidden pass true to create an hidden location + * @param[in] makeHidden pass true to create an hidden location. UNTESTED! * @param[in] makeAutoTor pass true to create an automatically configured - * Tor hidden location - * @param[out] errorMessage + * Tor hidden location. UNTESTED! + * @param[out] errorMessage if some error occurred human readable error + * message * @return true if success, false otherwise */ bool createLocation( RsLoginHelper::Location& location, From 5f18d267387f4931b4f803ad50d6ffffebe81157 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 27 Aug 2018 23:36:07 +0200 Subject: [PATCH 206/213] removed unused member depth from search results to avoid confusion while ensureing backward compatibility is kept --- libretroshare/src/turtle/p3turtle.cc | 2 -- libretroshare/src/turtle/rsturtleitem.cc | 12 +++++++++--- libretroshare/src/turtle/rsturtleitem.h | 5 +---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index c14b46e6c..c422b2dc0 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -928,7 +928,6 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) for(auto it(search_results.begin());it!=search_results.end();++it) { (*it)->request_id = item->request_id ; - (*it)->depth = 0 ; (*it)->PeerId(item->PeerId()) ; sendItem(*it) ; @@ -1174,7 +1173,6 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) // of the files found can be further reached by a tunnel. fwd_item->PeerId(it->second.origin) ; - fwd_item->depth = 0 ; // obfuscate the depth for non immediate friends. Result will always be 0. This effectively removes the information. sendItem(fwd_item) ; } diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 3c51f7c29..38ab3bb23 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -193,13 +193,20 @@ RS_TYPE_SERIALIZER_FROM_JSON_NOT_IMPLEMENTED_DEF(RsRegularExpression::Linearized void RsTurtleFTSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; + + // This depth was previously a member of SearchResult parent class that was set to be always 0. It's removed, but we have to stay backward compatible. + uint16_t depth_retrocompat_unused_placeholder = 0 ; + RsTypeSerializer::serial_process(j,ctx,depth_retrocompat_unused_placeholder,"depth") ; + RsTypeSerializer::serial_process (j,ctx,result ,"result") ; } void RsTurtleGenericSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; + + // This depth was previously a member of SearchResult parent class that was set to be always 0. It's removed, but we have to stay backward compatible. + uint16_t depth_retrocompat_unused_placeholder = 0 ; + RsTypeSerializer::serial_process(j,ctx,depth_retrocompat_unused_placeholder,"depth") ; RsTypeSerializer::TlvMemBlock_proxy prox(result_data,result_data_len) ; RsTypeSerializer::serial_process(j,ctx,prox,"search_data") ; @@ -212,7 +219,6 @@ RsTurtleSearchResultItem *RsTurtleGenericSearchResultItem::duplicate() const memcpy(sr->result_data,result_data,result_data_len) ; sr->result_data_len = result_data_len ; sr->request_id = request_id ; - sr->depth = depth ; return sr ; } diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 9643089b8..1f4893087 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -191,12 +191,9 @@ class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem class RsTurtleSearchResultItem: public RsTurtleItem { public: - RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} + RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} TurtleSearchRequestId request_id ; // Randomly generated request id. - uint16_t depth ; // The depth of a search result is obfuscated in this way: - // If the actual depth is 1, this field will be 1. - // If the actual depth is > 1, this field is a larger arbitrary integer. virtual uint32_t count() const =0; virtual void pop() =0; From 40c2a8e4697c74ae93aea82ed947d1832f525560 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 28 Aug 2018 14:05:02 +0200 Subject: [PATCH 207/213] Improve JSON API documentation following Cyril suggestion --- jsonapi-generator/README.adoc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/jsonapi-generator/README.adoc b/jsonapi-generator/README.adoc index b31db9b7b..fe3566fa6 100644 --- a/jsonapi-generator/README.adoc +++ b/jsonapi-generator/README.adoc @@ -10,6 +10,32 @@ Look for methods marked with +@jsonapi+ doxygen custom command into pointer name like +rsGxsChannels+ for +RsGxsChannels+, and the method name like +createGroup+ and pass the input paramethers as a JSON object. +.Service instance pointer in rsgxschannels.h +[source,cpp] +-------------------------------------------------------------------------------- +/** + * Pointer to global instance of RsGxsChannels service implementation + * @jsonapi{development} + */ +extern RsGxsChannels* rsGxsChannels; +-------------------------------------------------------------------------------- + +.Method declaration in rsgxschannels.h +[source,cpp] +-------------------------------------------------------------------------------- + /** + * @brief Request channel creation. + * The action is performed asyncronously, so it could fail in a subsequent + * phase even after returning true. + * @jsonapi{development} + * @param[out] token Storage for RsTokenService token to track request + * status. + * @param[in] group Channel data (name, description...) + * @return false on error, true otherwise + */ + virtual bool createGroup(uint32_t& token, RsGxsChannelGroup& group) = 0; +-------------------------------------------------------------------------------- + .paramethers.json [source,json] -------------------------------------------------------------------------------- From 75e882bb9f1221ec9ca355bd240f114a561a7b67 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 28 Aug 2018 14:12:09 +0200 Subject: [PATCH 208/213] Make NotifyClient class again --- libretroshare/src/retroshare/rsnotify.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index bba4ff959..a418cb958 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -181,7 +181,7 @@ class RsFeedItem // This mechanism can be used in plugins, new services, etc. // -struct NotifyClient; +class NotifyClient; class RsNotify { @@ -206,8 +206,9 @@ class RsNotify virtual bool setDisableAskPassword (const bool /*bValue*/) { return false ; } }; -struct NotifyClient +class NotifyClient { +public: NotifyClient() {} virtual ~NotifyClient() {} From 4bc6919ba9973ffa884bfcbdcdec5be31f5e17f5 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 28 Aug 2018 14:19:41 +0200 Subject: [PATCH 209/213] Friendly android-service build error if wrong compile options --- retroshare-android-service/src/service.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/retroshare-android-service/src/service.cpp b/retroshare-android-service/src/service.cpp index 7084346b9..83381975c 100644 --- a/retroshare-android-service/src/service.cpp +++ b/retroshare-android-service/src/service.cpp @@ -62,6 +62,7 @@ int main(int argc, char *argv[]) signal(SIGBREAK, exitGracefully); #endif // ifdef SIGBREAK +#ifdef LIBRESAPI_LOCAL_SERVER ApiServer api; RsControlModule ctrl_mod(argc, argv, api.getStateTokenServer(), &api, true); api.addResourceHandler( @@ -82,6 +83,9 @@ int main(int argc, char *argv[]) QObject::connect( &shouldExitTimer, &QTimer::timeout, [&]() { if(ctrl_mod.processShouldExit()) exitGracefully(0); } ); shouldExitTimer.start(); +#else +# error retroshare-android-service need CONFIG+=libresapilocalserver to build +#endif #ifdef RS_JSONAPI jas.start(); From 3094146c13bdd738dd4343d57dd2a345db926b43 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 28 Aug 2018 14:35:29 +0200 Subject: [PATCH 210/213] RsLoginHelper::attemptLogin clear cached passphrase after usage Thanks Cyril for suggestion --- libretroshare/src/rsserver/rsinit.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index bad35c91a..3a76fd79a 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1940,10 +1940,11 @@ RsInit::LoadCertificateStatus RsLoginHelper::attemptLogin( if(!rsNotify->cachePgpPassphrase(password)) return RsInit::ERR_UNKOWN; if(!rsNotify->setDisableAskPassword(true)) return RsInit::ERR_UNKOWN; if(!RsAccounts::SelectAccount(account)) return RsInit::ERR_UNKOWN; - std::string ignore; + std::string _ignore_lockFilePath; RsInit::LoadCertificateStatus ret = - RsInit::LockAndLoadCertificates(false, ignore); - rsNotify->setDisableAskPassword(false); + RsInit::LockAndLoadCertificates(false, _ignore_lockFilePath); + if(!rsNotify->setDisableAskPassword(false)) return RsInit::ERR_UNKOWN; + if(!rsNotify->clearPgpPassphrase()) return RsInit::ERR_UNKOWN; if(ret != RsInit::OK) return ret; if(RsControl::instance()->StartupRetroShare() == 1) return RsInit::OK; return RsInit::ERR_UNKOWN; From dd55ddea953fdfd3dd09e49112738a85bd6d780d Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 28 Aug 2018 15:20:41 +0200 Subject: [PATCH 211/213] Add more consistency checks to serialization code As suggested by Cyril --- libretroshare/src/serialiser/rsserializer.cc | 29 ++++++++++++++++++++ libretroshare/src/serialiser/rsserializer.h | 6 +--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/serialiser/rsserializer.cc b/libretroshare/src/serialiser/rsserializer.cc index 3905f2cac..c1385fddf 100644 --- a/libretroshare/src/serialiser/rsserializer.cc +++ b/libretroshare/src/serialiser/rsserializer.cc @@ -26,6 +26,7 @@ #include "util/rsprint.h" #include "serialiser/rsserializer.h" #include "serialiser/rstypeserializer.h" +#include "util/stacktrace.h" const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_NONE ( 0x0000 ); const SerializationFlags RsGenericSerializer::SERIALIZATION_FLAG_CONFIG ( 0x0001 ); @@ -241,3 +242,31 @@ RsItem *RsRawSerialiser::deserialise(void *data, uint32_t *pktsize) return item; } + +RsGenericSerializer::SerializeContext::SerializeContext( + uint8_t* data, uint32_t size, SerializationFlags flags, + RsJson::AllocatorType* allocator ) : + mData(data), mSize(size), mOffset(0), mOk(true), mFlags(flags), + mJson(rapidjson::kObjectType, allocator) +{ + if(data) + { + if(size == 0) + { + std::cerr << __PRETTY_FUNCTION__ << " data passed without " + << "size! This make no sense report to developers!" + << std::endl; + print_stacktrace(); + } + + if(flags & SERIALIZATION_FLAG_YIELDING) + { + std::cerr << __PRETTY_FUNCTION__ << " Attempt to create a " + << "binary serialization context with " + << "SERIALIZATION_FLAG_YIELDING! " + << "This make no sense report to developers!" + << std::endl; + print_stacktrace(); + } + } +} diff --git a/libretroshare/src/serialiser/rsserializer.h b/libretroshare/src/serialiser/rsserializer.h index 09803eaa6..40ccc35e9 100644 --- a/libretroshare/src/serialiser/rsserializer.h +++ b/libretroshare/src/serialiser/rsserializer.h @@ -159,8 +159,6 @@ struct RsItem; -#define SERIALIZE_ERROR() std::cerr << __PRETTY_FUNCTION__ << " : " - // This is the base class for serializers. class RsSerialType @@ -222,9 +220,7 @@ struct RsGenericSerializer : RsSerialType SerializeContext( uint8_t* data = nullptr, uint32_t size = 0, SerializationFlags flags = SERIALIZATION_FLAG_NONE, - RsJson::AllocatorType* allocator = nullptr) : - mData(data), mSize(size), mOffset(0), mOk(true), mFlags(flags), - mJson(rapidjson::kObjectType, allocator) {} + RsJson::AllocatorType* allocator = nullptr); RS_DEPRECATED SerializeContext( uint8_t *data, uint32_t size, SerializationFormat format, From b09eb57e947ebffefbba3757dedbbdfce6474cf3 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 28 Aug 2018 23:16:35 +0200 Subject: [PATCH 212/213] fixed small bug in deletion of banned file --- retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index f017529b1..1c0ae3256 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -445,6 +445,9 @@ void SearchDialog::ban() rsFiles -> banFile( hash, (item->text(SR_NAME_COL)).toUtf8().constData() , (item->text(SR_SIZE_COL)).toULongLong()); + while(item->parent() != NULL) + item = item->parent(); + ui.searchResultWidget->takeTopLevelItem(ui.searchResultWidget->indexOfTopLevelItem(item)) ; } } From 65304a301a5b10bdcc53f1f97e3862664a804931 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 28 Aug 2018 23:57:16 +0200 Subject: [PATCH 213/213] added last relay (a.k.a which direct friend) of search results in sources column --- libresapi/src/api/FileSearchHandler.cpp | 2 +- libresapi/src/api/FileSearchHandler.h | 2 +- libretroshare/src/pqi/p3notify.cc | 2 +- libretroshare/src/pqi/p3notify.h | 2 +- libretroshare/src/retroshare/rsnotify.h | 2 +- retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp | 7 ++++--- retroshare-gui/src/gui/notifyqt.cpp | 4 ++-- retroshare-gui/src/gui/notifyqt.h | 2 +- retroshare-nogui/src/notifytxt.cc | 2 +- retroshare-nogui/src/notifytxt.h | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libresapi/src/api/FileSearchHandler.cpp b/libresapi/src/api/FileSearchHandler.cpp index 73e7848f0..c768b1112 100644 --- a/libresapi/src/api/FileSearchHandler.cpp +++ b/libresapi/src/api/FileSearchHandler.cpp @@ -50,7 +50,7 @@ FileSearchHandler::~FileSearchHandler() mStateTokenServer->discardToken(mSearchesStateToken); } -void FileSearchHandler::notifyTurtleSearchResult(uint32_t search_id, const std::list& files) +void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id, const std::list& files) { RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** std::map::iterator mit = mSearches.find(search_id); diff --git a/libresapi/src/api/FileSearchHandler.h b/libresapi/src/api/FileSearchHandler.h index d4b3c31cf..66b79209c 100644 --- a/libresapi/src/api/FileSearchHandler.h +++ b/libresapi/src/api/FileSearchHandler.h @@ -37,7 +37,7 @@ public: virtual ~FileSearchHandler(); // from NotifyClient - virtual void notifyTurtleSearchResult(uint32_t search_id, const std::list& files); + virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list& files); private: void handleWildcard(Request& req, Response& resp); void handleCreateSearch(Request& req, Response& resp); diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index 8616a0957..2ffd3c5cd 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -225,7 +225,7 @@ void p3Notify::notifyChatCleared (const ChatId& chat_id) void p3Notify::notifyChatLobbyTimeShift (int time_shift) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyTimeShift(time_shift) ; } void p3Notify::notifyCustomState (const std::string& peer_id , const std::string& status_string ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyCustomState (peer_id,status_string) ; } void p3Notify::notifyHashingInfo (uint32_t type , const std::string& fileinfo ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHashingInfo (type,fileinfo) ; } -void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,files) ; } +void p3Notify::notifyTurtleSearchResult (const RsPeerId& pid , uint32_t search_id , const std::list& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(pid,search_id,files) ; } #warning MISSING CODE HERE //void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list& groups ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,groups) ; } void p3Notify::notifyPeerHasNewAvatar (std::string peer_id ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerHasNewAvatar(peer_id) ; } diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index 7cc66d826..d288091c3 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -101,7 +101,7 @@ class p3Notify: public RsNotify void notifyChatLobbyTimeShift (int /* time_shift*/) ; void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ; void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) ; - void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) ; + void notifyTurtleSearchResult (const RsPeerId &pid, uint32_t /* search_id */, const std::list& /* files */) ; #warning MISSING CODE HERE // void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) ; void notifyPeerHasNewAvatar (std::string /* peer_id */) ; diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index a418cb958..cf7777e9e 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -222,7 +222,7 @@ public: virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {} virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {} virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {} - virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* files */) {} + virtual void notifyTurtleSearchResult (const RsPeerId& /* pid */, uint32_t /* search_id */, const std::list& /* files */) {} #warning MISSING CODE HERE // virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list& /* groups */) {} virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {} diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index 1c0ae3256..20e5157da 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -977,9 +977,7 @@ void SearchDialog::processResultQueue() while(!searchResultsQueue.empty() && nb_treated_elements++ < 250) { qulonglong search_id = searchResultsQueue.back().first ; - FileDetail file = searchResultsQueue.back().second ; - - searchResultsQueue.pop_back() ; + FileDetail& file = searchResultsQueue.back().second ; #ifdef DEBUG std::cout << "Updating file detail:" << std::endl ; @@ -989,6 +987,8 @@ void SearchDialog::processResultQueue() #endif insertFile(search_id,file); + + searchResultsQueue.pop_back() ; } ui.searchResultWidget->setSortingEnabled(true); if(!searchResultsQueue.empty()) @@ -1323,6 +1323,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s modifiedResult =QString::number(friendSource) + "/" + QString::number(anonymousSource); float fltRes = friendSource + (float)anonymousSource/1000; item->setText(SR_SOURCES_COL,modifiedResult); + item->setToolTip(SR_SOURCES_COL, tr("Obtained via ")+QString::fromStdString(rsPeers->getPeerName(file.id)) ); item->setData(SR_SOURCES_COL, ROLE_SORT, fltRes); item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight ); item->setText(SR_SEARCH_ID_COL, sid_hexa); diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index da8dac48d..fa7bb4c82 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -568,7 +568,7 @@ void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list& files) +void NotifyQt::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,const std::list& files) { { QMutexLocker m(&_mutex) ; @@ -588,7 +588,7 @@ void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list& found_files); + virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list& found_files); virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list& found_groups); virtual void notifyPeerHasNewAvatar(std::string peer_id) ; virtual void notifyOwnAvatarChanged() ; diff --git a/retroshare-nogui/src/notifytxt.cc b/retroshare-nogui/src/notifytxt.cc index 18212b17e..d6d4741c4 100644 --- a/retroshare-nogui/src/notifytxt.cc +++ b/retroshare-nogui/src/notifytxt.cc @@ -219,7 +219,7 @@ void NotifyTxt::displayTransfers() /******************* Turtle Search Interface **********/ -void NotifyTxt::notifyTurtleSearchResult(uint32_t search_id,const std::list& found_files) +void NotifyTxt::notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list& found_files) { // std::cerr << "NotifyTxt::notifyTurtleSearchResult() " << found_files.size(); // std::cerr << " new results for Id: " << search_id; diff --git a/retroshare-nogui/src/notifytxt.h b/retroshare-nogui/src/notifytxt.h index 508bfd7fd..17dcbc409 100644 --- a/retroshare-nogui/src/notifytxt.h +++ b/retroshare-nogui/src/notifytxt.h @@ -44,7 +44,7 @@ class NotifyTxt: public NotifyClient virtual bool askForPassword(const std::string& title, const std::string& question, bool prev_is_bad, std::string& password,bool& cancel); virtual bool askForPluginConfirmation(const std::string& plugin_file, const std::string& plugin_hash,bool first_time); - virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list& found_files); + virtual void notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,const std::list& found_files); /* interface for handling SearchResults */ void getSearchIds(std::list &searchIds);