mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
merged with latest upstream trunk
This commit is contained in:
commit
0c1e6301b3
@ -7,7 +7,7 @@ before_install:
|
|||||||
- echo $LANG
|
- echo $LANG
|
||||||
- echo $LC_ALL
|
- echo $LC_ALL
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get install build-essential checkinstall cmake g++ git libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libdc1394-22-dev libglib2.0-dev libcv-dev libopencv-highgui-dev libhighgui-dev
|
- sudo apt-get install build-essential checkinstall cmake g++ git libavutil-dev libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libdc1394-22-dev libglib2.0-dev libcv-dev libopencv-highgui-dev libhighgui-dev
|
||||||
- sudo apt-get install libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev
|
- sudo apt-get install libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev
|
||||||
- sudo apt-get install libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev
|
- sudo apt-get install libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev
|
||||||
- sudo apt-get install libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev make pkg-config protobuf-compiler python-dev python-numpy subversion git yasm qtmobility-dev
|
- sudo apt-get install libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev make pkg-config protobuf-compiler python-dev python-numpy subversion git yasm qtmobility-dev
|
||||||
|
@ -10,7 +10,7 @@ Compilation on Linux
|
|||||||
```bash
|
```bash
|
||||||
sudo apt-get install libglib2.0-dev libupnp-dev qt4-dev-tools \
|
sudo apt-get install libglib2.0-dev libupnp-dev qt4-dev-tools \
|
||||||
libqt4-dev libssl-dev libxss-dev libgnome-keyring-dev libbz2-dev \
|
libqt4-dev libssl-dev libxss-dev libgnome-keyring-dev libbz2-dev \
|
||||||
libqt4-opengl-dev libqtmultimediakit1 qtmobility-dev \
|
libqt4-opengl-dev libqtmultimediakit1 qtmobility-dev libsqlcipher-dev \
|
||||||
libspeex-dev libspeexdsp-dev libxslt1-dev libcurl4-openssl-dev \
|
libspeex-dev libspeexdsp-dev libxslt1-dev libcurl4-openssl-dev \
|
||||||
libopencv-dev tcl8.5 libmicrohttpd-dev
|
libopencv-dev tcl8.5 libmicrohttpd-dev
|
||||||
```
|
```
|
||||||
|
@ -7,7 +7,6 @@ SUBDIRS += \
|
|||||||
libbitdht \
|
libbitdht \
|
||||||
libretroshare \
|
libretroshare \
|
||||||
libresapi \
|
libresapi \
|
||||||
pegmarkdown \
|
|
||||||
retroshare_gui \
|
retroshare_gui \
|
||||||
retroshare_nogui \
|
retroshare_nogui \
|
||||||
plugins
|
plugins
|
||||||
@ -22,10 +21,8 @@ libretroshare.depends = openpgpsdk libbitdht
|
|||||||
libresapi.file = libresapi/src/libresapi.pro
|
libresapi.file = libresapi/src/libresapi.pro
|
||||||
libresapi.depends = libretroshare
|
libresapi.depends = libretroshare
|
||||||
|
|
||||||
pegmarkdown.file = supportlibs/pegmarkdown/pegmarkdown.pro
|
|
||||||
|
|
||||||
retroshare_gui.file = retroshare-gui/src/retroshare-gui.pro
|
retroshare_gui.file = retroshare-gui/src/retroshare-gui.pro
|
||||||
retroshare_gui.depends = libretroshare libresapi pegmarkdown
|
retroshare_gui.depends = libretroshare libresapi
|
||||||
retroshare_gui.target = retroshare-gui
|
retroshare_gui.target = retroshare-gui
|
||||||
|
|
||||||
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
|
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
|
||||||
@ -35,3 +32,9 @@ retroshare_nogui.target = retroshare-nogui
|
|||||||
plugins.file = plugins/plugins.pro
|
plugins.file = plugins/plugins.pro
|
||||||
plugins.depends = retroshare_gui
|
plugins.depends = retroshare_gui
|
||||||
plugins.target = plugins
|
plugins.target = plugins
|
||||||
|
|
||||||
|
wikipoos {
|
||||||
|
SUBDIRS += pegmarkdown
|
||||||
|
pegmarkdown.file = supportlibs/pegmarkdown/pegmarkdown.pro
|
||||||
|
retroshare_gui.depends += pegmarkdown
|
||||||
|
}
|
||||||
|
11
Start_RetroShare-Gui_Debug.bat
Executable file
11
Start_RetroShare-Gui_Debug.bat
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
set QTDIR=C:\Qt\5.5\mingw492_32
|
||||||
|
set LIBS=..\libs
|
||||||
|
set RSPATH=.\retroshare-gui\src\debug
|
||||||
|
|
||||||
|
set PATH=%QTDIR%\bin;%LIBS%\bin;%PATH%
|
||||||
|
|
||||||
|
If not exist %RSPATH%\RetroShare06.exe (
|
||||||
|
build-all-mingw32make.bat
|
||||||
|
)
|
||||||
|
|
||||||
|
%RSPATH%\RetroShare06.exe
|
461
TODO.txt
461
TODO.txt
@ -1,345 +1,126 @@
|
|||||||
|
Legend:
|
||||||
|
E: easy. Just GUI stuff, no algorithmics involved. That does not mean it's easy to come up with.
|
||||||
|
M: medium, either because it's a big task, or because it needs to understand a lot of code.
|
||||||
|
H: hard. Needs digging deep into libretroshare, possibly involving some crypto.
|
||||||
|
|
||||||
|
[ ] pending
|
||||||
|
[/] half-done, someone's on it
|
||||||
|
[-] cancelled
|
||||||
|
[X] done
|
||||||
|
|
||||||
|
PS: no tabs in this file,thx ;-)
|
||||||
|
|
||||||
|
----------------------------------------- TODO list ----------------------------------------------
|
||||||
|
|
||||||
|
GUI
|
||||||
|
E [ ] add a "Contact" list to help selecting peers in People/FriendChooser/messages/etc.
|
||||||
|
E [ ] Implement creation of a default (signed) gxs id in startup wizard. Needs to show to the
|
||||||
|
user a proper separation between nodes (network layer) and GXS ids (service layer).
|
||||||
|
E [ ] fix posted GUI. Needs to be more handy and more appealing.
|
||||||
|
E [ ] add RS links for GXS identities, so that they can be transferred easily between nodes in forums, etc
|
||||||
|
E [ ] enable people dialog
|
||||||
|
M [ ] Personal Page (Profile Page for GXS ID Users,view latest Posts, public forum/channels,posted posts, comments in all areas, Reputation Infos, Popularity and more)
|
||||||
|
E [ ] fix RSButtonOnText::eventFilter, and fix all places where RSButtonOnText gets deleted
|
||||||
|
E [ ] find all places where the deprecated(in Qt5) Q_WS_WIN and other Q_WS* macros are
|
||||||
|
used, and replace with something else
|
||||||
|
E [ ] add tooltips in in permission matrix when hovering over the top most button/service name
|
||||||
|
explain what the service does and the dependencies
|
||||||
|
E [ ] Make RS fully compatible with High DPI screens.
|
||||||
|
M [ ] improve comments in channels. Comments should be more available, more visible, and easier to handle.
|
||||||
|
M [ ] Merge the various help systems. there's 3 of them now. Lots of duplicate code, etc.
|
||||||
|
M [ ] New and consistent icon set (Purplehaze420 said he would provide a consistent set of icons. Is that still alive?)
|
||||||
|
M [ ] add in options->Network a way to select which network interface is used to talk (choice between "auto" or selected from a list)
|
||||||
|
M [ ] add a RS link for encrypted messages (encrypt for multiple GXS ids at once). Messages will appear as a link when encrypted and
|
||||||
|
be automatically decrypted when a suitable GXS id is available for it. Could be a way to securely post something in a public place.
|
||||||
|
|
||||||
|
File transfer (all 3 tasks are related)
|
||||||
|
E [ ] Add a limit of the total number of files simultaneously asked to the same peer using direct transfer.
|
||||||
|
H [ ] implement a new file list management, with new info such as access time,total upload, popularity, etc
|
||||||
|
H [ ] implement a new file list sharing service based on auto-sync system
|
||||||
|
M [ ] get rid of the old cache system (remove CacheStrapper, CacheSource,etc)
|
||||||
|
|
||||||
|
DHT
|
||||||
|
H [ ] improve DHT lookups to find masquerading peers using fake peers. First experiments (by cyril) do not prove very efficient.
|
||||||
|
|
||||||
|
GXS
|
||||||
|
M [X] create a tunnel service from distant chat code to make it (1) more generic (2) resistant to packet loss.
|
||||||
|
M [ ] optimise GXS sync BW. For the moment too much is sent between nodes.
|
||||||
|
H [/] add the ability to use anonymous identities into circles. Needs new distribution model using items encrypted for multiple GXS keys.
|
||||||
|
H [ ] use different and incompatible classes for public and private keys in GxsSecurity
|
||||||
|
|
||||||
|
VOIP
|
||||||
|
H [ ] use proper video encoding. What we have now is decent for video, but sound should be prioritized. Experiments
|
||||||
|
with QtAV seem to work nicely. Finish and integrate!
|
||||||
|
M [ ] Video Quality/Resolution Settings (High, Medium, Low) HD, HQ, SD )
|
||||||
|
M [ ] Video Device: WebCam(s) or Desktop Selection
|
||||||
|
M [ ] Audio Input Device Selection (Microphone)
|
||||||
|
M [ ] Audio Output Device Selection (Speaker)
|
||||||
|
M [ ] Video Snapshots https://support.skype.com/en/faq/FA1222/what-is-video-snapshot
|
||||||
|
M [ ] Voice Messaging (record and send a voice message)
|
||||||
|
M [ ] Video Messages (send a video greeting to multiple friends/coworkers/developers at once.)
|
||||||
|
H [ ] Audio Conference
|
||||||
|
H [ ] Video Conference
|
||||||
|
|
||||||
|
|
||||||
|
Messages
|
||||||
|
H [ ] make the mail system re-send failed emails notified by the global router. This is hard because it needs a proper
|
||||||
|
management of duplicate messages
|
||||||
|
E [ ] add flags to allow distant messaging from contact list only / everyone / noone / only signed ids.
|
||||||
|
|
||||||
|
Chat
|
||||||
|
E [ ] add flags to allow distant chat from contact list only / everyone / noone / only signed ids.
|
||||||
|
|
||||||
|
Libretroshare
|
||||||
|
E [ ] make sure at least one location is kept when removing old locations as it avoids lots of connection problems.
|
||||||
|
M [ ] improve serialisation system. Lots of serialisation tasks (header, verifications, serialiser=>template, can be factored)
|
||||||
|
M [ ] separate chat stuff from rsmsgs.h into rschat.h
|
||||||
|
M [ ] crash at shutdown due to memory management already cleared while new objects keep being requested.
|
||||||
|
|
||||||
|
#0 0x0000000000da52eb in RsMemoryManagement:¿mallObject:¿mallObject() ()
|
||||||
|
#1 0x0000000000da3694 in RsItem::RsItem(unsigned int) ()
|
||||||
|
#2 0x0000000000dcb365 in RsRawItem::RsRawItem (this=0x0, t=33559555, size=38) at ./serialiser/rsserial.h
|
||||||
|
#3 0x0000000000fc1643 in RsServiceSerialiser::deserialise(void*, unsigned int*) ()
|
||||||
|
#4 0x0000000000da4451 in RsSerialiser::deserialise(void*, unsigned int*) ()
|
||||||
|
#5 0x0000000000fb5b4b in pqistreamer::handleincoming_locked() ()
|
||||||
|
#6 0x0000000000fb4b3e in pqistreamer::tick_recv(unsigned int) ()
|
||||||
|
#7 0x0000000000fb744a in pqithreadstreamer::data_tick() ()
|
||||||
|
#8 0x0000000000e19b27 in RsTickingThread::runloop (this=0x7fffb004e7e8) at util/rsthreads.cc:196
|
||||||
|
#9 0x0000000000e19748 in RsThread::rsthread_init (p=0x7fffb004e7e8) at util/rsthreads.cc:63
|
||||||
|
#10 0x00007ffff4006f6b in start_thread () from /lib64/libpthread.so.0
|
||||||
|
#11 0x00007ffff351c7ed in clone () from /lib64/libc.so.6
|
||||||
|
|
||||||
|
Channels
|
||||||
|
E [ ] allow to set a download directory per channel
|
||||||
|
M [ ] Thumbnail View for Channels
|
||||||
|
M [ ] Count commments on Comments Button
|
||||||
|
M [ ] Notify Channel comments/replies
|
||||||
|
|
||||||
|
Posted
|
||||||
|
E [ ] Show an info page for unsubscribed posted threads (same as forums)
|
||||||
|
E [ ] Make the GUI of Posted more sexy: more compact items, remove unecessary text, use consistent icons,...
|
||||||
|
|
||||||
|
Forums
|
||||||
|
E [ ] do we keep "Getting Started" ? the look needs to be improved. Any help doing this is welcome!
|
||||||
|
E [ ] some widgets in the GUI do not follow the system style => GUI looks bad on these systems
|
||||||
|
|
||||||
|
Bugs
|
||||||
|
E [ ] find the bug that shows some peers online in Network although they are not.
|
||||||
|
M [ ] Selecting different options in messages composer -> contact list then come back,
|
||||||
|
shows disappearing / re-appearing people. What causes this???
|
||||||
|
|
||||||
|
Settings
|
||||||
|
E [ ] add default sounds for Friend go online, New Chat Message, Message arrived, Download complete
|
||||||
|
M [ ] make sure sound is working for users on linux. We also need a "test sound" button in config->sound.
|
||||||
|
|
||||||
|
Packaging
|
||||||
|
E [ ] Sound files should be part of the install package at least on ubuntu (put them in /usr/share)
|
||||||
|
|
||||||
List of pending non backward compatible changes
|
List of pending non backward compatible changes
|
||||||
===============================================
|
===============================================
|
||||||
|
|
||||||
* RsGxsGrpMetaData::deserialis should use a proper TLV_STR_TYPE_NAME instead of 0 for mGroupName and mMsgName, in rsgxsdata.cc
|
* RsGxsGrpMetaData::deserialis should use a proper TLV_STR_TYPE_NAME instead of 0 for
|
||||||
* p3IdService::service_CreateGroup() should convert the mPgpSign member to radix64!! For now it is hard-coded in binary in a string.
|
mGroupName and mMsgName, in rsgxsdata.cc
|
||||||
|
* p3IdService::service_CreateGroup() should convert the mPgpSign member to radix64!! For now
|
||||||
List of fixes/improvements before 0.6
|
it is hard-coded in binary in a string.
|
||||||
=====================================
|
|
||||||
|
|
||||||
Legend:
|
|
||||||
E: easy. Just GUI stuff, no algorithmics involved
|
|
||||||
M: medium. Needs some care.
|
|
||||||
H: hard. Needs digging into libretroshare.
|
|
||||||
|
|
||||||
---------------------------------------- GUI TWEAKS FOR 0.6 RELEASE -------------------------------------------------
|
|
||||||
|
|
||||||
To be done
|
|
||||||
|
|
||||||
GUI
|
|
||||||
|
|
||||||
[X] http://www.cjoint.com/c/EFlhWgeLg4F. Strings too long in Add Friends Wizard on the conclusion page.
|
|
||||||
[X] RS crashes when right clicking on the People tabs when there's nobody yet
|
|
||||||
[X] Network tab cannot shrink the avatar column
|
|
||||||
[X] newsfeed default:
|
|
||||||
Options -- Notify -- Feed
|
|
||||||
Security <-- Make as Default Enabled
|
|
||||||
Connect attempt <-- Make as Default Enabled
|
|
||||||
|
|
||||||
[X] make the "Wrong IP reported" security item less dramatic. We should add text saying that this can be due to a friend
|
|
||||||
connecting before your own RS has realized that its IP has changed.
|
|
||||||
|
|
||||||
[ ] it should be possible to completely disable IP change security items using a checkbox in options->notify->Feeds
|
|
||||||
These security items should be enabled by default
|
|
||||||
|
|
||||||
[X] "Wrong IP" security items shouldn't show up when the IP reported by friend is whitelisted.
|
|
||||||
|
|
||||||
[X] at login, when cancel is pressed, the system keeps asking for the passwd. It shouldn't, and directly go back to the list of locations.
|
|
||||||
|
|
||||||
0000 [ ] merge the various help systems. there's 3 of them: (1) help buttons on most tabs that pop a flat panel with some
|
|
||||||
info; (2) help wizard accessible from the "!" button in friends details->Trust; (3) 'getting started tab'
|
|
||||||
|
|
||||||
0001 [X] forums - middle horisontal bar - always shows *by anonymous* (from noname) [fixed, also removed useless thread line]
|
|
||||||
0002 [X] remove useless column in forums "signed by" (last column) (from electron)
|
|
||||||
0003 [ ] main window must close on ESC (from noname)
|
|
||||||
0004 [X] show storage time of forums/channels/posted in gui (from cave)
|
|
||||||
0005 [X] if keysigning is not working -> hide or remove it (from cave) cyril: keep it, but add more info about how to use/interpret it.
|
|
||||||
0006 [ ] implement default gxs id (from cave) cyril: you mean system-wide default gxs id? That would be a good thing to have.
|
|
||||||
0007 [ ] *getting started* - need to say about chatservers (from noname)
|
|
||||||
comment: chatservers are inofficial and may go down at any time. which one should we mention?
|
|
||||||
cyril: we could add a link to a search for RS chat servers in duckduck go
|
|
||||||
0008 [X] forum livetime too short (from noname) cyril: expand it to 1 year
|
|
||||||
0009 [ ] Settings -> Server -> show discovery information in statusbar. I've never seen any discovery info since the switch to
|
|
||||||
disc v2 - so i guess this option can be removed (from sehraf) cyril: that can be fixed. The link between GUI and discovery2 can
|
|
||||||
be restored. Also we should get rid of the code for discovery(1)
|
|
||||||
|
|
||||||
0010 [ ] window and tab sizes not saved on exit or closing (from noname)
|
|
||||||
|
|
||||||
0011 [X] in add friend dialog: include signatures seems to do nothing there. cyril: it does if you have signatures. Show
|
|
||||||
the checkbox only when the key as signatures => less confusion. (from noname)
|
|
||||||
|
|
||||||
0012 [ ] from time to time the location images and the location message is not updated or gets lost, or the location name. (from cave)
|
|
||||||
|
|
||||||
0013 [ ] new design, new icons, minimal UI (from purplehaze420) comment: use webui as base for minimal ui
|
|
||||||
cyril: we cannot change everything now. But purplehaze420 said he would provide a consistent set of icons. That would be great.
|
|
||||||
|
|
||||||
0014 [X] go to Settings -> Permissions: wait for scrollbars to appear go back to any other setting (e.g. Notify): the page now
|
|
||||||
needs the same space as the permission matrix (happens on windows + linux; can be "fixed" by closing and reopen the setting window)
|
|
||||||
(from sehraf)
|
|
||||||
|
|
||||||
0015 [X] The new statistics windows is really nice and everybody should see it -> add a link to it somewhere in settings
|
|
||||||
(or wherever suitable) (from sehraf) cyril: there's a menu in the bottom right corner ofthe main window to get it.
|
|
||||||
Otherwise, we could merge it as tabs in options->server, but I don't really like this option.
|
|
||||||
|
|
||||||
0016 [ ] many things are deeply hidden - config wizard, share manager, permissions, statistics (from noname)
|
|
||||||
comment: either the gui is overloaded with buttons or stuff is hidden. choose one
|
|
||||||
cyril: this is true. Config wizard and share manager could be made more obvious.
|
|
||||||
Config wizard could be integrated in "getting started" which means
|
|
||||||
to be improved anyway.
|
|
||||||
|
|
||||||
0017 [X] no tab configuraion for uploads section. no cache transfer disable option comment: cachetransfers will be removed (from noname)
|
|
||||||
cyril: rename "show cache transfers" into "show file lists transfers"
|
|
||||||
|
|
||||||
0018 [X] add friend dialog - add button for pasting from clipboard.
|
|
||||||
// some ppl dumb to use rightclich or keyboard)) and on the upper window some buttons exist, the lower one feels lonely.(from noname)
|
|
||||||
comment: teach to use the context menu, else they are lost in RS
|
|
||||||
|
|
||||||
0019 [X] no identity on first start makes impossible to start chat or post forums.
|
|
||||||
maybe config wizard should propose to create one, just asking a name desired. (from noname)
|
|
||||||
cyril: integrating in config wizard is a good idea: check if one identity is present, if not allow to create one.
|
|
||||||
Note that all ID choosers allow to create a new identity
|
|
||||||
|
|
||||||
0020 [ ] double click on completed download must open the file. or folder, configurable in options (from noname)
|
|
||||||
|
|
||||||
0028 [X] RTT statistics shouldn't show curves for offline peers
|
|
||||||
0029 [X] In options, rename "server"->"network", "transfer"->"file transfer".
|
|
||||||
|
|
||||||
0030 [X] forums - middle horisontal bar - post time is duplicate to the one in the list. also thread name.
|
|
||||||
forum name (the line with view mode) is duplicate to tab header.
|
|
||||||
button for new thread must have text, *reply to selected post* button must be placed next to it
|
|
||||||
the big subscribe button on the top, but never used.
|
|
||||||
generally,we have 2 panels here, both semi-empty. need to compact all the stuff
|
|
||||||
|
|
||||||
0031 [X] chats - participant list can't be extended in wide.
|
|
||||||
show/hide button is almost invisible. make it more big. but it takes space in width, so move it to bar with lobby name.
|
|
||||||
however, the lobby name bar also seems redundant. so maybe the button's final place must domewhere in the lower button bar.
|
|
||||||
|
|
||||||
0031a[ ] ... the lobby name bar also seems redundant ....
|
|
||||||
|
|
||||||
0032 [X] In Network->friend list. Remove "[Connected]" to location names. Takes room and isn't useful since the text is in bold
|
|
||||||
when connected. Also put the avatar column first. Remove the "Busy" and "Idle" text since they are shown as icon already and
|
|
||||||
set them as tooltip => lots of saved space.
|
|
||||||
|
|
||||||
0033 [ ] Selecting different options in messages composer -> contact list then come back, shows disappearing / re-appearing people.
|
|
||||||
What causes this???
|
|
||||||
|
|
||||||
0034 [X] Show forum/channel/posted admin name in details window
|
|
||||||
|
|
||||||
**Not sure**
|
|
||||||
|
|
||||||
0021 [ ] too many option tabs. may be some must be hidden when advanced mode is not selected
|
|
||||||
some may be grouped, like styles -for messages, chats and forums appearance must be somewhere on top, in general (from noname)
|
|
||||||
comment: hiding stuff makes it even more complicated. before we hide it we can remove it
|
|
||||||
cyril: we could group them somehow.
|
|
||||||
|
|
||||||
0022 [ ] some time ago we had separate chat window for messaging (in 0.5.5 it still exists). may be it must be resurrected. (from noname)
|
|
||||||
|
|
||||||
// UNSORTED
|
|
||||||
//
|
|
||||||
// 23 [too hard for v0.6] chats are missing quote feature, any text formatting.
|
|
||||||
// picture attachment is ajoke, with the size limits given.
|
|
||||||
// need ability to save picture attaches in forums and chats
|
|
||||||
// (from noname)
|
|
||||||
//
|
|
||||||
// 24 [do nothing] people tab - is not much useful, may be hide it somewhere from main window. like options-node-my idents.
|
|
||||||
// (from noname)
|
|
||||||
// comment: we don't have somethign better, live with it
|
|
||||||
//
|
|
||||||
// 25 [low priority] network - peer filter - not showing locations, not useful because many options are location specific.
|
|
||||||
// (from noname)
|
|
||||||
// comment: not sure what correct behaviour would be
|
|
||||||
//
|
|
||||||
// 26 [low priority] friend file browser - need options to hide offline peers, hide empy shares
|
|
||||||
// size column should count contents for directories
|
|
||||||
// (from noname)
|
|
||||||
// comment: will people complain about missing peers?
|
|
||||||
//
|
|
||||||
// 27 [] notify for channels and forums - need option to show only new forums, not for every post in them.
|
|
||||||
// some might not like flooding there, and it is not a big problem to go to needed tab when it becomes red.
|
|
||||||
// (from noname)
|
|
||||||
|
|
||||||
// long post from noname. Many things go to deep and are out of scope for v0.6
|
|
||||||
//
|
|
||||||
// compaction the line below the buttonbar is useless, it just duplicates the
|
|
||||||
// button. except the mail tab, there is some buttons and they need to be
|
|
||||||
// relocated the help icon on each tab can be placed in window title or
|
|
||||||
// somwhere else
|
|
||||||
//
|
|
||||||
// IM window - the whole bar with name and a/v buttons is excess. name is on
|
|
||||||
// the window title, and in the chat. buttons must be on the lower panel with
|
|
||||||
// the others. 3x set... and dock buttons also must be relocated and the
|
|
||||||
// panel removed. away/offline informer bar must be more compact and nice
|
|
||||||
//
|
|
||||||
// modularity some peopl may not use specific rs features like forums or chats
|
|
||||||
// or mail. create the ability to hide the tabs from interface and disable the
|
|
||||||
// network services for them in an ultimate configuration people for example
|
|
||||||
// may want only chats, so the compact interface with only peer list is good
|
|
||||||
// for them, skype-like.
|
|
||||||
|
|
||||||
------------------------------------------ GENERAL BACKEND STUFF ----------------------------------------------------
|
|
||||||
Posted:
|
|
||||||
E [X] it's not possible to create a Posted thread without a Owner.
|
|
||||||
Bug? If not, then remove "No signature" from selection box
|
|
||||||
E [ ] Show an info page for unsubscribed posted threads (same as forums)
|
|
||||||
E [X] Links in Posted cannot be clicked.
|
|
||||||
M [ ] Fix the counting of unread messages in Posted. Now it's wrong.
|
|
||||||
E [X] Make the GUI of Posted more sexy: more compact items, remove unecessary text, use consistent icons,...
|
|
||||||
|
|
||||||
|
|
||||||
Forums
|
|
||||||
E [X] it's not possible to create a Forum thread without a Owner.
|
|
||||||
Bug? If not, then remove "No signature" from selection box
|
|
||||||
[X] the tooltip over GXS ids should show the avatar on the left side.
|
|
||||||
[X] fix data race between GXS ID default icons
|
|
||||||
[X] Share of key shows "Not implemented". Since forums are public, share key should be hidden.
|
|
||||||
[X] switching between forums might cause a crash. Seems to be due to GxsIdDetails::instance not always initialised when used.
|
|
||||||
|
|
||||||
GUI General
|
|
||||||
E [ ] do we keep "Getting Started" ? the look needs to be improved. Any help doing this is welcome!
|
|
||||||
E [X] Recommendation messages do not show complete links. Links show up in some buttons and the text is truncated
|
|
||||||
E [X] Recommendation messages should not be signed by the retroshare team!!
|
|
||||||
E [X] when adding a friend through clicking on cert links, the add friend wizard is shown twice!
|
|
||||||
M [X] add a flag in friends option to allow auto-download of recommended files
|
|
||||||
M [ ] sound is not working for some users on linux. We also need a "test sound" button in config->sound.
|
|
||||||
E [ ] some widgets in the GUI do not follow the system style => GUI looks bad on these systems
|
|
||||||
[X] display version ID in windows version
|
|
||||||
E [X] recommended friends messages have embedded buttons of wrong size. Use RSLinks instead!
|
|
||||||
E [X] "Friends details" should show both PGP key and RS certs in different tabs with appropriate names.
|
|
||||||
It should specify clearly which one should be used to make friends.
|
|
||||||
E [X] addFriend does not work when the cert contains signatures.
|
|
||||||
E [X] PGP signatures are not transmited by discovery2.
|
|
||||||
[X] Default appearance style on Ubuntu should be GTK (to allow correct tooltips)
|
|
||||||
[X] Default layout should use toolbars. The "menu" look is inneficient
|
|
||||||
[X] replace sound tooltip "sound off" by "sound is on, click to turn off"
|
|
||||||
[X] rtt statistic is duplicated in statistics provided by VOIP, so remove it from file transfers
|
|
||||||
[ ] add tooltips in in permission matrix when hovering over the top most button/service name
|
|
||||||
explain what the service does and the dependencies
|
|
||||||
|
|
||||||
Messages
|
|
||||||
H [X] distant messages should be made async-ed
|
|
||||||
* [ ] increase sigma of activity events to allow a more generous routing matrix
|
|
||||||
* [ ] collect routing events from chat lobbies? (maybe not a good idea)
|
|
||||||
M [X] distant messages are not re-sent when the peer is offline the first time
|
|
||||||
M [X] sent messages to direct peers in the Sent box have inconsistent To field.
|
|
||||||
Raises an error if you click on it.
|
|
||||||
M [X] icons for GxsTreeWidgetItem are too small in distant messages list widget
|
|
||||||
E [X] "from" should be disabled until we actually use a GXS id in the destination list.
|
|
||||||
E [X] "show all" and "show everyone" in destination list are duplicate names for different things.
|
|
||||||
Either remove one of them, or use appropriate names.
|
|
||||||
|
|
||||||
Channels
|
|
||||||
[X] Unsubscribed channels should show an info page when selected, like forums
|
|
||||||
H [X] marking all as read in channels takes time. The channel icon should show a waiting clock
|
|
||||||
during the operation to avoid the user to re-click many times in the hope to get the posts marked as read.
|
|
||||||
[X] channels items show a 0 left to the up/Dn buttons. What is it??
|
|
||||||
[X] allow to post on channels when attachment is not in shared files. Just display a warning.
|
|
||||||
M [X] popularity calculation seems wrong. To reproduce: create a new channel and subscribe to it from
|
|
||||||
another location with many friends => popularity is too big at that location (should be 1)
|
|
||||||
the problem seems to be in RsGxsNetService::handleRecvSyncMessage
|
|
||||||
peers send RsNxsSyncMsg for unsubscribed groups (they are not suppliers then)
|
|
||||||
nor sure what role RsGxsNetService::loadList plays here
|
|
||||||
[X] show group owner in channel/forum/posted's details tab
|
|
||||||
|
|
||||||
Chat lobbies
|
|
||||||
H [X] Chat lobbies should use Identities. That's a significant change, probably not backward compatible.
|
|
||||||
[X] Remove deprecated code in rschatitems.
|
|
||||||
[X] remove "change nickname" from drop menu
|
|
||||||
[X] there's no way to remove auto-subscribe when connected to a lobby. Show auto-subscribe status in tooltip, add menu entries.
|
|
||||||
|
|
||||||
Profile creation wizard
|
|
||||||
[X] "Hidden node" should be an option at start. Apparently it becomes mandatory when one sets the advanced mode.
|
|
||||||
[X] the blue button "Generate new node" does not have a clear state. It should be grey while disabled, then
|
|
||||||
not grey. Or maybe use an icon?
|
|
||||||
|
|
||||||
Settings
|
|
||||||
[X] remove HiddenNode fom config->server netWork mode drop menu, or disable it in non hidden mode.
|
|
||||||
[X] Default max upload should be a large number. Not 50KB/s!!
|
|
||||||
|
|
||||||
Settings > Sounds -> enable default sounds for
|
|
||||||
[ ] Friend go online
|
|
||||||
[ ] New Chat Message
|
|
||||||
[ ] Message arrived
|
|
||||||
[ ] Download complete
|
|
||||||
|
|
||||||
Chat
|
|
||||||
[X] Distant chat window should show GXS avatars
|
|
||||||
H [ ] Distant chat should work with shared identities
|
|
||||||
[X] Distant chat fails (tunnel bullet never gets green) when re-openning a distant chat window after closing a tunnel
|
|
||||||
[X] Distant chat fails (chat window never appears) when re-openning a distant chat window after closing a tunnel
|
|
||||||
[X] You should not be enabled to distant-chat yourself!
|
|
||||||
[X] Nickname completion is broken. It only works with @
|
|
||||||
|
|
||||||
Identities:
|
|
||||||
[X] "Owned by you" => "Owned by node [nodename]"
|
|
||||||
[X] Bold face should only be used for keys with admin credentials
|
|
||||||
E [X] reputations are not used yet. We should hide them.
|
|
||||||
H [X] Add timeout to Identities that are unused. Need to keep a time stamp list, updated whenever the identity is used for checking signatures.
|
|
||||||
[X] Fix avatar loading for identities. When loaded for the first time by forums, the avatar does not show up.
|
|
||||||
M [ ] allow to share identities between locations.
|
|
||||||
|
|
||||||
Network
|
|
||||||
E [X] Friends => Friend nodes
|
|
||||||
E [X] remove TCP, TOR, UDP from the status column, and move it in front of IP
|
|
||||||
|
|
||||||
File transfer
|
|
||||||
H [X] There's a bug sometimes causing re-hash of shared files at start. Find it, kill it.
|
|
||||||
[ ] Bug: when sorting files in friends file list, RS goes into a crazy loop and crashes
|
|
||||||
|
|
||||||
News feed
|
|
||||||
[X] remove the Ghost news feed items
|
|
||||||
[X] remove the double feed publication
|
|
||||||
|
|
||||||
libretroshare
|
|
||||||
[ ] make sure at least one location is kept when removing old locations as it avoids lots of connection problems.
|
|
||||||
[ ] some users can be declared as connected although they are not. Check Heart-Beat system.
|
|
||||||
H [X] fix the data race in pqissl
|
|
||||||
H [ ] valgrind pass for data races
|
|
||||||
H [ ] valgrind pass for memory leaks
|
|
||||||
H [ ] valgrind pass for memory errors
|
|
||||||
H [ ] valgrind pass for performance
|
|
||||||
E [-] remove mktemp => use mkstemp
|
|
||||||
note: mkstemp is not available on Windows
|
|
||||||
H [ ] RsGxsDataAccess::processRequests locks mDataMutex until all requests are processed.
|
|
||||||
Adding a new request or poll for the request status are freezing until the mutex is available.
|
|
||||||
[ ] crash at shutdown
|
|
||||||
|
|
||||||
#0 0x0000000000da52eb in RsMemoryManagement:¿mallObject:¿mallObject() ()
|
|
||||||
#1 0x0000000000da3694 in RsItem::RsItem(unsigned int) ()
|
|
||||||
#2 0x0000000000dcb365 in RsRawItem::RsRawItem (this=0x0, t=33559555, size=38) at ./serialiser/rsserial.h:182
|
|
||||||
#3 0x0000000000fc1643 in RsServiceSerialiser::deserialise(void*, unsigned int*) ()
|
|
||||||
#4 0x0000000000da4451 in RsSerialiser::deserialise(void*, unsigned int*) ()
|
|
||||||
#5 0x0000000000fb5b4b in pqistreamer::handleincoming_locked() ()
|
|
||||||
#6 0x0000000000fb4b3e in pqistreamer::tick_recv(unsigned int) ()
|
|
||||||
#7 0x0000000000fb744a in pqithreadstreamer::data_tick() ()
|
|
||||||
#8 0x0000000000e19b27 in RsTickingThread::runloop (this=0x7fffb004e7e8) at util/rsthreads.cc:196
|
|
||||||
#9 0x0000000000e19748 in RsThread::rsthread_init (p=0x7fffb004e7e8) at util/rsthreads.cc:63
|
|
||||||
#10 0x00007ffff4006f6b in start_thread () from /lib64/libpthread.so.0
|
|
||||||
#11 0x00007ffff351c7ed in clone () from /lib64/libc.so.6
|
|
||||||
|
|
||||||
Packaging
|
|
||||||
[X] check compilation on debian
|
|
||||||
[X] check compilation on ARM
|
|
||||||
[ ] Sound files should be part of the install package at least on ubuntu (put them in /usr/share)
|
|
||||||
|
|
||||||
Post v0.6 release changes
|
|
||||||
=========================
|
|
||||||
|
|
||||||
File transfer
|
|
||||||
H [ ] implement a new file list management, with new info such as access time, total upload, popularity, etc
|
|
||||||
H [ ] implement a new file list sharing service based on auto-sync system
|
|
||||||
H [ ] get rid of the old cache system (remove CacheStrapper, CacheSource,etc)
|
|
||||||
|
|
||||||
GUI
|
|
||||||
H [ ] enable circles for channels/posted/forums
|
|
||||||
E [ ] enable people dialog
|
|
||||||
E [ ] fix RSButtonOnText::eventFilter, and fix all places where RSButtonOnText gets deleted
|
|
||||||
E [ ] find all places where the deprecated(in Qt5) Q_WS_WIN and other Q_WS* macros are used, and replace with something else
|
|
||||||
|
|
||||||
GXS
|
|
||||||
H [ ] add the ability to use anonymous identities into circles. Needs new distribution model using items encrypted for multiple GXS keys.
|
|
||||||
H [ ] use different and incompatible classes for public and private keys in GxsSecurity
|
|
||||||
|
|
||||||
Libretroshare
|
|
||||||
M [ ] improve serialisation system. Lots of serialisation tasks (header, verifications, serialiser=>template, can be factored)
|
|
||||||
M [ ] separate chat stuff from rsmsgs.h into rschat.h
|
|
||||||
|
|
||||||
Chat
|
|
||||||
H [ ] add "chat with this peer" from lobbies to start a private distant conversation with the GXS id of the peer
|
|
||||||
|
|
||||||
Msgs
|
|
||||||
H [ ] Merge the new messaging format
|
|
||||||
|
|
||||||
Channels
|
|
||||||
M [ ] allow to set a download directory per channel
|
|
||||||
|
|
||||||
|
|
||||||
|
89
WindowsMSys2_InstallGuide.txt
Normal file
89
WindowsMSys2_InstallGuide.txt
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#############################
|
||||||
|
###--- QT INSTALLATION ---###
|
||||||
|
#############################
|
||||||
|
|
||||||
|
###Install Qt via:
|
||||||
|
http://www.qt.io/download/
|
||||||
|
|
||||||
|
###Use default options.
|
||||||
|
###Add to the PATH environment variable.
|
||||||
|
;C:\Qt\5.5\mingw492_32\bin;C:\Qt\Tools\mingw492_32\bin;C:\Qt\Tools\mingw492_32\opt\bin
|
||||||
|
|
||||||
|
###Depends on wich version of Qt you use.
|
||||||
|
|
||||||
|
###Change build-all-mingw32make.bat with these values too if you don't use MSys2.
|
||||||
|
|
||||||
|
|
||||||
|
###############################
|
||||||
|
###---MSYS2 INSTALLATION ---###
|
||||||
|
###############################
|
||||||
|
|
||||||
|
###Choose your MSYS2 installer here:
|
||||||
|
http://msys2.github.io/
|
||||||
|
|
||||||
|
###Follow install procedure.
|
||||||
|
###Don't forget to sync & Update pacman.
|
||||||
|
pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
|
||||||
|
|
||||||
|
###Restart console
|
||||||
|
pacman -Su
|
||||||
|
|
||||||
|
###Install all default programms
|
||||||
|
pacman -S base-devel git mercurial cvs wget p7zip gcc perl ruby python2
|
||||||
|
|
||||||
|
###Choose only w64-i686 if you want only compilation in 32b architecture.
|
||||||
|
pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
|
||||||
|
|
||||||
|
###Install other binutils:
|
||||||
|
pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc
|
||||||
|
pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3
|
||||||
|
pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex
|
||||||
|
pacman -S mingw-w64-i686-opencv mingw-w64-x86_64-opencv
|
||||||
|
pacman -S mingw-w64-i686-ffmpeg mingw-w64-x86_64-ffmpeg
|
||||||
|
pacman -S mingw-w64-i686-libmicrohttpd mingw-w64-x86_64-libmicrohttpd
|
||||||
|
pacman -S mingw-w64-i686-libxslt mingw-w64-x86_64-libxslt
|
||||||
|
|
||||||
|
### Add MSYS2 to PATH environment variable depends your windows
|
||||||
|
;C:\msys64\mingw32\bin
|
||||||
|
;C:\msys32\mingw32\bin
|
||||||
|
|
||||||
|
|
||||||
|
##############################
|
||||||
|
###--- GIT INSTALLATION ---###
|
||||||
|
##############################
|
||||||
|
|
||||||
|
###Install Git Gui or other client:
|
||||||
|
https://git-scm.com/download/win
|
||||||
|
|
||||||
|
###Create a new directory named:
|
||||||
|
C:\Development\GIT
|
||||||
|
|
||||||
|
###Right-click on it and choose:
|
||||||
|
Git Bash Here
|
||||||
|
|
||||||
|
###Paste this text on git console:
|
||||||
|
git clone https://github.com/RetroShare/RetroShare.git
|
||||||
|
|
||||||
|
|
||||||
|
###########################
|
||||||
|
###--- LAST SETTINGS ---###
|
||||||
|
###########################
|
||||||
|
|
||||||
|
###In QtCreator Option Git add its path:
|
||||||
|
C:\Program Files\Git\bin
|
||||||
|
### and select "Pull" with "Rebase"
|
||||||
|
|
||||||
|
|
||||||
|
###Open an MSys2 32|64 shell
|
||||||
|
###Move to build_scripts:
|
||||||
|
cd /c/Development/GIT/RetroShare/msys2_build_libs/
|
||||||
|
|
||||||
|
###Compil missing library
|
||||||
|
make
|
||||||
|
|
||||||
|
###You can now compile RS into Qt Creator
|
||||||
|
|
||||||
|
###For using, and debugging Plugins, you can use SymLinker (http://amd989.github.io/Symlinker/) to link
|
||||||
|
### the files in \build-RetroShare-Desktop_Qt_X_Y_Z_MinGW_32bit-Debug\plugins\PluginName\debug\*.dll
|
||||||
|
### to %appdata%\RetroShare\extensions6
|
||||||
|
|
137
build-all-mingw32make.bat
Normal file → Executable file
137
build-all-mingw32make.bat
Normal file → Executable file
@ -1,14 +1,14 @@
|
|||||||
set QTDIR=C:\Qt\4.8.6
|
set QTDIR=C:\Qt\5.5\mingw492_32\
|
||||||
set MINGW=C:\MinGW
|
set MINGW=C:\Qt\Tools\mingw492_32
|
||||||
set GIT=C:\Program Files\Git
|
|
||||||
|
|
||||||
set PATH=%QTDIR%\bin;%MINGW%\bin;%GIT%\bin;%PATH%
|
|
||||||
|
|
||||||
|
set PATH=%QTDIR%\bin;%MINGW%\bin;%PATH%
|
||||||
|
set DEBUG=1
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
rem emptying used variables in case the script was aborted and tempfile
|
rem emptying used variables in case the script was aborted and tempfile
|
||||||
set pack=
|
set pack=
|
||||||
set clean=
|
set clean=
|
||||||
|
set errorlevel=
|
||||||
if exist tmp.txt del tmp.txt
|
if exist tmp.txt del tmp.txt
|
||||||
|
|
||||||
|
|
||||||
@ -19,12 +19,12 @@ if %1x == x (
|
|||||||
)
|
)
|
||||||
if /i %1==clean (
|
if /i %1==clean (
|
||||||
set clean=clean
|
set clean=clean
|
||||||
shift
|
shift
|
||||||
goto :loop1
|
goto :loop1
|
||||||
)
|
)
|
||||||
if /i %1==pack (
|
if /i %1==pack (
|
||||||
set pack=pack
|
set pack=pack
|
||||||
shift
|
shift
|
||||||
goto :loop1
|
goto :loop1
|
||||||
)
|
)
|
||||||
echo.%1>>tmp.txt
|
echo.%1>>tmp.txt
|
||||||
@ -44,77 +44,174 @@ if not exist tmp.txt (
|
|||||||
)
|
)
|
||||||
|
|
||||||
for /f %%a in (tmp.txt) do (
|
for /f %%a in (tmp.txt) do (
|
||||||
@echo on
|
if ECHO==1 @echo on
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rem TODO: Remove these lines
|
||||||
|
rem GOTO :retroshare-gui
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:libbitdht
|
||||||
|
rem ###################################
|
||||||
|
rem ### libbitdht #####################
|
||||||
|
rem ###################################
|
||||||
cd libbitdht\src
|
cd libbitdht\src
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake libbitdht.pro
|
qmake libbitdht.pro
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make %%a
|
mingw32-make %%a
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### libbitdht done ################
|
||||||
|
echo ###################################
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
|
:openpgpsdk
|
||||||
cd ..\..\openpgpsdk\src
|
rem ###################################
|
||||||
|
rem ### openpgpsdk ####################
|
||||||
|
rem ###################################
|
||||||
|
cd openpgpsdk\src
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake openpgpsdk.pro
|
qmake openpgpsdk.pro
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make
|
mingw32-make
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### openpgpsdk done ###############
|
||||||
|
echo ###################################
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
cd ..\..\libresapi\src
|
:libresapi
|
||||||
|
rem ###################################
|
||||||
|
rem ### libresapi #####################
|
||||||
|
rem ###################################
|
||||||
|
cd libresapi\src
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake libresapi.pro
|
qmake libresapi.pro
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make %%a
|
mingw32-make %%a
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### libresapi done ################
|
||||||
|
echo ###################################
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
cd ..\..\libretroshare\src
|
:libretroshare
|
||||||
|
rem ###################################
|
||||||
|
rem ### libretroshare #################
|
||||||
|
rem ###################################
|
||||||
|
cd libretroshare\src
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake libretroshare.pro "CONFIG+=version_detail_bash_script"
|
qmake libretroshare.pro "CONFIG+=version_detail_bash_script"
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make %%a
|
mingw32-make %%a
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### libretroshare done ############
|
||||||
|
echo ###################################
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
|
:pegmarkdown
|
||||||
cd ..\..\supportlibs\pegmarkdown
|
rem ###################################
|
||||||
|
rem ### pegmarkdown ###################
|
||||||
|
rem ###################################
|
||||||
|
cd supportlibs\pegmarkdown
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake pegmarkdown.pro
|
qmake pegmarkdown.pro
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make %%a
|
mingw32-make %%a
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### pegmarkdown done ##############
|
||||||
|
echo ###################################
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
|
:retroshare-nogui
|
||||||
cd ..\..\retroshare-nogui\src
|
rem ###################################
|
||||||
|
rem ### retroshare-nogui ##############
|
||||||
|
rem ###################################
|
||||||
|
cd retroshare-nogui\src
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake retroshare-nogui.pro
|
qmake retroshare-nogui.pro
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make %%a
|
mingw32-make %%a
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### retroshare-nogui done #########
|
||||||
|
echo ###################################
|
||||||
|
cd ..\..
|
||||||
|
|
||||||
|
:retroshare-gui
|
||||||
cd ..\..\retroshare-gui\src
|
rem ###################################
|
||||||
|
rem ### retroshare-gui ################
|
||||||
|
rem ###################################
|
||||||
|
cd retroshare-gui\src
|
||||||
|
|
||||||
if not %clean%x==x mingw32-make clean
|
if not %clean%x==x mingw32-make clean
|
||||||
|
|
||||||
qmake retroshare-gui.pro "CONFIG+=version_detail_bash_script"
|
rem qmake -r -spec ..\mkspecs\win32-g++ "CONFIG+=version_detail_bash_script" retroshare-gui.pro
|
||||||
|
qmake retroshare-gui.pro "CONFIG+=version_detail_bash_script"
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
|
||||||
mingw32-make %%a
|
mingw32-make %%a
|
||||||
|
CALL :TEST_ERROR
|
||||||
|
echo ###################################
|
||||||
|
echo ### retroshare-gui done ###########
|
||||||
|
echo ###################################
|
||||||
|
|
||||||
cd ..\..
|
cd ..\..
|
||||||
@echo off
|
@echo off
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
if %pack%x==packx call packaging.bat
|
if %pack%x==packx call packaging.bat
|
||||||
rem clean up
|
rem ###################################
|
||||||
|
rem ### clean up ######################
|
||||||
|
rem ###################################
|
||||||
set clean=
|
set clean=
|
||||||
del tmp.txt
|
del tmp.txt
|
||||||
set pack=
|
set pack=
|
||||||
pause
|
pause
|
||||||
|
|
||||||
|
rem ###################################
|
||||||
|
rem ### END ###########################
|
||||||
|
rem ###################################
|
||||||
|
GOTO :EOF
|
||||||
|
|
||||||
|
|
||||||
|
:TEST_ERROR
|
||||||
|
@echo off
|
||||||
|
if errorlevel 1 (
|
||||||
|
pause
|
||||||
|
set clean=
|
||||||
|
del tmp.txt
|
||||||
|
set pack=
|
||||||
|
EXIT
|
||||||
|
)
|
||||||
|
if ECHO==1 @echo on
|
||||||
|
EXIT /B
|
||||||
|
|
||||||
|
:EOF
|
@ -1,5 +1,325 @@
|
|||||||
retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
||||||
|
|
||||||
|
2a5fe4d csoler 30 Oct 2015 21:12:47 -0400 merge before push
|
||||||
|
1bc2892 csoler 30 Oct 2015 21:11:44 -0400 removed some debug info
|
||||||
|
6554362 defnax 30 Oct 2015 15:51:13 +0100 Fixed Layout
|
||||||
|
12acf6d csoler 29 Oct 2015 23:31:23 -0400 fixed update of reputations display and used proper global score in id list
|
||||||
|
512c15c csoler 29 Oct 2015 22:58:21 -0400 fixed edit/show checkbox state in GxsGroupDialog.
|
||||||
|
958956a defnax 29 Oct 2015 17:20:32 +0100 Fixing layout & display on Details View anti spam fields
|
||||||
|
e56ba45 csoler 28 Oct 2015 21:22:07 -0400 attempt to fix the crash at exit, due to some threads asking for memory while the memory management structure is already gone
|
||||||
|
22fd4e4 csoler 28 Oct 2015 18:11:27 -0400 fixed bug causing signed lobby to refuse login on double click
|
||||||
|
459cbc6 csoler 28 Oct 2015 18:07:43 -0400 fixed bug causing forum posts to require PGP-signed ID on PGP-favored forums
|
||||||
|
04ead35 csoler 28 Oct 2015 16:00:27 -0400 Merge pull request #163 from PhenomRetroShare/AddGxsIdInTextAnchor
|
||||||
|
5beb852 csoler 28 Oct 2015 10:01:26 -0400 Merge pull request #164 from csoler/v0.6-SignedForums2
|
||||||
|
6df42a0 Phenom 28 Oct 2015 07:18:20 +0100 Add GXS Id in anchor in Chat.
|
||||||
|
1471dbc csoler 27 Oct 2015 23:53:31 -0400 fixed tooltips for anti-spam forum features
|
||||||
|
a526a29 csoler 27 Oct 2015 23:40:18 -0400 added missing flag check for anti-spam feature display
|
||||||
|
b04ce5e csoler 27 Oct 2015 22:47:02 -0400 removed debug info
|
||||||
|
79c80c9 csoler 27 Oct 2015 22:41:29 -0400 fixed a few bugs in display of tracking info
|
||||||
|
eefc8d3 defnax 28 Oct 2015 01:59:19 +0100 Fixed Tooltip on Outbox #121 Store Max Results spinbox #130
|
||||||
|
2096cd6 csoler 27 Oct 2015 20:15:50 -0400 added backward compatibility and API extension for RsGxsGrpMetaData
|
||||||
|
2cc0f6d defnax 27 Oct 2015 18:52:01 +0100 Added Decline Button to Voip Toaster Added new stylesheet from Beluga for the voip buttons
|
||||||
|
d69f270 csoler 27 Oct 2015 00:02:16 -0400 restored constants and output to non debugging state
|
||||||
|
206b27a csoler 26 Oct 2015 23:55:34 -0400 minor bugfix in msg tracking
|
||||||
|
c7d0e4c csoler 26 Oct 2015 23:38:10 -0400 enabled ID tracking forums. Fixed thresholds for anti-spam forums. Changed computation of reputation scored
|
||||||
|
b009c11 csoler 25 Oct 2015 23:45:33 -0400 changed RsGenExchange strategy to use a threshold on reputation when validating posts
|
||||||
|
e60ac99 csoler 25 Oct 2015 22:54:56 -0400 added bias to reputation score for known and signed ids. Changed computation formula to an exp
|
||||||
|
f24bddf csoler 25 Oct 2015 20:42:41 -0400 merged with upstream head
|
||||||
|
fee449b csoler 25 Oct 2015 19:28:13 -0400 added proper UI for setting anti-spam flags in GroupCreationDialog
|
||||||
|
207e84d csoler 25 Oct 2015 18:27:15 -0400 added new flag for msg tracking
|
||||||
|
3de29c5 csoler 25 Oct 2015 18:07:17 -0400 added load/save of message tracking info
|
||||||
|
47dd70f csoler 25 Oct 2015 17:16:16 -0400 added non selective tracking for GXS messages
|
||||||
|
afa3f53 electron128 25 Oct 2015 14:50:28 +0100 fix #150 cannot create pgp signed gxs identity: give users infinite time to type in their password
|
||||||
|
b340d8a electron128 25 Oct 2015 11:47:23 +0100 Hide about button and add better description for unloaded plugins
|
||||||
|
b717d60 defnax 25 Oct 2015 00:54:22 +0200 Added default Email Client Button to Web Mail Page
|
||||||
|
7db3bb1 csoler 24 Oct 2015 12:55:49 -0400 disabled debug info in GenExchange
|
||||||
|
8ea9771 csoler 24 Oct 2015 12:48:17 -0400 added new flag to GxsIdChooser to force non anonymous ids. Disabled by default
|
||||||
|
b501d91 defnax 24 Oct 2015 17:05:12 +0200 Added Invite page for Web Mail Providers (Connect Friend Wizard) Added select page style for Quick Start Wizard.
|
||||||
|
e0db78f csoler 24 Oct 2015 10:41:31 -0400 reject messages signed by non PGP-signed IDs from non anonymous forums
|
||||||
|
febd348 csoler 24 Oct 2015 00:22:55 -0400 added GUI support for non anon forums. Changed serialisation of GxsGroupMetaData so that mSignFlags is serialised in place of mAuthenFlag, which is not used anyway
|
||||||
|
a6851b6 csoler 23 Oct 2015 22:53:00 -0400 renamed old flags into indices in rsgenexchange.cc. Fixed up duplicate constants between GxsGroupDialog and rsgxsflags.h
|
||||||
|
4b402a4 csoler 23 Oct 2015 14:52:55 -0400 Merge pull request #155 from G10h4ck/huns_socket
|
||||||
|
71073c1 Gioacchino Mazzurco 12 Jan 2015 15:25:01 +0100 Respect passed parameters in unix_socket
|
||||||
|
463ebe7 csoler 21 Oct 2015 18:47:22 -0400 Merge pull request #154 from sehraf/pr-lobby-time
|
||||||
|
164c726 sehraf 21 Oct 2015 22:40:49 +0200 suggestion from cyril
|
||||||
|
bcfb3be defnax 21 Oct 2015 22:39:48 +0200 Hide some Labels on Hidden Mode
|
||||||
|
c061189 sehraf 21 Oct 2015 22:18:43 +0200 mark chat participants as inactive as long as no activity was seen and reduce time to inactivity from 30 min to 10 min (patches #67)
|
||||||
|
aec42a8 defnax 21 Oct 2015 04:16:20 +0200 Improved Network Settings Layout, better look and order
|
||||||
|
6f3ba57 csoler 20 Oct 2015 22:00:15 -0400 fixed up default sizes for list icons and main page icons for high DPI screens
|
||||||
|
1d1904c csoler 20 Oct 2015 21:03:08 -0400 added missing memory clean calls in X509 certificate generation
|
||||||
|
6398ed2 csoler 20 Oct 2015 18:39:32 -0400 added checks for result of pthread_create (issue #126)
|
||||||
|
f49f7ac csoler 20 Oct 2015 18:32:10 -0400 added missing EVP_CIPHER_CTX_cleanup calls (issue #128)
|
||||||
|
261c7fa csoler 20 Oct 2015 18:24:49 -0400 added missing fclose (issue #134)
|
||||||
|
78e9123 csoler 20 Oct 2015 18:20:37 -0400 added missing delete (issue #135)
|
||||||
|
007a3c8 csoler 20 Oct 2015 18:18:10 -0400 merge/pull
|
||||||
|
b2dbf9d csoler 20 Oct 2015 18:16:18 -0400 adding missing BIO_free (issue #138)
|
||||||
|
24a685f csoler 20 Oct 2015 18:03:06 -0400 Merge pull request #148 from G10h4ck/unsanelan
|
||||||
|
5084add csoler 20 Oct 2015 17:56:06 -0400 Merge pull request #151 from diversys/master
|
||||||
|
34758be Sergei Reznikov 20 Oct 2015 19:41:40 +0300 Add Haiku support
|
||||||
|
16a5eed Gio 17 Oct 2015 10:27:49 +0200 Removed flawed logic samenet/samesubnet you cannot determine if two ip are in the same subnet just from ips the internet is not just a bunch of /24
|
||||||
|
febea80 defnax 17 Oct 2015 02:23:46 +0200 Fixed Reputation display, and set text Alignment.
|
||||||
|
8e6c7cd csoler 16 Oct 2015 12:49:10 -0400 changed SSL cert size to 4096 bits as suggested by cave
|
||||||
|
6667031 defnax 15 Oct 2015 02:14:52 +0200 Moved to display pending packets on a QTreeWidget. Fixed People layout/spacing & display votes column.
|
||||||
|
441b164 csoler 13 Oct 2015 21:54:52 -0400 fixed small bugs in average friend reputation display
|
||||||
|
410102a csoler 13 Oct 2015 21:34:53 -0400 fixed bug causing lobby messages signed by IDs linked to unknown PGP keys to be dropped
|
||||||
|
525310e csoler 13 Oct 2015 18:22:01 -0400 merging
|
||||||
|
4f744a6 csoler 13 Oct 2015 18:21:05 -0400 updated ubuntu changlog
|
||||||
|
a75cbcd electron128 13 Oct 2015 20:36:00 +0200 webui: format time of chat messages
|
||||||
|
537c492 electron128 13 Oct 2015 20:35:24 +0200 libresapi: fixed bug in JSON serialisation of uint32_t, decimal digits had inverse order
|
||||||
|
4df3283 electron128 13 Oct 2015 20:27:53 +0200 webui: restored Makefile
|
||||||
|
0b2fdee csoler 13 Oct 2015 14:23:31 -0400 Merge pull request #147 from PhenomRetroShare/Fix_ChatWidget_IsTypingLabel
|
||||||
|
245a282 Phenom 13 Oct 2015 20:11:30 +0200 Fix centered Typing Label on ChatWidget.
|
||||||
|
477c11e csoler 13 Oct 2015 13:51:23 -0400 Merge pull request #146 from PhenomRetroShare/FixVOIP_VividCompilation
|
||||||
|
3172cd9 Phenom 13 Oct 2015 19:17:25 +0200 Fix VOIP Compilation on Vivid as they use a different version of rational.h
|
||||||
|
791f5fe defnax 13 Oct 2015 02:18:41 +0200 Fixed ID Details Dialog with Reputation
|
||||||
|
58bd186 defnax 13 Oct 2015 00:38:46 +0200 Set a default stylesheet padding size for the Accept/Decline buttons
|
||||||
|
e924193 defnax 12 Oct 2015 23:42:56 +0200 Merge pull request #144 from PhenomRetroShare/FixVOIP_HeightOfToolBarForWindowsInFullScreen
|
||||||
|
5dbd84b defnax 12 Oct 2015 23:38:05 +0200 Merge pull request #145 from PhenomRetroShare/Fix_Win32CompilationForPR#143
|
||||||
|
47c47d1 Phenom 12 Oct 2015 23:21:17 +0200 Fix Compilation on Win32 after PR#143 merged.
|
||||||
|
7bc6fdf Phenom 12 Oct 2015 23:17:00 +0200 Fix the height of the ToolBar in VOIP FullScreen for Windows.
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Fri, 30 Oct 2015 20:00:00 +0100
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.0120234~trusty) trusty; urgency=low
|
||||||
|
|
||||||
|
0120234 csoler 12 Oct 2015 15:06:12 -0400 Merge pull request #143 from csoler/v0.6-Reputations
|
||||||
|
71c8dfd csoler 12 Oct 2015 14:45:11 -0400 manual merge before creating a conflict-free PR
|
||||||
|
f18cc82 csoler 12 Oct 2015 14:22:51 -0400 fixed up constants for reputation system, now that is has been tested
|
||||||
|
e6bb307 csoler 12 Oct 2015 14:04:23 -0400 added update for forum messages list when an author gets banned
|
||||||
|
7dc5984 csoler 12 Oct 2015 14:03:53 -0400 added update for forum messages list when an author gets banned
|
||||||
|
022ac10 defnax 12 Oct 2015 18:58:12 +0200 Merge pull request #141 from PhenomRetroShare/AddVOIP_ReactivateSoundEvents
|
||||||
|
3d32fab Phenom 12 Oct 2015 18:25:03 +0200 Reactivate SoundEvents in VOIP.
|
||||||
|
86b47d8 csoler 12 Oct 2015 10:58:24 -0400 reduced icon size a little bit in GxsTreeWidgetItem
|
||||||
|
5a3756f csoler 12 Oct 2015 10:41:48 -0400 fixed bug on reputation cutoff. Updated tooltips
|
||||||
|
36101a9 csoler 12 Oct 2015 00:28:21 -0400 fixed small bug preventing msg exchange
|
||||||
|
82c16c6 csoler 11 Oct 2015 22:08:19 -0400 fixed GUI tooltips over banned items. Added dropping of messages from banned ide
|
||||||
|
1a76bea csoler 11 Oct 2015 21:41:35 -0400 enabled bannign button in forums, and disable message passing for banned users
|
||||||
|
ad4dabf csoler 11 Oct 2015 13:31:54 -0400 Merge pull request #140 from PhenomRetroShare/AddVOIP_Accept,RingAndHangUp
|
||||||
|
ebe48f4 csoler 11 Oct 2015 11:12:11 -0400 added proper memory release after mallocs in distant chat (SVN bug 383)
|
||||||
|
e309dd6 csoler 11 Oct 2015 10:00:11 -0400 fixed banning users from forum threads
|
||||||
|
6a3f4ce Phenom 11 Oct 2015 10:31:06 +0200 Update Toaster when ringing.
|
||||||
|
f750818 csoler 10 Oct 2015 21:25:06 -0400 added proper icons and names for banned users
|
||||||
|
68ca57c csoler 10 Oct 2015 18:27:15 -0400 added removal of messages frm banned users
|
||||||
|
3deee00 Phenom 10 Oct 2015 18:47:07 +0200 Hang Up when close chat window.
|
||||||
|
1989f36 Phenom 10 Oct 2015 15:21:59 +0200 Add Accept, Ring and HangUp event for Video and Audio. Now you don't send data b
|
||||||
|
1a229ef defnax 10 Oct 2015 14:16:12 +0200 Fixed to display GXS ID item with a better icon size
|
||||||
|
59d2ca9 csoler 9 Oct 2015 18:55:07 -0400 fixed bug causing uninitialised friend average reputation to be shown
|
||||||
|
338fcee csoler 9 Oct 2015 18:51:16 -0400 added button in forums to flag poster identity as bad
|
||||||
|
ce96e88 csoler 9 Oct 2015 17:51:10 -0400 debugging of reputation system
|
||||||
|
ffb8f73 defnax 9 Oct 2015 12:07:23 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
e97f23d defnax 9 Oct 2015 12:06:16 +0200 Improved icon size display on GroupTree.
|
||||||
|
bb7a8f2 csoler 8 Oct 2015 23:54:18 -0400 fixed some reputation sending bugs
|
||||||
|
8c6c934 csoler 8 Oct 2015 23:02:34 -0400 fixed a few bugs in reputation items serialisation code and GUI display
|
||||||
|
1cf9c34 csoler 8 Oct 2015 19:48:22 -0400 fixed compilation for MacOS
|
||||||
|
4a4625e csoler 8 Oct 2015 18:54:12 -0400 fixed compilation for windows (to be tested)
|
||||||
|
3d21d99 csoler 8 Oct 2015 18:39:50 -0400 added debug info for reputation system
|
||||||
|
80ed6d1 csoler 7 Oct 2015 23:44:24 -0400 added pruning of opinions to limit data in memory. Fixed up types and sending/rec
|
||||||
|
e776eff csoler 7 Oct 2015 21:24:31 -0400 added new method rsGetHostByName to use gethostbyname_r for re-entrant calls. Upd
|
||||||
|
f1f722a csoler 7 Oct 2015 19:08:35 -0400 added missing shutdown of non responsive socket that could leak FDs (suggested by
|
||||||
|
39672b2 csoler 7 Oct 2015 18:59:58 -0400 fixed typo causing non free of mutex_buf structure in pqissl.cc
|
||||||
|
3cbf0f6 defnax 7 Oct 2015 20:13:18 +0200 Fixed Cert Display on Email Invite Page
|
||||||
|
78e6f67 csoler 6 Oct 2015 23:56:39 -0400 added some documentation in p3gxsreputation.cc, and the method for computing fina
|
||||||
|
b094089 csoler 6 Oct 2015 22:39:14 -0400 fixed compilation
|
||||||
|
95bdd7f defnax 7 Oct 2015 01:35:31 +0200 Fixed ChatWidget Margin's Set Alignment for frame off's Video icon
|
||||||
|
993ca63 defnax 6 Oct 2015 19:58:42 +0200 Fixed icons display
|
||||||
|
3f116e2 defnax 6 Oct 2015 18:54:43 +0200 display voip icons in a bigger size
|
||||||
|
fedb8f7 csoler 6 Oct 2015 09:47:54 -0400 Merge pull request #129 from PhenomRetroShare/FixVOIP_AllowVOIPToSaveSetting
|
||||||
|
ff46d90 csoler 6 Oct 2015 08:58:30 -0400 Merge pull request #120 from PhenomRetroShare/AddVOIP_HideChatTextButton
|
||||||
|
9f6bc0c csoler 6 Oct 2015 00:11:18 -0400 added code for all reputation items
|
||||||
|
05d95d3 Phenom 5 Oct 2015 21:04:20 +0200 Use QFontMetricsF to define Icon size.
|
||||||
|
2b1d39c Phenom 4 Oct 2015 14:12:20 +0200 Add HideChat Button. Change layout of video when text is hidden. Add toolbar in f
|
||||||
|
5d8972e Phenom 3 Oct 2015 02:11:52 +0200 Add real FullScreen Mode
|
||||||
|
0120234 csoler 12 Oct 2015 15:06:12 -0400 Merge pull request #143 from csoler/v0.6-Reputations
|
||||||
|
71c8dfd csoler 12 Oct 2015 14:45:11 -0400 manual merge before creating a conflict-free PR
|
||||||
|
f18cc82 csoler 12 Oct 2015 14:22:51 -0400 fixed up constants for reputation system, now that is has been tested
|
||||||
|
e6bb307 csoler 12 Oct 2015 14:04:23 -0400 added update for forum messages list when an author gets banned
|
||||||
|
7dc5984 csoler 12 Oct 2015 14:03:53 -0400 added update for forum messages list when an author gets banned
|
||||||
|
022ac10 defnax 12 Oct 2015 18:58:12 +0200 Merge pull request #141 from PhenomRetroShare/AddVOIP_ReactivateSoundEvents
|
||||||
|
3d32fab Phenom 12 Oct 2015 18:25:03 +0200 Reactivate SoundEvents in VOIP.
|
||||||
|
86b47d8 csoler 12 Oct 2015 10:58:24 -0400 reduced icon size a little bit in GxsTreeWidgetItem
|
||||||
|
5a3756f csoler 12 Oct 2015 10:41:48 -0400 fixed bug on reputation cutoff. Updated tooltips
|
||||||
|
36101a9 csoler 12 Oct 2015 00:28:21 -0400 fixed small bug preventing msg exchange
|
||||||
|
82c16c6 csoler 11 Oct 2015 22:08:19 -0400 fixed GUI tooltips over banned items. Added dropping of messages from banned ide
|
||||||
|
1a76bea csoler 11 Oct 2015 21:41:35 -0400 enabled bannign button in forums, and disable message passing for banned users
|
||||||
|
ad4dabf csoler 11 Oct 2015 13:31:54 -0400 Merge pull request #140 from PhenomRetroShare/AddVOIP_Accept,RingAndHangUp
|
||||||
|
ebe48f4 csoler 11 Oct 2015 11:12:11 -0400 added proper memory release after mallocs in distant chat (SVN bug 383)
|
||||||
|
e309dd6 csoler 11 Oct 2015 10:00:11 -0400 fixed banning users from forum threads
|
||||||
|
6a3f4ce Phenom 11 Oct 2015 10:31:06 +0200 Update Toaster when ringing.
|
||||||
|
f750818 csoler 10 Oct 2015 21:25:06 -0400 added proper icons and names for banned users
|
||||||
|
68ca57c csoler 10 Oct 2015 18:27:15 -0400 added removal of messages frm banned users
|
||||||
|
3deee00 Phenom 10 Oct 2015 18:47:07 +0200 Hang Up when close chat window.
|
||||||
|
1989f36 Phenom 10 Oct 2015 15:21:59 +0200 Add Accept, Ring and HangUp event for Video and Audio. Now you don't send data b
|
||||||
|
1a229ef defnax 10 Oct 2015 14:16:12 +0200 Fixed to display GXS ID item with a better icon size
|
||||||
|
59d2ca9 csoler 9 Oct 2015 18:55:07 -0400 fixed bug causing uninitialised friend average reputation to be shown
|
||||||
|
338fcee csoler 9 Oct 2015 18:51:16 -0400 added button in forums to flag poster identity as bad
|
||||||
|
ce96e88 csoler 9 Oct 2015 17:51:10 -0400 debugging of reputation system
|
||||||
|
ffb8f73 defnax 9 Oct 2015 12:07:23 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
e97f23d defnax 9 Oct 2015 12:06:16 +0200 Improved icon size display on GroupTree.
|
||||||
|
bb7a8f2 csoler 8 Oct 2015 23:54:18 -0400 fixed some reputation sending bugs
|
||||||
|
8c6c934 csoler 8 Oct 2015 23:02:34 -0400 fixed a few bugs in reputation items serialisation code and GUI display
|
||||||
|
1cf9c34 csoler 8 Oct 2015 19:48:22 -0400 fixed compilation for MacOS
|
||||||
|
4a4625e csoler 8 Oct 2015 18:54:12 -0400 fixed compilation for windows (to be tested)
|
||||||
|
3d21d99 csoler 8 Oct 2015 18:39:50 -0400 added debug info for reputation system
|
||||||
|
80ed6d1 csoler 7 Oct 2015 23:44:24 -0400 added pruning of opinions to limit data in memory. Fixed up types and sending/rec
|
||||||
|
e776eff csoler 7 Oct 2015 21:24:31 -0400 added new method rsGetHostByName to use gethostbyname_r for re-entrant calls. Upd
|
||||||
|
f1f722a csoler 7 Oct 2015 19:08:35 -0400 added missing shutdown of non responsive socket that could leak FDs (suggested by
|
||||||
|
39672b2 csoler 7 Oct 2015 18:59:58 -0400 fixed typo causing non free of mutex_buf structure in pqissl.cc
|
||||||
|
3cbf0f6 defnax 7 Oct 2015 20:13:18 +0200 Fixed Cert Display on Email Invite Page
|
||||||
|
78e6f67 csoler 6 Oct 2015 23:56:39 -0400 added some documentation in p3gxsreputation.cc, and the method for computing fina
|
||||||
|
b094089 csoler 6 Oct 2015 22:39:14 -0400 fixed compilation
|
||||||
|
95bdd7f defnax 7 Oct 2015 01:35:31 +0200 Fixed ChatWidget Margin's Set Alignment for frame off's Video icon
|
||||||
|
993ca63 defnax 6 Oct 2015 19:58:42 +0200 Fixed icons display
|
||||||
|
3f116e2 defnax 6 Oct 2015 18:54:43 +0200 display voip icons in a bigger size
|
||||||
|
fedb8f7 csoler 6 Oct 2015 09:47:54 -0400 Merge pull request #129 from PhenomRetroShare/FixVOIP_AllowVOIPToSaveSetting
|
||||||
|
ff46d90 csoler 6 Oct 2015 08:58:30 -0400 Merge pull request #120 from PhenomRetroShare/AddVOIP_HideChatTextButton
|
||||||
|
9f6bc0c csoler 6 Oct 2015 00:11:18 -0400 added code for all reputation items
|
||||||
|
05d95d3 Phenom 5 Oct 2015 21:04:20 +0200 Use QFontMetricsF to define Icon size.
|
||||||
|
2b1d39c Phenom 4 Oct 2015 14:12:20 +0200 Add HideChat Button. Change layout of video when text is hidden. Add toolbar in f
|
||||||
|
5d8972e Phenom 3 Oct 2015 02:11:52 +0200 Add real FullScreen Mode
|
||||||
|
8a7e359 Phenom 1 Oct 2015 23:41:34 +0200 Add a button on VOIP to hide text when video is on.
|
||||||
|
3c8f232 Phenom 5 Oct 2015 19:15:53 +0200 Allow VOIP to save its settings.
|
||||||
|
d4c838b csoler 5 Oct 2015 08:51:33 -0400 Merge pull request #127 from sehraf/pr-disable-sorting
|
||||||
|
6a570af sehraf 5 Oct 2015 09:26:36 +0200 disable sorting while editing network view
|
||||||
|
7a7f4c9 csoler 4 Oct 2015 23:18:31 -0400 added missing file
|
||||||
|
317e7ea csoler 4 Oct 2015 23:14:49 -0400 added some backend for reputation system
|
||||||
|
c17dddb csoler 4 Oct 2015 17:47:30 -0400 updated GUI for reputation
|
||||||
|
b5bfddd csoler 3 Oct 2015 22:08:24 -0400 commit from PR#86 for VOIP, modified so as to restore real-time preview and video
|
||||||
|
9158ed6 csoler 3 Oct 2015 10:46:36 -0400 fixed potential buffer overrun (reported by GuessWho)
|
||||||
|
7fa687a csoler 3 Oct 2015 10:29:08 -0400 Merge pull request #119 from PhenomRetroShare/AddWebUI_BroadcastInLobbiesLis
|
||||||
|
b22069c csoler 3 Oct 2015 10:28:17 -0400 Merge pull request #123 from PhenomRetroShare/Fix_ChatWidgetDeleteKeyEvent
|
||||||
|
64389e3 Phenom 3 Oct 2015 11:00:16 +0200 Fiw Delete key event in ChatWidget.
|
||||||
|
904ea94 Phenom 2 Oct 2015 19:10:54 +0200 Remove (void)
|
||||||
|
986853d Phenom 1 Oct 2015 18:49:39 +0200 Add Broadcast in list of lobbies. Before you can only write text on it if unread
|
||||||
|
b055500 csoler 2 Oct 2015 11:03:52 -0400 Merge pull request #117 from G10h4ck/master
|
||||||
|
bd94fcd csoler 2 Oct 2015 10:53:00 -0400 Merge pull request #98 from PhenomRetroShare/AddMinimumFontSizeInChat
|
||||||
|
f6abe2f csoler 2 Oct 2015 10:50:14 -0400 Merge pull request #115 from PhenomRetroShare/AddWebUI_LobbyOrderByType
|
||||||
|
e83ae76 Gio 27 Sep 2015 20:15:41 +0200 pqiconnect remove ni NULL pointer check as it would crash anyway for null pointer d
|
||||||
|
28b9a44 Gio 27 Sep 2015 15:29:32 +0200 Write in a sane way pqissl::connect_parameter
|
||||||
|
b16ecc8 Gio 27 Sep 2015 15:11:55 +0200 Remove some garbage from pqissl
|
||||||
|
d6ba9a2 Phenom 25 Sep 2015 17:00:50 +0200 Order in WebUI Lobbies by first: auto_subscribe, is_private and then subscribed
|
||||||
|
3025f4d csoler 24 Sep 2015 18:18:11 -0400 removed aliasign problem that breaks compilation on gentoo
|
||||||
|
22d4893 csoler 24 Sep 2015 18:03:19 -0400 removed a few compilation warning that might cause compilation errors on some sy
|
||||||
|
0614a24 csoler 23 Sep 2015 22:11:50 -0400 Merge pull request #111 from csoler/v0.6-ImprovedExtIPDetermination
|
||||||
|
24b3325 csoler 23 Sep 2015 21:45:15 -0400 Improved reliability of the determination of external address: removed DHT stunn
|
||||||
|
323d894 csoler 22 Sep 2015 23:21:14 -0400 Merge pull request #110 from jenster/newbranchformychanges
|
||||||
|
68fd1b2 jenster 22 Sep 2015 18:33:16 -0700 First Mac/OSX compile fixes
|
||||||
|
6071be9 csoler 22 Sep 2015 11:20:28 -0400 Merge pull request #109 from AsamK/workaround_broken_sqlcipher
|
||||||
|
c80ad59 AsamK 22 Sep 2015 16:31:21 +0200 Add workaround for broken sqlcipher packages
|
||||||
|
7293cd3 csoler 21 Sep 2015 22:58:58 -0400 updated ubuntu changelog
|
||||||
|
1d54630 thunder2 17 Sep 2015 10:05:31 +0200 Fixed Windows compile.
|
||||||
|
66691d4 csoler 16 Sep 2015 20:01:39 -0400 Merge pull request #108 from sehraf/i2p
|
||||||
|
04abfad sehraf 16 Sep 2015 17:01:20 +0200 manually reverted changes by Qt Creator
|
||||||
|
7c7e4f8 sehraf 16 Sep 2015 12:13:54 +0200 added ip addr. field to the add certificate dialog
|
||||||
|
6202e83 sehraf 16 Sep 2015 11:48:32 +0200 add default case to gui instead of falling back to tor labeling
|
||||||
|
d3d184f sehraf 16 Sep 2015 11:09:04 +0200 added simple step-by-step guide to add a I2P server tunnel
|
||||||
|
e54358a sehraf 16 Sep 2015 10:55:33 +0200 added simple step-by-step guide to add a I2P client tunnel
|
||||||
|
1dd3375 sehraf 15 Sep 2015 17:14:55 +0200 hide debug output
|
||||||
|
d24b281 sehraf 15 Sep 2015 17:10:48 +0200 optimizations * reduced calls to mPeermgr * use switch convenience * small fixes
|
||||||
|
bfcf43f sehraf 15 Sep 2015 16:18:46 +0200 fixed connection type detection and other small things
|
||||||
|
8725aab sehraf 14 Sep 2015 15:14:39 +0200 gui fixes
|
||||||
|
6b87c38 sehraf 14 Sep 2015 14:56:14 +0200 small fixes
|
||||||
|
6ec1919 sehraf 14 Sep 2015 12:39:46 +0200 gui changes
|
||||||
|
b0251e3 sehraf 14 Sep 2015 12:12:28 +0200 generalized tooltips
|
||||||
|
4b19e73 sehraf 14 Sep 2015 09:56:43 +0200 added comments to functions
|
||||||
|
8a7e359 Phenom 1 Oct 2015 23:41:34 +0200 Add a button on VOIP to hide text when video is on.
|
||||||
|
3c8f232 Phenom 5 Oct 2015 19:15:53 +0200 Allow VOIP to save its settings.
|
||||||
|
d4c838b csoler 5 Oct 2015 08:51:33 -0400 Merge pull request #127 from sehraf/pr-disable-sorting
|
||||||
|
6a570af sehraf 5 Oct 2015 09:26:36 +0200 disable sorting while editing network view
|
||||||
|
7a7f4c9 csoler 4 Oct 2015 23:18:31 -0400 added missing file
|
||||||
|
317e7ea csoler 4 Oct 2015 23:14:49 -0400 added some backend for reputation system
|
||||||
|
c17dddb csoler 4 Oct 2015 17:47:30 -0400 updated GUI for reputation
|
||||||
|
b5bfddd csoler 3 Oct 2015 22:08:24 -0400 commit from PR#86 for VOIP, modified so as to restore real-time preview and video
|
||||||
|
9158ed6 csoler 3 Oct 2015 10:46:36 -0400 fixed potential buffer overrun (reported by GuessWho)
|
||||||
|
7fa687a csoler 3 Oct 2015 10:29:08 -0400 Merge pull request #119 from PhenomRetroShare/AddWebUI_BroadcastInLobbiesLis
|
||||||
|
b22069c csoler 3 Oct 2015 10:28:17 -0400 Merge pull request #123 from PhenomRetroShare/Fix_ChatWidgetDeleteKeyEvent
|
||||||
|
64389e3 Phenom 3 Oct 2015 11:00:16 +0200 Fiw Delete key event in ChatWidget.
|
||||||
|
904ea94 Phenom 2 Oct 2015 19:10:54 +0200 Remove (void)
|
||||||
|
986853d Phenom 1 Oct 2015 18:49:39 +0200 Add Broadcast in list of lobbies. Before you can only write text on it if unread
|
||||||
|
b055500 csoler 2 Oct 2015 11:03:52 -0400 Merge pull request #117 from G10h4ck/master
|
||||||
|
bd94fcd csoler 2 Oct 2015 10:53:00 -0400 Merge pull request #98 from PhenomRetroShare/AddMinimumFontSizeInChat
|
||||||
|
f6abe2f csoler 2 Oct 2015 10:50:14 -0400 Merge pull request #115 from PhenomRetroShare/AddWebUI_LobbyOrderByType
|
||||||
|
e83ae76 Gio 27 Sep 2015 20:15:41 +0200 pqiconnect remove ni NULL pointer check as it would crash anyway for null pointer d
|
||||||
|
28b9a44 Gio 27 Sep 2015 15:29:32 +0200 Write in a sane way pqissl::connect_parameter
|
||||||
|
b16ecc8 Gio 27 Sep 2015 15:11:55 +0200 Remove some garbage from pqissl
|
||||||
|
d6ba9a2 Phenom 25 Sep 2015 17:00:50 +0200 Order in WebUI Lobbies by first: auto_subscribe, is_private and then subscribed
|
||||||
|
3025f4d csoler 24 Sep 2015 18:18:11 -0400 removed aliasign problem that breaks compilation on gentoo
|
||||||
|
22d4893 csoler 24 Sep 2015 18:03:19 -0400 removed a few compilation warning that might cause compilation errors on some sy
|
||||||
|
0614a24 csoler 23 Sep 2015 22:11:50 -0400 Merge pull request #111 from csoler/v0.6-ImprovedExtIPDetermination
|
||||||
|
24b3325 csoler 23 Sep 2015 21:45:15 -0400 Improved reliability of the determination of external address: removed DHT stunn
|
||||||
|
323d894 csoler 22 Sep 2015 23:21:14 -0400 Merge pull request #110 from jenster/newbranchformychanges
|
||||||
|
68fd1b2 jenster 22 Sep 2015 18:33:16 -0700 First Mac/OSX compile fixes
|
||||||
|
6071be9 csoler 22 Sep 2015 11:20:28 -0400 Merge pull request #109 from AsamK/workaround_broken_sqlcipher
|
||||||
|
c80ad59 AsamK 22 Sep 2015 16:31:21 +0200 Add workaround for broken sqlcipher packages
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Mon, 12 Oct 2015 20:00:00 +0100
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.7293cd3~trusty) trusty; urgency=low
|
||||||
|
|
||||||
|
7293cd3 csoler Mon, 21 Sep 2015 22:58:58 -0400 updated ubuntu changelog
|
||||||
|
1d54630 thunder2 17 Sep 2015 10:05:31 +0200 Fixed Windows compile.
|
||||||
|
66691d4 csoler 16 Sep 2015 20:01:39 -0400 Merge pull request #108 from sehraf/i2p
|
||||||
|
04abfad sehraf 16 Sep 2015 17:01:20 +0200 manually reverted changes by Qt Creator
|
||||||
|
7c7e4f8 sehraf 16 Sep 2015 12:13:54 +0200 added ip addr. field to the add certificate dialog
|
||||||
|
6202e83 sehraf 16 Sep 2015 11:48:32 +0200 add default case to gui instead of falling back to tor labeling
|
||||||
|
d3d184f sehraf 16 Sep 2015 11:09:04 +0200 added simple step-by-step guide to add a I2P server tunnel
|
||||||
|
e54358a sehraf 16 Sep 2015 10:55:33 +0200 added simple step-by-step guide to add a I2P client tunnel
|
||||||
|
1dd3375 sehraf 15 Sep 2015 17:14:55 +0200 hide debug output
|
||||||
|
d24b281 sehraf 15 Sep 2015 17:10:48 +0200 optimizations * reduced calls to mPeermgr * use switch convenience * small fixes
|
||||||
|
bfcf43f sehraf 15 Sep 2015 16:18:46 +0200 fixed connection type detection and other small things
|
||||||
|
8725aab sehraf 14 Sep 2015 15:14:39 +0200 gui fixes
|
||||||
|
6b87c38 sehraf 14 Sep 2015 14:56:14 +0200 small fixes
|
||||||
|
6ec1919 sehraf 14 Sep 2015 12:39:46 +0200 gui changes
|
||||||
|
b0251e3 sehraf 14 Sep 2015 12:12:28 +0200 generalized tooltips
|
||||||
|
4b19e73 sehraf 14 Sep 2015 09:56:43 +0200 added comments to functions
|
||||||
|
900e51b csoler 13 Sep 2015 18:08:06 -0400 Merge pull request #107 from PhenomRetroShare/AddFriendListItemMouseEvents
|
||||||
|
48e6618 Phenom 13 Sep 2015 19:00:31 +0200 Send Mouse event to FriendList's item, since ElidedLabel was fixed.
|
||||||
|
7195d4c csoler 10 Sep 2015 09:41:28 -0400 Merge pull request #105 from ericthefish/master
|
||||||
|
4880fc4 Ivan Lucas 10 Sep 2015 11:21:01 +0100 Fixed grammar on add friend wizard by rewording slightly
|
||||||
|
840e930 Ivan Lucas 10 Sep 2015 10:29:15 +0100 Fix Spelling and Grammar
|
||||||
|
770e934 Ivan Lucas 10 Sep 2015 10:18:14 +0100 Merge remote-tracking branch 'upstream/master'
|
||||||
|
4a0539c csoler 9 Sep 2015 19:57:07 -0400 Merge pull request #103 from AsamK/html_parsing
|
||||||
|
1acd4a3 csoler 9 Sep 2015 16:44:59 -0400 Merge pull request #104 from PhenomRetroShare/Fix_ElidedLabel_mousePresEvent
|
||||||
|
ce9fc7b Phenom 9 Sep 2015 22:37:38 +0200 Fix ElidedLabel::mousePressEvent.
|
||||||
|
75a7a89 Ivan Lucas 9 Sep 2015 15:19:17 +0100 Fix typo
|
||||||
|
7aad9c1 AsamK 9 Sep 2015 13:36:00 +0200 Improve HTML parsing in libresapi
|
||||||
|
b8c3c89 AsamK 9 Sep 2015 11:53:01 +0200 Extract getPlainText method
|
||||||
|
ebd5da5 thunder2 8 Sep 2015 16:34:22 +0200 Optimizations in RsGenExchange, p3GxsForums and p3GxsChannels. - Removed not used variables
|
||||||
|
avoid copy constructors - Use swap instead of operator= to move elements of std containers
|
||||||
|
490b88c csoler 8 Sep 2015 14:17:29 -0400 Merge pull request #100 from ericthefish/master
|
||||||
|
a2e7e4d Ivan Lucas 8 Sep 2015 16:12:50 +0100 Fixed spelling/grammar
|
||||||
|
4f8b098 Ivan Lucas 8 Sep 2015 16:00:00 +0100 Fixing spelling
|
||||||
|
c4061fc thunder2 7 Sep 2015 22:27:04 +0200 Removed not used time consuming calculation of row count from RetroCursor.
|
||||||
|
29a1fa2 thunder2 7 Sep 2015 21:48:18 +0200 Removed unnecessary copy of results in RsGxsDataAccess.
|
||||||
|
0bc77d7 sehraf 8 Sep 2015 13:48:30 +0200 added some error handling
|
||||||
|
da417ee csoler 7 Sep 2015 20:38:47 -0400 Merge pull request #96 from AsamK/qmake_3
|
||||||
|
63e38af csoler 7 Sep 2015 20:36:03 -0400 Merge pull request #94 from AsamK/correct_libav_version
|
||||||
|
03d99ae sehraf 7 Sep 2015 23:55:57 +0200 made GenCertDislog more generic
|
||||||
|
4fc6c73 sehraf 7 Sep 2015 23:40:52 +0200 replaced some ifs with switch
|
||||||
|
e2768e0 defnax 7 Sep 2015 23:34:39 +0200 Added last used field to Person Details Window
|
||||||
|
fed4345 sehraf 7 Sep 2015 22:57:54 +0200 made server settings more generic and added i2p support
|
||||||
|
95d6b06 sehraf 7 Sep 2015 18:46:19 +0200 first working version
|
||||||
|
0107f4e sehraf 7 Sep 2015 12:59:21 +0200 first run on gui integration
|
||||||
|
ba74c04 sehraf 7 Sep 2015 11:51:24 +0200 removed duplicated code, fixed compile, few additions
|
||||||
|
c17d0e1 sehraf 7 Sep 2015 11:22:15 +0200 add i2p support to libretroshare
|
||||||
|
2c1743f defnax 7 Sep 2015 15:13:32 +0200 Added send message function for Participants list.
|
||||||
|
cc4be39 defnax 7 Sep 2015 15:08:56 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
0793a6a AsamK 6 Sep 2015 14:19:21 +0200 Use PLUGIN_DIR to define plugin directory only once
|
||||||
|
fe1ec9d AsamK 5 Sep 2015 22:49:57 +0200 Fixed mac compile. Moved sqlcipher.a to libretroshare.pro
|
||||||
|
571336e AsamK 5 Sep 2015 23:49:15 +0200 Move duplicate common stuff out of platform parts
|
||||||
|
66b9557 AsamK 5 Sep 2015 23:48:24 +0200 Use PKGCONFIG instead of manually specifying LIBS for Linux
|
||||||
|
b8e3a43 thunder2 6 Sep 2015 21:28:34 +0200 Auto download of recommended files adds the sender as source of the download.
|
||||||
|
5f36500 thunder2 6 Sep 2015 14:21:05 +0200 Fixed click in column "Friend nodes" in FriendList.
|
||||||
|
869077b thunder2 5 Sep 2015 12:46:18 +0200 Combined selects in RsDataService::retrieveNxsGrps/RsDataService::retrieveNxsMsgs.
|
||||||
|
d6f50c7 AsamK 5 Sep 2015 15:44:10 +0200 Fix libav version check
|
||||||
|
e9a5523 defnax 5 Sep 2015 00:16:07 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
7f8dae9 defnax 4 Sep 2015 16:33:43 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
07c5030 defnax 3 Sep 2015 17:41:30 +0200 Merge branch 'master' of https://github.com/RetroShare/RetroShare
|
||||||
|
3d6e978 defnax 2 Sep 2015 13:06:15 +0200 Fixed Status Label on Distant Chat
|
||||||
|
|
||||||
|
-- Cyril Soler <csoler@users.sourceforge.net> Mon, 21 Sep 2015 20:00:00 +0100
|
||||||
|
|
||||||
|
retroshare06 (0.6.0-1.20150905.8bb76c95~trusty) trusty; urgency=low
|
||||||
|
|
||||||
a276986 ( ) Merge pull request #60 from PhenomRetroShare/Fix_AllowChatTextFormatOption
|
a276986 ( ) Merge pull request #60 from PhenomRetroShare/Fix_AllowChatTextFormatOption
|
||||||
88a6931 (GUI ) Allow Chat Text Format Option working.
|
88a6931 (GUI ) Allow Chat Text Format Option working.
|
||||||
0b5b20d ( ) Merge pull request #59 from AsamK/qmake_improvements
|
0b5b20d ( ) Merge pull request #59 from AsamK/qmake_improvements
|
||||||
@ -98,9 +418,9 @@ retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
|||||||
4d7f733 (Packaging ) fixed bug in git parameter in packaging script
|
4d7f733 (Packaging ) fixed bug in git parameter in packaging script
|
||||||
9734f32 (Packaging ) updated ubuntu changelog. improved ubuntu packaging script
|
9734f32 (Packaging ) updated ubuntu changelog. improved ubuntu packaging script
|
||||||
|
|
||||||
-- Cyril Soler <csoler@users.sourceforge.net> Sun, 16 Aug 2015 20:00:00 +0100
|
-- Cyril Soler <csoler@users.sourceforge.net> Sun, 05 Sep 2015 20:00:00 +0100
|
||||||
|
|
||||||
retroshare06 (0.6.0-1.20150816~9734f32a) trusty; urgency=low
|
retroshare06 (0.6.0-1.20150816.9734f32a~trusty) trusty; urgency=low
|
||||||
|
|
||||||
f6b830d (branch merging) Merge pull request #35 from hunbernd/chat-fix
|
f6b830d (branch merging) Merge pull request #35 from hunbernd/chat-fix
|
||||||
16859a1 (GUI ) Fix: chatlobby toaster not working
|
16859a1 (GUI ) Fix: chatlobby toaster not working
|
||||||
@ -1232,7 +1552,7 @@ retroshare06 (0.6.0-0.7555~precise) precise; urgency=low
|
|||||||
- this version is the first unstable release of 0.6. It is incompatible with v0.5.5, but can be
|
- this version is the first unstable release of 0.6. It is incompatible with v0.5.5, but can be
|
||||||
used simultaneously on the same computer. Please see release notes for v0.6
|
used simultaneously on the same computer. Please see release notes for v0.6
|
||||||
on https://retroshareteam.wordpress.com/
|
on https://retroshareteam.wordpress.com/
|
||||||
|
|
||||||
-- Cyril Soler <csoler@users.sourceforge.net> Sun, 21 Sep 2014 20:00:00 +0100
|
-- Cyril Soler <csoler@users.sourceforge.net> Sun, 21 Sep 2014 20:00:00 +0100
|
||||||
|
|
||||||
retroshare (0.5.5-0.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
retroshare (0.5.5-0.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
||||||
@ -1487,9 +1807,9 @@ retroshare (0.5.5-0.6804~precise) precise; urgency=low
|
|||||||
retroshare (0.5.5-0.6732~precise) precise; urgency=low
|
retroshare (0.5.5-0.6732~precise) precise; urgency=low
|
||||||
|
|
||||||
* Notes
|
* Notes
|
||||||
This is the final release of the 0.5 brand.
|
This is the final release of the 0.5 brand.
|
||||||
|
|
||||||
- distant chat (encrypted with AES-PSK using tunnels, autenticated with PGP)
|
- distant chat (encrypted with AES-PSK using tunnels, autenticated with PGP)
|
||||||
- distant messages (encrypted, through tunnels)
|
- distant messages (encrypted, through tunnels)
|
||||||
=> See http://retroshareteam.wordpress.com/2013/08/08/distant-chat-and-messaging-using-generic-tunnels/
|
=> See http://retroshareteam.wordpress.com/2013/08/08/distant-chat-and-messaging-using-generic-tunnels/
|
||||||
- connection progress/status dialog
|
- connection progress/status dialog
|
||||||
@ -1504,9 +1824,9 @@ retroshare (0.5.4-0.6685~precise) precise; urgency=low
|
|||||||
* Improvements
|
* Improvements
|
||||||
- Added connection progress dialog, to show connection state, and give some feedback/advice to the user
|
- Added connection progress dialog, to show connection state, and give some feedback/advice to the user
|
||||||
- added storage for denied connections in linkMgr
|
- added storage for denied connections in linkMgr
|
||||||
- new splash screen / about image
|
- new splash screen / about image
|
||||||
- improved GUI layout. Many patches, mainly from Phenom, electron
|
- improved GUI layout. Many patches, mainly from Phenom, electron
|
||||||
- GUI improvement for distant messages, showing correct names, handling links, correct toasters, etc
|
- GUI improvement for distant messages, showing correct names, handling links, correct toasters, etc
|
||||||
- improved security feed so that one can send distant messages to peers that attempt to connect
|
- improved security feed so that one can send distant messages to peers that attempt to connect
|
||||||
- improved command line parameter handling (used argstream class)
|
- improved command line parameter handling (used argstream class)
|
||||||
- Disabled setting "Start RetroShare when my system starts" on Windows when running the debug version.
|
- Disabled setting "Start RetroShare when my system starts" on Windows when running the debug version.
|
||||||
@ -1531,7 +1851,7 @@ retroshare (0.5.4-0.6685~precise) precise; urgency=low
|
|||||||
|
|
||||||
|
|
||||||
* Bug fixes
|
* Bug fixes
|
||||||
- Added missing location from cert when addign new friend
|
- Added missing location from cert when addign new friend
|
||||||
- Added missing IndicateConfigChanged to p3PeerMgrIMPL::setDynDNS
|
- Added missing IndicateConfigChanged to p3PeerMgrIMPL::setDynDNS
|
||||||
- Fixed crash when closing the main window without the setting "Minimize to Tray Icon"
|
- Fixed crash when closing the main window without the setting "Minimize to Tray Icon"
|
||||||
- Renamed the setting "Do not Minimize to Tray Icon" to "Minimize to Tray
|
- Renamed the setting "Do not Minimize to Tray Icon" to "Minimize to Tray
|
||||||
@ -1561,10 +1881,10 @@ retroshare (0.5.4-0.6546~precise) precise; urgency=low
|
|||||||
- added DynDNS to RS certificate link if available
|
- added DynDNS to RS certificate link if available
|
||||||
- removed MT19937 random generator which is not used anymore. Changed N from 624 to 1024 to reduce cost
|
- removed MT19937 random generator which is not used anymore. Changed N from 624 to 1024 to reduce cost
|
||||||
- improved completion for chat (Patch from Phenom)
|
- improved completion for chat (Patch from Phenom)
|
||||||
- added help panels in MainWindow, to help beginners startup with the basic concepts.
|
- added help panels in MainWindow, to help beginners startup with the basic concepts.
|
||||||
- changed welcome message in broadcast chat
|
- changed welcome message in broadcast chat
|
||||||
- improved GUI layouts in FriendList, NewsFeed, Forums, Channels, removed doubling unused buttons
|
- improved GUI layouts in FriendList, NewsFeed, Forums, Channels, removed doubling unused buttons
|
||||||
- added last time of transfer (Patch from Phenom)
|
- added last time of transfer (Patch from Phenom)
|
||||||
- added column with IP for connected peers (modified patch from Phenom)
|
- added column with IP for connected peers (modified patch from Phenom)
|
||||||
- Removed some more hardcoded colors
|
- Removed some more hardcoded colors
|
||||||
- added completer to MimeTextEdit and ChatWidget (Patch from Phenom)
|
- added completer to MimeTextEdit and ChatWidget (Patch from Phenom)
|
||||||
@ -2272,8 +2592,8 @@ retroshare (0.5.3-0.5327~natty) natty; urgency=low
|
|||||||
window by clicking on "manage keys/locations". This allows to easily create a new location with the same pgp key on
|
window by clicking on "manage keys/locations". This allows to easily create a new location with the same pgp key on
|
||||||
another computer. To obtain a suitable keypair using gnupg, you need to concatenate the encrypted private key and the
|
another computer. To obtain a suitable keypair using gnupg, you need to concatenate the encrypted private key and the
|
||||||
public key into an ascii file. This can be done using:
|
public key into an ascii file. This can be done using:
|
||||||
gpg -a --export-secret-keys [your ID] > mykey.asc
|
gpg -a --export-secret-keys [your ID] > mykey.asc
|
||||||
gpg -a --export [your ID] >> mykey.asc
|
gpg -a --export [your ID] >> mykey.asc
|
||||||
|
|
||||||
* importing a key with subkeys in not yet possible. Please remove subkeys before importing.
|
* importing a key with subkeys in not yet possible. Please remove subkeys before importing.
|
||||||
|
|
||||||
@ -2303,10 +2623,10 @@ retroshare (0.5.3-0.5327~natty) natty; urgency=low
|
|||||||
* key removal from keyring. This is a challenge to keep locations synchronised.
|
* key removal from keyring. This is a challenge to keep locations synchronised.
|
||||||
|
|
||||||
- Rework of tcponudp/tcpstream should make UDP connections much more stable.
|
- Rework of tcponudp/tcpstream should make UDP connections much more stable.
|
||||||
* Fixed retransmit algorithm. Much more closely matched to TCP standard: http://tools.ietf.org/html/rfc2988
|
* Fixed retransmit algorithm. Much more closely matched to TCP standard: http://tools.ietf.org/html/rfc2988
|
||||||
* This increases retransmit timeouts, and reduces the number of packets resent.
|
* This increases retransmit timeouts, and reduces the number of packets resent.
|
||||||
* Added better debugging for retrans/close as separate #defines.
|
* Added better debugging for retrans/close as separate #defines.
|
||||||
* Further testing is required ;)
|
* Further testing is required ;)
|
||||||
|
|
||||||
- Added dynamic choose of sources for chunk crc requests. Fixes the bug that would let
|
- Added dynamic choose of sources for chunk crc requests. Fixes the bug that would let
|
||||||
a transfer not finish if the original surce for a crc is not here anymore.
|
a transfer not finish if the original surce for a crc is not here anymore.
|
||||||
@ -2508,7 +2828,7 @@ retroshare (0.5.3-0.5067~natty) natty; urgency=low
|
|||||||
- update new Spanish translation from Aitor
|
- update new Spanish translation from Aitor
|
||||||
- Added two new functions to libretroshare for writing formatted data to std::string
|
- Added two new functions to libretroshare for writing formatted data to std::string
|
||||||
- Added two new images from defnax to SecurityItem for SEC_TYPE_CONNECT_ATTEMPT and SEC_TYPE_UNKNOWN_IN.kkkkk
|
- Added two new images from defnax to SecurityItem for SEC_TYPE_CONNECT_ATTEMPT and SEC_TYPE_UNKNOWN_IN.kkkkk
|
||||||
- added new toasters for private/group/lobby chat.
|
- added new toasters for private/group/lobby chat.
|
||||||
- added copy certificate button to profile widget
|
- added copy certificate button to profile widget
|
||||||
- added topics to chat lobbies. Improved CL gui
|
- added topics to chat lobbies. Improved CL gui
|
||||||
- added deferred checking of chunks in FT. Not fully functional yet, for backward compatibility reasons.
|
- added deferred checking of chunks in FT. Not fully functional yet, for backward compatibility reasons.
|
||||||
@ -2582,8 +2902,8 @@ retroshare (0.5.3-0.4953~natty) natty; urgency=low
|
|||||||
* The forum/channel news feed is removed when the user reads the message in forums/channels
|
* The forum/channel news feed is removed when the user reads the message in forums/channels
|
||||||
* The standard font is now used for new chat lobbies.
|
* The standard font is now used for new chat lobbies.
|
||||||
* Added a new menu item to set the font of a private chat and chat lobby to the default font.
|
* Added a new menu item to set the font of a private chat and chat lobby to the default font.
|
||||||
* Changed the color of the time of the compact chat style from red to gray.
|
* Changed the color of the time of the compact chat style from red to gray.
|
||||||
* disabled autodownload when subscribing to a channel.
|
* disabled autodownload when subscribing to a channel.
|
||||||
* set a icon for Friend Recommendation menu action
|
* set a icon for Friend Recommendation menu action
|
||||||
* Sort nick names by name in the chat lobby.
|
* Sort nick names by name in the chat lobby.
|
||||||
|
|
||||||
@ -2641,7 +2961,7 @@ retroshare (0.5.3-0.4885~natty) natty; urgency=low
|
|||||||
* Unified Text Source.
|
* Unified Text Source.
|
||||||
* Added "Cut Below Here" line
|
* Added "Cut Below Here" line
|
||||||
- Switched BanList sharing to only your own list. (was OWN + FRIENDS lists)
|
- Switched BanList sharing to only your own list. (was OWN + FRIENDS lists)
|
||||||
This data is not used at the moment, so just reducing data before release.
|
This data is not used at the moment, so just reducing data before release.
|
||||||
- Updated English Email Invite (sorry guys, you'll have to redo translations).
|
- Updated English Email Invite (sorry guys, you'll have to redo translations).
|
||||||
- Set OSX default style to "Cleanlooks" - as AQUA style hides some windows.
|
- Set OSX default style to "Cleanlooks" - as AQUA style hides some windows.
|
||||||
- Updated Version strings to V0.5.3a. / 4874
|
- Updated Version strings to V0.5.3a. / 4874
|
||||||
|
@ -47,7 +47,7 @@ while [ ${#} -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if test "${dist}" = "" ; then
|
if test "${dist}" = "" ; then
|
||||||
dist="precise trusty vivid"
|
dist="precise trusty vivid wily"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Attempting to get revision number...
|
echo Attempting to get revision number...
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
CPPFLAGS += -g -Wall -D BE_DEBUG -lpthread
|
|
||||||
LDFLAGS += -g -Wall -D BE_DEBUG -lpthread
|
|
||||||
CFLAGS += -g -Wall -D BE_DEBUG
|
|
||||||
CC = g++
|
|
||||||
LIB = -lpthread
|
|
||||||
CPPLIB = -lpthread
|
|
||||||
|
|
||||||
EXEC = bdmsgs_test bdmetric_test bdquery_test bdspace_test bdspace_test2 bdnode_test bdnode_test2 bdstore_test
|
|
||||||
EXEC += bdnode_multitest1 bdmidids_test
|
|
||||||
EXEC += udpbitdht_nettest bencode_test
|
|
||||||
EXEC += bdmgr_multitest
|
|
||||||
#EXEC += bdudp_test
|
|
||||||
|
|
||||||
all: $(EXEC)
|
|
||||||
|
|
||||||
OBJ = bencode.o bdmsgs.o bdobj.o
|
|
||||||
OBJ += bdpeer.o bdquery.o bdnode.o bdstore.o bdhash.o
|
|
||||||
OBJ += bdmanager.o bdstddht.o
|
|
||||||
|
|
||||||
# udp base objs
|
|
||||||
OBJ += bdthreads.o udplayer.o udpstack.o
|
|
||||||
OBJ += udpbitdht.o
|
|
||||||
|
|
||||||
bdmsgs_test: $(OBJ) bdmsgs_test.o
|
|
||||||
bdmetric_test: $(OBJ) bdmetric_test.o
|
|
||||||
bdquery_test: $(OBJ) bdquery_test.o
|
|
||||||
bdspace_test: $(OBJ) bdspace_test.o
|
|
||||||
bdspace_test2: $(OBJ) bdspace_test2.o
|
|
||||||
bdnode_test: $(OBJ) bdnode_test.o
|
|
||||||
bdnode_test2: $(OBJ) bdnode_test2.o
|
|
||||||
bdmidids_test: $(OBJ) bdmidids_test.o
|
|
||||||
|
|
||||||
bdnode_multitest1: $(OBJ) bdnode_multitest1.o
|
|
||||||
bdmgr_multitest: $(OBJ) bdmgr_multitest.o
|
|
||||||
|
|
||||||
bdstore_test: $(OBJ) bdstore_test.o
|
|
||||||
bdudp_test: $(OBJ) bdudp_test.o
|
|
||||||
udpbitdht_nettest: $(OBJ) udpbitdht_nettest.o
|
|
||||||
bencode_test: $(OBJ) bencode_test.o
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o core $(EXEC)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
CXXFLAGS = -Wall -g -I..
|
|
||||||
#CXXFLAGS += -arch i386 # OSX
|
|
||||||
|
|
||||||
LIBS = -L../lib -lbitdht -lpthread
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXEC : bssdht
|
|
||||||
|
|
||||||
EGOBJ = bdhandler.o bssdht.o bootstrap_fn.o
|
|
||||||
|
|
||||||
bssdht: $(EGOBJ)
|
|
||||||
$(CXX) $(CXXFLAGS) -o bssdht $(EGOBJ) $(LIBS)
|
|
||||||
|
|
||||||
|
|
@ -4,6 +4,8 @@ TEMPLATE = lib
|
|||||||
CONFIG += staticlib
|
CONFIG += staticlib
|
||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
TARGET = bitdht
|
TARGET = bitdht
|
||||||
|
DESTDIR = lib
|
||||||
|
|
||||||
QMAKE_CXXFLAGS *= -Wall -DBE_DEBUG
|
QMAKE_CXXFLAGS *= -Wall -DBE_DEBUG
|
||||||
|
|
||||||
profiling {
|
profiling {
|
||||||
@ -27,7 +29,6 @@ debug {
|
|||||||
|
|
||||||
################################# Linux ##########################################
|
################################# Linux ##########################################
|
||||||
linux-* {
|
linux-* {
|
||||||
DESTDIR = lib
|
|
||||||
QMAKE_CC = g++
|
QMAKE_CC = g++
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +51,6 @@ unix {
|
|||||||
|
|
||||||
win32-x-g++ {
|
win32-x-g++ {
|
||||||
OBJECTS_DIR = temp/win32xgcc/obj
|
OBJECTS_DIR = temp/win32xgcc/obj
|
||||||
DESTDIR = lib.win32xgcc
|
|
||||||
# These have been replaced by _WIN32 && __MINGW32__
|
# These have been replaced by _WIN32 && __MINGW32__
|
||||||
# DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU
|
# DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU
|
||||||
QMAKE_CXXFLAGS *= -Wmissing-include-dirs
|
QMAKE_CXXFLAGS *= -Wmissing-include-dirs
|
||||||
@ -70,7 +70,6 @@ win32 {
|
|||||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||||
# These have been replaced by _WIN32 && __MINGW32__
|
# These have been replaced by _WIN32 && __MINGW32__
|
||||||
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||||
DESTDIR = lib
|
|
||||||
|
|
||||||
# Switch on extra warnings
|
# Switch on extra warnings
|
||||||
QMAKE_CFLAGS += -Wextra
|
QMAKE_CFLAGS += -Wextra
|
||||||
@ -93,18 +92,21 @@ mac {
|
|||||||
QMAKE_CC = g++
|
QMAKE_CC = g++
|
||||||
OBJECTS_DIR = temp/obj
|
OBJECTS_DIR = temp/obj
|
||||||
MOC_DIR = temp/moc
|
MOC_DIR = temp/moc
|
||||||
DESTDIR = lib
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################# FreeBSD ##########################################
|
################################# FreeBSD ##########################################
|
||||||
|
|
||||||
freebsd-* {
|
freebsd-* {
|
||||||
DESTDIR = lib
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################# OpenBSD ##########################################
|
################################# OpenBSD ##########################################
|
||||||
|
|
||||||
openbsd-* {
|
openbsd-* {
|
||||||
|
}
|
||||||
|
|
||||||
|
################################# Haiku ##########################################
|
||||||
|
|
||||||
|
haiku-* {
|
||||||
DESTDIR = lib
|
DESTDIR = lib
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,5 +170,3 @@ SOURCES += \
|
|||||||
bitdht/bdquerymgr.cc \
|
bitdht/bdquerymgr.cc \
|
||||||
util/bdbloom.cc \
|
util/bdbloom.cc \
|
||||||
bitdht/bdfriendlist.cc \
|
bitdht/bdfriendlist.cc \
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
|
|
||||||
LIB_TOP_DIR = ..
|
|
||||||
TEST_TOP_DIR = $(LIB_TOP_DIR)/tests
|
|
||||||
|
|
||||||
##### Define any flags that are needed for this section #######
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(TEST_TOP_DIR)/scripts/config.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
# Generic Test Harnesses.
|
|
||||||
TESTOBJ = bdmetric_test.o bdmsgs_test.o bdnode_test.o bdspace_test.o
|
|
||||||
TESTOBJ += bdmgr_multitest.o bdquery_test.o bdstore_test.o
|
|
||||||
TESTOBJ += bdmidids_test.o bdspace_test2.o udpbitdht_nettest.o
|
|
||||||
TESTOBJ += bdbloom_test.o bdbloom_makefilter.o
|
|
||||||
#TESTOBJ += bencode_test.o bdudp_test.o
|
|
||||||
#TESTOBJ = bdnode_test.o bdnode_multitest1.o bdnode_test2.o
|
|
||||||
|
|
||||||
TESTS = bdmetric_test bdmsgs_test bdspace_test
|
|
||||||
TESTS += bdmgr_multitest bdquery_test bdstore_test
|
|
||||||
TESTS += bdmidids_test bdspace_test2 udpbitdht_nettest
|
|
||||||
TESTS += bdbloom_test
|
|
||||||
#TESTS += bencode_test bdudp_test
|
|
||||||
#Tests to Fix.
|
|
||||||
#TESTS = bdnode_test bdnode_multitest1 bdnode_test2
|
|
||||||
|
|
||||||
MANUAL_TESTS =
|
|
||||||
|
|
||||||
all: tests $(MANUAL_TESTS)
|
|
||||||
|
|
||||||
bdmsgs_test: bdmsgs_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdmsgs_test bdmsgs_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdmetric_test: bdmetric_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdmetric_test bdmetric_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdquery_test: bdquery_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdquery_test bdquery_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdspace_test: bdspace_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdspace_test bdspace_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdspace_test2: bdspace_test2.o
|
|
||||||
$(CC) $(CFLAGS) -o bdspace_test2 bdspace_test2.o $(LIBS)
|
|
||||||
|
|
||||||
bdnode_test: bdnode_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdnode_test bdnode_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdnode_test2: bdnode_test2.o
|
|
||||||
$(CC) $(CFLAGS) -o bdnode_test2 bdnode_test2.o $(LIBS)
|
|
||||||
|
|
||||||
bdmidids_test: bdmidids_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdmidids_test bdmidids_test.o $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
bdnode_multitest1: bdnode_multitest1.o
|
|
||||||
$(CC) $(CFLAGS) -o bdnode_multitest1 bdnode_multitest1.o $(LIBS)
|
|
||||||
|
|
||||||
bdmgr_multitest: bdmgr_multitest.o
|
|
||||||
$(CC) $(CFLAGS) -o bdmgr_multitest bdmgr_multitest.o $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
bdstore_test: bdstore_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdstore_test bdstore_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdudp_test: bdudp_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdudp_test bdudp_test.o $(LIBS)
|
|
||||||
|
|
||||||
udpbitdht_nettest: udpbitdht_nettest.o
|
|
||||||
$(CC) $(CFLAGS) -o udpbitdht_nettest udpbitdht_nettest.o $(LIBS)
|
|
||||||
|
|
||||||
bencode_test: bencode_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bencode_test bencode_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdbloom_test: bdbloom_test.o
|
|
||||||
$(CC) $(CFLAGS) -o bdbloom_test bdbloom_test.o $(LIBS)
|
|
||||||
|
|
||||||
bdbloom_makefilter: bdbloom_makefilter.o
|
|
||||||
$(CC) $(CFLAGS) -o bdbloom_makefilter bdbloom_makefilter.o $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
clobber: remove_extra_files
|
|
||||||
|
|
||||||
remove_extra_files:
|
|
||||||
-$(RM) $(MANUAL_TESTS)
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(TEST_TOP_DIR)/scripts/rules.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* #define UDP_ENABLE_BROADCAST 1
|
* #define UDP_ENABLE_BROADCAST 1
|
||||||
|
@ -13,7 +13,7 @@ static bool auto_seed = bdRandom::seed( (time(NULL) + ((uint32_t) pthread_self()
|
|||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__) || (__HAIKU__)
|
||||||
// since this is completely insecure anyway, just kludge for now
|
// since this is completely insecure anyway, just kludge for now
|
||||||
static bool auto_seed = bdRandom::seed(time(NULL));
|
static bool auto_seed = bdRandom::seed(time(NULL));
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(__OpenBSD__)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <util/rsdir.h>
|
#include <util/rsdir.h>
|
||||||
|
#include "util/ContentTypes.h"
|
||||||
|
|
||||||
// for filestreamer
|
// for filestreamer
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
@ -274,12 +275,21 @@ public:
|
|||||||
{
|
{
|
||||||
sendMessage(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "Error: rsFiles is null. Retroshare is probably not yet started.");
|
sendMessage(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "Error: rsFiles is null. Retroshare is probably not yet started.");
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
}
|
}
|
||||||
if(url[0] == 0 || (mHash=RsFileHash(url+strlen(FILESTREAMER_ENTRY_PATH))).isNull())
|
std::string urls(url);
|
||||||
{
|
urls = urls.substr(strlen(FILESTREAMER_ENTRY_PATH));
|
||||||
sendMessage(connection, MHD_HTTP_NOT_FOUND, "Error: URL is not a valid file hash");
|
size_t perpos = urls.find('/');
|
||||||
return MHD_YES;
|
if(perpos == std::string::npos){
|
||||||
}
|
mHash = RsFileHash(urls);
|
||||||
|
}else{
|
||||||
|
mHash = RsFileHash(urls.substr(0, perpos));
|
||||||
|
}
|
||||||
|
if(urls.empty() || mHash.isNull())
|
||||||
|
{
|
||||||
|
sendMessage(connection, MHD_HTTP_NOT_FOUND, "Error: URL is not a valid file hash");
|
||||||
|
return MHD_YES;
|
||||||
|
}
|
||||||
|
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
std::list<RsFileHash> dls;
|
std::list<RsFileHash> dls;
|
||||||
rsFiles->FileDownloads(dls);
|
rsFiles->FileDownloads(dls);
|
||||||
@ -293,8 +303,13 @@ public:
|
|||||||
struct MHD_Response* resp = MHD_create_response_from_callback(
|
struct MHD_Response* resp = MHD_create_response_from_callback(
|
||||||
mSize, 1024*1024, &contentReadercallback, this, NULL);
|
mSize, 1024*1024, &contentReadercallback, this, NULL);
|
||||||
|
|
||||||
// only mp3 at the moment
|
// get content-type from extension
|
||||||
MHD_add_response_header(resp, "Content-Type", "audio/mpeg3");
|
std::string ext = "";
|
||||||
|
unsigned int i = info.fname.rfind('.');
|
||||||
|
if(i != std::string::npos)
|
||||||
|
ext = info.fname.substr(i+1);
|
||||||
|
MHD_add_response_header(resp, "Content-Type", ContentTypes::cTypeFromExt(ext).c_str());
|
||||||
|
|
||||||
secure_queue_response(connection, MHD_HTTP_OK, resp);
|
secure_queue_response(connection, MHD_HTTP_OK, resp);
|
||||||
MHD_destroy_response(resp);
|
MHD_destroy_response(resp);
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
@ -635,27 +650,10 @@ int ApiServerMHD::accessHandlerCallback(MHD_Connection *connection,
|
|||||||
{
|
{
|
||||||
extension = filename[i] + extension;
|
extension = filename[i] + extension;
|
||||||
i--;
|
i--;
|
||||||
}
|
};
|
||||||
const char* type = 0;
|
|
||||||
if(extension == "html")
|
|
||||||
type = "text/html";
|
|
||||||
else if(extension == "css")
|
|
||||||
type = "text/css";
|
|
||||||
else if(extension == "js")
|
|
||||||
type = "text/javascript";
|
|
||||||
else if(extension == "jsx") // react.js jsx files
|
|
||||||
type = "text/jsx";
|
|
||||||
else if(extension == "png")
|
|
||||||
type = "image/png";
|
|
||||||
else if(extension == "jpg" || extension == "jpeg")
|
|
||||||
type = "image/jpeg";
|
|
||||||
else if(extension == "gif")
|
|
||||||
type = "image/gif";
|
|
||||||
else
|
|
||||||
type = "application/octet-stream";
|
|
||||||
|
|
||||||
struct MHD_Response* resp = MHD_create_response_from_fd(s.st_size, fd);
|
struct MHD_Response* resp = MHD_create_response_from_fd(s.st_size, fd);
|
||||||
MHD_add_response_header(resp, "Content-Type", type);
|
MHD_add_response_header(resp, "Content-Type", ContentTypes::cTypeFromExt(extension).c_str());
|
||||||
secure_queue_response(connection, MHD_HTTP_OK, resp);
|
secure_queue_response(connection, MHD_HTTP_OK, resp);
|
||||||
MHD_destroy_response(resp);
|
MHD_destroy_response(resp);
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
|
@ -42,6 +42,12 @@ StreamBase& operator << (StreamBase& left, ChatHandler::Msg& m)
|
|||||||
|
|
||||||
bool compare_lobby_id(const ChatHandler::Lobby& l1, const ChatHandler::Lobby& l2)
|
bool compare_lobby_id(const ChatHandler::Lobby& l1, const ChatHandler::Lobby& l2)
|
||||||
{
|
{
|
||||||
|
if(l1.auto_subscribe && !l2.auto_subscribe) return true;
|
||||||
|
if(!l1.auto_subscribe && l2.auto_subscribe) return false;
|
||||||
|
if(l1.is_private && !l2.is_private) return true;
|
||||||
|
if(!l1.is_private && l2.is_private) return false;
|
||||||
|
if(l1.subscribed && !l2.subscribed) return true;
|
||||||
|
if(!l1.subscribed && l2.subscribed) return false;
|
||||||
return l1.id < l2.id;
|
return l1.id < l2.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,13 +71,17 @@ StreamBase& operator <<(StreamBase& left, KeyValueReference<ChatLobbyId> kv)
|
|||||||
|
|
||||||
StreamBase& operator << (StreamBase& left, ChatHandler::Lobby& l)
|
StreamBase& operator << (StreamBase& left, ChatHandler::Lobby& l)
|
||||||
{
|
{
|
||||||
|
ChatId chatId(l.id);
|
||||||
|
if (l.is_broadcast)
|
||||||
|
chatId = ChatId::makeBroadcastId();
|
||||||
left << makeKeyValueReference("id", l.id)
|
left << makeKeyValueReference("id", l.id)
|
||||||
<< makeKeyValue("chat_id", ChatId(l.id).toStdString())
|
<< makeKeyValue("chat_id", chatId.toStdString())
|
||||||
<< makeKeyValueReference("name",l.name)
|
<< makeKeyValueReference("name",l.name)
|
||||||
<< makeKeyValueReference("topic", l.topic)
|
<< makeKeyValueReference("topic", l.topic)
|
||||||
<< makeKeyValueReference("subscribed", l.subscribed)
|
<< makeKeyValueReference("subscribed", l.subscribed)
|
||||||
<< makeKeyValueReference("auto_subscribe", l.auto_subscribe)
|
<< makeKeyValueReference("auto_subscribe", l.auto_subscribe)
|
||||||
<< makeKeyValueReference("is_private", l.is_private)
|
<< makeKeyValueReference("is_private", l.is_private)
|
||||||
|
<< makeKeyValueReference("is_broadcast", l.is_broadcast)
|
||||||
<< makeKeyValueReference("gxs_id", l.gxs_id);
|
<< makeKeyValueReference("gxs_id", l.gxs_id);
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
@ -157,11 +167,26 @@ void ChatHandler::tick()
|
|||||||
l.subscribed = true;
|
l.subscribed = true;
|
||||||
l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
||||||
l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC);
|
l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC);
|
||||||
|
l.is_broadcast = false;
|
||||||
l.gxs_id = info.gxs_id;
|
l.gxs_id = info.gxs_id;
|
||||||
lobbies.push_back(l);
|
lobbies.push_back(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChatId id = ChatId::makeBroadcastId();
|
||||||
|
{
|
||||||
|
Lobby l;
|
||||||
|
l.id = id.toLobbyId();
|
||||||
|
l.name = "BroadCast";
|
||||||
|
l.topic = "Retroshare broadcast chat: messages are sent to all connected friends.";
|
||||||
|
l.subscribed = true;
|
||||||
|
l.auto_subscribe = false;
|
||||||
|
l.is_private = false;
|
||||||
|
l.is_broadcast = true;
|
||||||
|
l.gxs_id = id.toGxsId();
|
||||||
|
lobbies.push_back(l);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<VisibleChatLobbyRecord> unsubscribed_lobbies;
|
std::vector<VisibleChatLobbyRecord> unsubscribed_lobbies;
|
||||||
mRsMsgs->getListOfNearbyChatLobbies(unsubscribed_lobbies);
|
mRsMsgs->getListOfNearbyChatLobbies(unsubscribed_lobbies);
|
||||||
for(std::vector<VisibleChatLobbyRecord>::iterator vit = unsubscribed_lobbies.begin(); vit != unsubscribed_lobbies.end(); ++vit)
|
for(std::vector<VisibleChatLobbyRecord>::iterator vit = unsubscribed_lobbies.begin(); vit != unsubscribed_lobbies.end(); ++vit)
|
||||||
@ -176,6 +201,7 @@ void ChatHandler::tick()
|
|||||||
l.subscribed = false;
|
l.subscribed = false;
|
||||||
l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
||||||
l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC);
|
l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC);
|
||||||
|
l.is_broadcast = false;
|
||||||
l.gxs_id = RsGxsId();
|
l.gxs_id = RsGxsId();
|
||||||
lobbies.push_back(l);
|
lobbies.push_back(l);
|
||||||
}
|
}
|
||||||
@ -294,62 +320,7 @@ void ChatHandler::tick()
|
|||||||
|
|
||||||
// remove html tags from chat message
|
// remove html tags from chat message
|
||||||
// extract links form href
|
// extract links form href
|
||||||
const std::string& in = msg.msg;
|
getPlainText(msg.msg, m.msg, m.links);
|
||||||
std::string out;
|
|
||||||
bool ignore = false;
|
|
||||||
bool keep_link = false;
|
|
||||||
std::string last_six_chars;
|
|
||||||
Triple current_link;
|
|
||||||
std::vector<Triple> links;
|
|
||||||
for(unsigned int i = 0; i < in.size(); ++i)
|
|
||||||
{
|
|
||||||
if(keep_link && in[i] == '"')
|
|
||||||
{
|
|
||||||
keep_link = false;
|
|
||||||
current_link.second = out.size();
|
|
||||||
}
|
|
||||||
if(last_six_chars == "href=\"")
|
|
||||||
{
|
|
||||||
keep_link = true;
|
|
||||||
current_link.first = out.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// "rising edge" sets mode to ignore
|
|
||||||
if(in[i] == '<')
|
|
||||||
{
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
if(!ignore || keep_link)
|
|
||||||
out += in[i];
|
|
||||||
// "falling edge" resets mode to keep
|
|
||||||
if(in[i] == '>')
|
|
||||||
ignore = false;
|
|
||||||
|
|
||||||
last_six_chars += in[i];
|
|
||||||
if(last_six_chars.size() > 6)
|
|
||||||
last_six_chars = last_six_chars.substr(1);
|
|
||||||
std::string a = "</a>";
|
|
||||||
if( current_link.first != -1
|
|
||||||
&& last_six_chars.size() >= a.size()
|
|
||||||
&& last_six_chars.substr(last_six_chars.size()-a.size()) == a)
|
|
||||||
{
|
|
||||||
// only allow these protocols
|
|
||||||
// we don't want for example javascript:alert(0)
|
|
||||||
std::string http = "http://";
|
|
||||||
std::string https = "https://";
|
|
||||||
std::string retroshare = "retroshare://";
|
|
||||||
if( out.substr(current_link.first, http.size()) == http
|
|
||||||
|| out.substr(current_link.first, https.size()) == https
|
|
||||||
|| out.substr(current_link.first, retroshare.size()) == retroshare)
|
|
||||||
{
|
|
||||||
current_link.third = out.size();
|
|
||||||
links.push_back(current_link);
|
|
||||||
}
|
|
||||||
current_link = Triple();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.msg = out;
|
|
||||||
m.links = links;
|
|
||||||
m.recv_time = msg.recvTime;
|
m.recv_time = msg.recvTime;
|
||||||
m.send_time = msg.sendTime;
|
m.send_time = msg.sendTime;
|
||||||
|
|
||||||
@ -390,7 +361,77 @@ void ChatHandler::tick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatHandler::handleWildcard(Request &req, Response &resp)
|
void ChatHandler::getPlainText(const std::string& in, std::string &out, std::vector<Triple> &links)
|
||||||
|
{
|
||||||
|
if (in.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (in[0] != '<' || in[in.size() - 1] != '>')
|
||||||
|
{
|
||||||
|
// It's a plain text message without HTML
|
||||||
|
out = in;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool ignore = false;
|
||||||
|
|
||||||
|
bool keep_link = false;
|
||||||
|
std::string last_six_chars;
|
||||||
|
unsigned int tag_start_index = 0;
|
||||||
|
Triple current_link;
|
||||||
|
for(unsigned int i = 0; i < in.size(); ++i)
|
||||||
|
{
|
||||||
|
if(keep_link && in[i] == '"')
|
||||||
|
{
|
||||||
|
keep_link = false;
|
||||||
|
current_link.second = out.size();
|
||||||
|
}
|
||||||
|
if(last_six_chars == "href=\"")
|
||||||
|
{
|
||||||
|
keep_link = true;
|
||||||
|
current_link.first = out.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
// "rising edge" sets mode to ignore
|
||||||
|
if(in[i] == '<')
|
||||||
|
{
|
||||||
|
tag_start_index = i;
|
||||||
|
ignore = true;
|
||||||
|
}
|
||||||
|
if(!ignore || keep_link)
|
||||||
|
out += in[i];
|
||||||
|
// "falling edge" resets mode to keep
|
||||||
|
if(in[i] == '>') {
|
||||||
|
// leave ignore mode on, if it's a style tag
|
||||||
|
if (tag_start_index == 0 || tag_start_index + 6 > i || in.substr(tag_start_index, 6) != "<style")
|
||||||
|
ignore = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
last_six_chars += in[i];
|
||||||
|
if(last_six_chars.size() > 6)
|
||||||
|
last_six_chars = last_six_chars.substr(1);
|
||||||
|
std::string a = "</a>";
|
||||||
|
if( current_link.first != -1
|
||||||
|
&& last_six_chars.size() >= a.size()
|
||||||
|
&& last_six_chars.substr(last_six_chars.size()-a.size()) == a)
|
||||||
|
{
|
||||||
|
// only allow these protocols
|
||||||
|
// we don't want for example javascript:alert(0)
|
||||||
|
std::string http = "http://";
|
||||||
|
std::string https = "https://";
|
||||||
|
std::string retroshare = "retroshare://";
|
||||||
|
if( out.substr(current_link.first, http.size()) == http
|
||||||
|
|| out.substr(current_link.first, https.size()) == https
|
||||||
|
|| out.substr(current_link.first, retroshare.size()) == retroshare)
|
||||||
|
{
|
||||||
|
current_link.third = out.size();
|
||||||
|
links.push_back(current_link);
|
||||||
|
}
|
||||||
|
current_link = Triple();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatHandler::handleWildcard(Request &/*req*/, Response &resp)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||||
resp.mDataStream.getStreamToMember();
|
resp.mDataStream.getStreamToMember();
|
||||||
@ -447,7 +488,7 @@ void ChatHandler::handleSubscribeLobby(Request &req, Response &resp)
|
|||||||
resp.setFail("lobby join failed. (See console for more info)");
|
resp.setFail("lobby join failed. (See console for more info)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatHandler::handleUnsubscribeLobby(Request &req, Response &resp)
|
void ChatHandler::handleUnsubscribeLobby(Request &req, Response &/*resp*/)
|
||||||
{
|
{
|
||||||
ChatLobbyId id = 0;
|
ChatLobbyId id = 0;
|
||||||
req.mStream << makeKeyValueReference("id", id);
|
req.mStream << makeKeyValueReference("id", id);
|
||||||
@ -626,17 +667,17 @@ void ChatHandler::handleInfo(Request &req, Response &resp)
|
|||||||
resp.setOk();
|
resp.setOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatHandler::handleTypingLabel(Request &req, Response &resp)
|
void ChatHandler::handleTypingLabel(Request &/*req*/, Response &/*resp*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatHandler::handleSendStatus(Request &req, Response &resp)
|
void ChatHandler::handleSendStatus(Request &/*req*/, Response &/*resp*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatHandler::handleUnreadMsgs(Request &req, Response &resp)
|
void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||||
|
|
||||||
|
@ -57,13 +57,14 @@ public:
|
|||||||
|
|
||||||
class Lobby{
|
class Lobby{
|
||||||
public:
|
public:
|
||||||
Lobby(): id(0), subscribed(false), auto_subscribe(false), is_private(false){}
|
Lobby(): id(0), subscribed(false), auto_subscribe(false), is_private(false), is_broadcast(false){}
|
||||||
ChatLobbyId id;
|
ChatLobbyId id;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string topic;
|
std::string topic;
|
||||||
bool subscribed;
|
bool subscribed;
|
||||||
bool auto_subscribe;
|
bool auto_subscribe;
|
||||||
bool is_private;
|
bool is_private;
|
||||||
|
bool is_broadcast;
|
||||||
|
|
||||||
RsGxsId gxs_id;// for subscribed lobbies: the id we use to write messages
|
RsGxsId gxs_id;// for subscribed lobbies: the id we use to write messages
|
||||||
|
|
||||||
@ -75,6 +76,7 @@ public:
|
|||||||
&& subscribed == l.subscribed
|
&& subscribed == l.subscribed
|
||||||
&& auto_subscribe == l.auto_subscribe
|
&& auto_subscribe == l.auto_subscribe
|
||||||
&& is_private == l.is_private
|
&& is_private == l.is_private
|
||||||
|
&& is_broadcast == l.is_broadcast
|
||||||
&& gxs_id == l.gxs_id;
|
&& gxs_id == l.gxs_id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -102,6 +104,8 @@ private:
|
|||||||
void handleSendStatus(Request& req, Response& resp);
|
void handleSendStatus(Request& req, Response& resp);
|
||||||
void handleUnreadMsgs(Request& req, Response& resp);
|
void handleUnreadMsgs(Request& req, Response& resp);
|
||||||
|
|
||||||
|
void getPlainText(const std::string& in, std::string &out, std::vector<Triple> &links);
|
||||||
|
|
||||||
StateTokenServer* mStateTokenServer;
|
StateTokenServer* mStateTokenServer;
|
||||||
RsNotify* mNotify;
|
RsNotify* mNotify;
|
||||||
RsMsgs* mRsMsgs;
|
RsMsgs* mRsMsgs;
|
||||||
|
@ -14,9 +14,9 @@ StreamBase& operator <<(StreamBase& left, KeyValueReference<uint32_t> ref)
|
|||||||
{
|
{
|
||||||
digit = num % 10;
|
digit = num % 10;
|
||||||
num = num / 10;
|
num = num / 10;
|
||||||
str += (char)(digit + '0');
|
str = (char)(digit + '0') + str;
|
||||||
}
|
}
|
||||||
str += (char)(num + '0');
|
str = (char)(num + '0') + str;
|
||||||
left << makeKeyValueReference(ref.key, str);
|
left << makeKeyValueReference(ref.key, str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -408,7 +408,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
|||||||
std::string err_string;
|
std::string err_string;
|
||||||
if(!RsAccounts::GeneratePGPCertificate(pgp_name, "", pgp_password, pgp_id, 2048, err_string))
|
if(!RsAccounts::GeneratePGPCertificate(pgp_name, "", pgp_password, pgp_id, 2048, err_string))
|
||||||
{
|
{
|
||||||
resp.setFail("could not cerate pgp key: "+err_string);
|
resp.setFail("could not create pgp key: "+err_string);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += staticlib
|
CONFIG += staticlib
|
||||||
|
CONFIG += create_prl
|
||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
TARGET = resapi
|
TARGET = resapi
|
||||||
|
TARGET_PRL = libresapi
|
||||||
DESTDIR = lib
|
DESTDIR = lib
|
||||||
|
|
||||||
CONFIG += libmicrohttpd
|
CONFIG += libmicrohttpd
|
||||||
@ -22,10 +24,21 @@ unix {
|
|||||||
|
|
||||||
win32{
|
win32{
|
||||||
DEFINES *= WINDOWS_SYS
|
DEFINES *= WINDOWS_SYS
|
||||||
INCLUDEPATH += $$PWD/../../../libs/include
|
INCLUDEPATH += . $$INC_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
libmicrohttpd{
|
libmicrohttpd{
|
||||||
|
linux {
|
||||||
|
CONFIG += link_pkgconfig
|
||||||
|
PKGCONFIG *= libmicrohttpd
|
||||||
|
} else {
|
||||||
|
mac {
|
||||||
|
INCLUDEPATH += /usr/local/include
|
||||||
|
LIBS *= /usr/local/lib/libmicrohttpd.a
|
||||||
|
} else {
|
||||||
|
LIBS *= -lmicrohttpd
|
||||||
|
}
|
||||||
|
}
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
api/ApiServerMHD.cpp
|
api/ApiServerMHD.cpp
|
||||||
|
|
||||||
@ -51,7 +64,8 @@ SOURCES += \
|
|||||||
api/GetPluginInterfaces.cpp \
|
api/GetPluginInterfaces.cpp \
|
||||||
api/ChatHandler.cpp \
|
api/ChatHandler.cpp \
|
||||||
api/LivereloadHandler.cpp \
|
api/LivereloadHandler.cpp \
|
||||||
api/TmpBlobStore.cpp
|
api/TmpBlobStore.cpp \
|
||||||
|
util/ContentTypes.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
api/ApiServer.h \
|
api/ApiServer.h \
|
||||||
@ -74,4 +88,5 @@ HEADERS += \
|
|||||||
api/GetPluginInterfaces.h \
|
api/GetPluginInterfaces.h \
|
||||||
api/ChatHandler.h \
|
api/ChatHandler.h \
|
||||||
api/LivereloadHandler.h \
|
api/LivereloadHandler.h \
|
||||||
api/TmpBlobStore.h
|
api/TmpBlobStore.h \
|
||||||
|
util/ContentTypes.h
|
||||||
|
88
libresapi/src/util/ContentTypes.cpp
Normal file
88
libresapi/src/util/ContentTypes.cpp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#include "ContentTypes.h"
|
||||||
|
#include <fstream>
|
||||||
|
#include <cctype>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
RsMutex ContentTypes::ctmtx = RsMutex("CTMTX");
|
||||||
|
std::map<std::string, std::string> ContentTypes::cache;
|
||||||
|
bool ContentTypes::inited = false;
|
||||||
|
|
||||||
|
#ifdef WINDOWS_SYS
|
||||||
|
//Next to the executable
|
||||||
|
const char* ContentTypes::filename = ".\\mime.types";
|
||||||
|
#else
|
||||||
|
const char* ContentTypes::filename = "/etc/mime.types";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string ContentTypes::cTypeFromExt(const std::string &extension)
|
||||||
|
{
|
||||||
|
if(extension.empty())
|
||||||
|
return DEFAULTCT;
|
||||||
|
|
||||||
|
RsStackMutex mtx(ctmtx);
|
||||||
|
|
||||||
|
if(!inited)
|
||||||
|
addBasic();
|
||||||
|
|
||||||
|
std::string extension2(extension); //lower case
|
||||||
|
std::transform(extension2.begin(), extension2.end(), extension2.begin(),::tolower);
|
||||||
|
|
||||||
|
//looking into the cache
|
||||||
|
std::map<std::string,std::string>::iterator it;
|
||||||
|
it = cache.find(extension2);
|
||||||
|
if (it != cache.end())
|
||||||
|
{
|
||||||
|
std::cout << "Mime " + it->second + " for extension ." + extension2 + " was found in cache" << std::endl;
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
//looking into mime.types
|
||||||
|
std::string line;
|
||||||
|
std::string ext;
|
||||||
|
std::ifstream file(filename);
|
||||||
|
while(getline(file, line))
|
||||||
|
{
|
||||||
|
if(line.empty() || line[0] == '#') continue;
|
||||||
|
size_t i = line.find_first_of("\t ");
|
||||||
|
size_t j;
|
||||||
|
while(i != std::string::npos) //tokenize
|
||||||
|
{
|
||||||
|
j = i;
|
||||||
|
i = line.find_first_of("\t ", i+1);
|
||||||
|
if(i == std::string::npos)
|
||||||
|
ext = line.substr(j+1);
|
||||||
|
else
|
||||||
|
ext = line.substr(j+1, i-j-1);
|
||||||
|
|
||||||
|
if(extension2 == ext)
|
||||||
|
{
|
||||||
|
std::string mime = line.substr(0, line.find_first_of("\t "));
|
||||||
|
cache[extension2] = mime;
|
||||||
|
std::cout << "Mime " + mime + " for extension ." + extension2 + " was found in mime.types" << std::endl;
|
||||||
|
return mime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//nothing found
|
||||||
|
std::cout << "Mime for " + extension2 + " was not found in " + filename + " falling back to " << DEFAULTCT << std::endl;
|
||||||
|
cache[extension2] = DEFAULTCT;
|
||||||
|
return DEFAULTCT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add some basic content-types before first use.
|
||||||
|
//It keeps webui usable in the case of mime.types file not exists.
|
||||||
|
void ContentTypes::addBasic()
|
||||||
|
{
|
||||||
|
inited = true;
|
||||||
|
|
||||||
|
cache["html"] = "text/html";
|
||||||
|
cache["css"] = "text/css";
|
||||||
|
cache["js"] = "text/javascript";
|
||||||
|
cache["jsx"] = "text/jsx";
|
||||||
|
cache["png"] = "image/png";
|
||||||
|
cache["jpg"] = "image/jpeg";
|
||||||
|
cache["jpeg"] = "image/jpeg";
|
||||||
|
cache["gif"] = "image/gif";
|
||||||
|
}
|
||||||
|
|
23
libresapi/src/util/ContentTypes.h
Normal file
23
libresapi/src/util/ContentTypes.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef CONTENTTYPES_H
|
||||||
|
#define CONTENTTYPES_H
|
||||||
|
|
||||||
|
#include <util/rsthreads.h>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#define DEFAULTCT "application/octet-stream"
|
||||||
|
|
||||||
|
class ContentTypes
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::string cTypeFromExt(const std::string& extension);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::map<std::string, std::string> cache;
|
||||||
|
static RsMutex ctmtx;
|
||||||
|
static const char* filename;
|
||||||
|
static bool inited;
|
||||||
|
static void addBasic();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONTENTTYPES_H
|
@ -66,6 +66,10 @@ td{
|
|||||||
background-color: midnightblue;
|
background-color: midnightblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filelink{
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
input, textarea{
|
input, textarea{
|
||||||
color: lime;
|
color: lime;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
|
@ -4,7 +4,15 @@ RS.start();
|
|||||||
|
|
||||||
var api_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/api/v2/";
|
var api_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/api/v2/";
|
||||||
var filestreamer_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/fstream/";
|
var filestreamer_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/fstream/";
|
||||||
var upload_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/upload/";
|
var upload_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/upload/";
|
||||||
|
|
||||||
|
var extensions = {
|
||||||
|
mp3: "audio",
|
||||||
|
ogg: "audio",
|
||||||
|
wav: "audio",
|
||||||
|
webm: "video",
|
||||||
|
mp4: "video"
|
||||||
|
};
|
||||||
|
|
||||||
// livereload
|
// livereload
|
||||||
function start_live_reload()
|
function start_live_reload()
|
||||||
@ -558,7 +566,8 @@ var DownloadsWidget = React.createClass({
|
|||||||
widget.emit("play_file", {name: file.name, hash: file.hash})
|
widget.emit("play_file", {name: file.name, hash: file.hash})
|
||||||
};
|
};
|
||||||
var playBtn = <div></div>;
|
var playBtn = <div></div>;
|
||||||
if(file.name.slice(-3) === "mp3")
|
var splits = file.name.split(".");
|
||||||
|
if(splits[splits.length-1].toLowerCase() in extensions)
|
||||||
playBtn = <div className="btn" onClick={playFn}>play</div>;
|
playBtn = <div className="btn" onClick={playFn}>play</div>;
|
||||||
|
|
||||||
var ctrlBtn = <div></div>;
|
var ctrlBtn = <div></div>;
|
||||||
@ -571,7 +580,7 @@ var DownloadsWidget = React.createClass({
|
|||||||
ctrlBtn = <div className="btn" onClick={pauseFn}>pause</div>;
|
ctrlBtn = <div className="btn" onClick={pauseFn}>pause</div>;
|
||||||
}
|
}
|
||||||
return(<tr>
|
return(<tr>
|
||||||
<td>{this.props.data.name}</td>
|
<td><a className="filelink" target="_blank" href={filestreamer_url + this.props.data.hash + "/" + encodeURIComponent(this.props.data.name)}>{this.props.data.name}</a></td>
|
||||||
<td>{makeFriendlyUnit(this.props.data.size)}</td>
|
<td>{makeFriendlyUnit(this.props.data.size)}</td>
|
||||||
<td><ProgressBar progress={this.props.data.transfered / this.props.data.size}/></td>
|
<td><ProgressBar progress={this.props.data.transfered / this.props.data.size}/></td>
|
||||||
<td>{makeFriendlyUnit(this.props.data.transfer_rate*1e3)}/s</td>
|
<td>{makeFriendlyUnit(this.props.data.transfer_rate*1e3)}/s</td>
|
||||||
@ -673,7 +682,7 @@ var SearchWidget = React.createClass({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var AudioPlayerWidget = React.createClass({
|
var MediaPlayerWidget = React.createClass({
|
||||||
mixins: [SignalSlotMixin],
|
mixins: [SignalSlotMixin],
|
||||||
getInitialState: function(){
|
getInitialState: function(){
|
||||||
return {file: undefined};
|
return {file: undefined};
|
||||||
@ -691,13 +700,28 @@ var AudioPlayerWidget = React.createClass({
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return(
|
var splits = this.state.file.name.split(".");
|
||||||
<div>
|
var mediatype = extensions[splits[splits.length - 1].toLowerCase()];
|
||||||
<p>{this.state.file.name}</p>
|
if (mediatype == "audio") {
|
||||||
<audio controls src={filestreamer_url+this.state.file.hash} type="audio/mpeg">
|
return (
|
||||||
</audio>
|
<div>
|
||||||
</div>
|
<p>{this.state.file.name}</p>
|
||||||
);
|
<audio controls autoPlay src={filestreamer_url+this.state.file.hash}>
|
||||||
|
</audio>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else if (mediatype == "video") {
|
||||||
|
return(
|
||||||
|
<div>
|
||||||
|
<p>{this.state.file.name}</p>
|
||||||
|
<video height="300" controls autoPlay src={filestreamer_url+this.state.file.hash}>
|
||||||
|
Your browser does not support the video tag.
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return(<div></div>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -1467,7 +1491,7 @@ var ChatWidget = React.createClass({
|
|||||||
<ChatInfoWidget id={this.props.id}/>
|
<ChatInfoWidget id={this.props.id}/>
|
||||||
{
|
{
|
||||||
this.state.data.map(function(msg){
|
this.state.data.map(function(msg){
|
||||||
return <div key={msg.id}>{msg.send_time} {msg.author_name}: {markup(msg.msg, msg.links)}</div>;
|
return <div key={msg.id}>{new Date(msg.send_time*1000).toLocaleTimeString()} {msg.author_name}: {markup(msg.msg, msg.links)}</div>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
<input type="text" ref="input" onKeyDown={
|
<input type="text" ref="input" onKeyDown={
|
||||||
@ -1702,7 +1726,7 @@ var MainWidget = React.createClass({
|
|||||||
}
|
}
|
||||||
mainpage = <div>
|
mainpage = <div>
|
||||||
<UnreadChatMsgsCountWidget/>
|
<UnreadChatMsgsCountWidget/>
|
||||||
<AudioPlayerWidget/>
|
<MediaPlayerWidget/>
|
||||||
<IdentitySelectorWidget/>
|
<IdentitySelectorWidget/>
|
||||||
{mainpage}
|
{mainpage}
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -66,6 +66,10 @@ td{
|
|||||||
background-color: midnightblue;
|
background-color: midnightblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filelink{
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
input, textarea{
|
input, textarea{
|
||||||
color: lime;
|
color: lime;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
|
@ -4,7 +4,15 @@ RS.start();
|
|||||||
|
|
||||||
var api_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/api/v2/";
|
var api_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/api/v2/";
|
||||||
var filestreamer_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/fstream/";
|
var filestreamer_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/fstream/";
|
||||||
var upload_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/upload/";
|
var upload_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/upload/";
|
||||||
|
|
||||||
|
var extensions = {
|
||||||
|
mp3: "audio",
|
||||||
|
ogg: "audio",
|
||||||
|
wav: "audio",
|
||||||
|
webm: "video",
|
||||||
|
mp4: "video"
|
||||||
|
};
|
||||||
|
|
||||||
// livereload
|
// livereload
|
||||||
function start_live_reload()
|
function start_live_reload()
|
||||||
@ -558,7 +566,8 @@ var DownloadsWidget = React.createClass({
|
|||||||
widget.emit("play_file", {name: file.name, hash: file.hash})
|
widget.emit("play_file", {name: file.name, hash: file.hash})
|
||||||
};
|
};
|
||||||
var playBtn = <div></div>;
|
var playBtn = <div></div>;
|
||||||
if(file.name.slice(-3) === "mp3")
|
var splits = file.name.split(".");
|
||||||
|
if(splits[splits.length-1].toLowerCase() in extensions)
|
||||||
playBtn = <div className="btn" onClick={playFn}>play</div>;
|
playBtn = <div className="btn" onClick={playFn}>play</div>;
|
||||||
|
|
||||||
var ctrlBtn = <div></div>;
|
var ctrlBtn = <div></div>;
|
||||||
@ -571,7 +580,7 @@ var DownloadsWidget = React.createClass({
|
|||||||
ctrlBtn = <div className="btn" onClick={pauseFn}>pause</div>;
|
ctrlBtn = <div className="btn" onClick={pauseFn}>pause</div>;
|
||||||
}
|
}
|
||||||
return(<tr>
|
return(<tr>
|
||||||
<td>{this.props.data.name}</td>
|
<td><a className="filelink" target="_blank" href={filestreamer_url + this.props.data.hash + "/" + encodeURIComponent(this.props.data.name)}>{this.props.data.name}</a></td>
|
||||||
<td>{makeFriendlyUnit(this.props.data.size)}</td>
|
<td>{makeFriendlyUnit(this.props.data.size)}</td>
|
||||||
<td><ProgressBar progress={this.props.data.transfered / this.props.data.size}/></td>
|
<td><ProgressBar progress={this.props.data.transfered / this.props.data.size}/></td>
|
||||||
<td>{makeFriendlyUnit(this.props.data.transfer_rate*1e3)}/s</td>
|
<td>{makeFriendlyUnit(this.props.data.transfer_rate*1e3)}/s</td>
|
||||||
@ -673,7 +682,7 @@ var SearchWidget = React.createClass({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var AudioPlayerWidget = React.createClass({
|
var MediaPlayerWidget = React.createClass({
|
||||||
mixins: [SignalSlotMixin],
|
mixins: [SignalSlotMixin],
|
||||||
getInitialState: function(){
|
getInitialState: function(){
|
||||||
return {file: undefined};
|
return {file: undefined};
|
||||||
@ -691,13 +700,28 @@ var AudioPlayerWidget = React.createClass({
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return(
|
var splits = this.state.file.name.split(".");
|
||||||
<div>
|
var mediatype = extensions[splits[splits.length - 1].toLowerCase()];
|
||||||
<p>{this.state.file.name}</p>
|
if (mediatype == "audio") {
|
||||||
<audio controls src={filestreamer_url+this.state.file.hash} type="audio/mpeg">
|
return (
|
||||||
</audio>
|
<div>
|
||||||
</div>
|
<p>{this.state.file.name}</p>
|
||||||
);
|
<audio controls autoPlay src={filestreamer_url+this.state.file.hash}>
|
||||||
|
</audio>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else if (mediatype == "video") {
|
||||||
|
return(
|
||||||
|
<div>
|
||||||
|
<p>{this.state.file.name}</p>
|
||||||
|
<video height="300" controls autoPlay src={filestreamer_url+this.state.file.hash}>
|
||||||
|
Your browser does not support the video tag.
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return(<div></div>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -1467,7 +1491,7 @@ var ChatWidget = React.createClass({
|
|||||||
<ChatInfoWidget id={this.props.id}/>
|
<ChatInfoWidget id={this.props.id}/>
|
||||||
{
|
{
|
||||||
this.state.data.map(function(msg){
|
this.state.data.map(function(msg){
|
||||||
return <div key={msg.id}>{msg.send_time} {msg.author_name}: {markup(msg.msg, msg.links)}</div>;
|
return <div key={msg.id}>{new Date(msg.send_time*1000).toLocaleTimeString()} {msg.author_name}: {markup(msg.msg, msg.links)}</div>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
<input type="text" ref="input" onKeyDown={
|
<input type="text" ref="input" onKeyDown={
|
||||||
@ -1702,7 +1726,7 @@ var MainWidget = React.createClass({
|
|||||||
}
|
}
|
||||||
mainpage = <div>
|
mainpage = <div>
|
||||||
<UnreadChatMsgsCountWidget/>
|
<UnreadChatMsgsCountWidget/>
|
||||||
<AudioPlayerWidget/>
|
<MediaPlayerWidget/>
|
||||||
<IdentitySelectorWidget/>
|
<IdentitySelectorWidget/>
|
||||||
{mainpage}
|
{mainpage}
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "openssl/err.h"
|
#include "openssl/err.h"
|
||||||
|
|
||||||
#include "util/rsaes.h"
|
#include "util/rsaes.h"
|
||||||
|
#include "util/rsmemory.h"
|
||||||
|
|
||||||
#include <serialiser/rsmsgitems.h>
|
#include <serialiser/rsmsgitems.h>
|
||||||
|
|
||||||
@ -435,10 +436,6 @@ bool DistantChatService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mDistantChatMtx); /********** STACK LOCKED MTX ******/
|
RS_STACK_MUTEX(mDistantChatMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
uint32_t decrypted_size = RsAES::get_buffer_size(data_size-8);
|
|
||||||
uint8_t *decrypted_data = new uint8_t[decrypted_size];
|
|
||||||
uint8_t aes_key[DISTANT_CHAT_AES_KEY_SIZE] ;
|
|
||||||
|
|
||||||
std::map<RsPeerId,DistantChatDHInfo>::iterator it = _distant_chat_virtual_peer_ids.find(virtual_peer_id) ;
|
std::map<RsPeerId,DistantChatDHInfo>::iterator it = _distant_chat_virtual_peer_ids.find(virtual_peer_id) ;
|
||||||
|
|
||||||
if(it == _distant_chat_virtual_peer_ids.end())
|
if(it == _distant_chat_virtual_peer_ids.end())
|
||||||
@ -455,8 +452,11 @@ bool DistantChatService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||||||
std::cerr << "(EE) no GXS id data for ID=" << gxs_id << ". This is a bug." << std::endl;
|
std::cerr << "(EE) no GXS id data for ID=" << gxs_id << ". This is a bug." << std::endl;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
uint8_t aes_key[DISTANT_CHAT_AES_KEY_SIZE] ;
|
||||||
memcpy(aes_key,it2->second.aes_key,DISTANT_CHAT_AES_KEY_SIZE) ;
|
memcpy(aes_key,it2->second.aes_key,DISTANT_CHAT_AES_KEY_SIZE) ;
|
||||||
|
|
||||||
|
uint32_t decrypted_size = RsAES::get_buffer_size(data_size-8);
|
||||||
|
uint8_t *decrypted_data = new uint8_t[decrypted_size];
|
||||||
#ifdef DEBUG_DISTANT_CHAT
|
#ifdef DEBUG_DISTANT_CHAT
|
||||||
std::cerr << " Using IV: " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl;
|
std::cerr << " Using IV: " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl;
|
||||||
std::cerr << " Decrypted buffer size: " << decrypted_size << std::endl;
|
std::cerr << " Decrypted buffer size: " << decrypted_size << std::endl;
|
||||||
@ -540,7 +540,7 @@ void DistantChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t pubkey_size = BN_num_bytes(item->public_key) ;
|
uint32_t pubkey_size = BN_num_bytes(item->public_key) ;
|
||||||
unsigned char *data = (unsigned char *)malloc(pubkey_size) ;
|
RsTemporaryMemory data(pubkey_size) ;
|
||||||
BN_bn2bin(item->public_key, data) ;
|
BN_bn2bin(item->public_key, data) ;
|
||||||
|
|
||||||
RsTlvSecurityKey signature_key ;
|
RsTlvSecurityKey signature_key ;
|
||||||
@ -585,7 +585,7 @@ void DistantChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item)
|
|||||||
signature_key = item->gxs_key ;
|
signature_key = item->gxs_key ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!GxsSecurity::validateSignature((char*)data,pubkey_size,signature_key,item->signature))
|
if(!GxsSecurity::validateSignature((char*)(uint8_t*)data,pubkey_size,signature_key,item->signature))
|
||||||
{
|
{
|
||||||
std::cerr << "(SS) Signature was verified and it doesn't check! This is a security issue!" << std::endl;
|
std::cerr << "(SS) Signature was verified and it doesn't check! This is a security issue!" << std::endl;
|
||||||
return ;
|
return ;
|
||||||
@ -690,10 +690,10 @@ bool DistantChatService::locked_sendDHPublicKey(const DH *dh,const RsGxsId& own_
|
|||||||
uint32_t error_status ;
|
uint32_t error_status ;
|
||||||
|
|
||||||
uint32_t size = BN_num_bytes(dhitem->public_key) ;
|
uint32_t size = BN_num_bytes(dhitem->public_key) ;
|
||||||
unsigned char *data = (unsigned char *)malloc(size) ;
|
RsTemporaryMemory data(size) ;
|
||||||
BN_bn2bin(dhitem->public_key, data) ;
|
BN_bn2bin(dhitem->public_key, data) ;
|
||||||
|
|
||||||
if(!mGixs->signData((unsigned char*)data,size,own_gxs_id,signature,error_status))
|
if(!mGixs->signData(data,size,own_gxs_id,signature,error_status))
|
||||||
{
|
{
|
||||||
switch(error_status)
|
switch(error_status)
|
||||||
{
|
{
|
||||||
@ -702,11 +702,9 @@ bool DistantChatService::locked_sendDHPublicKey(const DH *dh,const RsGxsId& own_
|
|||||||
default: std::cerr << "(EE) Unknown error when signing" << std::endl;
|
default: std::cerr << "(EE) Unknown error when signing" << std::endl;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
free(data) ;
|
|
||||||
delete(dhitem);
|
delete(dhitem);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
free(data) ;
|
|
||||||
|
|
||||||
if(!mGixs->getKey(own_gxs_id,signature_key_public))
|
if(!mGixs->getKey(own_gxs_id,signature_key_public))
|
||||||
{
|
{
|
||||||
@ -810,19 +808,16 @@ void DistantChatService::sendTurtleData(RsChatItem *item)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t rssize = item->serial_size();
|
uint32_t rssize = item->serial_size();
|
||||||
uint8_t *buff = (uint8_t*)malloc(rssize) ;
|
RsTemporaryMemory buff(rssize) ;
|
||||||
|
|
||||||
if(!item->serialise(buff,rssize))
|
if(!item->serialise(buff,rssize))
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) DistantChatService::sendTurtleData(): Could not serialise item!" << std::endl;
|
std::cerr << "(EE) DistantChatService::sendTurtleData(): Could not serialise item!" << std::endl;
|
||||||
free(buff) ;
|
|
||||||
delete item ;
|
delete item ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendEncryptedTurtleData(buff,rssize,RsGxsId(item->PeerId())) ;
|
sendEncryptedTurtleData(buff,rssize,RsGxsId(item->PeerId())) ;
|
||||||
|
|
||||||
free(buff) ;
|
|
||||||
}
|
}
|
||||||
delete item ;
|
delete item ;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#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"
|
||||||
@ -168,13 +169,27 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
|||||||
{
|
{
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
|
|
||||||
if(!rsIdentity->getIdDetails(cli->signature.keyId,details) || !( details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
if(!rsIdentity->getIdDetails(cli->signature.keyId,details))
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
|
std::cerr << "(WW) cannot get ID " << cli->signature.keyId << " for checking signature of lobby item." << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (id=" << cli->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (id=" << cli->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(rsReputations->isIdentityBanned(cli->signature.keyId))
|
||||||
|
{
|
||||||
|
std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
if(!bounceLobbyObject(cli,cli->PeerId())) // forwards the message to friends, keeps track of subscribers, etc.
|
if(!bounceLobbyObject(cli,cli->PeerId())) // forwards the message to friends, keeps track of subscribers, etc.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -665,13 +680,26 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
|||||||
{
|
{
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
|
|
||||||
if(!rsIdentity->getIdDetails(item->signature.keyId,details) || !(details.mFlags & RS_IDENTITY_FLAGS_PGP_KNOWN))
|
if(!rsIdentity->getIdDetails(item->signature.keyId,details))
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
|
std::cerr << "(WW) cannot get ID " << item->signature.keyId << " for checking signature of lobby item." << std::endl;
|
||||||
|
#endif
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||||
{
|
{
|
||||||
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (ID=" << item->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
std::cerr << "(WW) Received a lobby msg/item that is not PGP-authed (ID=" << item->signature.keyId << "), whereas the lobby flags require it. Rejecting!" << std::endl;
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(rsReputations->isIdentityBanned(item->signature.keyId))
|
||||||
|
{
|
||||||
|
std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
addTimeShiftStatistics((int)now - (int)item->sendTime) ;
|
addTimeShiftStatistics((int)now - (int)item->sendTime) ;
|
||||||
|
|
||||||
if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||||
|
@ -175,6 +175,7 @@ HashCache::HashCache(const std::string& path)
|
|||||||
|
|
||||||
if(!f->good())
|
if(!f->good())
|
||||||
{
|
{
|
||||||
|
delete f ;
|
||||||
std::cerr << "Unencrypted file cache not present either." << std::endl;
|
std::cerr << "Unencrypted file cache not present either." << std::endl;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int bytesread = 0 ;
|
uint64_t bytesread = 0 ;
|
||||||
if(size != (bytesread = fread(compressed_data,1,size,file)))
|
if(size != (bytesread = fread(compressed_data,1,size,file)))
|
||||||
{
|
{
|
||||||
std::cerr << "FileIndex::loadIndex(): can't read " << size << " bytes from file " << filename << ". Only " << bytesread << " actually read." << std::endl;
|
std::cerr << "FileIndex::loadIndex(): can't read " << size << " bytes from file " << filename << ". Only " << bytesread << " actually read." << std::endl;
|
||||||
@ -1089,7 +1089,7 @@ int FileIndex::saveIndex(const std::string& filename, RsFileHash &fileHash, uint
|
|||||||
std::cerr << "FileIndex::saveIndex error opening file for writting: " << filename << ". Giving up." << std::endl;
|
std::cerr << "FileIndex::saveIndex error opening file for writting: " << filename << ". Giving up." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int outwritten ;
|
uint32_t outwritten ;
|
||||||
|
|
||||||
if(compressed_data_size != (outwritten=fwrite(compressed_data,1,compressed_data_size,file)))
|
if(compressed_data_size != (outwritten=fwrite(compressed_data,1,compressed_data_size,file)))
|
||||||
{
|
{
|
||||||
@ -1370,7 +1370,7 @@ void *FileIndex::findRef(const std::string& fpath) const
|
|||||||
std::cerr << "FileIndex::updateFileEntry() NULL parent";
|
std::cerr << "FileIndex::updateFileEntry() NULL parent";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
//#endif
|
//#endif
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
std::cerr << "Found parent directory: " << std::endl;
|
std::cerr << "Found parent directory: " << std::endl;
|
||||||
std::cerr << " parent.name = " << parent->name << std::endl;
|
std::cerr << " parent.name = " << parent->name << std::endl;
|
||||||
|
@ -96,7 +96,7 @@ void ChunkMap::setAvailabilityMap(const CompressedChunkMap& map)
|
|||||||
// do some sanity check
|
// do some sanity check
|
||||||
//
|
//
|
||||||
|
|
||||||
if( (((int)_map.size()-1)>>5) >= map._map.size() )
|
if( (((int)_map.size()-1)>>5) >= (int)map._map.size() )
|
||||||
{
|
{
|
||||||
std::cerr << "ChunkMap::setPeerAvailabilityMap: Compressed chunkmap received is too small or corrupted." << std::endl;
|
std::cerr << "ChunkMap::setPeerAvailabilityMap: Compressed chunkmap received is too small or corrupted." << std::endl;
|
||||||
return ;
|
return ;
|
||||||
|
@ -45,17 +45,18 @@ RsItem *RsGRouterSerialiser::deserialise(void *data, uint32_t *pktsize)
|
|||||||
|
|
||||||
switch(getRsItemSubType(rstype))
|
switch(getRsItemSubType(rstype))
|
||||||
{
|
{
|
||||||
case RS_PKT_SUBTYPE_GROUTER_DATA: return deserialise_RsGRouterGenericDataItem (data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_DATA: return deserialise_RsGRouterGenericDataItem (data, *pktsize);
|
||||||
case RS_PKT_SUBTYPE_GROUTER_TRANSACTION_CHUNK: return deserialise_RsGRouterTransactionChunkItem(data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_TRANSACTION_CHUNK: return deserialise_RsGRouterTransactionChunkItem(data, *pktsize);
|
||||||
case RS_PKT_SUBTYPE_GROUTER_TRANSACTION_ACKN: return deserialise_RsGRouterTransactionAcknItem (data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_TRANSACTION_ACKN: return deserialise_RsGRouterTransactionAcknItem (data, *pktsize);
|
||||||
case RS_PKT_SUBTYPE_GROUTER_SIGNED_RECEIPT: return deserialise_RsGRouterSignedReceiptItem (data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_SIGNED_RECEIPT: return deserialise_RsGRouterSignedReceiptItem (data, *pktsize);
|
||||||
case RS_PKT_SUBTYPE_GROUTER_MATRIX_CLUES: return deserialise_RsGRouterMatrixCluesItem (data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_MATRIX_CLUES: return deserialise_RsGRouterMatrixCluesItem (data, *pktsize);
|
||||||
case RS_PKT_SUBTYPE_GROUTER_FRIENDS_LIST: return deserialise_RsGRouterMatrixFriendListItem(data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_MATRIX_TRACK: return deserialise_RsGRouterMatrixTrackItem (data, *pktsize);
|
||||||
case RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO: return deserialise_RsGRouterRoutingInfoItem (data, *pktsize);
|
case RS_PKT_SUBTYPE_GROUTER_FRIENDS_LIST: return deserialise_RsGRouterMatrixFriendListItem(data, *pktsize);
|
||||||
|
case RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO: return deserialise_RsGRouterRoutingInfoItem (data, *pktsize);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::cerr << "RsGRouterSerialiser::deserialise(): Could not de-serialise item. SubPacket id = " << std::hex << getRsItemSubType(rstype) << " id = " << rstype << std::dec << std::endl;
|
std::cerr << "RsGRouterSerialiser::deserialise(): Could not de-serialise item. SubPacket id = " << std::hex << getRsItemSubType(rstype) << " id = " << rstype << std::dec << std::endl;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -269,6 +270,28 @@ RsGRouterMatrixFriendListItem *RsGRouterSerialiser::deserialise_RsGRouterMatrixF
|
|||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsGRouterMatrixTrackItem *RsGRouterSerialiser::deserialise_RsGRouterMatrixTrackItem(void *data, uint32_t pktsize) const
|
||||||
|
{
|
||||||
|
uint32_t offset = 8; // skip the header
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
bool ok = true ;
|
||||||
|
|
||||||
|
RsGRouterMatrixTrackItem *item = new RsGRouterMatrixTrackItem() ;
|
||||||
|
|
||||||
|
ok &= item->provider_id.deserialise(data, pktsize, offset) ;
|
||||||
|
ok &= item->message_id.deserialise(data,pktsize,offset) ;
|
||||||
|
ok &= getRawTimeT(data, pktsize, &offset, item->time_stamp) ;
|
||||||
|
|
||||||
|
if (offset != rssize || !ok)
|
||||||
|
{
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << ": error while deserialising! Item will be dropped." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
RsGRouterMatrixCluesItem *RsGRouterSerialiser::deserialise_RsGRouterMatrixCluesItem(void *data, uint32_t pktsize) const
|
RsGRouterMatrixCluesItem *RsGRouterSerialiser::deserialise_RsGRouterMatrixCluesItem(void *data, uint32_t pktsize) const
|
||||||
{
|
{
|
||||||
uint32_t offset = 8; // skip the header
|
uint32_t offset = 8; // skip the header
|
||||||
@ -559,6 +582,17 @@ uint32_t RsGRouterMatrixFriendListItem::serial_size() const
|
|||||||
|
|
||||||
return s ;
|
return s ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t RsGRouterMatrixTrackItem::serial_size() const
|
||||||
|
{
|
||||||
|
uint32_t s = 8 ; // header
|
||||||
|
s += 8 ; // time_stamp
|
||||||
|
s += RsPeerId::SIZE_IN_BYTES; // provider_id
|
||||||
|
s += RsMessageId::SIZE_IN_BYTES; // message_id
|
||||||
|
|
||||||
|
return s ;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t RsGRouterRoutingInfoItem::serial_size() const
|
uint32_t RsGRouterRoutingInfoItem::serial_size() const
|
||||||
{
|
{
|
||||||
uint32_t s = 8 ; // header
|
uint32_t s = 8 ; // header
|
||||||
@ -637,6 +671,26 @@ bool RsGRouterMatrixCluesItem::serialise(void *data,uint32_t& size) const
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RsGRouterMatrixTrackItem::serialise(void *data,uint32_t& size) const
|
||||||
|
{
|
||||||
|
uint32_t tlvsize,offset=0;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
if(!serialise_header(data,size,tlvsize,offset))
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
ok &= provider_id.serialise(data, tlvsize, offset) ;
|
||||||
|
ok &= message_id.serialise(data,tlvsize,offset) ;
|
||||||
|
ok &= setRawTimeT(data, tlvsize, &offset, time_stamp) ;
|
||||||
|
|
||||||
|
if (offset != tlvsize)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
std::cerr << "RsGRouterMatrixTrackItem::serialisedata() size error! " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
bool FriendTrialRecord::deserialise(void *data,uint32_t& offset,uint32_t size)
|
bool FriendTrialRecord::deserialise(void *data,uint32_t& offset,uint32_t size)
|
||||||
{
|
{
|
||||||
bool ok = true ;
|
bool ok = true ;
|
||||||
@ -701,6 +755,7 @@ bool RsGRouterRoutingInfoItem::serialise(void *data,uint32_t& size) const
|
|||||||
// ------------------------------------- IO --------------------------------------- //
|
// ------------------------------------- IO --------------------------------------- //
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
//
|
//
|
||||||
|
|
||||||
std::ostream& RsGRouterSignedReceiptItem::print(std::ostream& o, uint16_t)
|
std::ostream& RsGRouterSignedReceiptItem::print(std::ostream& o, uint16_t)
|
||||||
{
|
{
|
||||||
o << "RsGRouterReceiptItem:" << std::endl ;
|
o << "RsGRouterReceiptItem:" << std::endl ;
|
||||||
@ -746,6 +801,15 @@ std::ostream& RsGRouterRoutingInfoItem::print(std::ostream& o, uint16_t)
|
|||||||
return o ;
|
return o ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& RsGRouterMatrixTrackItem::print(std::ostream& o, uint16_t)
|
||||||
|
{
|
||||||
|
o << "RsGRouterMatrixTrackItem:" << std::endl ;
|
||||||
|
o << " provider_id: " << provider_id << std::endl;
|
||||||
|
o << " message_id: " << message_id << std::endl;
|
||||||
|
o << " time_stamp: " << time_stamp << std::endl;
|
||||||
|
|
||||||
|
return o ;
|
||||||
|
}
|
||||||
std::ostream& RsGRouterMatrixCluesItem::print(std::ostream& o, uint16_t)
|
std::ostream& RsGRouterMatrixCluesItem::print(std::ostream& o, uint16_t)
|
||||||
{
|
{
|
||||||
o << "RsGRouterMatrixCluesItem:" << std::endl ;
|
o << "RsGRouterMatrixCluesItem:" << std::endl ;
|
||||||
|
@ -33,20 +33,19 @@
|
|||||||
#include "retroshare/rsgrouter.h"
|
#include "retroshare/rsgrouter.h"
|
||||||
#include "groutermatrix.h"
|
#include "groutermatrix.h"
|
||||||
|
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_PUBLISH_KEY = 0x01 ; // used to publish a key
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_PUBLISH_KEY = 0x01 ; // used to publish a key
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_ACK_deprecated = 0x03 ; // don't use!
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_ACK_deprecated = 0x03 ; // don't use!
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_SIGNED_RECEIPT_deprecated = 0x04 ; // don't use!
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_SIGNED_RECEIPT_deprecated = 0x04 ; // don't use!
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_DATA_deprecated = 0x05 ; // don't use!
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_DATA_deprecated = 0x05 ; // don't use!
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_DATA_deprecated2 = 0x06 ; // don't use!
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_DATA_deprecated2 = 0x06 ; // don't use!
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_DATA = 0x07 ; // used to send data to a destination (Signed by source)
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_DATA = 0x07 ; // used to send data to a destination (Signed by source)
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_SIGNED_RECEIPT = 0x08 ; // long-distance acknowledgement of data received
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_SIGNED_RECEIPT = 0x08 ; // long-distance acknowledgement of data received
|
||||||
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_TRANSACTION_CHUNK = 0x10 ; // chunk of data. Used internally.
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_TRANSACTION_CHUNK = 0x10 ; // chunk of data. Used internally.
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_TRANSACTION_ACKN = 0x11 ; // acknowledge for finished transaction. Not necessary, but increases fiability.
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_TRANSACTION_ACKN = 0x11 ; // acknowledge for finished transaction. Not necessary, but increases fiability.
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_MATRIX_CLUES = 0x80 ; // item to save matrix clues
|
||||||
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_FRIENDS_LIST = 0x82 ; // item to save friend lists
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_MATRIX_CLUES = 0x80 ; // item to save matrix clues
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO = 0x93 ; //
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_FRIENDS_LIST = 0x82 ; // item to save friend lists
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_MATRIX_TRACK = 0x94 ; // item to save matrix track info
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO = 0x93 ; //
|
|
||||||
|
|
||||||
const uint8_t QOS_PRIORITY_RS_GROUTER = 4 ; // relevant for items that travel through friends
|
const uint8_t QOS_PRIORITY_RS_GROUTER = 4 ; // relevant for items that travel through friends
|
||||||
|
|
||||||
@ -243,6 +242,24 @@ class RsGRouterMatrixCluesItem: public RsGRouterItem
|
|||||||
std::list<RoutingMatrixHitEntry> clues ;
|
std::list<RoutingMatrixHitEntry> clues ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RsGRouterMatrixTrackItem: public RsGRouterItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsGRouterMatrixTrackItem() : RsGRouterItem(RS_PKT_SUBTYPE_GROUTER_MATRIX_TRACK)
|
||||||
|
{ setPriorityLevel(0) ; } // this item is never sent through the network
|
||||||
|
|
||||||
|
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||||
|
virtual uint32_t serial_size() const ;
|
||||||
|
|
||||||
|
virtual void clear() {}
|
||||||
|
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) ;
|
||||||
|
|
||||||
|
// packet data
|
||||||
|
//
|
||||||
|
RsGxsMessageId message_id ;
|
||||||
|
RsPeerId provider_id ;
|
||||||
|
time_t time_stamp ;
|
||||||
|
};
|
||||||
class RsGRouterMatrixFriendListItem: public RsGRouterItem
|
class RsGRouterMatrixFriendListItem: public RsGRouterItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -317,6 +334,7 @@ private:
|
|||||||
RsGRouterTransactionAcknItem *deserialise_RsGRouterTransactionAcknItem(void *data,uint32_t size) const ;
|
RsGRouterTransactionAcknItem *deserialise_RsGRouterTransactionAcknItem(void *data,uint32_t size) const ;
|
||||||
RsGRouterSignedReceiptItem *deserialise_RsGRouterSignedReceiptItem(void *data,uint32_t size) const ;
|
RsGRouterSignedReceiptItem *deserialise_RsGRouterSignedReceiptItem(void *data,uint32_t size) const ;
|
||||||
RsGRouterMatrixCluesItem *deserialise_RsGRouterMatrixCluesItem(void *data,uint32_t size) const ;
|
RsGRouterMatrixCluesItem *deserialise_RsGRouterMatrixCluesItem(void *data,uint32_t size) const ;
|
||||||
|
RsGRouterMatrixTrackItem *deserialise_RsGRouterMatrixTrackItem(void *data,uint32_t size) const ;
|
||||||
RsGRouterMatrixFriendListItem *deserialise_RsGRouterMatrixFriendListItem(void *data,uint32_t size) const ;
|
RsGRouterMatrixFriendListItem *deserialise_RsGRouterMatrixFriendListItem(void *data,uint32_t size) const ;
|
||||||
RsGRouterRoutingInfoItem *deserialise_RsGRouterRoutingInfoItem(void *data,uint32_t size) const ;
|
RsGRouterRoutingInfoItem *deserialise_RsGRouterRoutingInfoItem(void *data,uint32_t size) const ;
|
||||||
};
|
};
|
||||||
|
@ -34,6 +34,48 @@ GRouterMatrix::GRouterMatrix()
|
|||||||
_proba_need_updating = true ;
|
_proba_need_updating = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GRouterMatrix::addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& source_friend)
|
||||||
|
{
|
||||||
|
time_t now = time(NULL) ;
|
||||||
|
|
||||||
|
RoutingTrackEntry rte ;
|
||||||
|
|
||||||
|
rte.friend_id = source_friend ;
|
||||||
|
rte.time_stamp = now ;
|
||||||
|
|
||||||
|
_tracking_clues[mid] = rte ;
|
||||||
|
#ifdef ROUTING_MATRIX_DEBUG
|
||||||
|
std::cerr << "GRouterMatrix::addTrackingInfo(): Added clue mid=" << mid << ", from " << source_friend << " ID=" << source_friend << std::endl;
|
||||||
|
#endif
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GRouterMatrix::cleanUp()
|
||||||
|
{
|
||||||
|
// remove all tracking entries that have become too old.
|
||||||
|
|
||||||
|
#ifdef ROUTING_MATRIX_DEBUG
|
||||||
|
std::cerr << "GRouterMatrix::cleanup()" << std::endl;
|
||||||
|
#endif
|
||||||
|
time_t now = time(NULL) ;
|
||||||
|
|
||||||
|
for(std::map<RsGxsMessageId,RoutingTrackEntry>::iterator it(_tracking_clues.begin());it!=_tracking_clues.end();)
|
||||||
|
if(it->second.time_stamp + RS_GROUTER_MAX_KEEP_TRACKING_CLUES < now)
|
||||||
|
{
|
||||||
|
#ifdef ROUTING_MATRIX_DEBUG
|
||||||
|
std::cerr << " removing old entry msgId=" << it->first << ", from id " << it->second.friend_id << ", obtained " << (now - it->second.time_stamp) << " secs ago." << std::endl;
|
||||||
|
#endif
|
||||||
|
std::map<RsGxsMessageId,RoutingTrackEntry>::iterator tmp(it) ;
|
||||||
|
++tmp ;
|
||||||
|
_tracking_clues.erase(it) ;
|
||||||
|
it=tmp ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++it ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
bool GRouterMatrix::addRoutingClue(const GRouterKeyId& key_id,const RsPeerId& source_friend,float weight)
|
bool GRouterMatrix::addRoutingClue(const GRouterKeyId& key_id,const RsPeerId& source_friend,float weight)
|
||||||
{
|
{
|
||||||
// 1 - get the friend index.
|
// 1 - get the friend index.
|
||||||
@ -115,7 +157,19 @@ void GRouterMatrix::getListOfKnownKeys(std::vector<GRouterKeyId>& key_ids) const
|
|||||||
key_ids.clear() ;
|
key_ids.clear() ;
|
||||||
|
|
||||||
for(std::map<GRouterKeyId,std::vector<float> >::const_iterator it(_time_combined_hits.begin());it!=_time_combined_hits.end();++it)
|
for(std::map<GRouterKeyId,std::vector<float> >::const_iterator it(_time_combined_hits.begin());it!=_time_combined_hits.end();++it)
|
||||||
key_ids.push_back(it->first) ;
|
key_ids.push_back(it->first) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GRouterMatrix::getTrackingInfo(const RsGxsMessageId& mid, RsPeerId &source_friend)
|
||||||
|
{
|
||||||
|
std::map<RsGxsMessageId,RoutingTrackEntry>::const_iterator it = _tracking_clues.find(mid) ;
|
||||||
|
|
||||||
|
if(it == _tracking_clues.end())
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
source_friend = it->second.friend_id;
|
||||||
|
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRouterMatrix::debugDump() const
|
void GRouterMatrix::debugDump() const
|
||||||
@ -143,6 +197,10 @@ void GRouterMatrix::debugDump() const
|
|||||||
std::cerr << it->second[i] << " " ;
|
std::cerr << it->second[i] << " " ;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
std::cerr << " Tracking clues: " << std::endl;
|
||||||
|
|
||||||
|
for(std::map<RsGxsMessageId, RoutingTrackEntry>::const_iterator it(_tracking_clues.begin());it!=_tracking_clues.end();++it)
|
||||||
|
std::cerr << " " << it->first << ": from " << it->second.friend_id << " " << now - it->second.time_stamp << " secs ago." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GRouterMatrix::computeRoutingProbabilities(const GRouterKeyId& key_id, const std::vector<RsPeerId>& friends, std::vector<float>& probas) const
|
bool GRouterMatrix::computeRoutingProbabilities(const GRouterKeyId& key_id, const std::vector<RsPeerId>& friends, std::vector<float>& probas) const
|
||||||
@ -241,55 +299,78 @@ bool GRouterMatrix::saveList(std::list<RsItem*>& items)
|
|||||||
std::cerr << " GRoutingMatrix::saveList()" << std::endl;
|
std::cerr << " GRoutingMatrix::saveList()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RsGRouterMatrixFriendListItem *item = new RsGRouterMatrixFriendListItem ;
|
RsGRouterMatrixFriendListItem *item = new RsGRouterMatrixFriendListItem ;
|
||||||
|
|
||||||
item->reverse_friend_indices = _reverse_friend_indices ;
|
item->reverse_friend_indices = _reverse_friend_indices ;
|
||||||
items.push_back(item) ;
|
items.push_back(item) ;
|
||||||
|
|
||||||
for(std::map<GRouterKeyId,std::list<RoutingMatrixHitEntry> >::const_iterator it(_routing_clues.begin());it!=_routing_clues.end();++it)
|
for(std::map<GRouterKeyId,std::list<RoutingMatrixHitEntry> >::const_iterator it(_routing_clues.begin());it!=_routing_clues.end();++it)
|
||||||
{
|
{
|
||||||
RsGRouterMatrixCluesItem *item = new RsGRouterMatrixCluesItem ;
|
RsGRouterMatrixCluesItem *item = new RsGRouterMatrixCluesItem ;
|
||||||
|
|
||||||
item->destination_key = it->first ;
|
item->destination_key = it->first ;
|
||||||
item->clues = it->second ;
|
item->clues = it->second ;
|
||||||
|
|
||||||
items.push_back(item) ;
|
items.push_back(item) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
for(std::map<RsGxsMessageId,RoutingTrackEntry>::const_iterator it(_tracking_clues.begin());it!=_tracking_clues.end();++it)
|
||||||
|
{
|
||||||
|
RsGRouterMatrixTrackItem *item = new RsGRouterMatrixTrackItem ;
|
||||||
|
|
||||||
|
item->provider_id = it->second.friend_id ;
|
||||||
|
item->time_stamp = it->second.time_stamp ;
|
||||||
|
item->message_id = it->first ;
|
||||||
|
|
||||||
|
items.push_back(item) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
bool GRouterMatrix::loadList(std::list<RsItem*>& items)
|
bool GRouterMatrix::loadList(std::list<RsItem*>& items)
|
||||||
{
|
{
|
||||||
RsGRouterMatrixFriendListItem *itm1 = NULL ;
|
RsGRouterMatrixFriendListItem *itm1 = NULL ;
|
||||||
RsGRouterMatrixCluesItem *itm2 = NULL ;
|
RsGRouterMatrixCluesItem *itm2 = NULL ;
|
||||||
|
RsGRouterMatrixTrackItem *itm3 = NULL ;
|
||||||
|
|
||||||
#ifdef ROUTING_MATRIX_DEBUG
|
#ifdef ROUTING_MATRIX_DEBUG
|
||||||
std::cerr << " GRoutingMatrix::loadList()" << std::endl;
|
std::cerr << " GRoutingMatrix::loadList()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(std::list<RsItem*>::const_iterator it(items.begin());it!=items.end();++it)
|
for(std::list<RsItem*>::const_iterator it(items.begin());it!=items.end();++it)
|
||||||
{
|
{
|
||||||
if(NULL != (itm2 = dynamic_cast<RsGRouterMatrixCluesItem*>(*it)))
|
if(NULL != (itm3 = dynamic_cast<RsGRouterMatrixTrackItem*>(*it)))
|
||||||
{
|
{
|
||||||
#ifdef ROUTING_MATRIX_DEBUG
|
#ifdef ROUTING_MATRIX_DEBUG
|
||||||
std::cerr << " initing routing clues." << std::endl;
|
std::cerr << " initing tracking clues." << std::endl;
|
||||||
|
#endif
|
||||||
|
RoutingTrackEntry rte ;
|
||||||
|
rte.friend_id = itm3->provider_id ;
|
||||||
|
rte.time_stamp = itm3->time_stamp ;
|
||||||
|
|
||||||
|
_tracking_clues[itm3->message_id] = rte;
|
||||||
|
}
|
||||||
|
if(NULL != (itm2 = dynamic_cast<RsGRouterMatrixCluesItem*>(*it)))
|
||||||
|
{
|
||||||
|
#ifdef ROUTING_MATRIX_DEBUG
|
||||||
|
std::cerr << " initing routing clues." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_routing_clues[itm2->destination_key] = itm2->clues ;
|
_routing_clues[itm2->destination_key] = itm2->clues ;
|
||||||
_proba_need_updating = true ; // notifies to re-compute all the info.
|
_proba_need_updating = true ; // notifies to re-compute all the info.
|
||||||
}
|
}
|
||||||
if(NULL != (itm1 = dynamic_cast<RsGRouterMatrixFriendListItem*>(*it)))
|
if(NULL != (itm1 = dynamic_cast<RsGRouterMatrixFriendListItem*>(*it)))
|
||||||
{
|
{
|
||||||
_reverse_friend_indices = itm1->reverse_friend_indices ;
|
_reverse_friend_indices = itm1->reverse_friend_indices ;
|
||||||
_friend_indices.clear() ;
|
_friend_indices.clear() ;
|
||||||
|
|
||||||
for(uint32_t i=0;i<_reverse_friend_indices.size();++i)
|
for(uint32_t i=0;i<_reverse_friend_indices.size();++i)
|
||||||
_friend_indices[_reverse_friend_indices[i]] = i ;
|
_friend_indices[_reverse_friend_indices[i]] = i ;
|
||||||
|
|
||||||
_proba_need_updating = true ; // notifies to re-compute all the info.
|
_proba_need_updating = true ; // notifies to re-compute all the info.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,12 @@ struct RoutingMatrixHitEntry
|
|||||||
time_t time_stamp ;
|
time_t time_stamp ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RoutingTrackEntry
|
||||||
|
{
|
||||||
|
RsPeerId friend_id ; // not the full key. Gets too big otherwise!
|
||||||
|
time_t time_stamp ;
|
||||||
|
};
|
||||||
|
|
||||||
class GRouterMatrix
|
class GRouterMatrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -61,15 +67,19 @@ class GRouterMatrix
|
|||||||
// Record one routing clue. The events can possibly be merged in time buckets.
|
// Record one routing clue. The events can possibly be merged in time buckets.
|
||||||
//
|
//
|
||||||
bool addRoutingClue(const GRouterKeyId& id,const RsPeerId& source_friend,float weight) ;
|
bool addRoutingClue(const GRouterKeyId& id,const RsPeerId& source_friend,float weight) ;
|
||||||
|
bool addTrackingInfo(const RsGxsMessageId& id,const RsPeerId& source_friend) ;
|
||||||
|
|
||||||
bool saveList(std::list<RsItem*>& items) ;
|
bool saveList(std::list<RsItem*>& items) ;
|
||||||
bool loadList(std::list<RsItem*>& items) ;
|
bool loadList(std::list<RsItem*>& items) ;
|
||||||
|
|
||||||
|
bool cleanUp() ;
|
||||||
|
|
||||||
// Dump info in terminal.
|
// Dump info in terminal.
|
||||||
//
|
//
|
||||||
void debugDump() const ;
|
void debugDump() const ;
|
||||||
void getListOfKnownKeys(std::vector<GRouterKeyId>& key_ids) const ;
|
void getListOfKnownKeys(std::vector<GRouterKeyId>& key_ids) const ;
|
||||||
|
|
||||||
|
bool getTrackingInfo(const RsGxsMessageId& id,RsPeerId& source_friend);
|
||||||
private:
|
private:
|
||||||
// returns the friend id, possibly creating a new id.
|
// returns the friend id, possibly creating a new id.
|
||||||
//
|
//
|
||||||
@ -81,8 +91,9 @@ class GRouterMatrix
|
|||||||
|
|
||||||
// List of events received and computed routing probabilities
|
// List of events received and computed routing probabilities
|
||||||
//
|
//
|
||||||
std::map<GRouterKeyId, std::list<RoutingMatrixHitEntry> > _routing_clues ; // received routing clues. Should be saved.
|
std::map<GRouterKeyId, std::list<RoutingMatrixHitEntry> > _routing_clues ; // received routing clues. Should be saved.
|
||||||
std::map<GRouterKeyId, std::vector<float> > _time_combined_hits ; // hit matrix after time-convolution filter
|
std::map<GRouterKeyId, std::vector<float> > _time_combined_hits ; // hit matrix after time-convolution filter
|
||||||
|
std::map<RsGxsMessageId,RoutingTrackEntry> _tracking_clues ; // who provided the most recent messages
|
||||||
|
|
||||||
// This is used to avoid re-computing probas when new events have been received.
|
// This is used to avoid re-computing probas when new events have been received.
|
||||||
//
|
//
|
||||||
@ -93,6 +104,5 @@ class GRouterMatrix
|
|||||||
//
|
//
|
||||||
std::map<RsPeerId,uint32_t> _friend_indices ; // index for each friend to lookup in the routing matrix Not saved.
|
std::map<RsPeerId,uint32_t> _friend_indices ; // index for each friend to lookup in the routing matrix Not saved.
|
||||||
std::vector<RsPeerId> _reverse_friend_indices ;// SSLid corresponding to each friend index. Saved.
|
std::vector<RsPeerId> _reverse_friend_indices ;// SSLid corresponding to each friend index. Saved.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,9 +37,10 @@ class RsGRouterSignedReceiptItem ;
|
|||||||
|
|
||||||
static const uint16_t GROUTER_CLIENT_ID_MESSAGES = 0x1001 ;
|
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 = 5 ; // at most save config every 5 seconds
|
static const uint32_t RS_GROUTER_MIN_CONFIG_SAVE_PERIOD = 10 ; // 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 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
|
||||||
static const float RS_GROUTER_BASE_WEIGHT_GXS_PACKET = 0.1f ; // base contribution of GXS message to routing matrix
|
static const float RS_GROUTER_BASE_WEIGHT_GXS_PACKET = 0.1f ; // base contribution of GXS message to routing matrix
|
||||||
@ -56,7 +57,7 @@ static const uint32_t MAX_INACTIVE_DATA_PIPE_DELAY = 300 ; // cl
|
|||||||
|
|
||||||
static const time_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
static const time_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
||||||
static const time_t RS_GROUTER_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
static const time_t RS_GROUTER_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
||||||
static const time_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 1 *10 ; // Check for key advertising every 10 minutes
|
static const time_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 60*10 ; // Check for key advertising every 10 minutes
|
||||||
static const uint32_t GROUTER_ITEM_MAX_CACHE_KEEP_TIME = 2*86400 ; // Cached items are kept for 48 hours at most.
|
static const uint32_t GROUTER_ITEM_MAX_CACHE_KEEP_TIME = 2*86400 ; // Cached items are kept for 48 hours at most.
|
||||||
|
|
||||||
static const uint32_t RS_GROUTER_DATA_STATUS_UNKNOWN = 0x0000 ; // unknown. Unused.
|
static const uint32_t RS_GROUTER_DATA_STATUS_UNKNOWN = 0x0000 ; // unknown. Unused.
|
||||||
|
@ -252,6 +252,7 @@ int p3GRouter::tick()
|
|||||||
|
|
||||||
_last_matrix_update_time = now ;
|
_last_matrix_update_time = now ;
|
||||||
_routing_matrix.updateRoutingProbabilities() ; // This should be locked.
|
_routing_matrix.updateRoutingProbabilities() ; // This should be locked.
|
||||||
|
_routing_matrix.cleanUp() ; // This should be locked.
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GROUTER_DEBUG
|
#ifdef GROUTER_DEBUG
|
||||||
@ -1698,6 +1699,15 @@ bool p3GRouter::locked_getClientAndServiceId(const TurtleFileHash& hash, const R
|
|||||||
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) ;
|
||||||
@ -1705,6 +1715,7 @@ void p3GRouter::addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id)
|
|||||||
grouter_debug() << "Received new routing clue for key " << id << " from peer " << peer_id << std::endl;
|
grouter_debug() << "Received new routing clue for key " << id << " from peer " << peer_id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
_routing_matrix.addRoutingClue(id,peer_id,RS_GROUTER_BASE_WEIGHT_GXS_PACKET) ;
|
_routing_matrix.addRoutingClue(id,peer_id,RS_GROUTER_BASE_WEIGHT_GXS_PACKET) ;
|
||||||
|
_changed = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3GRouter::registerClientService(const GRouterServiceId& id,GRouterClientService *service)
|
bool p3GRouter::registerClientService(const GRouterServiceId& id,GRouterClientService *service)
|
||||||
@ -2154,6 +2165,13 @@ 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()
|
||||||
@ -2214,8 +2232,8 @@ void p3GRouter::debugDump()
|
|||||||
|
|
||||||
grouter_debug() << " Routing matrix: " << std::endl;
|
grouter_debug() << " Routing matrix: " << std::endl;
|
||||||
|
|
||||||
// if(_debug_enabled)
|
if(_debug_enabled)
|
||||||
// _routing_matrix.debugDump() ;
|
_routing_matrix.debugDump() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ 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 //
|
||||||
@ -167,6 +168,7 @@ 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 //
|
||||||
@ -223,7 +225,9 @@ private:
|
|||||||
void handleLowLevelTransactionAckItem(RsGRouterTransactionAcknItem*) ;
|
void handleLowLevelTransactionAckItem(RsGRouterTransactionAcknItem*) ;
|
||||||
|
|
||||||
static Sha1CheckSum computeDataItemHash(RsGRouterGenericDataItem *data_item);
|
static Sha1CheckSum computeDataItemHash(RsGRouterGenericDataItem *data_item);
|
||||||
|
#ifdef __APPLE__
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
class nullstream: public std::ostream {};
|
class nullstream: public std::ostream {};
|
||||||
|
|
||||||
std::ostream& grouter_debug() const
|
std::ostream& grouter_debug() const
|
||||||
@ -232,7 +236,9 @@ private:
|
|||||||
|
|
||||||
return _debug_enabled?(std::cerr):null;
|
return _debug_enabled?(std::cerr):null;
|
||||||
}
|
}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
void routePendingObjects() ;
|
void routePendingObjects() ;
|
||||||
void handleTunnels() ;
|
void handleTunnels() ;
|
||||||
void autoWash() ;
|
void autoWash() ;
|
||||||
@ -300,7 +306,6 @@ private:
|
|||||||
//
|
//
|
||||||
GRouterMatrix _routing_matrix ;
|
GRouterMatrix _routing_matrix ;
|
||||||
|
|
||||||
|
|
||||||
// Stores the keys which identify the router's node. For each key, a structure holds:
|
// Stores the keys which identify the router's node. For each key, a structure holds:
|
||||||
// - the client service
|
// - the client service
|
||||||
// - flags
|
// - flags
|
||||||
|
@ -551,7 +551,7 @@ bool GxsSecurity::decrypt(uint8_t *& out, uint32_t & outlen, const uint8_t *in,
|
|||||||
in_offset += size_net_ekl;
|
in_offset += size_net_ekl;
|
||||||
|
|
||||||
// Conservative limits to detect weird errors due to corrupted encoding.
|
// Conservative limits to detect weird errors due to corrupted encoding.
|
||||||
if(eklen < 0 || eklen > 512 || eklen+in_offset > inlen)
|
if(eklen < 0 || eklen > 512 || eklen+in_offset > (int)inlen)
|
||||||
{
|
{
|
||||||
std::cerr << "Error while deserialising encryption key length: eklen = " << std::dec << eklen << ". Giving up decryption." << std::endl;
|
std::cerr << "Error while deserialising encryption key length: eklen = " << std::dec << eklen << ". Giving up decryption." << std::endl;
|
||||||
free(ek);
|
free(ek);
|
||||||
@ -681,12 +681,25 @@ bool GxsSecurity::validateNxsGrp(const RsNxsGrp& grp, const RsTlvKeySignature& s
|
|||||||
EVP_VerifyInit(mdctx, EVP_sha1());
|
EVP_VerifyInit(mdctx, EVP_sha1());
|
||||||
EVP_VerifyUpdate(mdctx, allGrpData, allGrpDataLen);
|
EVP_VerifyUpdate(mdctx, allGrpData, allGrpDataLen);
|
||||||
int signOk = EVP_VerifyFinal(mdctx, sigbuf, siglen, signKey);
|
int signOk = EVP_VerifyFinal(mdctx, sigbuf, siglen, signKey);
|
||||||
|
EVP_MD_CTX_destroy(mdctx);
|
||||||
|
|
||||||
delete[] allGrpData ;
|
if(signOk != 1) // try previous API. This is a hack to accept groups previously signed with old APIs.
|
||||||
|
{
|
||||||
|
EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
|
||||||
|
|
||||||
|
EVP_VerifyInit(mdctx, EVP_sha1());
|
||||||
|
EVP_VerifyUpdate(mdctx, allGrpData, allGrpDataLen-4); // that means ommit the last
|
||||||
|
signOk = EVP_VerifyFinal(mdctx, sigbuf, siglen, signKey);
|
||||||
|
EVP_MD_CTX_destroy(mdctx);
|
||||||
|
|
||||||
|
if(signOk)
|
||||||
|
std::cerr << "(WW) GXS group with old API found. Signature still checks!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] allGrpData ;
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
EVP_PKEY_free(signKey);
|
EVP_PKEY_free(signKey);
|
||||||
EVP_MD_CTX_destroy(mdctx);
|
|
||||||
|
|
||||||
grpMeta.signSet = signSet;
|
grpMeta.signSet = signSet;
|
||||||
|
|
||||||
|
@ -49,19 +49,19 @@
|
|||||||
#define MSG_INDEX_GRPID std::string("INDEX_MESSAGES_GRPID")
|
#define MSG_INDEX_GRPID std::string("INDEX_MESSAGES_GRPID")
|
||||||
|
|
||||||
// generic
|
// generic
|
||||||
#define KEY_NXS_DATA std::string("nxsData")
|
#define KEY_NXS_DATA std::string("nxsData")
|
||||||
#define KEY_NXS_DATA_LEN std::string("nxsDataLen")
|
#define KEY_NXS_DATA_LEN std::string("nxsDataLen")
|
||||||
#define KEY_NXS_IDENTITY std::string("identity")
|
#define KEY_NXS_IDENTITY std::string("identity")
|
||||||
#define KEY_GRP_ID std::string("grpId")
|
#define KEY_GRP_ID std::string("grpId")
|
||||||
#define KEY_ORIG_GRP_ID std::string("origGrpId")
|
#define KEY_ORIG_GRP_ID std::string("origGrpId")
|
||||||
#define KEY_PARENT_GRP_ID std::string("parentGrpId")
|
#define KEY_PARENT_GRP_ID std::string("parentGrpId")
|
||||||
#define KEY_SIGN_SET std::string("signSet")
|
#define KEY_SIGN_SET std::string("signSet")
|
||||||
#define KEY_TIME_STAMP std::string("timeStamp")
|
#define KEY_TIME_STAMP std::string("timeStamp")
|
||||||
#define KEY_NXS_FLAGS std::string("flags")
|
#define KEY_NXS_FLAGS std::string("flags")
|
||||||
#define KEY_NXS_META std::string("meta")
|
#define KEY_NXS_META std::string("meta")
|
||||||
#define KEY_NXS_SERV_STRING std::string("serv_str")
|
#define KEY_NXS_SERV_STRING std::string("serv_str")
|
||||||
#define KEY_NXS_HASH std::string("hash")
|
#define KEY_NXS_HASH std::string("hash")
|
||||||
#define KEY_RECV_TS std::string("recv_time_stamp")
|
#define KEY_RECV_TS std::string("recv_time_stamp")
|
||||||
|
|
||||||
// remove later
|
// remove later
|
||||||
#define KEY_NXS_FILE_OLD std::string("nxsFile")
|
#define KEY_NXS_FILE_OLD std::string("nxsFile")
|
||||||
@ -94,8 +94,8 @@
|
|||||||
#define KEY_MSG_NAME std::string("msgName")
|
#define KEY_MSG_NAME std::string("msgName")
|
||||||
|
|
||||||
// msg local
|
// msg local
|
||||||
#define KEY_MSG_STATUS std::string("msgStatus")
|
#define KEY_MSG_STATUS std::string("msgStatus")
|
||||||
#define KEY_CHILD_TS std::string("childTs")
|
#define KEY_CHILD_TS std::string("childTs")
|
||||||
|
|
||||||
// database release columns
|
// database release columns
|
||||||
#define KEY_DATABASE_RELEASE_ID std::string("id")
|
#define KEY_DATABASE_RELEASE_ID std::string("id")
|
||||||
@ -129,22 +129,22 @@ RsDataService::RsDataService(const std::string &serviceDir, const std::string &d
|
|||||||
initialise(isNewDatabase);
|
initialise(isNewDatabase);
|
||||||
|
|
||||||
// for retrieving msg meta
|
// for retrieving msg meta
|
||||||
mColMsgMeta_GrpId = addColumn(mMsgMetaColumns, KEY_GRP_ID);
|
mColMsgMeta_GrpId = addColumn(mMsgMetaColumns, KEY_GRP_ID);
|
||||||
mColMsgMeta_TimeStamp = addColumn(mMsgMetaColumns, KEY_TIME_STAMP);
|
mColMsgMeta_TimeStamp = addColumn(mMsgMetaColumns, KEY_TIME_STAMP);
|
||||||
mColMsgMeta_NxsFlags = addColumn(mMsgMetaColumns, KEY_NXS_FLAGS);
|
mColMsgMeta_NxsFlags = addColumn(mMsgMetaColumns, KEY_NXS_FLAGS);
|
||||||
mColMsgMeta_SignSet = addColumn(mMsgMetaColumns, KEY_SIGN_SET);
|
mColMsgMeta_SignSet = addColumn(mMsgMetaColumns, KEY_SIGN_SET);
|
||||||
mColMsgMeta_NxsIdentity = addColumn(mMsgMetaColumns, KEY_NXS_IDENTITY);
|
mColMsgMeta_NxsIdentity = addColumn(mMsgMetaColumns, KEY_NXS_IDENTITY);
|
||||||
mColMsgMeta_NxsHash = addColumn(mMsgMetaColumns, KEY_NXS_HASH);
|
mColMsgMeta_NxsHash = addColumn(mMsgMetaColumns, KEY_NXS_HASH);
|
||||||
mColMsgMeta_MsgId = addColumn(mMsgMetaColumns, KEY_MSG_ID);
|
mColMsgMeta_MsgId = addColumn(mMsgMetaColumns, KEY_MSG_ID);
|
||||||
mColMsgMeta_OrigMsgId = addColumn(mMsgMetaColumns, KEY_ORIG_MSG_ID);
|
mColMsgMeta_OrigMsgId = addColumn(mMsgMetaColumns, KEY_ORIG_MSG_ID);
|
||||||
mColMsgMeta_MsgStatus = addColumn(mMsgMetaColumns, KEY_MSG_STATUS);
|
mColMsgMeta_MsgStatus = addColumn(mMsgMetaColumns, KEY_MSG_STATUS);
|
||||||
mColMsgMeta_ChildTs = addColumn(mMsgMetaColumns, KEY_CHILD_TS);
|
mColMsgMeta_ChildTs = addColumn(mMsgMetaColumns, KEY_CHILD_TS);
|
||||||
mColMsgMeta_MsgParentId = addColumn(mMsgMetaColumns, KEY_MSG_PARENT_ID);
|
mColMsgMeta_MsgParentId = addColumn(mMsgMetaColumns, KEY_MSG_PARENT_ID);
|
||||||
mColMsgMeta_MsgThreadId = addColumn(mMsgMetaColumns, KEY_MSG_THREAD_ID);
|
mColMsgMeta_MsgThreadId = addColumn(mMsgMetaColumns, KEY_MSG_THREAD_ID);
|
||||||
mColMsgMeta_Name = addColumn(mMsgMetaColumns, KEY_MSG_NAME);
|
mColMsgMeta_Name = addColumn(mMsgMetaColumns, KEY_MSG_NAME);
|
||||||
mColMsgMeta_NxsServString = addColumn(mMsgMetaColumns, KEY_NXS_SERV_STRING);
|
mColMsgMeta_NxsServString = addColumn(mMsgMetaColumns, KEY_NXS_SERV_STRING);
|
||||||
mColMsgMeta_RecvTs = addColumn(mMsgMetaColumns, KEY_RECV_TS);
|
mColMsgMeta_RecvTs = addColumn(mMsgMetaColumns, KEY_RECV_TS);
|
||||||
mColMsgMeta_NxsDataLen = addColumn(mMsgMetaColumns, KEY_NXS_DATA_LEN);
|
mColMsgMeta_NxsDataLen = addColumn(mMsgMetaColumns, KEY_NXS_DATA_LEN);
|
||||||
|
|
||||||
// for retrieving actual data
|
// for retrieving actual data
|
||||||
mColMsg_GrpId = addColumn(mMsgColumns, KEY_GRP_ID);
|
mColMsg_GrpId = addColumn(mMsgColumns, KEY_GRP_ID);
|
||||||
@ -152,38 +152,48 @@ RsDataService::RsDataService(const std::string &serviceDir, const std::string &d
|
|||||||
mColMsg_MetaData = addColumn(mMsgColumns, KEY_NXS_META);
|
mColMsg_MetaData = addColumn(mMsgColumns, KEY_NXS_META);
|
||||||
mColMsg_MsgId = addColumn(mMsgColumns, KEY_MSG_ID);
|
mColMsg_MsgId = addColumn(mMsgColumns, KEY_MSG_ID);
|
||||||
|
|
||||||
|
// for retrieving msg data with meta
|
||||||
|
mMsgColumnsWithMeta = mMsgColumns;
|
||||||
|
mColMsg_WithMetaOffset = mMsgColumnsWithMeta.size();
|
||||||
|
mMsgColumnsWithMeta.insert(mMsgColumnsWithMeta.end(), mMsgMetaColumns.begin(), mMsgMetaColumns.end());
|
||||||
|
|
||||||
// for retrieving grp meta data
|
// for retrieving grp meta data
|
||||||
mColGrpMeta_GrpId = addColumn(mGrpMetaColumns, KEY_GRP_ID);
|
mColGrpMeta_GrpId = addColumn(mGrpMetaColumns, KEY_GRP_ID);
|
||||||
mColGrpMeta_TimeStamp = addColumn(mGrpMetaColumns, KEY_TIME_STAMP);
|
mColGrpMeta_TimeStamp = addColumn(mGrpMetaColumns, KEY_TIME_STAMP);
|
||||||
mColGrpMeta_NxsFlags = addColumn(mGrpMetaColumns, KEY_NXS_FLAGS);
|
mColGrpMeta_NxsFlags = addColumn(mGrpMetaColumns, KEY_NXS_FLAGS);
|
||||||
// mColGrpMeta_SignSet = addColumn(mGrpMetaColumns, KEY_SIGN_SET);
|
// mColGrpMeta_SignSet = addColumn(mGrpMetaColumns, KEY_SIGN_SET);
|
||||||
mColGrpMeta_NxsIdentity = addColumn(mGrpMetaColumns, KEY_NXS_IDENTITY);
|
mColGrpMeta_NxsIdentity = addColumn(mGrpMetaColumns, KEY_NXS_IDENTITY);
|
||||||
mColGrpMeta_NxsHash = addColumn(mGrpMetaColumns, KEY_NXS_HASH);
|
mColGrpMeta_NxsHash = addColumn(mGrpMetaColumns, KEY_NXS_HASH);
|
||||||
mColGrpMeta_KeySet = addColumn(mGrpMetaColumns, KEY_KEY_SET);
|
mColGrpMeta_KeySet = addColumn(mGrpMetaColumns, KEY_KEY_SET);
|
||||||
mColGrpMeta_SubscrFlag = addColumn(mGrpMetaColumns, KEY_GRP_SUBCR_FLAG);
|
mColGrpMeta_SubscrFlag = addColumn(mGrpMetaColumns, KEY_GRP_SUBCR_FLAG);
|
||||||
mColGrpMeta_Pop = addColumn(mGrpMetaColumns, KEY_GRP_POP);
|
mColGrpMeta_Pop = addColumn(mGrpMetaColumns, KEY_GRP_POP);
|
||||||
mColGrpMeta_MsgCount = addColumn(mGrpMetaColumns, KEY_MSG_COUNT);
|
mColGrpMeta_MsgCount = addColumn(mGrpMetaColumns, KEY_MSG_COUNT);
|
||||||
mColGrpMeta_Status = addColumn(mGrpMetaColumns, KEY_GRP_STATUS);
|
mColGrpMeta_Status = addColumn(mGrpMetaColumns, KEY_GRP_STATUS);
|
||||||
mColGrpMeta_Name = addColumn(mGrpMetaColumns, KEY_GRP_NAME);
|
mColGrpMeta_Name = addColumn(mGrpMetaColumns, KEY_GRP_NAME);
|
||||||
mColGrpMeta_LastPost = addColumn(mGrpMetaColumns, KEY_GRP_LAST_POST);
|
mColGrpMeta_LastPost = addColumn(mGrpMetaColumns, KEY_GRP_LAST_POST);
|
||||||
mColGrpMeta_OrigGrpId = addColumn(mGrpMetaColumns, KEY_ORIG_GRP_ID);
|
mColGrpMeta_OrigGrpId = addColumn(mGrpMetaColumns, KEY_ORIG_GRP_ID);
|
||||||
mColGrpMeta_ServString = addColumn(mGrpMetaColumns, KEY_NXS_SERV_STRING);
|
mColGrpMeta_ServString = addColumn(mGrpMetaColumns, KEY_NXS_SERV_STRING);
|
||||||
mColGrpMeta_SignFlags = addColumn(mGrpMetaColumns, KEY_GRP_SIGN_FLAGS);
|
mColGrpMeta_SignFlags = addColumn(mGrpMetaColumns, KEY_GRP_SIGN_FLAGS);
|
||||||
mColGrpMeta_CircleId = addColumn(mGrpMetaColumns, KEY_GRP_CIRCLE_ID);
|
mColGrpMeta_CircleId = addColumn(mGrpMetaColumns, KEY_GRP_CIRCLE_ID);
|
||||||
mColGrpMeta_CircleType = addColumn(mGrpMetaColumns, KEY_GRP_CIRCLE_TYPE);
|
mColGrpMeta_CircleType = addColumn(mGrpMetaColumns, KEY_GRP_CIRCLE_TYPE);
|
||||||
mColGrpMeta_InternCircle = addColumn(mGrpMetaColumns, KEY_GRP_INTERNAL_CIRCLE);
|
mColGrpMeta_InternCircle = addColumn(mGrpMetaColumns, KEY_GRP_INTERNAL_CIRCLE);
|
||||||
mColGrpMeta_Originator = addColumn(mGrpMetaColumns, KEY_GRP_ORIGINATOR);
|
mColGrpMeta_Originator = addColumn(mGrpMetaColumns, KEY_GRP_ORIGINATOR);
|
||||||
mColGrpMeta_AuthenFlags = addColumn(mGrpMetaColumns, KEY_GRP_AUTHEN_FLAGS);
|
mColGrpMeta_AuthenFlags = addColumn(mGrpMetaColumns, KEY_GRP_AUTHEN_FLAGS);
|
||||||
mColGrpMeta_ParentGrpId = addColumn(mGrpMetaColumns, KEY_PARENT_GRP_ID);
|
mColGrpMeta_ParentGrpId = addColumn(mGrpMetaColumns, KEY_PARENT_GRP_ID);
|
||||||
mColGrpMeta_RecvTs = addColumn(mGrpMetaColumns, KEY_RECV_TS);
|
mColGrpMeta_RecvTs = addColumn(mGrpMetaColumns, KEY_RECV_TS);
|
||||||
mColGrpMeta_RepCutoff = addColumn(mGrpMetaColumns, KEY_GRP_REP_CUTOFF);
|
mColGrpMeta_RepCutoff = addColumn(mGrpMetaColumns, KEY_GRP_REP_CUTOFF);
|
||||||
mColGrpMeta_NxsDataLen = addColumn(mGrpMetaColumns, KEY_NXS_DATA_LEN);
|
mColGrpMeta_NxsDataLen = addColumn(mGrpMetaColumns, KEY_NXS_DATA_LEN);
|
||||||
|
|
||||||
// for retrieving actual grp data
|
// for retrieving actual grp data
|
||||||
mColGrp_GrpId = addColumn(mGrpColumns, KEY_GRP_ID);
|
mColGrp_GrpId = addColumn(mGrpColumns, KEY_GRP_ID);
|
||||||
mColGrp_NxsData = addColumn(mGrpColumns, KEY_NXS_DATA);
|
mColGrp_NxsData = addColumn(mGrpColumns, KEY_NXS_DATA);
|
||||||
mColGrp_MetaData = addColumn(mGrpColumns, KEY_NXS_META);
|
mColGrp_MetaData = addColumn(mGrpColumns, KEY_NXS_META);
|
||||||
|
|
||||||
|
// for retrieving grp data with meta
|
||||||
|
mGrpColumnsWithMeta = mGrpColumns;
|
||||||
|
mColGrp_WithMetaOffset = mGrpColumnsWithMeta.size();
|
||||||
|
mGrpColumnsWithMeta.insert(mGrpColumnsWithMeta.end(), mGrpMetaColumns.begin(), mGrpMetaColumns.end());
|
||||||
|
|
||||||
// Group id columns
|
// Group id columns
|
||||||
mColGrpId_GrpId = addColumn(mGrpIdColumn, KEY_GRP_ID);
|
mColGrpId_GrpId = addColumn(mGrpIdColumn, KEY_GRP_ID);
|
||||||
|
|
||||||
@ -474,7 +484,7 @@ bool RsDataService::finishReleaseUpdate(int release, bool result)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c, int colOffset)
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG
|
#ifdef RS_DATA_SERVICE_DEBUG
|
||||||
std::cerr << "RsDataService::locked_getGrpMeta()";
|
std::cerr << "RsDataService::locked_getGrpMeta()";
|
||||||
@ -492,27 +502,27 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
|||||||
|
|
||||||
// grpId
|
// grpId
|
||||||
std::string tempId;
|
std::string tempId;
|
||||||
c.getString(mColGrpMeta_GrpId, tempId);
|
c.getString(mColGrpMeta_GrpId + colOffset, tempId);
|
||||||
grpMeta->mGroupId = RsGxsGroupId(tempId);
|
grpMeta->mGroupId = RsGxsGroupId(tempId);
|
||||||
c.getString(mColGrpMeta_NxsIdentity, tempId);
|
c.getString(mColGrpMeta_NxsIdentity + colOffset, tempId);
|
||||||
grpMeta->mAuthorId = RsGxsId(tempId);
|
grpMeta->mAuthorId = RsGxsId(tempId);
|
||||||
|
|
||||||
c.getString(mColGrpMeta_Name, grpMeta->mGroupName);
|
c.getString(mColGrpMeta_Name + colOffset, grpMeta->mGroupName);
|
||||||
c.getString(mColGrpMeta_OrigGrpId, tempId);
|
c.getString(mColGrpMeta_OrigGrpId + colOffset, tempId);
|
||||||
grpMeta->mOrigGrpId = RsGxsGroupId(tempId);
|
grpMeta->mOrigGrpId = RsGxsGroupId(tempId);
|
||||||
c.getString(mColGrpMeta_ServString, grpMeta->mServiceString);
|
c.getString(mColGrpMeta_ServString + colOffset, grpMeta->mServiceString);
|
||||||
std::string temp;
|
std::string temp;
|
||||||
c.getString(mColGrpMeta_NxsHash, temp);
|
c.getString(mColGrpMeta_NxsHash + colOffset, temp);
|
||||||
grpMeta->mHash = RsFileHash(temp);
|
grpMeta->mHash = RsFileHash(temp);
|
||||||
grpMeta->mReputationCutOff = c.getInt32(mColGrpMeta_RepCutoff);
|
grpMeta->mReputationCutOff = c.getInt32(mColGrpMeta_RepCutoff + colOffset);
|
||||||
grpMeta->mSignFlags = c.getInt32(mColGrpMeta_SignFlags);
|
grpMeta->mSignFlags = c.getInt32(mColGrpMeta_SignFlags + colOffset);
|
||||||
|
|
||||||
grpMeta->mPublishTs = c.getInt32(mColGrpMeta_TimeStamp);
|
grpMeta->mPublishTs = c.getInt32(mColGrpMeta_TimeStamp + colOffset);
|
||||||
grpMeta->mGroupFlags = c.getInt32(mColGrpMeta_NxsFlags);
|
grpMeta->mGroupFlags = c.getInt32(mColGrpMeta_NxsFlags + colOffset);
|
||||||
grpMeta->mGrpSize = c.getInt32(mColGrpMeta_NxsDataLen);
|
grpMeta->mGrpSize = c.getInt32(mColGrpMeta_NxsDataLen + colOffset);
|
||||||
|
|
||||||
offset = 0; data = NULL; data_len = 0;
|
offset = 0; data = NULL; data_len = 0;
|
||||||
data = (char*)c.getData(mColGrpMeta_KeySet, data_len);
|
data = (char*)c.getData(mColGrpMeta_KeySet + colOffset, data_len);
|
||||||
|
|
||||||
if(data)
|
if(data)
|
||||||
ok &= grpMeta->keys.GetTlv(data, data_len, &offset);
|
ok &= grpMeta->keys.GetTlv(data, data_len, &offset);
|
||||||
@ -520,22 +530,22 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
|||||||
grpMeta->keys.TlvClear() ;
|
grpMeta->keys.TlvClear() ;
|
||||||
|
|
||||||
// local meta
|
// local meta
|
||||||
grpMeta->mSubscribeFlags = c.getInt32(mColGrpMeta_SubscrFlag);
|
grpMeta->mSubscribeFlags = c.getInt32(mColGrpMeta_SubscrFlag + colOffset);
|
||||||
grpMeta->mPop = c.getInt32(mColGrpMeta_Pop);
|
grpMeta->mPop = c.getInt32(mColGrpMeta_Pop + colOffset);
|
||||||
grpMeta->mVisibleMsgCount = c.getInt32(mColGrpMeta_MsgCount);
|
grpMeta->mVisibleMsgCount = c.getInt32(mColGrpMeta_MsgCount + colOffset);
|
||||||
grpMeta->mLastPost = c.getInt32(mColGrpMeta_LastPost);
|
grpMeta->mLastPost = c.getInt32(mColGrpMeta_LastPost + colOffset);
|
||||||
grpMeta->mGroupStatus = c.getInt32(mColGrpMeta_Status);
|
grpMeta->mGroupStatus = c.getInt32(mColGrpMeta_Status + colOffset);
|
||||||
|
|
||||||
c.getString(mColGrpMeta_CircleId, tempId);
|
c.getString(mColGrpMeta_CircleId + colOffset, tempId);
|
||||||
grpMeta->mCircleId = RsGxsCircleId(tempId);
|
grpMeta->mCircleId = RsGxsCircleId(tempId);
|
||||||
grpMeta->mCircleType = c.getInt32(mColGrpMeta_CircleType);
|
grpMeta->mCircleType = c.getInt32(mColGrpMeta_CircleType + colOffset);
|
||||||
c.getString(mColGrpMeta_InternCircle, tempId);
|
c.getString(mColGrpMeta_InternCircle + colOffset, tempId);
|
||||||
grpMeta->mInternalCircle = RsGxsCircleId(tempId);
|
grpMeta->mInternalCircle = RsGxsCircleId(tempId);
|
||||||
|
|
||||||
std::string s ; c.getString(mColGrpMeta_Originator, s) ;
|
std::string s ; c.getString(mColGrpMeta_Originator + colOffset, s) ;
|
||||||
grpMeta->mOriginator = RsPeerId(s);
|
grpMeta->mOriginator = RsPeerId(s);
|
||||||
grpMeta->mAuthenFlags = c.getInt32(mColGrpMeta_AuthenFlags);
|
grpMeta->mAuthenFlags = c.getInt32(mColGrpMeta_AuthenFlags + colOffset);
|
||||||
grpMeta->mRecvTS = c.getInt32(mColGrpMeta_RecvTs);
|
grpMeta->mRecvTS = c.getInt32(mColGrpMeta_RecvTs + colOffset);
|
||||||
|
|
||||||
|
|
||||||
c.getString(mColGrpMeta_ParentGrpId, tempId);
|
c.getString(mColGrpMeta_ParentGrpId, tempId);
|
||||||
@ -591,7 +601,7 @@ RsNxsGrp* RsDataService::locked_getGroup(RetroCursor &c)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
|
RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c, int colOffset)
|
||||||
{
|
{
|
||||||
|
|
||||||
RsGxsMsgMetaData* msgMeta = new RsGxsMsgMetaData();
|
RsGxsMsgMetaData* msgMeta = new RsGxsMsgMetaData();
|
||||||
@ -602,44 +612,43 @@ RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
|
|||||||
char* data = NULL;
|
char* data = NULL;
|
||||||
|
|
||||||
std::string gId;
|
std::string gId;
|
||||||
c.getString(mColMsgMeta_GrpId, gId);
|
c.getString(mColMsgMeta_GrpId + colOffset, gId);
|
||||||
msgMeta->mGroupId = RsGxsGroupId(gId);
|
msgMeta->mGroupId = RsGxsGroupId(gId);
|
||||||
std::string temp;
|
std::string temp;
|
||||||
c.getString(mColMsgMeta_MsgId, temp);
|
c.getString(mColMsgMeta_MsgId + colOffset, temp);
|
||||||
msgMeta->mMsgId = RsGxsMessageId(temp);
|
msgMeta->mMsgId = RsGxsMessageId(temp);
|
||||||
// without these, a msg is meaningless
|
// without these, a msg is meaningless
|
||||||
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
|
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
|
||||||
|
|
||||||
c.getString(mColMsgMeta_OrigMsgId, temp);
|
c.getString(mColMsgMeta_OrigMsgId + colOffset, temp);
|
||||||
msgMeta->mOrigMsgId = RsGxsMessageId(temp);
|
msgMeta->mOrigMsgId = RsGxsMessageId(temp);
|
||||||
c.getString(mColMsgMeta_NxsIdentity, temp);
|
c.getString(mColMsgMeta_NxsIdentity + colOffset, temp);
|
||||||
msgMeta->mAuthorId = RsGxsId(temp);
|
msgMeta->mAuthorId = RsGxsId(temp);
|
||||||
c.getString(mColMsgMeta_Name, msgMeta->mMsgName);
|
c.getString(mColMsgMeta_Name + colOffset, msgMeta->mMsgName);
|
||||||
c.getString(mColMsgMeta_NxsServString, msgMeta->mServiceString);
|
c.getString(mColMsgMeta_NxsServString + colOffset, msgMeta->mServiceString);
|
||||||
|
|
||||||
c.getString(mColMsgMeta_NxsHash, temp);
|
c.getString(mColMsgMeta_NxsHash + colOffset, temp);
|
||||||
msgMeta->mHash = RsFileHash(temp);
|
msgMeta->mHash = RsFileHash(temp);
|
||||||
msgMeta->recvTS = c.getInt32(mColMsgMeta_RecvTs);
|
msgMeta->recvTS = c.getInt32(mColMsgMeta_RecvTs + colOffset);
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
data = (char*)c.getData(mColMsgMeta_SignSet, data_len);
|
data = (char*)c.getData(mColMsgMeta_SignSet + colOffset, data_len);
|
||||||
msgMeta->signSet.GetTlv(data, data_len, &offset);
|
msgMeta->signSet.GetTlv(data, data_len, &offset);
|
||||||
msgMeta->mMsgSize = c.getInt32(mColMsgMeta_NxsDataLen);
|
msgMeta->mMsgSize = c.getInt32(mColMsgMeta_NxsDataLen + colOffset);
|
||||||
|
|
||||||
msgMeta->mMsgFlags = c.getInt32(mColMsgMeta_NxsFlags);
|
msgMeta->mMsgFlags = c.getInt32(mColMsgMeta_NxsFlags + colOffset);
|
||||||
msgMeta->mPublishTs = c.getInt32(mColMsgMeta_TimeStamp);
|
msgMeta->mPublishTs = c.getInt32(mColMsgMeta_TimeStamp + colOffset);
|
||||||
|
|
||||||
offset = 0; data_len = 0;
|
offset = 0; data_len = 0;
|
||||||
|
|
||||||
// thread and parent id
|
// thread and parent id
|
||||||
c.getString(mColMsgMeta_MsgThreadId, temp);
|
c.getString(mColMsgMeta_MsgThreadId + colOffset, temp);
|
||||||
msgMeta->mThreadId = RsGxsMessageId(temp);
|
msgMeta->mThreadId = RsGxsMessageId(temp);
|
||||||
c.getString(mColMsgMeta_MsgParentId, temp);
|
c.getString(mColMsgMeta_MsgParentId + colOffset, temp);
|
||||||
msgMeta->mParentId = RsGxsMessageId(temp);
|
msgMeta->mParentId = RsGxsMessageId(temp);
|
||||||
|
|
||||||
// local meta
|
// local meta
|
||||||
msgMeta->mMsgStatus = c.getInt32(mColMsgMeta_MsgStatus);
|
msgMeta->mMsgStatus = c.getInt32(mColMsgMeta_MsgStatus + colOffset);
|
||||||
msgMeta->mChildTs = c.getInt32(mColMsgMeta_ChildTs);
|
msgMeta->mChildTs = c.getInt32(mColMsgMeta_ChildTs + colOffset);
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
return msgMeta;
|
return msgMeta;
|
||||||
@ -1020,13 +1029,13 @@ int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool
|
|||||||
if(grp.empty()){
|
if(grp.empty()){
|
||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpColumns, "", "");
|
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, withMeta ? mGrpColumnsWithMeta : mGrpColumns, "", "");
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
std::vector<RsNxsGrp*> grps;
|
std::vector<RsNxsGrp*> grps;
|
||||||
|
|
||||||
locked_retrieveGroups(c, grps);
|
locked_retrieveGroups(c, grps, withMeta ? mColGrp_WithMetaOffset : 0);
|
||||||
std::vector<RsNxsGrp*>::iterator vit = grps.begin();
|
std::vector<RsNxsGrp*>::iterator vit = grps.begin();
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
@ -1051,12 +1060,12 @@ int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool
|
|||||||
for(; mit != grp.end(); ++mit)
|
for(; mit != grp.end(); ++mit)
|
||||||
{
|
{
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpColumns, "grpId='" + grpId.toStdString() + "'", "");
|
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, withMeta ? mGrpColumnsWithMeta : mGrpColumns, "grpId='" + grpId.toStdString() + "'", "");
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
std::vector<RsNxsGrp*> grps;
|
std::vector<RsNxsGrp*> grps;
|
||||||
locked_retrieveGroups(c, grps);
|
locked_retrieveGroups(c, grps, withMeta ? mColGrp_WithMetaOffset : 0);
|
||||||
|
|
||||||
if(!grps.empty())
|
if(!grps.empty())
|
||||||
{
|
{
|
||||||
@ -1085,38 +1094,10 @@ int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool
|
|||||||
std::cerr << "RsDataService::retrieveNxsGrps() " << mDbName << ", Requests: " << requestedGroups << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
|
std::cerr << "RsDataService::retrieveNxsGrps() " << mDbName << ", Requests: " << requestedGroups << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(withMeta && !grp.empty())
|
|
||||||
{
|
|
||||||
std::map<RsGxsGroupId, RsGxsGrpMetaData*> metaMap;
|
|
||||||
std::map<RsGxsGroupId, RsNxsGrp *>::iterator mit = grp.begin();
|
|
||||||
for(; mit != grp.end(); ++mit)
|
|
||||||
metaMap.insert(std::make_pair(mit->first, (RsGxsGrpMetaData*)(NULL)));
|
|
||||||
|
|
||||||
retrieveGxsGrpMetaData(metaMap);
|
|
||||||
|
|
||||||
mit = grp.begin();
|
|
||||||
for(; mit != grp.end(); ++mit)
|
|
||||||
{
|
|
||||||
RsNxsGrp* grpPtr = grp[mit->first];
|
|
||||||
grpPtr->metaData = metaMap[mit->first];
|
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG
|
|
||||||
std::cerr << "RsDataService::retrieveNxsGrps() GrpId: " << mit->first.toStdString();
|
|
||||||
std::cerr << " CircleType: " << (uint32_t) grpPtr->metaData->mCircleType;
|
|
||||||
std::cerr << " CircleId: " << grpPtr->metaData->mCircleId.toStdString();
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
|
||||||
std::cerr << "RsDataService::retrieveNxsGrps() " << mDbName << ", Time with meta: " << timer.duration() << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps){
|
void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps, int metaOffset){
|
||||||
|
|
||||||
if(c){
|
if(c){
|
||||||
bool valid = c->moveToFirst();
|
bool valid = c->moveToFirst();
|
||||||
@ -1127,6 +1108,9 @@ void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>
|
|||||||
// only add the latest grp info
|
// only add the latest grp info
|
||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
|
if (metaOffset) {
|
||||||
|
g->metaData = locked_getGrpMeta(*c, metaOffset);
|
||||||
|
}
|
||||||
grps.push_back(g);
|
grps.push_back(g);
|
||||||
}
|
}
|
||||||
valid = c->moveToNext();
|
valid = c->moveToNext();
|
||||||
@ -1143,8 +1127,6 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
|||||||
|
|
||||||
GxsMsgReq::const_iterator mit = reqIds.begin();
|
GxsMsgReq::const_iterator mit = reqIds.begin();
|
||||||
|
|
||||||
GxsMsgReq metaReqIds;// collects metaReqIds if needed
|
|
||||||
|
|
||||||
for(; mit != reqIds.end(); ++mit)
|
for(; mit != reqIds.end(); ++mit)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1158,15 +1140,11 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
|||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
|
|
||||||
RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", "");
|
RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, withMeta ? mMsgColumnsWithMeta : mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", "");
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
locked_retrieveMessages(c, msgSet);
|
locked_retrieveMessages(c, msgSet, withMeta ? mColMsg_WithMetaOffset : 0);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
|
||||||
resultCount += msgSet.size();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete c;
|
delete c;
|
||||||
@ -1180,36 +1158,24 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
|||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
|
|
||||||
RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString()
|
RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, withMeta ? mMsgColumnsWithMeta : mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString()
|
||||||
+ "' AND " + KEY_MSG_ID + "='" + msgId.toStdString() + "'", "");
|
+ "' AND " + KEY_MSG_ID + "='" + msgId.toStdString() + "'", "");
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
locked_retrieveMessages(c, msgSet);
|
locked_retrieveMessages(c, msgSet, withMeta ? mColMsg_WithMetaOffset : 0);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
|
||||||
resultCount += c->getResultCount();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
|
resultCount += msgSet.size();
|
||||||
|
#endif
|
||||||
|
|
||||||
msg[grpId] = msgSet;
|
msg[grpId] = msgSet;
|
||||||
|
|
||||||
if(withMeta)
|
|
||||||
{
|
|
||||||
std::vector<RsGxsMessageId> msgIds;
|
|
||||||
|
|
||||||
std::vector<RsNxsMsg*>::iterator lit = msgSet.begin(),
|
|
||||||
lit_end = msgSet.end();
|
|
||||||
|
|
||||||
for(; lit != lit_end; ++lit)
|
|
||||||
msgIds.push_back( (*lit)->msgId );
|
|
||||||
|
|
||||||
metaReqIds[grpId] = msgIds;
|
|
||||||
}
|
|
||||||
msgSet.clear();
|
msgSet.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,73 +1183,19 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
|||||||
std::cerr << "RsDataService::retrieveNxsMsgs() " << mDbName << ", Requests: " << reqIds.size() << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
|
std::cerr << "RsDataService::retrieveNxsMsgs() " << mDbName << ", Requests: " << reqIds.size() << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// tres expensive !?
|
|
||||||
if(withMeta)
|
|
||||||
{
|
|
||||||
|
|
||||||
GxsMsgMetaResult metaResult;
|
|
||||||
|
|
||||||
// request with meta ids so there is no chance of
|
|
||||||
// a mem leak being left over
|
|
||||||
retrieveGxsMsgMetaData(metaReqIds, metaResult);
|
|
||||||
|
|
||||||
GxsMsgResult::iterator mit2 = msg.begin(), mit2_end = msg.end();
|
|
||||||
|
|
||||||
for(; mit2 != mit2_end; ++mit2)
|
|
||||||
{
|
|
||||||
const RsGxsGroupId& grpId = mit2->first;
|
|
||||||
std::vector<RsNxsMsg*>& msgV = msg[grpId];
|
|
||||||
std::vector<RsNxsMsg*>::iterator lit = msgV.begin(),
|
|
||||||
lit_end = msgV.end();
|
|
||||||
|
|
||||||
// as retrieval only attempts to retrieve what was found this elimiates chance
|
|
||||||
// of a memory fault as all are assigned
|
|
||||||
for(; lit != lit_end; ++lit)
|
|
||||||
{
|
|
||||||
std::vector<RsGxsMsgMetaData*>& msgMetaV = metaResult[grpId];
|
|
||||||
std::vector<RsGxsMsgMetaData*>::iterator meta_lit = msgMetaV.begin();
|
|
||||||
RsNxsMsg* msgPtr = *lit;
|
|
||||||
for(; meta_lit != msgMetaV.end(); )
|
|
||||||
{
|
|
||||||
RsGxsMsgMetaData* meta = *meta_lit;
|
|
||||||
if(meta->mMsgId == msgPtr->msgId)
|
|
||||||
{
|
|
||||||
msgPtr->metaData = meta;
|
|
||||||
meta_lit = msgMetaV.erase(meta_lit);
|
|
||||||
}else{
|
|
||||||
++meta_lit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<RsGxsMsgMetaData*>& msgMetaV = metaResult[grpId];
|
|
||||||
std::vector<RsGxsMsgMetaData*>::iterator meta_lit;
|
|
||||||
|
|
||||||
// clean up just in case, should not go in here
|
|
||||||
for(meta_lit = msgMetaV.begin(); meta_lit !=
|
|
||||||
msgMetaV.end(); )
|
|
||||||
{
|
|
||||||
RsGxsMsgMetaData* meta = *meta_lit;
|
|
||||||
delete meta;
|
|
||||||
meta_lit = msgMetaV.erase(meta_lit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
|
||||||
std::cerr << "RsDataService::retrieveNxsMsgs() " << mDbName << ", Time with meta: " << timer.duration() << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsDataService::locked_retrieveMessages(RetroCursor *c, std::vector<RsNxsMsg *> &msgs)
|
void RsDataService::locked_retrieveMessages(RetroCursor *c, std::vector<RsNxsMsg *> &msgs, int metaOffset)
|
||||||
{
|
{
|
||||||
bool valid = c->moveToFirst();
|
bool valid = c->moveToFirst();
|
||||||
while(valid){
|
while(valid){
|
||||||
RsNxsMsg* m = locked_getMessage(*c);
|
RsNxsMsg* m = locked_getMessage(*c);
|
||||||
|
|
||||||
if(m){
|
if(m){
|
||||||
|
if (metaOffset) {
|
||||||
|
m->metaData = locked_getMsgMeta(*c, metaOffset);
|
||||||
|
}
|
||||||
msgs.push_back(m);
|
msgs.push_back(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,10 +1230,6 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
locked_retrieveMsgMeta(c, metaSet);
|
locked_retrieveMsgMeta(c, metaSet);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
|
||||||
resultCount += metaSet.size();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -1336,14 +1244,14 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
locked_retrieveMsgMeta(c, metaSet);
|
locked_retrieveMsgMeta(c, metaSet);
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
|
||||||
resultCount += c->getResultCount();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
|
resultCount += metaSet.size();
|
||||||
|
#endif
|
||||||
|
|
||||||
msgMeta[grpId] = metaSet;
|
msgMeta[grpId] = metaSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1361,7 +1269,7 @@ void RsDataService::locked_retrieveMsgMeta(RetroCursor *c, std::vector<RsGxsMsgM
|
|||||||
{
|
{
|
||||||
bool valid = c->moveToFirst();
|
bool valid = c->moveToFirst();
|
||||||
while(valid){
|
while(valid){
|
||||||
RsGxsMsgMetaData* m = locked_getMsgMeta(*c);
|
RsGxsMsgMetaData* m = locked_getMsgMeta(*c, 0);
|
||||||
|
|
||||||
if(m != NULL)
|
if(m != NULL)
|
||||||
msgMeta.push_back(m);
|
msgMeta.push_back(m);
|
||||||
@ -1402,7 +1310,7 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
|
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
RsGxsGrpMetaData* g = locked_getGrpMeta(*c);
|
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
grp[g->mGroupId] = g;
|
grp[g->mGroupId] = g;
|
||||||
@ -1431,7 +1339,7 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
|||||||
|
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
RsGxsGrpMetaData* g = locked_getGrpMeta(*c);
|
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
||||||
|
|
||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
|
@ -181,14 +181,15 @@ private:
|
|||||||
* @param c cursor to result set
|
* @param c cursor to result set
|
||||||
* @param msgs messages retrieved from cursor are stored here
|
* @param msgs messages retrieved from cursor are stored here
|
||||||
*/
|
*/
|
||||||
void locked_retrieveMessages(RetroCursor* c, std::vector<RsNxsMsg*>& msgs);
|
void locked_retrieveMessages(RetroCursor* c, std::vector<RsNxsMsg*>& msgs, int metaOffset);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Retrieves all the grp results from a cursor
|
* Retrieves all the grp results from a cursor
|
||||||
* @param c cursor to result set
|
* @param c cursor to result set
|
||||||
* @param grps groups retrieved from cursor are stored here
|
* @param grps groups retrieved from cursor are stored here
|
||||||
|
* @param withMeta this initialise the metaData member of the nxsgroups retrieved
|
||||||
*/
|
*/
|
||||||
void locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps);
|
void locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps, int metaOffset);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Retrieves all the msg meta results from a cursor
|
* Retrieves all the msg meta results from a cursor
|
||||||
@ -201,13 +202,13 @@ private:
|
|||||||
* extracts a msg meta item from a cursor at its
|
* extracts a msg meta item from a cursor at its
|
||||||
* current position
|
* current position
|
||||||
*/
|
*/
|
||||||
RsGxsMsgMetaData* locked_getMsgMeta(RetroCursor& c);
|
RsGxsMsgMetaData* locked_getMsgMeta(RetroCursor& c, int colOffset);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* extracts a grp meta item from a cursor at its
|
* extracts a grp meta item from a cursor at its
|
||||||
* current position
|
* current position
|
||||||
*/
|
*/
|
||||||
RsGxsGrpMetaData* locked_getGrpMeta(RetroCursor& c);
|
RsGxsGrpMetaData* locked_getGrpMeta(RetroCursor& c, int colOffset);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* extracts a msg item from a cursor at its
|
* extracts a msg item from a cursor at its
|
||||||
@ -257,10 +258,12 @@ private:
|
|||||||
|
|
||||||
std::list<std::string> mMsgColumns;
|
std::list<std::string> mMsgColumns;
|
||||||
std::list<std::string> mMsgMetaColumns;
|
std::list<std::string> mMsgMetaColumns;
|
||||||
|
std::list<std::string> mMsgColumnsWithMeta;
|
||||||
std::list<std::string> mMsgIdColumn;
|
std::list<std::string> mMsgIdColumn;
|
||||||
|
|
||||||
std::list<std::string> mGrpColumns;
|
std::list<std::string> mGrpColumns;
|
||||||
std::list<std::string> mGrpMetaColumns;
|
std::list<std::string> mGrpMetaColumns;
|
||||||
|
std::list<std::string> mGrpColumnsWithMeta;
|
||||||
std::list<std::string> mGrpIdColumn;
|
std::list<std::string> mGrpIdColumn;
|
||||||
|
|
||||||
// Message meta column
|
// Message meta column
|
||||||
@ -287,6 +290,9 @@ private:
|
|||||||
int mColMsg_MetaData;
|
int mColMsg_MetaData;
|
||||||
int mColMsg_MsgId;
|
int mColMsg_MsgId;
|
||||||
|
|
||||||
|
// Message columns with meta
|
||||||
|
int mColMsg_WithMetaOffset;
|
||||||
|
|
||||||
// Group meta columns
|
// Group meta columns
|
||||||
int mColGrpMeta_GrpId;
|
int mColGrpMeta_GrpId;
|
||||||
int mColGrpMeta_TimeStamp;
|
int mColGrpMeta_TimeStamp;
|
||||||
@ -319,6 +325,9 @@ private:
|
|||||||
int mColGrp_NxsData;
|
int mColGrp_NxsData;
|
||||||
int mColGrp_MetaData;
|
int mColGrp_MetaData;
|
||||||
|
|
||||||
|
// Group columns with meta
|
||||||
|
int mColGrp_WithMetaOffset;
|
||||||
|
|
||||||
// Group id columns
|
// Group id columns
|
||||||
int mColGrpId_GrpId;
|
int mColGrpId_GrpId;
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include "retroshare/rsgxsflags.h"
|
#include "retroshare/rsgxsflags.h"
|
||||||
#include "retroshare/rsgxscircles.h"
|
#include "retroshare/rsgxscircles.h"
|
||||||
#include "retroshare/rsgrouter.h"
|
#include "retroshare/rsgrouter.h"
|
||||||
|
#include "retroshare/rsidentity.h"
|
||||||
|
#include "retroshare/rspeers.h"
|
||||||
#include "rsgixs.h"
|
#include "rsgixs.h"
|
||||||
#include "rsgxsutil.h"
|
#include "rsgxsutil.h"
|
||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
@ -49,6 +51,14 @@
|
|||||||
#define PRIV_GRP_OFFSET 16
|
#define PRIV_GRP_OFFSET 16
|
||||||
#define GRP_OPTIONS_OFFSET 24
|
#define GRP_OPTIONS_OFFSET 24
|
||||||
|
|
||||||
|
// Authentication key indices. Used to store them in a map
|
||||||
|
// these where originally flags, but used as indexes. Still, we need
|
||||||
|
// to keep their old values to ensure backward compatibility.
|
||||||
|
|
||||||
|
static const uint32_t INDEX_AUTHEN_IDENTITY = 0x00000010; // identity
|
||||||
|
static const uint32_t INDEX_AUTHEN_PUBLISH = 0x00000020; // publish key
|
||||||
|
static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key
|
||||||
|
|
||||||
#define GXS_MASK "GXS_MASK_HACK"
|
#define GXS_MASK "GXS_MASK_HACK"
|
||||||
|
|
||||||
//#define GEN_EXCH_DEBUG 1
|
//#define GEN_EXCH_DEBUG 1
|
||||||
@ -416,7 +426,7 @@ uint8_t RsGenExchange::createGroup(RsNxsGrp *grp, RsTlvSecurityKeySet& privateKe
|
|||||||
bool ok = GxsSecurity::getSignature(allGrpData, allGrpDataLen, privAdminKey, adminSign);
|
bool ok = GxsSecurity::getSignature(allGrpData, allGrpDataLen, privAdminKey, adminSign);
|
||||||
|
|
||||||
// add admin sign to grpMeta
|
// add admin sign to grpMeta
|
||||||
meta->signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_ADMIN] = adminSign;
|
meta->signSet.keySignSet[INDEX_AUTHEN_ADMIN] = adminSign;
|
||||||
|
|
||||||
RsTlvBinaryData grpData(mServType);
|
RsTlvBinaryData grpData(mServType);
|
||||||
grpData.setBinData(allGrpData, allGrpDataLen);
|
grpData.setBinData(allGrpData, allGrpDataLen);
|
||||||
@ -462,8 +472,10 @@ int RsGenExchange::createGroupSignatures(RsTlvKeySignatureSet& signSet, RsTlvBin
|
|||||||
if ((!grpMeta.mAuthorId.isNull()) || checkAuthenFlag(pos, author_flag))
|
if ((!grpMeta.mAuthorId.isNull()) || checkAuthenFlag(pos, author_flag))
|
||||||
{
|
{
|
||||||
needIdentitySign = true;
|
needIdentitySign = true;
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "Needs Identity sign! (Service Flags)";
|
std::cerr << "Needs Identity sign! (Service Flags)";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needIdentitySign)
|
if (needIdentitySign)
|
||||||
@ -494,25 +506,29 @@ int RsGenExchange::createGroupSignatures(RsTlvKeySignatureSet& signSet, RsTlvBin
|
|||||||
id_ret = SIGN_FAIL;
|
id_ret = SIGN_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_IDENTITY] = sign;
|
signSet.keySignSet[INDEX_AUTHEN_IDENTITY] = sign;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mGixs->requestPrivateKey(grpMeta.mAuthorId);
|
mGixs->requestPrivateKey(grpMeta.mAuthorId);
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::createGroupSignatures(): ";
|
std::cerr << "RsGenExchange::createGroupSignatures(): ";
|
||||||
std::cerr << " ERROR AUTHOR KEY: " << grpMeta.mAuthorId
|
std::cerr << " ERROR AUTHOR KEY: " << grpMeta.mAuthorId
|
||||||
<< " is not Cached / available for Message Signing\n";
|
<< " is not Cached / available for Message Signing\n";
|
||||||
std::cerr << "RsGenExchange::createGroupSignatures(): Requestiong AUTHOR KEY";
|
std::cerr << "RsGenExchange::createGroupSignatures(): Requestiong AUTHOR KEY";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
id_ret = SIGN_FAIL_TRY_LATER;
|
id_ret = SIGN_FAIL_TRY_LATER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::createGroupSignatures()";
|
std::cerr << "RsGenExchange::createGroupSignatures()";
|
||||||
std::cerr << "Gixs not enabled while request identity signature validation!" << std::endl;
|
std::cerr << "Gixs not enabled while request identity signature validation!" << std::endl;
|
||||||
|
#endif
|
||||||
id_ret = SIGN_FAIL;
|
id_ret = SIGN_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,8 +548,10 @@ int RsGenExchange::createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBinar
|
|||||||
|
|
||||||
bool publishSignSuccess = false;
|
bool publishSignSuccess = false;
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::createMsgSignatures() for Msg.mMsgName: " << msgMeta.mMsgName;
|
std::cerr << "RsGenExchange::createMsgSignatures() for Msg.mMsgName: " << msgMeta.mMsgName;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// publish signature is determined by whether group is public or not
|
// publish signature is determined by whether group is public or not
|
||||||
@ -568,23 +586,29 @@ int RsGenExchange::createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBinar
|
|||||||
if (checkAuthenFlag(pos, publish_flag))
|
if (checkAuthenFlag(pos, publish_flag))
|
||||||
{
|
{
|
||||||
needPublishSign = true;
|
needPublishSign = true;
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "Needs Publish sign! (Service Flags)";
|
std::cerr << "Needs Publish sign! (Service Flags)";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check required permissions, and allow them to sign it - if they want too - as well!
|
// Check required permissions, and allow them to sign it - if they want too - as well!
|
||||||
if (checkAuthenFlag(pos, author_flag))
|
if (checkAuthenFlag(pos, author_flag))
|
||||||
{
|
{
|
||||||
needIdentitySign = true;
|
needIdentitySign = true;
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "Needs Identity sign! (Service Flags)";
|
std::cerr << "Needs Identity sign! (Service Flags)";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!msgMeta.mAuthorId.isNull())
|
if (!msgMeta.mAuthorId.isNull())
|
||||||
{
|
{
|
||||||
needIdentitySign = true;
|
needIdentitySign = true;
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "Needs Identity sign! (AuthorId Exists)";
|
std::cerr << "Needs Identity sign! (AuthorId Exists)";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(needPublishSign)
|
if(needPublishSign)
|
||||||
@ -609,12 +633,12 @@ int RsGenExchange::createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBinar
|
|||||||
// private publish key
|
// private publish key
|
||||||
publishKey = &(mit->second);
|
publishKey = &(mit->second);
|
||||||
|
|
||||||
RsTlvKeySignature publishSign = signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_PUBLISH];
|
RsTlvKeySignature publishSign = signSet.keySignSet[INDEX_AUTHEN_PUBLISH];
|
||||||
|
|
||||||
publishSignSuccess = GxsSecurity::getSignature((char*)msgData.bin_data, msgData.bin_len, *publishKey, publishSign);
|
publishSignSuccess = GxsSecurity::getSignature((char*)msgData.bin_data, msgData.bin_len, *publishKey, publishSign);
|
||||||
|
|
||||||
//place signature in msg meta
|
//place signature in msg meta
|
||||||
signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_PUBLISH] = publishSign;
|
signSet.keySignSet[INDEX_AUTHEN_PUBLISH] = publishSign;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
std::cerr << "RsGenExchange::createMsgSignatures()";
|
std::cerr << "RsGenExchange::createMsgSignatures()";
|
||||||
@ -653,25 +677,29 @@ int RsGenExchange::createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBinar
|
|||||||
id_ret = SIGN_FAIL;
|
id_ret = SIGN_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_IDENTITY] = sign;
|
signSet.keySignSet[INDEX_AUTHEN_IDENTITY] = sign;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mGixs->requestPrivateKey(msgMeta.mAuthorId);
|
mGixs->requestPrivateKey(msgMeta.mAuthorId);
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::createMsgSignatures(): ";
|
std::cerr << "RsGenExchange::createMsgSignatures(): ";
|
||||||
std::cerr << " ERROR AUTHOR KEY: " << msgMeta.mAuthorId
|
std::cerr << " ERROR AUTHOR KEY: " << msgMeta.mAuthorId
|
||||||
<< " is not Cached / available for Message Signing\n";
|
<< " is not Cached / available for Message Signing\n";
|
||||||
std::cerr << "RsGenExchange::createMsgSignatures(): Requestiong AUTHOR KEY";
|
std::cerr << "RsGenExchange::createMsgSignatures(): Requestiong AUTHOR KEY";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
id_ret = SIGN_FAIL_TRY_LATER;
|
id_ret = SIGN_FAIL_TRY_LATER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::createMsgSignatures()";
|
std::cerr << "RsGenExchange::createMsgSignatures()";
|
||||||
std::cerr << "Gixs not enabled while request identity signature validation!" << std::endl;
|
std::cerr << "Gixs not enabled while request identity signature validation!" << std::endl;
|
||||||
|
#endif
|
||||||
id_ret = SIGN_FAIL;
|
id_ret = SIGN_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,7 +791,7 @@ int RsGenExchange::createMessage(RsNxsMsg* msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, RsTlvSecurityKeySet& grpKeySet)
|
int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, const uint32_t& signFlag, RsTlvSecurityKeySet& grpKeySet)
|
||||||
{
|
{
|
||||||
bool needIdentitySign = false;
|
bool needIdentitySign = false;
|
||||||
bool needPublishSign = false;
|
bool needPublishSign = false;
|
||||||
@ -796,12 +824,16 @@ int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, RsTlvSecu
|
|||||||
if ((checkAuthenFlag(pos, author_flag)) || (!msg->metaData->mAuthorId.isNull()))
|
if ((checkAuthenFlag(pos, author_flag)) || (!msg->metaData->mAuthorId.isNull()))
|
||||||
needIdentitySign = true;
|
needIdentitySign = true;
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << "Validate message: msgId=" << msg->msgId << ", grpId=" << msg->grpId << " grpFlags=" << std::hex << grpFlag << std::dec
|
||||||
|
<< ". Need publish=" << needPublishSign << ", needIdentitySign=" << needIdentitySign ;
|
||||||
|
#endif
|
||||||
|
|
||||||
RsGxsMsgMetaData& metaData = *(msg->metaData);
|
RsGxsMsgMetaData& metaData = *(msg->metaData);
|
||||||
|
|
||||||
if(needPublishSign)
|
if(needPublishSign)
|
||||||
{
|
{
|
||||||
RsTlvKeySignature sign = metaData.signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_PUBLISH];
|
RsTlvKeySignature sign = metaData.signSet.keySignSet[INDEX_AUTHEN_PUBLISH];
|
||||||
|
|
||||||
std::map<RsGxsId, RsTlvSecurityKey>& keys = grpKeySet.keys;
|
std::map<RsGxsId, RsTlvSecurityKey>& keys = grpKeySet.keys;
|
||||||
std::map<RsGxsId, RsTlvSecurityKey>::iterator mit = keys.begin();
|
std::map<RsGxsId, RsTlvSecurityKey>::iterator mit = keys.begin();
|
||||||
@ -849,31 +881,67 @@ int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, RsTlvSecu
|
|||||||
bool haveKey = mGixs->haveKey(metaData.mAuthorId);
|
bool haveKey = mGixs->haveKey(metaData.mAuthorId);
|
||||||
|
|
||||||
if(haveKey)
|
if(haveKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
RsTlvSecurityKey authorKey;
|
RsTlvSecurityKey authorKey;
|
||||||
bool auth_key_fetched = mGixs->getKey(metaData.mAuthorId, authorKey) ;
|
bool auth_key_fetched = mGixs->getKey(metaData.mAuthorId, authorKey) ;
|
||||||
|
|
||||||
if (auth_key_fetched)
|
if (auth_key_fetched)
|
||||||
|
{
|
||||||
|
RsTlvKeySignature sign = metaData.signSet.keySignSet[INDEX_AUTHEN_IDENTITY];
|
||||||
|
idValidate &= GxsSecurity::validateNxsMsg(*msg, sign, authorKey);
|
||||||
|
mGixs->timeStampKey(metaData.mAuthorId) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "RsGenExchange::validateMsg()";
|
||||||
|
std::cerr << " ERROR Cannot Retrieve AUTHOR KEY for Message Validation";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
idValidate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(idValidate)
|
||||||
|
{
|
||||||
|
// get key data and check that the key is actually PGP-linked. If not, reject the post.
|
||||||
|
|
||||||
|
RsIdentityDetails details ;
|
||||||
|
|
||||||
|
if(!mGixs->getIdDetails(metaData.mAuthorId,details))
|
||||||
|
{
|
||||||
|
// the key cannot ke reached, although it's in cache. Weird situation.
|
||||||
|
std::cerr << "RsGenExchange::validateMsg(): cannot get key data for ID=" << metaData.mAuthorId << ", although it's supposed to be already in cache. Cannot validate." << std::endl;
|
||||||
|
idValidate = false ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// 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) ;
|
||||||
|
|
||||||
|
if(details.mReputation.mOverallReputationScore < reputation_threshold)
|
||||||
{
|
{
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
RsTlvKeySignature sign = metaData.signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_IDENTITY];
|
std::cerr << "RsGenExchange::validateMsg(): message from " << metaData.mAuthorId << ", rejected because reputation score (" << details.mReputation.mOverallReputationScore <<") is below the accepted threshold (" << reputation_threshold << ")" << std::endl;
|
||||||
idValidate &= GxsSecurity::validateNxsMsg(*msg, sign, authorKey);
|
#endif
|
||||||
mGixs->timeStampKey(metaData.mAuthorId) ;
|
idValidate = false ;
|
||||||
}
|
}
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
else
|
else
|
||||||
{
|
std::cerr << "RsGenExchange::validateMsg(): message from " << metaData.mAuthorId << ", accepted. Reputation score (" << details.mReputation.mOverallReputationScore <<") is above accepted threshold (" << reputation_threshold << ")" << std::endl;
|
||||||
std::cerr << "RsGenExchange::validateMsg()";
|
#endif
|
||||||
std::cerr << " ERROR Cannot Retrieve AUTHOR KEY for Message Validation";
|
}
|
||||||
std::cerr << std::endl;
|
|
||||||
idValidate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}else
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
std::list<RsPeerId> peers;
|
std::list<RsPeerId> peers;
|
||||||
peers.push_back(msg->PeerId());
|
peers.push_back(msg->PeerId());
|
||||||
mGixs->requestKey(metaData.mAuthorId, peers);
|
mGixs->requestKey(metaData.mAuthorId, peers);
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << ", Key missing. Retry later." << std::endl;
|
||||||
|
#endif
|
||||||
return VALIDATE_FAIL_TRY_LATER;
|
return VALIDATE_FAIL_TRY_LATER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,6 +958,10 @@ int RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, RsTlvSecu
|
|||||||
idValidate = true;
|
idValidate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << ", publish val=" << publishValidate << ", idValidate=" << idValidate << ". Result=" << (publishValidate && idValidate) << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(publishValidate && idValidate)
|
if(publishValidate && idValidate)
|
||||||
return VALIDATE_SUCCESS;
|
return VALIDATE_SUCCESS;
|
||||||
else
|
else
|
||||||
@ -911,8 +983,10 @@ int RsGenExchange::validateGrp(RsNxsGrp* grp)
|
|||||||
if ((!metaData.mAuthorId.isNull()) || checkAuthenFlag(pos, author_flag))
|
if ((!metaData.mAuthorId.isNull()) || checkAuthenFlag(pos, author_flag))
|
||||||
{
|
{
|
||||||
needIdentitySign = true;
|
needIdentitySign = true;
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "Needs Identity sign! (Service Flags)";
|
std::cerr << "Needs Identity sign! (Service Flags)";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(needIdentitySign)
|
if(needIdentitySign)
|
||||||
@ -930,7 +1004,7 @@ int RsGenExchange::validateGrp(RsNxsGrp* grp)
|
|||||||
if (auth_key_fetched)
|
if (auth_key_fetched)
|
||||||
{
|
{
|
||||||
|
|
||||||
RsTlvKeySignature sign = metaData.signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_IDENTITY];
|
RsTlvKeySignature sign = metaData.signSet.keySignSet[INDEX_AUTHEN_IDENTITY];
|
||||||
idValidate = GxsSecurity::validateNxsGrp(*grp, sign, authorKey);
|
idValidate = GxsSecurity::validateNxsGrp(*grp, sign, authorKey);
|
||||||
|
|
||||||
mGixs->timeStampKey(metaData.mAuthorId) ;
|
mGixs->timeStampKey(metaData.mAuthorId) ;
|
||||||
@ -1135,7 +1209,6 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaDat
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RsGenExchange::getMsgMeta(const uint32_t &token,
|
bool RsGenExchange::getMsgMeta(const uint32_t &token,
|
||||||
GxsMsgMetaMap &msgInfo)
|
GxsMsgMetaMap &msgInfo)
|
||||||
{
|
{
|
||||||
@ -1152,7 +1225,6 @@ bool RsGenExchange::getMsgMeta(const uint32_t &token,
|
|||||||
{
|
{
|
||||||
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
|
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
|
||||||
|
|
||||||
msgInfo[mit->first] = std::vector<RsMsgMetaData>();
|
|
||||||
std::vector<RsMsgMetaData>& msgInfoV = msgInfo[mit->first];
|
std::vector<RsMsgMetaData>& msgInfoV = msgInfo[mit->first];
|
||||||
|
|
||||||
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
|
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
|
||||||
@ -1181,7 +1253,6 @@ bool RsGenExchange::getMsgRelatedMeta(const uint32_t &token, GxsMsgRelatedMetaMa
|
|||||||
{
|
{
|
||||||
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
|
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
|
||||||
|
|
||||||
msgMeta[mit->first] = std::vector<RsMsgMetaData>();
|
|
||||||
std::vector<RsMsgMetaData>& msgInfoV = msgMeta[mit->first];
|
std::vector<RsMsgMetaData>& msgInfoV = msgMeta[mit->first];
|
||||||
|
|
||||||
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
|
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
|
||||||
@ -1265,14 +1336,14 @@ bool RsGenExchange::getMsgData(const uint32_t &token, GxsMsgDataMap &msgItems)
|
|||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
NxsMsgDataResult msgResult;
|
NxsMsgDataResult msgResult;
|
||||||
bool ok = mDataAccess->getMsgData(token, msgResult);
|
bool ok = mDataAccess->getMsgData(token, msgResult);
|
||||||
NxsMsgDataResult::iterator mit = msgResult.begin();
|
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
|
NxsMsgDataResult::iterator mit = msgResult.begin();
|
||||||
for(; mit != msgResult.end(); ++mit)
|
for(; mit != msgResult.end(); ++mit)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsMsgItem*> gxsMsgItems;
|
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
|
std::vector<RsGxsMsgItem*>& gxsMsgItems = msgItems[grpId];
|
||||||
std::vector<RsNxsMsg*>& nxsMsgsV = mit->second;
|
std::vector<RsNxsMsg*>& nxsMsgsV = mit->second;
|
||||||
std::vector<RsNxsMsg*>::iterator vit = nxsMsgsV.begin();
|
std::vector<RsNxsMsg*>::iterator vit = nxsMsgsV.begin();
|
||||||
for(; vit != nxsMsgsV.end(); ++vit)
|
for(; vit != nxsMsgsV.end(); ++vit)
|
||||||
@ -1305,7 +1376,6 @@ bool RsGenExchange::getMsgData(const uint32_t &token, GxsMsgDataMap &msgItems)
|
|||||||
}
|
}
|
||||||
delete msg;
|
delete msg;
|
||||||
}
|
}
|
||||||
msgItems[grpId] = gxsMsgItems;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -1317,17 +1387,15 @@ bool RsGenExchange::getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMa
|
|||||||
NxsMsgRelatedDataResult msgResult;
|
NxsMsgRelatedDataResult msgResult;
|
||||||
bool ok = mDataAccess->getMsgRelatedData(token, msgResult);
|
bool ok = mDataAccess->getMsgRelatedData(token, msgResult);
|
||||||
|
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
NxsMsgRelatedDataResult::iterator mit = msgResult.begin();
|
NxsMsgRelatedDataResult::iterator mit = msgResult.begin();
|
||||||
for(; mit != msgResult.end(); ++mit)
|
for(; mit != msgResult.end(); ++mit)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsMsgItem*> gxsMsgItems;
|
|
||||||
const RsGxsGrpMsgIdPair& msgId = mit->first;
|
const RsGxsGrpMsgIdPair& msgId = mit->first;
|
||||||
|
std::vector<RsGxsMsgItem*> &gxsMsgItems = msgItems[msgId];
|
||||||
std::vector<RsNxsMsg*>& nxsMsgsV = mit->second;
|
std::vector<RsNxsMsg*>& nxsMsgsV = mit->second;
|
||||||
std::vector<RsNxsMsg*>::iterator vit
|
std::vector<RsNxsMsg*>::iterator vit = nxsMsgsV.begin();
|
||||||
= nxsMsgsV.begin();
|
|
||||||
for(; vit != nxsMsgsV.end(); ++vit)
|
for(; vit != nxsMsgsV.end(); ++vit)
|
||||||
{
|
{
|
||||||
RsNxsMsg*& msg = *vit;
|
RsNxsMsg*& msg = *vit;
|
||||||
@ -1360,15 +1428,11 @@ bool RsGenExchange::getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMa
|
|||||||
|
|
||||||
delete msg;
|
delete msg;
|
||||||
}
|
}
|
||||||
msgItems[msgId] = gxsMsgItems;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RsTokenService* RsGenExchange::getTokenService()
|
RsTokenService* RsGenExchange::getTokenService()
|
||||||
{
|
{
|
||||||
return mDataAccess;
|
return mDataAccess;
|
||||||
@ -1763,8 +1827,10 @@ bool RsGenExchange::processGrpMask(const RsGxsGroupId& grpId, ContentValue &grpC
|
|||||||
grpMeta = mit->second;
|
grpMeta = mit->second;
|
||||||
if (!grpMeta)
|
if (!grpMeta)
|
||||||
{
|
{
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::processGrpMask() Ignore update for not existing grp id " << grpId.toStdString();
|
std::cerr << "RsGenExchange::processGrpMask() Ignore update for not existing grp id " << grpId.toStdString();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ok = true;
|
ok = true;
|
||||||
@ -1937,6 +2003,10 @@ void RsGenExchange::publishMsgs()
|
|||||||
msgId = msg->msgId;
|
msgId = msg->msgId;
|
||||||
grpId = msg->grpId;
|
grpId = msg->grpId;
|
||||||
msg->metaData->recvTS = time(NULL);
|
msg->metaData->recvTS = time(NULL);
|
||||||
|
|
||||||
|
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);
|
||||||
msgChangeMap[grpId].push_back(msgId);
|
msgChangeMap[grpId].push_back(msgId);
|
||||||
@ -2070,13 +2140,18 @@ void RsGenExchange::processGroupUpdatePublish()
|
|||||||
|
|
||||||
void RsGenExchange::processRoutingClues()
|
void RsGenExchange::processRoutingClues()
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
|
|
||||||
for(std::map<RsGxsId,std::set<RsPeerId> >::const_iterator it = mRoutingClues.begin();it!=mRoutingClues.end();++it)
|
for(std::map<RsGxsId,std::set<RsPeerId> >::const_iterator it = mRoutingClues.begin();it!=mRoutingClues.end();++it)
|
||||||
for(std::set<RsPeerId>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2)
|
for(std::set<RsPeerId>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2)
|
||||||
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()
|
||||||
{
|
{
|
||||||
@ -2291,6 +2366,12 @@ void RsGenExchange::publishGrps()
|
|||||||
}
|
}
|
||||||
else if(ret == SERVICE_CREATE_FAIL_TRY_LATER)
|
else if(ret == SERVICE_CREATE_FAIL_TRY_LATER)
|
||||||
{
|
{
|
||||||
|
// if the service is not ready yet, reset the start timestamp to give the service more time
|
||||||
|
// the service should have it's own timeout mechanism
|
||||||
|
// services should return SERVICE_CREATE_FAIL if the action timed out
|
||||||
|
// at the moment this is only important for the idservice:
|
||||||
|
// the idservice may ask the user for a password, and the user needs time
|
||||||
|
ggps.mStartTS = now;
|
||||||
create = CREATE_FAIL_TRY_LATER;
|
create = CREATE_FAIL_TRY_LATER;
|
||||||
}
|
}
|
||||||
else if(ret == SERVICE_CREATE_FAIL)
|
else if(ret == SERVICE_CREATE_FAIL)
|
||||||
@ -2443,201 +2524,208 @@ void RsGenExchange::computeHash(const RsTlvBinaryData& data, RsFileHash& hash)
|
|||||||
|
|
||||||
void RsGenExchange::processRecvdMessages()
|
void RsGenExchange::processRecvdMessages()
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
if(!mMsgPendingValidate.empty())
|
if(!mMsgPendingValidate.empty())
|
||||||
std::cerr << "processing received messages" << std::endl;
|
std::cerr << "processing received messages" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
NxsMsgPendingVect::iterator pend_it = mMsgPendingValidate.begin();
|
NxsMsgPendingVect::iterator pend_it = mMsgPendingValidate.begin();
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
if(!mMsgPendingValidate.empty())
|
if(!mMsgPendingValidate.empty())
|
||||||
std::cerr << " pending validation" << std::endl;
|
std::cerr << " pending validation" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for(; pend_it != mMsgPendingValidate.end();)
|
for(; pend_it != mMsgPendingValidate.end();)
|
||||||
{
|
{
|
||||||
GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair>& gpsi = *pend_it;
|
GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair>& gpsi = *pend_it;
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " grp=" << gpsi.mId.first << ", msg=" << gpsi.mId.second << ", attempts=" << gpsi.mAttempts ;
|
std::cerr << " grp=" << gpsi.mId.first << ", msg=" << gpsi.mId.second << ", attempts=" << gpsi.mAttempts ;
|
||||||
#endif
|
#endif
|
||||||
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
||||||
{
|
{
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " = max! deleting." << std::endl;
|
std::cerr << " = max! deleting." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
delete gpsi.mItem;
|
delete gpsi.mItem;
|
||||||
pend_it = mMsgPendingValidate.erase(pend_it);
|
pend_it = mMsgPendingValidate.erase(pend_it);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " movign to recvd." << std::endl;
|
std::cerr << " movign to recvd." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
mReceivedMsgs.push_back(gpsi.mItem);
|
mReceivedMsgs.push_back(gpsi.mItem);
|
||||||
++pend_it;
|
++pend_it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mReceivedMsgs.empty())
|
if(mReceivedMsgs.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<RsNxsMsg*>::iterator vit = mReceivedMsgs.begin();
|
std::vector<RsNxsMsg*>::iterator vit = mReceivedMsgs.begin();
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::map<RsNxsMsg*, RsGxsMsgMetaData*> msgs;
|
std::map<RsNxsMsg*, RsGxsMsgMetaData*> msgs;
|
||||||
|
|
||||||
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetas;
|
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetas;
|
||||||
|
|
||||||
// coalesce group meta retrieval for performance
|
// coalesce group meta retrieval for performance
|
||||||
for(; vit != mReceivedMsgs.end(); ++vit)
|
for(; vit != mReceivedMsgs.end(); ++vit)
|
||||||
{
|
{
|
||||||
RsNxsMsg* msg = *vit;
|
RsNxsMsg* msg = *vit;
|
||||||
grpMetas.insert(std::make_pair(msg->grpId, (RsGxsGrpMetaData*)NULL));
|
grpMetas.insert(std::make_pair(msg->grpId, (RsGxsGrpMetaData*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
mDataStore->retrieveGxsGrpMetaData(grpMetas);
|
mDataStore->retrieveGxsGrpMetaData(grpMetas);
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " updating received messages:" << std::endl;
|
std::cerr << " updating received messages:" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for(vit = mReceivedMsgs.begin(); vit != mReceivedMsgs.end(); ++vit)
|
for(vit = mReceivedMsgs.begin(); vit != mReceivedMsgs.end(); ++vit)
|
||||||
{
|
{
|
||||||
RsNxsMsg* msg = *vit;
|
RsNxsMsg* msg = *vit;
|
||||||
RsGxsMsgMetaData* meta = new RsGxsMsgMetaData();
|
RsGxsMsgMetaData* meta = new RsGxsMsgMetaData();
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
if(msg->meta.bin_len != 0)
|
if(msg->meta.bin_len != 0)
|
||||||
ok = meta->deserialise(msg->meta.bin_data, &(msg->meta.bin_len));
|
ok = meta->deserialise(msg->meta.bin_data, &(msg->meta.bin_len));
|
||||||
|
|
||||||
msg->metaData = meta;
|
msg->metaData = meta;
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " deserialised info: grp id=" << meta->mGroupId << ", msg id=" << meta->mMsgId ;
|
std::cerr << " deserialised info: grp id=" << meta->mGroupId << ", msg id=" << meta->mMsgId ;
|
||||||
#endif
|
#endif
|
||||||
uint8_t validateReturn = VALIDATE_FAIL;
|
uint8_t validateReturn = VALIDATE_FAIL;
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(msg->grpId);
|
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(msg->grpId);
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " msg info : grp id=" << msg->grpId << ", msg id=" << msg->msgId << std::endl;
|
std::cerr << " msg info : grp id=" << msg->grpId << ", msg id=" << msg->msgId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
RsGxsGrpMetaData* grpMeta = NULL ;
|
||||||
|
|
||||||
// validate msg
|
// validate msg
|
||||||
if(mit != grpMetas.end())
|
if(mit != grpMetas.end())
|
||||||
{
|
{
|
||||||
RsGxsGrpMetaData* grpMeta = mit->second;
|
grpMeta = mit->second;
|
||||||
validateReturn = validateMsg(msg, grpMeta->mGroupFlags, grpMeta->keys);
|
validateReturn = validateMsg(msg, grpMeta->mGroupFlags, grpMeta->mSignFlags, grpMeta->keys);
|
||||||
#ifdef GEN_EXCH_DEBUG
|
|
||||||
std::cerr << " message validation result: " << validateReturn << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if(validateReturn == VALIDATE_SUCCESS)
|
|
||||||
{
|
|
||||||
meta->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
|
||||||
msgs.insert(std::make_pair(msg, meta));
|
|
||||||
|
|
||||||
std::vector<RsGxsMessageId> &msgv = msgIds[msg->grpId];
|
|
||||||
if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end())
|
|
||||||
{
|
|
||||||
msgv.push_back(msg->msgId);
|
|
||||||
}
|
|
||||||
|
|
||||||
NxsMsgPendingVect::iterator validated_entry = std::find(mMsgPendingValidate.begin(), mMsgPendingValidate.end(),
|
|
||||||
getMsgIdPair(*msg));
|
|
||||||
|
|
||||||
if(validated_entry != mMsgPendingValidate.end()) mMsgPendingValidate.erase(validated_entry);
|
|
||||||
|
|
||||||
computeHash(msg->msg, meta->mHash);
|
|
||||||
meta->recvTS = time(NULL);
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
|
||||||
std::cerr << " new status flags: " << meta->mMsgStatus << std::endl;
|
|
||||||
std::cerr << " computed hash: " << meta->mHash << std::endl;
|
|
||||||
std::cerr << "Message received. Identity=" << msg->metaData->mAuthorId << ", from peer " << msg->PeerId() << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!msg->metaData->mAuthorId.isNull())
|
|
||||||
mRoutingClues[msg->metaData->mAuthorId].insert(msg->PeerId()) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
|
||||||
std::cerr << " deserialisation failed!" <<std::endl;
|
|
||||||
#endif
|
|
||||||
validateReturn = VALIDATE_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(validateReturn == VALIDATE_FAIL)
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "failed to deserialise incoming meta, msgId: "
|
std::cerr << " grpMeta.mSignFlags: " << std::hex << grpMeta->mSignFlags << std::dec << std::endl;
|
||||||
<< "msg->grpId: " << msg->grpId << ", msgId: " << msg->msgId << std::endl;
|
std::cerr << " grpMeta.mAuthFlags: " << std::hex << grpMeta->mAuthenFlags << std::dec << std::endl;
|
||||||
|
std::cerr << " message validation result: " << (int)validateReturn << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if(validateReturn == VALIDATE_SUCCESS)
|
||||||
|
{
|
||||||
|
meta->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||||
|
msgs.insert(std::make_pair(msg, meta));
|
||||||
|
|
||||||
|
std::vector<RsGxsMessageId> &msgv = msgIds[msg->grpId];
|
||||||
|
if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end())
|
||||||
|
{
|
||||||
|
msgv.push_back(msg->msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
NxsMsgPendingVect::iterator validated_entry = std::find(mMsgPendingValidate.begin(), mMsgPendingValidate.end(),
|
||||||
|
getMsgIdPair(*msg));
|
||||||
|
|
||||||
|
if(validated_entry != mMsgPendingValidate.end()) mMsgPendingValidate.erase(validated_entry);
|
||||||
|
|
||||||
|
computeHash(msg->msg, meta->mHash);
|
||||||
|
meta->recvTS = time(NULL);
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << " new status flags: " << meta->mMsgStatus << std::endl;
|
||||||
|
std::cerr << " computed hash: " << meta->mHash << std::endl;
|
||||||
|
std::cerr << "Message received. Identity=" << msg->metaData->mAuthorId << ", from peer " << msg->PeerId() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NxsMsgPendingVect::iterator failed_entry = std::find(mMsgPendingValidate.begin(), mMsgPendingValidate.end(),
|
if(!msg->metaData->mAuthorId.isNull())
|
||||||
getMsgIdPair(*msg));
|
mRoutingClues[msg->metaData->mAuthorId].insert(msg->PeerId()) ;
|
||||||
|
|
||||||
if(failed_entry != mMsgPendingValidate.end()) mMsgPendingValidate.erase(failed_entry);
|
if(grpMeta->mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
|
||||||
|
mTrackingClues.push_back(std::make_pair(msg->msgId,msg->PeerId())) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << " deserialisation failed!" <<std::endl;
|
||||||
|
#endif
|
||||||
|
validateReturn = VALIDATE_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(validateReturn == VALIDATE_FAIL)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
|
std::cerr << "Validation failed for message id "
|
||||||
|
<< "msg->grpId: " << msg->grpId << ", msgId: " << msg->msgId << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NxsMsgPendingVect::iterator failed_entry = std::find(mMsgPendingValidate.begin(), mMsgPendingValidate.end(),
|
||||||
|
getMsgIdPair(*msg));
|
||||||
|
|
||||||
|
if(failed_entry != mMsgPendingValidate.end()) mMsgPendingValidate.erase(failed_entry);
|
||||||
delete msg;
|
delete msg;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(validateReturn == VALIDATE_FAIL_TRY_LATER)
|
else if(validateReturn == VALIDATE_FAIL_TRY_LATER)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "failed to validate msg, trying again: "
|
std::cerr << "failed to validate msg, trying again: "
|
||||||
<< "msg->grpId: " << msg->grpId << ", msgId: " << msg->msgId << std::endl;
|
<< "msg->grpId: " << msg->grpId << ", msgId: " << msg->msgId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RsGxsGrpMsgIdPair id;
|
RsGxsGrpMsgIdPair id;
|
||||||
id.first = msg->grpId;
|
id.first = msg->grpId;
|
||||||
id.second = msg->msgId;
|
id.second = msg->msgId;
|
||||||
|
|
||||||
// first check you haven't made too many attempts
|
// first check you haven't made too many attempts
|
||||||
|
|
||||||
NxsMsgPendingVect::iterator vit = std::find(
|
NxsMsgPendingVect::iterator vit = std::find(
|
||||||
mMsgPendingValidate.begin(), mMsgPendingValidate.end(), id);
|
mMsgPendingValidate.begin(), mMsgPendingValidate.end(), id);
|
||||||
|
|
||||||
if(vit == mMsgPendingValidate.end())
|
if(vit == mMsgPendingValidate.end())
|
||||||
{
|
{
|
||||||
GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> item(msg, id);
|
GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> item(msg, id);
|
||||||
mMsgPendingValidate.push_back(item);
|
mMsgPendingValidate.push_back(item);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
vit->mAttempts++;
|
vit->mAttempts++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up resources from group meta retrieval
|
// clean up resources from group meta retrieval
|
||||||
freeAndClearContainerResource<std::map<RsGxsGroupId, RsGxsGrpMetaData*>,
|
freeAndClearContainerResource<std::map<RsGxsGroupId, RsGxsGrpMetaData*>,
|
||||||
RsGxsGrpMetaData*>(grpMetas);
|
RsGxsGrpMetaData*>(grpMetas);
|
||||||
|
|
||||||
if(!msgIds.empty())
|
if(!msgIds.empty())
|
||||||
{
|
{
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " removing existing and old messages from incoming list." << std::endl;
|
std::cerr << " removing existing and old messages from incoming list." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
removeDeleteExistingMessages(msgs, msgIds);
|
removeDeleteExistingMessages(msgs, msgIds);
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " storing remaining messages" << std::endl;
|
std::cerr << " storing remaining messages" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
mDataStore->storeMessage(msgs);
|
mDataStore->storeMessage(msgs);
|
||||||
|
|
||||||
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVE, false);
|
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVE, false);
|
||||||
c->msgChangeMap = msgIds;
|
c->msgChangeMap = msgIds;
|
||||||
mNotifications.push_back(c);
|
mNotifications.push_back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
mReceivedMsgs.clear();
|
mReceivedMsgs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGenExchange::processRecvdGroups()
|
void RsGenExchange::processRecvdGroups()
|
||||||
@ -2710,8 +2798,7 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
else if(ret == VALIDATE_FAIL)
|
else if(ret == VALIDATE_FAIL)
|
||||||
{
|
{
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "failed to deserialise incoming meta, grpId: "
|
std::cerr << "failed to validate incoming meta, grpId: " << grp->grpId << ": wrong signature" << std::endl;
|
||||||
<< grp->grpId << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
delete grp;
|
delete grp;
|
||||||
erase = true;
|
erase = true;
|
||||||
@ -2720,8 +2807,7 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "failed to validate incoming grp, trying again. grpId: "
|
std::cerr << "failed to validate incoming grp, trying again. grpId: " << grp->grpId << std::endl;
|
||||||
<< grp->grpId << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
||||||
@ -2737,6 +2823,7 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::cerr << "(EE) deserialise error in group meta data" << std::endl;
|
||||||
delete grp;
|
delete grp;
|
||||||
delete meta;
|
delete meta;
|
||||||
erase = true;
|
erase = true;
|
||||||
@ -2821,7 +2908,7 @@ void RsGenExchange::performUpdateValidation()
|
|||||||
bool RsGenExchange::updateValid(RsGxsGrpMetaData& oldGrpMeta, RsNxsGrp& newGrp) const
|
bool RsGenExchange::updateValid(RsGxsGrpMetaData& oldGrpMeta, RsNxsGrp& newGrp) const
|
||||||
{
|
{
|
||||||
std::map<SignType, RsTlvKeySignature>& signSet = newGrp.metaData->signSet.keySignSet;
|
std::map<SignType, RsTlvKeySignature>& signSet = newGrp.metaData->signSet.keySignSet;
|
||||||
std::map<SignType, RsTlvKeySignature>::iterator mit = signSet.find(GXS_SERV::FLAG_AUTHEN_ADMIN);
|
std::map<SignType, RsTlvKeySignature>::iterator mit = signSet.find(INDEX_AUTHEN_ADMIN);
|
||||||
|
|
||||||
if(mit == signSet.end())
|
if(mit == signSet.end())
|
||||||
{
|
{
|
||||||
@ -2900,7 +2987,9 @@ void RsGenExchange::removeDeleteExistingMessages( RsGeneralDataService::MsgStore
|
|||||||
{
|
{
|
||||||
const RsGxsMessageId::std_vector& msgIds = msgIdReq[cit2->second->mGroupId];
|
const RsGxsMessageId::std_vector& msgIds = msgIdReq[cit2->second->mGroupId];
|
||||||
|
|
||||||
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " grpid=" << cit2->second->mGroupId << ", msgid=" << cit2->second->mMsgId ;
|
std::cerr << " grpid=" << cit2->second->mGroupId << ", msgid=" << cit2->second->mMsgId ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test)
|
// Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test)
|
||||||
//
|
//
|
||||||
|
@ -739,12 +739,13 @@ private:
|
|||||||
/*!
|
/*!
|
||||||
* Attempts to validate msg signatures
|
* Attempts to validate msg signatures
|
||||||
* @param msg message to be validated
|
* @param msg message to be validated
|
||||||
* @param grpFlag the flag for the group the message belongs to
|
* @param grpFlag the distribution flag for the group the message belongs to
|
||||||
|
* @param grpFlag the signature flag for the group the message belongs to
|
||||||
* @param grpKeySet the key set user has for the message's group
|
* @param grpKeySet the key set user has for the message's group
|
||||||
* @return VALIDATE_SUCCESS for success, VALIDATE_FAIL for fail,
|
* @return VALIDATE_SUCCESS for success, VALIDATE_FAIL for fail,
|
||||||
* VALIDATE_ID_SIGN_NOT_AVAIL for Id sign key not avail (but requested)
|
* VALIDATE_ID_SIGN_NOT_AVAIL for Id sign key not avail (but requested)
|
||||||
*/
|
*/
|
||||||
int validateMsg(RsNxsMsg* msg, const uint32_t& grpFlag, RsTlvSecurityKeySet& grpKeySet);
|
int validateMsg(RsNxsMsg* msg, const uint32_t& grpFlag, const uint32_t &signFlag, RsTlvSecurityKeySet& grpKeySet);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Attempts to validate group signatures
|
* Attempts to validate group signatures
|
||||||
@ -862,7 +863,7 @@ private:
|
|||||||
std::vector<GroupDeletePublish> mGroupDeletePublish;
|
std::vector<GroupDeletePublish> mGroupDeletePublish;
|
||||||
|
|
||||||
std::map<RsGxsId,std::set<RsPeerId> > mRoutingClues ;
|
std::map<RsGxsId,std::set<RsPeerId> > mRoutingClues ;
|
||||||
|
std::list<std::pair<RsGxsMessageId,RsPeerId> > mTrackingClues ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSGENEXCHANGE_H
|
#endif // RSGENEXCHANGE_H
|
||||||
|
@ -166,6 +166,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool getKey(const RsGxsId &id, RsTlvSecurityKey &key) = 0;
|
virtual bool getKey(const RsGxsId &id, RsTlvSecurityKey &key) = 0;
|
||||||
virtual bool getPrivateKey(const RsGxsId &id, RsTlvSecurityKey &key) = 0; // For signing outgoing messages.
|
virtual bool getPrivateKey(const RsGxsId &id, RsTlvSecurityKey &key) = 0; // For signing outgoing messages.
|
||||||
|
virtual bool getIdDetails(const RsGxsId& id, RsIdentityDetails& details) = 0 ; // Proxy function so that we get p3Identity info from Gxs
|
||||||
#ifdef SUSPENDED
|
#ifdef SUSPENDED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
#include "serialiser/rsbaseserial.h"
|
#include "serialiser/rsbaseserial.h"
|
||||||
#include "serialiser/rstlvbase.h"
|
#include "serialiser/rstlvbase.h"
|
||||||
|
|
||||||
|
static const uint32_t RS_GXS_GRP_META_DATA_VERSION_ID_0001 = 0x0000 ; // change this, and keep old values if the content changes
|
||||||
|
static const uint32_t RS_GXS_GRP_META_DATA_VERSION_ID_0002 = 0xaf01 ; // current API
|
||||||
|
|
||||||
|
static const uint32_t RS_GXS_MSG_META_DATA_VERSION_ID_0001 = 0x0000 ; // current API
|
||||||
|
|
||||||
RsGxsGrpMetaData::RsGxsGrpMetaData()
|
RsGxsGrpMetaData::RsGxsGrpMetaData()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
@ -46,10 +51,11 @@ uint32_t RsGxsGrpMetaData::serial_size()
|
|||||||
s += GetTlvStringSize(mServiceString);
|
s += GetTlvStringSize(mServiceString);
|
||||||
s += signSet.TlvSize();
|
s += signSet.TlvSize();
|
||||||
s += keys.TlvSize();
|
s += keys.TlvSize();
|
||||||
s += 4; // for mCircleType
|
s += 4; // for mCircleType
|
||||||
s += mCircleId.serial_size();
|
s += mCircleId.serial_size();
|
||||||
s += 4; // mAuthenFlag
|
s += 4; // mAuthenFlag
|
||||||
s += mParentGrpId.serial_size();
|
s += mParentGrpId.serial_size(); // mParentGroupId
|
||||||
|
s += 4; // mSignFlag
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -104,7 +110,7 @@ bool RsGxsGrpMetaData::serialise(void *data, uint32_t &pktsize)
|
|||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
ok &= setRsItemHeader(data, tlvsize, 0, tlvsize);
|
ok &= setRsItemHeader(data, tlvsize, RS_GXS_GRP_META_DATA_VERSION_ID_0002, tlvsize);
|
||||||
|
|
||||||
#ifdef GXS_DEBUG
|
#ifdef GXS_DEBUG
|
||||||
std::cerr << "RsGxsGrpMetaData serialise()" << std::endl;
|
std::cerr << "RsGxsGrpMetaData serialise()" << std::endl;
|
||||||
@ -130,6 +136,7 @@ bool RsGxsGrpMetaData::serialise(void *data, uint32_t &pktsize)
|
|||||||
ok &= signSet.SetTlv(data, tlvsize, &offset);
|
ok &= signSet.SetTlv(data, tlvsize, &offset);
|
||||||
ok &= keys.SetTlv(data, tlvsize, &offset);
|
ok &= keys.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mSignFlags); // new in API v2. Was previously missing. Kept in the end for backward compatibility
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -154,12 +161,31 @@ bool RsGxsGrpMetaData::deserialise(void *data, uint32_t &pktsize)
|
|||||||
ok &= getRawUInt32(data, pktsize, &offset, &mPublishTs);
|
ok &= getRawUInt32(data, pktsize, &offset, &mPublishTs);
|
||||||
ok &= getRawUInt32(data, pktsize, &offset, &mCircleType);
|
ok &= getRawUInt32(data, pktsize, &offset, &mCircleType);
|
||||||
ok &= getRawUInt32(data, pktsize, &offset, &mAuthenFlags);
|
ok &= getRawUInt32(data, pktsize, &offset, &mAuthenFlags);
|
||||||
|
|
||||||
|
|
||||||
ok &= mAuthorId.deserialise(data, pktsize, offset);
|
ok &= mAuthorId.deserialise(data, pktsize, offset);
|
||||||
ok &= GetTlvString(data, pktsize, &offset, 0, mServiceString);
|
ok &= GetTlvString(data, pktsize, &offset, 0, mServiceString);
|
||||||
ok &= mCircleId.deserialise(data, pktsize, offset);
|
ok &= mCircleId.deserialise(data, pktsize, offset);
|
||||||
ok &= signSet.GetTlv(data, pktsize, &offset);
|
ok &= signSet.GetTlv(data, pktsize, &offset);
|
||||||
ok &= keys.GetTlv(data, pktsize, &offset);
|
ok &= keys.GetTlv(data, pktsize, &offset);
|
||||||
|
|
||||||
|
switch(getRsItemId(data))
|
||||||
|
{
|
||||||
|
case RS_GXS_GRP_META_DATA_VERSION_ID_0002: ok &= getRawUInt32(data, pktsize, &offset, &mSignFlags); // current API
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case RS_GXS_GRP_META_DATA_VERSION_ID_0001: mSignFlags = 0; // old API. Do not leave this uninitialised!
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default:
|
||||||
|
std::cerr << "(EE) RsGxsGrpMetaData::deserialise(): ERROR: unknown API version " << std::hex << getRsItemId(data) << std::dec << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(offset != pktsize)
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) RsGxsGrpMetaData::deserialise(): ERROR: unmatched size " << offset << ", expected: " << pktsize << std::dec << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
#ifdef DROP_NON_CANONICAL_ITEMS
|
#ifdef DROP_NON_CANONICAL_ITEMS
|
||||||
if(mGroupName.length() > RsGxsGrpMetaData::MAX_ALLOWED_STRING_SIZE)
|
if(mGroupName.length() > RsGxsGrpMetaData::MAX_ALLOWED_STRING_SIZE)
|
||||||
{
|
{
|
||||||
@ -202,8 +228,8 @@ uint32_t RsGxsMsgMetaData::serial_size()
|
|||||||
|
|
||||||
s += signSet.TlvSize();
|
s += signSet.TlvSize();
|
||||||
s += GetTlvStringSize(mMsgName);
|
s += GetTlvStringSize(mMsgName);
|
||||||
s += 4;
|
s += 4; // mPublishTS
|
||||||
s += 4;
|
s += 4; // mMsgFlags
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -239,7 +265,7 @@ bool RsGxsMsgMetaData::serialise(void *data, uint32_t *size)
|
|||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
ok &= setRsItemHeader(data, tlvsize, 0, tlvsize);
|
ok &= setRsItemHeader(data, tlvsize, RS_GXS_MSG_META_DATA_VERSION_ID_0001, tlvsize);
|
||||||
|
|
||||||
#ifdef GXS_DEBUG
|
#ifdef GXS_DEBUG
|
||||||
std::cerr << "RsGxsGrpMetaData serialise()" << std::endl;
|
std::cerr << "RsGxsGrpMetaData serialise()" << std::endl;
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
RsGxsGroupId mGroupId;
|
RsGxsGroupId mGroupId;
|
||||||
RsGxsGroupId mOrigGrpId;
|
RsGxsGroupId mOrigGrpId;
|
||||||
std::string mGroupName;
|
std::string mGroupName;
|
||||||
uint32_t mGroupFlags;
|
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;
|
uint32_t mSignFlags;
|
||||||
RsGxsId mAuthorId;
|
RsGxsId mAuthorId;
|
||||||
@ -123,7 +123,6 @@ public:
|
|||||||
uint32_t recvTS;
|
uint32_t recvTS;
|
||||||
RsFileHash mHash;
|
RsFileHash mHash;
|
||||||
bool validated;
|
bool validated;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list<RsNxsGrp*>&
|
|||||||
|
|
||||||
if(gmreq)
|
if(gmreq)
|
||||||
{
|
{
|
||||||
grpData = gmreq->mGroupData;
|
grpData.swap(gmreq->mGroupData);
|
||||||
gmreq->mGroupData.clear();
|
gmreq->mGroupData.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
}else{
|
}else{
|
||||||
@ -480,7 +480,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat
|
|||||||
|
|
||||||
if(mdreq)
|
if(mdreq)
|
||||||
{
|
{
|
||||||
msgData = mdreq->mMsgData;
|
msgData.swap(mdreq->mMsgData);
|
||||||
mdreq->mMsgData.clear();
|
mdreq->mMsgData.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
}
|
}
|
||||||
@ -517,7 +517,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData
|
|||||||
|
|
||||||
if(mrireq)
|
if(mrireq)
|
||||||
{
|
{
|
||||||
msgData = mrireq->mMsgDataResult;
|
msgData.swap(mrireq->mMsgDataResult);
|
||||||
mrireq->mMsgDataResult.clear();
|
mrireq->mMsgDataResult.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg
|
|||||||
|
|
||||||
if(mmreq)
|
if(mmreq)
|
||||||
{
|
{
|
||||||
msgInfo = mmreq->mMsgMetaData;
|
msgInfo.swap(mmreq->mMsgMetaData);
|
||||||
mmreq->mMsgMetaData.clear();
|
mmreq->mMsgMetaData.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta
|
|||||||
|
|
||||||
if(mrireq)
|
if(mrireq)
|
||||||
{
|
{
|
||||||
msgMeta = mrireq->mMsgMetaResult;
|
msgMeta.swap(mrireq->mMsgMetaResult);
|
||||||
mrireq->mMsgMetaResult.clear();
|
mrireq->mMsgMetaResult.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul
|
|||||||
|
|
||||||
if(mrireq)
|
if(mrireq)
|
||||||
{
|
{
|
||||||
msgIds = mrireq->mMsgIdResult;
|
msgIds.swap(mrireq->mMsgIdResult);
|
||||||
mrireq->mMsgIdResult.clear();
|
mrireq->mMsgIdResult.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
}
|
}
|
||||||
@ -664,7 +664,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds)
|
|||||||
|
|
||||||
if(mireq)
|
if(mireq)
|
||||||
{
|
{
|
||||||
msgIds = mireq->mMsgIdResult;
|
msgIds.swap(mireq->mMsgIdResult);
|
||||||
mireq->mMsgIdResult.clear();
|
mireq->mMsgIdResult.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
}
|
}
|
||||||
@ -697,7 +697,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::list<RsGxsGroupId
|
|||||||
|
|
||||||
if(gireq)
|
if(gireq)
|
||||||
{
|
{
|
||||||
groupIds = gireq->mGroupIdResult;
|
groupIds.swap(gireq->mGroupIdResult);
|
||||||
gireq->mGroupIdResult.clear();
|
gireq->mGroupIdResult.clear();
|
||||||
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
|
||||||
|
|
||||||
@ -1032,31 +1032,25 @@ bool RsGxsDataAccess::getGroupList(const std::list<RsGxsGroupId>& grpIdsIn, cons
|
|||||||
|
|
||||||
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
|
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
|
||||||
{
|
{
|
||||||
GxsMsgResult result;
|
|
||||||
|
|
||||||
GxsMsgReq msgIdOut;
|
GxsMsgReq msgIdOut;
|
||||||
|
|
||||||
// filter based on options
|
// filter based on options
|
||||||
getMsgList(req->mMsgIds, req->Options, msgIdOut);
|
getMsgList(req->mMsgIds, req->Options, msgIdOut);
|
||||||
|
|
||||||
mDataStore->retrieveNxsMsgs(msgIdOut, result, true, true);
|
mDataStore->retrieveNxsMsgs(msgIdOut, req->mMsgData, true, true);
|
||||||
|
|
||||||
req->mMsgData = result;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RsGxsDataAccess::getMsgSummary(MsgMetaReq* req)
|
bool RsGxsDataAccess::getMsgSummary(MsgMetaReq* req)
|
||||||
{
|
{
|
||||||
GxsMsgMetaResult result;
|
|
||||||
|
|
||||||
GxsMsgReq msgIdOut;
|
GxsMsgReq msgIdOut;
|
||||||
|
|
||||||
// filter based on options
|
// filter based on options
|
||||||
getMsgList(req->mMsgIds, req->Options, msgIdOut);
|
getMsgList(req->mMsgIds, req->Options, msgIdOut);
|
||||||
|
|
||||||
mDataStore->retrieveGxsMsgMetaData(msgIdOut, result);
|
mDataStore->retrieveGxsMsgMetaData(msgIdOut, req->mMsgMetaData);
|
||||||
req->mMsgMetaData = result;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "rsgxsnetservice.h"
|
#include "rsgxsnetservice.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 "pgp/pgpauxutils.h"
|
#include "pgp/pgpauxutils.h"
|
||||||
@ -1996,7 +1997,15 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
|||||||
std::cerr << ", no group meta found. Givign up." << std::endl;
|
std::cerr << ", no group meta found. Givign up." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rsReputations->isIdentityBanned(syncItem->authorId))
|
||||||
|
{
|
||||||
|
#ifdef NXS_NET_DEBUG
|
||||||
|
std::cerr << ", Identity " << syncItem->authorId << " is banned. Not requesting message!" << std::endl;
|
||||||
|
#endif
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
|
||||||
if(mReputations->haveReputation(syncItem->authorId) || noAuthor)
|
if(mReputations->haveReputation(syncItem->authorId) || noAuthor)
|
||||||
{
|
{
|
||||||
GixsReputation rep;
|
GixsReputation rep;
|
||||||
@ -2009,7 +2018,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
|||||||
|
|
||||||
// if author is required for this message, it will simply get dropped
|
// if author is required for this message, it will simply get dropped
|
||||||
// at genexchange side of things
|
// at genexchange side of things
|
||||||
if(rep.score > (int)grpMeta->mReputationCutOff || noAuthor)
|
if(rep.score >= (int)grpMeta->mReputationCutOff || noAuthor)
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG
|
#ifdef NXS_NET_DEBUG
|
||||||
std::cerr << ", passed! Adding message to req list." << std::endl;
|
std::cerr << ", passed! Adding message to req list." << std::endl;
|
||||||
@ -2210,7 +2219,15 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
|||||||
haveItem = true;
|
haveItem = true;
|
||||||
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!grpSyncItem->authorId.isNull() && rsReputations->isIdentityBanned(grpSyncItem->authorId))
|
||||||
|
{
|
||||||
|
#ifdef NXS_NET_DEBUG
|
||||||
|
std::cerr << " Identity " << grpSyncItem->authorId << " is banned. Not syncing group." << std::endl;
|
||||||
|
#endif
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
|
||||||
if( (mGrpAutoSync && !haveItem) || latestVersion)
|
if( (mGrpAutoSync && !haveItem) || latestVersion)
|
||||||
{
|
{
|
||||||
// determine if you need to check reputation
|
// determine if you need to check reputation
|
||||||
@ -2228,10 +2245,14 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
|||||||
if(rep.score >= GIXS_CUT_OFF)
|
if(rep.score >= GIXS_CUT_OFF)
|
||||||
{
|
{
|
||||||
addGroupItemToList(tr, grpId, transN, reqList);
|
addGroupItemToList(tr, grpId, transN, reqList);
|
||||||
|
#ifdef NXS_NET_DEBUG
|
||||||
std::cerr << " reputation cut off: limit=" << GIXS_CUT_OFF << " value=" << rep.score << ": allowed." << std::endl;
|
std::cerr << " reputation cut off: limit=" << GIXS_CUT_OFF << " value=" << rep.score << ": allowed." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef NXS_NET_DEBUG
|
||||||
else
|
else
|
||||||
std::cerr << " reputation cut off: limit=" << GIXS_CUT_OFF << " value=" << rep.score << ": you shall not pass." << std::endl;
|
std::cerr << " reputation cut off: limit=" << GIXS_CUT_OFF << " value=" << rep.score << ": you shall not pass." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ bool MsgRespPending::accepted()
|
|||||||
GixsReputation rep;
|
GixsReputation rep;
|
||||||
if(getAuthorRep(rep, entry.mAuthorId, mPeerId))
|
if(getAuthorRep(rep, entry.mAuthorId, mPeerId))
|
||||||
{
|
{
|
||||||
if(rep.score > mCutOff)
|
if(rep.score >= mCutOff)
|
||||||
{
|
{
|
||||||
entry.mPassedVetting = true;
|
entry.mPassedVetting = true;
|
||||||
count++;
|
count++;
|
||||||
@ -134,7 +134,7 @@ bool GrpRespPending::accepted()
|
|||||||
|
|
||||||
if(getAuthorRep(rep, entry.mAuthorId, mPeerId))
|
if(getAuthorRep(rep, entry.mAuthorId, mPeerId))
|
||||||
{
|
{
|
||||||
if(rep.score > mCutOff)
|
if(rep.score >= mCutOff)
|
||||||
{
|
{
|
||||||
entry.mPassedVetting = true;
|
entry.mPassedVetting = true;
|
||||||
count++;
|
count++;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -125,7 +125,7 @@ std::string PGPKeyManagement::makeArmouredKey(const unsigned char *keydata,size_
|
|||||||
|
|
||||||
uint32_t crc = compute24bitsCRC((unsigned char *)keydata,key_size) ;
|
uint32_t crc = compute24bitsCRC((unsigned char *)keydata,key_size) ;
|
||||||
|
|
||||||
unsigned char tmp[3] = { (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff } ;
|
unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ;
|
||||||
std::string crc_string ;
|
std::string crc_string ;
|
||||||
Radix64::encode((const char *)tmp,3,crc_string) ;
|
Radix64::encode((const char *)tmp,3,crc_string) ;
|
||||||
|
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
|
|
||||||
RS_TOP_DIR = ..
|
|
||||||
##### Define any flags that are needed for this section #######
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/config.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
BASE_OBJ = pqisecurity.o pqinetwork.o
|
|
||||||
#pqi_base.o
|
|
||||||
|
|
||||||
LOOP_OBJ = pqiloopback.o
|
|
||||||
STREAM_OBJ = pqistreamer.o pqiarchive.o pqistore.o pqibin.o
|
|
||||||
MGR_OBJ = pqimonitor.o p3dhtmgr.o p3connmgr.o p3cfgmgr.o p3authmgr.o
|
|
||||||
GRP_OBJ = pqiperson.o pqihandler.o pqiservice.o pqipersongrp.o
|
|
||||||
SSL_OBJ = pqissl.o pqissllistener.o pqisslpersongrp.o cleanupxpgp.o
|
|
||||||
UDP_OBJ = pqissludp.o
|
|
||||||
|
|
||||||
OTHER_OBJ = p3notify.o
|
|
||||||
|
|
||||||
|
|
||||||
TESTOBJ = net_test.o dht_test.o net_test1.o netiface_test.o
|
|
||||||
#conn_test.o
|
|
||||||
|
|
||||||
TESTS = net_test dht_test net_test1 netiface_test
|
|
||||||
#conn_test
|
|
||||||
|
|
||||||
ifdef PQI_USE_XPGP
|
|
||||||
SSL_OBJ += authxpgp.o
|
|
||||||
TESTOBJ += xpgp_id.o
|
|
||||||
TESTS += xpgp_id
|
|
||||||
else
|
|
||||||
ifdef PQI_USE_SSLONLY
|
|
||||||
SSL_OBJ += authssl.o
|
|
||||||
else
|
|
||||||
SSL_OBJ += authssl.o authgpg.o
|
|
||||||
TESTOBJ += gpgme_tst.o
|
|
||||||
TESTS += gpgme_tst
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
RSOBJ = $(BASE_OBJ) $(LOOP_OBJ) \
|
|
||||||
$(STREAM_OBJ) \
|
|
||||||
$(MGR_OBJ) \
|
|
||||||
$(SSL_OBJ) \
|
|
||||||
$(UDP_OBJ) \
|
|
||||||
$(GRP_OBJ) \
|
|
||||||
$(OTHER_OBJ)
|
|
||||||
|
|
||||||
all: librs tests
|
|
||||||
|
|
||||||
gpgme_tst: gpgme_tst.o
|
|
||||||
$(CC) $(CFLAGS) -o gpgme_tst gpgme_tst.o $(LIBS)
|
|
||||||
|
|
||||||
xpgp_id: xpgp_id.o
|
|
||||||
$(CC) $(CFLAGS) -o xpgp_id xpgp_id.o $(LIBS)
|
|
||||||
|
|
||||||
dht_test: dht_test.o
|
|
||||||
$(CC) $(CFLAGS) -o dht_test dht_test.o $(LIBS)
|
|
||||||
|
|
||||||
conn_test: conn_test.o
|
|
||||||
$(CC) $(CFLAGS) -o conn_test conn_test.o $(LIBS)
|
|
||||||
|
|
||||||
net_test: net_test.o
|
|
||||||
$(CC) $(CFLAGS) -o net_test net_test.o $(LIBS)
|
|
||||||
|
|
||||||
net_test1: net_test1.o
|
|
||||||
$(CC) $(CFLAGS) -o net_test1 net_test1.o $(LIBS)
|
|
||||||
|
|
||||||
netiface_test: netiface_test.o
|
|
||||||
$(CC) $(CFLAGS) -o netiface_test netiface_test.o $(LIBS)
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/rules.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
@ -198,7 +198,7 @@ void tls_cleanup()
|
|||||||
CRYPTO_set_locking_callback(NULL);
|
CRYPTO_set_locking_callback(NULL);
|
||||||
CRYPTO_set_id_callback(NULL);
|
CRYPTO_set_id_callback(NULL);
|
||||||
|
|
||||||
if (mutex_buf == NULL) {
|
if (mutex_buf != NULL) {
|
||||||
for (int i = 0; i < CRYPTO_num_locks(); i++) {
|
for (int i = 0; i < CRYPTO_num_locks(); i++) {
|
||||||
pthread_mutex_destroy(&mutex_buf[i]);
|
pthread_mutex_destroy(&mutex_buf[i]);
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,11 @@ bool p3Config::loadAttempt(const std::string& cfgFname,const std::string& signFn
|
|||||||
/* set hash */
|
/* set hash */
|
||||||
setHash(bio->gethash());
|
setHash(bio->gethash());
|
||||||
|
|
||||||
BinMemInterface *signbio = new BinMemInterface(1000, BIN_FLAGS_READABLE);
|
std::string signatureRead;
|
||||||
|
RsFileHash strHash(Hash());
|
||||||
|
AuthSSL::getAuthSSL()->SignData(strHash.toByteArray(), RsFileHash::SIZE_IN_BYTES, signatureRead);
|
||||||
|
|
||||||
|
BinMemInterface *signbio = new BinMemInterface(signatureRead.size(), BIN_FLAGS_READABLE);
|
||||||
|
|
||||||
if(!signbio->readfromfile(signFname.c_str()))
|
if(!signbio->readfromfile(signFname.c_str()))
|
||||||
{
|
{
|
||||||
@ -314,10 +318,6 @@ bool p3Config::loadAttempt(const std::string& cfgFname,const std::string& signFn
|
|||||||
|
|
||||||
std::string signatureStored((char *) signbio->memptr(), signbio->memsize());
|
std::string signatureStored((char *) signbio->memptr(), signbio->memsize());
|
||||||
|
|
||||||
std::string signatureRead;
|
|
||||||
RsFileHash strHash(Hash());
|
|
||||||
AuthSSL::getAuthSSL()->SignData(strHash.toByteArray(), RsFileHash::SIZE_IN_BYTES, signatureRead);
|
|
||||||
|
|
||||||
delete signbio;
|
delete signbio;
|
||||||
|
|
||||||
if(signatureRead != signatureStored)
|
if(signatureRead != signatureStored)
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
#include "rsserver/p3face.h"
|
#include "rsserver/p3face.h"
|
||||||
#include "util/rsstring.h"
|
#include "util/rsstring.h"
|
||||||
|
|
||||||
|
/****
|
||||||
|
* #define HISTMGR_DEBUG 1
|
||||||
|
***/
|
||||||
|
|
||||||
// clean too old messages every 5 minutes
|
// clean too old messages every 5 minutes
|
||||||
//
|
//
|
||||||
#define MSG_HISTORY_CLEANING_PERIOD 300
|
#define MSG_HISTORY_CLEANING_PERIOD 300
|
||||||
@ -171,7 +175,9 @@ void p3HistoryMgr::cleanOldMessages()
|
|||||||
{
|
{
|
||||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "****** cleaning old messages." << std::endl;
|
std::cerr << "****** cleaning old messages." << std::endl;
|
||||||
|
#endif
|
||||||
time_t now = time(NULL) ;
|
time_t now = time(NULL) ;
|
||||||
bool changed = false ;
|
bool changed = false ;
|
||||||
|
|
||||||
@ -185,7 +191,9 @@ void p3HistoryMgr::cleanOldMessages()
|
|||||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit2 = lit ;
|
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit2 = lit ;
|
||||||
++lit2 ;
|
++lit2 ;
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << " removing msg id " << lit->first << ", for peer id " << mit->first << std::endl;
|
std::cerr << " removing msg id " << lit->first << ", for peer id " << mit->first << std::endl;
|
||||||
|
#endif
|
||||||
delete lit->second ;
|
delete lit->second ;
|
||||||
|
|
||||||
mit->second.erase(lit) ;
|
mit->second.erase(lit) ;
|
||||||
@ -201,7 +209,9 @@ void p3HistoryMgr::cleanOldMessages()
|
|||||||
{
|
{
|
||||||
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit2 = mit ;
|
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit2 = mit ;
|
||||||
++mit2 ;
|
++mit2 ;
|
||||||
std::cerr << " removing peer id " << mit->first << ", since it has no messages" << std::endl;
|
#ifdef HISTMGR_DEBUG
|
||||||
|
std::cerr << " removing peer id " << mit->first << ", since it has no messages" << std::endl;
|
||||||
|
#endif
|
||||||
mMessages.erase(mit) ;
|
mMessages.erase(mit) ;
|
||||||
mit = mit2 ;
|
mit = mit2 ;
|
||||||
|
|
||||||
@ -306,7 +316,9 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
|
|||||||
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(msgItem->chatPeerId);
|
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(msgItem->chatPeerId);
|
||||||
msgItem->msgId = nextMsgId++;
|
msgItem->msgId = nextMsgId++;
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "Loading msg history item: peer id=" << msgItem->chatPeerId << "), msg id =" << msgItem->msgId << std::endl;
|
std::cerr << "Loading msg history item: peer id=" << msgItem->chatPeerId << "), msg id =" << msgItem->msgId << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mit != mMessages.end()) {
|
if (mit != mMessages.end()) {
|
||||||
mit->second.insert(std::make_pair(msgItem->msgId, msgItem));
|
mit->second.insert(std::make_pair(msgItem->msgId, msgItem));
|
||||||
@ -344,7 +356,9 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
|
|||||||
if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
||||||
mMaxStorageDurationSeconds = val ;
|
mMaxStorageDurationSeconds = val ;
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "Loaded max storage time for history = " << val << " seconds" << std::endl;
|
std::cerr << "Loaded max storage time for history = " << val << " seconds" << std::endl;
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +460,9 @@ bool p3HistoryMgr::getMessages(const ChatId &chatId, std::list<HistoryMsg> &msgs
|
|||||||
if(!chatIdToVirtualPeerId(chatId, chatPeerId))
|
if(!chatIdToVirtualPeerId(chatId, chatPeerId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "Getting history for virtual peer " << chatPeerId << std::endl;
|
std::cerr << "Getting history for virtual peer " << chatPeerId << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t foundCount = 0;
|
uint32_t foundCount = 0;
|
||||||
|
|
||||||
@ -467,7 +483,9 @@ bool p3HistoryMgr::getMessages(const ChatId &chatId, std::list<HistoryMsg> &msgs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << msgs.size() << " messages added." << std::endl;
|
std::cerr << msgs.size() << " messages added." << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -497,7 +515,9 @@ void p3HistoryMgr::clear(const ChatId &chatId)
|
|||||||
if(!chatIdToVirtualPeerId(chatId, chatPeerId))
|
if(!chatIdToVirtualPeerId(chatId, chatPeerId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "********** p3History::clear()called for virtual peer id " << chatPeerId << std::endl;
|
std::cerr << "********** p3History::clear()called for virtual peer id " << chatPeerId << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(chatPeerId);
|
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(chatPeerId);
|
||||||
if (mit == mMessages.end()) {
|
if (mit == mMessages.end()) {
|
||||||
@ -523,7 +543,9 @@ void p3HistoryMgr::removeMessages(const std::list<uint32_t> &msgIds)
|
|||||||
std::list<uint32_t> removedIds;
|
std::list<uint32_t> removedIds;
|
||||||
std::list<uint32_t>::iterator iit;
|
std::list<uint32_t>::iterator iit;
|
||||||
|
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "********** p3History::removeMessages called()" << std::endl;
|
std::cerr << "********** p3History::removeMessages called()" << std::endl;
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
@ -536,7 +558,9 @@ void p3HistoryMgr::removeMessages(const std::list<uint32_t> &msgIds)
|
|||||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit = mit->second.find(*iit);
|
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit = mit->second.find(*iit);
|
||||||
if (lit != mit->second.end())
|
if (lit != mit->second.end())
|
||||||
{
|
{
|
||||||
|
#ifdef HISTMGR_DEBUG
|
||||||
std::cerr << "**** Removing " << mit->first << " msg id = " << lit->first << std::endl;
|
std::cerr << "**** Removing " << mit->first << " msg id = " << lit->first << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
delete(lit->second);
|
delete(lit->second);
|
||||||
mit->second.erase(lit);
|
mit->second.erase(lit);
|
||||||
|
@ -964,24 +964,25 @@ bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, bool isIncom
|
|||||||
if (flags == RS_NET_CONN_UDP_ALL)
|
if (flags == RS_NET_CONN_UDP_ALL)
|
||||||
{
|
{
|
||||||
#ifdef LINKMGR_DEBUG
|
#ifdef LINKMGR_DEBUG
|
||||||
#endif
|
|
||||||
std::cerr << "p3LinkMgrIMPL::connectResult() Sending Feedback for UDP connection";
|
std::cerr << "p3LinkMgrIMPL::connectResult() Sending Feedback for UDP connection";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
#ifdef LINKMGR_DEBUG
|
#ifdef LINKMGR_DEBUG
|
||||||
#endif
|
|
||||||
std::cerr << "p3LinkMgrIMPL::connectResult() UDP Update CONNECTED to: " << id;
|
std::cerr << "p3LinkMgrIMPL::connectResult() UDP Update CONNECTED to: " << id;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
mNetMgr->netAssistStatusUpdate(id, NETMGR_DHT_FEEDBACK_CONNECTED);
|
mNetMgr->netAssistStatusUpdate(id, NETMGR_DHT_FEEDBACK_CONNECTED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef LINKMGR_DEBUG
|
#ifdef LINKMGR_DEBUG
|
||||||
#endif
|
|
||||||
std::cerr << "p3LinkMgrIMPL::connectResult() UDP Update FAILED to: " << id;
|
std::cerr << "p3LinkMgrIMPL::connectResult() UDP Update FAILED to: " << id;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* have no differentiation between failure and closed? */
|
/* have no differentiation between failure and closed? */
|
||||||
mNetMgr->netAssistStatusUpdate(id, NETMGR_DHT_FEEDBACK_CONN_FAILED);
|
mNetMgr->netAssistStatusUpdate(id, NETMGR_DHT_FEEDBACK_CONN_FAILED);
|
||||||
@ -1624,6 +1625,17 @@ bool p3LinkMgrIMPL::retryConnectTCP(const RsPeerId &id)
|
|||||||
/* first possibility - is it a hidden peer */
|
/* first possibility - is it a hidden peer */
|
||||||
if (mPeerMgr->isHiddenPeer(id))
|
if (mPeerMgr->isHiddenPeer(id))
|
||||||
{
|
{
|
||||||
|
/* check for valid hidden type */
|
||||||
|
uint32_t type = mPeerMgr->getHiddenType(id);
|
||||||
|
if (type & (~RS_HIDDEN_TYPE_MASK))
|
||||||
|
{
|
||||||
|
#ifdef LINKMGR_DEBUG
|
||||||
|
std::cerr << "p3LinkMgrIMPL::retryConnectTCP() invalid hidden type (" << type << ") -> return false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct sockaddr_storage proxy_addr;
|
struct sockaddr_storage proxy_addr;
|
||||||
std::string domain_addr;
|
std::string domain_addr;
|
||||||
uint16_t domain_port;
|
uint16_t domain_port;
|
||||||
@ -1636,7 +1648,7 @@ bool p3LinkMgrIMPL::retryConnectTCP(const RsPeerId &id)
|
|||||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||||
if (mFriendList.end() != (it = mFriendList.find(id)))
|
if (mFriendList.end() != (it = mFriendList.find(id)))
|
||||||
{
|
{
|
||||||
locked_ConnectAttempt_ProxyAddress(&(it->second), proxy_addr, domain_addr, domain_port);
|
locked_ConnectAttempt_ProxyAddress(&(it->second), type, proxy_addr, domain_addr, domain_port);
|
||||||
return locked_ConnectAttempt_Complete(&(it->second));
|
return locked_ConnectAttempt_Complete(&(it->second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1698,7 +1710,7 @@ bool p3LinkMgrIMPL::retryConnectTCP(const RsPeerId &id)
|
|||||||
|
|
||||||
#define MAX_TCP_ADDR_AGE (3600 * 24 * 14) // two weeks in seconds.
|
#define MAX_TCP_ADDR_AGE (3600 * 24 * 14) // two weeks in seconds.
|
||||||
|
|
||||||
bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &addr, time_t age)
|
bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &addr, time_t age)
|
||||||
{
|
{
|
||||||
#ifdef LINKMGR_DEBUG
|
#ifdef LINKMGR_DEBUG
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr(";
|
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr(";
|
||||||
@ -1719,13 +1731,8 @@ bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &ad
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValid = sockaddr_storage_isValidNet(addr);
|
|
||||||
bool isLoopback = sockaddr_storage_isLoopbackNet(addr);
|
|
||||||
// bool isPrivate = sockaddr_storage_isPrivateNet(addr);
|
|
||||||
bool isExternal = sockaddr_storage_isExternalNet(addr);
|
|
||||||
|
|
||||||
/* if invalid - quick rejection */
|
/* if invalid - quick rejection */
|
||||||
if (!isValid)
|
if ( ! sockaddr_storage_isValidNet(addr) )
|
||||||
{
|
{
|
||||||
#ifdef LINKMGR_DEBUG
|
#ifdef LINKMGR_DEBUG
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() REJECTING - INVALID";
|
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() REJECTING - INVALID";
|
||||||
@ -1760,60 +1767,7 @@ bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &ad
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if it is an external address, we'll accept it.
|
return true;
|
||||||
* - even it is meant to be a local address.
|
|
||||||
*/
|
|
||||||
if (isExternal)
|
|
||||||
{
|
|
||||||
#ifdef LINKMGR_DEBUG
|
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() ACCEPTING - EXTERNAL";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* if loopback, then okay - probably proxy connection (or local testing).
|
|
||||||
*/
|
|
||||||
if (isLoopback)
|
|
||||||
{
|
|
||||||
#ifdef LINKMGR_DEBUG
|
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() ACCEPTING - LOOPBACK";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* get here, it is private or loopback
|
|
||||||
* - can only connect to these addresses if we are on the same subnet.
|
|
||||||
- check net against our local address.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef LINKMGR_DEBUG
|
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() Checking sameNet against: ";
|
|
||||||
std::cerr << sockaddr_storage_iptostring(mLocalAddress);
|
|
||||||
std::cerr << ")";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sockaddr_storage_samenet(mLocalAddress, addr))
|
|
||||||
{
|
|
||||||
#ifdef LINKMGR_DEBUG
|
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() ACCEPTING - PRIVATE & sameNET";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef LINKMGR_DEBUG
|
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() REJECTING - PRIVATE & !sameNET";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* else it fails */
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2018,7 +1972,7 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_AddDynDNS(peerConnectState *peer, std
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer, const struct sockaddr_storage &proxy_addr, const std::string &domain_addr, uint16_t domain_port)
|
void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer, const uint32_t type, const struct sockaddr_storage &proxy_addr, const std::string &domain_addr, uint16_t domain_port)
|
||||||
{
|
{
|
||||||
#ifdef LINKMGR_DEBUG
|
#ifdef LINKMGR_DEBUG
|
||||||
std::cerr << "p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress() trying address: " << domain_addr << ":" << domain_port << std::endl;
|
std::cerr << "p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress() trying address: " << domain_addr << ":" << domain_port << std::endl;
|
||||||
@ -2026,7 +1980,22 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer,
|
|||||||
peerConnectAddress pca;
|
peerConnectAddress pca;
|
||||||
pca.addr = proxy_addr;
|
pca.addr = proxy_addr;
|
||||||
|
|
||||||
pca.type = RS_NET_CONN_TCP_HIDDEN;
|
switch (type) {
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
pca.type = RS_NET_CONN_TCP_HIDDEN_TOR;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
pca.type = RS_NET_CONN_TCP_HIDDEN_I2P;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
/**** THIS CASE SHOULD NOT BE TRIGGERED - since this function is called with a valid hidden type only ****/
|
||||||
|
std::cerr << "p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress() hidden type of addr: " << domain_addr << " is unkown -> THIS SHOULD NEVER HAPPEN!" << std::endl;
|
||||||
|
std::cerr << " - peer : " << peer->id << "(" << peer->name << ")" << std::endl;
|
||||||
|
std::cerr << " - proxy: " << sockaddr_storage_tostring(proxy_addr) << std::endl;
|
||||||
|
std::cerr << " - addr : " << domain_addr << ":" << domain_port << std::endl;
|
||||||
|
pca.type = RS_NET_CONN_TCP_UNKNOW_TOPOLOGY;
|
||||||
|
}
|
||||||
|
|
||||||
//for the delay, we add a random time and some more time when the friend list is big
|
//for the delay, we add a random time and some more time when the friend list is big
|
||||||
pca.delay = P3CONNMGR_TCP_DEFAULT_DELAY;
|
pca.delay = P3CONNMGR_TCP_DEFAULT_DELAY;
|
||||||
|
@ -40,16 +40,17 @@ class DNSResolver ;
|
|||||||
|
|
||||||
|
|
||||||
/* order of attempts ... */
|
/* order of attempts ... */
|
||||||
const uint32_t RS_NET_CONN_TCP_ALL = 0x000f;
|
const uint32_t RS_NET_CONN_TCP_ALL = 0x00ff;
|
||||||
const uint32_t RS_NET_CONN_UDP_ALL = 0x00f0;
|
const uint32_t RS_NET_CONN_UDP_ALL = 0x0f00;
|
||||||
|
|
||||||
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
|
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
|
||||||
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
|
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
|
||||||
const uint32_t RS_NET_CONN_TCP_UNKNOW_TOPOLOGY = 0x0004;
|
const uint32_t RS_NET_CONN_TCP_UNKNOW_TOPOLOGY = 0x0004;
|
||||||
const uint32_t RS_NET_CONN_TCP_HIDDEN = 0x0008;
|
const uint32_t RS_NET_CONN_TCP_HIDDEN_TOR = 0x0008;
|
||||||
|
const uint32_t RS_NET_CONN_TCP_HIDDEN_I2P = 0x0010;
|
||||||
|
|
||||||
const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0010;
|
const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0100;
|
||||||
const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0020; /* coming soon */
|
const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0200; /* coming soon */
|
||||||
|
|
||||||
// These are set in pqipersongroup.
|
// These are set in pqipersongroup.
|
||||||
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
|
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
|
||||||
@ -302,7 +303,7 @@ void locked_ConnectAttempt_CurrentAddresses(peerConnectState *peer, const struc
|
|||||||
void locked_ConnectAttempt_HistoricalAddresses(peerConnectState *peer, const pqiIpAddrSet &ipAddrs);
|
void locked_ConnectAttempt_HistoricalAddresses(peerConnectState *peer, const pqiIpAddrSet &ipAddrs);
|
||||||
void locked_ConnectAttempt_AddDynDNS(peerConnectState *peer, std::string dyndns, uint16_t dynPort);
|
void locked_ConnectAttempt_AddDynDNS(peerConnectState *peer, std::string dyndns, uint16_t dynPort);
|
||||||
void locked_ConnectAttempt_AddTunnel(peerConnectState *peer);
|
void locked_ConnectAttempt_AddTunnel(peerConnectState *peer);
|
||||||
void locked_ConnectAttempt_ProxyAddress(peerConnectState *peer, const struct sockaddr_storage &proxy_addr, const std::string &domain_addr, uint16_t domain_port);
|
void locked_ConnectAttempt_ProxyAddress(peerConnectState *peer, const uint32_t type, const struct sockaddr_storage &proxy_addr, const std::string &domain_addr, uint16_t domain_port);
|
||||||
|
|
||||||
bool locked_ConnectAttempt_Complete(peerConnectState *peer);
|
bool locked_ConnectAttempt_Complete(peerConnectState *peer);
|
||||||
|
|
||||||
|
@ -696,9 +696,9 @@ void p3NetMgrIMPL::netExtCheck()
|
|||||||
bool isStable = false;
|
bool isStable = false;
|
||||||
struct sockaddr_storage tmpip ;
|
struct sockaddr_storage tmpip ;
|
||||||
|
|
||||||
std::map<sockaddr_storage,ZeroInt> address_votes ;
|
std::map<sockaddr_storage,ZeroInt> address_votes ;
|
||||||
|
|
||||||
/* check for External Address */
|
/* check for External Address */
|
||||||
/* in order of importance */
|
/* in order of importance */
|
||||||
/* (1) UPnP -> which handles itself */
|
/* (1) UPnP -> which handles itself */
|
||||||
{
|
{
|
||||||
@ -708,35 +708,41 @@ void p3NetMgrIMPL::netExtCheck()
|
|||||||
|
|
||||||
/* net Assist */
|
/* net Assist */
|
||||||
if (netAssistExtAddress(tmpip))
|
if (netAssistExtAddress(tmpip))
|
||||||
{
|
{
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext supplied from netAssistExternalAddress()" << std::endl;
|
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext supplied from netAssistExternalAddress()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if(sockaddr_storage_isValidNet(tmpip))
|
if(sockaddr_storage_isValidNet(tmpip))
|
||||||
{
|
{
|
||||||
if(rsBanList->isAddressAccepted(tmpip,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
|
if(rsBanList->isAddressAccepted(tmpip,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
|
||||||
{
|
{
|
||||||
// must be stable???
|
// must be stable???
|
||||||
isStable = true;
|
isStable = true;
|
||||||
mNetFlags.mExtAddr = tmpip;
|
//mNetFlags.mExtAddr = tmpip;
|
||||||
mNetFlags.mExtAddrOk = true;
|
mNetFlags.mExtAddrOk = true;
|
||||||
mNetFlags.mExtAddrStableOk = isStable;
|
mNetFlags.mExtAddrStableOk = isStable;
|
||||||
|
|
||||||
address_votes[tmpip].n++ ;
|
address_votes[tmpip].n++ ;
|
||||||
}
|
|
||||||
else
|
std::cerr << "NetAssistAddress reported external address " << sockaddr_storage_iptostring(tmpip) << std::endl;
|
||||||
std::cerr << "(SS) netAssisExternalAddress returned wrong own IP " << sockaddr_storage_iptostring(tmpip) << " (banned). Rejecting." << std::endl;
|
}
|
||||||
}
|
else
|
||||||
|
std::cerr << "(SS) netAssisExternalAddress returned banned own IP " << sockaddr_storage_iptostring(tmpip) << " (banned). Rejecting." << std::endl;
|
||||||
|
}
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() Bad Address supplied from netAssistExternalAddress()" << std::endl;
|
std::cerr << "p3NetMgrIMPL::netExtCheck() Bad Address supplied from netAssistExternalAddress()" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ALLOW_DHT_STUNNER
|
||||||
|
// (cyril) I disabled this because it's pretty dangerous. The DHT can report a wrong address quite easily
|
||||||
|
// if the other DHT peers are not collaborating.
|
||||||
|
|
||||||
/* Next ask the DhtStunner */
|
/* Next ask the DhtStunner */
|
||||||
{
|
{
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
@ -748,30 +754,31 @@ void p3NetMgrIMPL::netExtCheck()
|
|||||||
|
|
||||||
if (mDhtStunner)
|
if (mDhtStunner)
|
||||||
{
|
{
|
||||||
/* input network bits */
|
/* input network bits */
|
||||||
if (mDhtStunner->getExternalAddr(tmpaddr, isstable))
|
if (mDhtStunner->getExternalAddr(tmpaddr, isstable))
|
||||||
{
|
{
|
||||||
if(rsBanList->isAddressAccepted(tmpaddr,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
|
if(rsBanList->isAddressAccepted(tmpaddr,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
|
||||||
{
|
{
|
||||||
// must be stable???
|
// must be stable???
|
||||||
isStable = (isstable == 1);
|
isStable = (isstable == 1);
|
||||||
mNetFlags.mExtAddr = tmpaddr;
|
//mNetFlags.mExtAddr = tmpaddr;
|
||||||
mNetFlags.mExtAddrOk = true;
|
mNetFlags.mExtAddrOk = true;
|
||||||
mNetFlags.mExtAddrStableOk = isStable;
|
mNetFlags.mExtAddrStableOk = isStable;
|
||||||
|
|
||||||
address_votes[tmpaddr].n++ ;
|
address_votes[tmpaddr].n++ ;
|
||||||
#ifdef NETMGR_DEBUG_STATEBOX
|
#ifdef NETMGR_DEBUG_STATEBOX
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() From DhtStunner: ";
|
std::cerr << "p3NetMgrIMPL::netExtCheck() From DhtStunner: ";
|
||||||
std::cerr << sockaddr_storage_tostring(tmpaddr);
|
std::cerr << sockaddr_storage_tostring(tmpaddr);
|
||||||
std::cerr << " Stable: " << (uint32_t) isstable;
|
std::cerr << " Stable: " << (uint32_t) isstable;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cerr << "(SS) DHTStunner returned wrong own IP " << sockaddr_storage_iptostring(tmpaddr) << " (banned). Rejecting." << std::endl;
|
std::cerr << "(SS) DHTStunner returned wrong own IP " << sockaddr_storage_iptostring(tmpaddr) << " (banned). Rejecting." << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* otherwise ask ExtAddrFinder */
|
/* otherwise ask ExtAddrFinder */
|
||||||
{
|
{
|
||||||
@ -782,119 +789,159 @@ void p3NetMgrIMPL::netExtCheck()
|
|||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() checking ExtAddrFinder" << std::endl;
|
std::cerr << "p3NetMgrIMPL::netExtCheck() checking ExtAddrFinder" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
bool extFinderOk = mExtAddrFinder->hasValidIP(tmpip);
|
bool extFinderOk = mExtAddrFinder->hasValidIP(tmpip);
|
||||||
if (extFinderOk)
|
if (extFinderOk)
|
||||||
{
|
{
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext supplied by ExtAddrFinder" << std::endl;
|
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext supplied by ExtAddrFinder" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
/* best guess at port */
|
/* best guess at port */
|
||||||
sockaddr_storage_setport(tmpip, sockaddr_storage_port(mLocalAddr));
|
sockaddr_storage_setport(tmpip, sockaddr_storage_port(mLocalAddr));
|
||||||
|
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() ";
|
std::cerr << "p3NetMgrIMPL::netExtCheck() ";
|
||||||
std::cerr << "ExtAddr: " << sockaddr_storage_tostring(tmpip);
|
std::cerr << "ExtAddr: " << sockaddr_storage_tostring(tmpip);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mNetFlags.mExtAddr = tmpip;
|
//mNetFlags.mExtAddr = tmpip;
|
||||||
mNetFlags.mExtAddrOk = true;
|
mNetFlags.mExtAddrOk = true;
|
||||||
|
|
||||||
address_votes[tmpip].n++ ;
|
address_votes[tmpip].n++ ;
|
||||||
|
|
||||||
/* XXX HACK TO FIX */
|
/* XXX HACK TO FIX */
|
||||||
#warning "ALLOWING ExtAddrFinder -> ExtAddrStableOk = true (which it is not normally)"
|
#warning "ALLOWING ExtAddrFinder -> ExtAddrStableOk = true (which it is not normally)"
|
||||||
mNetFlags.mExtAddrStableOk = true;
|
mNetFlags.mExtAddrStableOk = true;
|
||||||
|
|
||||||
|
std::cerr << "ExtAddrFinder reported external address " << sockaddr_storage_iptostring(tmpip) << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* any other sources ??? */
|
/* also ask peer mgr. */
|
||||||
|
|
||||||
|
if (mPeerMgr)
|
||||||
|
{
|
||||||
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
|
std::cerr << "p3NetMgrIMPL::netExtCheck() checking mPeerMgr" << std::endl;
|
||||||
|
#endif
|
||||||
|
uint8_t isstable ; // unused
|
||||||
|
sockaddr_storage tmpaddr ;
|
||||||
|
|
||||||
|
if (mPeerMgr->getExtAddressReportedByFriends(tmpaddr, isstable))
|
||||||
|
{
|
||||||
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
|
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext supplied by ExtAddrFinder" << std::endl;
|
||||||
|
#endif
|
||||||
|
/* best guess at port */
|
||||||
|
sockaddr_storage_setport(tmpaddr, sockaddr_storage_port(mLocalAddr));
|
||||||
|
|
||||||
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
|
std::cerr << "p3NetMgrIMPL::netExtCheck() ";
|
||||||
|
std::cerr << "ExtAddr: " << sockaddr_storage_tostring(tmpip);
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//mNetFlags.mExtAddr = tmpaddr;
|
||||||
|
mNetFlags.mExtAddrOk = true;
|
||||||
|
mNetFlags.mExtAddrStableOk = isstable;
|
||||||
|
|
||||||
|
address_votes[tmpaddr].n++ ;
|
||||||
|
|
||||||
|
std::cerr << "PeerMgr reported external address " << sockaddr_storage_iptostring(tmpaddr) << std::endl;
|
||||||
|
}
|
||||||
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
|
else
|
||||||
|
std::cerr << " No reliable address returned." << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* any other sources ??? */
|
||||||
|
|
||||||
/* finalise address */
|
/* finalise address */
|
||||||
if (mNetFlags.mExtAddrOk)
|
if (mNetFlags.mExtAddrOk)
|
||||||
{
|
{
|
||||||
// look at votes.
|
// look at votes.
|
||||||
|
|
||||||
std::cerr << "Figuring out ext addr from voting:" << std::endl;
|
std::cerr << "Figuring out ext addr from voting:" << std::endl;
|
||||||
uint32_t admax = 0 ;
|
uint32_t admax = 0 ;
|
||||||
|
|
||||||
for(std::map<sockaddr_storage,ZeroInt>::const_iterator it(address_votes.begin());it!=address_votes.end();++it)
|
for(std::map<sockaddr_storage,ZeroInt>::const_iterator it(address_votes.begin());it!=address_votes.end();++it)
|
||||||
{
|
{
|
||||||
std::cerr << " Vote: " << sockaddr_storage_iptostring(it->first) << " : " << it->second.n << " votes." ;
|
std::cerr << " Vote: " << sockaddr_storage_iptostring(it->first) << " : " << it->second.n << " votes." ;
|
||||||
|
|
||||||
if(it->second.n > admax)
|
if(it->second.n > admax)
|
||||||
{
|
{
|
||||||
mNetFlags.mExtAddr = it->first ;
|
mNetFlags.mExtAddr = it->first ;
|
||||||
admax = it->second.n ;
|
admax = it->second.n ;
|
||||||
|
|
||||||
std::cerr << " Kept!" << std::endl;
|
std::cerr << " Kept!" << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cerr << " Discarded." << std::endl;
|
std::cerr << " Discarded." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() ";
|
std::cerr << "p3NetMgrIMPL::netExtCheck() ";
|
||||||
std::cerr << "ExtAddr: " << sockaddr_storage_tostring(mNetFlags.mExtAddr);
|
std::cerr << "ExtAddr: " << sockaddr_storage_tostring(mNetFlags.mExtAddr);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
//update ip address list
|
//update ip address list
|
||||||
mExtAddr = mNetFlags.mExtAddr;
|
mExtAddr = mNetFlags.mExtAddr;
|
||||||
|
|
||||||
mNetStatus = RS_NET_DONE;
|
mNetStatus = RS_NET_DONE;
|
||||||
netSetupDone = true;
|
netSetupDone = true;
|
||||||
|
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext Ok: RS_NET_DONE" << std::endl;
|
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext Ok: RS_NET_DONE" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!mNetFlags.mExtAddrStableOk)
|
if (!mNetFlags.mExtAddrStableOk)
|
||||||
{
|
{
|
||||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||||
std::cerr << "p3NetMgrIMPL::netUdpCheck() UDP Unstable :( ";
|
std::cerr << "p3NetMgrIMPL::netUdpCheck() UDP Unstable :( ";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "p3NetMgrIMPL::netUdpCheck() We are unreachable";
|
std::cerr << "p3NetMgrIMPL::netUdpCheck() We are unreachable";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "netMode => RS_NET_MODE_UNREACHABLE";
|
std::cerr << "netMode => RS_NET_MODE_UNREACHABLE";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Due to the new UDP connections - we can still connect some of the time!
|
// Due to the new UDP connections - we can still connect some of the time!
|
||||||
// So limit warning!
|
// So limit warning!
|
||||||
|
|
||||||
//mNetMode &= ~(RS_NET_MODE_ACTUAL);
|
//mNetMode &= ~(RS_NET_MODE_ACTUAL);
|
||||||
//mNetMode |= RS_NET_MODE_UNREACHABLE;
|
//mNetMode |= RS_NET_MODE_UNREACHABLE;
|
||||||
|
|
||||||
/* send a system warning message */
|
/* send a system warning message */
|
||||||
//pqiNotify *notify = getPqiNotify();
|
//pqiNotify *notify = getPqiNotify();
|
||||||
//if (notify)
|
//if (notify)
|
||||||
{
|
{
|
||||||
std::string title =
|
std::string title =
|
||||||
"Warning: Bad Firewall Configuration";
|
"Warning: Bad Firewall Configuration";
|
||||||
|
|
||||||
std::string msg;
|
std::string msg;
|
||||||
msg += " **** WARNING **** \n";
|
msg += " **** WARNING **** \n";
|
||||||
msg += "Retroshare has detected that you are behind";
|
msg += "Retroshare has detected that you are behind";
|
||||||
msg += " a restrictive Firewall\n";
|
msg += " a restrictive Firewall\n";
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
msg += "You will have limited connectivity to other firewalled peers\n";
|
msg += "You will have limited connectivity to other firewalled peers\n";
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
msg += "You can fix this by:\n";
|
msg += "You can fix this by:\n";
|
||||||
msg += " (1) opening an External Port\n";
|
msg += " (1) opening an External Port\n";
|
||||||
msg += " (2) enabling UPnP, or\n";
|
msg += " (2) enabling UPnP, or\n";
|
||||||
msg += " (3) get a new (approved) Firewall/Router\n";
|
msg += " (3) get a new (approved) Firewall/Router\n";
|
||||||
|
|
||||||
//notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
|
//notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
|
||||||
|
|
||||||
std::cerr << msg << std::endl;
|
std::cerr << msg << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNetFlags.mExtAddrOk)
|
if (mNetFlags.mExtAddrOk)
|
||||||
{
|
{
|
||||||
|
@ -74,17 +74,20 @@ const uint32_t PEER_IP_CONNECT_STATE_MAX_LIST_SIZE = 4;
|
|||||||
#define MIN_RETRY_PERIOD 140
|
#define MIN_RETRY_PERIOD 140
|
||||||
|
|
||||||
static const std::string kConfigDefaultProxyServerIpAddr = "127.0.0.1";
|
static const std::string kConfigDefaultProxyServerIpAddr = "127.0.0.1";
|
||||||
static const uint16_t kConfigDefaultProxyServerPort = 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 std::string kConfigKeyExtIpFinder = "USE_EXTR_IP_FINDER";
|
static const std::string kConfigKeyExtIpFinder = "USE_EXTR_IP_FINDER";
|
||||||
static const std::string kConfigKeyProxyServerIpAddr = "PROXY_SERVER_IPADDR";
|
static const std::string kConfigKeyProxyServerIpAddrTor = "PROXY_SERVER_IPADDR";
|
||||||
static const std::string kConfigKeyProxyServerPort = "PROXY_SERVER_PORT";
|
static const std::string kConfigKeyProxyServerPortTor = "PROXY_SERVER_PORT";
|
||||||
|
static const std::string kConfigKeyProxyServerIpAddrI2P = "PROXY_SERVER_IPADDR_I2P";
|
||||||
|
static const std::string kConfigKeyProxyServerPortI2P = "PROXY_SERVER_PORT_I2P";
|
||||||
|
|
||||||
void printConnectState(std::ostream &out, peerState &peer);
|
void printConnectState(std::ostream &out, peerState &peer);
|
||||||
|
|
||||||
peerState::peerState()
|
peerState::peerState()
|
||||||
:netMode(RS_NET_MODE_UNKNOWN), vs_disc(RS_VS_DISC_FULL), vs_dht(RS_VS_DHT_FULL), lastcontact(0),
|
:netMode(RS_NET_MODE_UNKNOWN), vs_disc(RS_VS_DISC_FULL), vs_dht(RS_VS_DHT_FULL), lastcontact(0),
|
||||||
hiddenNode(false), hiddenPort(0)
|
hiddenNode(false), hiddenPort(0), hiddenType(RS_HIDDEN_TYPE_NONE)
|
||||||
{
|
{
|
||||||
sockaddr_storage_clear(localaddr);
|
sockaddr_storage_clear(localaddr);
|
||||||
sockaddr_storage_clear(serveraddr);
|
sockaddr_storage_clear(serveraddr);
|
||||||
@ -130,13 +133,21 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_
|
|||||||
lastGroupId = 1;
|
lastGroupId = 1;
|
||||||
|
|
||||||
// setup default ProxyServerAddress.
|
// setup default ProxyServerAddress.
|
||||||
sockaddr_storage_clear(mProxyServerAddress);
|
// Tor
|
||||||
sockaddr_storage_ipv4_aton(mProxyServerAddress,
|
sockaddr_storage_clear(mProxyServerAddressTor);
|
||||||
|
sockaddr_storage_ipv4_aton(mProxyServerAddressTor,
|
||||||
kConfigDefaultProxyServerIpAddr.c_str());
|
kConfigDefaultProxyServerIpAddr.c_str());
|
||||||
sockaddr_storage_ipv4_setport(mProxyServerAddress,
|
sockaddr_storage_ipv4_setport(mProxyServerAddressTor,
|
||||||
kConfigDefaultProxyServerPort);
|
kConfigDefaultProxyServerPortTor);
|
||||||
|
// I2P
|
||||||
|
sockaddr_storage_clear(mProxyServerAddressI2P);
|
||||||
|
sockaddr_storage_ipv4_aton(mProxyServerAddressI2P,
|
||||||
|
kConfigDefaultProxyServerIpAddr.c_str());
|
||||||
|
sockaddr_storage_ipv4_setport(mProxyServerAddressI2P,
|
||||||
|
kConfigDefaultProxyServerPortI2P);
|
||||||
|
|
||||||
mProxyServerStatus = RS_NET_PROXY_STATUS_UNKNOWN ;
|
mProxyServerStatusTor = RS_NET_PROXY_STATUS_UNKNOWN ;
|
||||||
|
mProxyServerStatusI2P = RS_NET_PROXY_STATUS_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
@ -169,6 +180,7 @@ bool p3PeerMgrIMPL::setupHiddenNode(const std::string &hiddenAddress, const uint
|
|||||||
mOwnState.hiddenNode = true;
|
mOwnState.hiddenNode = true;
|
||||||
mOwnState.hiddenPort = hiddenPort;
|
mOwnState.hiddenPort = hiddenPort;
|
||||||
mOwnState.hiddenDomain = hiddenAddress;
|
mOwnState.hiddenDomain = hiddenAddress;
|
||||||
|
mOwnState.hiddenType = hiddenDomainToHiddenType(hiddenAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
forceHiddenNode();
|
forceHiddenNode();
|
||||||
@ -188,6 +200,7 @@ bool p3PeerMgrIMPL::forceHiddenNode()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
mOwnState.hiddenNode = true;
|
mOwnState.hiddenNode = true;
|
||||||
|
mOwnState.hiddenType = hiddenDomainToHiddenType(mOwnState.hiddenDomain);
|
||||||
|
|
||||||
// force external address - otherwise its invalid.
|
// force external address - otherwise its invalid.
|
||||||
sockaddr_storage_clear(mOwnState.serveraddr);
|
sockaddr_storage_clear(mOwnState.serveraddr);
|
||||||
@ -372,8 +385,43 @@ bool p3PeerMgrIMPL::isHidden()
|
|||||||
return mOwnState.hiddenNode;
|
return mOwnState.hiddenNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief checks the hidden type of the own peer.
|
||||||
|
* @param type type to check
|
||||||
|
* @return true when the peer has the same hidden type than type
|
||||||
|
*/
|
||||||
|
bool p3PeerMgrIMPL::isHidden(const uint32_t type)
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
switch (type) {
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
return mOwnState.hiddenType == RS_HIDDEN_TYPE_TOR;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
return mOwnState.hiddenType == RS_HIDDEN_TYPE_I2P;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::isHidden(" << type << ") unkown type -> false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
|
bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
|
||||||
|
{
|
||||||
|
return isHiddenPeer(ssl_id, RS_HIDDEN_TYPE_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief checks the hidden type of a given ssl id. When type RS_HIDDEN_TYPE_NONE is choosen it returns the 'hiddenNode' value instead
|
||||||
|
* @param ssl_id to check
|
||||||
|
* @param type type to check. Use RS_HIDDEN_TYPE_NONE to check 'hiddenNode' value
|
||||||
|
* @return true when the peer has the same hidden type than type
|
||||||
|
*/
|
||||||
|
bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
@ -394,9 +442,91 @@ bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
|
|||||||
std::cerr << "p3PeerMgrIMPL::isHiddenPeer(" << ssl_id << ") = " << (it->second).hiddenNode;
|
std::cerr << "p3PeerMgrIMPL::isHiddenPeer(" << ssl_id << ") = " << (it->second).hiddenNode;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return (it->second).hiddenNode;
|
switch (type) {
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
return (it->second).hiddenType == RS_HIDDEN_TYPE_TOR;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
return (it->second).hiddenType == RS_HIDDEN_TYPE_I2P;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return (it->second).hiddenNode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasEnding (std::string const &fullString, std::string const &ending) {
|
||||||
|
if (fullString.length() < ending.length())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resolves the hidden type (tor or i2p) from a domain
|
||||||
|
* @param domain to check
|
||||||
|
* @return RS_HIDDEN_TYPE_TOR, RS_HIDDEN_TYPE_I2P or RS_HIDDEN_TYPE_NONE
|
||||||
|
*
|
||||||
|
* Tor: ^[a-z2-7]{16}\.onion$
|
||||||
|
*
|
||||||
|
* I2P: There is more than one address:
|
||||||
|
* - pub. key in base64
|
||||||
|
* - hash in base32 ( ^[a-z2-7]{52}\.b32\.i2p$ )
|
||||||
|
* - "normal" .i2p domains
|
||||||
|
*/
|
||||||
|
uint32_t p3PeerMgrIMPL::hiddenDomainToHiddenType(const std::string &domain)
|
||||||
|
{
|
||||||
|
if(hasEnding(domain, ".onion"))
|
||||||
|
return RS_HIDDEN_TYPE_TOR;
|
||||||
|
if(hasEnding(domain, ".i2p"))
|
||||||
|
return RS_HIDDEN_TYPE_I2P;
|
||||||
|
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::hiddenDomainToHiddenType() unknown hidden type: " << domain;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return RS_HIDDEN_TYPE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief returns the hidden type of a peer
|
||||||
|
* @param ssl_id peer id
|
||||||
|
* @return hidden type
|
||||||
|
*/
|
||||||
|
uint32_t p3PeerMgrIMPL::getHiddenType(const RsPeerId &ssl_id)
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
|
if (ssl_id == AuthSSL::getAuthSSL()->OwnId())
|
||||||
|
return mOwnState.hiddenType;
|
||||||
|
|
||||||
|
/* check for existing */
|
||||||
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
|
it = mFriendList.find(ssl_id);
|
||||||
|
if (it == mFriendList.end())
|
||||||
|
{
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::getHiddenType(" << ssl_id << ") Missing Peer => false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::getHiddenType(" << ssl_id << ") = " << (it->second).hiddenType;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return (it->second).hiddenType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief sets hidden domain and port for a given ssl ID
|
||||||
|
* @param ssl_id peer to set domain and port for
|
||||||
|
* @param domain_addr
|
||||||
|
* @param domain_port
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::string &domain_addr, const uint16_t domain_port)
|
bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::string &domain_addr, const uint16_t domain_port)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
@ -426,6 +556,7 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
|
|||||||
mOwnState.hiddenNode = true;
|
mOwnState.hiddenNode = true;
|
||||||
mOwnState.hiddenDomain = domain;
|
mOwnState.hiddenDomain = domain;
|
||||||
mOwnState.hiddenPort = domain_port;
|
mOwnState.hiddenPort = domain_port;
|
||||||
|
mOwnState.hiddenType = hiddenDomainToHiddenType(domain);
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set own State";
|
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set own State";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -448,6 +579,7 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
|
|||||||
it->second.hiddenDomain = domain;
|
it->second.hiddenDomain = domain;
|
||||||
it->second.hiddenPort = domain_port;
|
it->second.hiddenPort = domain_port;
|
||||||
it->second.hiddenNode = true;
|
it->second.hiddenNode = true;
|
||||||
|
it->second.hiddenType = hiddenDomainToHiddenType(domain);
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set Peers State";
|
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set Peers State";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -456,15 +588,40 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::setProxyServerAddress(const struct sockaddr_storage &proxy_addr)
|
/**
|
||||||
|
* @brief sets the proxy server address for a hidden service
|
||||||
|
* @param type hidden service type
|
||||||
|
* @param proxy_addr proxy address
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
bool p3PeerMgrIMPL::setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
if (!sockaddr_storage_same(mProxyServerAddress,proxy_addr))
|
switch (type) {
|
||||||
{
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
if (!sockaddr_storage_same(mProxyServerAddressI2P, proxy_addr))
|
||||||
mProxyServerAddress = proxy_addr;
|
{
|
||||||
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
mProxyServerAddressI2P = proxy_addr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
if (!sockaddr_storage_same(mProxyServerAddressTor, proxy_addr))
|
||||||
|
{
|
||||||
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
mProxyServerAddressTor = proxy_addr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::setProxyServerAddress() unknown hidden type " << type << " -> false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,21 +637,71 @@ bool p3PeerMgrIMPL::resetOwnExternalAddressList()
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::getProxyServerStatus(uint32_t& proxy_status)
|
/**
|
||||||
{
|
* @brief returs proxy server status for a hidden service proxy
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
* @param type hidden service type
|
||||||
|
* @param proxy_status
|
||||||
proxy_status = mProxyServerStatus;
|
* @return true on success
|
||||||
return true;
|
*/
|
||||||
}
|
bool p3PeerMgrIMPL::getProxyServerStatus(const uint32_t type, uint32_t& proxy_status)
|
||||||
bool p3PeerMgrIMPL::getProxyServerAddress(struct sockaddr_storage &proxy_addr)
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
proxy_addr = mProxyServerAddress;
|
switch (type) {
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
proxy_status = mProxyServerStatusI2P;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
proxy_status = mProxyServerStatusTor;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::getProxyServerStatus() unknown hidden type " << type << " -> false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief returs proxy server address for a hidden service proxy
|
||||||
|
* @param type hidden service type
|
||||||
|
* @param proxy_addr
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
bool p3PeerMgrIMPL::getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr)
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
proxy_addr = mProxyServerAddressI2P;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
proxy_addr = mProxyServerAddressTor;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::getProxyServerAddress() unknown hidden type " << type << " -> false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief looks up the proxy address and domain/port that have to be used when connecting to a peer
|
||||||
|
* @param ssl_id peer to connect to
|
||||||
|
* @param proxy_addr proxy address to be used
|
||||||
|
* @param domain_addr domain to connect to
|
||||||
|
* @param domain_port port to connect to
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port)
|
bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
@ -515,7 +722,21 @@ bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_stor
|
|||||||
domain_addr = it->second.hiddenDomain;
|
domain_addr = it->second.hiddenDomain;
|
||||||
domain_port = it->second.hiddenPort;
|
domain_port = it->second.hiddenPort;
|
||||||
|
|
||||||
proxy_addr = mProxyServerAddress;
|
switch (it->second.hiddenType) {
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
proxy_addr = mProxyServerAddressI2P;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
proxy_addr = mProxyServerAddressTor;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "p3PeerMgrIMPL::getProxyAddress() no valid hidden type (" << it->second.hiddenType << ") for peer id " << ssl_id << " -> false";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,7 +1026,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPgpId &id)
|
|||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
/* move to othersList */
|
/* move to othersList */
|
||||||
bool success = false;
|
//bool success = false;
|
||||||
std::map<RsPeerId, peerState>::iterator it;
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
//remove ssl and gpg_ids
|
//remove ssl and gpg_ids
|
||||||
for(it = mFriendList.begin(); it != mFriendList.end(); ++it)
|
for(it = mFriendList.begin(); it != mFriendList.end(); ++it)
|
||||||
@ -822,7 +1043,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPgpId &id)
|
|||||||
mOthersList[it->second.id] = peer;
|
mOthersList[it->second.id] = peer;
|
||||||
mStatusChanged = true;
|
mStatusChanged = true;
|
||||||
|
|
||||||
success = true;
|
//success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,7 +1099,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPeerId &id, bool removePgpId)
|
|||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
/* move to othersList */
|
/* move to othersList */
|
||||||
bool success = false;
|
//bool success = false;
|
||||||
std::map<RsPeerId, peerState>::iterator it;
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
//remove ssl and gpg_ids
|
//remove ssl and gpg_ids
|
||||||
for(it = mFriendList.begin(); it != mFriendList.end(); ++it)
|
for(it = mFriendList.begin(); it != mFriendList.end(); ++it)
|
||||||
@ -897,7 +1118,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPeerId &id, bool removePgpId)
|
|||||||
mOthersList[id] = peer;
|
mOthersList[id] = peer;
|
||||||
mStatusChanged = true;
|
mStatusChanged = true;
|
||||||
|
|
||||||
success = true;
|
//success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1246,20 +1467,51 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons
|
|||||||
// * emit a warnign when the address is unknown
|
// * emit a warnign when the address is unknown
|
||||||
// * if multiple peers report the same address => notify the LinkMgr that the external address had changed.
|
// * if multiple peers report the same address => notify the LinkMgr that the external address had changed.
|
||||||
|
|
||||||
sockaddr_storage addr_filtered ;
|
sockaddr_storage addr_filtered ;
|
||||||
sockaddr_storage_copyip(addr_filtered,addr) ;
|
sockaddr_storage_clear(addr_filtered) ;
|
||||||
|
sockaddr_storage_copyip(addr_filtered,addr) ;
|
||||||
|
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "Own external address is " << sockaddr_storage_iptostring(addr_filtered) << ", as reported by friend " << from << std::endl;
|
std::cerr << "Own external address is " << sockaddr_storage_iptostring(addr_filtered) << ", as reported by friend " << from << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!sockaddr_storage_isExternalNet(addr_filtered))
|
if(!sockaddr_storage_isExternalNet(addr_filtered))
|
||||||
|
{
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << " address is not an external address. Returning false" << std::endl ;
|
||||||
|
#endif
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update a list of own IPs:
|
||||||
|
// - remove old values for that same peer
|
||||||
|
// - remove values for non connected peers
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef PEER_DEBUG
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
std::cerr << " address is not an external address. Returning false" << std::endl ;
|
|
||||||
#endif
|
mReportedOwnAddresses[from] = addr_filtered ;
|
||||||
return false ;
|
|
||||||
|
for(std::map<RsPeerId,sockaddr_storage>::iterator it(mReportedOwnAddresses.begin());it!=mReportedOwnAddresses.end();)
|
||||||
|
if(!mLinkMgr->isOnline(it->first))
|
||||||
|
{
|
||||||
|
std::map<RsPeerId,sockaddr_storage>::iterator tmp(it) ;
|
||||||
|
++tmp ;
|
||||||
|
mReportedOwnAddresses.erase(it) ;
|
||||||
|
it=tmp ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++it ;
|
||||||
|
|
||||||
|
sockaddr_storage current_best_ext_address_guess ;
|
||||||
|
uint32_t count ;
|
||||||
|
|
||||||
|
locked_computeCurrentBestOwnExtAddressCandidate(current_best_ext_address_guess,count) ;
|
||||||
|
|
||||||
|
std::cerr << "p3PeerMgr:: Current external address is calculated to be: " << sockaddr_storage_iptostring(current_best_ext_address_guess) << " (simultaneously reported by " << count << " peers)." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now current
|
||||||
|
|
||||||
sockaddr_storage own_addr ;
|
sockaddr_storage own_addr ;
|
||||||
|
|
||||||
@ -1282,10 +1534,56 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons
|
|||||||
|
|
||||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, from.toStdString(), sockaddr_storage_iptostring(own_addr), sockaddr_storage_iptostring(addr));
|
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, from.toStdString(), sockaddr_storage_iptostring(own_addr), sockaddr_storage_iptostring(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we could also sweep over all connected friends and see if some report a different address.
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool p3PeerMgrIMPL::locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage& addr, uint32_t& count)
|
||||||
|
{
|
||||||
|
std::map<sockaddr_storage,ZeroedInt> addr_counts ;
|
||||||
|
|
||||||
|
for(std::map<RsPeerId,sockaddr_storage>::iterator it(mReportedOwnAddresses.begin());it!=mReportedOwnAddresses.end();++it)
|
||||||
|
++addr_counts[it->second].n ;
|
||||||
|
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "Current ext addr statistics:" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
count = 0 ;
|
||||||
|
|
||||||
|
for(std::map<sockaddr_storage,ZeroedInt>::const_iterator it(addr_counts.begin());it!=addr_counts.end();++it)
|
||||||
|
{
|
||||||
|
if(uint32_t(it->second.n) > count)
|
||||||
|
{
|
||||||
|
addr = it->first ;
|
||||||
|
count = it->second.n ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << sockaddr_storage_iptostring(it->first) << " : " << it->second.n << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3PeerMgrIMPL::getExtAddressReportedByFriends(sockaddr_storage &addr, uint8_t& isstable)
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
|
uint32_t count ;
|
||||||
|
|
||||||
|
locked_computeCurrentBestOwnExtAddressCandidate(addr,count) ;
|
||||||
|
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "Estimation count = " << count << ". Trusted? = " << (count>=2) << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return count >= 2 ;// 2 is not conservative enough. 3 should be probably better.
|
||||||
|
}
|
||||||
|
|
||||||
static bool cleanIpList(std::list<pqiIpAddress>& lst,const RsPeerId& pid,p3LinkMgr *link_mgr)
|
static bool cleanIpList(std::list<pqiIpAddress>& lst,const RsPeerId& pid,p3LinkMgr *link_mgr)
|
||||||
{
|
{
|
||||||
bool changed = false ;
|
bool changed = false ;
|
||||||
@ -1620,9 +1918,10 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
cleanup = false;
|
cleanup = false;
|
||||||
bool useExtAddrFinder = mNetMgr->getIPServersEnabled();
|
bool useExtAddrFinder = mNetMgr->getIPServersEnabled();
|
||||||
|
|
||||||
// Store Proxy Server.
|
/* gather these information before mPeerMtx is locked! */
|
||||||
struct sockaddr_storage proxy_addr;
|
struct sockaddr_storage proxy_addr_tor, proxy_addr_i2p;
|
||||||
getProxyServerAddress(proxy_addr);
|
getProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr_tor);
|
||||||
|
getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr_i2p);
|
||||||
|
|
||||||
mPeerMtx.lock(); /****** MUTEX LOCKED *******/
|
mPeerMtx.lock(); /****** MUTEX LOCKED *******/
|
||||||
|
|
||||||
@ -1733,17 +2032,33 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
|
|
||||||
|
// Store Proxy Server.
|
||||||
|
// Tor
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "Saving proxyServerAddress: " << sockaddr_storage_tostring(proxy_addr);
|
std::cerr << "Saving proxyServerAddress for Tor: " << sockaddr_storage_tostring(proxy_addr_tor);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
kv.key = kConfigKeyProxyServerIpAddr;
|
kv.key = kConfigKeyProxyServerIpAddrTor;
|
||||||
kv.value = sockaddr_storage_iptostring(proxy_addr);
|
kv.value = sockaddr_storage_iptostring(proxy_addr_tor);
|
||||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
kv.key = kConfigKeyProxyServerPort;
|
kv.key = kConfigKeyProxyServerPortTor;
|
||||||
kv.value = sockaddr_storage_porttostring(proxy_addr);
|
kv.value = sockaddr_storage_porttostring(proxy_addr_tor);
|
||||||
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
|
// I2P
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "Saving proxyServerAddress for I2P: " << sockaddr_storage_tostring(proxy_addr_i2p);
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
kv.key = kConfigKeyProxyServerIpAddrI2P;
|
||||||
|
kv.value = sockaddr_storage_iptostring(proxy_addr_i2p);
|
||||||
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
|
kv.key = kConfigKeyProxyServerPortI2P;
|
||||||
|
kv.value = sockaddr_storage_porttostring(proxy_addr_i2p);
|
||||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
saveData.push_back(vitem);
|
saveData.push_back(vitem);
|
||||||
@ -1779,8 +2094,10 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
|||||||
|
|
||||||
// DEFAULTS.
|
// DEFAULTS.
|
||||||
bool useExtAddrFinder = true;
|
bool useExtAddrFinder = true;
|
||||||
std::string proxyIpAddress = kConfigDefaultProxyServerIpAddr;
|
std::string proxyIpAddressTor = kConfigDefaultProxyServerIpAddr;
|
||||||
uint16_t proxyPort = kConfigDefaultProxyServerPort;
|
uint16_t proxyPortTor = kConfigDefaultProxyServerPortTor;
|
||||||
|
std::string proxyIpAddressI2P = kConfigDefaultProxyServerIpAddr;
|
||||||
|
uint16_t proxyPortI2P = kConfigDefaultProxyServerPortI2P;
|
||||||
|
|
||||||
if (load.empty()) {
|
if (load.empty()) {
|
||||||
std::cerr << "p3PeerMgrIMPL::loadList() list is empty, it may be a configuration problem." << std::endl;
|
std::cerr << "p3PeerMgrIMPL::loadList() list is empty, it may be a configuration problem." << std::endl;
|
||||||
@ -1876,20 +2193,38 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
|||||||
std::cerr << "setting use_extr_addr_finder to " << useExtAddrFinder << std::endl ;
|
std::cerr << "setting use_extr_addr_finder to " << useExtAddrFinder << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (kit->key == kConfigKeyProxyServerIpAddr)
|
// Tor
|
||||||
|
else if (kit->key == kConfigKeyProxyServerIpAddrTor)
|
||||||
{
|
{
|
||||||
proxyIpAddress = kit->value;
|
proxyIpAddressTor = kit->value;
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "Loaded proxyIpAddress: " << proxyIpAddress;
|
std::cerr << "Loaded proxyIpAddress for Tor: " << proxyIpAddressTor;
|
||||||
std::cerr << std::endl ;
|
std::cerr << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (kit->key == kConfigKeyProxyServerPort)
|
else if (kit->key == kConfigKeyProxyServerPortTor)
|
||||||
{
|
{
|
||||||
proxyPort = atoi(kit->value.c_str());
|
proxyPortTor = atoi(kit->value.c_str());
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "Loaded proxyPort: " << proxyPort;
|
std::cerr << "Loaded proxyPort for Tor: " << proxyPortTor;
|
||||||
|
std::cerr << std::endl ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// I2p
|
||||||
|
else if (kit->key == kConfigKeyProxyServerIpAddrI2P)
|
||||||
|
{
|
||||||
|
proxyIpAddressI2P = kit->value;
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "Loaded proxyIpAddress for I2P: " << proxyIpAddressI2P;
|
||||||
|
std::cerr << std::endl ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (kit->key == kConfigKeyProxyServerPortI2P)
|
||||||
|
{
|
||||||
|
proxyPortI2P = atoi(kit->value.c_str());
|
||||||
|
#ifdef PEER_DEBUG
|
||||||
|
std::cerr << "Loaded proxyPort for I2P: " << proxyPortI2P;
|
||||||
std::cerr << std::endl ;
|
std::cerr << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2005,13 +2340,24 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
|||||||
|
|
||||||
// Configure Proxy Server.
|
// Configure Proxy Server.
|
||||||
struct sockaddr_storage proxy_addr;
|
struct sockaddr_storage proxy_addr;
|
||||||
|
// Tor
|
||||||
sockaddr_storage_clear(proxy_addr);
|
sockaddr_storage_clear(proxy_addr);
|
||||||
sockaddr_storage_ipv4_aton(proxy_addr, proxyIpAddress.c_str());
|
sockaddr_storage_ipv4_aton(proxy_addr, proxyIpAddressTor.c_str());
|
||||||
sockaddr_storage_ipv4_setport(proxy_addr, proxyPort);
|
sockaddr_storage_ipv4_setport(proxy_addr, proxyPortTor);
|
||||||
|
|
||||||
if (sockaddr_storage_isValidNet(proxy_addr))
|
if (sockaddr_storage_isValidNet(proxy_addr))
|
||||||
{
|
{
|
||||||
setProxyServerAddress(proxy_addr);
|
setProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I2P
|
||||||
|
sockaddr_storage_clear(proxy_addr);
|
||||||
|
sockaddr_storage_ipv4_aton(proxy_addr, proxyIpAddressI2P.c_str());
|
||||||
|
sockaddr_storage_ipv4_setport(proxy_addr, proxyPortI2P);
|
||||||
|
|
||||||
|
if (sockaddr_storage_isValidNet(proxy_addr))
|
||||||
|
{
|
||||||
|
setProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -90,6 +90,7 @@ class peerState
|
|||||||
bool hiddenNode; /* all IP addresses / dyndns must be blank */
|
bool hiddenNode; /* all IP addresses / dyndns must be blank */
|
||||||
std::string hiddenDomain;
|
std::string hiddenDomain;
|
||||||
uint16_t hiddenPort;
|
uint16_t hiddenPort;
|
||||||
|
uint32_t hiddenType;
|
||||||
|
|
||||||
std::string location;
|
std::string location;
|
||||||
std::string name;
|
std::string name;
|
||||||
@ -153,6 +154,7 @@ virtual bool setLocalAddress(const RsPeerId &id, const struct sockaddr_storage
|
|||||||
virtual bool setExtAddress(const RsPeerId &id, const struct sockaddr_storage &addr) = 0;
|
virtual bool setExtAddress(const RsPeerId &id, const struct sockaddr_storage &addr) = 0;
|
||||||
virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns) = 0;
|
virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns) = 0;
|
||||||
virtual bool addCandidateForOwnExternalAddress(const RsPeerId& from, const struct sockaddr_storage &addr) = 0;
|
virtual bool addCandidateForOwnExternalAddress(const RsPeerId& from, const struct sockaddr_storage &addr) = 0;
|
||||||
|
virtual bool getExtAddressReportedByFriends(struct sockaddr_storage& addr,uint8_t& isstable) = 0;
|
||||||
|
|
||||||
virtual bool setNetworkMode(const RsPeerId &id, uint32_t netMode) = 0;
|
virtual bool setNetworkMode(const RsPeerId &id, uint32_t netMode) = 0;
|
||||||
virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
||||||
@ -185,12 +187,16 @@ virtual bool getPeerName(const RsPeerId &ssl_id, std::string &name) = 0;
|
|||||||
virtual bool getGpgId(const RsPeerId &sslId, RsPgpId &gpgId) = 0;
|
virtual bool getGpgId(const RsPeerId &sslId, RsPgpId &gpgId) = 0;
|
||||||
virtual uint32_t getConnectionType(const RsPeerId &sslId) = 0;
|
virtual uint32_t getConnectionType(const RsPeerId &sslId) = 0;
|
||||||
|
|
||||||
virtual bool setProxyServerAddress(const struct sockaddr_storage &proxy_addr) = 0;
|
virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr) = 0;
|
||||||
virtual bool getProxyServerAddress(struct sockaddr_storage &proxy_addr) = 0;
|
virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr) = 0;
|
||||||
virtual bool getProxyServerStatus(uint32_t& status) = 0;
|
virtual bool getProxyServerStatus(const uint32_t type, uint32_t& status) = 0;
|
||||||
virtual bool isHidden() = 0;
|
virtual bool isHidden() = 0;
|
||||||
|
virtual bool isHidden(const uint32_t type) = 0;
|
||||||
virtual bool isHiddenPeer(const RsPeerId &ssl_id) = 0;
|
virtual bool isHiddenPeer(const RsPeerId &ssl_id) = 0;
|
||||||
|
virtual bool isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type) = 0;
|
||||||
virtual bool getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0;
|
virtual bool getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0;
|
||||||
|
virtual uint32_t hiddenDomainToHiddenType(const std::string &domain) = 0;
|
||||||
|
virtual uint32_t getHiddenType(const RsPeerId &ssl_id) = 0;
|
||||||
|
|
||||||
|
|
||||||
virtual int getFriendCount(bool ssl, bool online) = 0;
|
virtual int getFriendCount(bool ssl, bool online) = 0;
|
||||||
@ -200,6 +206,7 @@ virtual int getFriendCount(bool ssl, bool online) = 0;
|
|||||||
// 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() = 0;
|
virtual bool haveOnceConnected() = 0;
|
||||||
|
|
||||||
|
virtual bool locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage &addr, uint32_t &count)=0;
|
||||||
|
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
@ -256,6 +263,7 @@ virtual bool setLocalAddress(const RsPeerId &id, const struct sockaddr_storage
|
|||||||
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 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);
|
||||||
@ -288,12 +296,16 @@ 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 struct sockaddr_storage &proxy_addr);
|
virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr);
|
||||||
virtual bool getProxyServerAddress(struct sockaddr_storage &proxy_addr);
|
virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr);
|
||||||
virtual bool getProxyServerStatus(uint32_t &proxy_status);
|
virtual bool getProxyServerStatus(const uint32_t type, uint32_t &proxy_status);
|
||||||
virtual bool isHidden();
|
virtual bool isHidden();
|
||||||
virtual bool isHiddenPeer(const RsPeerId& ssl_id);
|
virtual bool isHidden(const uint32_t type);
|
||||||
|
virtual bool isHiddenPeer(const RsPeerId &ssl_id);
|
||||||
|
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 getHiddenType(const RsPeerId &ssl_id);
|
||||||
|
|
||||||
virtual int getFriendCount(bool ssl, bool online);
|
virtual int getFriendCount(bool ssl, bool online);
|
||||||
|
|
||||||
@ -327,6 +339,7 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Internal Functions */
|
/* Internal Functions */
|
||||||
|
|
||||||
@ -335,6 +348,8 @@ bool removeBannedIps();
|
|||||||
|
|
||||||
void printPeerLists(std::ostream &out);
|
void printPeerLists(std::ostream &out);
|
||||||
|
|
||||||
|
virtual bool locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage &addr, uint32_t &count);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/*********************** p3config ******************************/
|
/*********************** p3config ******************************/
|
||||||
@ -349,7 +364,7 @@ void printPeerLists(std::ostream &out);
|
|||||||
|
|
||||||
p3LinkMgrIMPL *mLinkMgr;
|
p3LinkMgrIMPL *mLinkMgr;
|
||||||
p3NetMgrIMPL *mNetMgr;
|
p3NetMgrIMPL *mNetMgr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RsMutex mPeerMtx; /* protects below */
|
RsMutex mPeerMtx; /* protects below */
|
||||||
|
|
||||||
@ -362,6 +377,8 @@ private:
|
|||||||
std::map<RsPeerId, peerState> mFriendList; // <SSLid , peerState>
|
std::map<RsPeerId, peerState> mFriendList; // <SSLid , peerState>
|
||||||
std::map<RsPeerId, peerState> mOthersList;
|
std::map<RsPeerId, peerState> mOthersList;
|
||||||
|
|
||||||
|
std::map<RsPeerId,sockaddr_storage> mReportedOwnAddresses ;
|
||||||
|
|
||||||
std::list<RsPeerGroupItem *> groupList;
|
std::list<RsPeerGroupItem *> groupList;
|
||||||
uint32_t lastGroupId;
|
uint32_t lastGroupId;
|
||||||
|
|
||||||
@ -369,8 +386,10 @@ private:
|
|||||||
|
|
||||||
std::map<RsPgpId, ServicePermissionFlags> mFriendsPermissionFlags ; // permission flags for each gpg key
|
std::map<RsPgpId, ServicePermissionFlags> mFriendsPermissionFlags ; // permission flags for each gpg key
|
||||||
|
|
||||||
struct sockaddr_storage mProxyServerAddress;
|
struct sockaddr_storage mProxyServerAddressTor;
|
||||||
uint32_t mProxyServerStatus ;
|
struct sockaddr_storage mProxyServerAddressI2P;
|
||||||
|
uint32_t mProxyServerStatusTor ;
|
||||||
|
uint32_t mProxyServerStatusI2P ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public:
|
|||||||
uint32_t tmp ;
|
uint32_t tmp ;
|
||||||
ok &= getRawUInt32(data, rssize, &offset, &tmp);
|
ok &= getRawUInt32(data, rssize, &offset, &tmp);
|
||||||
|
|
||||||
for(int i=0;i<tmp && offset < rssize;++i)
|
for(uint32_t i=0;i<tmp && offset < rssize;++i)
|
||||||
{
|
{
|
||||||
RsPeerId peer_id ;
|
RsPeerId peer_id ;
|
||||||
ok &= peer_id.deserialise(data,rssize,offset) ;
|
ok &= peer_id.deserialise(data,rssize,offset) ;
|
||||||
@ -157,7 +157,7 @@ public:
|
|||||||
|
|
||||||
ok &= getRawUInt32(data, rssize, &offset, &tmp);
|
ok &= getRawUInt32(data, rssize, &offset, &tmp);
|
||||||
|
|
||||||
for(int i=0;i<tmp && offset < rssize;++i)
|
for(uint32_t i=0;i<tmp && offset < rssize;++i)
|
||||||
{
|
{
|
||||||
RsPeerId peer_id ;
|
RsPeerId peer_id ;
|
||||||
ok &= peer_id.deserialise(data,rssize,offset) ;
|
ok &= peer_id.deserialise(data,rssize,offset) ;
|
||||||
|
@ -225,18 +225,14 @@ class PQInterface: public RateInterface
|
|||||||
/**
|
/**
|
||||||
* also there are tick + person id functions.
|
* also there are tick + person id functions.
|
||||||
*/
|
*/
|
||||||
virtual int tick() { return 0; }
|
virtual int tick() { return 0; }
|
||||||
virtual int status() { return 0; }
|
virtual int status() { return 0; }
|
||||||
virtual const RsPeerId& PeerId() { return peerId; }
|
virtual const RsPeerId& PeerId() { return peerId; }
|
||||||
|
|
||||||
// the callback from NetInterface Connection Events.
|
// the callback from NetInterface Connection Events.
|
||||||
virtual int notifyEvent(NetInterface *ni, int event, const struct sockaddr_storage &remote_peer_address)
|
virtual int notifyEvent(NetInterface * /*ni*/, int /*event*/,
|
||||||
{
|
const sockaddr_storage & /*remote_peer_address*/)
|
||||||
(void) ni; /* remove unused parameter warnings */
|
{ return 0; }
|
||||||
(void) event; /* remove unused parameter warnings */
|
|
||||||
(void) remote_peer_address;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -249,7 +245,8 @@ class PQInterface: public RateInterface
|
|||||||
|
|
||||||
const uint32_t PQI_CONNECT_TCP = 0x0001;
|
const uint32_t PQI_CONNECT_TCP = 0x0001;
|
||||||
const uint32_t PQI_CONNECT_UDP = 0x0002;
|
const uint32_t PQI_CONNECT_UDP = 0x0002;
|
||||||
const uint32_t PQI_CONNECT_HIDDEN_TCP = 0x0004;
|
const uint32_t PQI_CONNECT_HIDDEN_TOR_TCP = 0x0004;
|
||||||
|
const uint32_t PQI_CONNECT_HIDDEN_I2P_TCP = 0x0008;
|
||||||
|
|
||||||
|
|
||||||
#define BIN_FLAGS_NO_CLOSE 0x0001
|
#define BIN_FLAGS_NO_CLOSE 0x0001
|
||||||
@ -266,57 +263,57 @@ const uint32_t PQI_CONNECT_HIDDEN_TCP = 0x0004;
|
|||||||
class BinInterface
|
class BinInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BinInterface() { return; }
|
BinInterface() {}
|
||||||
virtual ~BinInterface() { return; }
|
virtual ~BinInterface() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be called loop, for updating state
|
* To be called loop, for updating state
|
||||||
*/
|
*/
|
||||||
virtual int tick() = 0;
|
virtual int tick() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends data to a prescribed location (implementation dependent)
|
* Sends data to a prescribed location (implementation dependent)
|
||||||
*@param data what will be sent
|
*@param data what will be sent
|
||||||
*@param len the size of data pointed to in memory
|
*@param len the size of data pointed to in memory
|
||||||
*/
|
*/
|
||||||
virtual int senddata(void *data, int len) = 0;
|
virtual int senddata(void *data, int len) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads data from a prescribed location (implementation dependent)
|
* reads data from a prescribed location (implementation dependent)
|
||||||
*@param data what will be sent
|
*@param data what will be sent
|
||||||
*@param len the size of data pointed to in memory
|
*@param len the size of data pointed to in memory
|
||||||
*/
|
*/
|
||||||
virtual int readdata(void *data, int len) = 0;
|
virtual int readdata(void *data, int len) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is more particular the case of the sending data through a socket (internet)
|
* Is more particular the case of the sending data through a socket (internet)
|
||||||
* moretoread and candsend, take a microsec timeout argument.
|
* moretoread and candsend, take a microsec timeout argument.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual int netstatus() = 0;
|
virtual int netstatus() = 0;
|
||||||
virtual int isactive() = 0;
|
virtual int isactive() = 0;
|
||||||
virtual bool moretoread(uint32_t usec) = 0;
|
virtual bool moretoread(uint32_t usec) = 0;
|
||||||
virtual bool cansend(uint32_t usec) = 0;
|
virtual bool cansend(uint32_t usec) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method for streamer to shutdown bininterface
|
* method for streamer to shutdown bininterface
|
||||||
**/
|
**/
|
||||||
virtual int close() = 0;
|
virtual int close() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If hashing data
|
* If hashing data
|
||||||
**/
|
**/
|
||||||
virtual RsFileHash gethash() = 0;
|
virtual RsFileHash gethash() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of bytes read/sent
|
* Number of bytes read/sent
|
||||||
*/
|
*/
|
||||||
virtual uint64_t bytecount() { return 0; }
|
virtual uint64_t bytecount() { return 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used by pqistreamer to limit transfers
|
* used by pqistreamer to limit transfers
|
||||||
**/
|
**/
|
||||||
virtual bool bandwidthLimited() { return true; }
|
virtual bool bandwidthLimited() { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -359,26 +356,30 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @param p_in used to notify system of connect/disconnect events
|
* @param p_in used to notify system of connect/disconnect events
|
||||||
*/
|
*/
|
||||||
NetInterface(PQInterface *p_in, const RsPeerId& id)
|
NetInterface(PQInterface *p_in, const RsPeerId& id) : p(p_in), peerId(id) {}
|
||||||
:p(p_in), peerId(id) { return; }
|
|
||||||
|
|
||||||
virtual ~NetInterface()
|
virtual ~NetInterface() {}
|
||||||
{ return; }
|
|
||||||
|
|
||||||
virtual int connect(const struct sockaddr_storage &raddr) = 0;
|
/* TODO
|
||||||
virtual int listen() = 0;
|
* The data entrypoint is connect(const struct sockaddr_storage &raddr)
|
||||||
virtual int stoplistening() = 0;
|
* To generalize NetInterface we should have a more general type for raddr
|
||||||
virtual int disconnect() = 0;
|
* As an example a string containing an url or encoded like a domain name
|
||||||
virtual int reset() = 0;
|
*/
|
||||||
virtual const RsPeerId& PeerId() { return peerId; }
|
virtual int connect(const struct sockaddr_storage &raddr) = 0;
|
||||||
virtual int getConnectAddress(struct sockaddr_storage &raddr) = 0;
|
|
||||||
|
|
||||||
virtual bool connect_parameter(uint32_t type, uint32_t value) = 0;
|
virtual int listen() = 0;
|
||||||
virtual bool connect_parameter(uint32_t /* type */ , const std::string & /* value */ ) { return false; } // not generally used.
|
virtual int stoplistening() = 0;
|
||||||
virtual bool connect_additional_address(uint32_t /*type*/, const struct sockaddr_storage & /*addr*/) { return false; } // only needed by udp.
|
virtual int disconnect() = 0;
|
||||||
|
virtual int reset() = 0;
|
||||||
|
virtual const RsPeerId& PeerId() { return peerId; }
|
||||||
|
virtual int getConnectAddress(struct sockaddr_storage &raddr) = 0;
|
||||||
|
|
||||||
|
virtual bool connect_parameter(uint32_t type, uint32_t value) = 0;
|
||||||
|
virtual bool connect_parameter(uint32_t /* type */ , const std::string & /* value */ ) { return false; } // not generally used.
|
||||||
|
virtual bool connect_additional_address(uint32_t /*type*/, const struct sockaddr_storage & /*addr*/) { return false; } // only needed by udp.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PQInterface *parent() { return p; }
|
PQInterface *parent() { return p; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PQInterface *p;
|
PQInterface *p;
|
||||||
@ -396,10 +397,9 @@ private:
|
|||||||
class NetBinInterface: public NetInterface, public BinInterface
|
class NetBinInterface: public NetInterface, public BinInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetBinInterface(PQInterface *parent, const RsPeerId& id)
|
NetBinInterface(PQInterface *parent, const RsPeerId& id) :
|
||||||
:NetInterface(parent, id)
|
NetInterface(parent, id) {}
|
||||||
{ return; }
|
virtual ~NetBinInterface() {}
|
||||||
virtual ~NetBinInterface() { return; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CHAN_SIGN_SIZE 16
|
#define CHAN_SIGN_SIZE 16
|
||||||
|
@ -500,7 +500,7 @@ void printNetBinID(std::ostream &out, const RsPeerId& id, uint32_t t)
|
|||||||
{
|
{
|
||||||
out << "TCP)";
|
out << "TCP)";
|
||||||
}
|
}
|
||||||
else if (t == PQI_CONNECT_HIDDEN_TCP)
|
else if (t & (PQI_CONNECT_HIDDEN_TOR_TCP | PQI_CONNECT_HIDDEN_I2P_TCP))
|
||||||
{
|
{
|
||||||
out << "HTCP";
|
out << "HTCP";
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ int NetBinDummy::connect(const struct sockaddr_storage &raddr)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
if (parent())
|
if (parent())
|
||||||
{
|
{
|
||||||
struct sockaddr_storage addr = raddr;
|
//struct sockaddr_storage addr = raddr;
|
||||||
parent()->notifyEvent(this, CONNECT_FAILED, raddr);
|
parent()->notifyEvent(this, CONNECT_FAILED, raddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,21 +31,14 @@
|
|||||||
|
|
||||||
class pqilistener
|
class pqilistener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
pqilistener() {}
|
||||||
pqilistener() { return; }
|
virtual ~pqilistener() {}
|
||||||
virtual ~pqilistener() { return; }
|
virtual int tick() { return 1; }
|
||||||
|
virtual int status() { return 1; }
|
||||||
virtual int tick() { return 1; }
|
virtual int setListenAddr(const sockaddr_storage & /*addr*/) { return 1; }
|
||||||
virtual int status() { return 1; }
|
virtual int setuplisten() { return 1; }
|
||||||
virtual int setListenAddr(const struct sockaddr_storage &addr)
|
virtual int resetlisten() { return 1; }
|
||||||
{
|
|
||||||
(void) addr; /* suppress unused parameter warning */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
virtual int setuplisten() { return 1; }
|
|
||||||
virtual int resetlisten() { return 1; }
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +55,11 @@ int errno;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
#include <sys/sockio.h>
|
||||||
|
#define IFF_RUNNING 0x0001
|
||||||
|
#endif
|
||||||
|
|
||||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
#ifndef WINDOWS_SYS
|
#ifndef WINDOWS_SYS
|
||||||
|
|
||||||
@ -758,52 +763,6 @@ bool getLocalInterfaces(struct sockaddr_storage &existAddr, std::list<struct soc
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool sameNet(const struct in_addr *addr, const struct in_addr *addr2)
|
|
||||||
{
|
|
||||||
#ifdef NET_DEBUG
|
|
||||||
std::cerr << "sameNet: " << rs_inet_ntoa(*addr);
|
|
||||||
std::cerr << " VS " << rs_inet_ntoa(*addr2);
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
struct in_addr addrnet, addrnet2;
|
|
||||||
|
|
||||||
addrnet.s_addr = inet_netof(*addr);
|
|
||||||
addrnet2.s_addr = inet_netof(*addr2);
|
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
|
||||||
std::cerr << " (" << rs_inet_ntoa(addrnet);
|
|
||||||
std::cerr << " =?= " << rs_inet_ntoa(addrnet2);
|
|
||||||
std::cerr << ")" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
in_addr_t address1 = htonl(addr->s_addr);
|
|
||||||
in_addr_t address2 = htonl(addr2->s_addr);
|
|
||||||
|
|
||||||
// handle case for private net: 172.16.0.0/12
|
|
||||||
if (address1>>20 == (172<<4 | 16>>4))
|
|
||||||
{
|
|
||||||
return (address1>>20 == address2>>20);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (inet_netof(*addr) == inet_netof(*addr2));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool isSameSubnet(struct in_addr *addr1, struct in_addr *addr2)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* check that the (addr1 & 255.255.255.0) == (addr2 & 255.255.255.0)
|
|
||||||
*/
|
|
||||||
|
|
||||||
unsigned long a1 = ntohl(addr1->s_addr);
|
|
||||||
unsigned long a2 = ntohl(addr2->s_addr);
|
|
||||||
|
|
||||||
return ((a1 & 0xffffff00) == (a2 & 0xffffff00));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This just might be portable!!! will see!!!
|
/* This just might be portable!!! will see!!!
|
||||||
* Unfortunately this is usable on winXP+, determined by: (_WIN32_WINNT >= 0x0501)
|
* Unfortunately this is usable on winXP+, determined by: (_WIN32_WINNT >= 0x0501)
|
||||||
* but not older platforms.... which must use gethostbyname.
|
* but not older platforms.... which must use gethostbyname.
|
||||||
@ -899,16 +858,14 @@ int unix_close(int fd)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unix_socket(int /*domain*/, int /*type*/, int /*protocol*/)
|
int unix_socket(int domain, int type, int protocol)
|
||||||
{
|
{
|
||||||
int osock = socket(PF_INET, SOCK_STREAM, 0);
|
int osock = socket(domain, type, protocol);
|
||||||
|
|
||||||
/******************* WINDOWS SPECIFIC PART ******************/
|
|
||||||
#ifdef WINDOWS_SYS // WINDOWS
|
|
||||||
|
|
||||||
|
#ifdef WINDOWS_SYS
|
||||||
#ifdef NET_DEBUG
|
#ifdef NET_DEBUG
|
||||||
std::cerr << "unix_socket()" << std::endl;
|
std::cerr << "unix_socket()" << std::endl;
|
||||||
#endif
|
#endif // NET_DEBUG
|
||||||
|
|
||||||
if ((unsigned) osock == INVALID_SOCKET)
|
if ((unsigned) osock == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
@ -916,8 +873,8 @@ int unix_socket(int /*domain*/, int /*type*/, int /*protocol*/)
|
|||||||
osock = -1;
|
osock = -1;
|
||||||
errno = WinToUnixError(WSAGetLastError());
|
errno = WinToUnixError(WSAGetLastError());
|
||||||
}
|
}
|
||||||
#endif
|
#endif // WINDOWS_SYS
|
||||||
/******************* WINDOWS SPECIFIC PART ******************/
|
|
||||||
return osock;
|
return osock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
//socket blocking/options.
|
//socket blocking/options.
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -104,10 +105,6 @@ int inaddr_cmp(struct sockaddr_in addr1, unsigned long);
|
|||||||
bool getPreferredInterface(struct sockaddr_storage &existAddr, struct sockaddr_storage &prefAddr); // returns best addr.
|
bool getPreferredInterface(struct sockaddr_storage &existAddr, struct sockaddr_storage &prefAddr); // returns best addr.
|
||||||
bool getLocalInterfaces(struct sockaddr_storage &existAddr, std::list<struct sockaddr_storage> &addrs); // returns all possible addrs.
|
bool getLocalInterfaces(struct sockaddr_storage &existAddr, std::list<struct sockaddr_storage> &addrs); // returns all possible addrs.
|
||||||
|
|
||||||
// checks (addr1 & 255.255.255.0) == (addr2 & 255.255.255.0)
|
|
||||||
bool isSameSubnet(struct in_addr *addr1, struct in_addr *addr2);
|
|
||||||
bool sameNet(const struct in_addr *addr, const struct in_addr *addr2);
|
|
||||||
|
|
||||||
in_addr_t pqi_inet_netof(struct in_addr addr); // our implementation.
|
in_addr_t pqi_inet_netof(struct in_addr addr); // our implementation.
|
||||||
|
|
||||||
bool LookupDNSAddr(std::string name, struct sockaddr_in &addr);
|
bool LookupDNSAddr(std::string name, struct sockaddr_in &addr);
|
||||||
|
@ -48,57 +48,36 @@ static const int HEARTBEAT_REPEAT_TIME = 5;
|
|||||||
#include "pqi/pqiqosstreamer.h"
|
#include "pqi/pqiqosstreamer.h"
|
||||||
#include "pqi/pqithreadstreamer.h"
|
#include "pqi/pqithreadstreamer.h"
|
||||||
|
|
||||||
class pqiconnect: public pqiQoSstreamer, public NetInterface
|
class pqiconnect : public pqiQoSstreamer, public NetInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pqiconnect(PQInterface *parent, RsSerialiser *rss, NetBinInterface *ni_in)
|
pqiconnect(PQInterface *parent, RsSerialiser *rss, NetBinInterface *ni_in) :
|
||||||
:pqiQoSstreamer(parent, rss, ni_in->PeerId(), ni_in, 0), // pqistreamer will cleanup NetInterface.
|
pqiQoSstreamer(parent, rss, ni_in->PeerId(), ni_in, 0), // pqistreamer will cleanup NetInterface.
|
||||||
NetInterface(NULL, ni_in->PeerId()), // No need for callback
|
NetInterface(NULL, ni_in->PeerId()), // No need for callback
|
||||||
ni(ni_in)
|
ni(ni_in) {}
|
||||||
{
|
|
||||||
if (!ni_in)
|
|
||||||
{
|
|
||||||
std::cerr << "pqiconnect::pqiconnect() NetInterface == NULL, FATAL!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~pqiconnect() { return; }
|
virtual ~pqiconnect() {}
|
||||||
virtual bool getCryptoParams(RsPeerCryptoParams& params) ;
|
virtual bool getCryptoParams(RsPeerCryptoParams& params);
|
||||||
|
|
||||||
// presents a virtual NetInterface -> passes to ni.
|
// presents a virtual NetInterface -> passes to ni.
|
||||||
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() { return ni->reset(); }
|
||||||
virtual int disconnect() { return ni -> reset(); }
|
virtual int disconnect() { return ni->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); }
|
||||||
|
virtual int getConnectAddress(struct sockaddr_storage &raddr){ return ni->getConnectAddress(raddr); }
|
||||||
|
|
||||||
virtual int getConnectAddress(struct sockaddr_storage &raddr){ return ni->getConnectAddress(raddr); }
|
|
||||||
|
|
||||||
// get the contact from the net side!
|
// get the contact from the net side!
|
||||||
virtual const RsPeerId& PeerId()
|
virtual const RsPeerId& PeerId() { return ni->PeerId(); }
|
||||||
{
|
|
||||||
if (ni)
|
|
||||||
{
|
|
||||||
return ni->PeerId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return PQInterface::PeerId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// to check if our interface.
|
// to check if our interface.
|
||||||
virtual bool thisNetInterface(NetInterface *ni_in) { return (ni_in == ni); }
|
virtual bool thisNetInterface(NetInterface *ni_in) { return (ni_in == ni); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NetBinInterface *ni;
|
NetBinInterface *ni;
|
||||||
protected:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -617,15 +617,19 @@ int pqipersongrp::connectPeer(const RsPeerId& id
|
|||||||
uint32_t ptype;
|
uint32_t ptype;
|
||||||
if (type & RS_NET_CONN_TCP_ALL)
|
if (type & RS_NET_CONN_TCP_ALL)
|
||||||
{
|
{
|
||||||
if (type == RS_NET_CONN_TCP_HIDDEN)
|
switch (type) {
|
||||||
{
|
case RS_NET_CONN_TCP_HIDDEN_TOR:
|
||||||
ptype = PQI_CONNECT_HIDDEN_TCP;
|
ptype = PQI_CONNECT_HIDDEN_TOR_TCP;
|
||||||
timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
|
timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
|
||||||
}
|
break;
|
||||||
else
|
case RS_NET_CONN_TCP_HIDDEN_I2P:
|
||||||
{
|
ptype = PQI_CONNECT_HIDDEN_I2P_TCP;
|
||||||
|
timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
ptype = PQI_CONNECT_TCP;
|
ptype = PQI_CONNECT_TCP;
|
||||||
timeout = RS_TCP_STD_TIMEOUT_PERIOD;
|
timeout = RS_TCP_STD_TIMEOUT_PERIOD;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#ifdef PGRP_DEBUG
|
#ifdef PGRP_DEBUG
|
||||||
std::cerr << " pqipersongrp::connectPeer() connecting with TCP: Timeout :" << timeout;
|
std::cerr << " pqipersongrp::connectPeer() connecting with TCP: Timeout :" << timeout;
|
||||||
|
@ -27,7 +27,7 @@ void pqiQoS::clear()
|
|||||||
{
|
{
|
||||||
void *item ;
|
void *item ;
|
||||||
|
|
||||||
for(int i=0;i<_item_queues.size();++i)
|
for(uint32_t i=0;i<_item_queues.size();++i)
|
||||||
while( (item = _item_queues[i].pop()) != NULL)
|
while( (item = _item_queues[i].pop()) != NULL)
|
||||||
free(item) ;
|
free(item) ;
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ void pqiQoS::print() const
|
|||||||
|
|
||||||
void pqiQoS::in_rsItem(void *ptr,int priority)
|
void pqiQoS::in_rsItem(void *ptr,int priority)
|
||||||
{
|
{
|
||||||
if(priority >= _item_queues.size())
|
if(uint32_t(priority) >= _item_queues.size())
|
||||||
{
|
{
|
||||||
std::cerr << "pqiQoS::in_rsRawItem() ****Warning****: priority " << priority << " out of scope [0," << _item_queues.size()-1 << "]. Priority will be clamped to maximum value." << std::endl;
|
std::cerr << "pqiQoS::in_rsRawItem() ****Warning****: priority " << priority << " out of scope [0," << _item_queues.size()-1 << "]. Priority will be clamped to maximum value." << std::endl;
|
||||||
priority = _item_queues.size()-1 ;
|
priority = _item_queues.size()-1 ;
|
||||||
|
@ -103,7 +103,7 @@ pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3LinkMgr *lm)
|
|||||||
sslmode(PQISSL_ACTIVE), ssl_connection(NULL), sockfd(-1),
|
sslmode(PQISSL_ACTIVE), ssl_connection(NULL), sockfd(-1),
|
||||||
readpkt(NULL), pktlen(0), total_len(0),
|
readpkt(NULL), pktlen(0), total_len(0),
|
||||||
attempt_ts(0),
|
attempt_ts(0),
|
||||||
sameLAN(false), n_read_zero(0), mReadZeroTS(0), ssl_connect_timeout(0),
|
n_read_zero(0), mReadZeroTS(0), ssl_connect_timeout(0),
|
||||||
mConnectDelay(0), mConnectTS(0),
|
mConnectDelay(0), mConnectTS(0),
|
||||||
mConnectTimeout(0), mTimeoutTS(0)
|
mConnectTimeout(0), mTimeoutTS(0)
|
||||||
{
|
{
|
||||||
@ -255,7 +255,6 @@ int pqissl::reset_locked()
|
|||||||
sockfd = -1;
|
sockfd = -1;
|
||||||
waiting = WAITING_NOT;
|
waiting = WAITING_NOT;
|
||||||
ssl_connection = NULL;
|
ssl_connection = NULL;
|
||||||
sameLAN = false;
|
|
||||||
n_read_zero = 0;
|
n_read_zero = 0;
|
||||||
mReadZeroTS = 0;
|
mReadZeroTS = 0;
|
||||||
total_len = 0 ;
|
total_len = 0 ;
|
||||||
@ -286,54 +285,40 @@ int pqissl::reset_locked()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pqissl::connect_parameter(uint32_t type, const std::string &value)
|
bool pqissl::connect_parameter(uint32_t type, uint32_t value)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
|
std::cerr << "pqissl::connect_parameter() Peer: " << PeerId();
|
||||||
/* remove unused parameter warnings */
|
|
||||||
(void) type;
|
|
||||||
(void) value;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool pqissl::connect_parameter(uint32_t type, uint32_t value)
|
|
||||||
{
|
|
||||||
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
|
|
||||||
|
|
||||||
#ifdef PQISSL_LOG_DEBUG
|
|
||||||
{
|
|
||||||
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
|
|
||||||
rs_sprintf_append(out, " type: %u value: %u", type, value);
|
|
||||||
rslog(RSL_DEBUG_ALL, pqisslzone, out);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (type == NET_PARAM_CONNECT_DELAY)
|
switch(type)
|
||||||
{
|
{
|
||||||
#ifdef PQISSL_LOG_DEBUG
|
case NET_PARAM_CONNECT_DELAY:
|
||||||
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
|
{
|
||||||
rs_sprintf_append(out, " DELAY: %u", value);
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
rslog(RSL_DEBUG_BASIC, pqisslzone, out);
|
std::cerr << " DELAY: " << value << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
RS_STACK_MUTEX(mSslMtx);
|
||||||
|
|
||||||
mConnectDelay = value;
|
mConnectDelay = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (type == NET_PARAM_CONNECT_TIMEOUT)
|
case NET_PARAM_CONNECT_TIMEOUT:
|
||||||
{
|
{
|
||||||
#ifdef PQISSL_LOG_DEBUG
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
|
std::cerr << " TIMEOUT: " << value << std::endl;
|
||||||
rs_sprintf_append(out, " TIMEOUT: %u", value);
|
|
||||||
rslog(RSL_DEBUG_BASIC, pqisslzone, out);
|
|
||||||
#endif
|
#endif
|
||||||
|
RS_STACK_MUTEX(mSslMtx);
|
||||||
mConnectTimeout = value;
|
mConnectTimeout = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
default:
|
||||||
//return NetInterface::connect_parameter(type, value);
|
{
|
||||||
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
|
std::cerr << " type: " << type << " value: " << value << std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1472,22 +1457,12 @@ int pqissl::accept_locked(SSL *ssl, int fd, const struct sockaddr_storage &forei
|
|||||||
|
|
||||||
struct sockaddr_storage localaddr;
|
struct sockaddr_storage localaddr;
|
||||||
mLinkMgr->getLocalAddress(localaddr);
|
mLinkMgr->getLocalAddress(localaddr);
|
||||||
sameLAN = sockaddr_storage_samesubnet(remote_addr, localaddr);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string out = "pqissl::accept() SUCCESSFUL connection to: " + PeerId().toStdString();
|
std::string out = "pqissl::accept() SUCCESSFUL connection to: " + PeerId().toStdString();
|
||||||
out += " localaddr: " + sockaddr_storage_iptostring(localaddr);
|
out += " localaddr: " + sockaddr_storage_iptostring(localaddr);
|
||||||
out += " remoteaddr: " + sockaddr_storage_iptostring(remote_addr);
|
out += " remoteaddr: " + sockaddr_storage_iptostring(remote_addr);
|
||||||
|
|
||||||
if (sameLAN)
|
|
||||||
{
|
|
||||||
out += " SAME LAN";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
out += " DIFF LANs";
|
|
||||||
}
|
|
||||||
|
|
||||||
rslog(RSL_WARNING, pqisslzone, out);
|
rslog(RSL_WARNING, pqisslzone, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1961,10 +1936,7 @@ bool pqissl::cansend(uint32_t usec)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RsFileHash pqissl::gethash()
|
RsFileHash pqissl::gethash() { return RsFileHash(); }
|
||||||
{
|
|
||||||
return RsFileHash() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********** End of Implementation of BinInterface ******************/
|
/********** End of Implementation of BinInterface ******************/
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ virtual int reset();
|
|||||||
virtual int disconnect();
|
virtual int disconnect();
|
||||||
virtual int getConnectAddress(struct sockaddr_storage &raddr);
|
virtual int getConnectAddress(struct sockaddr_storage &raddr);
|
||||||
|
|
||||||
virtual bool connect_parameter(uint32_t type, const std::string &value);
|
virtual bool connect_parameter(uint32_t /*type*/, const std::string & /*value*/) { return false; }
|
||||||
virtual bool connect_parameter(uint32_t type, uint32_t value);
|
virtual bool connect_parameter(uint32_t type, uint32_t value);
|
||||||
|
|
||||||
// BinInterface
|
// BinInterface
|
||||||
@ -170,10 +170,13 @@ int Extract_Failed_SSL_Certificate(); // try to get cert anyway.
|
|||||||
bool CheckConnectionTimeout();
|
bool CheckConnectionTimeout();
|
||||||
|
|
||||||
|
|
||||||
//protected internal fns that are overloaded for udp case.
|
/* Do we really need this ?
|
||||||
virtual int net_internal_close(int fd);
|
* It is very specific TCP+SSL stuff and unlikely to be reused.
|
||||||
virtual int net_internal_SSL_set_fd(SSL *ssl, int fd);
|
* In fact we are overloading them in pqissludp case where they do different things or nothing.
|
||||||
virtual int net_internal_fcntl_nonblock(int fd);
|
*/
|
||||||
|
virtual int net_internal_close(int fd);
|
||||||
|
virtual int net_internal_SSL_set_fd(SSL *ssl, int fd);
|
||||||
|
virtual int net_internal_fcntl_nonblock(int fd);
|
||||||
|
|
||||||
|
|
||||||
/* data */
|
/* data */
|
||||||
@ -196,8 +199,6 @@ virtual int net_internal_fcntl_nonblock(int fd);
|
|||||||
|
|
||||||
int attempt_ts;
|
int attempt_ts;
|
||||||
|
|
||||||
bool sameLAN; /* flag use to allow high-speed transfers */
|
|
||||||
|
|
||||||
int n_read_zero; /* a counter to determine if the connection is really dead */
|
int n_read_zero; /* a counter to determine if the connection is really dead */
|
||||||
time_t mReadZeroTS; /* timestamp of first READ_ZERO occurance */
|
time_t mReadZeroTS; /* timestamp of first READ_ZERO occurance */
|
||||||
|
|
||||||
@ -208,11 +209,9 @@ virtual int net_internal_fcntl_nonblock(int fd);
|
|||||||
uint32_t mConnectTimeout;
|
uint32_t mConnectTimeout;
|
||||||
time_t mTimeoutTS;
|
time_t mTimeoutTS;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ssl only fns.
|
// ssl only fns.
|
||||||
int connectInterface(const struct sockaddr_storage &addr);
|
int connectInterface(const struct sockaddr_storage &addr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,19 +56,17 @@ const int pqissllistenzone = 49787;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
pqissllistenbase::pqissllistenbase(const struct sockaddr_storage &addr, p3PeerMgr *pm)
|
pqissllistenbase::pqissllistenbase(const sockaddr_storage &addr, p3PeerMgr *pm)
|
||||||
:laddr(addr), active(false), mPeerMgr(pm)
|
: laddr(addr), active(false), mPeerMgr(pm)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!(AuthSSL::getAuthSSL()-> active())) {
|
if (!(AuthSSL::getAuthSSL()-> active()))
|
||||||
pqioutput(PQL_ALERT, pqissllistenzone,
|
{
|
||||||
"SSL-CTX-CERT-ROOT not initialised!");
|
pqioutput(PQL_ALERT, pqissllistenzone,
|
||||||
|
"SSL-CTX-CERT-ROOT not initialised!");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setuplisten();
|
setuplisten();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pqissllistenbase::~pqissllistenbase()
|
pqissllistenbase::~pqissllistenbase()
|
||||||
@ -123,6 +121,10 @@ int pqissllistenbase::setuplisten()
|
|||||||
err = fcntl(lsock, F_SETFL, O_NONBLOCK);
|
err = fcntl(lsock, F_SETFL, O_NONBLOCK);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
|
shutdown(lsock,SHUT_RDWR) ;
|
||||||
|
close(lsock) ;
|
||||||
|
lsock = -1 ;
|
||||||
|
|
||||||
std::string out;
|
std::string out;
|
||||||
rs_sprintf(out, "Error: Cannot make socket NON-Blocking: %d", err);
|
rs_sprintf(out, "Error: Cannot make socket NON-Blocking: %d", err);
|
||||||
pqioutput(PQL_ERROR, pqissllistenzone, out);
|
pqioutput(PQL_ERROR, pqissllistenzone, out);
|
||||||
@ -145,6 +147,9 @@ int pqissllistenbase::setuplisten()
|
|||||||
unsigned long int on = 1;
|
unsigned long int on = 1;
|
||||||
if (0 != (err = ioctlsocket(lsock, FIONBIO, &on)))
|
if (0 != (err = ioctlsocket(lsock, FIONBIO, &on)))
|
||||||
{
|
{
|
||||||
|
closesocket(lsock) ;
|
||||||
|
lsock = -1 ;
|
||||||
|
|
||||||
std::string out;
|
std::string out;
|
||||||
rs_sprintf(out, "pqissllistenbase::setuplisten() Error: Cannot make socket NON-Blocking: %d\n", err);
|
rs_sprintf(out, "pqissllistenbase::setuplisten() Error: Cannot make socket NON-Blocking: %d\n", err);
|
||||||
out += "Socket Error: " + socket_errorType(WSAGetLastError());
|
out += "Socket Error: " + socket_errorType(WSAGetLastError());
|
||||||
@ -723,18 +728,7 @@ int pqissllistenbase::isSSLActive(int /*fd*/, SSL *ssl)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pqissllistener::pqissllistener(const struct sockaddr_storage &addr, p3PeerMgr *lm)
|
int pqissllistener::addlistenaddr(const RsPeerId& id, pqissl *acc)
|
||||||
:pqissllistenbase(addr, lm)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pqissllistener::~pqissllistener()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pqissllistener::addlistenaddr(const RsPeerId& id, pqissl *acc)
|
|
||||||
{
|
{
|
||||||
std::map<RsPeerId, pqissl *>::iterator it;
|
std::map<RsPeerId, pqissl *>::iterator it;
|
||||||
|
|
||||||
@ -748,7 +742,6 @@ int pqissllistener::addlistenaddr(const RsPeerId& id, pqissl *acc)
|
|||||||
|
|
||||||
pqioutput(PQL_DEBUG_ALERT, pqissllistenzone, out);
|
pqioutput(PQL_DEBUG_ALERT, pqissllistenzone, out);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,7 +778,7 @@ int pqissllistener::removeListenPort(const RsPeerId& id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pqissllistener::status()
|
int pqissllistener::status()
|
||||||
{
|
{
|
||||||
pqissllistenbase::status();
|
pqissllistenbase::status();
|
||||||
// print certificates we are listening for.
|
// print certificates we are listening for.
|
||||||
|
@ -49,13 +49,12 @@ class p3PeerMgr;
|
|||||||
|
|
||||||
class AcceptedSSL
|
class AcceptedSSL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int mFd;
|
int mFd;
|
||||||
SSL *mSSL;
|
SSL *mSSL;
|
||||||
RsPeerId mPeerId;
|
RsPeerId mPeerId;
|
||||||
|
|
||||||
struct sockaddr_storage mAddr;
|
sockaddr_storage mAddr;
|
||||||
time_t mAcceptTS;
|
time_t mAcceptTS;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,26 +63,22 @@ class AcceptedSSL
|
|||||||
|
|
||||||
class pqissllistenbase: public pqilistener
|
class pqissllistenbase: public pqilistener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
pqissllistenbase(const struct sockaddr_storage &addr, p3PeerMgr *pm);
|
||||||
|
virtual ~pqissllistenbase();
|
||||||
|
|
||||||
|
/*************************************/
|
||||||
|
/* LISTENER INTERFACE */
|
||||||
|
virtual int tick();
|
||||||
|
virtual int status();
|
||||||
|
virtual int setListenAddr(const struct sockaddr_storage &addr);
|
||||||
|
virtual int setuplisten();
|
||||||
|
virtual int resetlisten();
|
||||||
|
/*************************************/
|
||||||
|
|
||||||
pqissllistenbase(const struct sockaddr_storage &addr, p3PeerMgr *pm);
|
int acceptconnection();
|
||||||
virtual ~pqissllistenbase();
|
int continueaccepts();
|
||||||
|
int finaliseAccepts();
|
||||||
/*************************************/
|
|
||||||
/* LISTENER INTERFACE **/
|
|
||||||
|
|
||||||
virtual int tick();
|
|
||||||
virtual int status();
|
|
||||||
virtual int setListenAddr(const struct sockaddr_storage &addr);
|
|
||||||
virtual int setuplisten();
|
|
||||||
virtual int resetlisten();
|
|
||||||
|
|
||||||
/*************************************/
|
|
||||||
|
|
||||||
int acceptconnection();
|
|
||||||
int continueaccepts();
|
|
||||||
int finaliseAccepts();
|
|
||||||
|
|
||||||
struct IncomingSSLInfo
|
struct IncomingSSLInfo
|
||||||
{
|
{
|
||||||
@ -95,52 +90,44 @@ int finaliseAccepts();
|
|||||||
};
|
};
|
||||||
|
|
||||||
// fn to get cert, anyway
|
// fn to get cert, anyway
|
||||||
int continueSSL(IncomingSSLInfo&, bool);
|
int continueSSL(IncomingSSLInfo&, bool);
|
||||||
int closeConnection(int fd, SSL *ssl);
|
int closeConnection(int fd, SSL *ssl);
|
||||||
int isSSLActive(int fd, SSL *ssl);
|
int isSSLActive(int fd, SSL *ssl);
|
||||||
|
|
||||||
virtual int completeConnection(int sockfd, IncomingSSLInfo&) = 0;
|
virtual int completeConnection(int sockfd, IncomingSSLInfo&) = 0;
|
||||||
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId, const struct sockaddr_storage &raddr) = 0;
|
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId,
|
||||||
protected:
|
const sockaddr_storage &raddr) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
struct sockaddr_storage laddr;
|
struct sockaddr_storage laddr;
|
||||||
std::list<AcceptedSSL> accepted_ssl;
|
std::list<AcceptedSSL> accepted_ssl;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
int Extract_Failed_SSL_Certificate(const IncomingSSLInfo&);
|
|
||||||
|
|
||||||
bool active;
|
|
||||||
int lsock;
|
|
||||||
|
|
||||||
std::list<IncomingSSLInfo> incoming_ssl ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
p3PeerMgr *mPeerMgr;
|
p3PeerMgr *mPeerMgr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int Extract_Failed_SSL_Certificate(const IncomingSSLInfo&);
|
||||||
|
bool active;
|
||||||
|
int lsock;
|
||||||
|
std::list<IncomingSSLInfo> incoming_ssl ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class pqissllistener: public pqissllistenbase
|
class pqissllistener: public pqissllistenbase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
pqissllistener(const struct sockaddr_storage &addr, p3PeerMgr *pm) :
|
||||||
|
pqissllistenbase(addr, pm) {}
|
||||||
|
virtual ~pqissllistener() {}
|
||||||
|
|
||||||
pqissllistener(const struct sockaddr_storage &addr, p3PeerMgr *pm);
|
int addlistenaddr(const RsPeerId& id, pqissl *acc);
|
||||||
virtual ~pqissllistener();
|
int removeListenPort(const RsPeerId& id);
|
||||||
|
|
||||||
int addlistenaddr(const RsPeerId& id, pqissl *acc);
|
virtual int status();
|
||||||
int removeListenPort(const RsPeerId& id);
|
virtual int completeConnection(int sockfd, IncomingSSLInfo&);
|
||||||
|
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId,
|
||||||
|
const sockaddr_storage &raddr);
|
||||||
|
|
||||||
//virtual int tick();
|
private:
|
||||||
virtual int status();
|
std::map<RsPeerId, pqissl*> listenaddr;
|
||||||
|
|
||||||
virtual int completeConnection(int sockfd, IncomingSSLInfo&);
|
|
||||||
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId, const struct sockaddr_storage &raddr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::map<RsPeerId, pqissl *> listenaddr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,36 @@ pqiperson * pqisslpersongrp::locked_createPerson(const RsPeerId& id, pqilistener
|
|||||||
|
|
||||||
pqiconnect *pqisc = new pqiconnect(pqip, rss, pqis);
|
pqiconnect *pqisc = new pqiconnect(pqip, rss, pqis);
|
||||||
|
|
||||||
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TCP, pqisc);
|
/* first select type based on peer */
|
||||||
|
uint32_t typePeer = mPeerMgr->getHiddenType(id);
|
||||||
|
switch (typePeer) {
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TOR_TCP, pqisc);
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_I2P_TCP, pqisc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* peer is not a hidden one but we are */
|
||||||
|
/* select type based on ourselves */
|
||||||
|
uint32_t typeOwn = mPeerMgr->getHiddenType(AuthSSL::getAuthSSL()->OwnId());
|
||||||
|
switch (typeOwn) {
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_I2P_TCP, pqisc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* this case shouldn't happen! */
|
||||||
|
std::cerr << "pqisslpersongrp::locked_createPerson WARNING INVALID HIDDEN TYPES - THIS SHOULD NOT HAPPEN!" << std::endl;
|
||||||
|
std::cerr << " - ID: " << id << std::endl;
|
||||||
|
std::cerr << " - mPeerMgr->isHidden(): " << mPeerMgr->isHidden() << std::endl;
|
||||||
|
std::cerr << " - mPeerMgr->isHiddenPeer(id): " << mPeerMgr->isHiddenPeer(id) << std::endl;
|
||||||
|
std::cerr << " - hidden types: peer=" << typePeer << " own=" << typeOwn << std::endl;
|
||||||
|
std::cerr << " --> falling back to Tor" << std::endl;
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TOR_TCP, pqisc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -51,22 +51,22 @@ static const uint32_t PQI_SSLUDP_DEF_CONN_PERIOD = 300; /* 5 minutes? */
|
|||||||
|
|
||||||
/********** PQI SSL UDP STUFF **************************************/
|
/********** PQI SSL UDP STUFF **************************************/
|
||||||
|
|
||||||
pqissludp::pqissludp(PQInterface *parent, p3LinkMgr *lm)
|
pqissludp::pqissludp(PQInterface *parent, p3LinkMgr *lm) :
|
||||||
:pqissl(NULL, parent, lm), tou_bio(NULL),
|
pqissl(NULL, parent, lm), tou_bio(NULL), listen_checktime(0),
|
||||||
listen_checktime(0), mConnectPeriod(PQI_SSLUDP_DEF_CONN_PERIOD), mConnectFlags(0), mConnectBandwidth(0)
|
mConnectPeriod(PQI_SSLUDP_DEF_CONN_PERIOD), mConnectFlags(0),
|
||||||
|
mConnectBandwidth(0)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
|
RS_STACK_MUTEX(mSslMtx);
|
||||||
|
|
||||||
sockaddr_storage_clear(remote_addr);
|
sockaddr_storage_clear(remote_addr);
|
||||||
sockaddr_storage_clear(mConnectProxyAddr);
|
sockaddr_storage_clear(mConnectProxyAddr);
|
||||||
sockaddr_storage_clear(mConnectSrcAddr);
|
sockaddr_storage_clear(mConnectSrcAddr);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pqissludp::~pqissludp()
|
pqissludp::~pqissludp()
|
||||||
{
|
{
|
||||||
rslog(RSL_ALERT, pqissludpzone,
|
rslog(RSL_ALERT, pqissludpzone,
|
||||||
"pqissludp::~pqissludp -> destroying pqissludp");
|
"pqissludp::~pqissludp -> destroying pqissludp");
|
||||||
|
|
||||||
/* must call reset from here, so that the
|
/* must call reset from here, so that the
|
||||||
@ -76,16 +76,13 @@ pqissludp::~pqissludp()
|
|||||||
* This means that reset() will be called twice, but this should
|
* This means that reset() will be called twice, but this should
|
||||||
* be harmless.
|
* be harmless.
|
||||||
*/
|
*/
|
||||||
stoplistening(); /* remove from p3proxy listenqueue */
|
stoplistening(); /* remove from p3proxy listenqueue */
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
|
RS_STACK_MUTEX(mSslMtx);
|
||||||
|
|
||||||
if (tou_bio) // this should be in the reset?
|
if (tou_bio) // this should be in the reset?
|
||||||
{
|
|
||||||
BIO_free(tou_bio);
|
BIO_free(tou_bio);
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pqissludp::reset_locked()
|
int pqissludp::reset_locked()
|
||||||
@ -153,7 +150,7 @@ int pqissludp::attach()
|
|||||||
|
|
||||||
|
|
||||||
// The Address determination is done centrally
|
// The Address determination is done centrally
|
||||||
int pqissludp::Initiate_Connection()
|
int pqissludp::Initiate_Connection()
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -349,7 +346,7 @@ int pqissludp::Initiate_Connection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/********* VERY DIFFERENT **********/
|
/********* VERY DIFFERENT **********/
|
||||||
int pqissludp::Basic_Connection_Complete()
|
int pqissludp::Basic_Connection_Complete()
|
||||||
{
|
{
|
||||||
rslog(RSL_DEBUG_BASIC, pqissludpzone,
|
rslog(RSL_DEBUG_BASIC, pqissludpzone,
|
||||||
"pqissludp::Basic_Connection_Complete()...");
|
"pqissludp::Basic_Connection_Complete()...");
|
||||||
@ -449,15 +446,6 @@ int pqissludp::net_internal_fcntl_nonblock(int /*fd*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* These are identical to pqinetssl version */
|
|
||||||
//int pqissludp::status()
|
|
||||||
|
|
||||||
int pqissludp::tick()
|
|
||||||
{
|
|
||||||
pqissl::tick();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// listen fns call the udpproxy.
|
// listen fns call the udpproxy.
|
||||||
int pqissludp::listen()
|
int pqissludp::listen()
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
class pqissludp;
|
class pqissludp;
|
||||||
class cert;
|
class cert;
|
||||||
|
|
||||||
/* This provides a NetBinInterface, which is
|
/* This provides a NetBinInterface, which is
|
||||||
* primarily inherited from pqissl.
|
* primarily inherited from pqissl.
|
||||||
* fns declared here are different -> all others are identical.
|
* fns declared here are different -> all others are identical.
|
||||||
*/
|
*/
|
||||||
@ -53,49 +53,48 @@ class cert;
|
|||||||
class pqissludp: public pqissl
|
class pqissludp: public pqissl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pqissludp(PQInterface *parent, p3LinkMgr *lm);
|
pqissludp(PQInterface *parent, p3LinkMgr *lm);
|
||||||
|
|
||||||
virtual ~pqissludp();
|
virtual ~pqissludp();
|
||||||
|
|
||||||
// NetInterface.
|
// NetInterface.
|
||||||
// listen fns call the udpproxy.
|
// listen fns call the udpproxy.
|
||||||
virtual int listen();
|
virtual int listen();
|
||||||
virtual int stoplistening();
|
virtual int stoplistening();
|
||||||
virtual int tick();
|
|
||||||
|
|
||||||
virtual bool connect_parameter(uint32_t type, uint32_t value);
|
virtual bool connect_parameter(uint32_t type, uint32_t value);
|
||||||
virtual bool connect_additional_address(uint32_t type, const struct sockaddr_storage &addr);
|
virtual bool connect_additional_address(uint32_t type, const struct sockaddr_storage &addr);
|
||||||
|
|
||||||
// BinInterface.
|
// BinInterface.
|
||||||
// These are reimplemented.
|
// These are reimplemented.
|
||||||
virtual bool moretoread(uint32_t usec);
|
virtual bool moretoread(uint32_t usec);
|
||||||
virtual bool cansend(uint32_t usec);
|
virtual bool cansend(uint32_t usec);
|
||||||
/* UDP always through firewalls -> always bandwidth Limited */
|
/* UDP always through firewalls -> always bandwidth Limited */
|
||||||
virtual bool bandwidthLimited() { return true; }
|
virtual bool bandwidthLimited() { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// pqissludp specific.
|
// pqissludp specific.
|
||||||
// called to initiate a connection;
|
// called to initiate a connection;
|
||||||
int attach();
|
int attach();
|
||||||
|
|
||||||
virtual int reset_locked();
|
virtual int reset_locked();
|
||||||
|
|
||||||
virtual int Initiate_Connection();
|
virtual int Initiate_Connection();
|
||||||
virtual int Basic_Connection_Complete();
|
virtual int Basic_Connection_Complete();
|
||||||
|
|
||||||
//protected internal fns that are overloaded for udp case.
|
/* Do we really need this ?
|
||||||
virtual int net_internal_close(int fd);
|
* It is very specific UDP+ToU+SSL stuff and unlikely to be reused.
|
||||||
virtual int net_internal_SSL_set_fd(SSL *ssl, int fd);
|
* In fact we are overloading them here becase they are very do different of pqissl.
|
||||||
virtual int net_internal_fcntl_nonblock(int fd);
|
*/
|
||||||
|
virtual int net_internal_close(int fd);
|
||||||
|
virtual int net_internal_SSL_set_fd(SSL *ssl, int fd);
|
||||||
|
virtual int net_internal_fcntl_nonblock(int fd);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BIO *tou_bio; // specific to ssludp.
|
BIO *tou_bio; // specific to ssludp.
|
||||||
|
|
||||||
//int remote_timeout;
|
|
||||||
//int proxy_timeout;
|
|
||||||
|
|
||||||
long listen_checktime;
|
long listen_checktime;
|
||||||
|
|
||||||
uint32_t mConnectPeriod;
|
uint32_t mConnectPeriod;
|
||||||
|
@ -72,102 +72,79 @@ X509_REQ *GenerateX509Req(
|
|||||||
std::string loc, std::string state, std::string country,
|
std::string loc, std::string state, std::string country,
|
||||||
int nbits_in, std::string &errString)
|
int nbits_in, std::string &errString)
|
||||||
{
|
{
|
||||||
/* generate request */
|
/* generate request */
|
||||||
X509_REQ *req=X509_REQ_new();
|
X509_REQ *req=X509_REQ_new();
|
||||||
|
|
||||||
// setup output.
|
// setup output.
|
||||||
BIO *bio_out = NULL;
|
BIO *bio_out = BIO_new(BIO_s_file());
|
||||||
bio_out = BIO_new(BIO_s_file());
|
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
|
||||||
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
|
|
||||||
|
|
||||||
EVP_PKEY *pkey = NULL;
|
EVP_PKEY *pkey = NULL;
|
||||||
|
X509_NAME *x509_name = NULL ;
|
||||||
|
RSA *rsa = NULL ;
|
||||||
|
|
||||||
// first generate a key....
|
try
|
||||||
if ((pkey=EVP_PKEY_new()) == NULL)
|
{
|
||||||
{
|
// first generate a key....
|
||||||
fprintf(stderr,"GenerateX509Req: Couldn't Create Key\n");
|
if ((pkey=EVP_PKEY_new()) == NULL)
|
||||||
errString = "Couldn't Create Key";
|
{
|
||||||
return 0;
|
fprintf(stderr,"GenerateX509Req: Couldn't Create Key\n");
|
||||||
}
|
throw std::runtime_error("Couldn't Create Key") ;
|
||||||
|
}
|
||||||
|
|
||||||
int nbits = 2048;
|
int nbits = 2048;
|
||||||
unsigned long e = 0x10001;
|
unsigned long e = 0x10001;
|
||||||
|
|
||||||
if ((nbits_in >= 512) && (nbits_in <= 4096))
|
if ((nbits_in >= 512) && (nbits_in <= 4096))
|
||||||
{
|
{
|
||||||
nbits = nbits_in;
|
nbits = nbits_in;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,"GenerateX509Req: strange num of nbits: %d\n", nbits_in);
|
fprintf(stderr,"GenerateX509Req: strange num of nbits: %d\n", nbits_in);
|
||||||
fprintf(stderr,"GenerateX509Req: reverting to %d\n", nbits);
|
fprintf(stderr,"GenerateX509Req: reverting to %d\n", nbits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsa = RSA_generate_key(nbits, e, NULL, NULL);
|
||||||
|
|
||||||
RSA *rsa = RSA_generate_key(nbits, e, NULL, NULL);
|
if ((rsa == NULL) || !EVP_PKEY_assign_RSA(pkey, rsa))
|
||||||
if ((rsa == NULL) || !EVP_PKEY_assign_RSA(pkey, rsa))
|
throw std::runtime_error("Couldn't generate RSA Key");
|
||||||
{
|
|
||||||
if(rsa) RSA_free(rsa);
|
|
||||||
fprintf(stderr,"GenerateX509Req: Couldn't Generate RSA Key!\n");
|
|
||||||
errString = "Couldn't generate RSA Key";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// open the file.
|
||||||
|
FILE *out;
|
||||||
|
if (NULL == (out = RsDirUtil::rs_fopen(pkey_file.c_str(), "w")))
|
||||||
|
throw std::runtime_error("Couldn't Create Key File \"" + pkey_file + "\"");
|
||||||
|
|
||||||
// open the file.
|
const EVP_CIPHER *cipher = EVP_des_ede3_cbc();
|
||||||
FILE *out;
|
|
||||||
if (NULL == (out = RsDirUtil::rs_fopen(pkey_file.c_str(), "w")))
|
|
||||||
{
|
|
||||||
fprintf(stderr,"GenerateX509Req: Couldn't Create Key File!");
|
|
||||||
fprintf(stderr," : %s\n", pkey_file.c_str());
|
|
||||||
|
|
||||||
errString = "Couldn't Create Key File";
|
if (!PEM_write_PrivateKey(out,pkey,cipher, NULL,0,NULL,(void *) passwd.c_str()))
|
||||||
return 0;
|
{
|
||||||
}
|
fclose(out) ;
|
||||||
|
throw std::runtime_error("Couldn't Save Private Key to file \""+pkey_file+"\"");
|
||||||
|
}
|
||||||
|
|
||||||
const EVP_CIPHER *cipher = EVP_des_ede3_cbc();
|
fclose(out);
|
||||||
|
|
||||||
if (!PEM_write_PrivateKey(out,pkey,cipher,
|
// We have now created a private key....
|
||||||
NULL,0,NULL,(void *) passwd.c_str()))
|
std::cerr << "GenerateX509Req() Saved Private Key to file \"" << pkey_file << "\"" << std::endl;
|
||||||
{
|
|
||||||
fprintf(stderr,"GenerateX509Req() Couldn't Save Private Key");
|
|
||||||
fprintf(stderr," : %s\n", pkey_file.c_str());
|
|
||||||
|
|
||||||
errString = "Couldn't Save Private Key File";
|
/********** Test Loading the private Key.... ************/
|
||||||
return 0;
|
FILE *tst_in = NULL;
|
||||||
}
|
EVP_PKEY *tst_pkey = NULL;
|
||||||
fclose(out);
|
|
||||||
|
|
||||||
// We have now created a private key....
|
if (NULL == (tst_in = RsDirUtil::rs_fopen(pkey_file.c_str(), "rb")))
|
||||||
fprintf(stderr,"GenerateX509Req() Saved Private Key");
|
throw std::runtime_error("GenerateX509Req() Couldn't Open Private Key file \""+pkey_file+"\"") ;
|
||||||
fprintf(stderr," : %s\n", pkey_file.c_str());
|
|
||||||
|
|
||||||
/********** Test Loading the private Key.... ************/
|
if (NULL == (tst_pkey = PEM_read_PrivateKey(tst_in,NULL,NULL,(void *) passwd.c_str())))
|
||||||
FILE *tst_in = NULL;
|
{
|
||||||
EVP_PKEY *tst_pkey = NULL;
|
fclose(tst_in);
|
||||||
if (NULL == (tst_in = RsDirUtil::rs_fopen(pkey_file.c_str(), "rb")))
|
throw std::runtime_error("GenerateX509Req() Couldn't read Private Key file \""+pkey_file+"\"") ;
|
||||||
{
|
}
|
||||||
fprintf(stderr,"GenerateX509Req() Couldn't Open Private Key");
|
|
||||||
fprintf(stderr," : %s\n", pkey_file.c_str());
|
|
||||||
|
|
||||||
errString = "Couldn't Open Private Key";
|
fclose(tst_in);
|
||||||
return 0;
|
EVP_PKEY_free(tst_pkey);
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == (tst_pkey =
|
/* Fill in details: fields.
|
||||||
PEM_read_PrivateKey(tst_in,NULL,NULL,(void *) passwd.c_str())))
|
|
||||||
{
|
|
||||||
fprintf(stderr,"GenerateX509Req() Couldn't Read Private Key");
|
|
||||||
fprintf(stderr," : %s\n", pkey_file.c_str());
|
|
||||||
|
|
||||||
errString = "Couldn't Read Private Key";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fclose(tst_in);
|
|
||||||
EVP_PKEY_free(tst_pkey);
|
|
||||||
/********** Test Loading the private Key.... ************/
|
|
||||||
|
|
||||||
/* Fill in details: fields.
|
|
||||||
req->req_info;
|
req->req_info;
|
||||||
req->req_info->enc;
|
req->req_info->enc;
|
||||||
req->req_info->version;
|
req->req_info->version;
|
||||||
@ -175,108 +152,88 @@ X509_REQ *GenerateX509Req(
|
|||||||
req->req_info->pubkey;
|
req->req_info->pubkey;
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
long version = 0x00;
|
long version = 0x00;
|
||||||
unsigned long chtype = MBSTRING_UTF8;
|
unsigned long chtype = MBSTRING_UTF8;
|
||||||
X509_NAME *x509_name = X509_NAME_new();
|
x509_name = X509_NAME_new();
|
||||||
|
|
||||||
// fill in the request.
|
// fill in the request.
|
||||||
|
|
||||||
/**** X509_REQ -> Version ********************************/
|
/**** X509_REQ -> Version ********************************/
|
||||||
if (!X509_REQ_set_version(req,version)) /* version 1 */
|
if(!X509_REQ_set_version(req,version)) /* version 1 */
|
||||||
{
|
throw std::runtime_error("GenerateX509Req(): Couldn't Set SSL certificate Version!");
|
||||||
fprintf(stderr,"GenerateX509Req(): Couldn't Set Version!\n");
|
|
||||||
|
|
||||||
errString = "Couldn't Set Version";
|
/**** X509_REQ -> Version ********************************/
|
||||||
return 0;
|
/**** X509_REQ -> Key ********************************/
|
||||||
}
|
|
||||||
/**** X509_REQ -> Version ********************************/
|
|
||||||
/**** X509_REQ -> Key ********************************/
|
|
||||||
|
|
||||||
if (!X509_REQ_set_pubkey(req,pkey))
|
if (!X509_REQ_set_pubkey(req,pkey))
|
||||||
{
|
throw std::runtime_error("GenerateX509Req(): Couldn't Set SSL certificate PUBKEY!");
|
||||||
fprintf(stderr,"GenerateX509Req() Couldn't Set PUBKEY !\n");
|
|
||||||
|
|
||||||
errString = "Couldn't Set PubKey";
|
/**** SUBJECT ********************************/
|
||||||
return 0;
|
// create the name.
|
||||||
}
|
|
||||||
|
|
||||||
/**** SUBJECT ********************************/
|
// fields to add.
|
||||||
// create the name.
|
// commonName CN
|
||||||
|
// emailAddress (none)
|
||||||
|
// organizationName O
|
||||||
|
// localityName L
|
||||||
|
// stateOrProvinceName ST
|
||||||
|
// countryName C
|
||||||
|
|
||||||
// fields to add.
|
if (0 == strlen(name.c_str()))
|
||||||
// commonName CN
|
throw std::runtime_error("No name! Aborting.") ;
|
||||||
// emailAddress (none)
|
|
||||||
// organizationName O
|
|
||||||
// localityName L
|
|
||||||
// stateOrProvinceName ST
|
|
||||||
// countryName C
|
|
||||||
|
|
||||||
if (0 < strlen(name.c_str()))
|
X509_NAME_add_entry_by_txt(x509_name, "CN", chtype, (unsigned char *) name.c_str(), -1, -1, 0);
|
||||||
{
|
|
||||||
X509_NAME_add_entry_by_txt(x509_name, "CN", chtype,
|
|
||||||
(unsigned char *) name.c_str(), -1, -1, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr,"GenerateX509Req(): No Name -> Not creating X509 Cert Req\n");
|
|
||||||
errString = "No Name, Aborting";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < strlen(email.c_str()))
|
if (0 < strlen(email.c_str()))
|
||||||
{
|
X509_NAME_add_entry_by_NID(x509_name, 48, 0, (unsigned char *) email.c_str(), -1, -1, 0);
|
||||||
//X509_NAME_add_entry_by_txt(x509_name, "Email", 0,
|
|
||||||
// (unsigned char *) ui -> gen_email -> value(), -1, -1, 0);
|
|
||||||
X509_NAME_add_entry_by_NID(x509_name, 48, 0,
|
|
||||||
(unsigned char *) email.c_str(), -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < strlen(org.c_str()))
|
if (0 < strlen(org.c_str()))
|
||||||
{
|
X509_NAME_add_entry_by_txt(x509_name, "O", chtype, (unsigned char *) org.c_str(), -1, -1, 0);
|
||||||
X509_NAME_add_entry_by_txt(x509_name, "O", chtype,
|
|
||||||
(unsigned char *) org.c_str(), -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < strlen(loc.c_str()))
|
if (0 < strlen(loc.c_str()))
|
||||||
{
|
X509_NAME_add_entry_by_txt(x509_name, "L", chtype, (unsigned char *) loc.c_str(), -1, -1, 0);
|
||||||
X509_NAME_add_entry_by_txt(x509_name, "L", chtype,
|
|
||||||
(unsigned char *) loc.c_str(), -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < strlen(state.c_str()))
|
if (0 < strlen(state.c_str()))
|
||||||
{
|
X509_NAME_add_entry_by_txt(x509_name, "ST", chtype, (unsigned char *) state.c_str(), -1, -1, 0);
|
||||||
X509_NAME_add_entry_by_txt(x509_name, "ST", chtype,
|
|
||||||
(unsigned char *) state.c_str(), -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < strlen(country.c_str()))
|
if (0 < strlen(country.c_str()))
|
||||||
{
|
X509_NAME_add_entry_by_txt(x509_name, "C", chtype, (unsigned char *) country.c_str(), -1, -1, 0);
|
||||||
X509_NAME_add_entry_by_txt(x509_name, "C", chtype,
|
|
||||||
(unsigned char *) country.c_str(), -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!X509_REQ_set_subject_name(req,x509_name))
|
if (!X509_REQ_set_subject_name(req,x509_name))
|
||||||
{
|
throw std::runtime_error("GenerateX509Req() Couldn't Set Name to Request!");
|
||||||
fprintf(stderr,"GenerateX509Req() Couldn't Set Name to Request!\n");
|
|
||||||
X509_NAME_free(x509_name);
|
|
||||||
|
|
||||||
errString = "Couldn't Set Name";
|
X509_NAME_free(x509_name);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
X509_NAME_free(x509_name);
|
/**** SUBJECT ********************************/
|
||||||
/**** SUBJECT ********************************/
|
|
||||||
|
|
||||||
if (!X509_REQ_sign(req,pkey,EVP_sha1()))
|
if (!X509_REQ_sign(req,pkey,EVP_sha1()))
|
||||||
{
|
throw std::runtime_error("GenerateX509Req() Failed to sign REQ");
|
||||||
fprintf(stderr,"GenerateX509Req() Failed to Sign REQ\n");
|
|
||||||
|
|
||||||
errString = "Couldn't Sign Req";
|
errString = "No Error";
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
errString = "No Error";
|
return req;
|
||||||
return req;
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) Key creation failed: " << e.what() << std::endl;
|
||||||
|
errString = e.what() ;
|
||||||
|
req = NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(rsa)
|
||||||
|
RSA_free(rsa);
|
||||||
|
|
||||||
|
if(x509_name)
|
||||||
|
X509_NAME_free(x509_name);
|
||||||
|
|
||||||
|
if(bio_out)
|
||||||
|
BIO_free_all(bio_out) ;
|
||||||
|
|
||||||
|
if(pkey)
|
||||||
|
EVP_PKEY_free(pkey);
|
||||||
|
|
||||||
|
return req ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SERIAL_RAND_BITS 64
|
#define SERIAL_RAND_BITS 64
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
RS_TOP_DIR = ..
|
|
||||||
##### Define any flags that are needed for this section #######
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/config.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
OBJ = notifytxt.o retroshare.o
|
|
||||||
|
|
||||||
#TESTOBJ =
|
|
||||||
|
|
||||||
TESTS = retroshare-nogui
|
|
||||||
|
|
||||||
all: tests
|
|
||||||
|
|
||||||
retroshare-nogui: $(OBJ)
|
|
||||||
$(CC) $(CFLAGS) -o retroshare-nogui $(OBJ) $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/rules.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
@ -102,6 +102,9 @@ 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
|
||||||
|
@ -18,48 +18,36 @@ namespace GXS_SERV {
|
|||||||
|
|
||||||
/** START privacy **/
|
/** START privacy **/
|
||||||
|
|
||||||
static const uint32_t FLAG_PRIVACY_MASK = 0x0000000f;
|
static const uint32_t FLAG_PRIVACY_MASK = 0x0000000f;
|
||||||
|
static const uint32_t FLAG_PRIVACY_PRIVATE = 0x00000001; // pub key encrypted
|
||||||
// pub key encrypted
|
static const uint32_t FLAG_PRIVACY_RESTRICTED = 0x00000002; // publish private key needed to publish
|
||||||
static const uint32_t FLAG_PRIVACY_PRIVATE = 0x00000001;
|
static const uint32_t FLAG_PRIVACY_PUBLIC = 0x00000004; // anyone can publish, publish key pair not needed
|
||||||
|
|
||||||
// publish private key needed to publish
|
|
||||||
static const uint32_t FLAG_PRIVACY_RESTRICTED = 0x00000002;
|
|
||||||
|
|
||||||
// anyone can publish, publish key pair not needed
|
|
||||||
static const uint32_t FLAG_PRIVACY_PUBLIC = 0x00000004;
|
|
||||||
|
|
||||||
/** END privacy **/
|
/** END privacy **/
|
||||||
|
|
||||||
/** START authentication **/
|
|
||||||
|
|
||||||
static const uint32_t FLAG_AUTHEN_MASK = 0x000000f0;
|
|
||||||
|
|
||||||
// identity
|
|
||||||
static const uint32_t FLAG_AUTHEN_IDENTITY = 0x000000010;
|
|
||||||
|
|
||||||
// publish key
|
|
||||||
static const uint32_t FLAG_AUTHEN_PUBLISH = 0x000000020;
|
|
||||||
|
|
||||||
// admin key
|
|
||||||
static const uint32_t FLAG_AUTHEN_ADMIN = 0x00000040;
|
|
||||||
|
|
||||||
// pgp sign identity
|
|
||||||
static const uint32_t FLAG_AUTHEN_PGP_IDENTITY = 0x00000080;
|
|
||||||
|
|
||||||
/** END authentication **/
|
/** END authentication **/
|
||||||
|
|
||||||
|
/** START author authentication flags **/
|
||||||
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_MASK = 0x0000ff00;
|
||||||
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_NONE = 0x00000000;
|
||||||
|
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_IFNOPUBSIGN = 0x00000400;
|
||||||
|
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES = 0x00000800;
|
||||||
|
|
||||||
|
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_ALLSIGNED = 0x00000002;
|
||||||
|
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_THREADHEAD = 0x00000004;
|
||||||
|
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_NONEREQ = 0x00000008;
|
||||||
|
|
||||||
/** START msg authentication flags **/
|
/** START msg authentication flags **/
|
||||||
|
|
||||||
static const uint8_t MSG_AUTHEN_MASK = 0x0f;
|
static const uint8_t MSG_AUTHEN_MASK = 0x0f;
|
||||||
|
static const uint8_t MSG_AUTHEN_ROOT_PUBLISH_SIGN = 0x01;
|
||||||
static const uint8_t MSG_AUTHEN_ROOT_PUBLISH_SIGN = 0x01;
|
|
||||||
|
|
||||||
static const uint8_t MSG_AUTHEN_CHILD_PUBLISH_SIGN = 0x02;
|
static const uint8_t MSG_AUTHEN_CHILD_PUBLISH_SIGN = 0x02;
|
||||||
|
static const uint8_t MSG_AUTHEN_ROOT_AUTHOR_SIGN = 0x04;
|
||||||
static const uint8_t MSG_AUTHEN_ROOT_AUTHOR_SIGN = 0x04;
|
static const uint8_t MSG_AUTHEN_CHILD_AUTHOR_SIGN = 0x08;
|
||||||
|
|
||||||
static const uint8_t MSG_AUTHEN_CHILD_AUTHOR_SIGN = 0x08;
|
|
||||||
|
|
||||||
/** END msg authentication flags **/
|
/** END msg authentication flags **/
|
||||||
|
|
||||||
@ -71,12 +59,9 @@ namespace GXS_SERV {
|
|||||||
|
|
||||||
/** START Subscription Flags. (LOCAL) **/
|
/** START Subscription Flags. (LOCAL) **/
|
||||||
|
|
||||||
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x01;
|
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x01;
|
||||||
|
static const uint32_t GROUP_SUBSCRIBE_PUBLISH = 0x02;
|
||||||
static const uint32_t GROUP_SUBSCRIBE_PUBLISH = 0x02;
|
static const uint32_t GROUP_SUBSCRIBE_SUBSCRIBED = 0x04;
|
||||||
|
|
||||||
static const uint32_t GROUP_SUBSCRIBE_SUBSCRIBED = 0x04;
|
|
||||||
|
|
||||||
static const uint32_t GROUP_SUBSCRIBE_NOT_SUBSCRIBED = 0x08;
|
static const uint32_t GROUP_SUBSCRIBE_NOT_SUBSCRIBED = 0x08;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -95,17 +80,12 @@ namespace GXS_SERV {
|
|||||||
*
|
*
|
||||||
* NOTE: RsGxsCommentService uses 0x000f0000.
|
* NOTE: RsGxsCommentService uses 0x000f0000.
|
||||||
*/
|
*/
|
||||||
static const uint32_t GXS_MSG_STATUS_GEN_MASK = 0x0000ffff;
|
static const uint32_t GXS_MSG_STATUS_GEN_MASK = 0x0000ffff;
|
||||||
|
|
||||||
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x00000001;
|
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x00000001;
|
||||||
|
static const uint32_t GXS_MSG_STATUS_GUI_UNREAD = 0x00000002;
|
||||||
static const uint32_t GXS_MSG_STATUS_GUI_UNREAD = 0x00000002;
|
static const uint32_t GXS_MSG_STATUS_GUI_NEW = 0x00000004;
|
||||||
|
static const uint32_t GXS_MSG_STATUS_KEEP = 0x00000008;
|
||||||
static const uint32_t GXS_MSG_STATUS_GUI_NEW = 0x00000004;
|
static const uint32_t GXS_MSG_STATUS_DELETE = 0x00000020;
|
||||||
|
|
||||||
static const uint32_t GXS_MSG_STATUS_KEEP = 0x00000008;
|
|
||||||
|
|
||||||
static const uint32_t GXS_MSG_STATUS_DELETE = 0x000000020;
|
|
||||||
|
|
||||||
/** END GXS Msg status flags **/
|
/** END GXS Msg status flags **/
|
||||||
|
|
||||||
@ -123,10 +103,13 @@ namespace GXS_SERV {
|
|||||||
#define IS_MSG_NEW(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_NEW)
|
#define IS_MSG_NEW(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_NEW)
|
||||||
#define IS_MSG_UNREAD(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD)
|
#define IS_MSG_UNREAD(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD)
|
||||||
|
|
||||||
|
#define IS_GROUP_PGP_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
|
||||||
|
#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)
|
||||||
#define IS_GROUP_PUBLISHER(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
|
#define IS_GROUP_PUBLISHER(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
|
||||||
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
|
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
|
||||||
#define IS_GROUP_NOT_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED)
|
#define IS_GROUP_NOT_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED)
|
||||||
|
|
||||||
#define IS_MSG_UNPROCESSED(status) (status & GXS_SERV::GXS_MSG_STATUS_UNPROCESSED)
|
#define IS_MSG_UNPROCESSED(status) (status & GXS_SERV::GXS_MSG_STATUS_UNPROCESSED)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "retroshare/rstokenservice.h"
|
#include "retroshare/rstokenservice.h"
|
||||||
#include "retroshare/rsgxsifacehelper.h"
|
#include "retroshare/rsgxsifacehelper.h"
|
||||||
|
#include "retroshare/rsreputations.h"
|
||||||
#include "retroshare/rsids.h"
|
#include "retroshare/rsids.h"
|
||||||
#include "serialiser/rstlvimage.h"
|
#include "serialiser/rstlvimage.h"
|
||||||
#include "retroshare/rsgxscommon.h"
|
#include "retroshare/rsgxscommon.h"
|
||||||
@ -161,7 +162,8 @@ class RsRecognTagDetails
|
|||||||
class RsIdentityDetails
|
class RsIdentityDetails
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsIdentityDetails() :mFlags(0), mReputation(), mLastUsageTS(0) { return; }
|
RsIdentityDetails()
|
||||||
|
: mFlags(0), mLastUsageTS(0) { return; }
|
||||||
|
|
||||||
RsGxsId mId;
|
RsGxsId mId;
|
||||||
|
|
||||||
@ -176,8 +178,12 @@ public:
|
|||||||
// Recogn details.
|
// Recogn details.
|
||||||
std::list<RsRecognTag> mRecognTags;
|
std::list<RsRecognTag> mRecognTags;
|
||||||
|
|
||||||
// reputation details.
|
// Cyril: Reputation details. At some point we might want to merge information
|
||||||
GxsReputation mReputation;
|
// between the two into a single global score. Since the old reputation system
|
||||||
|
// is not finished yet, I leave this in place. We should decide what to do with it.
|
||||||
|
|
||||||
|
GxsReputation mReputation_oldSystem; // this is the old "mReputation" field, which apparently is not used.
|
||||||
|
RsReputations::ReputationInfo mReputation;
|
||||||
|
|
||||||
// avatar
|
// avatar
|
||||||
RsGxsImage mAvatar ;
|
RsGxsImage mAvatar ;
|
||||||
@ -215,7 +221,7 @@ public:
|
|||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
// 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.
|
||||||
// Its a major error if we don't have the identity.
|
// Its a major error if we don't have the identity.
|
||||||
|
@ -63,6 +63,14 @@ const uint32_t RS_NETMODE_EXT = 0x0003;
|
|||||||
const uint32_t RS_NETMODE_HIDDEN = 0x0004;
|
const uint32_t RS_NETMODE_HIDDEN = 0x0004;
|
||||||
const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
|
const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
|
||||||
|
|
||||||
|
/* Hidden Type */
|
||||||
|
const uint32_t RS_HIDDEN_TYPE_NONE = 0x0000;
|
||||||
|
const uint32_t RS_HIDDEN_TYPE_UNKNOWN = 0x0001;
|
||||||
|
const uint32_t RS_HIDDEN_TYPE_TOR = 0x0002;
|
||||||
|
const uint32_t RS_HIDDEN_TYPE_I2P = 0x0004;
|
||||||
|
/* mask to match all valid hidden types */
|
||||||
|
const uint32_t RS_HIDDEN_TYPE_MASK = RS_HIDDEN_TYPE_I2P | RS_HIDDEN_TYPE_TOR;
|
||||||
|
|
||||||
/* Visibility */
|
/* Visibility */
|
||||||
const uint32_t RS_VS_DISC_OFF = 0x0000;
|
const uint32_t RS_VS_DISC_OFF = 0x0000;
|
||||||
const uint32_t RS_VS_DISC_MINIMAL = 0x0001;
|
const uint32_t RS_VS_DISC_MINIMAL = 0x0001;
|
||||||
@ -96,7 +104,8 @@ const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
|
|||||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
|
||||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
|
||||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
|
||||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_I2P = 7;
|
||||||
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 8;
|
||||||
|
|
||||||
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
|
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
|
||||||
|
|
||||||
@ -232,6 +241,7 @@ class RsPeerDetails
|
|||||||
bool isHiddenNode;
|
bool isHiddenNode;
|
||||||
std::string hiddenNodeAddress;
|
std::string hiddenNodeAddress;
|
||||||
uint16_t hiddenNodePort;
|
uint16_t hiddenNodePort;
|
||||||
|
uint32_t hiddenType;
|
||||||
|
|
||||||
// Filled in for Standard Node.
|
// Filled in for Standard Node.
|
||||||
std::string localAddr;
|
std::string localAddr;
|
||||||
@ -350,8 +360,8 @@ class RsPeers
|
|||||||
virtual bool setNetworkMode(const RsPeerId &ssl_id, uint32_t netMode) = 0;
|
virtual bool setNetworkMode(const RsPeerId &ssl_id, uint32_t netMode) = 0;
|
||||||
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
||||||
|
|
||||||
virtual bool getProxyServer(std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
|
virtual bool getProxyServer(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
|
||||||
virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 0;
|
virtual bool setProxyServer(const uint32_t type, const std::string &addr, const uint16_t port) = 0;
|
||||||
|
|
||||||
virtual void getIPServersList(std::list<std::string>& ip_servers) = 0;
|
virtual void getIPServersList(std::list<std::string>& ip_servers) = 0;
|
||||||
virtual void allowServerIPDetermination(bool) = 0;
|
virtual void allowServerIPDetermination(bool) = 0;
|
||||||
|
@ -40,6 +40,7 @@ extern RsPluginHandler *rsPlugins ;
|
|||||||
|
|
||||||
class p3Service ;
|
class p3Service ;
|
||||||
class RsServiceControl ;
|
class RsServiceControl ;
|
||||||
|
class RsReputations ;
|
||||||
class RsTurtle ;
|
class RsTurtle ;
|
||||||
class RsDht ;
|
class RsDht ;
|
||||||
class RsDisc ;
|
class RsDisc ;
|
||||||
@ -116,6 +117,7 @@ public:
|
|||||||
RsUtil::inited_ptr<PgpAuxUtils> mPgpAuxUtils;
|
RsUtil::inited_ptr<PgpAuxUtils> mPgpAuxUtils;
|
||||||
RsUtil::inited_ptr<RsGxsForums> mGxsForums;
|
RsUtil::inited_ptr<RsGxsForums> mGxsForums;
|
||||||
RsUtil::inited_ptr<RsGxsChannels> mGxsChannels;
|
RsUtil::inited_ptr<RsGxsChannels> mGxsChannels;
|
||||||
|
RsUtil::inited_ptr<RsReputations> mReputations;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsPlugin
|
class RsPlugin
|
||||||
|
61
libretroshare/src/retroshare/rsreputations.h
Normal file
61
libretroshare/src/retroshare/rsreputations.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* libretroshare/src/services: rsreputation.h
|
||||||
|
*
|
||||||
|
* Services for RetroShare.
|
||||||
|
*
|
||||||
|
* Copyright 2015 by Cyril Soler
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "csoler@users.sourceforge.net".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "retroshare/rsids.h"
|
||||||
|
#include "retroshare/rsgxsifacetypes.h"
|
||||||
|
|
||||||
|
class RsReputations
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const float REPUTATION_THRESHOLD_ANTI_SPAM = 1.4f ;
|
||||||
|
static const float REPUTATION_THRESHOLD_DEFAULT = 1.0f ;
|
||||||
|
|
||||||
|
// This is the interface file for the reputation system
|
||||||
|
//
|
||||||
|
enum Opinion { OPINION_NEGATIVE = 0, OPINION_NEUTRAL = 1, OPINION_POSITIVE = 2 } ;
|
||||||
|
enum Assessment { ASSESSMENT_BAD = 0, ASSESSMENT_OK = 1 } ;
|
||||||
|
|
||||||
|
struct ReputationInfo
|
||||||
|
{
|
||||||
|
RsReputations::Opinion mOwnOpinion ;
|
||||||
|
float mOverallReputationScore ;
|
||||||
|
float mFriendAverage ;
|
||||||
|
RsReputations::Assessment mAssessment; // this should help clients in taking decisions
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
|
||||||
|
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
|
||||||
|
|
||||||
|
// This one is a proxy designed to allow fast checking of a GXS id.
|
||||||
|
// it basically returns true if assessment is not ASSESSMENT_OK
|
||||||
|
|
||||||
|
virtual bool isIdentityBanned(const RsGxsId& id) =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// To access reputations from anywhere
|
||||||
|
//
|
||||||
|
extern RsReputations *rsReputations ;
|
@ -1,35 +0,0 @@
|
|||||||
|
|
||||||
RS_TOP_DIR = ..
|
|
||||||
##### Define any flags that are needed for this section #######
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/config.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
RSOBJ = rsinit.o \
|
|
||||||
p3peers.o \
|
|
||||||
p3rank.o \
|
|
||||||
p3photo.o \
|
|
||||||
p3msgs.o \
|
|
||||||
p3blog.o \
|
|
||||||
p3discovery.o \
|
|
||||||
p3face-server.o \
|
|
||||||
p3face-config.o \
|
|
||||||
p3face-msgs.o \
|
|
||||||
rsiface.o \
|
|
||||||
rstypes.o
|
|
||||||
|
|
||||||
#TESTOBJ =
|
|
||||||
|
|
||||||
#TESTS =
|
|
||||||
|
|
||||||
all: librs tests
|
|
||||||
|
|
||||||
#tlvbase_test : tlvbase_test.o
|
|
||||||
# $(CC) $(CFLAGS) -o tlvbase_test tlvbase_test.o $(OBJ) $(LIBS)
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/rules.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
@ -313,6 +313,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
d.isHiddenNode = true;
|
d.isHiddenNode = true;
|
||||||
d.hiddenNodeAddress = ps.hiddenDomain;
|
d.hiddenNodeAddress = ps.hiddenDomain;
|
||||||
d.hiddenNodePort = ps.hiddenPort;
|
d.hiddenNodePort = ps.hiddenPort;
|
||||||
|
d.hiddenType = ps.hiddenType;
|
||||||
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
|
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
|
||||||
d.localPort = sockaddr_storage_port(ps.localaddr);
|
d.localPort = sockaddr_storage_port(ps.localaddr);
|
||||||
d.extAddr = "hidden";
|
d.extAddr = "hidden";
|
||||||
@ -324,6 +325,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
d.isHiddenNode = false;
|
d.isHiddenNode = false;
|
||||||
d.hiddenNodeAddress = "";
|
d.hiddenNodeAddress = "";
|
||||||
d.hiddenNodePort = 0;
|
d.hiddenNodePort = 0;
|
||||||
|
d.hiddenType = RS_HIDDEN_TYPE_NONE;
|
||||||
|
|
||||||
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
|
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
|
||||||
d.localPort = sockaddr_storage_port(ps.localaddr);
|
d.localPort = sockaddr_storage_port(ps.localaddr);
|
||||||
@ -435,20 +437,79 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
}
|
}
|
||||||
else if (pcs.state & RS_PEER_S_CONNECTED)
|
else if (pcs.state & RS_PEER_S_CONNECTED)
|
||||||
{
|
{
|
||||||
if(isProxyAddress(pcs.connectaddr) || mPeerMgr->isHidden())
|
/* peer is connected - determine how and set proper connectState */
|
||||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
|
if(mPeerMgr->isHidden())
|
||||||
else if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
|
{
|
||||||
{
|
uint32_t type;
|
||||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;
|
/* hidden location */
|
||||||
}
|
/* use connection direction to determine connection type */
|
||||||
else if (pcs.connecttype == RS_NET_CONN_UDP_ALL)
|
if(pcs.actAsServer)
|
||||||
{
|
{
|
||||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UDP;
|
/* incoming connection */
|
||||||
}
|
/* use own type to set connectState */
|
||||||
else
|
type = mPeerMgr->getHiddenType(AuthSSL::getAuthSSL()->OwnId());
|
||||||
{
|
switch (type) {
|
||||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
}
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_I2P;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* outgoing connection */
|
||||||
|
/* use peer hidden type to set connectState */
|
||||||
|
switch (ps.hiddenType) {
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_I2P;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ps.hiddenType & RS_HIDDEN_TYPE_MASK)
|
||||||
|
{
|
||||||
|
/* hidden peer */
|
||||||
|
/* use hidden type to set connectState */
|
||||||
|
switch (ps.hiddenType) {
|
||||||
|
case RS_HIDDEN_TYPE_TOR:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
|
||||||
|
break;
|
||||||
|
case RS_HIDDEN_TYPE_I2P:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_I2P;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* peer and we are normal nodes */
|
||||||
|
/* use normal detection to set connectState */
|
||||||
|
if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
|
||||||
|
{
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;
|
||||||
|
}
|
||||||
|
else if (pcs.connecttype == RS_NET_CONN_UDP_ALL)
|
||||||
|
{
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UDP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d.wasDeniedConnection = pcs.wasDeniedConnection;
|
d.wasDeniedConnection = pcs.wasDeniedConnection;
|
||||||
@ -457,13 +518,13 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::isProxyAddress(const sockaddr_storage& addr)
|
bool p3Peers::isProxyAddress(const uint32_t type, const sockaddr_storage& addr)
|
||||||
{
|
{
|
||||||
uint16_t port ;
|
uint16_t port ;
|
||||||
std::string string_addr;
|
std::string string_addr;
|
||||||
uint32_t status ;
|
uint32_t status ;
|
||||||
|
|
||||||
if(!getProxyServer(string_addr, port, status))
|
if(!getProxyServer(type, string_addr, port, status))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
return sockaddr_storage_iptostring(addr)==string_addr && sockaddr_storage_port(addr)==port ;
|
return sockaddr_storage_iptostring(addr)==string_addr && sockaddr_storage_port(addr)==port ;
|
||||||
@ -923,21 +984,21 @@ bool p3Peers::setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht)
|
|||||||
return mPeerMgr->setVisState(id, vs_disc, vs_dht);
|
return mPeerMgr->setVisState(id, vs_disc, vs_dht);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::getProxyServer(std::string &addr, uint16_t &port, uint32_t &status)
|
bool p3Peers::getProxyServer(const uint32_t type, std::string &addr, uint16_t &port, uint32_t &status)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::getProxyServer()" << std::endl;
|
std::cerr << "p3Peers::getProxyServer()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sockaddr_storage proxy_addr;
|
struct sockaddr_storage proxy_addr;
|
||||||
mPeerMgr->getProxyServerAddress(proxy_addr);
|
mPeerMgr->getProxyServerAddress(type, proxy_addr);
|
||||||
addr = sockaddr_storage_iptostring(proxy_addr);
|
addr = sockaddr_storage_iptostring(proxy_addr);
|
||||||
port = sockaddr_storage_port(proxy_addr);
|
port = sockaddr_storage_port(proxy_addr);
|
||||||
mPeerMgr->getProxyServerStatus(status);
|
mPeerMgr->getProxyServerStatus(type, status);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::setProxyServer(const std::string &addr_str, const uint16_t port)
|
bool p3Peers::setProxyServer(const uint32_t type, const std::string &addr_str, const uint16_t port)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::setProxyServer() " << std::endl;
|
std::cerr << "p3Peers::setProxyServer() " << std::endl;
|
||||||
@ -958,7 +1019,7 @@ bool p3Peers::setProxyServer(const std::string &addr_str, const uint16_t port)
|
|||||||
#endif
|
#endif
|
||||||
/********************************** WINDOWS/UNIX SPECIFIC PART *******************/
|
/********************************** WINDOWS/UNIX SPECIFIC PART *******************/
|
||||||
{
|
{
|
||||||
return mPeerMgr->setProxyServerAddress(addr);
|
return mPeerMgr->setProxyServerAddress(type, addr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1017,7 +1078,7 @@ bool p3Peers::GetPGPBase64StringAndCheckSum( const RsPgpId& gpg_id,
|
|||||||
|
|
||||||
uint32_t crc = PGPKeyManagement::compute24bitsCRC((unsigned char *)mem_block,mem_block_size) ;
|
uint32_t crc = PGPKeyManagement::compute24bitsCRC((unsigned char *)mem_block,mem_block_size) ;
|
||||||
|
|
||||||
unsigned char tmp[3] = { (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff } ;
|
unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ;
|
||||||
Radix64::encode((const char *)tmp,3,gpg_base64_checksum) ;
|
Radix64::encode((const char *)tmp,3,gpg_base64_checksum) ;
|
||||||
|
|
||||||
delete[] mem_block ;
|
delete[] mem_block ;
|
||||||
@ -1107,6 +1168,7 @@ bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetai
|
|||||||
{
|
{
|
||||||
pd.hiddenNodeAddress = domain;
|
pd.hiddenNodeAddress = domain;
|
||||||
pd.hiddenNodePort = port;
|
pd.hiddenNodePort = port;
|
||||||
|
pd.hiddenType = mPeerMgr->hiddenDomainToHiddenType(domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1311,7 +1373,7 @@ RsPeerDetails::RsPeerDetails()
|
|||||||
hasSignedMe(false),accept_connection(false),
|
hasSignedMe(false),accept_connection(false),
|
||||||
state(0),localAddr(""),localPort(0),extAddr(""),extPort(0),netMode(0),vs_disc(0), vs_dht(0),
|
state(0),localAddr(""),localPort(0),extAddr(""),extPort(0),netMode(0),vs_disc(0), vs_dht(0),
|
||||||
lastConnect(0),connectState(0),connectStateString(""),connectPeriod(0),foundDHT(false),
|
lastConnect(0),connectState(0),connectStateString(""),connectPeriod(0),foundDHT(false),
|
||||||
wasDeniedConnection(false), deniedTS(0)
|
wasDeniedConnection(false), deniedTS(0), hiddenType(RS_HIDDEN_TYPE_NONE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns);
|
|||||||
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 getProxyServer(std::string &addr, uint16_t &port,uint32_t& status);
|
virtual bool getProxyServer(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status);
|
||||||
virtual bool setProxyServer(const std::string &addr, const uint16_t port);
|
virtual bool setProxyServer(const uint32_t type,const std::string &addr, const uint16_t port);
|
||||||
virtual bool isProxyAddress(const sockaddr_storage&);
|
virtual bool isProxyAddress(const uint32_t type,const sockaddr_storage&);
|
||||||
|
|
||||||
virtual void getIPServersList(std::list<std::string>& ip_servers) ;
|
virtual void getIPServersList(std::list<std::string>& ip_servers) ;
|
||||||
virtual void allowServerIPDetermination(bool) ;
|
virtual void allowServerIPDetermination(bool) ;
|
||||||
|
@ -994,7 +994,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nbits = 2048;
|
int nbits = 4096;
|
||||||
|
|
||||||
std::string pgp_name = AuthGPG::getAuthGPG()->getGPGName(pgp_id);
|
std::string pgp_name = AuthGPG::getAuthGPG()->getGPGName(pgp_id);
|
||||||
|
|
||||||
|
@ -365,7 +365,11 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||||||
#ifdef LOCALNET_TESTING
|
#ifdef LOCALNET_TESTING
|
||||||
>> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false)
|
>> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
>> help('h',"help","Display this Help") ;
|
||||||
|
#else
|
||||||
>> help() ;
|
>> help() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
as.defaultErrorHandling(true) ;
|
as.defaultErrorHandling(true) ;
|
||||||
|
|
||||||
@ -819,6 +823,7 @@ bool RsInit::SetHiddenLocation(const std::string& hiddenaddress, uint16_t port)
|
|||||||
|
|
||||||
RsFiles *rsFiles = NULL;
|
RsFiles *rsFiles = NULL;
|
||||||
RsTurtle *rsTurtle = NULL ;
|
RsTurtle *rsTurtle = NULL ;
|
||||||
|
RsReputations *rsReputations = NULL ;
|
||||||
#ifdef ENABLE_GROUTER
|
#ifdef ENABLE_GROUTER
|
||||||
RsGRouter *rsGRouter = NULL ;
|
RsGRouter *rsGRouter = NULL ;
|
||||||
#endif
|
#endif
|
||||||
@ -847,6 +852,7 @@ RsGRouter *rsGRouter = NULL ;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "services/p3gxsreputation.h"
|
||||||
#include "services/p3serviceinfo.h"
|
#include "services/p3serviceinfo.h"
|
||||||
#include "services/p3heartbeat.h"
|
#include "services/p3heartbeat.h"
|
||||||
#include "services/p3discovery2.h"
|
#include "services/p3discovery2.h"
|
||||||
@ -1251,7 +1257,7 @@ int RsServer::StartupRetroShare()
|
|||||||
std::vector<std::string> plugins_directories ;
|
std::vector<std::string> plugins_directories ;
|
||||||
|
|
||||||
#ifndef WINDOWS_SYS
|
#ifndef WINDOWS_SYS
|
||||||
plugins_directories.push_back(std::string(LIB_DIR) + "/retroshare/extensions6/") ;
|
plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
|
||||||
#endif
|
#endif
|
||||||
std::string extensions_dir = rsAccounts->PathBaseDirectory() + "/extensions6/" ;
|
std::string extensions_dir = rsAccounts->PathBaseDirectory() + "/extensions6/" ;
|
||||||
plugins_directories.push_back(extensions_dir) ;
|
plugins_directories.push_back(extensions_dir) ;
|
||||||
@ -1357,6 +1363,11 @@ int RsServer::StartupRetroShare()
|
|||||||
|
|
||||||
mPosted->setNetworkExchangeService(posted_ns) ;
|
mPosted->setNetworkExchangeService(posted_ns) ;
|
||||||
|
|
||||||
|
/**** Reputation system ****/
|
||||||
|
|
||||||
|
p3GxsReputation *mReputations = new p3GxsReputation(mLinkMgr) ;
|
||||||
|
rsReputations = mReputations ;
|
||||||
|
|
||||||
/**** Wiki GXS service ****/
|
/**** Wiki GXS service ****/
|
||||||
|
|
||||||
|
|
||||||
@ -1364,9 +1375,9 @@ int RsServer::StartupRetroShare()
|
|||||||
RS_SERVICE_GXS_TYPE_WIKI,
|
RS_SERVICE_GXS_TYPE_WIKI,
|
||||||
NULL, rsInitConfig->gxs_passwd);
|
NULL, rsInitConfig->gxs_passwd);
|
||||||
|
|
||||||
|
#ifdef RS_USE_WIKI
|
||||||
p3Wiki *mWiki = new p3Wiki(wiki_ds, NULL, mGxsIdService);
|
p3Wiki *mWiki = new p3Wiki(wiki_ds, NULL, mGxsIdService);
|
||||||
|
// create GXS wiki service
|
||||||
// create GXS photo service
|
|
||||||
RsGxsNetService* wiki_ns = new RsGxsNetService(
|
RsGxsNetService* wiki_ns = new RsGxsNetService(
|
||||||
RS_SERVICE_GXS_TYPE_WIKI, wiki_ds, nxsMgr,
|
RS_SERVICE_GXS_TYPE_WIKI, wiki_ds, nxsMgr,
|
||||||
mWiki, mWiki->getServiceInfo(),
|
mWiki, mWiki->getServiceInfo(),
|
||||||
@ -1374,6 +1385,7 @@ int RsServer::StartupRetroShare()
|
|||||||
pgpAuxUtils);
|
pgpAuxUtils);
|
||||||
|
|
||||||
mWiki->setNetworkExchangeService(wiki_ns) ;
|
mWiki->setNetworkExchangeService(wiki_ns) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**** Forum GXS service ****/
|
/**** Forum GXS service ****/
|
||||||
|
|
||||||
@ -1443,7 +1455,9 @@ int RsServer::StartupRetroShare()
|
|||||||
pqih->addService(gxsid_ns, true);
|
pqih->addService(gxsid_ns, true);
|
||||||
pqih->addService(gxscircles_ns, true);
|
pqih->addService(gxscircles_ns, true);
|
||||||
pqih->addService(posted_ns, true);
|
pqih->addService(posted_ns, true);
|
||||||
|
#ifdef RS_USE_WIKI
|
||||||
pqih->addService(wiki_ns, true);
|
pqih->addService(wiki_ns, true);
|
||||||
|
#endif
|
||||||
pqih->addService(gxsforums_ns, true);
|
pqih->addService(gxsforums_ns, true);
|
||||||
pqih->addService(gxschannels_ns, true);
|
pqih->addService(gxschannels_ns, true);
|
||||||
//pqih->addService(photo_ns, true);
|
//pqih->addService(photo_ns, true);
|
||||||
@ -1489,8 +1503,8 @@ int RsServer::StartupRetroShare()
|
|||||||
pqih -> addService(mDisc,true);
|
pqih -> addService(mDisc,true);
|
||||||
pqih -> addService(msgSrv,true);
|
pqih -> addService(msgSrv,true);
|
||||||
pqih -> addService(chatSrv,true);
|
pqih -> addService(chatSrv,true);
|
||||||
pqih -> addService(mStatusSrv,true);
|
pqih -> addService(mStatusSrv,true);
|
||||||
|
pqih -> addService(mReputations,true);
|
||||||
|
|
||||||
// set interfaces for plugins
|
// set interfaces for plugins
|
||||||
//
|
//
|
||||||
@ -1511,6 +1525,8 @@ int RsServer::StartupRetroShare()
|
|||||||
interfaces.mPgpAuxUtils = pgpAuxUtils;
|
interfaces.mPgpAuxUtils = pgpAuxUtils;
|
||||||
interfaces.mGxsForums = mGxsForums;
|
interfaces.mGxsForums = mGxsForums;
|
||||||
interfaces.mGxsChannels = mGxsChannels;
|
interfaces.mGxsChannels = mGxsChannels;
|
||||||
|
interfaces.mReputations = mReputations;
|
||||||
|
|
||||||
mPluginsManager->setInterfaces(interfaces);
|
mPluginsManager->setInterfaces(interfaces);
|
||||||
|
|
||||||
// now add plugin objects inside the loop:
|
// now add plugin objects inside the loop:
|
||||||
@ -1598,12 +1614,13 @@ int RsServer::StartupRetroShare()
|
|||||||
mConfigMgr->addConfiguration("peers.cfg", mPeerMgr);
|
mConfigMgr->addConfiguration("peers.cfg", mPeerMgr);
|
||||||
mConfigMgr->addConfiguration("general.cfg", mGeneralConfig);
|
mConfigMgr->addConfiguration("general.cfg", mGeneralConfig);
|
||||||
mConfigMgr->addConfiguration("msgs.cfg", msgSrv);
|
mConfigMgr->addConfiguration("msgs.cfg", msgSrv);
|
||||||
mConfigMgr->addConfiguration("chat.cfg", chatSrv);
|
mConfigMgr->addConfiguration("chat.cfg", chatSrv);
|
||||||
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
||||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||||
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
|
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
|
||||||
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
||||||
|
mConfigMgr->addConfiguration("reputations.cfg", mReputations);
|
||||||
#ifdef ENABLE_GROUTER
|
#ifdef ENABLE_GROUTER
|
||||||
mConfigMgr->addConfiguration("grouter.cfg", gr);
|
mConfigMgr->addConfiguration("grouter.cfg", gr);
|
||||||
#endif
|
#endif
|
||||||
@ -1619,7 +1636,9 @@ int RsServer::StartupRetroShare()
|
|||||||
mConfigMgr->addConfiguration("gxschannels.cfg", gxschannels_ns);
|
mConfigMgr->addConfiguration("gxschannels.cfg", gxschannels_ns);
|
||||||
mConfigMgr->addConfiguration("gxscircles.cfg", gxscircles_ns);
|
mConfigMgr->addConfiguration("gxscircles.cfg", gxscircles_ns);
|
||||||
mConfigMgr->addConfiguration("posted.cfg", posted_ns);
|
mConfigMgr->addConfiguration("posted.cfg", posted_ns);
|
||||||
|
#ifdef RS_USE_WIKI
|
||||||
mConfigMgr->addConfiguration("wiki.cfg", wiki_ns);
|
mConfigMgr->addConfiguration("wiki.cfg", wiki_ns);
|
||||||
|
#endif
|
||||||
//mConfigMgr->addConfiguration("photo.cfg", photo_ns);
|
//mConfigMgr->addConfiguration("photo.cfg", photo_ns);
|
||||||
//mConfigMgr->addConfiguration("wire.cfg", wire_ns);
|
//mConfigMgr->addConfiguration("wire.cfg", wire_ns);
|
||||||
#endif
|
#endif
|
||||||
@ -1728,7 +1747,9 @@ int RsServer::StartupRetroShare()
|
|||||||
// Must Set the GXS pointers before starting threads.
|
// Must Set the GXS pointers before starting threads.
|
||||||
rsIdentity = mGxsIdService;
|
rsIdentity = mGxsIdService;
|
||||||
rsGxsCircles = mGxsCircles;
|
rsGxsCircles = mGxsCircles;
|
||||||
|
#if RS_USE_WIKI
|
||||||
rsWiki = mWiki;
|
rsWiki = mWiki;
|
||||||
|
#endif
|
||||||
rsPosted = mPosted;
|
rsPosted = mPosted;
|
||||||
rsGxsForums = mGxsForums;
|
rsGxsForums = mGxsForums;
|
||||||
rsGxsChannels = mGxsChannels;
|
rsGxsChannels = mGxsChannels;
|
||||||
@ -1739,7 +1760,9 @@ int RsServer::StartupRetroShare()
|
|||||||
startServiceThread(mGxsIdService);
|
startServiceThread(mGxsIdService);
|
||||||
startServiceThread(mGxsCircles);
|
startServiceThread(mGxsCircles);
|
||||||
startServiceThread(mPosted);
|
startServiceThread(mPosted);
|
||||||
|
#if RS_USE_WIKI
|
||||||
startServiceThread(mWiki);
|
startServiceThread(mWiki);
|
||||||
|
#endif
|
||||||
startServiceThread(mGxsForums);
|
startServiceThread(mGxsForums);
|
||||||
startServiceThread(mGxsChannels);
|
startServiceThread(mGxsChannels);
|
||||||
|
|
||||||
@ -1750,7 +1773,9 @@ int RsServer::StartupRetroShare()
|
|||||||
startServiceThread(gxsid_ns);
|
startServiceThread(gxsid_ns);
|
||||||
startServiceThread(gxscircles_ns);
|
startServiceThread(gxscircles_ns);
|
||||||
startServiceThread(posted_ns);
|
startServiceThread(posted_ns);
|
||||||
|
#if RS_USE_WIKI
|
||||||
startServiceThread(wiki_ns);
|
startServiceThread(wiki_ns);
|
||||||
|
#endif
|
||||||
startServiceThread(gxsforums_ns);
|
startServiceThread(gxsforums_ns);
|
||||||
startServiceThread(gxschannels_ns);
|
startServiceThread(gxschannels_ns);
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "rsloginhandler.h"
|
#include "rsloginhandler.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
#include "rsaccounts.h"
|
#include "rsaccounts.h"
|
||||||
|
|
||||||
#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
#include <gnome-keyring-1/gnome-keyring.h>
|
#include <gnome-keyring-1/gnome-keyring.h>
|
||||||
|
|
||||||
@ -118,6 +117,7 @@ bool RsLoginHandler::tryAutoLogin(const RsPeerId& ssl_id,std::string& ssl_passwd
|
|||||||
std::cerr << "RsTryAutoLogin()" << std::endl;
|
std::cerr << "RsTryAutoLogin()" << std::endl;
|
||||||
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
#ifndef __HAIKU__
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
|
|
||||||
@ -145,8 +145,9 @@ bool RsLoginHandler::tryAutoLogin(const RsPeerId& ssl_id,std::string& ssl_passwd
|
|||||||
|
|
||||||
void *passwordData = NULL;
|
void *passwordData = NULL;
|
||||||
UInt32 passwordLength = 0;
|
UInt32 passwordLength = 0;
|
||||||
const char *userId = ssl_id.c_str();
|
std::string idtemp = ssl_id.toStdString();
|
||||||
UInt32 uidLength = strlen(ssl_id.c_str());
|
const char *userId = idtemp.c_str();
|
||||||
|
UInt32 uidLength = strlen(userId);
|
||||||
SecKeychainItemRef itemRef = NULL;
|
SecKeychainItemRef itemRef = NULL;
|
||||||
|
|
||||||
OSStatus status = SecKeychainFindGenericPassword (
|
OSStatus status = SecKeychainFindGenericPassword (
|
||||||
@ -348,6 +349,7 @@ bool RsLoginHandler::tryAutoLogin(const RsPeerId& ssl_id,std::string& ssl_passwd
|
|||||||
LocalFree(DataOut.pbData);
|
LocalFree(DataOut.pbData);
|
||||||
|
|
||||||
return isDecrypt;
|
return isDecrypt;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
|
||||||
@ -360,6 +362,7 @@ bool RsLoginHandler::enableAutoLogin(const RsPeerId& ssl_id,const std::string& s
|
|||||||
std::cerr << "RsStoreAutoLogin()" << std::endl;
|
std::cerr << "RsStoreAutoLogin()" << std::endl;
|
||||||
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
#ifndef __HAIKU__
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
if(GNOME_KEYRING_RESULT_OK == gnome_keyring_store_password_sync(&my_schema, NULL, (gchar*)("RetroShare password for SSL Id "+ssl_id.toStdString()).c_str(),(gchar*)ssl_passwd.c_str(),"RetroShare SSL Id",ssl_id.toStdString().c_str(),NULL))
|
if(GNOME_KEYRING_RESULT_OK == gnome_keyring_store_password_sync(&my_schema, NULL, (gchar*)("RetroShare password for SSL Id "+ssl_id.toStdString()).c_str(),(gchar*)ssl_passwd.c_str(),"RetroShare SSL Id",ssl_id.toStdString().c_str(),NULL))
|
||||||
@ -381,8 +384,9 @@ bool RsLoginHandler::enableAutoLogin(const RsPeerId& ssl_id,const std::string& s
|
|||||||
|
|
||||||
const void *password = ssl_passwd.c_str();
|
const void *password = ssl_passwd.c_str();
|
||||||
UInt32 passwordLength = strlen(ssl_passwd.c_str());
|
UInt32 passwordLength = strlen(ssl_passwd.c_str());
|
||||||
const char *userid = ssl_id.c_str();
|
std::string idtemp = ssl_id.toStdString();
|
||||||
UInt32 uidLength = strlen(ssl_id.c_str());
|
const char *userid = idtemp.c_str();
|
||||||
|
UInt32 uidLength = strlen(userid);
|
||||||
|
|
||||||
OSStatus status = SecKeychainAddGenericPassword (
|
OSStatus status = SecKeychainAddGenericPassword (
|
||||||
NULL, // default keychain
|
NULL, // default keychain
|
||||||
@ -517,6 +521,7 @@ bool RsLoginHandler::enableAutoLogin(const RsPeerId& ssl_id,const std::string& s
|
|||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsLoginHandler::clearAutoLogin(const RsPeerId& ssl_id)
|
bool RsLoginHandler::clearAutoLogin(const RsPeerId& ssl_id)
|
||||||
@ -540,8 +545,9 @@ bool RsLoginHandler::clearAutoLogin(const RsPeerId& ssl_id)
|
|||||||
|
|
||||||
void *passwordData = NULL;
|
void *passwordData = NULL;
|
||||||
UInt32 passwordLength = 0;
|
UInt32 passwordLength = 0;
|
||||||
const char *userId = ssl_id.c_str();
|
std::string idtemp = ssl_id.toStdString();
|
||||||
UInt32 uidLength = strlen(ssl_id.c_str());
|
const char *userId = idtemp.c_str();
|
||||||
|
UInt32 uidLength = strlen(userId);
|
||||||
SecKeychainItemRef itemRef = NULL;
|
SecKeychainItemRef itemRef = NULL;
|
||||||
|
|
||||||
OSStatus status = SecKeychainFindGenericPassword (
|
OSStatus status = SecKeychainFindGenericPassword (
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
this->mPublishTs = rGxsMeta.mPublishTs;
|
this->mPublishTs = rGxsMeta.mPublishTs;
|
||||||
this->mThreadId = rGxsMeta.mThreadId;
|
this->mThreadId = rGxsMeta.mThreadId;
|
||||||
this->mServiceString = rGxsMeta.mServiceString;
|
this->mServiceString = rGxsMeta.mServiceString;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
#include "serialiser/rsbaseserial.h"
|
#include "serialiser/rsbaseserial.h"
|
||||||
#include "serialiser/rsbanlistitems.h"
|
#include "serialiser/rsgxsreputationitems.h"
|
||||||
#include "serialiser/rstlvbanlist.h"
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
#define RSSERIAL_DEBUG 1
|
#define RSSERIAL_DEBUG 1
|
||||||
@ -33,172 +34,444 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// re-defined here, in order to avoid cross-includes
|
||||||
|
#define REPUTATION_IDENTITY_FLAG_NEEDS_UPDATE 0x0100
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifdef SUSPENDED
|
bool RsReputationItem::serialise_header(void *data,uint32_t& pktsize,uint32_t& tlvsize, uint32_t& offset) const
|
||||||
RsBanListItem::~RsBanListItem()
|
|
||||||
{
|
{
|
||||||
return;
|
tlvsize = serial_size() ;
|
||||||
|
offset = 0;
|
||||||
|
|
||||||
|
if (pktsize < tlvsize)
|
||||||
|
return false; /* not enough space */
|
||||||
|
|
||||||
|
pktsize = tlvsize;
|
||||||
|
|
||||||
|
if(!setRsItemHeader(data, tlvsize, PacketId(), tlvsize))
|
||||||
|
{
|
||||||
|
std::cerr << "RsReputationItem::serialise_header(): ERROR. Not enough size!" << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
#ifdef RSSERIAL_DEBUG
|
||||||
|
std::cerr << "RsReputationItem::serialise() Header: " << ok << std::endl;
|
||||||
|
#endif
|
||||||
|
offset += 8;
|
||||||
|
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsBanListItem::clear()
|
/*************************************************************************/
|
||||||
|
|
||||||
|
void RsGxsReputationSetItem::clear()
|
||||||
{
|
{
|
||||||
peerList.TlvClear();
|
mOpinions.clear() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &RsBanListItem::print(std::ostream &out, uint16_t indent)
|
void RsGxsReputationUpdateItem::clear()
|
||||||
{
|
{
|
||||||
printRsItemBase(out, "RsBanListItem", indent);
|
mOpinions.clear() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
std::ostream& RsGxsReputationConfigItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
{
|
||||||
|
printRsItemBase(out, "RsReputationConfigItem", indent);
|
||||||
uint16_t int_Indent = indent + 2;
|
uint16_t int_Indent = indent + 2;
|
||||||
peerList.print(out, int_Indent);
|
|
||||||
|
|
||||||
printRsItemEnd(out, "RsBanListItem", indent);
|
out << "mPeerId: " << mPeerId << std::endl;
|
||||||
|
out << "last update: " << time(NULL) - mLatestUpdate << " secs ago." << std::endl;
|
||||||
|
out << "last query : " << time(NULL) - mLastQuery << " secs ago." << std::endl;
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsReputationConfigItem", indent);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& RsGxsReputationSetItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
{
|
||||||
|
printRsItemBase(out, "RsReputationSetItem", indent);
|
||||||
|
uint16_t int_Indent = indent + 2;
|
||||||
|
|
||||||
uint32_t RsBanListSerialiser::sizeList(RsBanListItem *item)
|
out << "GxsId: " << mGxsId << std::endl;
|
||||||
|
out << "mOwnOpinion: " << mOwnOpinion << std::endl;
|
||||||
|
out << "mOwnOpinionTS : " << time(NULL) - mOwnOpinionTS << " secs ago." << std::endl;
|
||||||
|
out << "Opinions from neighbors: " << std::endl;
|
||||||
|
|
||||||
|
for(std::map<RsPeerId,uint32_t>::const_iterator it(mOpinions.begin());it!=mOpinions.end();++it)
|
||||||
|
out << " " << it->first << ": " << it->second << std::endl;
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsReputationSetItem", indent);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
std::ostream& RsGxsReputationUpdateItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
{
|
||||||
|
printRsItemBase(out, "RsReputationUpdateItem", indent);
|
||||||
|
uint16_t int_Indent = indent + 2;
|
||||||
|
|
||||||
|
out << "from: " << PeerId() << std::endl;
|
||||||
|
out << "last update: " << time(NULL) - mLatestUpdate << " secs ago." << std::endl;
|
||||||
|
|
||||||
|
for(std::map<RsGxsId,uint32_t>::const_iterator it(mOpinions.begin());it!=mOpinions.end();++it)
|
||||||
|
out << " " << it->first << ": " << it->second << std::endl;
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsReputationUpdateItem", indent);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
std::ostream& RsGxsReputationRequestItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
{
|
||||||
|
printRsItemBase(out, "RsReputationRequestItem", indent);
|
||||||
|
uint16_t int_Indent = indent + 2;
|
||||||
|
|
||||||
|
out << "last update: " << time(NULL) - mLastUpdate << " secs ago." << std::endl;
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsReputationRequestItem", indent);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
uint32_t RsGxsReputationConfigItem::serial_size() const
|
||||||
|
{
|
||||||
|
uint32_t s = 8; /* header */
|
||||||
|
|
||||||
|
s += mPeerId.serial_size() ; // PeerId
|
||||||
|
s += 4 ; // mLatestUpdate
|
||||||
|
s += 4 ; // mLastQuery
|
||||||
|
|
||||||
|
return s ;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t RsGxsReputationSetItem::serial_size() const
|
||||||
{
|
{
|
||||||
uint32_t s = 8; /* header */
|
uint32_t s = 8; /* header */
|
||||||
s += item->peerList.TlvSize();
|
|
||||||
|
s += mGxsId.serial_size() ;
|
||||||
|
s += 4 ; // mOwnOpinion
|
||||||
|
s += 4 ; // mOwnOpinionTS
|
||||||
|
s += 4 ; // mIdentityFlags
|
||||||
|
|
||||||
|
s += 4 ; // mOpinions.size()
|
||||||
|
|
||||||
|
s += (4+RsPeerId::serial_size()) * mOpinions.size() ;
|
||||||
|
|
||||||
|
return s ;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t RsGxsReputationUpdateItem::serial_size() const
|
||||||
|
{
|
||||||
|
uint32_t s = 8; /* header */
|
||||||
|
|
||||||
|
s += 4 ; // mLatestUpdate
|
||||||
|
s += 4 ; // mOpinions.size();
|
||||||
|
|
||||||
|
s += (RsGxsId::serial_size() + 4) * mOpinions.size() ;
|
||||||
|
|
||||||
|
return s ;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t RsGxsReputationRequestItem::serial_size() const
|
||||||
|
{
|
||||||
|
uint32_t s = 8; /* header */
|
||||||
|
|
||||||
|
s += 4 ; // mLastUpdate
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* serialise the data to the buffer */
|
/*************************************************************************/
|
||||||
bool RsBanListSerialiser::serialiseList(RsBanListItem *item, void *data, uint32_t *pktsize)
|
|
||||||
|
bool RsGxsReputationConfigItem::serialise(void *data, uint32_t& pktsize) const
|
||||||
{
|
{
|
||||||
uint32_t tlvsize = sizeList(item);
|
uint32_t tlvsize ;
|
||||||
uint32_t offset = 0;
|
uint32_t offset=0;
|
||||||
|
|
||||||
if (*pktsize < tlvsize)
|
if(!serialise_header(data,pktsize,tlvsize,offset))
|
||||||
return false; /* not enough space */
|
return false ;
|
||||||
|
|
||||||
*pktsize = tlvsize;
|
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
ok &= mPeerId.serialise(data,tlvsize,offset) ;
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mLatestUpdate);
|
||||||
#ifdef RSSERIAL_DEBUG
|
ok &= setRawUInt32(data, tlvsize, &offset, mLastQuery);
|
||||||
std::cerr << "RsDsdvSerialiser::serialiseRoute() Header: " << ok << std::endl;
|
|
||||||
std::cerr << "RsDsdvSerialiser::serialiseRoute() Size: " << tlvsize << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* skip the header */
|
|
||||||
offset += 8;
|
|
||||||
|
|
||||||
/* add mandatory parts first */
|
|
||||||
ok &= item->peerList.SetTlv(data, tlvsize, &offset);
|
|
||||||
|
|
||||||
if (offset != tlvsize)
|
if (offset != tlvsize)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
#ifdef RSSERIAL_DEBUG
|
std::cerr << "RsGxsReputationConfigItem::serialisedata() size error! " << std::endl;
|
||||||
std::cerr << "RsDsdvSerialiser::serialiseRoute() Size Error! " << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsBanListItem *RsBanListSerialiser::deserialiseList(void *data, uint32_t *pktsize)
|
bool RsGxsReputationSetItem::serialise(void *data, uint32_t& pktsize) const
|
||||||
{
|
{
|
||||||
/* get the type and size */
|
uint32_t tlvsize ;
|
||||||
uint32_t rstype = getRsItemId(data);
|
uint32_t offset=0;
|
||||||
uint32_t tlvsize = getRsItemSize(data);
|
|
||||||
|
|
||||||
uint32_t offset = 0;
|
if(!serialise_header(data,pktsize,tlvsize,offset))
|
||||||
|
return false ;
|
||||||
|
|
||||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
||||||
(RS_SERVICE_TYPE_BANLIST != getRsItemService(rstype)) ||
|
|
||||||
(RS_PKT_SUBTYPE_BANLIST_ITEM != getRsItemSubType(rstype)))
|
|
||||||
{
|
|
||||||
return NULL; /* wrong type */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*pktsize < tlvsize) /* check size */
|
|
||||||
return NULL; /* not enough data */
|
|
||||||
|
|
||||||
/* set the packet length */
|
|
||||||
*pktsize = tlvsize;
|
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
/* ready to load */
|
ok &= mGxsId.serialise(data,tlvsize,offset) ;
|
||||||
RsBanListItem *item = new RsBanListItem();
|
ok &= setRawUInt32(data, tlvsize, &offset, mOwnOpinion);
|
||||||
item->clear();
|
ok &= setRawUInt32(data, tlvsize, &offset, mOwnOpinionTS);
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mIdentityFlags) ;
|
||||||
/* skip the header */
|
ok &= setRawUInt32(data, tlvsize, &offset, mOpinions.size());
|
||||||
offset += 8;
|
|
||||||
|
for(std::map<RsPeerId,uint32_t>::const_iterator it(mOpinions.begin());it!=mOpinions.end();++it)
|
||||||
/* add mandatory parts first */
|
{
|
||||||
ok &= item->peerList.GetTlv(data, tlvsize, &offset);
|
ok &= it->first.serialise(data,tlvsize,offset) ;
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, it->second) ;
|
||||||
|
}
|
||||||
|
|
||||||
if (offset != tlvsize)
|
if (offset != tlvsize)
|
||||||
{
|
{
|
||||||
/* error */
|
ok = false;
|
||||||
delete item;
|
std::cerr << "RsGxsReputationSetItem::serialisedata() size error! " << std::endl;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
return ok;
|
||||||
{
|
|
||||||
delete item;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
}
|
||||||
|
bool RsGxsReputationUpdateItem::serialise(void *data, uint32_t& pktsize) const
|
||||||
|
{
|
||||||
|
uint32_t tlvsize ;
|
||||||
|
uint32_t offset=0;
|
||||||
|
|
||||||
|
if(!serialise_header(data,pktsize,tlvsize,offset))
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mLatestUpdate);
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mOpinions.size());
|
||||||
|
|
||||||
|
for(std::map<RsGxsId,uint32_t>::const_iterator it(mOpinions.begin());ok && it!=mOpinions.end();++it)
|
||||||
|
{
|
||||||
|
ok &= it->first.serialise(data, tlvsize, offset) ;
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, it->second) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset != tlvsize)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
std::cerr << "RsGxsReputationUpdateItem::serialisedata() size error! " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
/* serialise the data to the buffer */
|
||||||
|
bool RsGxsReputationRequestItem::serialise(void *data, uint32_t& pktsize) const
|
||||||
|
{
|
||||||
|
uint32_t tlvsize ;
|
||||||
|
uint32_t offset=0;
|
||||||
|
|
||||||
|
if(!serialise_header(data,pktsize,tlvsize,offset))
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
ok &= setRawUInt32(data, tlvsize, &offset, mLastUpdate);
|
||||||
|
|
||||||
|
if (offset != tlvsize)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
std::cerr << "RsGxsReputationRequestItem::serialisedata() size error! " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
uint32_t RsBanListSerialiser::size(RsItem *i)
|
RsGxsReputationConfigItem *RsGxsReputationSerialiser::deserialiseReputationConfigItem(void *data,uint32_t size)
|
||||||
{
|
{
|
||||||
RsBanListItem *dri;
|
uint32_t offset = 8; // skip the header
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
bool ok = true ;
|
||||||
|
|
||||||
if (NULL != (dri = dynamic_cast<RsBanListItem *>(i)))
|
RsGxsReputationConfigItem *item = new RsGxsReputationConfigItem() ;
|
||||||
{
|
|
||||||
return sizeList(dri);
|
/* add mandatory parts first */
|
||||||
}
|
ok &= item->mPeerId.deserialise(data, size, offset) ;
|
||||||
return 0;
|
ok &= getRawUInt32(data, size, &offset, &item->mLatestUpdate);
|
||||||
|
ok &= getRawUInt32(data, size, &offset, &item->mLastQuery);
|
||||||
|
|
||||||
|
if (offset != rssize || !ok)
|
||||||
|
{
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << ": error while deserialising! Item will be dropped." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsBanListSerialiser::serialise(RsItem *i, void *data, uint32_t *pktsize)
|
RsGxsReputationSetItem *RsGxsReputationSerialiser::deserialiseReputationSetItem_deprecated(void *data,uint32_t tlvsize)
|
||||||
{
|
{
|
||||||
RsBanListItem *dri;
|
uint32_t offset = 8; // skip the header
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
bool ok = true ;
|
||||||
|
|
||||||
if (NULL != (dri = dynamic_cast<RsBanListItem *>(i)))
|
RsGxsReputationSetItem *item = new RsGxsReputationSetItem() ;
|
||||||
{
|
|
||||||
return serialiseList(dri, data, pktsize);
|
/* add mandatory parts first */
|
||||||
}
|
ok &= item->mGxsId.deserialise(data, tlvsize, offset) ;
|
||||||
return false;
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mOwnOpinion);
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mOwnOpinionTS);
|
||||||
|
|
||||||
|
item->mIdentityFlags = REPUTATION_IDENTITY_FLAG_NEEDS_UPDATE; // special value that means please update me.
|
||||||
|
|
||||||
|
uint32_t S ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &S);
|
||||||
|
|
||||||
|
for(int i=0;ok && i<S;++i)
|
||||||
|
{
|
||||||
|
RsPeerId pid ;
|
||||||
|
uint32_t op ;
|
||||||
|
|
||||||
|
ok &= pid.deserialise(data, tlvsize, offset) ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &op);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
item->mOpinions[pid] = op ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset != rssize || !ok)
|
||||||
|
{
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << ": error while deserialising! Item will be dropped." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
RsGxsReputationSetItem *RsGxsReputationSerialiser::deserialiseReputationSetItem(void *data,uint32_t tlvsize)
|
||||||
|
{
|
||||||
|
uint32_t offset = 8; // skip the header
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
bool ok = true ;
|
||||||
|
|
||||||
|
RsGxsReputationSetItem *item = new RsGxsReputationSetItem() ;
|
||||||
|
|
||||||
|
/* add mandatory parts first */
|
||||||
|
ok &= item->mGxsId.deserialise(data, tlvsize, offset) ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mOwnOpinion);
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mOwnOpinionTS);
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mIdentityFlags);
|
||||||
|
|
||||||
|
uint32_t S ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &S);
|
||||||
|
|
||||||
|
for(int i=0;ok && i<S;++i)
|
||||||
|
{
|
||||||
|
RsPeerId pid ;
|
||||||
|
uint32_t op ;
|
||||||
|
|
||||||
|
ok &= pid.deserialise(data, tlvsize, offset) ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &op);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
item->mOpinions[pid] = op ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset != rssize || !ok)
|
||||||
|
{
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << ": error while deserialising! Item will be dropped." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsItem *RsBanListSerialiser::deserialise(void *data, uint32_t *pktsize)
|
RsGxsReputationUpdateItem *RsGxsReputationSerialiser::deserialiseReputationUpdateItem(void *data,uint32_t tlvsize)
|
||||||
|
{
|
||||||
|
uint32_t offset = 8; // skip the header
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
bool ok = true ;
|
||||||
|
|
||||||
|
RsGxsReputationUpdateItem *item = new RsGxsReputationUpdateItem() ;
|
||||||
|
|
||||||
|
/* add mandatory parts first */
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mLatestUpdate);
|
||||||
|
|
||||||
|
uint32_t S ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &S) ;
|
||||||
|
|
||||||
|
for(uint32_t i=0;ok && i<S;++i)
|
||||||
|
{
|
||||||
|
RsGxsId gid ;
|
||||||
|
uint32_t op ;
|
||||||
|
|
||||||
|
ok &= gid.deserialise(data, tlvsize, offset) ;
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &op);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
item->mOpinions[gid] = op ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset != rssize || !ok)
|
||||||
|
{
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << ": error while deserialising! Item will be dropped." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsGxsReputationRequestItem *RsGxsReputationSerialiser::deserialiseReputationRequestItem(void *data,uint32_t tlvsize)
|
||||||
|
{
|
||||||
|
uint32_t offset = 8; // skip the header
|
||||||
|
uint32_t rssize = getRsItemSize(data);
|
||||||
|
bool ok = true ;
|
||||||
|
|
||||||
|
RsGxsReputationRequestItem *item = new RsGxsReputationRequestItem() ;
|
||||||
|
|
||||||
|
/* add mandatory parts first */
|
||||||
|
ok &= getRawUInt32(data, tlvsize, &offset, &item->mLastUpdate);
|
||||||
|
|
||||||
|
if (offset != rssize || !ok)
|
||||||
|
{
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << ": error while deserialising! Item will be dropped." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
RsItem *RsGxsReputationSerialiser::deserialise(void *data, uint32_t *pktsize)
|
||||||
{
|
{
|
||||||
/* get the type and size */
|
/* get the type and size */
|
||||||
uint32_t rstype = getRsItemId(data);
|
uint32_t rstype = getRsItemId(data);
|
||||||
|
|
||||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || (RS_SERVICE_GXS_TYPE_REPUTATION != getRsItemService(rstype)))
|
||||||
(RS_SERVICE_TYPE_BANLIST != getRsItemService(rstype)))
|
{
|
||||||
{
|
std::cerr << "RsReputationSerialiser::deserialise(): wrong item type " << std::hex << rstype << std::dec << std::endl;
|
||||||
return NULL; /* wrong type */
|
return NULL; /* wrong type */
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(getRsItemSubType(rstype))
|
switch(getRsItemSubType(rstype))
|
||||||
{
|
{
|
||||||
case RS_PKT_SUBTYPE_BANLIST_ITEM:
|
case RS_PKT_SUBTYPE_GXS_REPUTATION_SET_ITEM : return deserialiseReputationSetItem (data, *pktsize);
|
||||||
return deserialiseList(data, pktsize);
|
case RS_PKT_SUBTYPE_GXS_REPUTATION_SET_ITEM_deprecated: return deserialiseReputationSetItem_deprecated(data, *pktsize);
|
||||||
break;
|
case RS_PKT_SUBTYPE_GXS_REPUTATION_UPDATE_ITEM : return deserialiseReputationUpdateItem (data, *pktsize);
|
||||||
|
case RS_PKT_SUBTYPE_GXS_REPUTATION_REQUEST_ITEM : return deserialiseReputationRequestItem (data, *pktsize);
|
||||||
|
case RS_PKT_SUBTYPE_GXS_REPUTATION_CONFIG_ITEM : return deserialiseReputationConfigItem (data, *pktsize);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
std::cerr << "RsGxsReputationSerialiser::deserialise(): unknown item subtype " << std::hex<< rstype << std::dec << std::endl;
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,88 +32,96 @@
|
|||||||
#include "serialiser/rsserial.h"
|
#include "serialiser/rsserial.h"
|
||||||
#include "retroshare/rsgxsifacetypes.h"
|
#include "retroshare/rsgxsifacetypes.h"
|
||||||
|
|
||||||
#define RS_PKT_SUBTYPE_GXSREPUTATION_CONFIG_ITEM 0x01
|
#define RS_PKT_SUBTYPE_GXS_REPUTATION_CONFIG_ITEM 0x01
|
||||||
#define RS_PKT_SUBTYPE_GXSREPUTATION_SET_ITEM 0x02
|
#define RS_PKT_SUBTYPE_GXS_REPUTATION_SET_ITEM_deprecated 0x02
|
||||||
#define RS_PKT_SUBTYPE_GXSREPUTATION_UPDATE_ITEM 0x03
|
#define RS_PKT_SUBTYPE_GXS_REPUTATION_UPDATE_ITEM 0x03
|
||||||
#define RS_PKT_SUBTYPE_GXSREPUTATION_REQUEST_ITEM 0x04
|
#define RS_PKT_SUBTYPE_GXS_REPUTATION_REQUEST_ITEM 0x04
|
||||||
|
#define RS_PKT_SUBTYPE_GXS_REPUTATION_SET_ITEM 0x05
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
class RsReputationItem: public RsItem
|
||||||
class RsGxsReputationConfigItem: public RsItem
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsReputationConfigItem()
|
RsReputationItem(uint8_t reputation_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_GXS_TYPE_REPUTATION,reputation_subtype)
|
||||||
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXS_TYPE_REPUTATION,
|
{
|
||||||
RS_PKT_SUBTYPE_GXSREPUTATION_CONFIG_ITEM)
|
setPriorityLevel(QOS_PRIORITY_RS_GXSREPUTATION_ITEM);
|
||||||
{
|
}
|
||||||
setPriorityLevel(QOS_PRIORITY_RS_GXSREPUTATION_ITEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~RsGxsReputationConfigItem();
|
virtual ~RsReputationItem() {}
|
||||||
virtual void clear();
|
|
||||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
|
||||||
|
|
||||||
std::string mPeerId;
|
virtual bool serialise(void *data,uint32_t& size) const = 0 ;
|
||||||
|
virtual uint32_t serial_size() const = 0 ;
|
||||||
|
|
||||||
|
virtual void clear() = 0 ;
|
||||||
|
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool serialise_header(void *data, uint32_t& pktsize, uint32_t& tlvsize, uint32_t& offset) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RsGxsReputationConfigItem: public RsReputationItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsGxsReputationConfigItem() :RsReputationItem(RS_PKT_SUBTYPE_GXS_REPUTATION_CONFIG_ITEM) {}
|
||||||
|
|
||||||
|
virtual ~RsGxsReputationConfigItem() {}
|
||||||
|
virtual void clear() {}
|
||||||
|
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
|
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||||
|
virtual uint32_t serial_size() const ;
|
||||||
|
|
||||||
|
RsPeerId mPeerId;
|
||||||
uint32_t mLatestUpdate; // timestamp they returned.
|
uint32_t mLatestUpdate; // timestamp they returned.
|
||||||
uint32_t mLastQuery; // when we sent out.
|
uint32_t mLastQuery; // when we sent out.
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsGxsReputationSetItem: public RsItem
|
class RsGxsReputationSetItem: public RsReputationItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsReputationSetItem()
|
RsGxsReputationSetItem() :RsReputationItem(RS_PKT_SUBTYPE_GXS_REPUTATION_SET_ITEM) {}
|
||||||
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXS_TYPE_REPUTATION,
|
|
||||||
RS_PKT_SUBTYPE_GXSREPUTATION_SET_ITEM)
|
|
||||||
{
|
|
||||||
setPriorityLevel(QOS_PRIORITY_RS_GXSREPUTATION_ITEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~RsGxsReputationSetItem();
|
virtual ~RsGxsReputationSetItem() {}
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
std::string mGxsId;
|
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||||
|
virtual uint32_t serial_size() const ;
|
||||||
|
|
||||||
|
RsGxsId mGxsId;
|
||||||
uint32_t mOwnOpinion;
|
uint32_t mOwnOpinion;
|
||||||
uint32_t mOwnOpinionTs;
|
uint32_t mOwnOpinionTS;
|
||||||
uint32_t mReputation;
|
uint32_t mIdentityFlags ;
|
||||||
std::map<std::string, uint32_t> mOpinions; // RsPeerId -> Opinion.
|
std::map<RsPeerId, uint32_t> mOpinions; // RsPeerId -> Opinion.
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsGxsReputationUpdateItem: public RsItem
|
class RsGxsReputationUpdateItem: public RsReputationItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsReputationUpdateItem()
|
RsGxsReputationUpdateItem() :RsReputationItem(RS_PKT_SUBTYPE_GXS_REPUTATION_UPDATE_ITEM) {}
|
||||||
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXS_TYPE_REPUTATION,
|
|
||||||
RS_PKT_SUBTYPE_GXSREPUTATION_UPDATE_ITEM)
|
|
||||||
{
|
|
||||||
setPriorityLevel(QOS_PRIORITY_RS_GXSREPUTATION_ITEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~RsGxsReputationUpdateItem();
|
virtual ~RsGxsReputationUpdateItem() {}
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
std::map<RsGxsId, uint32_t> mOpinions; // GxsId -> Opinion.
|
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||||
uint32_t mLatestUpdate;
|
virtual uint32_t serial_size() const ;
|
||||||
|
|
||||||
|
uint32_t mLatestUpdate;
|
||||||
|
std::map<RsGxsId, uint32_t> mOpinions; // GxsId -> Opinion.
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsGxsReputationRequestItem: public RsItem
|
class RsGxsReputationRequestItem: public RsReputationItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsReputationRequestItem()
|
RsGxsReputationRequestItem() :RsReputationItem(RS_PKT_SUBTYPE_GXS_REPUTATION_REQUEST_ITEM) {}
|
||||||
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXS_TYPE_REPUTATION,
|
|
||||||
RS_PKT_SUBTYPE_GXSREPUTATION_REQUEST_ITEM)
|
|
||||||
{
|
|
||||||
setPriorityLevel(QOS_PRIORITY_RS_GXSREPUTATION_ITEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~RsGxsReputationRequestItem();
|
virtual ~RsGxsReputationRequestItem() {}
|
||||||
virtual void clear();
|
virtual void clear() {}
|
||||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
|
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||||
|
virtual uint32_t serial_size() const ;
|
||||||
|
|
||||||
uint32_t mLastUpdate;
|
uint32_t mLastUpdate;
|
||||||
};
|
};
|
||||||
@ -121,39 +129,27 @@ std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
|||||||
|
|
||||||
class RsGxsReputationSerialiser: public RsSerialType
|
class RsGxsReputationSerialiser: public RsSerialType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsReputationSerialiser()
|
RsGxsReputationSerialiser() :RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXS_TYPE_REPUTATION){}
|
||||||
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXS_TYPE_REPUTATION)
|
|
||||||
{ return; }
|
|
||||||
virtual ~RsGxsReputationSerialiser()
|
|
||||||
{ return; }
|
|
||||||
|
|
||||||
virtual uint32_t size(RsItem *);
|
|
||||||
virtual bool serialise (RsItem *item, void *data, uint32_t *size);
|
|
||||||
virtual RsItem * deserialise(void *data, uint32_t *size);
|
|
||||||
|
|
||||||
private:
|
virtual ~RsGxsReputationSerialiser(){}
|
||||||
|
|
||||||
virtual uint32_t sizeConfig(RsGxsReputationConfigItem *);
|
|
||||||
virtual bool serialiseConfig(RsGxsReputationConfigItem *item, void *data, uint32_t *size);
|
|
||||||
virtual RsGxsReputationConfigItem *deserialiseConfig(void *data, uint32_t *size);
|
|
||||||
|
|
||||||
|
|
||||||
virtual uint32_t sizeSet(RsGxsReputationSetItem *);
|
|
||||||
virtual bool serialiseSet(RsGxsReputationSetItem *item, void *data, uint32_t *size);
|
|
||||||
virtual RsGxsReputationSetItem *deserialiseSet(void *data, uint32_t *size);
|
|
||||||
|
|
||||||
|
|
||||||
virtual uint32_t sizeUpdate(RsGxsReputationUpdateItem *);
|
|
||||||
virtual bool serialiseUpdate(RsGxsReputationUpdateItem *item, void *data, uint32_t *size);
|
|
||||||
virtual RsGxsReputationUpdateItem *deserialiseUpdate(void *data, uint32_t *size);
|
|
||||||
|
|
||||||
|
|
||||||
virtual uint32_t sizeRequest(RsGxsReputationRequestItem *);
|
|
||||||
virtual bool serialiseRequest(RsGxsReputationRequestItem *item, void *data, uint32_t *size);
|
|
||||||
virtual RsGxsReputationRequestItem *deserialiseRequest(void *data, uint32_t *size);
|
|
||||||
|
|
||||||
|
virtual uint32_t size(RsItem *item)
|
||||||
|
{
|
||||||
|
return dynamic_cast<RsReputationItem*>(item)->serial_size() ;
|
||||||
|
}
|
||||||
|
virtual bool serialise (RsItem *item, void *data, uint32_t *size)
|
||||||
|
{
|
||||||
|
return dynamic_cast<RsReputationItem*>(item)->serialise(data,*size) ;
|
||||||
|
}
|
||||||
|
virtual RsItem * deserialise(void *data, uint32_t *size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static RsGxsReputationConfigItem *deserialiseReputationConfigItem (void *data, uint32_t size);
|
||||||
|
static RsGxsReputationSetItem *deserialiseReputationSetItem (void *data, uint32_t size);
|
||||||
|
static RsGxsReputationSetItem *deserialiseReputationSetItem_deprecated (void *data, uint32_t size);
|
||||||
|
static RsGxsReputationUpdateItem *deserialiseReputationUpdateItem (void *data, uint32_t size);
|
||||||
|
static RsGxsReputationRequestItem *deserialiseReputationRequestItem (void *data, uint32_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
@ -427,7 +427,7 @@ RsItem * RsSerialiser::deserialise(void *data, uint32_t *size)
|
|||||||
std::cerr << "RsSerialiser::deserialise() pkt_size: " << pkt_size << " vs *size: " << *size;
|
std::cerr << "RsSerialiser::deserialise() pkt_size: " << pkt_size << " vs *size: " << *size;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsItem *item2 = (it->second)->deserialise(data, &pkt_size);
|
//RsItem *item2 = (it->second)->deserialise(data, &pkt_size);
|
||||||
|
|
||||||
uint32_t failedtype = getRsItemId(data);
|
uint32_t failedtype = getRsItemId(data);
|
||||||
std::cerr << "RsSerialiser::deserialise() FAILED PACKET Size: ";
|
std::cerr << "RsSerialiser::deserialise() FAILED PACKET Size: ";
|
||||||
|
@ -523,9 +523,9 @@ static bool readHex(char s1,char s2,uint8_t& v)
|
|||||||
|
|
||||||
static bool find_decoded_string(const std::string& in,const std::string& suspicious_string)
|
static bool find_decoded_string(const std::string& in,const std::string& suspicious_string)
|
||||||
{
|
{
|
||||||
int ss_pointer = 0 ;
|
uint32_t ss_pointer = 0 ;
|
||||||
|
|
||||||
for(int i=0;i<in.length();++i)
|
for(uint32_t i=0;i<in.length();++i)
|
||||||
{
|
{
|
||||||
uint8_t hexv ;
|
uint8_t hexv ;
|
||||||
char next_char ;
|
char next_char ;
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
RS_TOP_DIR = ..
|
|
||||||
##### Define any flags that are needed for this section #######
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/config.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
||||||
RSOBJ = p3service.o p3chatservice.o p3msgservice.o \
|
|
||||||
p3gamelauncher.o p3ranking.o p3disc.o \
|
|
||||||
p3photoservice.o \
|
|
||||||
p3distrib.o \
|
|
||||||
p3status.o \
|
|
||||||
p3Qblog.o \
|
|
||||||
p3forums.o \
|
|
||||||
p3channels.o \
|
|
||||||
p3portservice.o
|
|
||||||
|
|
||||||
# dummy forums interface.
|
|
||||||
# p3forums-dummy.o \
|
|
||||||
|
|
||||||
TESTOBJ = forum_test.o
|
|
||||||
|
|
||||||
TESTS = forum_test
|
|
||||||
|
|
||||||
all: librs tests
|
|
||||||
|
|
||||||
forum_test : forum_test.o
|
|
||||||
$(CC) $(CFLAGS) -o forum_test forum_test.o $(OBJ) $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################
|
|
||||||
include $(RS_TOP_DIR)/scripts/rules.mk
|
|
||||||
###############################################################
|
|
||||||
|
|
@ -439,8 +439,6 @@ void p3BanList::getBannedIps(std::list<BanListPeer> &lst)
|
|||||||
lst.clear() ;
|
lst.clear() ;
|
||||||
for(std::map<sockaddr_storage,BanListPeer>::const_iterator it(mBanSet.begin());it!=mBanSet.end();++it)
|
for(std::map<sockaddr_storage,BanListPeer>::const_iterator it(mBanSet.begin());it!=mBanSet.end();++it)
|
||||||
{
|
{
|
||||||
bool already_banned = false ;
|
|
||||||
|
|
||||||
if(!acceptedBanSet_locked(it->second))
|
if(!acceptedBanSet_locked(it->second))
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
@ -498,7 +496,7 @@ bool p3BanList::addIpRange(const sockaddr_storage &addr, int masked_bytes,uint32
|
|||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mBanMtx) ;
|
RS_STACK_MUTEX(mBanMtx) ;
|
||||||
|
|
||||||
if(getBitRange(addr) > masked_bytes)
|
if(getBitRange(addr) > uint32_t(masked_bytes))
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) Input to p3BanList::addIpRange is inconsistent: ip=" << sockaddr_storage_iptostring(addr) << "/" << 32-8*masked_bytes << std::endl;
|
std::cerr << "(EE) Input to p3BanList::addIpRange is inconsistent: ip=" << sockaddr_storage_iptostring(addr) << "/" << 32-8*masked_bytes << std::endl;
|
||||||
return false ;
|
return false ;
|
||||||
@ -955,7 +953,7 @@ bool p3BanList::addBanEntry(const RsPeerId &peerId, const struct sockaddr_storag
|
|||||||
{
|
{
|
||||||
/* see if it needs an update */
|
/* see if it needs an update */
|
||||||
if ((mit->second.reason != reason) ||
|
if ((mit->second.reason != reason) ||
|
||||||
(mit->second.level != level) ||
|
(mit->second.level != uint32_t(level)) ||
|
||||||
(mit->second.mTs < time_stamp))
|
(mit->second.mTs < time_stamp))
|
||||||
{
|
{
|
||||||
/* update */
|
/* update */
|
||||||
@ -1044,7 +1042,7 @@ int p3BanList::condenseBanSources_locked()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lvl = lit->second.level;
|
uint32_t lvl = lit->second.level;
|
||||||
if (it->first != ownId)
|
if (it->first != ownId)
|
||||||
{
|
{
|
||||||
/* as from someone else, increment level */
|
/* as from someone else, increment level */
|
||||||
|
@ -337,7 +337,6 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelP
|
|||||||
|
|
||||||
for(; mit != msgData.end(); ++mit)
|
for(; mit != msgData.end(); ++mit)
|
||||||
{
|
{
|
||||||
RsGxsGroupId grpId = mit->first;
|
|
||||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||||
|
|
||||||
|
@ -199,8 +199,7 @@ bool p3GxsForums::getGroupData(const uint32_t &token, std::vector<RsGxsForumGrou
|
|||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
RsGxsForumGroup grp = item->mGroup;
|
RsGxsForumGroup grp = item->mGroup;
|
||||||
item->mGroup.mMeta = item->meta;
|
grp.mMeta = item->meta;
|
||||||
grp.mMeta = item->mGroup.mMeta;
|
|
||||||
delete item;
|
delete item;
|
||||||
groups.push_back(grp);
|
groups.push_back(grp);
|
||||||
}
|
}
|
||||||
@ -230,7 +229,6 @@ bool p3GxsForums::getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &
|
|||||||
|
|
||||||
for(; mit != msgData.end(); ++mit)
|
for(; mit != msgData.end(); ++mit)
|
||||||
{
|
{
|
||||||
RsGxsGroupId grpId = mit->first;
|
|
||||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user