mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
merged with upstream/master
This commit is contained in:
commit
ade6017f74
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,8 @@
|
|||||||
/RetroShare.pro.user
|
/RetroShare.pro.user
|
||||||
*.o
|
*.o
|
||||||
|
*.sw?
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
moc_*.cpp
|
moc_*.cpp
|
||||||
qrc_*.cpp
|
qrc_*.cpp
|
||||||
ui_*.h
|
ui_*.h
|
||||||
|
@ -8,7 +8,7 @@ Build Status
|
|||||||
| Platform | 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) |
|
| 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/axkopdqj9fc48kwe?svg=true)](https://ci.appveyor.com/project/PhenomRetroShare/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) |
|
||||||
|
|
||||||
Compilation on Windows
|
Compilation on Windows
|
||||||
----------------------------
|
----------------------------
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
!include("retroshare.pri"): error("Could not include file retroshare.pri")
|
!include("retroshare.pri"): error("Could not include file retroshare.pri")
|
||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
|
#CONFIG += tests
|
||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
openpgpsdk \
|
openpgpsdk \
|
||||||
@ -46,4 +47,5 @@ tests {
|
|||||||
SUBDIRS += unittests
|
SUBDIRS += unittests
|
||||||
unittests.file = tests/unittests/unittests.pro
|
unittests.file = tests/unittests/unittests.pro
|
||||||
unittests.depends = libretroshare librssimulator
|
unittests.depends = libretroshare librssimulator
|
||||||
|
unittests.target = unittests
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
|
|
||||||
# version format
|
# version format
|
||||||
version: RetroShare 6.0.{build}-{branch}
|
version: RetroShare 0.6.0.{build}-{branch}
|
||||||
|
|
||||||
# you can use {branch} name in version format too
|
# you can use {branch} name in version format too
|
||||||
# version: 1.0.{build}-{branch}
|
# version: 1.0.{build}-{branch}
|
||||||
|
@ -1,4 +1,300 @@
|
|||||||
retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
retroshare06 (0.6.1-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
||||||
|
|
||||||
|
Release of version 0.6.1.
|
||||||
|
* See detailed logs: https://github.com/RetroShare/RetroShare/blob/master/build_scripts/Debian%2BUbuntu/changelog
|
||||||
|
* Release blog post: https://retroshareteam.wordpress.com
|
||||||
|
* Website: https://github.com/Retroshare/Retroshare/releases
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Wed, 31 Aug 2016 12:00:00 +0100
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.20160818.b9ac4f87) xenial; urgency=low
|
||||||
|
|
||||||
|
9780f1f Phenom Mon, 15 Aug 2016 12:00:44 +0200 Add AutoHide to RSImageBlockWidget
|
||||||
|
368a429 csoler Wed, 17 Aug 2016 09:40:16 +0200 fixed read_125Size and write_125Size according to RFC4880
|
||||||
|
4b11fb1 defnax Tue, 16 Aug 2016 22:26:48 +0200 update FeedReader icons
|
||||||
|
6682a7a defnax Tue, 16 Aug 2016 22:02:30 +0200 added new mainwindow icons for RetroShare.
|
||||||
|
4d5be7f csoler Tue, 16 Aug 2016 10:29:21 +0200 Merge pull request #476 from PhenomRetroShare/Add_FilterBannedInIdDialog
|
||||||
|
4572dc6 csoler Tue, 16 Aug 2016 10:22:00 +0200 Merge pull request #475 from PhenomRetroShare/Fix_RSTextBrowser_loadRessource_OnWindows
|
||||||
|
26cbb27 csoler Tue, 16 Aug 2016 10:20:30 +0200 Merge pull request #472 from PhenomRetroShare/Fix_ChangeImageBlockedIconOnRSTextBrowser
|
||||||
|
bb9f158 csoler Tue, 16 Aug 2016 10:05:38 +0200 Merge pull request #473 from PhenomRetroShare/Fix_RsCertificate_toStdString
|
||||||
|
81cd2e9 thunder2 Tue, 16 Aug 2016 09:09:19 +0200 Fixed MSYS2 compile (use correct bracket in pro file)
|
||||||
|
accd3ca Phenom Mon, 15 Aug 2016 19:05:00 +0200 Fix RsTextBrowser::loadRessource on Windows.
|
||||||
|
dd2e4c3 Phenom Mon, 15 Aug 2016 12:11:56 +0200 Change Image Blocked Icon On RSTextBrowser
|
||||||
|
38a9e10 Phenom Mon, 15 Aug 2016 14:19:29 +0200 Fix RsCertificate::toStdString by fixing PGPKeyParser::read_125Size.
|
||||||
|
df44f50 Phenom Mon, 15 Aug 2016 19:53:43 +0200 Add Banned Filter in IdDialog.
|
||||||
|
b8158a4 Thunder Mon, 15 Aug 2016 19:54:52 +0200 Merge pull request #474 from PhenomRetroShare/Fix_MSys2WindowsCompilation
|
||||||
|
3200ea5 Phenom Mon, 15 Aug 2016 16:16:46 +0200 Fix MSys2 Windows Compilation after #f1847a9 commit.
|
||||||
|
3640e32 thunder2 Mon, 15 Aug 2016 11:49:36 +0200 Updated build of external libraries for Windows compile
|
||||||
|
f1847a9 thunder2 Sun, 14 Aug 2016 14:11:01 +0200 Changed check for MSYS2 environment for Windows compile
|
||||||
|
b0b4320 defnax Sat, 13 Aug 2016 16:20:58 +0200 decrease chat bar widget icon size
|
||||||
|
c01f5a3 defnax Sat, 13 Aug 2016 13:16:35 +0200 Merge pull request #468 from PhenomRetroShare/Add_ChatLoadEmbeddedImagesOption
|
||||||
|
fcad9d9 Phenom Sat, 13 Aug 2016 10:42:42 +0200 Fix RSTextBrowser::loadResource if image comes from stylesheet.
|
||||||
|
f71aad4 Phenom Tue, 9 Aug 2016 23:32:25 +0200 Add Chat Load Embedded Images Option like forum and message.
|
||||||
|
0e1c0c2 defnax Fri, 12 Aug 2016 22:19:44 +0200 Added search filter for participants list.
|
||||||
|
ab82c4a csoler Fri, 12 Aug 2016 15:24:40 +0200 added missing return in PGPKeyUtil, causing corruption of keys in some--possible rare--situations
|
||||||
|
81d42f0 thunder2 Fri, 12 Aug 2016 14:14:09 +0200 Fixed MSYS2AUTOMAKE path in msys2_build_libs/Makefile
|
||||||
|
f3b8843 thunder2 Fri, 12 Aug 2016 10:03:47 +0200 Fixed QMAKE_PRE_LINK for Windows compile without MSYS2
|
||||||
|
1fe7dce defnax Wed, 10 Aug 2016 00:22:23 +0200 Set icons for the voting combo box
|
||||||
|
d1645e9 defnax Tue, 9 Aug 2016 19:38:56 +0200 moved auto-ban checkbox to a better position
|
||||||
|
aaf13eb csoler Tue, 9 Aug 2016 10:47:08 +0200 Merge pull request #466 from PhenomRetroShare/Fix_RsCollEditorCountUpdateWhenRemove
|
||||||
|
32db280 csoler Tue, 9 Aug 2016 10:35:01 +0200 Merge pull request #459 from PhenomRetroShare/Add_CreateNewGXSIDInGenCertDialog
|
||||||
|
275c47e Phenom Tue, 9 Aug 2016 01:22:14 +0200 Add Title when ask for password.
|
||||||
|
6edd7bb Phenom Sat, 6 Aug 2016 17:15:56 +0200 Add possibility to create GXSId directly on GenCertDialog.
|
||||||
|
6db747a csoler Mon, 8 Aug 2016 22:19:38 +0200 Merge pull request #467 from PhenomRetroShare/Fix_NATStatusLED
|
||||||
|
c2c8893 csoler Mon, 8 Aug 2016 22:18:32 +0200 Merge pull request #462 from PhenomRetroShare/Add_CaseSensitiveOptionForLobbyNotify
|
||||||
|
0b1f08a csoler Mon, 8 Aug 2016 22:12:55 +0200 Merge pull request #461 from PhenomRetroShare/Add_CommentNumberOnButton
|
||||||
|
723d96b csoler Mon, 8 Aug 2016 22:11:10 +0200 Merge pull request #460 from PhenomRetroShare/Fix_LobbyNotifyIcon
|
||||||
|
9c601dc csoler Mon, 8 Aug 2016 22:10:01 +0200 Merge pull request #463 from PhenomRetroShare/Fix_ImageBlockOnRsTextBrowser
|
||||||
|
d59f7a0 Phenom Mon, 8 Aug 2016 21:59:12 +0200 Fix NAT Status LED
|
||||||
|
ee368ef Phenom Mon, 8 Aug 2016 20:45:35 +0200 Fix RsCollection Editor Count Update When Removing items.
|
||||||
|
c0c7ede csoler Mon, 8 Aug 2016 20:14:05 +0200 Merge pull request #464 from G10h4ck/libresapilocal
|
||||||
|
600e2d6 csoler Mon, 8 Aug 2016 20:11:21 +0200 Merge pull request #465 from PhenomRetroShare/Fix_RsGxsNetService_handleRecvPublishKeys_grpMeta_NULL
|
||||||
|
72d7435 Phenom Mon, 8 Aug 2016 19:05:42 +0200 Fix RsGxsNetService::handleRecvPublishKeys when grpMeta is NULL
|
||||||
|
183ac22 Gio Mon, 8 Aug 2016 14:02:01 +0200 ApiServerLocal run on it's own thread to avoid stopping UI ApiLocalConnectionHandler can now handle both buffered (QLocalSocket based) and unbuffered (like ncat or simple scripts) clients
|
||||||
|
88407e6 Phenom Sun, 7 Aug 2016 19:41:44 +0200 Fix Image Block on RSTextBrowser.
|
||||||
|
d048270 Phenom Sun, 7 Aug 2016 19:00:23 +0200 Add Case Sensitive option for Lobby Notify.
|
||||||
|
ea6bbac Phenom Sun, 7 Aug 2016 14:40:04 +0200 Add Comment Number On Button.
|
||||||
|
dea776a defnax Sat, 6 Aug 2016 18:35:07 +0200 Moved font menu to Settings menu
|
||||||
|
776e404 Phenom Sat, 6 Aug 2016 17:52:12 +0200 Fix Lobby Notify Icon.
|
||||||
|
9f14103 csoler Sat, 6 Aug 2016 15:47:23 +0200 Merge pull request #458 from PhenomRetroShare/Fix_QMessageBoxAddWidget
|
||||||
|
329a7e7 csoler Sat, 6 Aug 2016 15:46:01 +0200 Merge pull request #456 from PhenomRetroShare/Fix_ForumItemSortOnLastView
|
||||||
|
21bd8cd Phenom Sat, 6 Aug 2016 13:49:39 +0200 Fix QMessageBox layout addWidget.
|
||||||
|
beab81e Phenom Sat, 6 Aug 2016 11:57:20 +0200 Fix Forum Item sort on LastPost View.
|
||||||
|
f3d1a6c defnax Fri, 5 Aug 2016 19:13:59 +0200 Added missed notify icon
|
||||||
|
ac73fd9 defnax Fri, 5 Aug 2016 01:01:56 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
e2bb477 defnax Fri, 5 Aug 2016 01:00:53 +0200 Added new blue icon set for Chat Widget (icons by Beluga) svg ad png Format
|
||||||
|
96e73b3 csoler Thu, 4 Aug 2016 22:38:59 +0200 Merge pull request #454 from csoler/v0.6-ContactList
|
||||||
|
cd433e8 csoler Thu, 4 Aug 2016 22:33:45 +0200 fixed bug causing uninitialised memory read in reputation changing
|
||||||
|
5a55de5 csoler Thu, 4 Aug 2016 22:01:11 +0200 added missing DontUseNativeDialog flag in misc.cpp
|
||||||
|
46d4863 defnax Thu, 4 Aug 2016 19:50:00 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
e2d29f6 defnax Thu, 4 Aug 2016 19:46:20 +0200 update icons
|
||||||
|
3993fbf csoler Thu, 4 Aug 2016 16:10:00 +0200 fixed auto-positive opinions for contacts
|
||||||
|
c757630 csoler Thu, 4 Aug 2016 13:12:55 +0200 added callback in RsGenExchange subclasses to autorise new groups, to be used by p3GxsIdentity
|
||||||
|
7545ad4 csoler Thu, 4 Aug 2016 11:43:35 +0200 simplied/improved reputation system. Now ids can be banned based on their owner node using a single checkbox in the Person tab, with immediate effect
|
||||||
|
70228ee csoler Thu, 4 Aug 2016 11:02:12 +0200 fixed missign return, probably causing crashes
|
||||||
|
48b2e05 csoler Wed, 3 Aug 2016 19:56:49 +0200 Merge pull request #453 from G10h4ck/libresapilocal
|
||||||
|
c4ef4d7 csoler Tue, 2 Aug 2016 23:57:11 +0200 saved owner node ID in GXS reputation item
|
||||||
|
353308e Gio Wed, 3 Aug 2016 14:35:45 +0200 ApiLocalConnectionHandler class quit() at the end outside if
|
||||||
|
60cf299 csoler Wed, 3 Aug 2016 08:46:15 +0200 Merge pull request #436 from G10h4ck/libresapilocal
|
||||||
|
e4e29c5 Gio Wed, 3 Aug 2 016 00:50:49 +0200 quit ApiLocalConnectionHandler after replying API query
|
||||||
|
17003f1 csoler Tue, 2 Aug 2016 16:25:00 +0200 modified wrong comment in why mLastPost should not be used in rsgxsnetservice.cc, and added a call to clearing GrpMeta cache when new msg in that group are received
|
||||||
|
3cd90ae csoler Mon, 1 Aug 2016 16:35:19 +0200 re-disabled the code to update the server TS to last post as it can severely perturbate the distribution of posts. Added a call to update msgServerUpdateMap when new messages received
|
||||||
|
d6be440 csoler Mon, 1 Aug 2016 15:38:51 +0200 re-enabled some code previously disabled in last commit
|
||||||
|
b1288bc csoler Mon, 1 Aug 2016 14:43:17 +0200 added missing time stamp of msgServerUpdateMap when posting a new message
|
||||||
|
5fac5a8 csoler Sun, 31 Jul 2016 22:14:23 +0200 moved all getOpenFilename to use misc::getOpenFilename
|
||||||
|
c643d1e csoler Sun, 31 Jul 2016 22:07:43 +0200 Merge pull request #451 from PhenomRetroShare/Fix_ImportExportCertASC
|
||||||
|
d000d75 Phenom Sun, 31 Jul 2016 21:03:45 +0200 Fix Import and Export Cert file *.asc.
|
||||||
|
edce1e9 csoler Sun, 31 Jul 2016 17:47:50 +0200 Merge pull request #449 from PhenomRetroShare/Add_RemoveDuplicateCBInRSCollEditor
|
||||||
|
6e25a30 csoler Sun, 31 Jul 2016 17:21:12 +0200 Merge pull request #450 from PhenomRetroShare/Fix_QFileDialogDontUseNativeDialog
|
||||||
|
6935441 Phenom Sun, 31 Jul 2016 16:23:41 +0200 Fix other QFileDialog call in misc adding DontUseNativeDialog option.
|
||||||
|
0317904 Phenom Sun, 31 Jul 2016 16:08:15 +0200 Add Remove Duplicate checkbox in RsCollection editor.
|
||||||
|
64b5609 csoler Sun, 31 Jul 2016 11:52:23 +0200 Merge pull request #448 from PhenomRetroShare/Fix_IdDialogContextMenuShownAtStartUp
|
||||||
|
998fede Phenom Sun, 31 Jul 2016 11:15:47 +0200 Fix IdDialog ContextMenu shown at startup.
|
||||||
|
3721055 csoler Sat, 30 Jul 2016 21:15:08 +0200 Merge pull request #447 from PhenomRetroShare/Fix_IdChooserInSignedLobby
|
||||||
|
bef7db4 Phenom Sat, 30 Jul 2016 19:14:59 +0200 Fix IdChooser in Signed Lobby.
|
||||||
|
2921d9e csoler Sat, 30 Jul 2016 15:26:27 +0200 Merge pull request #445 from PhenomRetroShare/Add_MergeDisplayMenuToHeaderContextMenu
|
||||||
|
2126234 csoler Sat, 30 Jul 2016 15:25:30 +0200 Merge pull request #446 from PhenomRetroShare/Fix_FriendListSortGPGItem
|
||||||
|
46e4b3b Phenom Sat, 30 Jul 2016 13:58:02 +0200 Fix FriendList sorting when expand PGPItem sorted by LastContact or IP
|
||||||
|
ae9ab64 Phenom Sat, 30 Jul 2016 13:27:23 +0200 Move Display button's menu to Header context menu on FriendList.
|
||||||
|
d62f8a4 defnax Fri, 29 Jul 2016 23:21:46 +0200 Fixed stylesheet
|
||||||
|
032bcf7 defnax Fri, 29 Jul 2016 23:14:46 +0200 Fixed Stylesheets
|
||||||
|
b1dcd2f csoler Fri, 29 Jul 2016 22:02:57 +0200 Merge pull request #444 from PhenomRetroShare/Add_MergeFilterIdFilterToHeaderContextMenu
|
||||||
|
1707c07 csoler Fri, 29 Jul 2016 21:58:31 +0200 added DontUseNativeDialog as default flag in file dialog in order to avoid some crashed when not using it
|
||||||
|
d3beccf Phenom Fri, 29 Jul 2016 20:54:26 +0200 Merge Filter ComboBox to Header Context Menu in IdDialog.
|
||||||
|
431dd68 defnax Fri, 29 Jul 2016 17:29:54 +0200 Temporary solution for the Filter Combobox it takes to much space, no space more for search filter,moved under the ToolBar.
|
||||||
|
7c2e2bd Gio Thu, 28 Jul 2016 17:24:17 +0200 take in account that QLocalSocket is of type STREAM so it doesn't emit readyRead event for each write() on the other side
|
||||||
|
fe7de83 Gio Thu, 28 Jul 2016 14:08:49 +0200 WebUI is now optional but enabled by default at compile time
|
||||||
|
c73be93 csoler Tue, 26 Jul 2016 16:06:03 +0200 removed anti-spam message that has become irrelevant
|
||||||
|
da8a520 csoler Mon, 25 Jul 2016 16:07:53 -0400 Merge pull request #442 from csoler/v0.6-ContactList
|
||||||
|
ed05ec7 csoler Mon, 25 Jul 2016 16:06:28 -0400 fixed text in People tab
|
||||||
|
f5e55e8 csoler Mon, 25 Jul 2016 16:04:30 -0400 fixed a few bugs in the People tab
|
||||||
|
2189771 csoler Mon, 25 Jul 2016 15:45:49 -0400 added two new options to people page for handlign reputations: change the ban limit from friend opinions, and allow to auto-set positive opinions to contacts
|
||||||
|
efd503e csoler Mon, 25 Jul 2016 14:56:55 -0400 removed the possibility of GXS groups to keep track of post origin before release, as it is too intrusive as compared to the benefits
|
||||||
|
35c01e5 csoler Fri, 22 Jul 2016 21:10:54 -0400 updated translation files
|
||||||
|
1a4d400 csoler Fri, 22 Jul 2016 20:40:42 -0400 updated changlog
|
||||||
|
e5d9bd5 csoler Fri, 22 Jul 2016 20:39:55 -0400 Merge pull request #441 from PhenomRetroShare/Fix_PostedFeedItemWithComments
|
||||||
|
7c7da7e Phenom Sat, 23 Jul 2016 01:48:23 +0200 Fix Posted Feed Item when received comment.
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Wed, 18 Aug 2016 16:00:00 +0100
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.20160722~daf54dff) precise; urgency=low
|
||||||
|
|
||||||
|
daf54df csoler Fri, 22 Jul 2016 17:49:07 -0400 fixed missing RsGxsGrpMeta cache update when updating grp meta, which caused unstable group flags/name/perms update
|
||||||
|
95edc5b csoler Fri, 22 Jul 2016 10:06:24 -0400 fixed variable name problem in ServerPage (with no consequences)
|
||||||
|
713deac csoler Sat, 16 Jul 2016 18:39:36 -0400 time-stamping newly received GXS ids
|
||||||
|
95202d6 csoler Sat, 16 Jul 2016 18:26:04 -0400 removed possible double free() of buf in parse_headers (suggestion by GuessWho)
|
||||||
|
71168c7 csoler Fri, 15 Jul 2016 22:47:35 -0400 drop net ID request when peer list is empty
|
||||||
|
8fdd255 csoler Fri, 15 Jul 2016 22:28:36 -0400 improved strategy for merging pending ID load requests, fixing bug in previous commit
|
||||||
|
59d0859 csoler Fri, 15 Jul 2016 22:25:15 -0400 fixed compilation in tests
|
||||||
|
9fd44a5 csoler Fri, 15 Jul 2016 19:28:54 -0400 Merge pull request #437 from PhenomRetroShare/Fix_UnitTests
|
||||||
|
9126076 csoler Fri, 15 Jul 2016 17:09:22 -0400 removed debug info in p3IdService and RsGxsNetService
|
||||||
|
90dfc6e csoler Fri, 15 Jul 2016 16:59:57 -0400 improved explicit requests of missing GXS ids, also fixing situations where empty peers lists would wipe out pe
|
||||||
|
3152eca Phenom Fri, 15 Jul 2016 15:03:41 +0200 Fix UnitTests and run it in windows too.
|
||||||
|
8ccfee2 csoler Tue, 12 Jul 2016 22:49:21 -0400 Merge pull request #434 from csoler/v0.6-LocalCircles
|
||||||
|
c555300 csoler Tue, 12 Jul 2016 22:45:23 -0400 fixed merging with upstream
|
||||||
|
c7e60d0 csoler Tue, 12 Jul 2016 22:42:19 -0400 removed debug info in rsgxsnetservice
|
||||||
|
ed523e8 csoler Mon, 11 Jul 2016 22:44:15 -0400 fixed backend for locl circles
|
||||||
|
931c3df csoler Mon, 11 Jul 2016 21:33:09 -0400 fixed display of group node restriction in GxsGroupDialog and info
|
||||||
|
a7d82cf csoler Mon, 11 Jul 2016 18:44:52 -0400 delete GXS IDs with no TS
|
||||||
|
45b189c csoler Mon, 11 Jul 2016 18:30:12 -0400 removed EXTERNAL/PERSONNAL options from GxsCircleChooser
|
||||||
|
951f29f csoler Sun, 10 Jul 2016 23:00:47 -0400 removed debug info in rsDataService
|
||||||
|
95915fa csoler Sun, 10 Jul 2016 22:46:37 -0400 removed cross deadlock between p3GxsReputation and p3IdService
|
||||||
|
d089e2e csoler Sat, 9 Jul 2016 18:06:59 -0400 added a GroupChooser class to choose groups of friend nodes
|
||||||
|
0125f91 csoler Wed, 6 Jul 2016 22:36:59 -0400 fixed deserialise bug in FileItem
|
||||||
|
a69629c csoler Wed, 6 Jul 2016 22:16:05 -0400 added missing own id from group list, and removed possible duplicates in random group ids
|
||||||
|
269f945 csoler Wed, 6 Jul 2016 22:02:56 -0400 fixed load/save of new group ids and backward compatibility with FriendList
|
||||||
|
01c0d2f csoler Tue, 5 Jul 2016 23:49:43 -0400 finished conversion to RsNodeGroupId for file transfer and GUI
|
||||||
|
1c277ab csoler Tue, 5 Jul 2016 23:47:55 -0400 Merge pull request #433 from csoler/v0.6-SqlCache
|
||||||
|
4ee9eff csoler Mon, 4 Jul 2016 23:55:48 -0400 changed internal storage of groups of friend nodes so as to use an abstract ID instead of a string (phase 1 of l
|
||||||
|
42f2210 csoler Sun, 3 Jul 2016 23:15:05 -0400 removed debug info in IdDialog
|
||||||
|
218ca45 csoler Sun, 3 Jul 2016 23:12:56 -0400 removed some debug info in rsdataservice
|
||||||
|
09ad539 csoler Sun, 3 Jul 2016 22:02:23 -0400 fixed red color in IdDialog
|
||||||
|
9f9f021 csoler Sun, 3 Jul 2016 22:02:04 -0400 remved debug output in udlstck
|
||||||
|
c98416d csoler Sun, 3 Jul 2016 18:59:30 -0400 added auto-cleaning of reputation info for outdated/removed identities
|
||||||
|
bf28ea7 csoler Sun, 3 Jul 2016 18:49:02 -0400 removed debug info in udpstack.cc
|
||||||
|
692293e csoler Sun, 3 Jul 2016 18:12:50 -0400 added red color to banned identities in IdDialog
|
||||||
|
e611b2b csoler Sun, 3 Jul 2016 18:06:01 -0400 moved isIdentitybanned from p3GxsReputations to p3IdService, so as to avoid calling back p3IdService from p3GxsR
|
||||||
|
720c6fd csoler Sat, 2 Jul 2016 22:41:12 -0400 fixed bug causing TS update of some unused identities
|
||||||
|
86d8f01 csoler Fri, 1 Jul 2016 23:38:10 -0400 added a local cache in rsdataservice to avoid calling sqlcipher on GrpMetaData
|
||||||
|
cdd2c1f csoler Thu, 30 Jun 2016 16:50:35 -0400 Merge pull request #432 from G10h4ck/master
|
||||||
|
da4c563 Gio Thu, 30 Jun 2016 22:03:22 +0200 Fix typo in libresapi documentation
|
||||||
|
0206c65 csoler Thu, 30 Jun 2016 15:06:41 -0400 added missing else in display of forum anti-spam message
|
||||||
|
2dfe116 csoler Thu, 30 Jun 2016 14:21:54 -0400 added compilation flag for profiling in GUI
|
||||||
|
ef95451 csoler Tue, 28 Jun 2016 21:16:31 -0400 updated changelog
|
||||||
|
440390e csoler Thu, 30 Jun 2016 14:21:11 -0400 Merge pull request #431 from csoler/v0.6-SignedForums3
|
||||||
|
ba50028 csoler Thu, 30 Jun 2016 14:16:45 -0400 added GXS distribution flag to defavor posts signed by key form unknown RS nodes, and updated UI in forums to u
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Mon, 18 Jul 2016 22:00:00 -0500
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.20160628~18eb34b8) trusty; urgency=low
|
||||||
|
|
||||||
|
9f7ef8b csoler Tue, 28 Jun 2016 20:59:56 -0400 fixed possible cross deadlocks between RsGxsGenExchange and RsGxsNetService
|
||||||
|
00bdc50 csoler Tue, 28 Jun 2016 17:56:37 -0400 updated changelog
|
||||||
|
bb82b6e csoler Tue, 28 Jun 2016 14:35:59 -0400 Merge pull request #429 from PhenomRetroShare/Fix_StandardQSS
|
||||||
|
456751a Phenom Tue, 28 Jun 2016 20:23:32 +0200 Fix ProgressBar Chunk with Standard.qss
|
||||||
|
019ed12 csoler Tue, 28 Jun 2016 12:37:04 -0400 Merge pull request #428 from sehraf/pr-fix-udp
|
||||||
|
ea07a13 sehraf Tue, 28 Jun 2016 17:37:22 +0200 fix TcpPacket::readPacket
|
||||||
|
c15c979 csoler Mon, 27 Jun 2016 17:17:28 +0100 Merge pull request #426 from sehraf/pr-disable-dht-stunner
|
||||||
|
ff86678 csoler Sun, 26 Jun 2016 23:14:01 -0400 clear error queue before calling SSL_read()/SSL_write(), to avoid remaining errors to corrupt the next connection attempts and cause disconnections
|
||||||
|
31089d7 csoler Sat, 25 Jun 2016 19:12:35 +0100 added auto-clean of pending data in pqistreamer after connection is closed, to avoid confusing the peer after re-connecting (probably not the cause of the SSL error)
|
||||||
|
043c5b1 csoler Sat, 25 Jun 2016 13:01:36 -0400 Merge pull request #427 from PhenomRetroShare/Fix_TheRetroSharesDeskTopFileIsMissing
|
||||||
|
e6347d7 Phenom Sat, 25 Jun 2016 11:09:28 +0200 Fix "!!!The RetroShare's desktop file is missing or wrong!!!" message for Linux.
|
||||||
|
5d96268 sehraf Tue, 21 Jun 2016 14:02:52 +0200 removed unused variable warnings
|
||||||
|
4d2d825 sehraf Tue, 21 Jun 2016 13:55:23 +0200 add new option to qmake to enable dht stunner removed dht stunner code when option is not set
|
||||||
|
37ae8bc csoler Tue, 21 Jun 2016 07:22:13 -0400 Merge pull request #424 from sehraf/pr-dht-banlist
|
||||||
|
3bb03ff sehraf Mon, 20 Jun 2016 22:30:51 +0200 Added new (optional) callback to libbitdht to ask upper layer if an IP is banned. In case this callback is implemented it will be used in favour of the built-in...
|
||||||
|
ddce43b csoler Sat, 18 Jun 2016 20:43:42 -0400 Merge pull request #422 from PhenomRetroShare/Fix_ReadMe.md
|
||||||
|
24eb88a csoler Sat, 18 Jun 2016 20:38:48 -0400 added explicit comparisons for tests on RsGxsGrpMetaData and RsGxsMsgMetaData
|
||||||
|
0388162 Phenom Sun, 19 Jun 2016 01:37:50 +0200 Change Build AppVeyor State to RetroShare/RetroShare.
|
||||||
|
bc04f3c csoler Sat, 18 Jun 2016 17:43:50 -0400 Merge pull request #421 from PhenomRetroShare/Fix_UnitTestCompilation
|
||||||
|
43f618f Phenom Sat, 18 Jun 2016 23:10:12 +0200 Fix UnitTest Compilation
|
||||||
|
07bda26 csoler Sat, 18 Jun 2016 16:27:15 -0400 fixed permission matrix widget crash
|
||||||
|
35da9cb csoler Sat, 18 Jun 2016 15:36:03 -0400 Merge pull request #419 from PhenomRetroShare/Fix_ChannelNewsFeedWhenComment
|
||||||
|
90a27f4 csoler Sat, 18 Jun 2016 15:33:10 -0400 Merge pull request #418 from sehraf/pr-improve-debug
|
||||||
|
d84fdff Phenom Sat, 18 Jun 2016 20:03:55 +0200 Fix GxsChannelPostItem when received comment.
|
||||||
|
3cf1968 sehraf Sat, 18 Jun 2016 18:04:18 +0200 fixed p3msgservice.cc
|
||||||
|
d8235c6 sehraf Sat, 18 Jun 2016 13:08:14 +0200 removed dead code and cleanup
|
||||||
|
09afbbe sehraf Sat, 18 Jun 2016 13:00:15 +0200 switched to new rslog method
|
||||||
|
7627bd9 csoler Fri, 17 Jun 2016 22:53:05 -0400 Merge pull request #417 from csoler/v0.6-SecurityKeys
|
||||||
|
f57f620 csoler Fri, 17 Jun 2016 22:27:00 -0400 reduced database testing/cleaning frequency to 31/59 mins.
|
||||||
|
eb05922 csoler Fri, 17 Jun 2016 22:21:06 -0400 added a tooltip and read color for unsecure GXS identities. These are still supported for a few weeks at most. So get rid of them
|
||||||
|
4df4bb6 csoler Fri, 17 Jun 2016 20:46:58 -0400 fixed removal of messages in unsubscribed groups
|
||||||
|
886d896 csoler Fri, 17 Jun 2016 20:46:24 -0400 fixed warning about old fingerprint for own keys.
|
||||||
|
f6c5a05 sehraf Fri, 17 Jun 2016 11:09:59 +0200 switched to caller providing all needed information instead of saving those on callee side
|
||||||
|
cc6ae74 csoler Thu, 16 Jun 2016 23:17:40 -0400 fixed color of admin circles (we cannot use a bullet, since bullets are kept for Membership property)
|
||||||
|
4d452bf csoler Thu, 16 Jun 2016 18:34:33 -0400 removed annoying warning in avatar widget
|
||||||
|
c25b650 csoler Thu, 16 Jun 2016 23:10:13 -0400 removed check key debug info
|
||||||
|
25c0c9d csoler Thu, 16 Jun 2016 23:06:07 -0400 added systematic consistency checking of public/private RSA keys at deserialisation time
|
||||||
|
b9ba51f csoler Thu, 16 Jun 2016 22:23:27 -0400 improved naming of publish/admin rights in GroupTreeWidget
|
||||||
|
8d54603 csoler Thu, 16 Jun 2016 21:27:28 -0400 fixed bug in private key extraction
|
||||||
|
dbd78d2 csoler Thu, 16 Jun 2016 20:19:03 -0400 merged with upstream/master
|
||||||
|
e28e972 sehraf Thu, 16 Jun 2016 21:26:02 +0200 removed dead code
|
||||||
|
70662cf defnax Thu, 16 Jun 2016 18:41:56 +0200 Fixed some layout spacing
|
||||||
|
656e7eb csoler Wed, 15 Jun 2016 23:27:30 -0400 Merge pull request #415 from PhenomRetroShare/Add_BuildStatusInReadme.md
|
||||||
|
c7da734 csoler Wed, 15 Jun 2016 21:38:14 -0400 Merge pull request #416 from csoler/v0.6-ContactList
|
||||||
|
e63f936 csoler Wed, 15 Jun 2016 21:33:27 -0400 improved strategy for removal of unused GXS ids with proper constants for unknown/signed/known ids. Forbid the stamping of banned keys.
|
||||||
|
da11995 defnax Wed, 15 Jun 2016 23:32:01 +0200 Clean up the Chat Toolbar Buttons Fixed display of Info Text on PGg details
|
||||||
|
631a29c Phenom Wed, 15 Jun 2016 20:53:56 +0200 Add Build Status in ReadMe.md file. And add AppVeyor File.
|
||||||
|
6b74a8a csoler Tue, 14 Jun 2016 21:54:09 -0400 added missing call to ssl_pendign in pqissludp.
|
||||||
|
c3eba4a csoler Tue, 14 Jun 2016 21:53:48 -0400 added missing serialisation call for peer bandwidth limits
|
||||||
|
8c44e69 csoler Tue, 14 Jun 2016 21:53:06 -0400 added output of items which doesnot serialise correctly in pqisslstore
|
||||||
|
ceecdb2 csoler Tue, 14 Jun 2016 20:31:38 -0400 Merge pull request #414 from PhenomRetroShare/Add_MessageWhenSendingArgToOtherInstance
|
||||||
|
cedce2e csoler Tue, 14 Jun 2016 20:30:06 -0400 Merge pull request #260 from PhenomRetroShare/Add_SendAsPlainText_And_NoEmoteIcon_Button
|
||||||
|
69e98b8 defnax Wed, 15 Jun 2016 00:08:45 +0200 Added count Invited Members to Create Circles Dialog. Changed some context menu icons for People list and Circles tree. Added icon when im Cir
|
||||||
|
ddbcd21 Phenom Wed, 27 Jan 2016 20:27:44 +0100 Add buttons to send message in plain text and without EmoteIcon.
|
||||||
|
9b09187 Phenom Tue, 14 Jun 2016 15:10:15 +0200 Add message, when sending arguments to other instance, to disable this option.
|
||||||
|
56e0797 csoler Mon, 13 Jun 2016 23:06:10 -0400 Merge pull request #413 from csoler/v0.6-Circles
|
||||||
|
e03c5df csoler Mon, 13 Jun 2016 22:38:51 -0400 improved GUI layout in circle creation box. Added tooltips
|
||||||
|
600607d csoler Mon, 13 Jun 2016 22:14:09 -0400 added warning for old peers in circles
|
||||||
|
8b954a2 csoler Mon, 13 Jun 2016 18:08:05 -0400 added names to upnp redirects to avoid router confusion (patch from ET)
|
||||||
|
fa29dd7 csoler Sun, 12 Jun 2016 21:41:09 -0400 changed the way RsGxsSyncMsgReqItem are sent for circle-restricted groups, using a hash of the group ID instead of encrypting the whole item,
|
||||||
|
972de42 csoler Sat, 11 Jun 2016 18:07:57 -0400 converted static variable to class member in pqihandler
|
||||||
|
34f49d4 csoler Sat, 11 Jun 2016 18:07:07 -0400 removed compilation warning
|
||||||
|
248d0c4 csoler Sat, 11 Jun 2016 17:58:08 -0400 Merge pull request #412 from csoler/v0.6-MaxUpRate
|
||||||
|
ef4455a csoler Sat, 11 Jun 2016 17:54:11 -0400 cleaned the MaxUpRate branch from unused code
|
||||||
|
8e75185 csoler Sat, 11 Jun 2016 17:21:04 -0400 made avgReadCount and avgSendCound to be uint32_t instead of floats, since they count bytes. Changes kb to 1024 instead of 1000
|
||||||
|
eb9025d csoler Sat, 11 Jun 2016 17:20:22 -0400 removed annoying warning when a circle is empty
|
||||||
|
373d41b csoler Sat, 11 Jun 2016 14:11:21 -0400 added missing variable def after previous commit
|
||||||
|
23e8e93 csoler Sat, 11 Jun 2016 09:50:22 -0400 added mutex proteciton around mAvgLastUpdate to avoid it being changed by the constructor
|
||||||
|
0d1d31a csoler Sat, 11 Jun 2016 09:33:11 -0400 added mutex protection around pqistreamer::getRates, since float r/w are not necessarily atomic
|
||||||
|
eba90a8 csoler Sat, 11 Jun 2016 09:24:33 -0400 Merge pull request #411 from PhenomRetroShare/Add_SIGFPE_Debug_DEFINES
|
||||||
|
afe23e7 csoler Sat, 11 Jun 2016 09:22:53 -0400 Merge pull request #410 from PhenomRetroShare/Fix_SIGFPE_InQProgressBar_PrintEvent
|
||||||
|
d649659 Phenom Sat, 11 Jun 2016 14:38:31 +0200 Add SIGFPE debug DEFINES.
|
||||||
|
08258ca Phenom Sat, 11 Jun 2016 14:23:26 +0200 Fix SIGFPE in QProgressBar::paintEvent
|
||||||
|
d1be3f3 defnax Fri, 10 Jun 2016 13:40:24 +0200 Set a minimum column width
|
||||||
|
83a1434 csoler Thu, 9 Jun 2016 23:23:51 -0400 fixed bug in setting MaxRate values
|
||||||
|
f5ad8b4 csoler Thu, 9 Jun 2016 23:13:07 -0400 moved node-wide options to node details
|
||||||
|
a4931ed csoler Thu, 9 Jun 2016 20:51:09 -0400 fixed setting/getting maxrates using pgp id
|
||||||
|
a07805b csoler Thu, 9 Jun 2016 20:41:27 -0400 moved bandwidth limits to the pgp level
|
||||||
|
38b86c3 csoler Thu, 9 Jun 2016 18:12:04 -0400 improved debug output for early address rejection
|
||||||
|
6b78275 csoler Wed, 8 Jun 2016 22:54:40 -0400 fixed bug in loading config file to set max rates
|
||||||
|
5a0fa66 csoler Wed, 8 Jun 2016 22:44:28 -0400 added proper talking between pqihandler and GUI for maxrates fixing
|
||||||
|
226e85c csoler Wed, 8 Jun 2016 21:00:26 -0400 added dropmenu entry in circles to allow admin to grant/deny membership
|
||||||
|
509266a csoler Tue, 7 Jun 2016 22:38:24 -0400 removed some dead code
|
||||||
|
a1bbcd8 csoler Tue, 7 Jun 2016 22:06:32 -0400 fixed a few small issues in new peer rates
|
||||||
|
20b6745 csoler Tue, 7 Jun 2016 21:48:22 -0400 added GUI and storage for max up/dn rates per peer
|
||||||
|
0e85709 csoler Tue, 7 Jun 2016 11:00:34 -0400 Merge pull request #409 from sehraf/pr-upnp-version
|
||||||
|
2d5883c sehraf Tue, 7 Jun 2016 16:30:39 +0200 add UPnP lib version
|
||||||
|
1c1b7ac csoler Mon, 6 Jun 2016 22:55:23 -0400 attempt at fixing the crash when quitting RS (due to operator new not being able to allocate memory from deleted allocator
|
||||||
|
54a0ca4 csoler Sun, 5 Jun 2016 15:49:33 -0400 added line in circle tooltip for visibility. Re-worked tooltip text a little bit
|
||||||
|
ee25596 csoler Sun, 5 Jun 2016 15:20:48 -0400 updated tooltip and names for self-restricted circles to "private"
|
||||||
|
195ad4e csoler Sun, 5 Jun 2016 15:15:40 -0400 use grey bullet as a placeholder for circles without pending operations
|
||||||
|
456b57b csoler Sun, 5 Jun 2016 13:17:30 -0400 Merge pull request #205 from pztrn/master
|
||||||
|
9f2d6bd csoler Sun, 5 Jun 2016 13:02:13 -0400 Merge pull request #259 from heini/rhel_fedora_qt5
|
||||||
|
e2e9ede csoler Sun, 5 Jun 2016 11:51:47 -0400 fixed initialization of memebrs in peerDetails
|
||||||
|
f1d69ad csoler Sun, 5 Jun 2016 11:26:29 -0400 Merge pull request #351 from PhenomRetroShare/Add_WebUI_ClearButtonOnBradCast
|
||||||
|
f55b283 csoler Sun, 5 Jun 2016 11:05:52 -0400 second pass over compilation warnings
|
||||||
|
927f782 csoler Sun, 5 Jun 2016 10:43:57 -0400 pass over compiler warnings
|
||||||
|
c2ae4fc csoler Sun, 5 Jun 2016 10:06:11 -0400 merged upstream/master
|
||||||
|
2567feb csoler Sun, 5 Jun 2016 09:54:26 -0400 fixed compilation broken by using deprecated Qt method
|
||||||
|
a2ca038 csoler Sat, 4 Jun 2016 21:39:40 -0400 fixed compilation and several problems following separation of public/private keys
|
||||||
|
0eb4e9e defnax Sat, 4 Jun 2016 21:27:20 +0200 - renamed label "restricted to group" to "restricted to circle" - changed icon
|
||||||
|
b2497cc csoler Sat, 4 Jun 2016 09:45:17 -0400 Merge pull request #406 from sehraf/pr-fixes-#2
|
||||||
|
24f619d csoler Sat, 4 Jun 2016 03:20:45 +0200 added missing include for debian squeeze
|
||||||
|
d8189d0 csoler Fri, 3 Jun 2016 21:11:12 -0400 moved placeholder text from .ui to .cpp to allow compilation with old Qt
|
||||||
|
99f54a2 defnax Fri, 3 Jun 2016 19:16:59 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
4300d87 defnax Fri, 3 Jun 2016 19:15:24 +0200 Set default Header Stylesheet for Circles
|
||||||
|
814db7e csoler Fri, 3 Jun 2016 19:15:16 +0200 fixed possible uninitialised memory read
|
||||||
|
4c986cd csoler Fri, 3 Jun 2016 19:03:10 +0200 attempt to fix the pthread_setname_np symbol issue. To be tested
|
||||||
|
0d10603 sehraf Fri, 3 Jun 2016 09:02:19 +0200 fix build errors (return typ is a pointer and not boolean)
|
||||||
|
590be09 csoler Thu, 2 Jun 2016 23:47:57 -0400 separated RsTlvSecurityKey into two incompatible classes to enforce the correct usage of private vs. public keys
|
||||||
|
53eb4df csoler Thu, 2 Jun 2016 21:21:18 -0400 fixed compilation errors due to last merge operation
|
||||||
|
e2b5785 csoler Thu, 2 Jun 2016 21:15:51 -0400 merged PR403 with trunk
|
||||||
|
10e0254 csoler Thu, 2 Jun 2016 20:23:22 -0400 fixed a few things to correct PR403
|
||||||
|
699b3cf csoler Thu, 2 Jun 2016 20:38:28 -0400 Merge pull request #402 from PhenomRetroShare/Fix_WindowsCompilationWithMksTemp
|
||||||
|
5362fd3 csoler Thu, 2 Jun 2016 20:36:51 -0400 Merge pull request #401 from PhenomRetroShare/Fix_WindowsCompilationWithThreadName
|
||||||
|
6f5693d csoler Thu, 2 Jun 2016 18:26:43 -0400 Merge pull request #405 from PhenomRetroShare/Fix_UnitTestsCompilation
|
||||||
|
2c8d047 Phenom Thu, 2 Jun 2016 19:34:58 +0200 Fix UnitTests Compilation
|
||||||
|
2f4f44e csoler Thu, 2 Jun 2016 09:36:50 -0400 added early discarding of incoming connection attempt (before SSL handshake) for blacklisted IPs
|
||||||
|
6e38554 sehraf Thu, 2 Jun 2016 13:22:24 +0200 rename define UBUNTU to HAS_GNOME_KEYRING The name UBUNTU is misleading since it is only used to select the keyring backend (which is gnome key
|
||||||
|
4f60c8c sehraf Thu, 2 Jun 2016 14:53:15 +0200 libretroshare: fix comparison between signed and unsigned integer
|
||||||
|
8b788b2 sehraf Thu, 2 Jun 2016 14:44:33 +0200 libretroshare: fix member initialisation order
|
||||||
|
cfc0e70 sehraf Thu, 2 Jun 2016 14:42:32 +0200 libretroshare: remove unused variables
|
||||||
|
005af47 Phenom Wed, 1 Jun 2016 22:37:05 +0200 Fix Compilation when mkstemp is not defined.
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Mon, 20 Jun 2016 14:00:00 -0500
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.20160601.1f8a6ee2~trusty) trusty; urgency=low
|
||||||
|
|
||||||
cbef014 csoler Sun, 29 May 2016 16:09:56 -0400 added regular test of circle auto-subscribe from cache, and auto-subscribe w
|
cbef014 csoler Sun, 29 May 2016 16:09:56 -0400 added regular test of circle auto-subscribe from cache, and auto-subscribe w
|
||||||
2bde81f csoler Sat, 28 May 2016 21:09:44 -0400 removed more debug info, improved tooltips
|
2bde81f csoler Sat, 28 May 2016 21:09:44 -0400 removed more debug info, improved tooltips
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
###################### PARAMETERS ####################
|
###################### PARAMETERS ####################
|
||||||
version="0.6.0"
|
version="0.6.1"
|
||||||
gitpath="https://github.com/RetroShare/RetroShare.git"
|
gitpath="https://github.com/RetroShare/RetroShare.git"
|
||||||
workdir=retroshare06-${version}
|
workdir=retroshare06-${version}
|
||||||
#bubba3="Y" # comment out to compile for bubba3
|
#bubba3="Y" # comment out to compile for bubba3
|
||||||
@ -47,7 +47,7 @@ while [ ${#} -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if test "${dist}" = "" ; then
|
if test "${dist}" = "" ; then
|
||||||
dist="precise trusty vivid wily xenial"
|
dist="precise trusty vivid wily xenial wheezy squeeze jessie stretch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Attempting to get revision number...
|
echo Attempting to get revision number...
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
Apply dput ppa:retroshare/unstable retroshare06_0.6.0-1.#.changes
|
for i in `ls retroshare06_0.6.0-1.*.changes` ; do
|
||||||
|
dput ppa:retroshare/unstable $i
|
||||||
|
done
|
||||||
|
6
build_scripts/Windows/build_libs/.gitignore
vendored
Normal file
6
build_scripts/Windows/build_libs/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/download
|
||||||
|
/msys
|
||||||
|
/libs
|
||||||
|
/tools/7z.dll
|
||||||
|
/tools/7z.exe
|
||||||
|
/tools/curl.exe
|
43
build_scripts/Windows/build_libs/1-prepare.bat
Normal file
43
build_scripts/Windows/build_libs/1-prepare.bat
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
@setlocal
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Initialize environment
|
||||||
|
call "%~dp0_env.bat"
|
||||||
|
|
||||||
|
set SevenZipUrl=http://7-zip.org/a/7z1602.msi
|
||||||
|
set SevenZipInstall=7z1602.msi
|
||||||
|
set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z
|
||||||
|
set CurlInstall=curl-7.50.1-win32-mingw.7z
|
||||||
|
|
||||||
|
if not exist "%DownloadPath%" mkdir "%DownloadPath%"
|
||||||
|
|
||||||
|
call :remove_dir "%TempPath%"
|
||||||
|
|
||||||
|
echo Download installation files
|
||||||
|
if not exist "%DownloadPath%\%SevenZipInstall%" call "%ToolsPath%\winhttpjs.bat" %SevenZipUrl% -saveTo "%DownloadPath%\%SevenZipInstall%"
|
||||||
|
if not exist "%DownloadPath%\%SevenZipInstall%" echo Cannot download 7z& goto :exit
|
||||||
|
|
||||||
|
if not exist "%DownloadPath%\%CurlInstall%" call "%ToolsPath%\winhttpjs.bat" %CurlUrl% -saveTo "%DownloadPath%\%CurlInstall%"
|
||||||
|
if not exist "%DownloadPath%\%CurlInstall%" echo Cannot download Curl& goto :exit
|
||||||
|
|
||||||
|
echo Unpack 7z
|
||||||
|
msiexec /a "%DownloadPath%\%SevenZipInstall%" /qb TARGETDIR="%TempPath%"
|
||||||
|
copy "%TempPath%\Files\7-Zip\7z.dll" "%ToolsPath%"
|
||||||
|
copy "%TempPath%\Files\7-Zip\7z.exe" "%ToolsPath%"
|
||||||
|
call :remove_dir "%TempPath%"
|
||||||
|
|
||||||
|
echo Unpack Curl
|
||||||
|
"%SevenZipExe%" x -o"%TempPath%" "%DownloadPath%\%CurlInstall%"
|
||||||
|
copy "%TempPath%\curl-7.50.1-win32-mingw\bin\curl.exe" "%ToolsPath%"
|
||||||
|
call :remove_dir "%TempPath%"
|
||||||
|
|
||||||
|
:exit
|
||||||
|
endlocal
|
||||||
|
exit /B 0
|
||||||
|
|
||||||
|
:remove_dir
|
||||||
|
if not exist %1 goto :EOF
|
||||||
|
del /s /f /q %1 >nul
|
||||||
|
rmdir /s /q %1
|
||||||
|
goto :EOF
|
70
build_scripts/Windows/build_libs/2-install-msys.bat
Normal file
70
build_scripts/Windows/build_libs/2-install-msys.bat
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
@setlocal
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Initialize environment
|
||||||
|
call "%~dp0_env.bat"
|
||||||
|
|
||||||
|
set MSYSInstall=mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip
|
||||||
|
set CMakeInstall=cmake-3.1.0-win32-x86.zip
|
||||||
|
set CMakeUnpackPath=%MSYSPath%\msys\1.0
|
||||||
|
|
||||||
|
if not exist "%DownloadPath%" mkdir "%DownloadPath%"
|
||||||
|
|
||||||
|
echo Check existing installation
|
||||||
|
if not exist "%MSYSPath%\bin\mingw-get.exe" goto proceed
|
||||||
|
choice /M "Found existing MSYS version. Do you want to proceed?"
|
||||||
|
if %ERRORLEVEL%==2 goto exit
|
||||||
|
|
||||||
|
:proceed
|
||||||
|
echo Remove previous MSYS version
|
||||||
|
call :remove_dir "%MSYSPath%"
|
||||||
|
|
||||||
|
echo Download installation files
|
||||||
|
if not exist "%DownloadPath%\%MSYSInstall%" "%CurlExe%" -L -k http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/%MSYSInstall%/download -o "%DownloadPath%\%MSYSInstall%"
|
||||||
|
if not exist "%DownloadPath%%\MSYSInstall%" echo Cannot download MSYS& goto :exit
|
||||||
|
|
||||||
|
if not exist "%DownloadPath%\%CMakeInstall%" "%CurlExe%" -L -k http://www.cmake.org/files/v3.1/cmake-3.1.0-win32-x86.zip -o "%DownloadPath%\%CMakeInstall%"
|
||||||
|
if not exist "%DownloadPath%\%CMakeInstall%" echo Cannot download CMake& goto :exit
|
||||||
|
|
||||||
|
echo Unpack MSYS
|
||||||
|
"%SevenZipExe%" x -o"%MSYSPath%" "%DownloadPath%\%MSYSInstall%"
|
||||||
|
|
||||||
|
echo Install MSYS
|
||||||
|
if not exist "%MSYSPath%\var\lib\mingw-get\data\profile.xml" copy "%MSYSPath%\var\lib\mingw-get\data\defaults.xml" "%MSYSPath%\var\lib\mingw-get\data\profile.xml"
|
||||||
|
pushd "%MSYSPath%\bin"
|
||||||
|
mingw-get.exe install mingw32-mingw-get
|
||||||
|
mingw-get.exe install msys-coreutils
|
||||||
|
mingw-get.exe install msys-base
|
||||||
|
mingw-get.exe install msys-autoconf
|
||||||
|
mingw-get.exe install msys-automake
|
||||||
|
mingw-get.exe install msys-autogen
|
||||||
|
mingw-get.exe install msys-mktemp
|
||||||
|
mingw-get.exe install msys-wget
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo Unpack CMake
|
||||||
|
"%SevenZipExe%" x -o"%CMakeUnpackPath%" "%DownloadPath%\%CMakeInstall%"
|
||||||
|
|
||||||
|
echo Install CMake
|
||||||
|
set CMakeVersion=
|
||||||
|
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
|
||||||
|
if "%CMakeVersion%"=="" echo CMake version not found.& goto :exit
|
||||||
|
echo Found CMake version %CMakeVersion%
|
||||||
|
|
||||||
|
set FoundProfile=
|
||||||
|
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYSPath%\msys\1.0\etc\profile"') do set FoundProfile=%%F
|
||||||
|
|
||||||
|
if "%FoundProfile%"=="0" (
|
||||||
|
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYSPath%\msys\1.0\etc\profile"
|
||||||
|
)
|
||||||
|
|
||||||
|
:exit
|
||||||
|
endlocal
|
||||||
|
exit /B 0
|
||||||
|
|
||||||
|
:remove_dir
|
||||||
|
if not exist %1 goto :EOF
|
||||||
|
del /s /f /q %1 >nul
|
||||||
|
rmdir /s /q %1
|
||||||
|
goto :EOF
|
29
build_scripts/Windows/build_libs/3-build-libs.bat
Normal file
29
build_scripts/Windows/build_libs/3-build-libs.bat
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@setlocal
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Initialize environment
|
||||||
|
call "%~dp0_env.bat"
|
||||||
|
|
||||||
|
set MSYSSH=%MSYSPath%\msys\1.0\bin\sh.exe
|
||||||
|
set MSYSCurPath=/%CurPath:~0,1%/%CurPath:~3%
|
||||||
|
set MSYSCurPath=%MSYSCurPath:\=/%
|
||||||
|
|
||||||
|
if not exist "%MSYSSH%" echo Please install MSYS first.&& exit /B 1
|
||||||
|
|
||||||
|
set GCCPath=
|
||||||
|
call :FIND_IN_PATH g++.exe GCCPath
|
||||||
|
if "%GCCPath%"=="" echo Please run %~nx0 in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable.&& exit /B 1
|
||||||
|
|
||||||
|
"%MSYSSH%" --login -i -c "cd "%MSYSCurPath%" && make -f makefile %*"
|
||||||
|
|
||||||
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
|
:FIND_IN_PATH
|
||||||
|
SET PathTemp="%Path:;=";"%"
|
||||||
|
FOR %%P IN (%PathTemp%) DO (
|
||||||
|
IF EXIST "%%~P.\%~1" (
|
||||||
|
set %2=%%~P
|
||||||
|
goto :EOF
|
||||||
|
)
|
||||||
|
)
|
226
build_scripts/Windows/build_libs/Makefile
Executable file
226
build_scripts/Windows/build_libs/Makefile
Executable file
@ -0,0 +1,226 @@
|
|||||||
|
ZLIB_VERSION=1.2.3
|
||||||
|
BZIP2_VERSION=1.0.6
|
||||||
|
MINIUPNPC_VERSION=2.0
|
||||||
|
OPENSSL_VERSION=1.0.2h
|
||||||
|
SPEEX_VERSION=1.2rc2
|
||||||
|
SPEEXDSP_VERSION=1.2rc3
|
||||||
|
OPENCV_VERSION=2.4.13
|
||||||
|
LIBXML2_VERSION=2.9.3
|
||||||
|
LIBXSLT_VERSION=1.1.28
|
||||||
|
CURL_VERSION=7.46.0
|
||||||
|
TCL_VERSION=8.6.2
|
||||||
|
SQLCIPHER_VERSION=2.2.1
|
||||||
|
LIBMICROHTTPD_VERSION=0.9.46
|
||||||
|
FFMPEG_VERSION=3.1.2
|
||||||
|
|
||||||
|
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg copylibs
|
||||||
|
|
||||||
|
download: \
|
||||||
|
download/zlib-$(ZLIB_VERSION).tar.gz \
|
||||||
|
download/bzip2-$(BZIP2_VERSION).tar.gz \
|
||||||
|
download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz \
|
||||||
|
download/openssl-$(OPENSSL_VERSION).tar.gz \
|
||||||
|
download/speex-$(SPEEX_VERSION).tar.gz \
|
||||||
|
download/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
|
||||||
|
download/opencv-$(OPENCV_VERSION).tar.gz \
|
||||||
|
download/libxml2-$(LIBXML2_VERSION).tar.gz \
|
||||||
|
download/libxslt-$(LIBXSLT_VERSION).tar.gz \
|
||||||
|
download/curl-$(CURL_VERSION).tar.gz \
|
||||||
|
download/tcl$(TCL_VERSION)-src.tar.gz \
|
||||||
|
download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
|
||||||
|
download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
|
||||||
|
download/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||||
|
|
||||||
|
dirs:
|
||||||
|
mkdir -p download
|
||||||
|
mkdir -p libs/include
|
||||||
|
mkdir -p libs/lib
|
||||||
|
mkdir -p libs/bin
|
||||||
|
|
||||||
|
download/zlib-$(ZLIB_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -O download/zlib-$(ZLIB_VERSION).tar.gz
|
||||||
|
|
||||||
|
zlib: download/zlib-$(ZLIB_VERSION).tar.gz
|
||||||
|
tar xvf download/zlib-$(ZLIB_VERSION).tar.gz
|
||||||
|
cd zlib-$(ZLIB_VERSION) && ./configure
|
||||||
|
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../libs"
|
||||||
|
cd zlib-$(ZLIB_VERSION) && make
|
||||||
|
cp zlib-$(ZLIB_VERSION)/zlib.h libs/include/
|
||||||
|
cp zlib-$(ZLIB_VERSION)/zconf.h libs/include/
|
||||||
|
cp zlib-$(ZLIB_VERSION)/libz.a libs/lib/
|
||||||
|
rm -r -f zlib-$(ZLIB_VERSION)
|
||||||
|
touch zlib
|
||||||
|
|
||||||
|
download/bzip2-$(BZIP2_VERSION).tar.gz:
|
||||||
|
wget http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -O download/bzip2-$(BZIP2_VERSION).tar.gz
|
||||||
|
|
||||||
|
bzip2: download/bzip2-$(BZIP2_VERSION).tar.gz
|
||||||
|
tar xvf download/bzip2-$(BZIP2_VERSION).tar.gz
|
||||||
|
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../libs"
|
||||||
|
cd bzip2-$(BZIP2_VERSION) && make
|
||||||
|
cp bzip2-$(BZIP2_VERSION)/bzlib.h libs/include/
|
||||||
|
cp bzip2-$(BZIP2_VERSION)/libbz2.a libs/lib/
|
||||||
|
rm -r -f bzip2-$(BZIP2_VERSION)
|
||||||
|
touch bzip2
|
||||||
|
|
||||||
|
download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz:
|
||||||
|
wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -O download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||||
|
|
||||||
|
miniupnpc: download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||||
|
tar xvf download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||||
|
cd miniupnpc-$(MINIUPNPC_VERSION) && CC=gcc && export CC && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll
|
||||||
|
mkdir -p libs/include/miniupnpc && cp miniupnpc-$(MINIUPNPC_VERSION)/*.h libs/include/miniupnpc/
|
||||||
|
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib libs/lib/
|
||||||
|
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll libs/bin/
|
||||||
|
rm -r -f miniupnpc-$(MINIUPNPC_VERSION)
|
||||||
|
touch miniupnpc
|
||||||
|
|
||||||
|
download/openssl-$(OPENSSL_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -O download/openssl-$(OPENSSL_VERSION).tar.gz
|
||||||
|
|
||||||
|
openssl: download/openssl-$(OPENSSL_VERSION).tar.gz
|
||||||
|
tar xvf download/openssl-$(OPENSSL_VERSION).tar.gz
|
||||||
|
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../libs"
|
||||||
|
#cd openssl-$(OPENSSL_VERSION) && make install
|
||||||
|
cd openssl-$(OPENSSL_VERSION) && ./config shared
|
||||||
|
cd openssl-$(OPENSSL_VERSION) && make
|
||||||
|
mkdir -p libs/include/openssl && cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h libs/include/openssl/
|
||||||
|
cp openssl-$(OPENSSL_VERSION)/libeay32.dll libs/bin/
|
||||||
|
cp openssl-$(OPENSSL_VERSION)/ssleay32.dll libs/bin/
|
||||||
|
cp openssl-$(OPENSSL_VERSION)/libcrypto.dll.a libs/lib/
|
||||||
|
cp openssl-$(OPENSSL_VERSION)/libssl.dll.a libs/lib/
|
||||||
|
rm -r -f openssl-$(OPENSSL_VERSION)
|
||||||
|
touch openssl
|
||||||
|
|
||||||
|
download/speex-$(SPEEX_VERSION).tar.gz:
|
||||||
|
wget http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O download/speex-$(SPEEX_VERSION).tar.gz
|
||||||
|
|
||||||
|
speex: download/speex-$(SPEEX_VERSION).tar.gz
|
||||||
|
tar xvf download/speex-$(SPEEX_VERSION).tar.gz
|
||||||
|
cd speex-$(SPEEX_VERSION) && ./configure
|
||||||
|
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../libs"
|
||||||
|
cd speex-$(SPEEX_VERSION) && make
|
||||||
|
mkdir -p libs/include/speex && cp speex-$(SPEEX_VERSION)/include/speex/*.h libs/include/speex/
|
||||||
|
cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeex.a libs/lib
|
||||||
|
rm -r -f speex-$(SPEEX_VERSION)
|
||||||
|
touch speex
|
||||||
|
|
||||||
|
download/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
|
||||||
|
wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||||
|
|
||||||
|
speexdsp: download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||||
|
tar xvf download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||||
|
cd speexdsp-$(SPEEXDSP_VERSION) && ./configure
|
||||||
|
cd speexdsp-$(SPEEXDSP_VERSION) && make
|
||||||
|
mkdir -p libs/include/speex && cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h libs/include/speex/
|
||||||
|
cp speexdsp-$(SPEEXDSP_VERSION)/libspeexdsp/.libs/libspeexdsp.a libs/lib
|
||||||
|
rm -r -f speexdsp-$(SPEEXDSP_VERSION)
|
||||||
|
touch speexdsp
|
||||||
|
|
||||||
|
download/opencv-$(OPENCV_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate https://github.com/Itseez/opencv/archive/$(OPENCV_VERSION).tar.gz -O download/opencv-$(OPENCV_VERSION).tar.gz
|
||||||
|
|
||||||
|
opencv: download/opencv-$(OPENCV_VERSION).tar.gz
|
||||||
|
tar xvf download/opencv-$(OPENCV_VERSION).tar.gz
|
||||||
|
mkdir -p opencv-$(OPENCV_VERSION)/build
|
||||||
|
#cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../libs"
|
||||||
|
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install"
|
||||||
|
cd opencv-$(OPENCV_VERSION)/build && make install
|
||||||
|
cp -r opencv-$(OPENCV_VERSION)/build/install/include/* libs/include/
|
||||||
|
mkdir -p libs/lib/opencv && cp -r opencv-$(OPENCV_VERSION)/build/install/x86/mingw/staticlib/* libs/lib/opencv/
|
||||||
|
rm -r -f opencv-$(OPENCV_VERSION)
|
||||||
|
touch opencv
|
||||||
|
|
||||||
|
download/libxml2-$(LIBXML2_VERSION).tar.gz:
|
||||||
|
wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O download/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||||
|
|
||||||
|
libxml2: download/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||||
|
tar xvf download/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||||
|
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
|
||||||
|
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../libs"
|
||||||
|
cd libxml2-$(LIBXML2_VERSION) && make
|
||||||
|
mkdir -p libs/include/libxml && cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h libs/include/libxml/
|
||||||
|
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a libs/lib/
|
||||||
|
touch libxml2
|
||||||
|
|
||||||
|
download/libxslt-$(LIBXSLT_VERSION).tar.gz:
|
||||||
|
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O download/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||||
|
|
||||||
|
libxslt: download/libxml2-$(LIBXML2_VERSION).tar.gz download/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||||
|
tar xvf download/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||||
|
tar xvf download/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||||
|
tar xvf libxslt-$(LIBXSLT_VERSION)-fix.tar.gz
|
||||||
|
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
|
||||||
|
cd libxslt-$(LIBXSLT_VERSION) && make
|
||||||
|
mkdir -p libs/include/libxslt && cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h libs/include/libxslt/
|
||||||
|
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a libs/lib/
|
||||||
|
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a libs/lib/
|
||||||
|
rm -r -f libxml2-$(LIBXML2_VERSION)
|
||||||
|
rm -r -f libxslt-$(LIBXSLT_VERSION)
|
||||||
|
touch libxslt
|
||||||
|
|
||||||
|
download/curl-$(CURL_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -O download/curl-$(CURL_VERSION).tar.gz
|
||||||
|
|
||||||
|
curl: download/curl-$(CURL_VERSION).tar.gz
|
||||||
|
tar xvf download/curl-$(CURL_VERSION).tar.gz
|
||||||
|
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../libs"
|
||||||
|
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../libs"
|
||||||
|
cd curl-$(CURL_VERSION) && make
|
||||||
|
mkdir -p libs/include/curl && cp curl-$(CURL_VERSION)/include/curl/*.h libs/include/curl/
|
||||||
|
cp curl-$(CURL_VERSION)/lib/.libs/libcurl.a libs/lib/
|
||||||
|
rm -r -f curl-$(CURL_VERSION)
|
||||||
|
touch curl
|
||||||
|
|
||||||
|
download/tcl$(TCL_VERSION)-src.tar.gz:
|
||||||
|
wget http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -O download/tcl$(TCL_VERSION)-src.tar.gz
|
||||||
|
|
||||||
|
download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -O download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
|
||||||
|
|
||||||
|
sqlcipher: download/tcl$(TCL_VERSION)-src.tar.gz download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
|
||||||
|
# tcl
|
||||||
|
tar xvf download/tcl$(TCL_VERSION)-src.tar.gz
|
||||||
|
mkdir -p tcl$(TCL_VERSION)/build
|
||||||
|
cd tcl$(TCL_VERSION)/build && ../win/configure
|
||||||
|
cd tcl$(TCL_VERSION)/build && make
|
||||||
|
#sqlcipher
|
||||||
|
tar xvf download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
|
||||||
|
cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh
|
||||||
|
mkdir -p tcl$(TCL_VERSION)/lib
|
||||||
|
ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6
|
||||||
|
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && LIBS="-L`pwd`/../libs/lib -lgdi32 $$LIBS" && export LIBS && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../libs/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../libs/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install"
|
||||||
|
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* libs/include/
|
||||||
|
cp sqlcipher-$(SQLCIPHER_VERSION)/install/lib/libsqlcipher.a libs/lib/
|
||||||
|
cp sqlcipher-$(SQLCIPHER_VERSION)/install/bin/sqlcipher.exe libs/bin/
|
||||||
|
rm -r -f sqlcipher-$(SQLCIPHER_VERSION)
|
||||||
|
rm -r -f tcl$(TCL_VERSION)
|
||||||
|
touch sqlcipher
|
||||||
|
|
||||||
|
download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||||
|
|
||||||
|
libmicrohttpd: download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||||
|
tar xvf download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||||
|
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../libs"
|
||||||
|
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install
|
||||||
|
rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION)
|
||||||
|
touch libmicrohttpd
|
||||||
|
|
||||||
|
download/ffmpeg-$(FFMPEG_VERSION).tar.gz:
|
||||||
|
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O download/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||||
|
|
||||||
|
ffmpeg: download/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||||
|
tar xvf download/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||||
|
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../libs"
|
||||||
|
cd ffmpeg-$(FFMPEG_VERSION) && make install
|
||||||
|
rm -r -f ffmpeg-$(FFMPEG_VERSION)
|
||||||
|
touch ffmpeg
|
||||||
|
|
||||||
|
|
||||||
|
copylibs:
|
||||||
|
read -p "Do you want to copy libs to retroshare? (yes|no)" answer; \
|
||||||
|
if [ "$$answer" = "yes" ] ; then \
|
||||||
|
cp -r libs ../../../../ ; \
|
||||||
|
fi
|
||||||
|
|
584
build_scripts/Windows/build_libs/Tools/winhttpjs.bat
Normal file
584
build_scripts/Windows/build_libs/Tools/winhttpjs.bat
Normal file
@ -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();
|
9
build_scripts/Windows/build_libs/_env.bat
Normal file
9
build_scripts/Windows/build_libs/_env.bat
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
set CurPath=%~dp0
|
||||||
|
set DownloadPath=%CurPath%download
|
||||||
|
set ToolsPath=%CurPath%tools
|
||||||
|
set TempPath=%CurPath%tmp
|
||||||
|
set MSYSPath=%CurPath%msys
|
||||||
|
set LibsPath=%CurPath%libs
|
||||||
|
|
||||||
|
set CurlExe=%ToolsPath%\curl.exe
|
||||||
|
set SevenZipExe=%ToolsPath%\7z.exe
|
30
build_scripts/Windows/build_libs/clean-all.bat
Normal file
30
build_scripts/Windows/build_libs/clean-all.bat
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
@setlocal
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Initialize environment
|
||||||
|
call "%~dp0_env.bat"
|
||||||
|
|
||||||
|
::call :remove_dir "%DownloadPath%"
|
||||||
|
call :remove_dir "%MSYSPath%"
|
||||||
|
call :remove_dir "%TempPath%"
|
||||||
|
|
||||||
|
call :remove_file "%ToolsPath%\7z.exe"
|
||||||
|
call :remove_file "%ToolsPath%\7z.dll"
|
||||||
|
call :remove_file "%ToolsPath%\curl.exe"
|
||||||
|
|
||||||
|
call "%~dp0clean.bat"
|
||||||
|
|
||||||
|
endlocal
|
||||||
|
exit /B 0
|
||||||
|
|
||||||
|
:remove_dir
|
||||||
|
if not exist %1 goto :EOF
|
||||||
|
del /s /f /q %1 >nul
|
||||||
|
rmdir /s /q %1
|
||||||
|
goto :EOF
|
||||||
|
|
||||||
|
:remove_file
|
||||||
|
if not exist %1 goto :EOF
|
||||||
|
del /q %1 >nul
|
||||||
|
goto :EOF
|
36
build_scripts/Windows/build_libs/clean.bat
Normal file
36
build_scripts/Windows/build_libs/clean.bat
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
@setlocal
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Initialize environment
|
||||||
|
call "%~dp0_env.bat"
|
||||||
|
|
||||||
|
call :remove_dir "%LibsPath%"
|
||||||
|
|
||||||
|
call :remove_file "%CurPath%bzip2"
|
||||||
|
call :remove_file "%CurPath%curl"
|
||||||
|
call :remove_file "%CurPath%ffmpeg"
|
||||||
|
call :remove_file "%CurPath%libmicrohttpd"
|
||||||
|
call :remove_file "%CurPath%libxml2"
|
||||||
|
call :remove_file "%CurPath%libxslt"
|
||||||
|
call :remove_file "%CurPath%miniupnpc"
|
||||||
|
call :remove_file "%CurPath%opencv"
|
||||||
|
call :remove_file "%CurPath%openssl"
|
||||||
|
call :remove_file "%CurPath%speex"
|
||||||
|
call :remove_file "%CurPath%speexdsp"
|
||||||
|
call :remove_file "%CurPath%sqlcipher"
|
||||||
|
call :remove_file "%CurPath%zlib"
|
||||||
|
|
||||||
|
endlocal
|
||||||
|
exit /B 0
|
||||||
|
|
||||||
|
:remove_dir
|
||||||
|
if not exist %1 goto :EOF
|
||||||
|
del /s /f /q %1 >nul
|
||||||
|
rmdir /s /q %1
|
||||||
|
goto :EOF
|
||||||
|
|
||||||
|
:remove_file
|
||||||
|
if not exist %1 goto :EOF
|
||||||
|
del /q %1 >nul
|
||||||
|
goto :EOF
|
16
build_scripts/Windows/build_libs/update-msys.bat
Normal file
16
build_scripts/Windows/build_libs/update-msys.bat
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
@setlocal
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Initialize environment
|
||||||
|
call "%~dp0_env.bat"
|
||||||
|
|
||||||
|
if not exist "%MSYSPath%\bin\mingw-get.exe" exit /B 0
|
||||||
|
|
||||||
|
echo Update MSYS
|
||||||
|
pushd "%MSYSPath%\bin"
|
||||||
|
mingw-get.exe update
|
||||||
|
mingw-get.exe upgrade
|
||||||
|
popd
|
||||||
|
|
||||||
|
exit /B %ERRORLEVEL%
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "bitdht/bdfilter.h"
|
#include "bitdht/bdfilter.h"
|
||||||
|
#include "bitdht/bdmanager.h"
|
||||||
#include "util/bdfile.h"
|
#include "util/bdfile.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -39,7 +40,7 @@
|
|||||||
**/
|
**/
|
||||||
#define BDFILTER_ENTRY_DROP_PERIOD (7 * 24 * 3600)
|
#define BDFILTER_ENTRY_DROP_PERIOD (7 * 24 * 3600)
|
||||||
|
|
||||||
bdFilter::bdFilter(const std::string &fname, const bdNodeId *ownid, uint32_t filterFlags, bdDhtFunctions *fns)
|
bdFilter::bdFilter(const std::string &fname, const bdNodeId *ownid, uint32_t filterFlags, bdDhtFunctions *fns, bdNodeManager *manager)
|
||||||
{
|
{
|
||||||
/* */
|
/* */
|
||||||
mOwnId = *ownid;
|
mOwnId = *ownid;
|
||||||
@ -49,6 +50,7 @@ bdFilter::bdFilter(const std::string &fname, const bdNodeId *ownid, uint32_t fi
|
|||||||
loadBannedIpFile() ;
|
loadBannedIpFile() ;
|
||||||
|
|
||||||
mFilterFlags = filterFlags;
|
mFilterFlags = filterFlags;
|
||||||
|
mNodeManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bdFilter::writeBannedIpFile()
|
void bdFilter::writeBannedIpFile()
|
||||||
@ -220,10 +222,22 @@ void bdFilter::getFilteredPeers(std::list<bdFilteredPeer>& peers)
|
|||||||
/* fast check if the addr is in the structure */
|
/* fast check if the addr is in the structure */
|
||||||
int bdFilter::addrOkay(struct sockaddr_in *addr)
|
int bdFilter::addrOkay(struct sockaddr_in *addr)
|
||||||
{
|
{
|
||||||
std::map<uint32_t,bdFilteredPeer>::const_iterator it = mFiltered.find(addr->sin_addr.s_addr);
|
// first check upper layer
|
||||||
|
bool isAvailable, isBanned;
|
||||||
|
mNodeManager->doIsBannedCallback(addr, &isAvailable, &isBanned);
|
||||||
|
|
||||||
|
if(isAvailable) {
|
||||||
|
#ifdef DEBUG_FILTER
|
||||||
|
std::cerr << "bdFilter::addrOkay addr: " << inet_ntoa(addr->sin_addr) << " result from upper layer: " << (isBanned ? "banned" : "ok") << std::endl;
|
||||||
|
#endif
|
||||||
|
return !isBanned;
|
||||||
|
} else {
|
||||||
|
// fallback to own ban list
|
||||||
|
|
||||||
|
std::map<uint32_t,bdFilteredPeer>::const_iterator it = mFiltered.find(addr->sin_addr.s_addr);
|
||||||
if (it == mFiltered.end())
|
if (it == mFiltered.end())
|
||||||
return 1; // Address is Okay!
|
return 1; // Address is Okay
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_FILTER
|
#ifdef DEBUG_FILTER
|
||||||
std::cerr << "Detected Packet From Banned Ip Address: " << inet_ntoa(addr->sin_addr);
|
std::cerr << "Detected Packet From Banned Ip Address: " << inet_ntoa(addr->sin_addr);
|
||||||
|
@ -47,10 +47,12 @@ class bdFilteredPeer
|
|||||||
time_t mLastSeen;
|
time_t mLastSeen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class bdNodeManager;
|
||||||
|
|
||||||
class bdFilter
|
class bdFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bdFilter(const std::string& fname,const bdNodeId *ownid, uint32_t filterFlags, bdDhtFunctions *fns);
|
bdFilter(const std::string& fname, const bdNodeId *ownid, uint32_t filterFlags, bdDhtFunctions *fns, bdNodeManager *manager);
|
||||||
|
|
||||||
// get the answer.
|
// get the answer.
|
||||||
//bool filtered(std::list<bdFilteredPeer> &answer);
|
//bool filtered(std::list<bdFilteredPeer> &answer);
|
||||||
@ -80,6 +82,9 @@ bool isOwnIdWithoutBitDhtFlags(const bdId *id, uint32_t peerFlags);
|
|||||||
std::map<uint32_t,bdFilteredPeer> mFiltered;
|
std::map<uint32_t,bdFilteredPeer> mFiltered;
|
||||||
bdDhtFunctions *mFns;
|
bdDhtFunctions *mFns;
|
||||||
std::string mFilename ;
|
std::string mFilename ;
|
||||||
|
|
||||||
|
// have access to the manager for isBanned callback
|
||||||
|
bdNodeManager* mNodeManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,19 +338,24 @@ class BitDhtCallback
|
|||||||
// ~BitDhtCallback();
|
// ~BitDhtCallback();
|
||||||
|
|
||||||
// dummy cos not needed for standard dht behaviour;
|
// dummy cos not needed for standard dht behaviour;
|
||||||
virtual int dhtNodeCallback(const bdId * /*id*/, uint32_t /*peerflags*/) { return 0; }
|
virtual int dhtNodeCallback(const bdId * /*id*/, uint32_t /*peerflags*/) { return 0; }
|
||||||
|
|
||||||
// must be implemented.
|
// must be implemented.
|
||||||
virtual int dhtPeerCallback(const bdId *id, uint32_t status) = 0;
|
virtual int dhtPeerCallback(const bdId *id, uint32_t status) = 0;
|
||||||
virtual int dhtValueCallback(const bdNodeId *id, std::string key, uint32_t status) = 0;
|
virtual int dhtValueCallback(const bdNodeId *id, std::string key, uint32_t status) = 0;
|
||||||
|
|
||||||
// connection callback. Not required for basic behaviour, but forced for initial development.
|
// connection callback. Not required for basic behaviour, but forced for initial development.
|
||||||
virtual int dhtConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId *destId,
|
virtual int dhtConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId *destId,
|
||||||
uint32_t mode, uint32_t point, uint32_t param, uint32_t cbtype, uint32_t errcode) = 0; /* { return 0; } */
|
uint32_t mode, uint32_t point, uint32_t param, uint32_t cbtype, uint32_t errcode) = 0; /* { return 0; } */
|
||||||
|
|
||||||
// Generic Info callback - initially will be used to provide bad peers.
|
// Generic Info callback - initially will be used to provide bad peers.
|
||||||
virtual int dhtInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::string info) = 0;
|
virtual int dhtInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::string info) = 0;
|
||||||
|
|
||||||
|
// ask upper layer whether an IP is banned or not
|
||||||
|
// must not be implemented
|
||||||
|
// when set it will be used instead of the own ban list
|
||||||
|
// return code is used to express availability/absence
|
||||||
|
virtual int dhtIsBannedCallback(const sockaddr_in */*addr*/, bool */*isBanned*/) { return 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
|
|
||||||
bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string bootfile, const std::string& filterfile,bdDhtFunctions *fns)
|
bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string bootfile, const std::string& filterfile,bdDhtFunctions *fns)
|
||||||
:bdNode(id, dhtVersion, bootfile, filterfile, fns)
|
:bdNode(id, dhtVersion, bootfile, filterfile, fns, this)
|
||||||
{
|
{
|
||||||
mMode = BITDHT_MGR_STATE_OFF;
|
mMode = BITDHT_MGR_STATE_OFF;
|
||||||
mFns = fns;
|
mFns = fns;
|
||||||
@ -1179,10 +1179,9 @@ void bdNodeManager::doPeerCallback(const bdId *id, uint32_t status)
|
|||||||
|
|
||||||
void bdNodeManager::doValueCallback(const bdNodeId *id, std::string key, uint32_t status)
|
void bdNodeManager::doValueCallback(const bdNodeId *id, std::string key, uint32_t status)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_MGR
|
||||||
std::cerr << "bdNodeManager::doValueCallback()";
|
std::cerr << "bdNodeManager::doValueCallback()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
#ifdef DEBUG_MGR
|
|
||||||
#endif
|
#endif
|
||||||
/* search list */
|
/* search list */
|
||||||
std::list<BitDhtCallback *>::iterator it;
|
std::list<BitDhtCallback *>::iterator it;
|
||||||
@ -1196,10 +1195,9 @@ void bdNodeManager::doValueCallback(const bdNodeId *id, std::string key, uint32_
|
|||||||
|
|
||||||
void bdNodeManager::doInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::string info)
|
void bdNodeManager::doInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::string info)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_MGR
|
||||||
std::cerr << "bdNodeManager::doInfoCallback()";
|
std::cerr << "bdNodeManager::doInfoCallback()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
#ifdef DEBUG_MGR
|
|
||||||
#endif
|
#endif
|
||||||
/* search list */
|
/* search list */
|
||||||
std::list<BitDhtCallback *>::iterator it;
|
std::list<BitDhtCallback *>::iterator it;
|
||||||
@ -1210,6 +1208,28 @@ void bdNodeManager::doInfoCallback(const bdId *id, uint32_t type, uint32_t flags
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bdNodeManager::doIsBannedCallback(const sockaddr_in *addr, bool *isAvailable, bool *isBanned)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_MGR
|
||||||
|
std::cerr << "bdNodeManager::doIsBannedCallback()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
/* search list */
|
||||||
|
std::list<BitDhtCallback *>::iterator it;
|
||||||
|
*isBanned = false;
|
||||||
|
*isAvailable = false;
|
||||||
|
for(it = mCallbacks.begin(); it != mCallbacks.end(); it++)
|
||||||
|
{
|
||||||
|
// set isBanned to true as soon as one callback answers with true
|
||||||
|
bool banned;
|
||||||
|
if((*it)->dhtIsBannedCallback(addr, &banned))
|
||||||
|
{
|
||||||
|
*isBanned = *isBanned || banned;
|
||||||
|
*isAvailable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define BITDHT_IDENTITY_STRING_V1 "d1:"
|
#define BITDHT_IDENTITY_STRING_V1 "d1:"
|
||||||
#define BITDHT_IDENTITY_SIZE_V1 3
|
#define BITDHT_IDENTITY_SIZE_V1 3
|
||||||
|
@ -153,6 +153,9 @@ virtual void callbackConnect(bdId *srcId, bdId *proxyId, bdId *destId,
|
|||||||
|
|
||||||
int isBitDhtPacket(char *data, int size, struct sockaddr_in &from);
|
int isBitDhtPacket(char *data, int size, struct sockaddr_in &from);
|
||||||
|
|
||||||
|
// this function is used by bdFilter (must be public!)
|
||||||
|
void doIsBannedCallback(const sockaddr_in *addr, bool *isAvailable, bool* isBanned);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@
|
|||||||
|
|
||||||
#define HISTORY_PERIOD 60
|
#define HISTORY_PERIOD 60
|
||||||
|
|
||||||
bdNode::bdNode(bdNodeId *ownId, std::string dhtVersion, const std::string& bootfile, const std::string& filterfile, bdDhtFunctions *fns)
|
bdNode::bdNode(bdNodeId *ownId, std::string dhtVersion, const std::string& bootfile, const std::string& filterfile, bdDhtFunctions *fns, bdNodeManager *manager)
|
||||||
:mNodeSpace(ownId, fns),
|
:mNodeSpace(ownId, fns),
|
||||||
mFilterPeers(filterfile,ownId, BITDHT_FILTER_REASON_OWNID, fns),
|
mFilterPeers(filterfile,ownId, BITDHT_FILTER_REASON_OWNID, fns, manager),
|
||||||
mQueryMgr(NULL),
|
mQueryMgr(NULL),
|
||||||
mConnMgr(NULL),
|
mConnMgr(NULL),
|
||||||
mOwnId(*ownId), mDhtVersion(dhtVersion), mStore(bootfile, fns), mFns(fns),
|
mOwnId(*ownId), mDhtVersion(dhtVersion), mStore(bootfile, fns), mFns(fns),
|
||||||
|
@ -85,6 +85,7 @@ output -> call back to Udp().
|
|||||||
*********/
|
*********/
|
||||||
|
|
||||||
class bdFilteredPeer ;
|
class bdFilteredPeer ;
|
||||||
|
class bdNodeManager;
|
||||||
|
|
||||||
class bdNodeNetMsg
|
class bdNodeNetMsg
|
||||||
{
|
{
|
||||||
@ -122,7 +123,7 @@ class bdNode: public bdNodePublisher
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
bdNode(bdNodeId *id, std::string dhtVersion, const std::string& bootfile, const std::string& filterfile,
|
bdNode(bdNodeId *id, std::string dhtVersion, const std::string& bootfile, const std::string& filterfile,
|
||||||
bdDhtFunctions *fns);
|
bdDhtFunctions *fns, bdNodeManager* manager);
|
||||||
|
|
||||||
void init(); /* sets up the self referential classes (mQueryMgr & mConnMgr) */
|
void init(); /* sets up the self referential classes (mQueryMgr & mConnMgr) */
|
||||||
|
|
||||||
|
@ -87,8 +87,10 @@ bool UdpStack::getLocalAddress(struct sockaddr_in &local)
|
|||||||
|
|
||||||
bool UdpStack::resetAddress(struct sockaddr_in &local)
|
bool UdpStack::resetAddress(struct sockaddr_in &local)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_UDP_RECV
|
||||||
std::cerr << "UdpStack::resetAddress(" << local << ")";
|
std::cerr << "UdpStack::resetAddress(" << local << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
laddr = local;
|
laddr = local;
|
||||||
|
|
||||||
return udpLayer->reset(local);
|
return udpLayer->reset(local);
|
||||||
|
@ -150,10 +150,10 @@ want generic resource caching mechanism
|
|||||||
- dynamic handlers contain result data, and thus get deleted after a while
|
- dynamic handlers contain result data, and thus get deleted after a while
|
||||||
|
|
||||||
it is even possible to implement a resource-changed check at the highest level
|
it is even possible to implement a resource-changed check at the highest level
|
||||||
this allows to compute everything on the server side and only send chanes to the client
|
this allows to compute everything on the server side and only send changes to the client
|
||||||
the different resource providers don't have to implement a resource changed check then
|
the different resource providers don't have to implement a resource changed check then
|
||||||
a top level change detector will poll them
|
a top level change detector will poll them
|
||||||
of course this does not wokr with a deep resource tree with millions of nodes
|
of course this does not work with a deep resource tree with millions of nodes
|
||||||
|
|
||||||
for this we have the dynamic handlers,
|
for this we have the dynamic handlers,
|
||||||
they are created on demand and know how to listen for changes which affect them
|
they are created on demand and know how to listen for changes which affect them
|
||||||
|
113
libresapi/src/api/ApiServerLocal.cpp
Normal file
113
libresapi/src/api/ApiServerLocal.cpp
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* libresapi local socket server
|
||||||
|
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ApiServerLocal.h"
|
||||||
|
#include "JsonStream.h"
|
||||||
|
|
||||||
|
namespace resource_api{
|
||||||
|
|
||||||
|
ApiServerLocal::ApiServerLocal(ApiServer* server, QObject *parent) :
|
||||||
|
QObject(parent), serverThread(this),
|
||||||
|
localListener(server) // Must have no parent to be movable to other thread
|
||||||
|
{
|
||||||
|
localListener.moveToThread(&serverThread);
|
||||||
|
serverThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiServerLocal::~ApiServerLocal() { serverThread.quit(); }
|
||||||
|
|
||||||
|
ApiLocalListener::ApiLocalListener(ApiServer *server, QObject *parent) :
|
||||||
|
QObject(parent), mApiServer(server), mLocalServer(this)
|
||||||
|
{
|
||||||
|
mLocalServer.removeServer(serverName());
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
mLocalServer.setSocketOptions(QLocalServer::UserAccessOption);
|
||||||
|
#endif
|
||||||
|
connect(&mLocalServer, SIGNAL(newConnection()), this, SLOT(handleConnection()));
|
||||||
|
mLocalServer.listen(serverName());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApiLocalListener::handleConnection()
|
||||||
|
{
|
||||||
|
new ApiLocalConnectionHandler(mApiServer,
|
||||||
|
mLocalServer.nextPendingConnection(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiLocalConnectionHandler::ApiLocalConnectionHandler(
|
||||||
|
ApiServer* apiServer, QLocalSocket* sock, QObject *parent) :
|
||||||
|
QObject(parent), mApiServer(apiServer), mLocalSocket(sock),
|
||||||
|
mState(WAITING_PATH)
|
||||||
|
{
|
||||||
|
connect(mLocalSocket, SIGNAL(disconnected()), this, SLOT(deleteLater()));
|
||||||
|
connect(sock, SIGNAL(readyRead()), this, SLOT(handlePendingRequests()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiLocalConnectionHandler::~ApiLocalConnectionHandler()
|
||||||
|
{
|
||||||
|
mLocalSocket->close();
|
||||||
|
delete mLocalSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApiLocalConnectionHandler::handlePendingRequests()
|
||||||
|
{
|
||||||
|
switch(mState)
|
||||||
|
{
|
||||||
|
case WAITING_PATH:
|
||||||
|
{
|
||||||
|
if(mLocalSocket->canReadLine())
|
||||||
|
{
|
||||||
|
readPath:
|
||||||
|
reqPath = mLocalSocket->readLine().constData();
|
||||||
|
mState = WAITING_DATA;
|
||||||
|
|
||||||
|
/* Because QLocalSocket is SOCK_STREAM some clients implementations
|
||||||
|
* like the one based on QLocalSocket feel free to send the whole
|
||||||
|
* request (PATH + DATA) in a single write(), causing readyRead()
|
||||||
|
* signal being emitted only once, in that case we should continue
|
||||||
|
* processing without waiting for readyRead() being fired again, so
|
||||||
|
* we don't break here as there may be more lines to read */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case WAITING_DATA:
|
||||||
|
{
|
||||||
|
if(mLocalSocket->canReadLine())
|
||||||
|
{
|
||||||
|
resource_api::JsonStream reqJson;
|
||||||
|
reqJson.setJsonString(std::string(mLocalSocket->readLine().constData()));
|
||||||
|
resource_api::Request req(reqJson);
|
||||||
|
req.setPath(reqPath);
|
||||||
|
std::string resultString = mApiServer->handleRequest(req);
|
||||||
|
mLocalSocket->write(resultString.c_str(), resultString.length());
|
||||||
|
mLocalSocket->write("\n\0");
|
||||||
|
mState = WAITING_PATH;
|
||||||
|
|
||||||
|
/* Because QLocalSocket is SOCK_STREAM some clients implementations
|
||||||
|
* like the one based on QLocalSocket feel free to coalesce multiple
|
||||||
|
* upper level write() into a single socket write(), causing
|
||||||
|
* readyRead() signal being emitted only once, in that case we should
|
||||||
|
* keep processing without waiting for readyRead() being fired again */
|
||||||
|
if(mLocalSocket->canReadLine()) goto readPath;
|
||||||
|
|
||||||
|
// Now there are no more requests to process we can break
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace resource_api
|
87
libresapi/src/api/ApiServerLocal.h
Normal file
87
libresapi/src/api/ApiServerLocal.h
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#pragma once
|
||||||
|
/*
|
||||||
|
* libresapi local socket server
|
||||||
|
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QLocalServer>
|
||||||
|
#include <QString>
|
||||||
|
#include <QThread>
|
||||||
|
#include <QLocalSocket>
|
||||||
|
#include <retroshare/rsinit.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "ApiServer.h"
|
||||||
|
|
||||||
|
namespace resource_api
|
||||||
|
{
|
||||||
|
|
||||||
|
class ApiLocalListener : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ApiLocalListener(ApiServer* server, QObject *parent=0);
|
||||||
|
~ApiLocalListener() { mLocalServer.close(); }
|
||||||
|
|
||||||
|
const static QString& serverName()
|
||||||
|
{
|
||||||
|
const static QString sockPath(RsAccounts::AccountDirectory()
|
||||||
|
.append("/libresapi.sock").c_str());
|
||||||
|
return sockPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void handleConnection();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ApiServer* mApiServer;
|
||||||
|
QLocalServer mLocalServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ApiServerLocal : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ApiServerLocal(ApiServer* server, QObject *parent=0);
|
||||||
|
~ApiServerLocal();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QThread serverThread;
|
||||||
|
ApiLocalListener localListener;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ApiLocalConnectionHandler : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ApiLocalConnectionHandler(ApiServer* apiServer, QLocalSocket* sock, QObject *parent = 0);
|
||||||
|
~ApiLocalConnectionHandler();
|
||||||
|
enum State {WAITING_PATH, WAITING_DATA};
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void handlePendingRequests();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ApiServer* mApiServer;
|
||||||
|
QLocalSocket* mLocalSocket;
|
||||||
|
State mState;
|
||||||
|
std::string reqPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace resource_api
|
@ -559,7 +559,7 @@ int ApiServerMHD::accessHandlerCallback(MHD_Connection *connection,
|
|||||||
return ((MHDHandlerBase*)(*con_cls))->handleRequest(connection, url, method, version, upload_data, upload_data_size);
|
return ((MHDHandlerBase*)(*con_cls))->handleRequest(connection, url, method, version, upload_data, upload_data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// these characters are not allowe in the url, raise an error if they occur
|
// these characters are not allowed in the url, raise an error if they occur
|
||||||
// reason: don't want to serve files outside the current document root
|
// reason: don't want to serve files outside the current document root
|
||||||
const char *double_dots = "..";
|
const char *double_dots = "..";
|
||||||
if(strstr(url, double_dots))
|
if(strstr(url, double_dots))
|
||||||
|
@ -193,6 +193,33 @@ public:
|
|||||||
// then each handler should pop the top element
|
// then each handler should pop the top element
|
||||||
std::stack<std::string> mPath;
|
std::stack<std::string> mPath;
|
||||||
std::string mFullPath;
|
std::string mFullPath;
|
||||||
|
bool setPath(std::string reqPath)
|
||||||
|
{
|
||||||
|
std::string str;
|
||||||
|
for(std::string::reverse_iterator sit = reqPath.rbegin(); sit != reqPath.rend(); sit++)
|
||||||
|
{
|
||||||
|
if((*sit) != '/')
|
||||||
|
{
|
||||||
|
// add to front because we are traveling in reverse order
|
||||||
|
str = *sit + str;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(str != "")
|
||||||
|
{
|
||||||
|
mPath.push(str);
|
||||||
|
str.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(str != "")
|
||||||
|
{
|
||||||
|
mPath.push(str);
|
||||||
|
}
|
||||||
|
mFullPath = reqPath;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// parameters should be used to influence the result
|
// parameters should be used to influence the result
|
||||||
// for example include or exclude some information
|
// for example include or exclude some information
|
||||||
|
@ -55,7 +55,7 @@ bool RsControlModule::processShouldExit()
|
|||||||
return mProcessShouldExit;
|
return mProcessShouldExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsControlModule::askForPassword(const std::string &key_details, bool /* prev_is_bad */, std::string &password, bool& cancelled)
|
bool RsControlModule::askForPassword(const std::string &title, const std::string &key_details, bool /* prev_is_bad */, std::string &password, bool& cancelled)
|
||||||
{
|
{
|
||||||
cancelled = false ;
|
cancelled = false ;
|
||||||
{
|
{
|
||||||
@ -67,6 +67,7 @@ bool RsControlModule::askForPassword(const std::string &key_details, bool /* pre
|
|||||||
}
|
}
|
||||||
|
|
||||||
mWantPassword = true;
|
mWantPassword = true;
|
||||||
|
mTitle = title;
|
||||||
mKeyName = key_details;
|
mKeyName = key_details;
|
||||||
mPassword = "";
|
mPassword = "";
|
||||||
mStateTokenServer->replaceToken(mStateToken);
|
mStateTokenServer->replaceToken(mStateToken);
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
bool processShouldExit();
|
bool processShouldExit();
|
||||||
|
|
||||||
// from NotifyClient
|
// from NotifyClient
|
||||||
virtual bool askForPassword(const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled);
|
virtual bool askForPassword(const std::string &title, const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// from RsThread
|
// from RsThread
|
||||||
@ -76,6 +76,7 @@ private:
|
|||||||
// to notify that a password callback is waiting
|
// to notify that a password callback is waiting
|
||||||
// to answer the request, clear the flag and set the password
|
// to answer the request, clear the flag and set the password
|
||||||
bool mWantPassword;
|
bool mWantPassword;
|
||||||
|
std::string mTitle;
|
||||||
std::string mKeyName;
|
std::string mKeyName;
|
||||||
std::string mPassword;
|
std::string mPassword;
|
||||||
// for ssl cert generation:
|
// for ssl cert generation:
|
||||||
|
@ -8,11 +8,12 @@ TARGET = resapi
|
|||||||
TARGET_PRL = libresapi
|
TARGET_PRL = libresapi
|
||||||
DESTDIR = lib
|
DESTDIR = lib
|
||||||
|
|
||||||
CONFIG += libmicrohttpd
|
|
||||||
|
|
||||||
INCLUDEPATH += ../../libretroshare/src
|
INCLUDEPATH += ../../libretroshare/src
|
||||||
|
|
||||||
unix {
|
libresapihttpserver {
|
||||||
|
CONFIG += libmicrohttpd
|
||||||
|
|
||||||
|
unix {
|
||||||
|
|
||||||
webui_files.path = "$${DATA_DIR}/webui"
|
webui_files.path = "$${DATA_DIR}/webui"
|
||||||
webui_files.files = webui/app.js webui/app.css webui/index.html
|
webui_files.files = webui/app.js webui/app.css webui/index.html
|
||||||
@ -81,9 +82,9 @@ unix {
|
|||||||
|
|
||||||
|
|
||||||
QMAKE_EXTRA_COMPILERS += create_webfiles_html create_webfiles_js create_webfiles_css
|
QMAKE_EXTRA_COMPILERS += create_webfiles_html create_webfiles_js create_webfiles_css
|
||||||
}
|
}
|
||||||
|
|
||||||
win32{
|
win32 {
|
||||||
DEFINES *= WINDOWS_SYS
|
DEFINES *= WINDOWS_SYS
|
||||||
INCLUDEPATH += . $$INC_DIR
|
INCLUDEPATH += . $$INC_DIR
|
||||||
|
|
||||||
@ -104,9 +105,8 @@ win32{
|
|||||||
|
|
||||||
# create dummy files
|
# create dummy files
|
||||||
system($$MAKE_SRC\\init.bat .)
|
system($$MAKE_SRC\\init.bat .)
|
||||||
}
|
}
|
||||||
|
|
||||||
libmicrohttpd{
|
|
||||||
linux {
|
linux {
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG *= libmicrohttpd
|
PKGCONFIG *= libmicrohttpd
|
||||||
@ -173,3 +173,10 @@ HEADERS += \
|
|||||||
util/ContentTypes.h \
|
util/ContentTypes.h \
|
||||||
api/ApiPluginHandler.h \
|
api/ApiPluginHandler.h \
|
||||||
api/ChannelsHandler.h
|
api/ChannelsHandler.h
|
||||||
|
|
||||||
|
libresapilocalserver {
|
||||||
|
CONFIG *= qt
|
||||||
|
QT *= network
|
||||||
|
SOURCES *= api/ApiServerLocal.cpp
|
||||||
|
HEADERS *= api/ApiServerLocal.h
|
||||||
|
}
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "pqi/p3historymgr.h"
|
#include "pqi/p3historymgr.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "retroshare/rsiface.h"
|
#include "retroshare/rsiface.h"
|
||||||
#include "retroshare/rsreputations.h"
|
|
||||||
#include "retroshare/rsidentity.h"
|
#include "retroshare/rsidentity.h"
|
||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
#include "gxs/rsgixs.h"
|
#include "gxs/rsgixs.h"
|
||||||
@ -139,7 +138,7 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rsReputations->isIdentityBanned(cli->signature.keyId))
|
if(rsIdentity->isBanned(cli->signature.keyId))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl;
|
std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl;
|
||||||
return false ;
|
return false ;
|
||||||
@ -169,7 +168,7 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
|||||||
if(it == _chat_lobbys.end())
|
if(it == _chat_lobbys.end())
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CHAT_LOBBIES
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
std::cerr << "Chatlobby for id " << std::hex << item->lobby_id << " has no record. Dropping the msg." << std::dec << std::endl;
|
std::cerr << "Chatlobby for id " << std::hex << cli->lobby_id << " has no record. Dropping the msg." << std::dec << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -648,7 +647,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
|||||||
#endif
|
#endif
|
||||||
time_t now = time(NULL) ;
|
time_t now = time(NULL) ;
|
||||||
|
|
||||||
if(rsReputations->isIdentityBanned(item->signature.keyId))
|
if(rsIdentity->isBanned(item->signature.keyId))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl;
|
std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl;
|
||||||
return ;
|
return ;
|
||||||
|
@ -431,7 +431,7 @@ int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<D
|
|||||||
return !results.empty() ;
|
return !results.empty() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileIndexMonitor::findLocalFile(const RsFileHash& hash,FileSearchFlags hint_flags, const RsPeerId& peer_id,std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<std::string>& parent_groups) const
|
bool FileIndexMonitor::findLocalFile(const RsFileHash& hash,FileSearchFlags hint_flags, const RsPeerId& peer_id,std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<RsNodeGroupId>& parent_groups) const
|
||||||
{
|
{
|
||||||
std::list<FileEntry *> results;
|
std::list<FileEntry *> results;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -1668,7 +1668,7 @@ int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, FileSear
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,FileStorageFlags& flags,std::list<std::string>& parent_groups) const
|
void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,FileStorageFlags& flags,std::list<RsNodeGroupId>& parent_groups) const
|
||||||
{
|
{
|
||||||
flags.clear() ;
|
flags.clear() ;
|
||||||
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
||||||
|
@ -110,7 +110,7 @@ class FileIndexMonitor: public CacheSource, public RsTickingThread
|
|||||||
virtual ~FileIndexMonitor();
|
virtual ~FileIndexMonitor();
|
||||||
|
|
||||||
/* external interface for filetransfer */
|
/* external interface for filetransfer */
|
||||||
bool findLocalFile(const RsFileHash& hash,FileSearchFlags flags,const RsPeerId& peer_id, std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<std::string>& parent_groups) const;
|
bool findLocalFile(const RsFileHash& hash,FileSearchFlags flags,const RsPeerId& peer_id, std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<RsNodeGroupId>& parent_groups) const;
|
||||||
|
|
||||||
int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
||||||
int SearchBoolExp(Expression *exp, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
int SearchBoolExp(Expression *exp, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
||||||
@ -176,7 +176,7 @@ class FileIndexMonitor: public CacheSource, public RsTickingThread
|
|||||||
time_t locked_saveFileIndexes(bool update_cache) ;
|
time_t locked_saveFileIndexes(bool update_cache) ;
|
||||||
|
|
||||||
// Finds the share flags associated with this file entry.
|
// Finds the share flags associated with this file entry.
|
||||||
void locked_findShareFlagsAndParentGroups(FileEntry *fe,FileStorageFlags& shareflags,std::list<std::string>& parent_groups) const ;
|
void locked_findShareFlagsAndParentGroups(FileEntry *fe, FileStorageFlags& shareflags, std::list<RsNodeGroupId> &parent_groups) const ;
|
||||||
|
|
||||||
std::string locked_findRealRoot(std::string base) const;
|
std::string locked_findRealRoot(std::string base) const;
|
||||||
|
|
||||||
|
@ -30,7 +30,11 @@
|
|||||||
#include "bitdht/bdstddht.h"
|
#include "bitdht/bdstddht.h"
|
||||||
|
|
||||||
#include "tcponudp/udprelay.h"
|
#include "tcponudp/udprelay.h"
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
#include "tcponudp/udpstunner.h"
|
#include "tcponudp/udpstunner.h"
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
|
#include "retroshare/rsbanlist.h"
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
@ -76,6 +80,27 @@ virtual int dhtInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::
|
|||||||
return mParent->InfoCallback(id, type, flags, info);
|
return mParent->InfoCallback(id, type, flags, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int dhtIsBannedCallback(const sockaddr_in *addr, bool *isBanned)
|
||||||
|
{
|
||||||
|
// check whether ip filtering is enabled
|
||||||
|
// if not return 0 to signal that no filter is available
|
||||||
|
if(!rsBanList->ipFilteringEnabled())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// now check the filter
|
||||||
|
if(rsBanList->isAddressAccepted(*(const sockaddr_storage*)addr, RSBANLIST_CHECKING_FLAGS_BLACKLIST, NULL)) {
|
||||||
|
*isBanned = false;
|
||||||
|
} else {
|
||||||
|
#ifdef DEBUG_BITDHT
|
||||||
|
std::cerr << "p3BitDht dhtIsBannedCallback: peer is banned " << sockaddr_storage_tostring(*(const sockaddr_storage*)addr) << std::endl;
|
||||||
|
#endif
|
||||||
|
*isBanned = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return 1 to signal that a filter is available
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
p3BitDht *mParent;
|
p3BitDht *mParent;
|
||||||
@ -86,8 +111,10 @@ p3BitDht::p3BitDht(const RsPeerId& id, pqiConnectCb *cb, p3NetMgr *nm,
|
|||||||
UdpStack *udpstack, std::string bootstrapfile,const std::string& filteredipfile)
|
UdpStack *udpstack, std::string bootstrapfile,const std::string& filteredipfile)
|
||||||
:p3Config(), pqiNetAssistConnect(id, cb), mNetMgr(nm), dhtMtx("p3BitDht")
|
:p3Config(), pqiNetAssistConnect(id, cb), mNetMgr(nm), dhtMtx("p3BitDht")
|
||||||
{
|
{
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
mDhtStunner = NULL;
|
mDhtStunner = NULL;
|
||||||
mProxyStunner = NULL;
|
mProxyStunner = NULL;
|
||||||
|
#endif
|
||||||
mRelay = NULL;
|
mRelay = NULL;
|
||||||
|
|
||||||
mPeerSharer = NULL;
|
mPeerSharer = NULL;
|
||||||
@ -168,13 +195,19 @@ bool p3BitDht::getOwnDhtId(std::string &ownDhtId)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
void p3BitDht::setupConnectBits(UdpStunner *dhtStunner, UdpStunner *proxyStunner, UdpRelayReceiver *relay)
|
void p3BitDht::setupConnectBits(UdpStunner *dhtStunner, UdpStunner *proxyStunner, UdpRelayReceiver *relay)
|
||||||
{
|
{
|
||||||
mDhtStunner = dhtStunner;
|
mDhtStunner = dhtStunner;
|
||||||
mProxyStunner = proxyStunner;
|
mProxyStunner = proxyStunner;
|
||||||
mRelay = relay;
|
mRelay = relay;
|
||||||
}
|
}
|
||||||
|
#else // RS_USE_DHT_STUNNER
|
||||||
|
void p3BitDht::setupConnectBits(UdpRelayReceiver *relay)
|
||||||
|
{
|
||||||
|
mRelay = relay;
|
||||||
|
}
|
||||||
|
#endif //RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
void p3BitDht::setupPeerSharer(pqiNetAssistPeerShare *sharer)
|
void p3BitDht::setupPeerSharer(pqiNetAssistPeerShare *sharer)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,9 @@ class p3BitDhtRelayHandler
|
|||||||
|
|
||||||
|
|
||||||
class UdpRelayReceiver;
|
class UdpRelayReceiver;
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
class UdpStunner;
|
class UdpStunner;
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
class p3NetMgr;
|
class p3NetMgr;
|
||||||
|
|
||||||
class p3BitDht: public p3Config, public pqiNetAssistConnect, public RsDht
|
class p3BitDht: public p3Config, public pqiNetAssistConnect, public RsDht
|
||||||
@ -174,8 +176,11 @@ public:
|
|||||||
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
|
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
|
||||||
************************************************************************************************/
|
************************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
void setupConnectBits(UdpStunner *dhtStunner, UdpStunner *proxyStunner, UdpRelayReceiver *relay);
|
void setupConnectBits(UdpStunner *dhtStunner, UdpStunner *proxyStunner, UdpRelayReceiver *relay);
|
||||||
|
#else // RS_USE_DHT_STUNNER
|
||||||
|
void setupConnectBits(UdpRelayReceiver *relay);
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
void setupPeerSharer(pqiNetAssistPeerShare *sharer);
|
void setupPeerSharer(pqiNetAssistPeerShare *sharer);
|
||||||
void modifyNodesPerBucket(uint16_t count);
|
void modifyNodesPerBucket(uint16_t count);
|
||||||
|
|
||||||
@ -359,8 +364,10 @@ private:
|
|||||||
int removeTranslation_locked(const RsPeerId& pid);
|
int removeTranslation_locked(const RsPeerId& pid);
|
||||||
|
|
||||||
UdpBitDht *mUdpBitDht; /* has own mutex, is static except for creation/destruction */
|
UdpBitDht *mUdpBitDht; /* has own mutex, is static except for creation/destruction */
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
UdpStunner *mDhtStunner;
|
UdpStunner *mDhtStunner;
|
||||||
UdpStunner *mProxyStunner;
|
UdpStunner *mProxyStunner;
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
UdpRelayReceiver *mRelay;
|
UdpRelayReceiver *mRelay;
|
||||||
|
|
||||||
p3NetMgr *mNetMgr;
|
p3NetMgr *mNetMgr;
|
||||||
|
@ -149,7 +149,7 @@ int p3BitDht::getNetFailedPeer(std::string peerId, PeerStatus &status)
|
|||||||
std::string p3BitDht::getUdpAddressString()
|
std::string p3BitDht::getUdpAddressString()
|
||||||
{
|
{
|
||||||
std::string out;
|
std::string out;
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
struct sockaddr_in extAddr;
|
struct sockaddr_in extAddr;
|
||||||
uint8_t extStable;
|
uint8_t extStable;
|
||||||
|
|
||||||
@ -187,7 +187,10 @@ std::string p3BitDht::getUdpAddressString()
|
|||||||
{
|
{
|
||||||
out += " ProxyExtAddr: Unknown ";
|
out += " ProxyExtAddr: Unknown ";
|
||||||
}
|
}
|
||||||
|
#else // RS_USE_DHT_STUNNER
|
||||||
|
// whitespaces taken from above
|
||||||
|
out = " DhtExtAddr: Unknown ProxyExtAddr: Unknown ";
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ int p3BitDht::InfoCallback(const bdId *id, uint32_t /*type*/, uint32_t /*flags*/
|
|||||||
mPeerSharer->updatePeer(rsid, tmpaddr, outtype, outreason, outage);
|
mPeerSharer->updatePeer(rsid, tmpaddr, outtype, outreason, outage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
/* call to the Stunners to drop the address as well */
|
/* call to the Stunners to drop the address as well */
|
||||||
/* IDEALLY these addresses should all be filtered at UdpLayer level instead! */
|
/* IDEALLY these addresses should all be filtered at UdpLayer level instead! */
|
||||||
if (mDhtStunner)
|
if (mDhtStunner)
|
||||||
@ -91,6 +92,7 @@ int p3BitDht::InfoCallback(const bdId *id, uint32_t /*type*/, uint32_t /*flags*/
|
|||||||
{
|
{
|
||||||
mProxyStunner->dropStunPeer(addr);
|
mProxyStunner->dropStunPeer(addr);
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -135,7 +137,7 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
if ((mProxyStunner) && (mProxyStunner->needStunPeers()))
|
if ((mProxyStunner) && (mProxyStunner->needStunPeers()))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_BITDHT_COMMON
|
#ifdef DEBUG_BITDHT_COMMON
|
||||||
@ -156,6 +158,7 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
|||||||
#endif
|
#endif
|
||||||
mDhtStunner->addStunPeer(id->addr, NULL);
|
mDhtStunner->addStunPeer(id->addr, NULL);
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -683,7 +686,6 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sockaddr_in extaddr;
|
struct sockaddr_in extaddr;
|
||||||
uint8_t extStable = 0;
|
|
||||||
sockaddr_clear(&extaddr);
|
sockaddr_clear(&extaddr);
|
||||||
|
|
||||||
bool connectOk = false;
|
bool connectOk = false;
|
||||||
@ -731,6 +733,9 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
|
uint8_t extStable = 0;
|
||||||
|
|
||||||
UdpStunner *stunner = mProxyStunner;
|
UdpStunner *stunner = mProxyStunner;
|
||||||
if (!proxyPort)
|
if (!proxyPort)
|
||||||
{
|
{
|
||||||
@ -849,6 +854,11 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#else // RS_USE_DHT_STUNNER
|
||||||
|
connectionAllowed = BITDHT_CONNECT_ERROR_TEMPUNAVAIL;
|
||||||
|
(void) connectOk;
|
||||||
|
(void) exclusivePort;
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
}
|
}
|
||||||
|
|
||||||
ca.mMode = mode;
|
ca.mMode = mode;
|
||||||
@ -1188,7 +1198,6 @@ int p3BitDht::doActions()
|
|||||||
else if (action.mMode == BITDHT_CONNECT_MODE_PROXY)
|
else if (action.mMode == BITDHT_CONNECT_MODE_PROXY)
|
||||||
{
|
{
|
||||||
struct sockaddr_in extaddr;
|
struct sockaddr_in extaddr;
|
||||||
uint8_t extStable = 0;
|
|
||||||
sockaddr_clear(&extaddr);
|
sockaddr_clear(&extaddr);
|
||||||
bool proxyPort = true;
|
bool proxyPort = true;
|
||||||
bool exclusivePort = false;
|
bool exclusivePort = false;
|
||||||
@ -1234,6 +1243,9 @@ int p3BitDht::doActions()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
|
uint8_t extStable = 0;
|
||||||
|
|
||||||
UdpStunner *stunner = mProxyStunner;
|
UdpStunner *stunner = mProxyStunner;
|
||||||
if (!proxyPort)
|
if (!proxyPort)
|
||||||
{
|
{
|
||||||
@ -1333,6 +1345,11 @@ int p3BitDht::doActions()
|
|||||||
connectionReqFailed = true;
|
connectionReqFailed = true;
|
||||||
failReason = CSB_UPDATE_RETRY_ATTEMPT;
|
failReason = CSB_UPDATE_RETRY_ATTEMPT;
|
||||||
}
|
}
|
||||||
|
#else // RS_USE_DHT_STUNNER
|
||||||
|
connectionReqFailed = true;
|
||||||
|
failReason = CSB_UPDATE_RETRY_ATTEMPT;
|
||||||
|
(void) connectOk;
|
||||||
|
#endif //RS_USE_DHT_STUNNER
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doConnectionRequest)
|
if (doConnectionRequest)
|
||||||
@ -1416,7 +1433,9 @@ int p3BitDht::doActions()
|
|||||||
{
|
{
|
||||||
std::cerr << "PeerAction: ERROR ERROR, we grabd Exclusive Port to do this, trying emergency release";
|
std::cerr << "PeerAction: ERROR ERROR, we grabd Exclusive Port to do this, trying emergency release";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
mProxyStunner->releaseExclusiveMode(pid,false);
|
mProxyStunner->releaseExclusiveMode(pid,false);
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2378,6 +2397,7 @@ void p3BitDht::ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrCh
|
|||||||
|
|
||||||
if (dpd->mExclusiveProxyLock)
|
if (dpd->mExclusiveProxyLock)
|
||||||
{
|
{
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
if (mProxyStunner->releaseExclusiveMode(pid, addrChgLikely))
|
if (mProxyStunner->releaseExclusiveMode(pid, addrChgLikely))
|
||||||
{
|
{
|
||||||
dpd->mExclusiveProxyLock = false;
|
dpd->mExclusiveProxyLock = false;
|
||||||
@ -2389,6 +2409,9 @@ void p3BitDht::ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrCh
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#else // RS_USE_DHT_STUNNER
|
||||||
|
(void)addrChgLikely;
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
{
|
{
|
||||||
dpd->mExclusiveProxyLock = false;
|
dpd->mExclusiveProxyLock = false;
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ int p3BitDht::addBadPeer(const struct sockaddr_storage &addr, uint32_t /*reason*
|
|||||||
addrv4.sin_addr = ap->sin_addr;
|
addrv4.sin_addr = ap->sin_addr;
|
||||||
addrv4.sin_port = ap->sin_port;
|
addrv4.sin_port = ap->sin_port;
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
if (mDhtStunner)
|
if (mDhtStunner)
|
||||||
{
|
{
|
||||||
mDhtStunner->dropStunPeer(addrv4);
|
mDhtStunner->dropStunPeer(addrv4);
|
||||||
@ -211,7 +211,7 @@ int p3BitDht::addBadPeer(const struct sockaddr_storage &addr, uint32_t /*reason*
|
|||||||
{
|
{
|
||||||
mProxyStunner->dropStunPeer(addrv4);
|
mProxyStunner->dropStunPeer(addrv4);
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "ft/ftdbase.h"
|
#include "ft/ftdbase.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
#include "retroshare/rspeers.h"
|
||||||
|
|
||||||
#include "serialiser/rsconfigitems.h"
|
#include "serialiser/rsconfigitems.h"
|
||||||
|
|
||||||
@ -241,7 +242,9 @@ bool ftFiMonitor::saveList(bool &cleanup, std::list<RsItem *>& sList)
|
|||||||
fi->file.path = (*it).filename ;
|
fi->file.path = (*it).filename ;
|
||||||
fi->file.name = (*it).virtualname ;
|
fi->file.name = (*it).virtualname ;
|
||||||
fi->flags = (*it).shareflags.toUInt32() ;
|
fi->flags = (*it).shareflags.toUInt32() ;
|
||||||
fi->parent_groups = (*it).parent_groups ;
|
|
||||||
|
for(std::list<RsNodeGroupId>::const_iterator it2( (*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2)
|
||||||
|
fi->parent_groups.ids.insert(*it2) ;
|
||||||
|
|
||||||
sList.push_back(fi);
|
sList.push_back(fi);
|
||||||
}
|
}
|
||||||
@ -332,24 +335,52 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
|
|||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
// 07/05/2016 - This ensures backward compatibility. Can be removed in a few weeks.
|
||||||
if (!fi)
|
RsFileConfigItem_deprecated *fib = dynamic_cast<RsFileConfigItem_deprecated *>(*it);
|
||||||
|
if (fib)
|
||||||
{
|
{
|
||||||
delete (*it);
|
/* ensure that it exists? */
|
||||||
continue;
|
|
||||||
|
SharedDirInfo info ;
|
||||||
|
info.filename = RsDirUtil::convertPathToUnix(fib->file.path);
|
||||||
|
info.virtualname = fib->file.name;
|
||||||
|
info.shareflags = FileStorageFlags(fib->flags) ;
|
||||||
|
info.shareflags &= PERMISSION_MASK ;
|
||||||
|
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||||
|
|
||||||
|
for(std::list<std::string>::const_iterator itt(fib->parent_groups.begin());itt!=fib->parent_groups.end();++itt)
|
||||||
|
{
|
||||||
|
RsGroupInfo ginfo;
|
||||||
|
|
||||||
|
if(rsPeers->getGroupInfoByName(*itt,ginfo) )
|
||||||
|
{
|
||||||
|
info.parent_groups.push_back(ginfo.id) ;
|
||||||
|
std::cerr << "(II) converted old group ID \"" << *itt << "\" into corresponding new group id " << ginfo.id << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::cerr << "(EE) cannot convert old group ID \"" << *itt << "\" into corresponding new group id: no candidate found. " << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirList.push_back(info) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
||||||
|
if (fi)
|
||||||
|
{
|
||||||
/* ensure that it exists? */
|
/* ensure that it exists? */
|
||||||
|
|
||||||
SharedDirInfo info ;
|
SharedDirInfo info ;
|
||||||
info.filename = RsDirUtil::convertPathToUnix(fi->file.path);
|
info.filename = RsDirUtil::convertPathToUnix(fi->file.path);
|
||||||
info.virtualname = fi->file.name;
|
info.virtualname = fi->file.name;
|
||||||
info.parent_groups = fi->parent_groups;
|
|
||||||
info.shareflags = FileStorageFlags(fi->flags) ;
|
info.shareflags = FileStorageFlags(fi->flags) ;
|
||||||
info.shareflags &= PERMISSION_MASK ;
|
info.shareflags &= PERMISSION_MASK ;
|
||||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||||
|
|
||||||
|
for(std::set<RsNodeGroupId>::const_iterator itt(fi->parent_groups.ids.begin());itt!=fi->parent_groups.ids.end();++itt)
|
||||||
|
info.parent_groups.push_back(*itt) ;
|
||||||
|
|
||||||
dirList.push_back(info) ;
|
dirList.push_back(info) ;
|
||||||
|
}
|
||||||
|
|
||||||
delete *it ;
|
delete *it ;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ bool ftExtraList::saveList(bool &cleanup, std::list<RsItem *>& sList)
|
|||||||
std::map<RsFileHash, FileDetails>::const_iterator it;
|
std::map<RsFileHash, FileDetails>::const_iterator it;
|
||||||
for(it = mFiles.begin(); it != mFiles.end(); ++it)
|
for(it = mFiles.begin(); it != mFiles.end(); ++it)
|
||||||
{
|
{
|
||||||
RsFileConfigItem *fi = new RsFileConfigItem();
|
RsFileConfigItem_deprecated *fi = new RsFileConfigItem_deprecated();
|
||||||
fi->file.path = (it->second).info.path;
|
fi->file.path = (it->second).info.path;
|
||||||
fi->file.name = (it->second).info.fname;
|
fi->file.name = (it->second).info.fname;
|
||||||
fi->file.hash = (it->second).info.hash;
|
fi->file.hash = (it->second).info.hash;
|
||||||
@ -428,7 +428,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
|||||||
for(it = load.begin(); it != load.end(); ++it)
|
for(it = load.begin(); it != load.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
||||||
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
RsFileConfigItem_deprecated *fi = dynamic_cast<RsFileConfigItem_deprecated *>(*it);
|
||||||
if (!fi)
|
if (!fi)
|
||||||
{
|
{
|
||||||
delete (*it);
|
delete (*it);
|
||||||
|
@ -39,7 +39,7 @@ static const uint16_t GROUTER_CLIENT_ID_MESSAGES = 0x1001 ;
|
|||||||
|
|
||||||
static const uint32_t RS_GROUTER_MATRIX_MAX_HIT_ENTRIES = 10 ; // max number of clues to store
|
static const uint32_t RS_GROUTER_MATRIX_MAX_HIT_ENTRIES = 10 ; // max number of clues to store
|
||||||
static const uint32_t RS_GROUTER_MATRIX_MIN_TIME_BETWEEN_HITS = 60 ; // can be set to up to half the publish time interval. Prevents flooding routes.
|
static const uint32_t RS_GROUTER_MATRIX_MIN_TIME_BETWEEN_HITS = 60 ; // can be set to up to half the publish time interval. Prevents flooding routes.
|
||||||
static const uint32_t RS_GROUTER_MIN_CONFIG_SAVE_PERIOD = 10 ; // at most save config every 10 seconds
|
static const uint32_t RS_GROUTER_MIN_CONFIG_SAVE_PERIOD = 61 ; // at most save config every 10 seconds
|
||||||
static const uint32_t RS_GROUTER_MAX_KEEP_TRACKING_CLUES = 86400*10 ; // max time for which we keep record of tracking info: 10 days.
|
static const uint32_t RS_GROUTER_MAX_KEEP_TRACKING_CLUES = 86400*10 ; // max time for which we keep record of tracking info: 10 days.
|
||||||
|
|
||||||
static const float RS_GROUTER_BASE_WEIGHT_ROUTED_MSG = 1.0f ; // base contribution of routed message clue to routing matrix
|
static const float RS_GROUTER_BASE_WEIGHT_ROUTED_MSG = 1.0f ; // base contribution of routed message clue to routing matrix
|
||||||
|
@ -191,7 +191,6 @@
|
|||||||
#include "turtle/p3turtle.h"
|
#include "turtle/p3turtle.h"
|
||||||
#include "gxs/rsgixs.h"
|
#include "gxs/rsgixs.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "retroshare/rsreputations.h"
|
|
||||||
|
|
||||||
#include "p3grouter.h"
|
#include "p3grouter.h"
|
||||||
#include "grouteritems.h"
|
#include "grouteritems.h"
|
||||||
@ -1863,15 +1862,6 @@ bool p3GRouter::locked_getLocallyRegisteredClientFromServiceId(const GRouterServ
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3GRouter::addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& peer_id)
|
|
||||||
{
|
|
||||||
RS_STACK_MUTEX(grMtx) ;
|
|
||||||
#ifdef GROUTER_DEBUG
|
|
||||||
grouter_debug() << "Received new routing clue for key " << mid << " from peer " << peer_id << std::endl;
|
|
||||||
#endif
|
|
||||||
_routing_matrix.addTrackingInfo(mid,peer_id) ;
|
|
||||||
_changed = true ;
|
|
||||||
}
|
|
||||||
void p3GRouter::addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id)
|
void p3GRouter::addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(grMtx) ;
|
RS_STACK_MUTEX(grMtx) ;
|
||||||
@ -1994,7 +1984,7 @@ bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item,uint32_t& er
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(rsReputations->isIdentityBanned(item->signature.keyId))
|
if(rsIdentity->isBanned(item->signature.keyId))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) received global router message from banned identity " << item->signature.keyId << ". Rejecting the message." << std::endl;
|
std::cerr << "(WW) received global router message from banned identity " << item->signature.keyId << ". Rejecting the message." << std::endl;
|
||||||
return false ;
|
return false ;
|
||||||
@ -2358,13 +2348,6 @@ bool p3GRouter::getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& infos)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3GRouter::getTrackingInfo(const RsGxsMessageId &mid, RsPeerId &provider_id)
|
|
||||||
{
|
|
||||||
RS_STACK_MUTEX(grMtx) ;
|
|
||||||
|
|
||||||
return _routing_matrix.getTrackingInfo(mid,provider_id) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dump everything
|
// Dump everything
|
||||||
//
|
//
|
||||||
void p3GRouter::debugDump()
|
void p3GRouter::debugDump()
|
||||||
|
@ -130,7 +130,6 @@ public:
|
|||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
virtual void addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id) ;
|
virtual void addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id) ;
|
||||||
virtual void addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& peer_id) ;
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// Client/server request services //
|
// Client/server request services //
|
||||||
@ -168,7 +167,6 @@ public:
|
|||||||
// - Cache state (memory size, etc)
|
// - Cache state (memory size, etc)
|
||||||
//
|
//
|
||||||
virtual bool getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& info) ;
|
virtual bool getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& info) ;
|
||||||
virtual bool getTrackingInfo(const RsGxsMessageId& mid, RsPeerId& provider_id) ;
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// Derived from p3Service //
|
// Derived from p3Service //
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
/*****
|
/*****
|
||||||
* #define RS_DATA_SERVICE_DEBUG 1
|
* #define RS_DATA_SERVICE_DEBUG 1
|
||||||
* #define RS_DATA_SERVICE_DEBUG_TIME 1
|
* #define RS_DATA_SERVICE_DEBUG_TIME 1
|
||||||
|
* #define RS_DATA_SERVICE_DEBUG_CACHE 1
|
||||||
****/
|
****/
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -123,6 +124,7 @@ RsDataService::RsDataService(const std::string &serviceDir, const std::string &d
|
|||||||
: RsGeneralDataService(), mDbMutex("RsDataService"), mServiceDir(serviceDir), mDbName(dbName), mDbPath(mServiceDir + "/" + dbName), mServType(serviceType), mDb(NULL)
|
: RsGeneralDataService(), mDbMutex("RsDataService"), mServiceDir(serviceDir), mDbName(dbName), mDbPath(mServiceDir + "/" + dbName), mServType(serviceType), mDb(NULL)
|
||||||
{
|
{
|
||||||
bool isNewDatabase = !RsDirUtil::fileExists(mDbPath);
|
bool isNewDatabase = !RsDirUtil::fileExists(mDbPath);
|
||||||
|
mGrpMetaDataCache_ContainsAllDatabase = false ;
|
||||||
|
|
||||||
mDb = new RetroDb(mDbPath, RetroDb::OPEN_READWRITE_CREATE, key);
|
mDb = new RetroDb(mDbPath, RetroDb::OPEN_READWRITE_CREATE, key);
|
||||||
|
|
||||||
@ -710,8 +712,8 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
|
|||||||
// start a transaction
|
// start a transaction
|
||||||
mDb->beginTransaction();
|
mDb->beginTransaction();
|
||||||
|
|
||||||
for(; mit != msg.end(); ++mit){
|
for(; mit != msg.end(); ++mit)
|
||||||
|
{
|
||||||
RsNxsMsg* msgPtr = mit->first;
|
RsNxsMsg* msgPtr = mit->first;
|
||||||
RsGxsMsgMetaData* msgMetaPtr = mit->second;
|
RsGxsMsgMetaData* msgMetaPtr = mit->second;
|
||||||
|
|
||||||
@ -779,6 +781,10 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
|
|||||||
std::cerr << "\t & MessageId: " << msgMetaPtr->mMsgId.toStdString();
|
std::cerr << "\t & MessageId: " << msgMetaPtr->mMsgId.toStdString();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is needed so that mLastPost is correctly updated in the group meta when it is re-loaded.
|
||||||
|
|
||||||
|
locked_clearGrpMetaCache(msgMetaPtr->mGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// finish transaction
|
// finish transaction
|
||||||
@ -881,6 +887,8 @@ int RsDataService::storeGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
|||||||
cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus);
|
cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus);
|
||||||
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
|
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
|
||||||
|
|
||||||
|
locked_clearGrpMetaCache(grpMetaPtr->mGroupId);
|
||||||
|
|
||||||
if (!mDb->sqlInsert(GRP_TABLE_NAME, "", cv))
|
if (!mDb->sqlInsert(GRP_TABLE_NAME, "", cv))
|
||||||
{
|
{
|
||||||
std::cerr << "RsDataService::storeGroup() sqlInsert Failed";
|
std::cerr << "RsDataService::storeGroup() sqlInsert Failed";
|
||||||
@ -904,6 +912,12 @@ int RsDataService::storeGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsDataService::locked_clearGrpMetaCache(const RsGxsGroupId& gid)
|
||||||
|
{
|
||||||
|
mGrpMetaDataCache.erase(gid) ; // cleans existing cache entry
|
||||||
|
mGrpMetaDataCache_ContainsAllDatabase = false;
|
||||||
|
}
|
||||||
|
|
||||||
int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -971,6 +985,8 @@ int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
|||||||
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
|
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
|
||||||
|
|
||||||
mDb->sqlUpdate(GRP_TABLE_NAME, "grpId='" + grpPtr->grpId.toStdString() + "'", cv);
|
mDb->sqlUpdate(GRP_TABLE_NAME, "grpId='" + grpPtr->grpId.toStdString() + "'", cv);
|
||||||
|
|
||||||
|
locked_clearGrpMetaCache(grpMetaPtr->mGroupId);
|
||||||
}
|
}
|
||||||
// finish transaction
|
// finish transaction
|
||||||
bool ret = mDb->commitTransaction();
|
bool ret = mDb->commitTransaction();
|
||||||
@ -1231,6 +1247,9 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
locked_retrieveMsgMeta(c, metaSet);
|
locked_retrieveMsgMeta(c, metaSet);
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << "Retrieving (all) Msg metadata grpId=" << grpId << ", " << std::dec << metaSet.size() << " messages" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -1245,6 +1264,9 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
locked_retrieveMsgMeta(c, metaSet);
|
locked_retrieveMsgMeta(c, metaSet);
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << "Retrieving Msg metadata grpId=" << grpId << ", " << std::dec << metaSet.size() << " messages" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1296,11 +1318,21 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
int requestedGroups = grp.size();
|
int requestedGroups = grp.size();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(grp.empty()){
|
if(grp.empty())
|
||||||
|
{
|
||||||
|
if(mGrpMetaDataCache_ContainsAllDatabase) // grab all the stash from the cache, so as to avoid decryption costs.
|
||||||
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << (void*)this << ": RsDataService::retrieveGxsGrpMetaData() retrieving all from cache!" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for(std::map<RsGxsGroupId,RsGxsGrpMetaData>::const_iterator it(mGrpMetaDataCache.begin());it!=mGrpMetaDataCache.end();++it)
|
||||||
|
grp[it->first] = new RsGxsGrpMetaData(it->second);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG
|
#ifdef RS_DATA_SERVICE_DEBUG
|
||||||
std::cerr << "RsDataService::retrieveGxsGrpMetaData() retrieving all";
|
std::cerr << "RsDataService::retrieveGxsGrpMetaData() retrieving all" << std::endl;
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "", "");
|
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "", "");
|
||||||
@ -1315,6 +1347,10 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
grp[g->mGroupId] = g;
|
grp[g->mGroupId] = g;
|
||||||
|
mGrpMetaDataCache[g->mGroupId] = *g ;
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << (void *)this << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
valid = c->moveToNext();
|
valid = c->moveToNext();
|
||||||
|
|
||||||
@ -1325,12 +1361,29 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mGrpMetaDataCache_ContainsAllDatabase = true ;
|
||||||
|
}
|
||||||
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, RsGxsGrpMetaData *>::iterator mit = grp.begin();
|
std::map<RsGxsGroupId, RsGxsGrpMetaData *>::iterator mit = grp.begin();
|
||||||
|
|
||||||
for(; mit != grp.end(); ++mit)
|
for(; mit != grp.end(); ++mit)
|
||||||
{
|
{
|
||||||
|
std::map<RsGxsGroupId, RsGxsGrpMetaData>::const_iterator itt = mGrpMetaDataCache.find(mit->first) ;
|
||||||
|
if(itt != mGrpMetaDataCache.end())
|
||||||
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << "Retrieving Grp metadata grpId=" << mit->first << " from cache!" << std::endl;
|
||||||
|
#endif
|
||||||
|
grp[mit->first] = new RsGxsGrpMetaData(itt->second) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ;
|
||||||
|
#endif
|
||||||
|
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "grpId='" + grpId.toStdString() + "'", "");
|
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "grpId='" + grpId.toStdString() + "'", "");
|
||||||
|
|
||||||
@ -1338,6 +1391,10 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
{
|
{
|
||||||
bool valid = c->moveToFirst();
|
bool valid = c->moveToFirst();
|
||||||
|
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
if(!valid)
|
||||||
|
std::cerr << " Empty query! GrpId " << grpId << " is not in database" << std::endl;
|
||||||
|
#endif
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
||||||
@ -1345,6 +1402,10 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
grp[g->mGroupId] = g;
|
grp[g->mGroupId] = g;
|
||||||
|
mGrpMetaDataCache[g->mGroupId] = *g ;
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << ". Got it. Updating cache." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
valid = c->moveToNext();
|
valid = c->moveToNext();
|
||||||
|
|
||||||
@ -1354,7 +1415,11 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
}
|
}
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
else
|
||||||
|
std::cerr << ". not found!" << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1391,13 +1456,28 @@ int RsDataService::resetDataStore()
|
|||||||
|
|
||||||
int RsDataService::updateGroupMetaData(GrpLocMetaData &meta)
|
int RsDataService::updateGroupMetaData(GrpLocMetaData &meta)
|
||||||
{
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << (void*)this << ": Updating Grp Meta data: grpId = " << meta.grpId << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
RsGxsGroupId& grpId = meta.grpId;
|
RsGxsGroupId& grpId = meta.grpId;
|
||||||
|
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << (void*)this << ": erasing old entry from cache." << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
locked_clearGrpMetaCache(meta.grpId);
|
||||||
|
|
||||||
return mDb->sqlUpdate(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", meta.val) ? 1 : 0;
|
return mDb->sqlUpdate(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", meta.val) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsDataService::updateMessageMetaData(MsgLocMetaData &metaData)
|
int RsDataService::updateMessageMetaData(MsgLocMetaData &metaData)
|
||||||
{
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
|
std::cerr << (void*)this << ": Updating Msg Meta data: grpId = " << metaData.msgId.first << " msgId = " << metaData.msgId.second << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
RsGxsGroupId& grpId = metaData.msgId.first;
|
RsGxsGroupId& grpId = metaData.msgId.first;
|
||||||
RsGxsMessageId& msgId = metaData.msgId.second;
|
RsGxsMessageId& msgId = metaData.msgId.second;
|
||||||
|
@ -340,6 +340,15 @@ private:
|
|||||||
uint16_t mServType;
|
uint16_t mServType;
|
||||||
|
|
||||||
RetroDb* mDb;
|
RetroDb* mDb;
|
||||||
|
|
||||||
|
// used to store metadata instead of reading it from the database.
|
||||||
|
// The boolean variable below is also used to force re-reading when
|
||||||
|
// the entre list of grp metadata is requested (which happens quite often)
|
||||||
|
|
||||||
|
void locked_clearGrpMetaCache(const RsGxsGroupId& gid);
|
||||||
|
|
||||||
|
std::map<RsGxsGroupId,RsGxsGrpMetaData> mGrpMetaDataCache ;
|
||||||
|
bool mGrpMetaDataCache_ContainsAllDatabase ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSDATASERVICE_H
|
#endif // RSDATASERVICE_H
|
||||||
|
@ -881,7 +881,14 @@ int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, const uin
|
|||||||
{
|
{
|
||||||
|
|
||||||
// now check reputation of the message author
|
// now check reputation of the message author
|
||||||
float reputation_threshold = ( (signFlag & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) && !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)) ? (RsReputations::REPUTATION_THRESHOLD_ANTI_SPAM): (RsReputations::REPUTATION_THRESHOLD_DEFAULT) ;
|
float reputation_threshold = RsReputations::REPUTATION_THRESHOLD_DEFAULT;
|
||||||
|
|
||||||
|
if( (signFlag & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) && !(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
||||||
|
reputation_threshold = RsReputations::REPUTATION_THRESHOLD_ANTI_SPAM;
|
||||||
|
else if( (signFlag & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) && !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
|
reputation_threshold = RsReputations::REPUTATION_THRESHOLD_ANTI_SPAM;
|
||||||
|
else
|
||||||
|
reputation_threshold = RsReputations::REPUTATION_THRESHOLD_DEFAULT;
|
||||||
|
|
||||||
if(details.mReputation.mOverallReputationScore < reputation_threshold)
|
if(details.mReputation.mOverallReputationScore < reputation_threshold)
|
||||||
{
|
{
|
||||||
@ -2004,10 +2011,7 @@ void RsGenExchange::publishMsgs()
|
|||||||
|
|
||||||
// FIXTESTS global variable rsPeers not available in unittests!
|
// FIXTESTS global variable rsPeers not available in unittests!
|
||||||
if(rsPeers)
|
if(rsPeers)
|
||||||
{
|
|
||||||
mRoutingClues[msg->metaData->mAuthorId].insert(rsPeers->getOwnId()) ;
|
mRoutingClues[msg->metaData->mAuthorId].insert(rsPeers->getOwnId()) ;
|
||||||
mTrackingClues.push_back(std::make_pair(msg->msgId,rsPeers->getOwnId())) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
computeHash(msg->msg, msg->metaData->mHash);
|
computeHash(msg->msg, msg->metaData->mHash);
|
||||||
mDataAccess->addMsgData(msg);
|
mDataAccess->addMsgData(msg);
|
||||||
@ -2015,6 +2019,9 @@ void RsGenExchange::publishMsgs()
|
|||||||
|
|
||||||
delete[] metaDataBuff;
|
delete[] metaDataBuff;
|
||||||
|
|
||||||
|
if(mNetService != NULL)
|
||||||
|
mNetService->stampMsgServerUpdateTS(grpId) ;
|
||||||
|
|
||||||
// add to published to allow acknowledgement
|
// add to published to allow acknowledgement
|
||||||
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
|
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::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||||
@ -2152,11 +2159,6 @@ void RsGenExchange::processRoutingClues()
|
|||||||
rsGRouter->addRoutingClue(GRouterKeyId(it->first),(*it2) ) ;
|
rsGRouter->addRoutingClue(GRouterKeyId(it->first),(*it2) ) ;
|
||||||
|
|
||||||
mRoutingClues.clear() ;
|
mRoutingClues.clear() ;
|
||||||
|
|
||||||
for(std::list<std::pair<RsGxsMessageId,RsPeerId> >::const_iterator it = mTrackingClues.begin();it!=mTrackingClues.end();++it)
|
|
||||||
rsGRouter->addTrackingInfo((*it).first,(*it).second) ;
|
|
||||||
|
|
||||||
mTrackingClues.clear() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGenExchange::processGroupDelete()
|
void RsGenExchange::processGroupDelete()
|
||||||
@ -2285,6 +2287,9 @@ bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
|
|||||||
|
|
||||||
void RsGenExchange::publishGrps()
|
void RsGenExchange::publishGrps()
|
||||||
{
|
{
|
||||||
|
std::list<RsGxsGroupId> groups_to_subscribe ;
|
||||||
|
|
||||||
|
{
|
||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
NxsGrpSignPendVect::iterator vit = mGrpsToPublish.begin();
|
NxsGrpSignPendVect::iterator vit = mGrpsToPublish.begin();
|
||||||
|
|
||||||
@ -2415,8 +2420,8 @@ void RsGenExchange::publishGrps()
|
|||||||
else
|
else
|
||||||
mDataAccess->addGroupData(grp);
|
mDataAccess->addGroupData(grp);
|
||||||
#warning this is bad: addGroupData/updateGroupData actially deletes grp. But it may be used below? grp should be a class object and not deleted manually!
|
#warning this is bad: addGroupData/updateGroupData actially deletes grp. But it may be used below? grp should be a class object and not deleted manually!
|
||||||
if(mNetService!=NULL)
|
|
||||||
mNetService->subscribeStatusChanged(grpId,true) ;
|
groups_to_subscribe.push_back(grpId) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2509,7 +2514,13 @@ void RsGenExchange::publishGrps()
|
|||||||
std::cerr << " " << *it << std::endl;
|
std::cerr << " " << *it << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is done off-mutex to avoid possible cross deadlocks with the net service.
|
||||||
|
|
||||||
|
if(mNetService!=NULL)
|
||||||
|
for(std::list<RsGxsGroupId>::const_iterator it(groups_to_subscribe.begin());it!=groups_to_subscribe.end();++it)
|
||||||
|
mNetService->subscribeStatusChanged((*it),true) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2590,6 +2601,9 @@ void RsGenExchange::computeHash(const RsTlvBinaryData& data, RsFileHash& hash)
|
|||||||
|
|
||||||
void RsGenExchange::processRecvdMessages()
|
void RsGenExchange::processRecvdMessages()
|
||||||
{
|
{
|
||||||
|
std::list<RsGxsMessageId> messages_to_reject ;
|
||||||
|
|
||||||
|
{
|
||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
@ -2713,9 +2727,6 @@ void RsGenExchange::processRecvdMessages()
|
|||||||
|
|
||||||
if(!msg->metaData->mAuthorId.isNull())
|
if(!msg->metaData->mAuthorId.isNull())
|
||||||
mRoutingClues[msg->metaData->mAuthorId].insert(msg->PeerId()) ;
|
mRoutingClues[msg->metaData->mAuthorId].insert(msg->PeerId()) ;
|
||||||
|
|
||||||
if(grpMeta->mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
|
|
||||||
mTrackingClues.push_back(std::make_pair(msg->msgId,msg->PeerId())) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(validateReturn == VALIDATE_FAIL)
|
if(validateReturn == VALIDATE_FAIL)
|
||||||
@ -2725,7 +2736,7 @@ void RsGenExchange::processRecvdMessages()
|
|||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "Notifying the network service to not download this message again." << std::endl;
|
std::cerr << "Notifying the network service to not download this message again." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
mNetService->rejectMessage(msg->msgId) ;
|
messages_to_reject.push_back(msg->msgId) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2802,6 +2813,18 @@ void RsGenExchange::processRecvdMessages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mReceivedMsgs.clear();
|
mReceivedMsgs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done off-mutex to avoid cross deadlocks in the netservice that might call the RsGenExchange as an observer..
|
||||||
|
|
||||||
|
if(mNetService != NULL)
|
||||||
|
for(std::list<RsGxsMessageId>::const_iterator it(messages_to_reject.begin());it!=messages_to_reject.end();++it)
|
||||||
|
mNetService->rejectMessage(*it) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData *grpMeta)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGenExchange::processRecvdGroups()
|
void RsGenExchange::processRecvdGroups()
|
||||||
@ -2811,6 +2834,9 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
if(mReceivedGrps.empty())
|
if(mReceivedGrps.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << "RsGenExchange::Processing received groups" << std::endl;
|
||||||
|
#endif
|
||||||
NxsGrpPendValidVect::iterator vit = mReceivedGrps.begin();
|
NxsGrpPendValidVect::iterator vit = mReceivedGrps.begin();
|
||||||
std::vector<RsGxsGroupId> existingGrpIds;
|
std::vector<RsGxsGroupId> existingGrpIds;
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
@ -2831,7 +2857,7 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
|
|
||||||
bool erase = true;
|
bool erase = true;
|
||||||
|
|
||||||
if(deserialOk)
|
if(deserialOk && acceptNewGroup(meta))
|
||||||
{
|
{
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " processing validation for group " << meta->mGroupId << ", attempts number " << gpsi.mAttempts << std::endl;
|
std::cerr << " processing validation for group " << meta->mGroupId << ", attempts number " << gpsi.mAttempts << std::endl;
|
||||||
@ -2911,7 +2937,9 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(!deserialOk)
|
||||||
std::cerr << "(EE) deserialise error in group meta data" << std::endl;
|
std::cerr << "(EE) deserialise error in group meta data" << std::endl;
|
||||||
|
|
||||||
delete grp;
|
delete grp;
|
||||||
delete meta;
|
delete meta;
|
||||||
erase = true;
|
erase = true;
|
||||||
|
@ -259,6 +259,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void receiveChanges(std::vector<RsGxsNotify*>& changes);
|
virtual void receiveChanges(std::vector<RsGxsNotify*>& changes);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief acceptNewGroup
|
||||||
|
* Early checks if the group can be accepted. This is mainly used to check wether the group is banned for some reasons.
|
||||||
|
* Returns true unless derived in GXS services.
|
||||||
|
*
|
||||||
|
* \param grpMeta Group metadata to check
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
virtual bool acceptNewGroup(const RsGxsGrpMetaData *grpMeta) ;
|
||||||
|
|
||||||
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -595,6 +605,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff);
|
void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
* @param token value set to be redeemed with acknowledgement
|
||||||
|
* @param grpId group id of the group to update
|
||||||
|
* @param CutOff The cut off value to set
|
||||||
|
*/
|
||||||
|
void updateGroupLastMsgTimeStamp(uint32_t& token, const RsGxsGroupId& grpId);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @return storage time of messages in months
|
* @return storage time of messages in months
|
||||||
*/
|
*/
|
||||||
|
@ -96,7 +96,6 @@
|
|||||||
* as these will be used very frequently.
|
* as these will be used very frequently.
|
||||||
*****/
|
*****/
|
||||||
|
|
||||||
typedef RsPeerId PeerId; // SHOULD BE REMOVED => RsPeerId (SSLID)
|
|
||||||
typedef PGPIdType RsPgpId;
|
typedef PGPIdType RsPgpId;
|
||||||
|
|
||||||
/* Identity Interface for GXS Message Verification.
|
/* Identity Interface for GXS Message Verification.
|
||||||
@ -150,7 +149,7 @@ public:
|
|||||||
* @param keyref the KeyRef of the key being requested
|
* @param keyref the KeyRef of the key being requested
|
||||||
* @return will
|
* @return will
|
||||||
*/
|
*/
|
||||||
virtual bool requestKey(const RsGxsId &id, const std::list<PeerId> &peers) = 0;
|
virtual bool requestKey(const RsGxsId &id, const std::list<RsPeerId> &peers) = 0;
|
||||||
virtual bool requestPrivateKey(const RsGxsId &id) = 0;
|
virtual bool requestPrivateKey(const RsGxsId &id) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,17 +39,17 @@ uint32_t RsGxsGrpMetaData::serial_size(uint32_t api_version)
|
|||||||
|
|
||||||
s += mGroupId.serial_size();
|
s += mGroupId.serial_size();
|
||||||
s += mOrigGrpId.serial_size();
|
s += mOrigGrpId.serial_size();
|
||||||
|
s += mParentGrpId.serial_size();
|
||||||
s += GetTlvStringSize(mGroupName);
|
s += GetTlvStringSize(mGroupName);
|
||||||
s += 4;
|
s += 4; // mGroupFlags
|
||||||
s += 4;
|
s += 4; // mPublishTs
|
||||||
|
s += 4; // mCircleType
|
||||||
|
s += 4; // mAuthenFlag
|
||||||
s += mAuthorId.serial_size();
|
s += mAuthorId.serial_size();
|
||||||
s += GetTlvStringSize(mServiceString);
|
s += GetTlvStringSize(mServiceString);
|
||||||
|
s += mCircleId.serial_size();
|
||||||
s += signSet.TlvSize();
|
s += signSet.TlvSize();
|
||||||
s += keys.TlvSize();
|
s += keys.TlvSize();
|
||||||
s += 4; // for mCircleType
|
|
||||||
s += mCircleId.serial_size();
|
|
||||||
s += 4; // mAuthenFlag
|
|
||||||
s += mParentGrpId.serial_size(); // mParentGroupId
|
|
||||||
|
|
||||||
if(api_version == RS_GXS_GRP_META_DATA_VERSION_ID_0002)
|
if(api_version == RS_GXS_GRP_META_DATA_VERSION_ID_0002)
|
||||||
s += 4; // mSignFlag
|
s += 4; // mSignFlag
|
||||||
@ -203,7 +203,7 @@ bool RsGxsGrpMetaData::deserialise(void *data, uint32_t &pktsize)
|
|||||||
int RsGxsMsgMetaData::refcount = 0;
|
int RsGxsMsgMetaData::refcount = 0;
|
||||||
|
|
||||||
RsGxsMsgMetaData::RsGxsMsgMetaData(){
|
RsGxsMsgMetaData::RsGxsMsgMetaData(){
|
||||||
|
clear();
|
||||||
//std::cout << "\nrefcount++ : " << ++refcount << std::endl;
|
//std::cout << "\nrefcount++ : " << ++refcount << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ bool RsGxsMsgMetaData::deserialise(void *data, uint32_t *size)
|
|||||||
|
|
||||||
ok &= signSet.GetTlv(data, *size, &offset);
|
ok &= signSet.GetTlv(data, *size, &offset);
|
||||||
ok &= GetTlvString(data, *size, &offset, 0, mMsgName);
|
ok &= GetTlvString(data, *size, &offset, 0, mMsgName);
|
||||||
uint32_t t;
|
uint32_t t=0;
|
||||||
ok &= getRawUInt32(data, *size, &offset, &t);
|
ok &= getRawUInt32(data, *size, &offset, &t);
|
||||||
mPublishTs = t;
|
mPublishTs = t;
|
||||||
ok &= getRawUInt32(data, *size, &offset, &mMsgFlags);
|
ok &= getRawUInt32(data, *size, &offset, &mMsgFlags);
|
||||||
|
@ -56,24 +56,22 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
void operator =(const RsGroupMetaData& rMeta);
|
void operator =(const RsGroupMetaData& rMeta);
|
||||||
|
|
||||||
|
//Sort data in same order than serialiser and deserializer
|
||||||
RsGxsGroupId mGroupId;
|
RsGxsGroupId mGroupId;
|
||||||
RsGxsGroupId mOrigGrpId;
|
RsGxsGroupId mOrigGrpId;
|
||||||
|
RsGxsGroupId mParentGrpId;
|
||||||
std::string mGroupName;
|
std::string mGroupName;
|
||||||
uint32_t mGroupFlags; // GXS_SERV::FLAG_PRIVACY_RESTRICTED | GXS_SERV::FLAG_PRIVACY_PRIVATE | GXS_SERV::FLAG_PRIVACY_PUBLIC
|
uint32_t mGroupFlags; // GXS_SERV::FLAG_PRIVACY_RESTRICTED | GXS_SERV::FLAG_PRIVACY_PRIVATE | GXS_SERV::FLAG_PRIVACY_PUBLIC
|
||||||
uint32_t mPublishTs;
|
uint32_t mPublishTs;
|
||||||
uint32_t mSignFlags;
|
|
||||||
RsGxsId mAuthorId;
|
|
||||||
|
|
||||||
RsGxsCircleId mCircleId;
|
|
||||||
uint32_t mCircleType;
|
uint32_t mCircleType;
|
||||||
|
uint32_t mAuthenFlags;
|
||||||
|
RsGxsId mAuthorId;
|
||||||
|
std::string mServiceString;
|
||||||
|
RsGxsCircleId mCircleId;
|
||||||
RsTlvKeySignatureSet signSet;
|
RsTlvKeySignatureSet signSet;
|
||||||
RsTlvSecurityKeySet keys;
|
RsTlvSecurityKeySet keys;
|
||||||
|
|
||||||
std::string mServiceString;
|
uint32_t mSignFlags;
|
||||||
uint32_t mAuthenFlags;
|
|
||||||
RsGxsGroupId mParentGrpId;
|
|
||||||
|
|
||||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||||
|
|
||||||
@ -105,18 +103,17 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
void operator =(const RsMsgMetaData& rMeta);
|
void operator =(const RsMsgMetaData& rMeta);
|
||||||
|
|
||||||
|
static int refcount;
|
||||||
|
|
||||||
|
//Sort data in same order than serialiser and deserializer
|
||||||
RsGxsGroupId mGroupId;
|
RsGxsGroupId mGroupId;
|
||||||
RsGxsMessageId mMsgId;
|
RsGxsMessageId mMsgId;
|
||||||
static int refcount;
|
|
||||||
RsGxsMessageId mThreadId;
|
RsGxsMessageId mThreadId;
|
||||||
RsGxsMessageId mParentId;
|
RsGxsMessageId mParentId;
|
||||||
RsGxsMessageId mOrigMsgId;
|
RsGxsMessageId mOrigMsgId;
|
||||||
RsGxsId mAuthorId;
|
RsGxsId mAuthorId;
|
||||||
|
|
||||||
RsTlvKeySignatureSet signSet;
|
RsTlvKeySignatureSet signSet;
|
||||||
|
|
||||||
std::string mServiceString;
|
|
||||||
|
|
||||||
std::string mMsgName;
|
std::string mMsgName;
|
||||||
time_t mPublishTs;
|
time_t mPublishTs;
|
||||||
uint32_t mMsgFlags; // Whats this for?
|
uint32_t mMsgFlags; // Whats this for?
|
||||||
@ -124,6 +121,7 @@ public:
|
|||||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||||
// normally READ / UNREAD flags. LOCAL Data.
|
// normally READ / UNREAD flags. LOCAL Data.
|
||||||
|
|
||||||
|
std::string mServiceString;
|
||||||
uint32_t mMsgStatus;
|
uint32_t mMsgStatus;
|
||||||
uint32_t mMsgSize;
|
uint32_t mMsgSize;
|
||||||
time_t mChildTs;
|
time_t mChildTs;
|
||||||
|
@ -204,9 +204,9 @@
|
|||||||
#include "rsgxsnetservice.h"
|
#include "rsgxsnetservice.h"
|
||||||
#include "gxssecurity.h"
|
#include "gxssecurity.h"
|
||||||
#include "retroshare/rsconfig.h"
|
#include "retroshare/rsconfig.h"
|
||||||
#include "retroshare/rsreputations.h"
|
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
#include "retroshare/rsgxscircles.h"
|
#include "retroshare/rsgxscircles.h"
|
||||||
|
#include "retroshare/rspeers.h"
|
||||||
#include "pgp/pgpauxutils.h"
|
#include "pgp/pgpauxutils.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "util/rsmemory.h"
|
#include "util/rsmemory.h"
|
||||||
@ -220,7 +220,7 @@
|
|||||||
NXS_NET_DEBUG_3 publish key exchange
|
NXS_NET_DEBUG_3 publish key exchange
|
||||||
NXS_NET_DEBUG_4 vetting
|
NXS_NET_DEBUG_4 vetting
|
||||||
NXS_NET_DEBUG_5 summary of transactions (useful to just know what comes in/out)
|
NXS_NET_DEBUG_5 summary of transactions (useful to just know what comes in/out)
|
||||||
NXS_NET_DEBUG_6
|
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_7 encryption/decryption of transactions
|
||||||
|
|
||||||
***/
|
***/
|
||||||
@ -233,7 +233,6 @@
|
|||||||
//#define NXS_NET_DEBUG_6 1
|
//#define NXS_NET_DEBUG_6 1
|
||||||
//#define NXS_NET_DEBUG_7 1
|
//#define NXS_NET_DEBUG_7 1
|
||||||
|
|
||||||
#define GIXS_CUT_OFF 0
|
|
||||||
//#define NXS_FRAG
|
//#define NXS_FRAG
|
||||||
|
|
||||||
// The constant below have a direct influence on how fast forums/channels/posted/identity groups propagate and on the overloading of queues:
|
// The constant below have a direct influence on how fast forums/channels/posted/identity groups propagate and on the overloading of queues:
|
||||||
@ -244,6 +243,7 @@
|
|||||||
// A small value for MAX_REQLIST_SIZE is likely to help messages to propagate in a chaotic network, but will also slow them down.
|
// A small value for MAX_REQLIST_SIZE is likely to help messages to propagate in a chaotic network, but will also slow them down.
|
||||||
// A small SYNC_PERIOD fasten message propagation, but is likely to overload the server side of transactions (e.g. overload outqueues).
|
// A small SYNC_PERIOD fasten message propagation, but is likely to overload the server side of transactions (e.g. overload outqueues).
|
||||||
//
|
//
|
||||||
|
#define GIXS_CUT_OFF 0
|
||||||
#define SYNC_PERIOD 60
|
#define SYNC_PERIOD 60
|
||||||
#define MAX_REQLIST_SIZE 20 // No more than 20 items per msg request list => creates smaller transactions that are less likely to be cancelled.
|
#define MAX_REQLIST_SIZE 20 // No more than 20 items per msg request list => creates smaller transactions that are less likely to be cancelled.
|
||||||
#define TRANSAC_TIMEOUT 2000 // In seconds. Has been increased to avoid epidemic transaction cancelling due to overloaded outqueues.
|
#define TRANSAC_TIMEOUT 2000 // In seconds. Has been increased to avoid epidemic transaction cancelling due to overloaded outqueues.
|
||||||
@ -266,8 +266,8 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ;
|
|||||||
|| 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)
|
||||||
|
|
||||||
static const RsPeerId peer_to_print = RsPeerId(std::string("")) ;
|
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("")) ; // use this to allow to this group id only, or "" for all IDs
|
||||||
static const uint32_t service_to_print = 0x215 ; // use this to allow to this service id only, or 0 for all services
|
static const uint32_t service_to_print = 0x211 ; // 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)
|
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
|
||||||
|
|
||||||
class nullstream: public std::ostream {};
|
class nullstream: public std::ostream {};
|
||||||
@ -928,6 +928,8 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
|
|||||||
#ifdef NXS_NET_DEBUG_6
|
#ifdef NXS_NET_DEBUG_6
|
||||||
GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << "Received Grp update stats item from peer " << grs->PeerId() << " for group " << grs->grpId << ", reporting " << grs->number_of_posts << " posts." << std::endl;
|
GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << "Received Grp update stats item from peer " << grs->PeerId() << " for group " << grs->grpId << ", reporting " << grs->number_of_posts << " posts." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
bool should_notify = false ;
|
||||||
|
{
|
||||||
RS_STACK_MUTEX(mNxsMutex) ;
|
RS_STACK_MUTEX(mNxsMutex) ;
|
||||||
RsGroupNetworkStatsRecord& rec(mGroupNetworkStats[grs->grpId]) ;
|
RsGroupNetworkStatsRecord& rec(mGroupNetworkStats[grs->grpId]) ;
|
||||||
|
|
||||||
@ -939,6 +941,9 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
|
|||||||
rec.update_TS = time(NULL) ;
|
rec.update_TS = time(NULL) ;
|
||||||
|
|
||||||
if (old_count != rec.max_visible_count || old_suppliers_count != rec.suppliers.size())
|
if (old_count != rec.max_visible_count || old_suppliers_count != rec.suppliers.size())
|
||||||
|
should_notify = true ;
|
||||||
|
}
|
||||||
|
if(should_notify)
|
||||||
mObserver->notifyChangedGroupStats(grs->grpId);
|
mObserver->notifyChangedGroupStats(grs->grpId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2091,14 +2096,19 @@ void RsGxsNetService::updateServerSyncTS()
|
|||||||
else
|
else
|
||||||
msui = mapIT->second;
|
msui = mapIT->second;
|
||||||
|
|
||||||
if(grpMeta->mLastPost > msui->msgUpdateTS )
|
// (cyril) I'm removing this, because the msgUpdateTS is updated when new messages are received by calling locked_stampMsgServerUpdateTS().
|
||||||
{
|
// mLastPost is actually updated somewhere when loading group meta data. It's not clear yet whether it is set to the latest publish time (wrong)
|
||||||
change = true;
|
// or the latest receive time (right). The former would cause problems because it would need to compare times coming from different (potentially async-ed)
|
||||||
msui->msgUpdateTS = grpMeta->mLastPost;
|
// machines.
|
||||||
|
//
|
||||||
|
// if(grpMeta->mLastPost > msui->msgUpdateTS )
|
||||||
|
// {
|
||||||
|
// change = true;
|
||||||
|
// msui->msgUpdateTS = grpMeta->mLastPost;
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG__G(grpId) << " updated msgUpdateTS to last post = " << time(NULL) - grpMeta->mLastPost << " secs ago for group "<< grpId << std::endl;
|
// GXSNETDEBUG__G(grpId) << " updated msgUpdateTS to last post = " << time(NULL) - grpMeta->mLastPost << " secs ago for group "<< grpId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
// }
|
||||||
|
|
||||||
// This is needed for group metadata updates to actually propagate: only a new grpUpdateTS will trigger the exchange of groups mPublishTs which
|
// This is needed for group metadata updates to actually propagate: only a new grpUpdateTS will trigger the exchange of groups mPublishTs which
|
||||||
// will then be compared and pssibly trigger a MetaData transmission. mRecvTS is upated when creating, receiving for the first time, or receiving
|
// will then be compared and pssibly trigger a MetaData transmission. mRecvTS is upated when creating, receiving for the first time, or receiving
|
||||||
@ -2118,6 +2128,7 @@ void RsGxsNetService::updateServerSyncTS()
|
|||||||
if(change)
|
if(change)
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
||||||
{
|
{
|
||||||
return tr->mTimeOut < ((uint32_t) time(NULL));
|
return tr->mTimeOut < ((uint32_t) time(NULL));
|
||||||
@ -2590,6 +2601,8 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
|||||||
// for the grp id
|
// for the grp id
|
||||||
locked_doMsgUpdateWork(tr->mTransaction, grpId);
|
locked_doMsgUpdateWork(tr->mTransaction, grpId);
|
||||||
|
|
||||||
|
// also update server sync TS, since we need to send the new message list to friends for comparison
|
||||||
|
locked_stampMsgServerUpdateTS(grpId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(tr->mFlag == NxsTransaction::FLAG_STATE_FAILED)
|
else if(tr->mFlag == NxsTransaction::FLAG_STATE_FAILED)
|
||||||
@ -2923,9 +2936,8 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// FIXTESTS global variable rsReputations not available in unittests!
|
|
||||||
if(rsReputations == 0){ std::cerr << "rsReputations==0, accepting all messages!" << std::endl; }
|
if(rsIdentity && rsIdentity->isBanned(syncItem->authorId))
|
||||||
if(rsReputations && rsReputations->isIdentityBanned(syncItem->authorId))
|
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_1
|
#ifdef NXS_NET_DEBUG_1
|
||||||
GXSNETDEBUG_PG(item->PeerId(),grpId) << ", Identity " << syncItem->authorId << " is banned. Not requesting message!" << std::endl;
|
GXSNETDEBUG_PG(item->PeerId(),grpId) << ", Identity " << syncItem->authorId << " is banned. Not requesting message!" << std::endl;
|
||||||
@ -3169,8 +3181,8 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
|||||||
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
||||||
}
|
}
|
||||||
// FIXTESTS global variable rsReputations not available in unittests!
|
// FIXTESTS global variable rsReputations not available in unittests!
|
||||||
if(rsReputations == 0){ std::cerr << "rsReputations==0, accepting all groups!" << std::endl; }
|
|
||||||
if(!grpSyncItem->authorId.isNull() && rsReputations && rsReputations->isIdentityBanned(grpSyncItem->authorId))
|
if(!grpSyncItem->authorId.isNull() && rsIdentity && rsIdentity->isBanned(grpSyncItem->authorId))
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG_PG(tr->mTransaction->PeerId(),grpId) << " Identity " << grpSyncItem->authorId << " is banned. Not syncing group." << std::endl;
|
GXSNETDEBUG_PG(tr->mTransaction->PeerId(),grpId) << " Identity " << grpSyncItem->authorId << " is banned. Not syncing group." << std::endl;
|
||||||
@ -4089,7 +4101,7 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& toVet, bool& should_encrypt)
|
bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& /* toVet */, bool& should_encrypt)
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendGrpId()"<< std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendGrpId()"<< std::endl;
|
||||||
@ -4120,101 +4132,21 @@ bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpM
|
|||||||
#endif
|
#endif
|
||||||
should_encrypt = true ;
|
should_encrypt = true ;
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
#ifdef TO_BE_REMOVED_OLD_VETTING_FOR_EXTERNAL_CIRCLES
|
|
||||||
const RsGxsCircleId& circleId = grpMeta.mCircleId;
|
|
||||||
if(circleId.isNull())
|
|
||||||
{
|
|
||||||
std::cerr << " EXTERNAL_CIRCLE missing NULL CircleId: " << grpMeta.mGroupId<< std::endl;
|
|
||||||
|
|
||||||
// ERROR, will never be shared.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mCircles->isLoaded(circleId))
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " EXTERNAL_CIRCLE, checking mCircles->canSend"<< std::endl;
|
|
||||||
#endif
|
|
||||||
// the sending authorisation is based on:
|
|
||||||
// getPgpId(peer_id) being a signer of one GxsId in the Circle
|
|
||||||
//
|
|
||||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
|
||||||
|
|
||||||
bool res = mCircles->canSend(circleId, pgpId);
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " answer is: " << res << std::endl;
|
|
||||||
#endif
|
|
||||||
return res ;
|
|
||||||
}
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " grp not ready. Adding to vetting list." << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
toVet.push_back(GrpIdCircleVet(grpMeta.mGroupId, circleId, grpMeta.mAuthorId));
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " YOUREYESONLY, checking further"<< std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// a non empty internal circle id means this
|
bool res = checkPermissionsForFriendGroup(sslId,grpMeta) ;
|
||||||
// is the personal circle owner
|
|
||||||
if(!grpMeta.mInternalCircle.isNull())
|
|
||||||
{
|
|
||||||
const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle;
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " have mInternalCircle - we are Group creator" << std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Final answer: " << res << std::endl;
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mCircleId: " << grpMeta.mCircleId << std::endl;
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle: " << grpMeta.mInternalCircle << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(mCircles->isLoaded(internalCircleId))
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " circle Loaded - checking mCircles->canSend" << std::endl;
|
|
||||||
#endif
|
|
||||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
|
||||||
bool should_encrypt = false ;
|
|
||||||
|
|
||||||
bool res = mCircles->canSend(internalCircleId, pgpId,should_encrypt);
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " answer is: " << res << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
return res ;
|
return res ;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle Not Loaded - add to vetting"<< std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId)<< " YOUREYESONLY, checking further"<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
toVet.push_back(GrpIdCircleVet(grpMeta.mGroupId, internalCircleId, grpMeta.mAuthorId));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// an empty internal circle id means this peer can only
|
|
||||||
// send circle related info from peer he received it
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle not set, someone else's personal circle"<< std::endl;
|
|
||||||
#endif
|
|
||||||
if(grpMeta.mOriginator == sslId)
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator matches -> can send"<< std::endl;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator doesn't match -> cannot send"<< std::endl;
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -4254,34 +4186,6 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs
|
|||||||
#endif
|
#endif
|
||||||
should_encrypt_id = grpMeta.mCircleId ;
|
should_encrypt_id = grpMeta.mCircleId ;
|
||||||
return true ;
|
return true ;
|
||||||
#ifdef TO_BE_REMOVED_OLD_VETTING_FOR_EXTERNAL_CIRCLES
|
|
||||||
const RsGxsCircleId& circleId = grpMeta.mCircleId;
|
|
||||||
if(circleId.isNull())
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_0
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " ERROR; EXTERNAL_CIRCLE missing NULL CircleId";
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << grpMeta.mGroupId;
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// should just be shared. ? no - this happens for
|
|
||||||
// Circle Groups which lose their CircleIds.
|
|
||||||
// return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mCircles->isLoaded(circleId))
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " EXTERNAL_CIRCLE, checking mCircles->canSend" << std::endl;
|
|
||||||
#endif
|
|
||||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
|
||||||
return mCircles->canSend(circleId, pgpId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mCircles->loadCircle(circleId); // simply request for next pass
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY) // do not attempt to sync msg unless to originator or those permitted
|
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY) // do not attempt to sync msg unless to originator or those permitted
|
||||||
@ -4289,53 +4193,11 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs
|
|||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// a non empty internal circle id means this
|
bool res = checkPermissionsForFriendGroup(sslId,grpMeta) ;
|
||||||
// is the personal circle owner
|
|
||||||
if(!grpMeta.mInternalCircle.isNull())
|
|
||||||
{
|
|
||||||
const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle;
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " have mInternalCircle - we are Group creator" << std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Final answer: " << res << std::endl;
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mCircleId: " << grpMeta.mCircleId << std::endl;
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle: " << grpMeta.mInternalCircle << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
return res ;
|
||||||
if(mCircles->isLoaded(internalCircleId))
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " circle Loaded - checking mCircles->canSend" << std::endl;
|
|
||||||
#endif
|
|
||||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
|
||||||
bool should_encrypt ;
|
|
||||||
return mCircles->canSend(internalCircleId, pgpId,should_encrypt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mCircles->loadCircle(internalCircleId); // request for next pass
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// an empty internal circle id means this peer can only
|
|
||||||
// send circle related info from peer he received it
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " mInternalCircle not set, someone else's personal circle" << std::endl;
|
|
||||||
#endif
|
|
||||||
if(grpMeta.mOriginator == sslId)
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator matches -> can send" << std::endl;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Originator doesn't match -> cannot send"<< std::endl;
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -4680,72 +4542,69 @@ bool RsGxsNetService::canSendMsgIds(std::vector<RsGxsMsgMetaData*>& msgMetas, co
|
|||||||
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
if(circleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: YOUR EYES ONLY" << std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " YOUREYESONLY, checking further" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// a non empty internal circle id means this
|
bool res = checkPermissionsForFriendGroup(sslId,grpMeta) ;
|
||||||
// is the personal circle owner
|
|
||||||
if(!grpMeta.mInternalCircle.isNull())
|
|
||||||
{
|
|
||||||
const RsGxsCircleId& internalCircleId = grpMeta.mInternalCircle;
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
#ifdef NXS_NET_DEBUG_4
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Group internal circle: " << internalCircleId << std::endl;
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Final answer: " << res << std::endl;
|
||||||
#endif
|
|
||||||
if(mCircles->isLoaded(internalCircleId))
|
|
||||||
{
|
|
||||||
const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId);
|
|
||||||
bool should_encrypt = false ;
|
|
||||||
|
|
||||||
bool res= mCircles->canSend(internalCircleId, pgpId,should_encrypt);
|
|
||||||
|
|
||||||
if(should_encrypt)
|
|
||||||
std::cerr << "(EE) inconsistent response: vetting requests to encrypt circle of type YOUR_EYES_ONLY" << std::endl;
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Answer from circle::canSend(): " << res << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Not loaded. Putting in vetting list and returning false." << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::vector<MsgIdCircleVet> toVet;
|
|
||||||
std::vector<RsGxsMsgMetaData*>::const_iterator vit = msgMetas.begin();
|
|
||||||
|
|
||||||
for(; vit != msgMetas.end(); ++vit)
|
|
||||||
{
|
|
||||||
const RsGxsMsgMetaData* const& meta = *vit;
|
|
||||||
|
|
||||||
MsgIdCircleVet mic(meta->mMsgId, meta->mAuthorId);
|
|
||||||
toVet.push_back(mic);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!toVet.empty())
|
|
||||||
mPendingCircleVets.push_back(new MsgCircleIdsRequestVetting(mCircles, mPgpUtils,
|
|
||||||
toVet, grpMeta.mGroupId,
|
|
||||||
sslId, grpMeta.mCircleId));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// an empty internal circle id means this peer can only
|
|
||||||
// send circle related info from peer he received it
|
|
||||||
|
|
||||||
#ifdef NXS_NET_DEBUG_4
|
|
||||||
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Empty internal circle: cannot only send info from Peer we received it (grpMeta.mOriginator=" << grpMeta.mOriginator << " answer is: " << (grpMeta.mOriginator == sslId) << std::endl;
|
|
||||||
#endif
|
|
||||||
if(grpMeta.mOriginator == sslId)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** inherited methods **/
|
/** inherited methods **/
|
||||||
|
|
||||||
|
bool RsGxsNetService::checkPermissionsForFriendGroup(const RsPeerId& sslId,const RsGxsGrpMetaData& grpMeta)
|
||||||
|
{
|
||||||
|
#ifdef NXS_NET_DEBUG_4
|
||||||
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: YOUR EYES ONLY - ID = " << grpMeta.mInternalCircle << std::endl;
|
||||||
|
#endif
|
||||||
|
// a non empty internal circle id means this
|
||||||
|
// is the personal circle owner
|
||||||
|
if(!grpMeta.mInternalCircle.isNull())
|
||||||
|
{
|
||||||
|
RsGroupInfo ginfo ;
|
||||||
|
RsPgpId pgpId = mPgpUtils->getPGPId(sslId) ;
|
||||||
|
|
||||||
|
#ifdef NXS_NET_DEBUG_4
|
||||||
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Group internal circle: " << grpMeta.mInternalCircle << ", We're owner. Sending to everyone in the group." << std::endl;
|
||||||
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Current destination is PGP Id: " << pgpId << std::endl;
|
||||||
|
#endif
|
||||||
|
if(!rsPeers->getGroupInfo(RsNodeGroupId(grpMeta.mInternalCircle),ginfo))
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) Cannot get information for internal circle (group node) ID " << grpMeta.mInternalCircle << " which conditions dissemination of GXS group " << grpMeta.mGroupId << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool res = (ginfo.peerIds.find(pgpId) != ginfo.peerIds.end());
|
||||||
|
|
||||||
|
#ifdef NXS_NET_DEBUG_4
|
||||||
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Final Answer is: " << res << std::endl;
|
||||||
|
#endif
|
||||||
|
return res ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// An empty internal circle id means this peer can only
|
||||||
|
// send circle related info from peer he received it from.
|
||||||
|
// Normally this should be a pgp-based decision, but if we do that,
|
||||||
|
// A ---> B ----> A' ---...--->B' , then A' will also send to B' since B is the
|
||||||
|
// originator for A'. So A will lose control of who can see the data. This should
|
||||||
|
// be discussed further...
|
||||||
|
|
||||||
|
#ifdef NXS_NET_DEBUG_4
|
||||||
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Empty internal circle: cannot only send/recv info to/from Peer we received it from (grpMeta.mOriginator=" << grpMeta.mOriginator << ")" << std::endl;
|
||||||
|
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Final answer is: " << (grpMeta.mOriginator == sslId) << std::endl;
|
||||||
|
#endif
|
||||||
|
if(grpMeta.mOriginator == sslId)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RsGxsNetService::pauseSynchronisation(bool /* enabled */)
|
void RsGxsNetService::pauseSynchronisation(bool /* enabled */)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -4759,6 +4618,12 @@ void RsGxsNetService::setSyncAge(uint32_t /* age */)
|
|||||||
int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)
|
int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mNxsMutex) ;
|
RS_STACK_MUTEX(mNxsMutex) ;
|
||||||
|
#ifdef NXS_NET_DEBUG_0
|
||||||
|
GXSNETDEBUG_P_(peerId) << "RsGxsNetService::requestGrp(): adding explicit group requests to peer " << peerId << std::endl;
|
||||||
|
|
||||||
|
for(std::list<RsGxsGroupId>::const_iterator it(grpId.begin());it!=grpId.end();++it)
|
||||||
|
GXSNETDEBUG_PG(peerId,*it) << " Group ID: " << *it << std::endl;
|
||||||
|
#endif
|
||||||
mExplicitRequest[peerId].assign(grpId.begin(), grpId.end());
|
mExplicitRequest[peerId].assign(grpId.begin(), grpId.end());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -4771,6 +4636,9 @@ void RsGxsNetService::processExplicitGroupRequests()
|
|||||||
|
|
||||||
for(; cit != mExplicitRequest.end(); ++cit)
|
for(; cit != mExplicitRequest.end(); ++cit)
|
||||||
{
|
{
|
||||||
|
#ifdef NXS_NET_DEBUG_0
|
||||||
|
GXSNETDEBUG_P_(cit->first) << "RsGxsNetService::sending pending explicit group requests to peer " << cit->first << std::endl;
|
||||||
|
#endif
|
||||||
const RsPeerId& peerId = cit->first;
|
const RsPeerId& peerId = cit->first;
|
||||||
const std::list<RsGxsGroupId>& groupIdList = cit->second;
|
const std::list<RsGxsGroupId>& groupIdList = cit->second;
|
||||||
|
|
||||||
@ -4779,6 +4647,9 @@ void RsGxsNetService::processExplicitGroupRequests()
|
|||||||
uint32_t transN = locked_getTransactionId();
|
uint32_t transN = locked_getTransactionId();
|
||||||
for(; git != groupIdList.end(); ++git)
|
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;
|
||||||
|
#endif
|
||||||
RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType);
|
RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType);
|
||||||
item->grpId = *git;
|
item->grpId = *git;
|
||||||
item->PeerId(peerId);
|
item->PeerId(peerId);
|
||||||
@ -4956,6 +4827,10 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
|
|||||||
// update the publish keys in this group meta info
|
// update the publish keys in this group meta info
|
||||||
|
|
||||||
RsGxsGrpMetaData *grpMeta = grpMetaMap[item->grpId] ;
|
RsGxsGrpMetaData *grpMeta = grpMetaMap[item->grpId] ;
|
||||||
|
if (!grpMeta) {
|
||||||
|
std::cerr << "(EE) RsGxsNetService::handleRecvPublishKeys() grpMeta not found." << std::endl;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
// Check that the keys correspond, and that FULL keys are supplied, etc.
|
// Check that the keys correspond, and that FULL keys are supplied, etc.
|
||||||
|
|
||||||
@ -5028,3 +4903,26 @@ bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& gro
|
|||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid)
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mNxsMutex) ;
|
||||||
|
|
||||||
|
return locked_stampMsgServerUpdateTS(gid) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid)
|
||||||
|
{
|
||||||
|
std::map<RsGxsGroupId,RsGxsServerMsgUpdateItem*>::iterator it = mServerMsgUpdateMap.find(gid) ;
|
||||||
|
|
||||||
|
if(mServerMsgUpdateMap.end() == it)
|
||||||
|
{
|
||||||
|
RsGxsServerMsgUpdateItem *item = new RsGxsServerMsgUpdateItem(mServType);
|
||||||
|
item->grpId = gid ;
|
||||||
|
item->msgUpdateTS = time(NULL) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
it->second->msgUpdateTS = time(NULL) ;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -155,6 +155,7 @@ public:
|
|||||||
virtual void rejectMessage(const RsGxsMessageId& msg_id) ;
|
virtual void rejectMessage(const RsGxsMessageId& msg_id) ;
|
||||||
|
|
||||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
||||||
|
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ;
|
||||||
|
|
||||||
/* p3Config methods */
|
/* p3Config methods */
|
||||||
public:
|
public:
|
||||||
@ -228,6 +229,13 @@ private:
|
|||||||
*/
|
*/
|
||||||
void locked_completeTransaction(NxsTransaction* trans);
|
void locked_completeTransaction(NxsTransaction* trans);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief locked_stampMsgServerUpdateTS
|
||||||
|
* updates the server msg time stamp. This function is the locked method for the one above with similar name
|
||||||
|
* \param gid group id to stamp.
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
bool locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid);
|
||||||
/*!
|
/*!
|
||||||
* This retrieves a unique transaction id that
|
* This retrieves a unique transaction id that
|
||||||
* can be used in an outgoing transaction
|
* can be used in an outgoing transaction
|
||||||
@ -354,6 +362,15 @@ private:
|
|||||||
bool canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& toVet, bool &should_encrypt);
|
bool canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& toVet, bool &should_encrypt);
|
||||||
bool canSendMsgIds(std::vector<RsGxsMsgMetaData*>& msgMetas, const RsGxsGrpMetaData&, const RsPeerId& sslId, RsGxsCircleId &should_encrypt_id);
|
bool canSendMsgIds(std::vector<RsGxsMsgMetaData*>& msgMetas, const RsGxsGrpMetaData&, const RsPeerId& sslId, RsGxsCircleId &should_encrypt_id);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief checkPermissionsForFriendGroup
|
||||||
|
* Checks that we can send/recv from that node, given that the grpMeta has a distribution limited to a local circle.
|
||||||
|
* \param sslId Candidate peer to send to or to receive from.
|
||||||
|
* \param grpMeta Contains info about the group id, internal circle id, etc.
|
||||||
|
* \return true only when the internal exists and validates as a friend node group, and contains the owner of sslId.
|
||||||
|
*/
|
||||||
|
bool checkPermissionsForFriendGroup(const RsPeerId& sslId,const RsGxsGrpMetaData& grpMeta) ;
|
||||||
|
|
||||||
bool checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxsGrpMetaData& meta, RsGxsCircleId& should_encrypt_id);
|
bool checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxsGrpMetaData& meta, RsGxsCircleId& should_encrypt_id);
|
||||||
|
|
||||||
void locked_createTransactionFromPending(MsgRespPending* grpPend);
|
void locked_createTransactionFromPending(MsgRespPending* grpPend);
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "rsgxsutil.h"
|
#include "rsgxsutil.h"
|
||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "retroshare/rsreputations.h"
|
|
||||||
#include "pqi/pqihash.h"
|
#include "pqi/pqihash.h"
|
||||||
#include "gxs/rsgixs.h"
|
#include "gxs/rsgixs.h"
|
||||||
|
|
||||||
@ -165,7 +164,7 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
std::cerr << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl;
|
std::cerr << "TimeStamping group authors' key ID " << grp->metaData->mAuthorId << " in group ID " << grp->grpId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(rsReputations!=NULL && !rsReputations->isIdentityBanned(grp->metaData->mAuthorId))
|
if(rsIdentity!=NULL && !rsIdentity->isBanned(grp->metaData->mAuthorId))
|
||||||
used_gxs_ids.insert(grp->metaData->mAuthorId) ;
|
used_gxs_ids.insert(grp->metaData->mAuthorId) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,7 +246,7 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
#ifdef GXSUTIL_DEBUG
|
#ifdef GXSUTIL_DEBUG
|
||||||
std::cerr << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl;
|
std::cerr << "TimeStamping message authors' key ID " << msg->metaData->mAuthorId << " in message " << msg->msgId << ", group ID " << msg->grpId<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
if(rsReputations!=NULL && !rsReputations->isIdentityBanned(msg->metaData->mAuthorId))
|
if(rsIdentity!=NULL && !rsIdentity->isBanned(msg->metaData->mAuthorId))
|
||||||
used_gxs_ids.insert(msg->metaData->mAuthorId) ;
|
used_gxs_ids.insert(msg->metaData->mAuthorId) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,15 @@ public:
|
|||||||
* \return false if the group is not found, true otherwise
|
* \return false if the group is not found, true otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief stampMsgServerUpdateTS
|
||||||
|
* Updates the msgServerUpdateMap structure to time(NULL), so as to trigger sending msg lists to friends.
|
||||||
|
* This is needed when e.g. posting a new message to a group.
|
||||||
|
* \param gid the group to stamp in msgServerUpdateMap
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSGNP_H
|
#endif // RSGNP_H
|
||||||
|
@ -10,6 +10,10 @@ DESTDIR = lib
|
|||||||
|
|
||||||
#CONFIG += dsdv
|
#CONFIG += dsdv
|
||||||
|
|
||||||
|
# the dht stunner is used to obtain RS' external ip addr. when it is natted
|
||||||
|
# this system is unreliable and rs supports a newer and better one (asking connected peers)
|
||||||
|
# CONFIG += useDhtStunner
|
||||||
|
|
||||||
profiling {
|
profiling {
|
||||||
QMAKE_CXXFLAGS -= -fomit-frame-pointer
|
QMAKE_CXXFLAGS -= -fomit-frame-pointer
|
||||||
QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer
|
QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer
|
||||||
@ -65,8 +69,7 @@ SOURCES *= serialiser/rstlvdsdv.cc \
|
|||||||
bitdht {
|
bitdht {
|
||||||
|
|
||||||
HEADERS += dht/p3bitdht.h \
|
HEADERS += dht/p3bitdht.h \
|
||||||
dht/connectstatebox.h \
|
dht/connectstatebox.h
|
||||||
dht/stunaddrassist.h
|
|
||||||
|
|
||||||
SOURCES += dht/p3bitdht.cc \
|
SOURCES += dht/p3bitdht.cc \
|
||||||
dht/p3bitdht_interface.cc \
|
dht/p3bitdht_interface.cc \
|
||||||
@ -80,7 +83,6 @@ HEADERS += tcponudp/udppeer.h \
|
|||||||
tcponudp/tcppacket.h \
|
tcponudp/tcppacket.h \
|
||||||
tcponudp/tcpstream.h \
|
tcponudp/tcpstream.h \
|
||||||
tcponudp/tou.h \
|
tcponudp/tou.h \
|
||||||
tcponudp/udpstunner.h \
|
|
||||||
tcponudp/udprelay.h \
|
tcponudp/udprelay.h \
|
||||||
|
|
||||||
SOURCES += tcponudp/udppeer.cc \
|
SOURCES += tcponudp/udppeer.cc \
|
||||||
@ -88,9 +90,17 @@ SOURCES += tcponudp/udppeer.cc \
|
|||||||
tcponudp/tcpstream.cc \
|
tcponudp/tcpstream.cc \
|
||||||
tcponudp/tou.cc \
|
tcponudp/tou.cc \
|
||||||
tcponudp/bss_tou.c \
|
tcponudp/bss_tou.c \
|
||||||
tcponudp/udpstunner.cc \
|
|
||||||
tcponudp/udprelay.cc \
|
tcponudp/udprelay.cc \
|
||||||
|
|
||||||
|
useDhtStunner {
|
||||||
|
HEADERS += dht/stunaddrassist.h \
|
||||||
|
tcponudp/udpstunner.h
|
||||||
|
|
||||||
|
SOURCES += tcponudp/udpstunner.cc
|
||||||
|
|
||||||
|
DEFINES += RS_USE_DHT_STUNNER
|
||||||
|
}
|
||||||
|
|
||||||
DEFINES *= RS_USE_BITDHT
|
DEFINES *= RS_USE_BITDHT
|
||||||
|
|
||||||
BITDHT_DIR = ../../libbitdht/src
|
BITDHT_DIR = ../../libbitdht/src
|
||||||
|
@ -75,9 +75,9 @@ bool PgpAuxUtilsImpl::askForDeferredSelfSignature(const void *data,
|
|||||||
const uint32_t len,
|
const uint32_t len,
|
||||||
unsigned char *sign,
|
unsigned char *sign,
|
||||||
unsigned int *signlen,
|
unsigned int *signlen,
|
||||||
int& signature_result )
|
int& signature_result , std::string reason)
|
||||||
{
|
{
|
||||||
return RsServer::notify()->askForDeferredSelfSignature(data, len, sign, signlen, signature_result);
|
return RsServer::notify()->askForDeferredSelfSignature(data, len, sign, signlen, signature_result, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class PgpAuxUtils
|
|||||||
|
|
||||||
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const =0;
|
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const =0;
|
||||||
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint) = 0;
|
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint) = 0;
|
||||||
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result ) = 0;
|
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PgpAuxUtilsImpl: public PgpAuxUtils
|
class PgpAuxUtilsImpl: public PgpAuxUtils
|
||||||
@ -58,7 +58,7 @@ public:
|
|||||||
virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const;
|
virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const;
|
||||||
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint);
|
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint);
|
||||||
virtual bool getGPGAllList(std::list<RsPgpId> &ids);
|
virtual bool getGPGAllList(std::list<RsPgpId> &ids);
|
||||||
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result );
|
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ ops_parse_cb_return_t cb_get_passphrase(const ops_parser_content_t *content_,ops
|
|||||||
uid_hint += "(" + RsPgpId(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ;
|
uid_hint += "(" + RsPgpId(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ;
|
||||||
|
|
||||||
bool cancelled = false ;
|
bool cancelled = false ;
|
||||||
passwd = PGPHandler::passphraseCallback()(NULL,uid_hint.c_str(),NULL,prev_was_bad,&cancelled) ;
|
passwd = PGPHandler::passphraseCallback()(NULL,"",uid_hint.c_str(),NULL,prev_was_bad,&cancelled) ;
|
||||||
|
|
||||||
if(cancelled)
|
if(cancelled)
|
||||||
*(unsigned char *)cbinfo->arg = 1;
|
*(unsigned char *)cbinfo->arg = 1;
|
||||||
@ -1326,7 +1326,7 @@ bool PGPHandler::decryptTextFromFile(const RsPgpId&,std::string& text,const std:
|
|||||||
return (bool)res ;
|
return (bool)res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PGPHandler::SignDataBin(const RsPgpId& id,const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,bool use_raw_signature)
|
bool PGPHandler::SignDataBin(const RsPgpId& id,const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,bool use_raw_signature, std::string reason /* = "" */)
|
||||||
{
|
{
|
||||||
RsStackMutex mtx(pgphandlerMtx) ; // lock access to PGP memory structures.
|
RsStackMutex mtx(pgphandlerMtx) ; // lock access to PGP memory structures.
|
||||||
// need to find the key and to decrypt it.
|
// need to find the key and to decrypt it.
|
||||||
@ -1357,7 +1357,7 @@ ops_secret_key_t *secret_key = NULL ;
|
|||||||
for(int i=0;i<3;++i)
|
for(int i=0;i<3;++i)
|
||||||
{
|
{
|
||||||
bool cancelled =false;
|
bool cancelled =false;
|
||||||
std::string passphrase = _passphrase_callback(NULL,uid_hint.c_str(),"Please enter passwd for encrypting your key : ",last_passwd_was_wrong,&cancelled) ;
|
std::string passphrase = _passphrase_callback(NULL,reason.c_str(),uid_hint.c_str(),"Please enter passwd for encrypting your key : ",last_passwd_was_wrong,&cancelled) ;//TODO reason
|
||||||
|
|
||||||
secret_key = ops_decrypt_secret_key_from_data(key,passphrase.c_str()) ;
|
secret_key = ops_decrypt_secret_key_from_data(key,passphrase.c_str()) ;
|
||||||
|
|
||||||
@ -1449,7 +1449,7 @@ bool PGPHandler::privateSignCertificate(const RsPgpId& ownId,const RsPgpId& id_o
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cancelled = false;
|
bool cancelled = false;
|
||||||
std::string passphrase = _passphrase_callback(NULL,RsPgpId(skey->key_id).toStdString().c_str(),"Please enter passwd for encrypting your key : ",false,&cancelled) ;
|
std::string passphrase = _passphrase_callback(NULL,"",RsPgpId(skey->key_id).toStdString().c_str(),"Please enter passwd for encrypting your key : ",false,&cancelled) ;
|
||||||
|
|
||||||
ops_secret_key_t *secret_key = ops_decrypt_secret_key_from_data(skey,passphrase.c_str()) ;
|
ops_secret_key_t *secret_key = ops_decrypt_secret_key_from_data(skey,passphrase.c_str()) ;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ extern "C" {
|
|||||||
#include <openpgpsdk/keyring_local.h>
|
#include <openpgpsdk/keyring_local.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::string (*PassphraseCallback)(void *data, const char *uid_hint, const char *passphrase_info, int prev_was_bad,bool *cancelled) ;
|
typedef std::string (*PassphraseCallback)(void *data, const char *uid_title, const char *uid_hint, const char *passphrase_info, int prev_was_bad,bool *cancelled) ;
|
||||||
|
|
||||||
class PGPCertificateInfo
|
class PGPCertificateInfo
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ class PGPHandler
|
|||||||
bool exportPublicKey(const RsPgpId& id,unsigned char *& mem,size_t& mem_size,bool armoured,bool include_signatures) const ;
|
bool exportPublicKey(const RsPgpId& id,unsigned char *& mem,size_t& mem_size,bool armoured,bool include_signatures) const ;
|
||||||
|
|
||||||
bool parseSignature(unsigned char *sign, unsigned int signlen,RsPgpId& issuer_id) ;
|
bool parseSignature(unsigned char *sign, unsigned int signlen,RsPgpId& issuer_id) ;
|
||||||
bool SignDataBin(const RsPgpId& id,const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,bool make_raw_signature=false) ;
|
bool SignDataBin(const RsPgpId& id, const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, bool make_raw_signature=false, std::string reason = "") ;
|
||||||
bool VerifySignBin(const void *data, uint32_t data_len, unsigned char *sign, unsigned int sign_len, const PGPFingerprintType& withfingerprint) ;
|
bool VerifySignBin(const void *data, uint32_t data_len, unsigned char *sign, unsigned int sign_len, const PGPFingerprintType& withfingerprint) ;
|
||||||
bool privateSignCertificate(const RsPgpId& own_id,const RsPgpId& id_of_key_to_sign) ;
|
bool privateSignCertificate(const RsPgpId& own_id,const RsPgpId& id_of_key_to_sign) ;
|
||||||
|
|
||||||
|
@ -248,23 +248,25 @@ uint64_t PGPKeyParser::read_KeyID(unsigned char *& data)
|
|||||||
|
|
||||||
uint32_t PGPKeyParser::write_125Size(unsigned char *data,uint32_t size)
|
uint32_t PGPKeyParser::write_125Size(unsigned char *data,uint32_t size)
|
||||||
{
|
{
|
||||||
if(size < 192)
|
if(size < 192)//192 To know if size is coded with One Char < 0xC0
|
||||||
{
|
{
|
||||||
data[0] = size ;
|
data[0] = size ;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(size < 8384)
|
if(size < 8384)//8384 To know if size is coded with Two Chars < 0xE0. See RFC4880
|
||||||
{
|
{
|
||||||
data[0] = (size >> 8) + 192 ;
|
data[1] = (size - 192) & 0xFF ;//Warning data[1] could be "negative", recode it using 8bits type
|
||||||
data[1] = (size & 255) - 192 ;
|
data[0] = ((size - 192 - data[1]) >> 8) + 192 ;
|
||||||
|
|
||||||
|
return 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
data[0] = 0xff ;
|
data[0] = 0xFF ; //Else size is coded with 4 Chars + 1 at 0xFF
|
||||||
data[1] = (size >> 24) & 255 ;
|
data[1] = (size >> 24) & 0xFF ;
|
||||||
data[2] = (size >> 16) & 255 ;
|
data[2] = (size >> 16) & 0xFF ;
|
||||||
data[3] = (size >> 8) & 255 ;
|
data[3] = (size >> 8) & 0xFF ;
|
||||||
data[4] = (size ) & 255 ;
|
data[4] = (size ) & 0xFF ;
|
||||||
|
|
||||||
return 5 ;
|
return 5 ;
|
||||||
}
|
}
|
||||||
@ -274,16 +276,16 @@ uint32_t PGPKeyParser::read_125Size(unsigned char *& data)
|
|||||||
uint8_t b1 = *data ;
|
uint8_t b1 = *data ;
|
||||||
++data ;
|
++data ;
|
||||||
|
|
||||||
if(b1 < 192)
|
if(b1 < 192) //192 Size is coded with One Char. See RFC4880
|
||||||
return b1 ;
|
return b1 ;
|
||||||
|
|
||||||
uint8_t b2 = *data ;
|
uint8_t b2 = *data ;
|
||||||
++data ;
|
++data ;
|
||||||
|
|
||||||
if(b1 < 224)
|
if(b1 < 224)//224 = 0xC0+0x20 Size is coded with Two Chars
|
||||||
return ((b1-192) << 8) + b2 + 192 ;
|
return ((b1-192) << 8) + b2 + 192 ; // see RFC4880
|
||||||
|
|
||||||
if(b1 != 0xff)
|
if(b1 != 0xFF)// Else Coded with 4 Chars but first == 0xFF
|
||||||
throw std::runtime_error("GPG parsing error") ;
|
throw std::runtime_error("GPG parsing error") ;
|
||||||
|
|
||||||
uint8_t b3 = *data ; ++data ;
|
uint8_t b3 = *data ; ++data ;
|
||||||
|
@ -86,14 +86,14 @@ bool AuthGPG::encryptTextToFile(const std::string& text,const std::string& outfi
|
|||||||
// return PGPHandler::encryptTextToString(RsPgpId(pgp_id),text,outstr) ;
|
// return PGPHandler::encryptTextToString(RsPgpId(pgp_id),text,outstr) ;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
std::string pgp_pwd_callback(void * /*hook*/, const char *uid_hint, const char * /*passphrase_info*/, int prev_was_bad,bool *cancelled)
|
std::string pgp_pwd_callback(void * /*hook*/, const char *uid_title, const char *uid_hint, const char * /*passphrase_info*/, int prev_was_bad,bool *cancelled)
|
||||||
{
|
{
|
||||||
#define GPG_DEBUG2
|
#define GPG_DEBUG2
|
||||||
#ifdef GPG_DEBUG2
|
#ifdef GPG_DEBUG2
|
||||||
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
||||||
#endif
|
#endif
|
||||||
std::string password;
|
std::string password;
|
||||||
RsServer::notify()->askForPassword(uid_hint, prev_was_bad, password,cancelled) ;
|
RsServer::notify()->askForPassword(uid_title, uid_hint, prev_was_bad, password,cancelled) ;
|
||||||
|
|
||||||
return password ;
|
return password ;
|
||||||
}
|
}
|
||||||
@ -296,9 +296,9 @@ void AuthGPG::processServices()
|
|||||||
delete operation;
|
delete operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthGPG::DoOwnSignature(const void *data, unsigned int datalen, void *buf_sigout, unsigned int *outl)
|
bool AuthGPG::DoOwnSignature(const void *data, unsigned int datalen, void *buf_sigout, unsigned int *outl, std::string reason /* = "" */)
|
||||||
{
|
{
|
||||||
return PGPHandler::SignDataBin(mOwnGpgId,data,datalen,(unsigned char *)buf_sigout,outl) ;
|
return PGPHandler::SignDataBin(mOwnGpgId,data,datalen,(unsigned char *)buf_sigout,outl,false,reason) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -605,9 +605,9 @@ bool AuthGPG::decryptDataBin(const void *data, unsigned int datalen, unsigned ch
|
|||||||
{
|
{
|
||||||
return PGPHandler::decryptDataBin(mOwnGpgId,data,datalen,sign,signlen) ;
|
return PGPHandler::decryptDataBin(mOwnGpgId,data,datalen,sign,signlen) ;
|
||||||
}
|
}
|
||||||
bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen)
|
bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen, std::string reason /*= ""*/)
|
||||||
{
|
{
|
||||||
return DoOwnSignature(data, datalen, sign, signlen);
|
return DoOwnSignature(data, datalen, sign, signlen, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint)
|
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint)
|
||||||
|
@ -208,7 +208,7 @@ class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
|
|||||||
* There should also be Encryption Functions... (do later).
|
* There should also be Encryption Functions... (do later).
|
||||||
*
|
*
|
||||||
****/
|
****/
|
||||||
virtual bool SignDataBin(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen);
|
virtual bool SignDataBin(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "");
|
||||||
virtual bool VerifySignBin(const void*, uint32_t, unsigned char*, unsigned int, const PGPFingerprintType& withfingerprint);
|
virtual bool VerifySignBin(const void*, uint32_t, unsigned char*, unsigned int, const PGPFingerprintType& withfingerprint);
|
||||||
virtual bool parseSignature(const void *sig, unsigned int siglen, RsPgpId& issuer_id);
|
virtual bool parseSignature(const void *sig, unsigned int siglen, RsPgpId& issuer_id);
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
|
|||||||
//void createDummyFriends(void); //NYI
|
//void createDummyFriends(void); //NYI
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
bool DoOwnSignature(const void *, unsigned int, void *, unsigned int *);
|
bool DoOwnSignature(const void *, unsigned int, void *, unsigned int *, std::string reason);
|
||||||
bool VerifySignature(const void *data, int datalen, const void *sig, unsigned int siglen, const PGPFingerprintType& withfingerprint);
|
bool VerifySignature(const void *data, int datalen, const void *sig, unsigned int siglen, const PGPFingerprintType& withfingerprint);
|
||||||
|
|
||||||
/* Sign/Trust stuff */
|
/* Sign/Trust stuff */
|
||||||
|
@ -850,7 +850,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
|
|||||||
std::cerr << "Digest Applied: len: " << hashoutl << std::endl;
|
std::cerr << "Digest Applied: len: " << hashoutl << std::endl;
|
||||||
|
|
||||||
/* NOW Sign via GPG Functions */
|
/* NOW Sign via GPG Functions */
|
||||||
if (!AuthGPG::getAuthGPG()->SignDataBin(buf_hashout, hashoutl, buf_sigout, (unsigned int *) &sigoutl))
|
if (!AuthGPG::getAuthGPG()->SignDataBin(buf_hashout, hashoutl, buf_sigout, (unsigned int *) &sigoutl,"AuthSSLimpl::SignX509ReqWithGPG()"))
|
||||||
{
|
{
|
||||||
sigoutl = 0;
|
sigoutl = 0;
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -138,8 +138,6 @@ p3LinkMgrIMPL::p3LinkMgrIMPL(p3PeerMgrIMPL *peerMgr, p3NetMgrIMPL *netMgr)
|
|||||||
mDNSResolver = new DNSResolver();
|
mDNSResolver = new DNSResolver();
|
||||||
mRetryPeriod = MIN_RETRY_PERIOD;
|
mRetryPeriod = MIN_RETRY_PERIOD;
|
||||||
|
|
||||||
lastGroupId = 1;
|
|
||||||
|
|
||||||
/* setup Banned Ip Address - static for now
|
/* setup Banned Ip Address - static for now
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class peerConnectState
|
|||||||
};
|
};
|
||||||
|
|
||||||
class p3tunnel;
|
class p3tunnel;
|
||||||
class RsPeerGroupItem;
|
class RsPeerGroupItem_deprecated;
|
||||||
class RsGroupInfo;
|
class RsGroupInfo;
|
||||||
|
|
||||||
class p3PeerMgr;
|
class p3PeerMgr;
|
||||||
@ -339,9 +339,6 @@ private:
|
|||||||
std::map<RsPeerId, peerConnectState> mFriendList;
|
std::map<RsPeerId, peerConnectState> mFriendList;
|
||||||
std::map<RsPeerId, peerConnectState> mOthersList;
|
std::map<RsPeerId, peerConnectState> mOthersList;
|
||||||
|
|
||||||
std::list<RsPeerGroupItem *> groupList;
|
|
||||||
uint32_t lastGroupId;
|
|
||||||
|
|
||||||
/* relatively static list of banned ip addresses */
|
/* relatively static list of banned ip addresses */
|
||||||
std::list<struct sockaddr_storage> mBannedIpList;
|
std::list<struct sockaddr_storage> mBannedIpList;
|
||||||
};
|
};
|
||||||
|
@ -169,12 +169,13 @@ void p3NetMgrIMPL::setManagers(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr)
|
|||||||
// mDhtMgr = dhtMgr;
|
// mDhtMgr = dhtMgr;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
void p3NetMgrIMPL::setAddrAssist(pqiAddrAssist *dhtStun, pqiAddrAssist *proxyStun)
|
void p3NetMgrIMPL::setAddrAssist(pqiAddrAssist *dhtStun, pqiAddrAssist *proxyStun)
|
||||||
{
|
{
|
||||||
mDhtStunner = dhtStun;
|
mDhtStunner = dhtStun;
|
||||||
mProxyStunner = proxyStun;
|
mProxyStunner = proxyStun;
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
|
|
||||||
/***** Framework / initial implementation for a connection manager.
|
/***** Framework / initial implementation for a connection manager.
|
||||||
@ -445,6 +446,7 @@ void p3NetMgrIMPL::slowTick()
|
|||||||
netAssistTick();
|
netAssistTick();
|
||||||
updateNetStateBox_temporal();
|
updateNetStateBox_temporal();
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
if (mDhtStunner)
|
if (mDhtStunner)
|
||||||
{
|
{
|
||||||
mDhtStunner->tick();
|
mDhtStunner->tick();
|
||||||
@ -454,7 +456,7 @@ void p3NetMgrIMPL::slowTick()
|
|||||||
{
|
{
|
||||||
mProxyStunner->tick();
|
mProxyStunner->tick();
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STARTUP_DELAY 5
|
#define STARTUP_DELAY 5
|
||||||
@ -1734,11 +1736,12 @@ void p3NetMgrIMPL::updateNetStateBox_temporal()
|
|||||||
std::cerr << "p3NetMgrIMPL::updateNetStateBox_temporal() ";
|
std::cerr << "p3NetMgrIMPL::updateNetStateBox_temporal() ";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t isstable = 0;
|
|
||||||
struct sockaddr_storage tmpaddr;
|
struct sockaddr_storage tmpaddr;
|
||||||
sockaddr_storage_clear(tmpaddr);
|
sockaddr_storage_clear(tmpaddr);
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
|
uint8_t isstable = 0;
|
||||||
|
|
||||||
if (mDhtStunner)
|
if (mDhtStunner)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1776,6 +1779,7 @@ void p3NetMgrIMPL::updateNetStateBox_temporal()
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1789,7 +1793,7 @@ void p3NetMgrIMPL::updateNetStateBox_temporal()
|
|||||||
|
|
||||||
/* now we check if a WebIP address is required? */
|
/* now we check if a WebIP address is required? */
|
||||||
|
|
||||||
|
#ifdef NETMGR_DEBUG_STATEBOX
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
@ -1805,7 +1809,6 @@ void p3NetMgrIMPL::updateNetStateBox_temporal()
|
|||||||
std::string nattypestr = NetStateNatTypeString(natType);
|
std::string nattypestr = NetStateNatTypeString(natType);
|
||||||
std::string netmodestr = NetStateNetworkModeString(netMode);
|
std::string netmodestr = NetStateNetworkModeString(netMode);
|
||||||
|
|
||||||
#ifdef NETMGR_DEBUG_STATEBOX
|
|
||||||
std::cerr << "p3NetMgrIMPL::updateNetStateBox_temporal() NetStateBox Thinking";
|
std::cerr << "p3NetMgrIMPL::updateNetStateBox_temporal() NetStateBox Thinking";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "\tNetState: " << netstatestr;
|
std::cerr << "\tNetState: " << netstatestr;
|
||||||
@ -1818,10 +1821,9 @@ void p3NetMgrIMPL::updateNetStateBox_temporal()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "\tNatType: " << nattypestr;
|
std::cerr << "\tNatType: " << nattypestr;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
updateNatSetting();
|
updateNatSetting();
|
||||||
|
|
||||||
@ -1869,7 +1871,7 @@ void p3NetMgrIMPL::updateNatSetting()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
switch(natType)
|
switch(natType)
|
||||||
{
|
{
|
||||||
case RSNET_NATTYPE_RESTRICTED_CONE:
|
case RSNET_NATTYPE_RESTRICTED_CONE:
|
||||||
@ -1894,7 +1896,7 @@ void p3NetMgrIMPL::updateNatSetting()
|
|||||||
mProxyStunner->setRefreshPeriod(NET_STUNNER_PERIOD_SLOW);
|
mProxyStunner->setRefreshPeriod(NET_STUNNER_PERIOD_SLOW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
/* This controls the Attach mode of the DHT...
|
/* This controls the Attach mode of the DHT...
|
||||||
* which effectively makes the DHT "attach" to Open Nodes.
|
* which effectively makes the DHT "attach" to Open Nodes.
|
||||||
|
@ -209,7 +209,9 @@ virtual bool getDHTEnabled();
|
|||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
|
|
||||||
void setManagers(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr);
|
void setManagers(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr);
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
void setAddrAssist(pqiAddrAssist *dhtStun, pqiAddrAssist *proxyStun);
|
void setAddrAssist(pqiAddrAssist *dhtStun, pqiAddrAssist *proxyStun);
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
|
||||||
@ -319,8 +321,10 @@ private:
|
|||||||
p3LinkMgr *mLinkMgr;
|
p3LinkMgr *mLinkMgr;
|
||||||
|
|
||||||
//p3BitDht *mBitDht;
|
//p3BitDht *mBitDht;
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
pqiAddrAssist *mDhtStunner;
|
pqiAddrAssist *mDhtStunner;
|
||||||
pqiAddrAssist *mProxyStunner;
|
pqiAddrAssist *mProxyStunner;
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
RsMutex mNetMtx; /* protects below */
|
RsMutex mNetMtx; /* protects below */
|
||||||
|
|
||||||
|
@ -245,10 +245,10 @@ void p3Notify::notifyDownloadComplete (const std::string& fileHash )
|
|||||||
void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; }
|
void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; }
|
||||||
void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; }
|
void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; }
|
||||||
|
|
||||||
bool p3Notify::askForPassword (const std::string& key_details , bool prev_is_bad , std::string& password,bool *cancelled)
|
bool p3Notify::askForPassword (const std::string& title , const std::string& key_details , bool prev_is_bad , std::string& password,bool *cancelled)
|
||||||
{
|
{
|
||||||
FOR_ALL_NOTIFY_CLIENTS
|
FOR_ALL_NOTIFY_CLIENTS
|
||||||
if( (*it)->askForPassword(key_details,prev_is_bad,password,*cancelled))
|
if( (*it)->askForPassword(title,key_details,prev_is_bad,password,*cancelled))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
@ -261,10 +261,10 @@ bool p3Notify::askForPluginConfirmation (const std::string& plugin_filen
|
|||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
bool p3Notify::askForDeferredSelfSignature (const void * data , const uint32_t len , unsigned char *sign, unsigned int *signlen,int& signature_result )
|
bool p3Notify::askForDeferredSelfSignature (const void * data , const uint32_t len , unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason /*=""*/)
|
||||||
{
|
{
|
||||||
FOR_ALL_NOTIFY_CLIENTS
|
FOR_ALL_NOTIFY_CLIENTS
|
||||||
if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result))
|
if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result, reason))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
|
@ -116,12 +116,12 @@ class p3Notify: public RsNotify
|
|||||||
void notifyPeerStatusChangedSummary () ;
|
void notifyPeerStatusChangedSummary () ;
|
||||||
void notifyDiscInfoChanged () ;
|
void notifyDiscInfoChanged () ;
|
||||||
|
|
||||||
bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) ;
|
bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */, int& signature_result , std::string reason = "") ;
|
||||||
void notifyDownloadComplete (const std::string& /* fileHash */) ;
|
void notifyDownloadComplete (const std::string& /* fileHash */) ;
|
||||||
void notifyDownloadCompleteCount (uint32_t /* count */) ;
|
void notifyDownloadCompleteCount (uint32_t /* count */) ;
|
||||||
void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ;
|
void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ;
|
||||||
|
|
||||||
bool askForPassword (const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ;
|
bool askForPassword (const std::string& title, const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ;
|
||||||
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ;
|
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -75,7 +75,7 @@ static struct RsLog::logInfo p3peermgrzoneInfo = {RsLog::Default, "p3peermgr"};
|
|||||||
|
|
||||||
static const std::string kConfigDefaultProxyServerIpAddr = "127.0.0.1";
|
static const std::string kConfigDefaultProxyServerIpAddr = "127.0.0.1";
|
||||||
static const uint16_t kConfigDefaultProxyServerPortTor = 9050; // standard port.
|
static const uint16_t kConfigDefaultProxyServerPortTor = 9050; // standard port.
|
||||||
static const uint16_t kConfigDefaultProxyServerPortI2P = 10; // there is no standard port though
|
static const uint16_t kConfigDefaultProxyServerPortI2P = 4447; // I2Pd's standard port
|
||||||
|
|
||||||
static const std::string kConfigKeyExtIpFinder = "USE_EXTR_IP_FINDER";
|
static const std::string kConfigKeyExtIpFinder = "USE_EXTR_IP_FINDER";
|
||||||
static const std::string kConfigKeyProxyServerIpAddrTor = "PROXY_SERVER_IPADDR";
|
static const std::string kConfigKeyProxyServerIpAddrTor = "PROXY_SERVER_IPADDR";
|
||||||
@ -130,8 +130,6 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_
|
|||||||
mOwnState.vs_disc = RS_VS_DISC_FULL;
|
mOwnState.vs_disc = RS_VS_DISC_FULL;
|
||||||
mOwnState.vs_dht = RS_VS_DHT_FULL;
|
mOwnState.vs_dht = RS_VS_DHT_FULL;
|
||||||
|
|
||||||
lastGroupId = 1;
|
|
||||||
|
|
||||||
// setup default ProxyServerAddress.
|
// setup default ProxyServerAddress.
|
||||||
// Tor
|
// Tor
|
||||||
sockaddr_storage_clear(mProxyServerAddressTor);
|
sockaddr_storage_clear(mProxyServerAddressTor);
|
||||||
@ -1071,7 +1069,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPgpId &id)
|
|||||||
|
|
||||||
std::list<RsPgpId> ids ;
|
std::list<RsPgpId> ids ;
|
||||||
ids.push_back(id) ;
|
ids.push_back(id) ;
|
||||||
assignPeersToGroup("", ids, false);
|
assignPeersToGroup(RsNodeGroupId(), ids, false);
|
||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
@ -1145,7 +1143,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPeerId &id, bool removePgpId)
|
|||||||
|
|
||||||
/* remove id from all groups */
|
/* remove id from all groups */
|
||||||
|
|
||||||
assignPeersToGroup("", pgpid_toRemove, false);
|
assignPeersToGroup(RsNodeGroupId(), pgpid_toRemove, false);
|
||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
@ -1915,7 +1913,7 @@ RsSerialiser *p3PeerMgrIMPL::setupSerialiser()
|
|||||||
bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||||
{
|
{
|
||||||
/* create a list of current peers */
|
/* create a list of current peers */
|
||||||
cleanup = false;
|
cleanup = true;
|
||||||
bool useExtAddrFinder = mNetMgr->getIPServersEnabled();
|
bool useExtAddrFinder = mNetMgr->getIPServersEnabled();
|
||||||
|
|
||||||
/* gather these information before mPeerMtx is locked! */
|
/* gather these information before mPeerMtx is locked! */
|
||||||
@ -1971,7 +1969,6 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
saveData.push_back(item);
|
saveData.push_back(item);
|
||||||
saveCleanupList.push_back(item);
|
|
||||||
|
|
||||||
/* iterate through all friends and save */
|
/* iterate through all friends and save */
|
||||||
std::map<RsPeerId, peerState>::iterator it;
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
@ -2003,7 +2000,6 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
item->domain_port = (it->second).hiddenPort;
|
item->domain_port = (it->second).hiddenPort;
|
||||||
|
|
||||||
saveData.push_back(item);
|
saveData.push_back(item);
|
||||||
saveCleanupList.push_back(item);
|
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "p3PeerMgrIMPL::saveList() Peer Config Item:" << std::endl;
|
std::cerr << "p3PeerMgrIMPL::saveList() Peer Config Item:" << std::endl;
|
||||||
item->print(std::cerr, 10);
|
item->print(std::cerr, 10);
|
||||||
@ -2024,7 +2020,6 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveData.push_back(sitem) ;
|
saveData.push_back(sitem) ;
|
||||||
saveCleanupList.push_back(sitem);
|
|
||||||
|
|
||||||
// Now save config for network digging strategies
|
// Now save config for network digging strategies
|
||||||
|
|
||||||
@ -2066,13 +2061,13 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
saveData.push_back(vitem);
|
saveData.push_back(vitem);
|
||||||
saveCleanupList.push_back(vitem);
|
|
||||||
|
|
||||||
/* save groups */
|
/* save groups */
|
||||||
|
|
||||||
std::list<RsPeerGroupItem *>::iterator groupIt;
|
for ( std::map<RsNodeGroupId,RsGroupInfo>::iterator groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt)
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
{
|
||||||
saveData.push_back(*groupIt); // no delete
|
RsNodeGroupItem *itm = new RsNodeGroupItem(groupIt->second);
|
||||||
|
saveData.push_back(itm) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2294,7 +2289,8 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPeerGroupItem *gitem = dynamic_cast<RsPeerGroupItem *>(*it) ;
|
RsPeerGroupItem_deprecated *gitem = dynamic_cast<RsPeerGroupItem_deprecated *>(*it) ;
|
||||||
|
|
||||||
if (gitem)
|
if (gitem)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
@ -2304,20 +2300,54 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
|||||||
gitem->print(std::cerr, 10);
|
gitem->print(std::cerr, 10);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
RsGroupInfo ginfo ;
|
||||||
|
ginfo.flag = gitem->flag ;
|
||||||
|
ginfo.name = gitem->name ;
|
||||||
|
ginfo.peerIds = gitem->pgpList.ids ;
|
||||||
|
|
||||||
groupList.push_back(gitem); // don't delete
|
do { ginfo.id = RsNodeGroupId::random(); } while(groupList.find(ginfo.id) != groupList.end()) ;
|
||||||
|
|
||||||
if ((gitem->flag & RS_GROUP_FLAG_STANDARD) == 0) {
|
// Ensure backward compatibility when loading the group in old format. The id must matchthe standard default id.
|
||||||
/* calculate group id */
|
|
||||||
uint32_t groupId = atoi(gitem->id.c_str());
|
if(gitem->id == std::string(RS_GROUP_DEFAULT_NAME_FRIENDS )) ginfo.id = RS_GROUP_ID_FRIENDS ;
|
||||||
if (groupId > lastGroupId) {
|
if(gitem->id == std::string(RS_GROUP_DEFAULT_NAME_COWORKERS)) ginfo.id = RS_GROUP_ID_COWORKERS ;
|
||||||
lastGroupId = groupId;
|
if(gitem->id == std::string(RS_GROUP_DEFAULT_NAME_FAMILY )) ginfo.id = RS_GROUP_ID_FAMILY ;
|
||||||
}
|
if(gitem->id == std::string(RS_GROUP_DEFAULT_NAME_FAVORITES)) ginfo.id = RS_GROUP_ID_FAVORITES ;
|
||||||
|
if(gitem->id == std::string(RS_GROUP_DEFAULT_NAME_OTHERS )) ginfo.id = RS_GROUP_ID_OTHERS ;
|
||||||
|
|
||||||
|
if(!ginfo.id.isNull())
|
||||||
|
{
|
||||||
|
groupList[ginfo.id] = ginfo ;
|
||||||
|
std::cerr << "(II) Creating new group for old format local group \"" << gitem->name << "\". Id=" << ginfo.id << std::endl;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
std::cerr << "(EE) no group corresponding to old format group with ID=\"" << gitem->id << "\"" << std::endl;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsNodeGroupItem *gitem2 = dynamic_cast<RsNodeGroupItem*>(*it) ;
|
||||||
|
|
||||||
|
if (gitem2)
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::loadList() Peer group item:" << std::endl;
|
||||||
|
gitem->print(std::cerr, 10);
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
RsGroupInfo info ;
|
||||||
|
info.peerIds = gitem2->pgpList.ids ;
|
||||||
|
info.id = gitem2->id ;
|
||||||
|
info.name = gitem2->name ;
|
||||||
|
info.flag = gitem2->flag ;
|
||||||
|
|
||||||
|
std::cerr << "(II) Loaded group in new format. ID = " << info.id << std::endl;
|
||||||
|
groupList[info.id] = info ;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
RsPeerBandwidthLimitsItem *pblitem = dynamic_cast<RsPeerBandwidthLimitsItem*>(*it) ;
|
RsPeerBandwidthLimitsItem *pblitem = dynamic_cast<RsPeerBandwidthLimitsItem*>(*it) ;
|
||||||
|
|
||||||
if(pblitem)
|
if(pblitem)
|
||||||
@ -2363,41 +2393,18 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
|||||||
|
|
||||||
/* Standard groups */
|
/* Standard groups */
|
||||||
const int standardGroupCount = 5;
|
const int standardGroupCount = 5;
|
||||||
const char *standardGroup[standardGroupCount] = { RS_GROUP_ID_FRIENDS, RS_GROUP_ID_FAMILY, RS_GROUP_ID_COWORKERS, RS_GROUP_ID_OTHERS, RS_GROUP_ID_FAVORITES };
|
const RsNodeGroupId standardGroupIds [standardGroupCount] = { RS_GROUP_ID_FRIENDS, RS_GROUP_ID_FAMILY, RS_GROUP_ID_COWORKERS, RS_GROUP_ID_OTHERS, RS_GROUP_ID_FAVORITES };
|
||||||
bool foundStandardGroup[standardGroupCount] = { false, false, false, false, false };
|
const char *standardGroupNames[standardGroupCount] = { RS_GROUP_DEFAULT_NAME_FRIENDS, RS_GROUP_DEFAULT_NAME_FAMILY, RS_GROUP_DEFAULT_NAME_COWORKERS, RS_GROUP_DEFAULT_NAME_OTHERS, RS_GROUP_DEFAULT_NAME_FAVORITES };
|
||||||
|
|
||||||
std::list<RsPeerGroupItem *>::iterator groupIt;
|
for(uint32_t k=0;k<standardGroupCount;++k)
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
if(groupList.find(standardGroupIds[k]) == groupList.end())
|
||||||
if ((*groupIt)->flag & RS_GROUP_FLAG_STANDARD) {
|
{
|
||||||
int i;
|
RsGroupInfo info ;
|
||||||
for (i = 0; i < standardGroupCount; ++i) {
|
info.id = standardGroupIds[k];
|
||||||
if ((*groupIt)->id == standardGroup[i]) {
|
info.name = standardGroupNames[k];
|
||||||
foundStandardGroup[i] = true;
|
info.flag |= RS_GROUP_FLAG_STANDARD;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i >= standardGroupCount) {
|
groupList[info.id] = info;
|
||||||
/* No more a standard group, remove the flag standard */
|
|
||||||
(*groupIt)->flag &= ~RS_GROUP_FLAG_STANDARD;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
uint32_t groupId = atoi((*groupIt)->id.c_str());
|
|
||||||
if (groupId == 0) {
|
|
||||||
rs_sprintf((*groupIt)->id, "%lu", lastGroupId++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize standard groups */
|
|
||||||
for (int i = 0; i < standardGroupCount; ++i) {
|
|
||||||
if (foundStandardGroup[i] == false) {
|
|
||||||
RsPeerGroupItem *gitem = new RsPeerGroupItem;
|
|
||||||
gitem->id = standardGroup[i];
|
|
||||||
gitem->name = standardGroup[i];
|
|
||||||
gitem->flag |= RS_GROUP_FLAG_STANDARD;
|
|
||||||
groupList.push_back(gitem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2478,19 +2485,16 @@ bool p3PeerMgrIMPL::addGroup(RsGroupInfo &groupInfo)
|
|||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
RsPeerGroupItem *groupItem = new RsPeerGroupItem;
|
do { groupInfo.id = RsNodeGroupId::random(); } while(groupList.find(groupInfo.id) != groupList.end()) ;
|
||||||
groupItem->set(groupInfo);
|
|
||||||
|
|
||||||
rs_sprintf(groupItem->id, "%lu", ++lastGroupId);
|
RsGroupInfo groupItem(groupInfo) ;
|
||||||
|
|
||||||
// remove standard flag
|
// remove standard flag
|
||||||
groupItem->flag &= ~RS_GROUP_FLAG_STANDARD;
|
|
||||||
|
|
||||||
groupItem->PeerId(getOwnId());
|
groupItem.flag &= ~RS_GROUP_FLAG_STANDARD;
|
||||||
|
groupList[groupInfo.id] = groupItem;
|
||||||
|
|
||||||
groupList.push_back(groupItem);
|
std::cerr << "(II) Added new group with ID " << groupInfo.id << ", name=\"" << groupInfo.name << "\"" << std::endl;
|
||||||
|
|
||||||
groupInfo.id = groupItem->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
|
||||||
@ -2500,35 +2504,39 @@ bool p3PeerMgrIMPL::addGroup(RsGroupInfo &groupInfo)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::editGroup(const std::string &groupId, RsGroupInfo &groupInfo)
|
bool p3PeerMgrIMPL::editGroup(const RsNodeGroupId& groupId, RsGroupInfo &groupInfo)
|
||||||
{
|
{
|
||||||
if (groupId.empty()) {
|
if (groupId.isNull())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
std::list<RsPeerGroupItem*>::iterator groupIt;
|
std::map<RsNodeGroupId,RsGroupInfo>::iterator it = groupList.find(groupId) ;
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
|
||||||
if ((*groupIt)->id == groupId) {
|
if(it == groupList.end())
|
||||||
break;
|
{
|
||||||
}
|
std::cerr << "(EE) cannot find local node group with ID " << groupId << std::endl;
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupIt != groupList.end()) {
|
if (it->second.flag & RS_GROUP_FLAG_STANDARD)
|
||||||
if ((*groupIt)->flag & RS_GROUP_FLAG_STANDARD) {
|
{
|
||||||
// can't edit standard groups
|
// can't edit standard groups
|
||||||
} else {
|
std::cerr << "(EE) cannot edit standard group with ID " << groupId << std::endl;
|
||||||
changed = true;
|
return false ;
|
||||||
(*groupIt)->set(groupInfo);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
it->second = groupInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed)
|
||||||
|
{
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
@ -2537,31 +2545,35 @@ bool p3PeerMgrIMPL::editGroup(const std::string &groupId, RsGroupInfo &groupInfo
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::removeGroup(const std::string &groupId)
|
bool p3PeerMgrIMPL::removeGroup(const RsNodeGroupId& groupId)
|
||||||
{
|
{
|
||||||
if (groupId.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
std::list<RsPeerGroupItem*>::iterator groupIt;
|
std::map<RsNodeGroupId,RsGroupInfo>::iterator it = groupList.find(groupId) ;
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
|
||||||
if ((*groupIt)->id == groupId) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (groupIt != groupList.end()) {
|
if (it != groupList.end()) {
|
||||||
if ((*groupIt)->flag & RS_GROUP_FLAG_STANDARD) {
|
if (it->second.flag & RS_GROUP_FLAG_STANDARD)
|
||||||
|
{
|
||||||
// can't remove standard groups
|
// can't remove standard groups
|
||||||
} else {
|
std::cerr << "(EE) cannot remove standard group with ID " << groupId << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
#warning we need to check that the local group is not used. Otherwise deleting it is going to cause problems!
|
||||||
|
// else if(!it->second.used_gxs_groups.empty())
|
||||||
|
// {
|
||||||
|
// std::cerr << "(EE) cannot remove standard group with ID " << groupId << " because it is used in the following groups: " << std::endl;
|
||||||
|
// for(std::set<RsGxsGroupId>::const_iterator it2(it->second.used_gxs_groups.begin());it2!=it->second.used_gxs_groups.end();++it2)
|
||||||
|
// std::cerr << " " << *it2 << std::endl;
|
||||||
|
//
|
||||||
|
// return false ;
|
||||||
|
// }
|
||||||
|
else
|
||||||
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
delete(*groupIt);
|
groupList.erase(it);
|
||||||
groupList.erase(groupIt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2575,83 +2587,84 @@ bool p3PeerMgrIMPL::removeGroup(const std::string &groupId)
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo)
|
bool p3PeerMgrIMPL::getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo)
|
||||||
{
|
{
|
||||||
if (groupId.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
std::list<RsPeerGroupItem*>::iterator groupIt;
|
for(std::map<RsNodeGroupId,RsGroupInfo>::iterator it = groupList.begin();it!=groupList.end();++it)
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
if(it->second.name == groupName)
|
||||||
if ((*groupIt)->id == groupId) {
|
{
|
||||||
(*groupIt)->get(groupInfo);
|
groupInfo = it->second ;
|
||||||
|
return true ;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
std::cerr << "(EE) getGroupInfoByName: no known group for name " << groupName << std::endl;
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
bool p3PeerMgrIMPL::getGroupInfo(const RsNodeGroupId& groupId, RsGroupInfo &groupInfo)
|
||||||
bool p3PeerMgrIMPL::getGroupInfoList(std::list<RsGroupInfo> &groupInfoList)
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
std::list<RsPeerGroupItem*>::iterator groupIt;
|
std::map<RsNodeGroupId,RsGroupInfo>::iterator it = groupList.find(groupId) ;
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
|
||||||
RsGroupInfo groupInfo;
|
if(it == groupList.end())
|
||||||
(*groupIt)->get(groupInfo);
|
return false ;
|
||||||
groupInfoList.push_back(groupInfo);
|
|
||||||
}
|
groupInfo = it->second;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// groupId == "" && assign == false -> remove from all groups
|
bool p3PeerMgrIMPL::getGroupInfoList(std::list<RsGroupInfo>& groupInfoList)
|
||||||
bool p3PeerMgrIMPL::assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign)
|
|
||||||
{
|
{
|
||||||
if (groupId.empty() && assign == true) {
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (peerIds.empty()) {
|
for (std::map<RsNodeGroupId,RsGroupInfo> ::const_iterator groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt)
|
||||||
|
groupInfoList.push_back(groupIt->second);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// groupId.isNull() && assign == false -> remove from all groups
|
||||||
|
|
||||||
|
bool p3PeerMgrIMPL::assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId> &peerIds, bool assign)
|
||||||
|
{
|
||||||
|
if (groupId.isNull() && assign == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (peerIds.empty())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
std::list<RsPeerGroupItem*>::iterator groupIt;
|
for (std::map<RsNodeGroupId,RsGroupInfo>::iterator groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt)
|
||||||
for (groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt) {
|
if (groupId.isNull() || groupIt->first == groupId)
|
||||||
if (groupId.empty() || (*groupIt)->id == groupId) {
|
{
|
||||||
RsPeerGroupItem *groupItem = *groupIt;
|
RsGroupInfo& groupItem = groupIt->second;
|
||||||
|
|
||||||
std::list<RsPgpId>::const_iterator peerIt;
|
for (std::list<RsPgpId>::const_iterator peerIt = peerIds.begin(); peerIt != peerIds.end(); ++peerIt)
|
||||||
for (peerIt = peerIds.begin(); peerIt != peerIds.end(); ++peerIt) {
|
{
|
||||||
std::set<RsPgpId>::iterator peerIt1 = std::find(groupItem->pgpList.ids.begin(), groupItem->pgpList.ids.end(), *peerIt);
|
std::set<RsPgpId>::iterator peerIt1 = groupItem.peerIds.find(*peerIt);
|
||||||
if (assign) {
|
|
||||||
if (peerIt1 == groupItem->pgpList.ids.end()) {
|
if (assign)
|
||||||
groupItem->pgpList.ids.insert(*peerIt);
|
{
|
||||||
|
groupItem.peerIds.insert(*peerIt);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
if (peerIt1 != groupItem->pgpList.ids.end()) {
|
{
|
||||||
groupItem->pgpList.ids.erase(peerIt1);
|
groupItem.peerIds.erase(*peerIt);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (groupId.empty() == false) {
|
if (!groupId.isNull())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
||||||
|
@ -106,7 +106,7 @@ class peerState
|
|||||||
uint32_t maxDnRate ;
|
uint32_t maxDnRate ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsPeerGroupItem;
|
class RsNodeGroupItem;
|
||||||
class RsGroupInfo;
|
class RsGroupInfo;
|
||||||
|
|
||||||
std::string textPeerState(peerState &state);
|
std::string textPeerState(peerState &state);
|
||||||
@ -139,11 +139,12 @@ virtual bool removeAllFriendLocations(const RsPgpId &gpgid) = 0;
|
|||||||
/* This is solely used by p3peers - makes sense */
|
/* This is solely used by p3peers - makes sense */
|
||||||
|
|
||||||
virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
|
virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
|
||||||
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
virtual bool editGroup(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo) = 0;
|
||||||
virtual bool removeGroup(const std::string &groupId) = 0;
|
virtual bool removeGroup(const RsNodeGroupId &groupId) = 0;
|
||||||
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
virtual bool getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo) = 0;
|
||||||
|
virtual bool getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo) = 0;
|
||||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
|
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
|
||||||
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
|
virtual bool assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
|
||||||
|
|
||||||
virtual bool resetOwnExternalAddressList() = 0 ;
|
virtual bool resetOwnExternalAddressList() = 0 ;
|
||||||
|
|
||||||
@ -231,33 +232,34 @@ virtual bool locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage
|
|||||||
|
|
||||||
class p3PeerMgrIMPL: public p3PeerMgr, public p3Config
|
class p3PeerMgrIMPL: public p3PeerMgr, public p3Config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
/* EXTERNAL INTERFACE */
|
/* EXTERNAL INTERFACE */
|
||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
|
|
||||||
virtual bool addFriend(const RsPeerId&ssl_id, const RsPgpId&gpg_id, uint32_t netMode = RS_NET_MODE_UDP,
|
virtual bool addFriend(const RsPeerId&ssl_id, const RsPgpId&gpg_id, uint32_t netMode = RS_NET_MODE_UDP,
|
||||||
uint16_t vsDisc = RS_VS_DISC_FULL, uint16_t vsDht = RS_VS_DHT_FULL,
|
uint16_t vsDisc = RS_VS_DISC_FULL, uint16_t vsDht = RS_VS_DHT_FULL,
|
||||||
time_t lastContact = 0,ServicePermissionFlags = ServicePermissionFlags(RS_NODE_PERM_DEFAULT));
|
time_t lastContact = 0,ServicePermissionFlags = ServicePermissionFlags(RS_NODE_PERM_DEFAULT));
|
||||||
virtual bool removeFriend(const RsPeerId &ssl_id, bool removePgpId);
|
virtual bool removeFriend(const RsPeerId &ssl_id, bool removePgpId);
|
||||||
virtual bool removeFriend(const RsPgpId &pgp_id);
|
virtual bool removeFriend(const RsPgpId &pgp_id);
|
||||||
|
|
||||||
virtual bool isFriend(const RsPeerId &ssl_id);
|
virtual bool isFriend(const RsPeerId &ssl_id);
|
||||||
|
|
||||||
virtual bool getAssociatedPeers(const RsPgpId &gpg_id, std::list<RsPeerId> &ids);
|
virtual bool getAssociatedPeers(const RsPgpId &gpg_id, std::list<RsPeerId> &ids);
|
||||||
virtual bool removeAllFriendLocations(const RsPgpId &gpgid);
|
virtual bool removeAllFriendLocations(const RsPgpId &gpgid);
|
||||||
|
|
||||||
|
|
||||||
/******************** Groups **********************/
|
/******************** Groups **********************/
|
||||||
/* This is solely used by p3peers - makes sense */
|
/* This is solely used by p3peers - makes sense */
|
||||||
|
|
||||||
virtual bool addGroup(RsGroupInfo &groupInfo);
|
virtual bool addGroup(RsGroupInfo &groupInfo);
|
||||||
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo);
|
virtual bool editGroup(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo);
|
||||||
virtual bool removeGroup(const std::string &groupId);
|
virtual bool removeGroup(const RsNodeGroupId &groupId);
|
||||||
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo);
|
virtual bool getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo);
|
||||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
|
virtual bool getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo) ;
|
||||||
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign);
|
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
|
||||||
|
virtual bool assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId> &peerIds, bool assign);
|
||||||
|
|
||||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPgpId& gpg_id) ;
|
virtual ServicePermissionFlags servicePermissionFlags(const RsPgpId& gpg_id) ;
|
||||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) ;
|
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) ;
|
||||||
@ -271,26 +273,26 @@ virtual bool assignPeersToGroup(const std::string &groupId, const std::list<R
|
|||||||
* 3) p3disc - reasonable
|
* 3) p3disc - reasonable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual bool setLocalAddress(const RsPeerId &id, const struct sockaddr_storage &addr);
|
virtual bool setLocalAddress(const RsPeerId &id, const struct sockaddr_storage &addr);
|
||||||
virtual bool setExtAddress(const RsPeerId &id, const struct sockaddr_storage &addr);
|
virtual bool setExtAddress(const RsPeerId &id, const struct sockaddr_storage &addr);
|
||||||
virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns);
|
virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns);
|
||||||
virtual bool addCandidateForOwnExternalAddress(const RsPeerId& from, const struct sockaddr_storage &addr) ;
|
virtual bool addCandidateForOwnExternalAddress(const RsPeerId& from, const struct sockaddr_storage &addr) ;
|
||||||
virtual bool getExtAddressReportedByFriends(struct sockaddr_storage& addr, uint8_t &isstable) ;
|
virtual bool getExtAddressReportedByFriends(struct sockaddr_storage& addr, uint8_t &isstable) ;
|
||||||
|
|
||||||
virtual bool setNetworkMode(const RsPeerId &id, uint32_t netMode);
|
virtual bool setNetworkMode(const RsPeerId &id, uint32_t netMode);
|
||||||
virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht);
|
virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht);
|
||||||
|
|
||||||
virtual bool setLocation(const RsPeerId &pid, const std::string &location);
|
virtual bool setLocation(const RsPeerId &pid, const std::string &location);
|
||||||
virtual bool setHiddenDomainPort(const RsPeerId &id, const std::string &domain_addr, const uint16_t domain_port);
|
virtual bool setHiddenDomainPort(const RsPeerId &id, const std::string &domain_addr, const uint16_t domain_port);
|
||||||
|
|
||||||
virtual bool updateCurrentAddress(const RsPeerId& id, const pqiIpAddress &addr);
|
virtual bool updateCurrentAddress(const RsPeerId& id, const pqiIpAddress &addr);
|
||||||
virtual bool updateLastContact(const RsPeerId& id);
|
virtual bool updateLastContact(const RsPeerId& id);
|
||||||
virtual bool updateAddressList(const RsPeerId& id, const pqiIpAddrSet &addrs);
|
virtual bool updateAddressList(const RsPeerId& id, const pqiIpAddrSet &addrs);
|
||||||
|
|
||||||
virtual bool resetOwnExternalAddressList() ;
|
virtual bool resetOwnExternalAddressList() ;
|
||||||
|
|
||||||
// THIS MUST ONLY BE CALLED BY NETMGR!!!!
|
// THIS MUST ONLY BE CALLED BY NETMGR!!!!
|
||||||
virtual bool UpdateOwnAddress(const struct sockaddr_storage &local_addr, const struct sockaddr_storage &ext_addr);
|
virtual bool UpdateOwnAddress(const struct sockaddr_storage &local_addr, const struct sockaddr_storage &ext_addr);
|
||||||
/**************** Net Status Info ****************/
|
/**************** Net Status Info ****************/
|
||||||
/*
|
/*
|
||||||
* MUST RATIONALISE THE DATA FROM THESE FUNCTIONS
|
* MUST RATIONALISE THE DATA FROM THESE FUNCTIONS
|
||||||
@ -300,57 +302,57 @@ virtual bool UpdateOwnAddress(const struct sockaddr_storage &local_addr, cons
|
|||||||
* 3) p3disc - reasonable
|
* 3) p3disc - reasonable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual bool getOwnNetStatus(peerState &state);
|
virtual bool getOwnNetStatus(peerState &state);
|
||||||
virtual bool getFriendNetStatus(const RsPeerId &id, peerState &state);
|
virtual bool getFriendNetStatus(const RsPeerId &id, peerState &state);
|
||||||
virtual bool getOthersNetStatus(const RsPeerId &id, peerState &state);
|
virtual bool getOthersNetStatus(const RsPeerId &id, peerState &state);
|
||||||
|
|
||||||
virtual bool getPeerName(const RsPeerId& ssl_id, std::string& name);
|
virtual bool getPeerName(const RsPeerId& ssl_id, std::string& name);
|
||||||
virtual bool getGpgId(const RsPeerId& sslId, RsPgpId& gpgId);
|
virtual bool getGpgId(const RsPeerId& sslId, RsPgpId& gpgId);
|
||||||
virtual uint32_t getConnectionType(const RsPeerId& sslId);
|
virtual uint32_t getConnectionType(const RsPeerId& sslId);
|
||||||
|
|
||||||
virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr);
|
virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr);
|
||||||
virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr);
|
virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr);
|
||||||
virtual bool getProxyServerStatus(const uint32_t type, uint32_t &proxy_status);
|
virtual bool getProxyServerStatus(const uint32_t type, uint32_t &proxy_status);
|
||||||
virtual bool isHidden();
|
virtual bool isHidden();
|
||||||
virtual bool isHidden(const uint32_t type);
|
virtual bool isHidden(const uint32_t type);
|
||||||
virtual bool isHiddenPeer(const RsPeerId &ssl_id);
|
virtual bool isHiddenPeer(const RsPeerId &ssl_id);
|
||||||
virtual bool isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type);
|
virtual bool isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type);
|
||||||
virtual bool getProxyAddress(const RsPeerId& ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port);
|
virtual bool getProxyAddress(const RsPeerId& ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port);
|
||||||
virtual uint32_t hiddenDomainToHiddenType(const std::string &domain);
|
virtual uint32_t hiddenDomainToHiddenType(const std::string &domain);
|
||||||
virtual uint32_t getHiddenType(const RsPeerId &ssl_id);
|
virtual uint32_t getHiddenType(const RsPeerId &ssl_id);
|
||||||
|
|
||||||
virtual int getFriendCount(bool ssl, bool online);
|
virtual int getFriendCount(bool ssl, bool online);
|
||||||
|
|
||||||
/************* DEPRECIATED FUNCTIONS (TO REMOVE) ********/
|
/************* DEPRECIATED FUNCTIONS (TO REMOVE) ********/
|
||||||
|
|
||||||
// Single Use Function... shouldn't be here. used by p3serverconfig.cc
|
// Single Use Function... shouldn't be here. used by p3serverconfig.cc
|
||||||
virtual bool haveOnceConnected();
|
virtual bool haveOnceConnected();
|
||||||
|
|
||||||
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn);
|
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn);
|
||||||
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn);
|
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn);
|
||||||
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn);
|
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn);
|
||||||
|
|
||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
/* Extra IMPL Functions (used by p3LinkMgr, p3NetMgr + Setup) */
|
/* Extra IMPL Functions (used by p3LinkMgr, p3NetMgr + Setup) */
|
||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
|
|
||||||
p3PeerMgrIMPL( const RsPeerId& ssl_own_id,
|
p3PeerMgrIMPL( const RsPeerId& ssl_own_id,
|
||||||
const RsPgpId& gpg_own_id,
|
const RsPgpId& gpg_own_id,
|
||||||
const std::string& gpg_own_name,
|
const std::string& gpg_own_name,
|
||||||
const std::string& ssl_own_location) ;
|
const std::string& ssl_own_location) ;
|
||||||
|
|
||||||
void setManagers(p3LinkMgrIMPL *linkMgr, p3NetMgrIMPL *netMgr);
|
void setManagers(p3LinkMgrIMPL *linkMgr, p3NetMgrIMPL *netMgr);
|
||||||
|
|
||||||
bool forceHiddenNode();
|
bool forceHiddenNode();
|
||||||
bool setupHiddenNode(const std::string &hiddenAddress, const uint16_t hiddenPort);
|
bool setupHiddenNode(const std::string &hiddenAddress, const uint16_t hiddenPort);
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
|
||||||
const RsPeerId& getOwnId();
|
const RsPeerId& getOwnId();
|
||||||
bool setOwnNetworkMode(uint32_t netMode);
|
bool setOwnNetworkMode(uint32_t netMode);
|
||||||
bool setOwnVisState(uint16_t vs_disc, uint16_t vs_dht);
|
bool setOwnVisState(uint16_t vs_disc, uint16_t vs_dht);
|
||||||
|
|
||||||
int getConnectAddresses(const RsPeerId &id,
|
int getConnectAddresses(const RsPeerId &id,
|
||||||
struct sockaddr_storage &lAddr, struct sockaddr_storage &eAddr,
|
struct sockaddr_storage &lAddr, struct sockaddr_storage &eAddr,
|
||||||
pqiIpAddrSet &histAddrs, std::string &dyndns);
|
pqiIpAddrSet &histAddrs, std::string &dyndns);
|
||||||
|
|
||||||
@ -358,22 +360,22 @@ int getConnectAddresses(const RsPeerId &id,
|
|||||||
protected:
|
protected:
|
||||||
/* Internal Functions */
|
/* Internal Functions */
|
||||||
|
|
||||||
bool removeUnusedLocations();
|
bool removeUnusedLocations();
|
||||||
bool removeBannedIps();
|
bool removeBannedIps();
|
||||||
|
|
||||||
void printPeerLists(std::ostream &out);
|
void printPeerLists(std::ostream &out);
|
||||||
|
|
||||||
virtual bool locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage &addr, uint32_t &count);
|
virtual bool locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage &addr, uint32_t &count);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/*********************** p3config ******************************/
|
/*********************** p3config ******************************/
|
||||||
/* Key Functions to be overloaded for Full Configuration */
|
/* Key Functions to be overloaded for Full Configuration */
|
||||||
virtual RsSerialiser *setupSerialiser();
|
virtual RsSerialiser *setupSerialiser();
|
||||||
virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
|
virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
|
||||||
virtual void saveDone();
|
virtual void saveDone();
|
||||||
virtual bool loadList(std::list<RsItem *>& load);
|
virtual bool loadList(std::list<RsItem *>& load);
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/* other important managers */
|
/* other important managers */
|
||||||
|
|
||||||
@ -394,7 +396,7 @@ private:
|
|||||||
|
|
||||||
std::map<RsPeerId,sockaddr_storage> mReportedOwnAddresses ;
|
std::map<RsPeerId,sockaddr_storage> mReportedOwnAddresses ;
|
||||||
|
|
||||||
std::list<RsPeerGroupItem *> groupList;
|
std::map<RsNodeGroupId,RsGroupInfo> groupList;
|
||||||
uint32_t lastGroupId;
|
uint32_t lastGroupId;
|
||||||
|
|
||||||
std::list<RsItem *> saveCleanupList; /* TEMPORARY LIST WHEN SAVING */
|
std::list<RsItem *> saveCleanupList; /* TEMPORARY LIST WHEN SAVING */
|
||||||
|
@ -27,31 +27,10 @@
|
|||||||
#ifndef PQI_TOP_HEADER
|
#ifndef PQI_TOP_HEADER
|
||||||
#define PQI_TOP_HEADER
|
#define PQI_TOP_HEADER
|
||||||
|
|
||||||
/* This just includes the standard headers required.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "pqi/pqi_base.h"
|
|
||||||
#include "pqi/pqinetwork.h"
|
|
||||||
#include "serialiser/rsserial.h"
|
#include "serialiser/rsserial.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <functional>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
/********************** SEARCH INTERFACE ***************************/
|
class P3Interface
|
||||||
// this is an interface.... so should be
|
|
||||||
// classified as virtual = 0;
|
|
||||||
|
|
||||||
class SearchInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SearchInterface() { return; }
|
|
||||||
|
|
||||||
virtual ~SearchInterface() { return; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class P3Interface: public SearchInterface
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
P3Interface() {return; }
|
P3Interface() {return; }
|
||||||
@ -61,16 +40,13 @@ virtual int tick() { return 1; }
|
|||||||
virtual int status() { return 1; }
|
virtual int status() { return 1; }
|
||||||
|
|
||||||
virtual int SendRsRawItem(RsRawItem *) = 0;
|
virtual int SendRsRawItem(RsRawItem *) = 0;
|
||||||
#ifdef TO_BE_REMOVED
|
|
||||||
virtual RsRawItem *GetRsRawItem() = 0;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* interface to allow outgoing messages to be sent directly
|
/**
|
||||||
* through to the pqiperson, rather than being queued
|
* @brief Interface to allow outgoing messages to be sent directly through to
|
||||||
|
* the pqiperson, rather than being queued
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class pqiPublisher
|
class pqiPublisher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -80,6 +56,4 @@ virtual bool sendItem(RsRawItem *item) = 0;
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // PQI_TOP_HEADER
|
#endif // PQI_TOP_HEADER
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ virtual void updatePeer(const RsPeerId& id, const struct sockaddr_storage &addr
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
/* this is for the Stunners
|
/* this is for the Stunners
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -132,7 +133,7 @@ virtual void setRefreshPeriod(int32_t period) = 0;
|
|||||||
virtual int tick() = 0; /* for internal accounting */
|
virtual int tick() = 0; /* for internal accounting */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#endif // RS_USE_DHT_STUNNER
|
||||||
|
|
||||||
#define NETASSIST_KNOWN_PEER_OFFLINE 0x0001
|
#define NETASSIST_KNOWN_PEER_OFFLINE 0x0001
|
||||||
#define NETASSIST_KNOWN_PEER_ONLINE 0x0002
|
#define NETASSIST_KNOWN_PEER_ONLINE 0x0002
|
||||||
|
@ -25,16 +25,23 @@
|
|||||||
|
|
||||||
#include "pqi/pqihandler.h"
|
#include "pqi/pqihandler.h"
|
||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include <stdlib.h> // for NULL
|
||||||
#include "util/rsstring.h"
|
#include <time.h> // for time, time_t
|
||||||
#include "retroshare/rspeers.h"
|
#include <algorithm> // for sort
|
||||||
#include <stdlib.h>
|
#include <iostream> // for dec
|
||||||
#include <time.h>
|
#include <string> // for string, char_traits, operator+, bas...
|
||||||
|
#include <utility> // for pair
|
||||||
|
|
||||||
|
#include "pqi/pqi_base.h" // for PQInterface, RsBwRates
|
||||||
|
#include "retroshare/rsconfig.h" // for RSTrafficClue
|
||||||
|
#include "retroshare/rsids.h" // for t_RsGenericIdType
|
||||||
|
#include "retroshare/rspeers.h" // for RsPeers, rsPeers
|
||||||
|
#include "serialiser/rsserial.h" // for RsItem, RsRawItem
|
||||||
|
#include "util/rsdebug.h" // for pqioutput, PQL_DEBUG_BASIC, PQL_ALERT
|
||||||
|
#include "util/rsstring.h" // for rs_sprintf_append
|
||||||
|
|
||||||
using std::dec;
|
using std::dec;
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#ifdef WINDOWS_SYS
|
#ifdef WINDOWS_SYS
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,15 +26,20 @@
|
|||||||
#ifndef MRK_PQI_HANDLER_HEADER
|
#ifndef MRK_PQI_HANDLER_HEADER
|
||||||
#define MRK_PQI_HANDLER_HEADER
|
#define MRK_PQI_HANDLER_HEADER
|
||||||
|
|
||||||
#include "pqi/pqi.h"
|
#include <stdint.h> // for uint32_t
|
||||||
#include "pqi/pqiqos.h"
|
#include <time.h> // for time_t, NULL
|
||||||
|
#include <list> // for list
|
||||||
|
#include <map> // for map
|
||||||
|
|
||||||
#include "util/rsthreads.h"
|
#include "pqi/pqi.h" // for P3Interface, pqiPublisher
|
||||||
#include "retroshare/rstypes.h"
|
#include "retroshare/rstypes.h" // for RsPeerId
|
||||||
#include "retroshare/rsconfig.h"
|
#include "util/rsthreads.h" // for RsStackMutex, RsMutex
|
||||||
|
|
||||||
#include <map>
|
class PQInterface;
|
||||||
#include <list>
|
class RSTrafficClue;
|
||||||
|
class RsBwRates;
|
||||||
|
class RsItem;
|
||||||
|
class RsRawItem;
|
||||||
|
|
||||||
class SearchModule
|
class SearchModule
|
||||||
{
|
{
|
||||||
|
@ -23,9 +23,12 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pqi/pqi.h"
|
|
||||||
#include "pqi/pqiloopback.h"
|
#include "pqi/pqiloopback.h"
|
||||||
|
|
||||||
|
#include <stddef.h> // for NULL
|
||||||
|
|
||||||
|
class RsItem;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
#define LOOPBACK_DEBUG 1
|
#define LOOPBACK_DEBUG 1
|
||||||
***/
|
***/
|
||||||
|
@ -26,12 +26,12 @@
|
|||||||
#ifndef MRK_PQI_LOOPBACK_HEADER
|
#ifndef MRK_PQI_LOOPBACK_HEADER
|
||||||
#define MRK_PQI_LOOPBACK_HEADER
|
#define MRK_PQI_LOOPBACK_HEADER
|
||||||
|
|
||||||
// The standard data types and the search interface.
|
#include <list> // for list
|
||||||
#include "pqi/pqi.h"
|
|
||||||
|
|
||||||
#include <map>
|
#include "pqi/pqi_base.h" // for NetInterface (ptr only), PQInterface
|
||||||
#include <list>
|
#include "retroshare/rstypes.h" // for RsPeerId
|
||||||
#include <iostream>
|
|
||||||
|
class RsItem;
|
||||||
|
|
||||||
class pqiloopback: public PQInterface
|
class pqiloopback: public PQInterface
|
||||||
{
|
{
|
||||||
@ -47,8 +47,7 @@ virtual RsItem *GetItem();
|
|||||||
virtual int tick();
|
virtual int tick();
|
||||||
virtual int status();
|
virtual int status();
|
||||||
|
|
||||||
virtual int notifyEvent(NetInterface */*ni*/, int /*event*/) { return 0; } /* Not used */
|
private:
|
||||||
private:
|
|
||||||
std::list<RsItem *> objs;
|
std::list<RsItem *> objs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -243,6 +243,7 @@ int pqiNetStateBox::updateNetState()
|
|||||||
|
|
||||||
void pqiNetStateBox::clearOldNetworkData()
|
void pqiNetStateBox::clearOldNetworkData()
|
||||||
{
|
{
|
||||||
|
#ifdef RS_USE_DHT_STUNNER
|
||||||
/* check if any measurements are too old to consider */
|
/* check if any measurements are too old to consider */
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
if (now - mStunProxyTS > NETSTATE_PARAM_TIMEOUT)
|
if (now - mStunProxyTS > NETSTATE_PARAM_TIMEOUT)
|
||||||
@ -254,6 +255,14 @@ void pqiNetStateBox::clearOldNetworkData()
|
|||||||
{
|
{
|
||||||
mStunDhtSet = false;
|
mStunDhtSet = false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
//Set values, as they are not updated.
|
||||||
|
mStunProxySet = true;
|
||||||
|
mStunDhtSet = true;
|
||||||
|
mStunProxyStable = true;
|
||||||
|
mStunDhtStable = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ public:
|
|||||||
virtual int connect(const struct sockaddr_storage &raddr) { return ni->connect(raddr); }
|
virtual int connect(const struct sockaddr_storage &raddr) { return ni->connect(raddr); }
|
||||||
virtual int listen() { return ni->listen(); }
|
virtual int listen() { return ni->listen(); }
|
||||||
virtual int stoplistening() { return ni->stoplistening(); }
|
virtual int stoplistening() { return ni->stoplistening(); }
|
||||||
virtual int reset() { return ni->reset(); }
|
virtual int reset() { pqistreamer::reset(); return ni->reset(); }
|
||||||
virtual int disconnect() { return ni->reset(); }
|
virtual int disconnect() { return reset() ; }
|
||||||
virtual bool connect_parameter(uint32_t type, uint32_t value) { return ni->connect_parameter(type, value);}
|
virtual bool connect_parameter(uint32_t type, uint32_t value) { return ni->connect_parameter(type, value);}
|
||||||
virtual bool connect_parameter(uint32_t type, std::string value) { return ni->connect_parameter(type, value);}
|
virtual bool connect_parameter(uint32_t type, std::string value) { return ni->connect_parameter(type, value);}
|
||||||
virtual bool connect_additional_address(uint32_t type, const struct sockaddr_storage &addr) { return ni->connect_additional_address(type, addr); }
|
virtual bool connect_additional_address(uint32_t type, const struct sockaddr_storage &addr) { return ni->connect_additional_address(type, addr); }
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "pqiqosstreamer.h"
|
#include "pqiqosstreamer.h"
|
||||||
|
|
||||||
|
//#define DEBUG_PQIQOSSTREAMER 1
|
||||||
|
|
||||||
const float pqiQoSstreamer::PQI_QOS_STREAMER_ALPHA = 2.0f ;
|
const float pqiQoSstreamer::PQI_QOS_STREAMER_ALPHA = 2.0f ;
|
||||||
|
|
||||||
pqiQoSstreamer::pqiQoSstreamer(PQInterface *parent, RsSerialiser *rss, const RsPeerId& peerid, BinInterface *bio_in, int bio_flagsin)
|
pqiQoSstreamer::pqiQoSstreamer(PQInterface *parent, RsSerialiser *rss, const RsPeerId& peerid, BinInterface *bio_in, int bio_flagsin)
|
||||||
@ -60,6 +62,11 @@ void pqiQoSstreamer::locked_storeInOutputQueue(void *ptr,int size,int priority)
|
|||||||
|
|
||||||
void pqiQoSstreamer::locked_clear_out_queue()
|
void pqiQoSstreamer::locked_clear_out_queue()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_PQIQOSSTREAMER
|
||||||
|
if(qos_queue_size() > 0)
|
||||||
|
std::cerr << " pqiQoSstreamer::locked_clear_out_queue(): clearing " << qos_queue_size() << " pending outqueue elements." << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
pqiQoS::clear() ;
|
pqiQoS::clear() ;
|
||||||
_total_item_size = 0 ;
|
_total_item_size = 0 ;
|
||||||
_total_item_count = 0 ;
|
_total_item_count = 0 ;
|
||||||
|
@ -1548,6 +1548,7 @@ int pqissl::senddata(void *data, int len)
|
|||||||
#ifdef PQISSL_DEBUG
|
#ifdef PQISSL_DEBUG
|
||||||
std::cout << "Sending data thread=" << pthread_self() << ", ssl=" << (void*)this << ", size=" << len << std::endl ;
|
std::cout << "Sending data thread=" << pthread_self() << ", ssl=" << (void*)this << ", size=" << len << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
ERR_clear_error();
|
||||||
tmppktlen = SSL_write(ssl_connection, data, len) ;
|
tmppktlen = SSL_write(ssl_connection, data, len) ;
|
||||||
|
|
||||||
if (len != tmppktlen)
|
if (len != tmppktlen)
|
||||||
@ -1638,6 +1639,8 @@ int pqissl::readdata(void *data, int len)
|
|||||||
#ifdef PQISSL_DEBUG
|
#ifdef PQISSL_DEBUG
|
||||||
std::cerr << "calling SSL_read. len=" << len << ", total_len=" << total_len << std::endl ;
|
std::cerr << "calling SSL_read. len=" << len << ", total_len=" << total_len << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
ERR_clear_error() ;
|
||||||
|
|
||||||
tmppktlen = SSL_read(ssl_connection, (void*)( &(((uint8_t*)data)[total_len])), len-total_len) ;
|
tmppktlen = SSL_read(ssl_connection, (void*)( &(((uint8_t*)data)[total_len])), len-total_len) ;
|
||||||
#ifdef PQISSL_DEBUG
|
#ifdef PQISSL_DEBUG
|
||||||
std::cerr << "have read " << tmppktlen << " bytes" << std::endl ;
|
std::cerr << "have read " << tmppktlen << " bytes" << std::endl ;
|
||||||
@ -1661,8 +1664,6 @@ int pqissl::readdata(void *data, int len)
|
|||||||
int error = SSL_get_error(ssl_connection, tmppktlen);
|
int error = SSL_get_error(ssl_connection, tmppktlen);
|
||||||
unsigned long err2 = ERR_get_error();
|
unsigned long err2 = ERR_get_error();
|
||||||
|
|
||||||
//printSSLError(ssl_connection, tmppktlen, error, err2, out);
|
|
||||||
|
|
||||||
if ((error == SSL_ERROR_ZERO_RETURN) && (err2 == 0))
|
if ((error == SSL_ERROR_ZERO_RETURN) && (err2 == 0))
|
||||||
{
|
{
|
||||||
/* this code will be called when
|
/* this code will be called when
|
||||||
@ -1761,6 +1762,9 @@ int pqissl::readdata(void *data, int len)
|
|||||||
rs_sprintf_append(out, "SSL_read() UNKNOWN ERROR: %d Resetting!", error);
|
rs_sprintf_append(out, "SSL_read() UNKNOWN ERROR: %d Resetting!", error);
|
||||||
rslog(RSL_ALERT, pqisslzone, out);
|
rslog(RSL_ALERT, pqisslzone, out);
|
||||||
std::cerr << out << std::endl ;
|
std::cerr << out << std::endl ;
|
||||||
|
std::cerr << ", SSL_read() output is " << tmppktlen << std::endl ;
|
||||||
|
|
||||||
|
printSSLError(ssl_connection, tmppktlen, error, err2, out);
|
||||||
|
|
||||||
rslog(RSL_ALERT, pqisslzone, "pqissl::readdata() -> calling reset()");
|
rslog(RSL_ALERT, pqisslzone, "pqissl::readdata() -> calling reset()");
|
||||||
reset_locked();
|
reset_locked();
|
||||||
|
@ -24,18 +24,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <time.h>
|
|
||||||
#include "util/rsdebug.h"
|
|
||||||
#include "util/rsstring.h"
|
|
||||||
#include "util/rsprint.h"
|
|
||||||
#include "util/rsscopetimer.h"
|
|
||||||
|
|
||||||
#include "pqi/pqistreamer.h"
|
#include "pqi/pqistreamer.h"
|
||||||
#include "rsserver/p3face.h"
|
|
||||||
|
|
||||||
#include "serialiser/rsserial.h"
|
#include <stdlib.h> // for free, realloc, exit
|
||||||
|
#include <string.h> // for memcpy, memset, memcmp
|
||||||
|
#include <time.h> // for NULL, time, time_t
|
||||||
|
#include <algorithm> // for min
|
||||||
|
#include <iostream> // for operator<<, ostream, basic_ostream
|
||||||
|
#include <string> // for string, allocator, operator<<, oper...
|
||||||
|
#include <utility> // for pair
|
||||||
|
|
||||||
|
#include "pqi/p3notify.h" // for p3Notify
|
||||||
|
#include "retroshare/rsids.h" // for operator<<
|
||||||
|
#include "retroshare/rsnotify.h" // for RS_SYS_WARNING
|
||||||
|
#include "rsserver/p3face.h" // for RsServer
|
||||||
|
#include "serialiser/rsserial.h" // for RsItem, RsSerialiser, getRsItemSize
|
||||||
|
#include "util/rsdebug.h" // for pqioutput, PQL_ALERT, PQL_DEBUG_ALL
|
||||||
|
#include "util/rsmemory.h" // for rs_malloc
|
||||||
|
#include "util/rsprint.h" // for BinToHex
|
||||||
|
#include "util/rsstring.h" // for rs_sprintf_append, rs_sprintf
|
||||||
|
|
||||||
static struct RsLog::logInfo pqistreamerzoneInfo = {RsLog::Default, "pqistreamer"};
|
static struct RsLog::logInfo pqistreamerzoneInfo = {RsLog::Default, "pqistreamer"};
|
||||||
#define pqistreamerzone &pqistreamerzoneInfo
|
#define pqistreamerzone &pqistreamerzoneInfo
|
||||||
@ -135,17 +142,7 @@ pqistreamer::~pqistreamer()
|
|||||||
if (mRsSerialiser)
|
if (mRsSerialiser)
|
||||||
delete mRsSerialiser;
|
delete mRsSerialiser;
|
||||||
|
|
||||||
// clean up outgoing. (cntrl packets)
|
free_pend_locked();
|
||||||
locked_clear_out_queue() ;
|
|
||||||
|
|
||||||
if (mPkt_wpending)
|
|
||||||
{
|
|
||||||
free(mPkt_wpending);
|
|
||||||
mPkt_wpending = NULL;
|
|
||||||
mPkt_wpending_size = 0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
free_rpend_locked();
|
|
||||||
|
|
||||||
// clean up incoming.
|
// clean up incoming.
|
||||||
while(!mIncoming.empty())
|
while(!mIncoming.empty())
|
||||||
@ -156,6 +153,7 @@ pqistreamer::~pqistreamer()
|
|||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(mIncomingSize != 0)
|
if(mIncomingSize != 0)
|
||||||
std::cerr << "(EE) inconsistency after deleting pqistreamer queue. Remaining items: " << mIncomingSize << std::endl;
|
std::cerr << "(EE) inconsistency after deleting pqistreamer queue. Remaining items: " << mIncomingSize << std::endl;
|
||||||
return;
|
return;
|
||||||
@ -282,7 +280,7 @@ int pqistreamer::tick_recv(uint32_t timeout)
|
|||||||
}
|
}
|
||||||
if(!(mBio->isactive()))
|
if(!(mBio->isactive()))
|
||||||
{
|
{
|
||||||
free_rpend_locked();
|
free_pend_locked();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -295,6 +293,7 @@ int pqistreamer::tick_send(uint32_t timeout)
|
|||||||
/* short circuit everything is bio isn't active */
|
/* short circuit everything is bio isn't active */
|
||||||
if (!(mBio->isactive()))
|
if (!(mBio->isactive()))
|
||||||
{
|
{
|
||||||
|
free_pend_locked();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,7 +689,7 @@ int pqistreamer::handleincoming_locked()
|
|||||||
if(!(mBio->isactive()))
|
if(!(mBio->isactive()))
|
||||||
{
|
{
|
||||||
mReading_state = reading_state_initial ;
|
mReading_state = reading_state_initial ;
|
||||||
free_rpend_locked();
|
free_pend_locked();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -762,7 +761,7 @@ start_packet_read:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_PQISTREAMER
|
#ifdef DEBUG_PQISTREAMER
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "block 0 : " << RsUtil::BinToHex(block,8) << std::endl;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "block 0 : " << RsUtil::BinToHex((unsigned char*)block,8) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
readbytes += blen;
|
readbytes += blen;
|
||||||
@ -806,12 +805,12 @@ continue_packet:
|
|||||||
else
|
else
|
||||||
extralen = getRsItemSize(block) - blen; // old style packet type
|
extralen = getRsItemSize(block) - blen; // old style packet type
|
||||||
|
|
||||||
#ifdef DEBUG_PQISTREAMER
|
#ifdef DEBUG_PACKET_SLICING
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet getRsItemSize(block) = " << getRsItemSize(block) << std::endl ;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet getRsItemSize(block) = " << getRsItemSize(block) << std::endl ;
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet extralen = " << extralen << std::endl ;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet extralen = " << extralen << std::endl ;
|
||||||
|
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet state=" << mReading_state << std::endl ;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet state=" << mReading_state << std::endl ;
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "block 1 : " << RsUtil::BinToHex(block,8) << std::endl;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "block 1 : " << RsUtil::BinToHex((unsigned char*)block,8) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (extralen + (uint32_t)blen > maxlen)
|
if (extralen + (uint32_t)blen > maxlen)
|
||||||
{
|
{
|
||||||
@ -874,7 +873,7 @@ continue_packet:
|
|||||||
|
|
||||||
if (extralen != (uint32_t)(tmplen = mBio->readdata(extradata, extralen)))
|
if (extralen != (uint32_t)(tmplen = mBio->readdata(extradata, extralen)))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PQISTREAMER
|
#ifdef DEBUG_PACKET_SLICING
|
||||||
if(tmplen > 0)
|
if(tmplen > 0)
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "Incomplete packet read ! This is a real problem ;-)" << std::endl ;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "Incomplete packet read ! This is a real problem ;-)" << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
@ -921,9 +920,9 @@ continue_packet:
|
|||||||
// we assume readdata() returned either -1 or the complete read size.
|
// we assume readdata() returned either -1 or the complete read size.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_PQISTREAMER
|
#ifdef DEBUG_PACKET_SLICING
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet state=" << mReading_state << std::endl ;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "continuing packet state=" << mReading_state << std::endl ;
|
||||||
std::cerr << "[" << (void*)pthread_self() << "] " << "block 2 : " << RsUtil::BinToHex(extradata,8) << std::endl;
|
std::cerr << "[" << (void*)pthread_self() << "] " << "block 2 : " << RsUtil::BinToHex((unsigned char*)extradata,8) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mFailed_read_attempts = 0 ;
|
mFailed_read_attempts = 0 ;
|
||||||
@ -952,7 +951,7 @@ continue_packet:
|
|||||||
std::cerr << "Inputing partial packet " << RsUtil::BinToHex((char*)block,8) << std::endl;
|
std::cerr << "Inputing partial packet " << RsUtil::BinToHex((char*)block,8) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
uint32_t packet_length = 0 ;
|
uint32_t packet_length = 0 ;
|
||||||
pkt = addPartialPacket(block,pktlen,slice_packet_id,is_packet_starting,is_packet_ending,packet_length) ;
|
pkt = addPartialPacket_locked(block,pktlen,slice_packet_id,is_packet_starting,is_packet_ending,packet_length) ;
|
||||||
|
|
||||||
pktlen = packet_length ;
|
pktlen = packet_length ;
|
||||||
}
|
}
|
||||||
@ -997,7 +996,7 @@ continue_packet:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsItem *pqistreamer::addPartialPacket(const void *block, uint32_t len, uint32_t slice_packet_id, bool is_packet_starting, bool is_packet_ending, uint32_t &total_len)
|
RsItem *pqistreamer::addPartialPacket_locked(const void *block, uint32_t len, uint32_t slice_packet_id, bool is_packet_starting, bool is_packet_ending, uint32_t &total_len)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PACKET_SLICING
|
#ifdef DEBUG_PACKET_SLICING
|
||||||
std::cerr << "Receiving partial packet. size=" << len << ", ID=" << std::hex << slice_packet_id << std::dec << ", starting:" << is_packet_starting << ", ending:" << is_packet_ending ;
|
std::cerr << "Receiving partial packet. size=" << len << ", ID=" << std::hex << slice_packet_id << std::dec << ", starting:" << is_packet_starting << ", ending:" << is_packet_ending ;
|
||||||
@ -1180,7 +1179,7 @@ void pqistreamer::outSentBytes_locked(uint32_t outb)
|
|||||||
#ifdef DEBUG_PQISTREAMER
|
#ifdef DEBUG_PQISTREAMER
|
||||||
{
|
{
|
||||||
std::string out;
|
std::string out;
|
||||||
rs_sprintf(out, "pqistreamer::outSentBytes(): %d@%gkB/s", outb, getRate(false));
|
rs_sprintf(out, "pqistreamer::outSentBytes(): %d@%gkB/s", outb, RateInterface::getRate(false));
|
||||||
pqioutput(PQL_DEBUG_ALL, pqistreamerzone, out);
|
pqioutput(PQL_DEBUG_ALL, pqistreamerzone, out);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1210,7 +1209,7 @@ void pqistreamer::inReadBytes_locked(uint32_t inb)
|
|||||||
#ifdef DEBUG_PQISTREAMER
|
#ifdef DEBUG_PQISTREAMER
|
||||||
{
|
{
|
||||||
std::string out;
|
std::string out;
|
||||||
rs_sprintf(out, "pqistreamer::inReadBytes(): %d@%gkB/s", inb, getRate(true));
|
rs_sprintf(out, "pqistreamer::inReadBytes(): %d@%gkB/s", inb, RateInterface::getRate(true));
|
||||||
pqioutput(PQL_DEBUG_ALL, pqistreamerzone, out);
|
pqioutput(PQL_DEBUG_ALL, pqistreamerzone, out);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1237,14 +1236,53 @@ void pqistreamer::allocate_rpend_locked()
|
|||||||
memset(mPkt_rpending,0,mPkt_rpend_size) ;
|
memset(mPkt_rpending,0,mPkt_rpend_size) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pqistreamer::free_rpend_locked()
|
// clean everything that is half-finished, to avoid causing issues when re-connecting later on.
|
||||||
{
|
|
||||||
if(!mPkt_rpending)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
int pqistreamer::reset()
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mStreamerMtx); /**** LOCKED MUTEX ****/
|
||||||
|
#ifdef DEBUG_PQISTREAMER
|
||||||
|
std::cerr << "pqistreamer::reset()" << std::endl;
|
||||||
|
#endif
|
||||||
|
free_pend_locked();
|
||||||
|
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pqistreamer::free_pend_locked()
|
||||||
|
{
|
||||||
|
if(mPkt_rpending)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_PQISTREAMER
|
||||||
|
std::cerr << "pqistreamer::free_pend_locked(): pending input packet buffer" << std::endl;
|
||||||
|
#endif
|
||||||
free(mPkt_rpending);
|
free(mPkt_rpending);
|
||||||
mPkt_rpending = 0;
|
mPkt_rpending = 0;
|
||||||
|
}
|
||||||
mPkt_rpend_size = 0;
|
mPkt_rpend_size = 0;
|
||||||
|
|
||||||
|
if (mPkt_wpending)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_PQISTREAMER
|
||||||
|
std::cerr << "pqistreamer::free_pend_locked(): pending output packet buffer" << std::endl;
|
||||||
|
#endif
|
||||||
|
free(mPkt_wpending);
|
||||||
|
mPkt_wpending = NULL;
|
||||||
|
}
|
||||||
|
mPkt_wpending_size = 0 ;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PQISTREAMER
|
||||||
|
if(!mPartialPackets.empty())
|
||||||
|
std::cerr << "pqistreamer::free_pend_locked(): " << mPartialPackets.size() << " pending input partial packets" << std::endl;
|
||||||
|
#endif
|
||||||
|
// also delete any incoming partial packet
|
||||||
|
for(std::map<uint32_t,PartialPacketRecord>::iterator it(mPartialPackets.begin());it!=mPartialPackets.end();++it)
|
||||||
|
free(it->second.mem) ;
|
||||||
|
|
||||||
|
mPartialPackets.clear() ;
|
||||||
|
|
||||||
|
// clean up outgoing. (cntrl packets)
|
||||||
|
locked_clear_out_queue() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pqistreamer::gatherStatistics(std::list<RSTrafficClue>& outqueue_lst,std::list<RSTrafficClue>& inqueue_lst)
|
int pqistreamer::gatherStatistics(std::list<RSTrafficClue>& outqueue_lst,std::list<RSTrafficClue>& inqueue_lst)
|
||||||
|
@ -27,18 +27,19 @@
|
|||||||
#ifndef MRK_PQI_STREAMER_HEADER
|
#ifndef MRK_PQI_STREAMER_HEADER
|
||||||
#define MRK_PQI_STREAMER_HEADER
|
#define MRK_PQI_STREAMER_HEADER
|
||||||
|
|
||||||
// Only dependent on the base stuff.
|
#include <stdint.h> // for uint32_t
|
||||||
#include "pqi/pqi_base.h"
|
#include <time.h> // for time_t
|
||||||
#include "util/rsthreads.h"
|
#include <iostream> // for operator<<, basic_ostream, cerr, endl
|
||||||
#include "retroshare/rstypes.h"
|
#include <list> // for list
|
||||||
|
#include <map> // for map
|
||||||
|
|
||||||
#include <list>
|
#include "pqi/pqi_base.h" // for BinInterface (ptr only), PQInterface
|
||||||
|
#include "retroshare/rsconfig.h" // for RSTrafficClue
|
||||||
|
#include "retroshare/rstypes.h" // for RsPeerId
|
||||||
|
#include "util/rsthreads.h" // for RsMutex
|
||||||
|
|
||||||
// Fully implements the PQInterface.
|
class RsItem;
|
||||||
// and communicates with peer etc via the BinInterface.
|
class RsSerialiser;
|
||||||
//
|
|
||||||
// The interface does not handle connection, just communication.
|
|
||||||
// possible bioflags: BIN_FLAGS_NO_CLOSE | BIN_FLAGS_NO_DELETE
|
|
||||||
|
|
||||||
struct PartialPacketRecord
|
struct PartialPacketRecord
|
||||||
{
|
{
|
||||||
@ -46,6 +47,12 @@ struct PartialPacketRecord
|
|||||||
uint32_t size ;
|
uint32_t size ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fully implements the PQInterface and communicates with peer etc via
|
||||||
|
* the BinInterface.
|
||||||
|
* The interface does not handle connection, just communication.
|
||||||
|
* Possible BIN_FLAGS: BIN_FLAGS_NO_CLOSE | BIN_FLAGS_NO_DELETE
|
||||||
|
*/
|
||||||
class pqistreamer: public PQInterface
|
class pqistreamer: public PQInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -74,6 +81,7 @@ class pqistreamer: public PQInterface
|
|||||||
virtual float getRate(bool b) ;
|
virtual float getRate(bool b) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int reset() ;
|
||||||
|
|
||||||
int tick_bio();
|
int tick_bio();
|
||||||
int tick_send(uint32_t timeout);
|
int tick_send(uint32_t timeout);
|
||||||
@ -117,7 +125,8 @@ class pqistreamer: public PQInterface
|
|||||||
int inAllowedBytes_locked();
|
int inAllowedBytes_locked();
|
||||||
void inReadBytes_locked(uint32_t );
|
void inReadBytes_locked(uint32_t );
|
||||||
|
|
||||||
|
// cleans up everything that's pending / half finished.
|
||||||
|
void free_pend_locked();
|
||||||
|
|
||||||
// RsSerialiser - determines which packets can be serialised.
|
// RsSerialiser - determines which packets can be serialised.
|
||||||
RsSerialiser *mRsSerialiser;
|
RsSerialiser *mRsSerialiser;
|
||||||
@ -126,7 +135,7 @@ class pqistreamer: public PQInterface
|
|||||||
uint32_t mPkt_wpending_size; // ... and its size.
|
uint32_t mPkt_wpending_size; // ... and its size.
|
||||||
|
|
||||||
void allocate_rpend_locked(); // use these two functions to allocate/free the buffer below
|
void allocate_rpend_locked(); // use these two functions to allocate/free the buffer below
|
||||||
void free_rpend_locked();
|
|
||||||
int mPkt_rpend_size; // size of pkt_rpending.
|
int mPkt_rpend_size; // size of pkt_rpending.
|
||||||
void *mPkt_rpending; // storage for read in pending packets.
|
void *mPkt_rpending; // storage for read in pending packets.
|
||||||
|
|
||||||
@ -170,7 +179,7 @@ class pqistreamer: public PQInterface
|
|||||||
bool mAcceptsPacketSlicing ;
|
bool mAcceptsPacketSlicing ;
|
||||||
time_t mLastSentPacketSlicingProbe ;
|
time_t mLastSentPacketSlicingProbe ;
|
||||||
void locked_addTrafficClue(const RsItem *pqi, uint32_t pktsize, std::list<RSTrafficClue> &lst);
|
void locked_addTrafficClue(const RsItem *pqi, uint32_t pktsize, std::list<RSTrafficClue> &lst);
|
||||||
RsItem *addPartialPacket(const void *block, uint32_t len, uint32_t slice_packet_id,bool packet_starting,bool packet_ending,uint32_t& total_len);
|
RsItem *addPartialPacket_locked(const void *block, uint32_t len, uint32_t slice_packet_id,bool packet_starting,bool packet_ending,uint32_t& total_len);
|
||||||
|
|
||||||
std::map<uint32_t,PartialPacketRecord> mPartialPackets ;
|
std::map<uint32_t,PartialPacketRecord> mPartialPackets ;
|
||||||
};
|
};
|
||||||
|
@ -99,7 +99,7 @@ struct SharedDirInfo
|
|||||||
std::string filename ;
|
std::string filename ;
|
||||||
std::string virtualname ;
|
std::string virtualname ;
|
||||||
FileStorageFlags shareflags ; // DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | ...
|
FileStorageFlags shareflags ; // DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | ...
|
||||||
std::list<std::string> parent_groups ;
|
std::list<RsNodeGroupId> parent_groups ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsFiles
|
class RsFiles
|
||||||
|
@ -103,9 +103,6 @@ public:
|
|||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
virtual void addRoutingClue(const GRouterKeyId& destination, const RsPeerId& source) =0;
|
virtual void addRoutingClue(const GRouterKeyId& destination, const RsPeerId& source) =0;
|
||||||
virtual void addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& peer_id) =0;
|
|
||||||
|
|
||||||
virtual bool getTrackingInfo(const RsGxsMessageId& mid, RsPeerId& provider_id) =0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// To access the GRouter from anywhere
|
// To access the GRouter from anywhere
|
||||||
|
@ -33,7 +33,8 @@ namespace GXS_SERV {
|
|||||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG = 0x00000100;
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG = 0x00000100;
|
||||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_REQUIRED = 0x00000200;
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_REQUIRED = 0x00000200;
|
||||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN = 0x00000400;
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN = 0x00000400;
|
||||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES = 0x00000800;
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES = 0x00000800; // not used anymore
|
||||||
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN = 0x00001000;
|
||||||
|
|
||||||
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_MASK = 0x000000ff;
|
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_MASK = 0x000000ff;
|
||||||
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED = 0x00000001;
|
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED = 0x00000001;
|
||||||
@ -105,6 +106,7 @@ namespace GXS_SERV {
|
|||||||
#define IS_MSG_UNPROCESSED(status) (status & GXS_SERV::GXS_MSG_STATUS_UNPROCESSED)
|
#define IS_MSG_UNPROCESSED(status) (status & GXS_SERV::GXS_MSG_STATUS_UNPROCESSED)
|
||||||
|
|
||||||
#define IS_GROUP_PGP_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
|
#define IS_GROUP_PGP_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
|
||||||
|
#define IS_GROUP_PGP_KNOWN_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN)
|
||||||
#define IS_GROUP_MESSAGE_TRACKING(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
|
#define IS_GROUP_MESSAGE_TRACKING(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
|
||||||
|
|
||||||
#define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
#define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||||
|
@ -62,6 +62,7 @@ extern RsIdentity *rsIdentity;
|
|||||||
|
|
||||||
// Unicode symbols. NOT utf-8 bytes, because of multi byte characters
|
// Unicode symbols. NOT utf-8 bytes, because of multi byte characters
|
||||||
#define RSID_MAXIMUM_NICKNAME_SIZE 30
|
#define RSID_MAXIMUM_NICKNAME_SIZE 30
|
||||||
|
#define RSID_MINIMUM_NICKNAME_SIZE 2
|
||||||
|
|
||||||
std::string rsIdTypeToString(uint32_t idtype);
|
std::string rsIdTypeToString(uint32_t idtype);
|
||||||
|
|
||||||
@ -221,8 +222,8 @@ public:
|
|||||||
RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) { return; }
|
RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) { return; }
|
||||||
virtual ~RsIdentity() { return; }
|
virtual ~RsIdentity() { return; }
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
// For Other Services....
|
// For Other Services....
|
||||||
// It should be impossible for them to get a message which we don't have the identity.
|
// It should be impossible for them to get a message which we don't have the identity.
|
||||||
@ -231,36 +232,38 @@ public:
|
|||||||
// We cache all identities, and provide alternative (instantaneous)
|
// We cache all identities, and provide alternative (instantaneous)
|
||||||
// functions to extract info, rather than the standard Token system.
|
// functions to extract info, rather than the standard Token system.
|
||||||
|
|
||||||
//virtual bool getNickname(const RsGxsId &id, std::string &nickname) = 0;
|
//virtual bool getNickname(const RsGxsId &id, std::string &nickname) = 0;
|
||||||
virtual bool getIdDetails(const RsGxsId &id, RsIdentityDetails &details) = 0;
|
virtual bool getIdDetails(const RsGxsId &id, RsIdentityDetails &details) = 0;
|
||||||
|
|
||||||
// Fills up list of all own ids. Returns false if ids are not yet loaded.
|
// Fills up list of all own ids. Returns false if ids are not yet loaded.
|
||||||
virtual bool getOwnIds(std::list<RsGxsId> &ownIds) = 0;
|
virtual bool getOwnIds(std::list<RsGxsId> &ownIds) = 0;
|
||||||
virtual bool isOwnId(const RsGxsId& id) = 0;
|
virtual bool isOwnId(const RsGxsId& id) = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
|
virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
|
||||||
bool absOpinion, int score) = 0;
|
bool absOpinion, int score) = 0;
|
||||||
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms) = 0;
|
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms) = 0;
|
||||||
|
|
||||||
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||||
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||||
|
|
||||||
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
|
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
|
||||||
const std::string &tag, RsRecognTagDetails &details) = 0;
|
const std::string &tag, RsRecognTagDetails &details) = 0;
|
||||||
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
|
||||||
uint16_t tag_class, uint16_t tag_type, std::string &tag) = 0;
|
uint16_t tag_class, uint16_t tag_type, std::string &tag) = 0;
|
||||||
|
|
||||||
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) = 0 ;
|
virtual bool setAsRegularContact(const RsGxsId& id,bool is_a_contact) = 0 ;
|
||||||
virtual bool isARegularContact(const RsGxsId& id) = 0 ;
|
virtual bool isARegularContact(const RsGxsId& id) = 0 ;
|
||||||
|
virtual bool isBanned(const RsGxsId& id) =0;
|
||||||
|
virtual time_t getLastUsageTS(const RsGxsId &id) =0;
|
||||||
|
|
||||||
// Specific RsIdentity Functions....
|
// Specific RsIdentity Functions....
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
/* We expose these initially for testing / GUI purposes.
|
/* We expose these initially for testing / GUI purposes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &groups) = 0;
|
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &groups) = 0;
|
||||||
//virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsIdOpinion> &opinions) = 0;
|
//virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsIdOpinion> &opinions) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,14 +73,13 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> c
|
|||||||
memcpy(bytes,id.toByteArray(),ID_SIZE_IN_BYTES) ;
|
memcpy(bytes,id.toByteArray(),ID_SIZE_IN_BYTES) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Random initialization. Can be useful for testing.
|
// Random initialization. Can be useful for testing and to generate new ids.
|
||||||
//
|
//
|
||||||
static t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> random()
|
static t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> random()
|
||||||
{
|
{
|
||||||
t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> id ;
|
t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> id ;
|
||||||
|
|
||||||
for(uint32_t i=0;i<ID_SIZE_IN_BYTES;++i)
|
RSRandom::random_bytes(id.bytes,ID_SIZE_IN_BYTES) ;
|
||||||
id.bytes[i] = RSRandom::random_u32() & 0xff ;
|
|
||||||
|
|
||||||
return id ;
|
return id ;
|
||||||
}
|
}
|
||||||
@ -164,7 +163,7 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> t
|
|||||||
if(s.length() != ID_SIZE_IN_BYTES*2)
|
if(s.length() != ID_SIZE_IN_BYTES*2)
|
||||||
{
|
{
|
||||||
if(!s.empty())
|
if(!s.empty())
|
||||||
std::cerr << "t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string in constructor has wrong size. Expected ID size=" << ID_SIZE_IN_BYTES << " String=\"" << s << "\"" << std::endl;
|
std::cerr << "t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string in constructor has wrong size. Expected ID size=" << ID_SIZE_IN_BYTES*2 << " String=\"" << s << "\" = " << s.length() << std::endl;
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
@ -220,6 +219,7 @@ static const uint32_t RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE = 0x0008 ;
|
|||||||
static const uint32_t RS_GENERIC_ID_GROUTER_ID_TYPE = 0x0009 ;
|
static const uint32_t RS_GENERIC_ID_GROUTER_ID_TYPE = 0x0009 ;
|
||||||
static const uint32_t RS_GENERIC_ID_GXS_TUNNEL_ID_TYPE = 0x0010 ;
|
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_GXS_DISTANT_CHAT_ID_TYPE = 0x0011 ;
|
||||||
|
static const uint32_t RS_GENERIC_ID_NODE_GROUP_ID_TYPE = 0x0012 ;
|
||||||
|
|
||||||
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_SSL_ID_TYPE> SSLIdType ;
|
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< PGP_KEY_ID_SIZE , true, RS_GENERIC_ID_PGP_ID_TYPE> PGPIdType ;
|
||||||
@ -231,4 +231,5 @@ typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_I
|
|||||||
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE > GXSCircleId ;
|
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE > GXSCircleId ;
|
||||||
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GXS_TUNNEL_ID_TYPE > GXSTunnelId ;
|
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GXS_TUNNEL_ID_TYPE > GXSTunnelId ;
|
||||||
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GXS_DISTANT_CHAT_ID_TYPE > DistantChatPeerId ;
|
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GXS_DISTANT_CHAT_ID_TYPE > DistantChatPeerId ;
|
||||||
|
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_NODE_GROUP_ID_TYPE > RsNodeGroupId ;
|
||||||
|
|
||||||
|
@ -229,12 +229,12 @@ class NotifyClient
|
|||||||
virtual void notifyPeerStatusChangedSummary () {}
|
virtual void notifyPeerStatusChangedSummary () {}
|
||||||
virtual void notifyDiscInfoChanged () {}
|
virtual void notifyDiscInfoChanged () {}
|
||||||
|
|
||||||
virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) { signature_result = false ;return true; }
|
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 notifyDownloadComplete (const std::string& /* fileHash */) {}
|
||||||
virtual void notifyDownloadCompleteCount (uint32_t /* count */) {}
|
virtual void notifyDownloadCompleteCount (uint32_t /* count */) {}
|
||||||
virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {}
|
virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {}
|
||||||
|
|
||||||
virtual bool askForPassword (const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;}
|
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 */) { return false ;}
|
virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -185,11 +185,17 @@ const uint32_t RS_NET_PROXY_STATUS_OK = 0x0001 ;
|
|||||||
|
|
||||||
|
|
||||||
/* Groups */
|
/* Groups */
|
||||||
#define RS_GROUP_ID_FRIENDS "Friends"
|
static const RsNodeGroupId RS_GROUP_ID_FRIENDS ("00000000000000000000000000000001");
|
||||||
#define RS_GROUP_ID_FAMILY "Family"
|
static const RsNodeGroupId RS_GROUP_ID_FAMILY ("00000000000000000000000000000002");
|
||||||
#define RS_GROUP_ID_COWORKERS "Co-Workers"
|
static const RsNodeGroupId RS_GROUP_ID_COWORKERS ("00000000000000000000000000000003");
|
||||||
#define RS_GROUP_ID_OTHERS "Other Contacts"
|
static const RsNodeGroupId RS_GROUP_ID_OTHERS ("00000000000000000000000000000004");
|
||||||
#define RS_GROUP_ID_FAVORITES "Favorites"
|
static const RsNodeGroupId RS_GROUP_ID_FAVORITES ("00000000000000000000000000000005");
|
||||||
|
|
||||||
|
#define RS_GROUP_DEFAULT_NAME_FRIENDS "Friends"
|
||||||
|
#define RS_GROUP_DEFAULT_NAME_FAMILY "Family"
|
||||||
|
#define RS_GROUP_DEFAULT_NAME_COWORKERS "Co-Workers"
|
||||||
|
#define RS_GROUP_DEFAULT_NAME_OTHERS "Other Contacts"
|
||||||
|
#define RS_GROUP_DEFAULT_NAME_FAVORITES "Favorites"
|
||||||
|
|
||||||
const uint32_t RS_GROUP_FLAG_STANDARD = 0x0001;
|
const uint32_t RS_GROUP_FLAG_STANDARD = 0x0001;
|
||||||
|
|
||||||
@ -295,7 +301,7 @@ class RsGroupInfo
|
|||||||
public:
|
public:
|
||||||
RsGroupInfo();
|
RsGroupInfo();
|
||||||
|
|
||||||
std::string id;
|
RsNodeGroupId id;
|
||||||
std::string name;
|
std::string name;
|
||||||
uint32_t flag;
|
uint32_t flag;
|
||||||
|
|
||||||
@ -346,7 +352,7 @@ public:
|
|||||||
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;
|
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||||
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
|
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||||
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
|
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
|
||||||
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) = 0;
|
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "") = 0;
|
||||||
|
|
||||||
/* Add/Remove Friends */
|
/* Add/Remove Friends */
|
||||||
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT) = 0;
|
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT) = 0;
|
||||||
@ -399,14 +405,15 @@ public:
|
|||||||
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
|
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
|
||||||
|
|
||||||
/* Group Stuff */
|
/* Group Stuff */
|
||||||
virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
|
virtual bool addGroup(RsGroupInfo& groupInfo) = 0;
|
||||||
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
virtual bool editGroup(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||||
virtual bool removeGroup(const std::string &groupId) = 0;
|
virtual bool removeGroup(const RsNodeGroupId& groupId) = 0;
|
||||||
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
virtual bool getGroupInfo(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
|
virtual bool getGroupInfoByName(const std::string& groupId, RsGroupInfo& groupInfo) = 0;
|
||||||
|
virtual bool getGroupInfoList(std::list<RsGroupInfo>& groupInfoList) = 0;
|
||||||
// groupId == "" && assign == false -> remove from all groups
|
// groupId == "" && assign == false -> remove from all groups
|
||||||
virtual bool assignPeerToGroup(const std::string &groupId, const RsPgpId& peerId, bool assign) = 0;
|
virtual bool assignPeerToGroup(const RsNodeGroupId& groupId, const RsPgpId& peerId, bool assign) = 0;
|
||||||
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
|
virtual bool assignPeersToGroup(const RsNodeGroupId& groupId, const std::list<RsPgpId>& peerIds, bool assign) = 0;
|
||||||
|
|
||||||
/* Group sharing permission */
|
/* Group sharing permission */
|
||||||
|
|
||||||
@ -421,7 +428,7 @@ public:
|
|||||||
//
|
//
|
||||||
virtual FileSearchFlags computePeerPermissionFlags(
|
virtual FileSearchFlags computePeerPermissionFlags(
|
||||||
const RsPeerId& peer_id, FileStorageFlags file_sharing_flags,
|
const RsPeerId& peer_id, FileStorageFlags file_sharing_flags,
|
||||||
const std::list<std::string>& file_parent_groups) = 0;
|
const std::list<RsNodeGroupId>& file_parent_groups) = 0;
|
||||||
|
|
||||||
/* Service permission flags */
|
/* Service permission flags */
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ virtual ~RsPosted() { return; }
|
|||||||
|
|
||||||
/* Specific Service Data */
|
/* Specific Service Data */
|
||||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) = 0;
|
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) = 0;
|
||||||
|
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts) = 0;
|
||||||
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
|
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
|
||||||
//Not currently used
|
//Not currently used
|
||||||
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
|
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
|
||||||
|
@ -50,14 +50,25 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
||||||
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
virtual bool getReputationInfo(const RsGxsId& id, const RsPgpId &ownerNode, ReputationInfo& info) =0;
|
||||||
virtual void setNodeAutoBanThreshold(uint32_t n) =0;
|
|
||||||
virtual uint32_t nodeAutoBanThreshold() =0;
|
// parameters
|
||||||
|
|
||||||
|
// virtual void setNodeAutoBanThreshold(uint32_t n) =0;
|
||||||
|
// virtual uint32_t nodeAutoBanThreshold() =0;
|
||||||
|
|
||||||
|
virtual void setNodeAutoPositiveOpinionForContacts(bool b) =0;
|
||||||
|
virtual bool nodeAutoPositiveOpinionForContacts() =0;
|
||||||
|
virtual float nodeAutoBanIdentitiesLimit() =0;
|
||||||
|
virtual void setNodeAutoBanIdentitiesLimit(float f) =0;
|
||||||
|
|
||||||
// This one is a proxy designed to allow fast checking of a GXS id.
|
// This one is a proxy designed to allow fast checking of a GXS id.
|
||||||
// it basically returns true if assessment is not ASSESSMENT_OK
|
// it basically returns true if assessment is not ASSESSMENT_OK
|
||||||
|
|
||||||
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
||||||
|
|
||||||
|
virtual bool isNodeBanned(const RsPgpId& id) =0;
|
||||||
|
virtual void banNode(const RsPgpId& id,bool b) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// To access reputations from anywhere
|
// To access reputations from anywhere
|
||||||
|
@ -212,7 +212,7 @@ class FileInfo
|
|||||||
DwlSpeed priority ;
|
DwlSpeed priority ;
|
||||||
time_t lastTS;
|
time_t lastTS;
|
||||||
|
|
||||||
std::list<std::string> parent_groups ;
|
std::list<RsNodeGroupId> parent_groups ;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const FileInfo& info);
|
std::ostream &operator<<(std::ostream &out, const FileInfo& info);
|
||||||
@ -242,8 +242,8 @@ public:
|
|||||||
FileStorageFlags flags;
|
FileStorageFlags flags;
|
||||||
uint32_t min_age ; // minimum age of files in this subtree
|
uint32_t min_age ; // minimum age of files in this subtree
|
||||||
|
|
||||||
std::vector<DirStub> children;
|
std::list<DirStub> children;
|
||||||
std::list<std::string> parent_groups; // parent groups for the shared directory
|
std::list<RsNodeGroupId> parent_groups; // parent groups for the shared directory
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const DirDetails& details);
|
std::ostream &operator<<(std::ostream &out, const DirDetails& details);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#define RS_MAJOR_VERSION 0
|
#define RS_MAJOR_VERSION 0
|
||||||
#define RS_MINOR_VERSION 6
|
#define RS_MINOR_VERSION 6
|
||||||
#define RS_BUILD_NUMBER 0
|
#define RS_BUILD_NUMBER 1
|
||||||
#define RS_BUILD_NUMBER_ADD "x" // <-- do we need this?
|
#define RS_BUILD_NUMBER_ADD "x" // <-- do we need this?
|
||||||
|
|
||||||
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
|
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
|
||||||
// git log --pretty="%H" | head -1 | cut -c1-8
|
// git log --pretty="%H" | head -1 | cut -c1-8
|
||||||
//
|
//
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define RS_MAJOR_VERSION 0
|
#define RS_MAJOR_VERSION 0
|
||||||
#define RS_MINOR_VERSION 6
|
#define RS_MINOR_VERSION 6
|
||||||
#define RS_BUILD_NUMBER 0
|
#define RS_BUILD_NUMBER 1
|
||||||
#define RS_BUILD_NUMBER_ADD ""
|
#define RS_BUILD_NUMBER_ADD ""
|
||||||
|
|
||||||
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
|
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
|
||||||
|
@ -635,9 +635,9 @@ bool p3Peers::getAssociatedSSLIds(const RsPgpId &gpg_id, std::list<RsPeerId> &id
|
|||||||
return mPeerMgr->getAssociatedPeers(gpg_id, ids);
|
return mPeerMgr->getAssociatedPeers(gpg_id, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen)
|
bool p3Peers::gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason /* = "" */)
|
||||||
{
|
{
|
||||||
return AuthGPG::getAuthGPG()->SignDataBin(data,len,sign,signlen);
|
return AuthGPG::getAuthGPG()->SignDataBin(data,len,sign,signlen, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::getGPGDetails(const RsPgpId &pgp_id, RsPeerDetails &d)
|
bool p3Peers::getGPGDetails(const RsPgpId &pgp_id, RsPeerDetails &d)
|
||||||
@ -1280,7 +1280,7 @@ bool p3Peers::addGroup(RsGroupInfo &groupInfo)
|
|||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::editGroup(const std::string &groupId, RsGroupInfo &groupInfo)
|
bool p3Peers::editGroup(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::editGroup()" << std::endl;
|
std::cerr << "p3Peers::editGroup()" << std::endl;
|
||||||
@ -1292,7 +1292,7 @@ bool p3Peers::editGroup(const std::string &groupId, RsGroupInfo &groupInfo)
|
|||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::removeGroup(const std::string &groupId)
|
bool p3Peers::removeGroup(const RsNodeGroupId &groupId)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::removeGroup()" << std::endl;
|
std::cerr << "p3Peers::removeGroup()" << std::endl;
|
||||||
@ -1303,7 +1303,15 @@ bool p3Peers::removeGroup(const std::string &groupId)
|
|||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo)
|
bool p3Peers::getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo)
|
||||||
|
{
|
||||||
|
#ifdef P3PEERS_DEBUG
|
||||||
|
std::cerr << "p3Peers::getGroupInfo()" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return mPeerMgr->getGroupInfoByName(groupName, groupInfo);
|
||||||
|
}
|
||||||
|
bool p3Peers::getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::getGroupInfo()" << std::endl;
|
std::cerr << "p3Peers::getGroupInfo()" << std::endl;
|
||||||
@ -1321,7 +1329,7 @@ bool p3Peers::getGroupInfoList(std::list<RsGroupInfo> &groupInfoList)
|
|||||||
return mPeerMgr->getGroupInfoList(groupInfoList);
|
return mPeerMgr->getGroupInfoList(groupInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::assignPeerToGroup(const std::string &groupId, const RsPgpId& peerId, bool assign)
|
bool p3Peers::assignPeerToGroup(const RsNodeGroupId &groupId, const RsPgpId& peerId, bool assign)
|
||||||
{
|
{
|
||||||
std::list<RsPgpId> peerIds;
|
std::list<RsPgpId> peerIds;
|
||||||
peerIds.push_back(peerId);
|
peerIds.push_back(peerId);
|
||||||
@ -1329,7 +1337,7 @@ bool p3Peers::assignPeerToGroup(const std::string &groupId, const RsPgpId& peerI
|
|||||||
return assignPeersToGroup(groupId, peerIds, assign);
|
return assignPeersToGroup(groupId, peerIds, assign);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign)
|
bool p3Peers::assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId> &peerIds, bool assign)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::assignPeersToGroup()" << std::endl;
|
std::cerr << "p3Peers::assignPeersToGroup()" << std::endl;
|
||||||
@ -1343,7 +1351,7 @@ bool p3Peers::assignPeersToGroup(const std::string &groupId, const std::list<RsP
|
|||||||
|
|
||||||
FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
||||||
FileStorageFlags share_flags,
|
FileStorageFlags share_flags,
|
||||||
const std::list<std::string>& directory_parent_groups)
|
const std::list<RsNodeGroupId>& directory_parent_groups)
|
||||||
{
|
{
|
||||||
// We should be able to do that in O(1), using groups based on packs of bits.
|
// We should be able to do that in O(1), using groups based on packs of bits.
|
||||||
//
|
//
|
||||||
@ -1354,7 +1362,7 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||||||
bool found = false ;
|
bool found = false ;
|
||||||
RsPgpId pgp_id = getGPGId(peer_ssl_id) ;
|
RsPgpId pgp_id = getGPGId(peer_ssl_id) ;
|
||||||
|
|
||||||
for(std::list<std::string>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
for(std::list<RsNodeGroupId>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
||||||
{
|
{
|
||||||
RsGroupInfo info ;
|
RsGroupInfo info ;
|
||||||
if(!getGroupInfo(*it,info))
|
if(!getGroupInfo(*it,info))
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user