├── .gitignore ├── AUTHORS ├── BuildWindowsInstaller.bat ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Meshwork.nsi ├── Meshwork.sln ├── NEWS ├── README ├── autogen.sh ├── configure.ac ├── contrib ├── DiffieHellman.dll ├── Makefile.am ├── MonoTorrent.dll ├── MonoTorrent.dll.mdb ├── dotnet │ ├── Mono.Data.Sqlite.dll │ ├── Mono.Data.dll │ ├── Mono.GetOptions.dll │ ├── Mono.Posix.dll │ ├── add.reg │ └── install.bat ├── gtkspell-sharp.dll ├── ige-mac-integration-sharp.dll ├── osx │ └── libigemacintegration.dylib └── win32 │ ├── libgtkspell.dll │ └── sqlite3.dll ├── debian ├── compat ├── control └── rules ├── meshwork-gtk.pc.in ├── meshwork.desktop ├── meshwork.in ├── meshwork.pc.in ├── plugins ├── Debug │ ├── Debug.csproj │ ├── DebugActionGroup.cs │ ├── DebugPlugin.cs │ ├── DebugPluginMenus.xml │ ├── DebugWindow.cs │ ├── Makefile.am │ └── debugplugin.glade └── Makefile.am ├── po ├── ChangeLog ├── POTFILES.in ├── POTFILES.skip └── README ├── resources ├── Makefile.am ├── glade │ └── meshwork.glade ├── images │ ├── arrow_down.png │ ├── arrow_up.png │ ├── attachment-col-small.png │ ├── avatar-generic-large.png │ ├── avatar-generic-medium.png │ ├── avatar-generic-small.png │ ├── firewall-small.png │ ├── install_header.bmp │ ├── install_side.bmp │ ├── meshwork.png │ ├── network1.png │ ├── smallclose.png │ ├── star1_16.png │ ├── stock_icons │ │ ├── application-exit_16.png │ │ ├── application-exit_22.png │ │ ├── application-exit_24.png │ │ ├── application-exit_32.png │ │ ├── application-x-executable_16.png │ │ ├── audio-x-generic_16.png │ │ ├── computer_24.png │ │ ├── connect_24.png │ │ ├── connect_established_16.png │ │ ├── dialog-information_24.png │ │ ├── dialog-password_16.png │ │ ├── dialog-password_22.png │ │ ├── dialog-password_24.png │ │ ├── dialog-password_32.png │ │ ├── dialog-warning_16.png │ │ ├── down_16.png │ │ ├── down_22.png │ │ ├── find_16.png │ │ ├── find_24.png │ │ ├── folder_16.png │ │ ├── folder_24.png │ │ ├── go-down_16.png │ │ ├── go-down_22.png │ │ ├── go-home_16.png │ │ ├── go-home_24.png │ │ ├── go-next_16.png │ │ ├── go-next_22.png │ │ ├── go-previous_16.png │ │ ├── go-previous_22.png │ │ ├── go-up_16.png │ │ ├── go-up_22.png │ │ ├── gtk-new_16.png │ │ ├── gtk-new_24.png │ │ ├── gtk-preferences_16.png │ │ ├── gtk-preferences_22.png │ │ ├── gtk-preferences_24.png │ │ ├── image-x-generic_16.png │ │ ├── info_24.png │ │ ├── internet-group-chat_16.png │ │ ├── internet-group-chat_22.png │ │ ├── internet-group-chat_24.png │ │ ├── list-add_16.png │ │ ├── list-add_22.png │ │ ├── list-add_24.png │ │ ├── list-remove_16.png │ │ ├── list-remove_22.png │ │ ├── list-remove_24.png │ │ ├── locked_16.png │ │ ├── mail-message-new_16.png │ │ ├── mail-message-new_22.png │ │ ├── mail-message-new_24.png │ │ ├── mail-message-new_32.png │ │ ├── mail_generic_16.png │ │ ├── network-transmit-receive_16.png │ │ ├── process-working_22.png │ │ ├── stock_channel_16.png │ │ ├── stock_internet_16.png │ │ ├── stock_internet_24.png │ │ ├── stock_new-text_24.png │ │ ├── stock_person_16.png │ │ ├── stock_person_24.png │ │ ├── stock_refresh_16.png │ │ ├── stock_refresh_24.png │ │ ├── system-search_16.png │ │ ├── system-search_24.png │ │ ├── text-x-generic_16.png │ │ ├── unknown_16.png │ │ ├── up_16.png │ │ ├── up_22.png │ │ ├── user-home_16.png │ │ ├── video-x-generic_16.png │ │ ├── view-refresh_16.png │ │ └── x-office-document_16.png │ ├── tray_icon.png │ └── zoom.png └── ui │ ├── MainWindow.xml │ ├── MapPopupMenu.xml │ ├── SearchPopupMenu.xml │ └── TrayPopupMenu.xml ├── src ├── Makefile.am ├── Meshwork.Backend.Core.Logging │ ├── Meshwork.Backend.Core.Logging.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Backend.Core │ ├── Meshwork.Backend.Core.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Backend.Transport │ ├── Meshwork.Backend.Transport.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Backend │ ├── Core │ │ ├── AckMethod.cs │ │ ├── AutoconnectManager.cs │ │ ├── ChatRoom.cs │ │ ├── Collections │ │ │ ├── MessageIdCollection.cs │ │ │ └── NodeConnectionCollection.cs │ │ ├── ConnectionState.cs │ │ ├── ConnectionType.cs │ │ ├── Core.cs │ │ ├── Destination │ │ │ ├── DestinationBase.cs │ │ │ ├── DestinationInfo.cs │ │ │ ├── DestinationManager.cs │ │ │ ├── DestinationTypeFriendlyNames.cs │ │ │ ├── IDestination.cs │ │ │ ├── IDestinationSource.cs │ │ │ ├── IPDestination.cs │ │ │ ├── IPv4Destination.cs │ │ │ ├── IPv6Destination.cs │ │ │ ├── TCPIPDestinationSource.cs │ │ │ ├── TCPIPv4Destination.cs │ │ │ ├── TCPIPv4DestinationSource.cs │ │ │ ├── TCPIPv6Destination.cs │ │ │ └── TCPIPv6DestinationSource.cs │ │ ├── Encryption.cs │ │ ├── Errors.cs │ │ ├── EventArgs.cs │ │ ├── Exceptions.cs │ │ ├── IAvatarManager.cs │ │ ├── IMeshworkPlugin.cs │ │ ├── INodeConnection.cs │ │ ├── ISettings.cs │ │ ├── KeyManager.cs │ │ ├── LocalNodeConnection.cs │ │ ├── Logging │ │ │ ├── ConsoleCrayon.cs │ │ │ ├── ConsoleLogger.cs │ │ │ ├── FileLogger.cs │ │ │ ├── ILogger.cs │ │ │ └── LogLevel.cs │ │ ├── LoggingService.cs │ │ ├── Memo.cs │ │ ├── Message.cs │ │ ├── MessageBuilder.cs │ │ ├── MessageProcessor.cs │ │ ├── NearbyNode.cs │ │ ├── Network.cs │ │ ├── NetworkInfo.cs │ │ ├── NetworkState.cs │ │ ├── Node.cs │ │ ├── PluginInfo.cs │ │ ├── Protocol │ │ │ ├── MemoInfo.cs │ │ │ ├── MessageContentClasses.cs │ │ │ └── SearchResultInfo.cs │ │ ├── PublicKey.cs │ │ ├── RemoteNodeConnection.cs │ │ ├── SettingsBase.cs │ │ ├── TextCatalog.cs │ │ ├── Transport │ │ │ ├── AESTransportEncryptor.cs │ │ │ ├── IMeshworkOperation.cs │ │ │ ├── ITransport.cs │ │ │ ├── ITransportEncryptor.cs │ │ │ ├── ITransportListener.cs │ │ │ ├── TcpListener.cs │ │ │ ├── TcpTransport.cs │ │ │ ├── TransportBase.cs │ │ │ ├── TransportManager.cs │ │ │ └── TransportState.cs │ │ ├── TrustedNodeInfo.cs │ │ └── Validator.cs │ ├── Feature │ │ ├── FileBrowsing │ │ │ └── Filesystem │ │ │ │ ├── AbstractDirectory.cs │ │ │ │ ├── AbstractFile.cs │ │ │ │ ├── FileSystemProvider.cs │ │ │ │ ├── IDirectory.cs │ │ │ │ ├── IDirectoryItem.cs │ │ │ │ ├── IFile.cs │ │ │ │ ├── ILocalDirectoryItem.cs │ │ │ │ ├── IRemoteDirectoryItem.cs │ │ │ │ ├── LocalDirectory.cs │ │ │ │ ├── LocalFile.cs │ │ │ │ ├── MyDirectory.cs │ │ │ │ ├── NetworkDirectory.cs │ │ │ │ ├── NodeDirectory.cs │ │ │ │ ├── PathUtil.cs │ │ │ │ ├── RemoteDirectory.cs │ │ │ │ ├── RemoteFile.cs │ │ │ │ └── RootDirectory.cs │ │ ├── FileIndexing │ │ │ ├── ShareBuilder.cs │ │ │ ├── ShareHasher.cs │ │ │ └── ShareWatcher.cs │ │ ├── FileSearch │ │ │ ├── FileSearch.cs │ │ │ ├── FileSearchFilter.cs │ │ │ ├── FileSearchGroup.cs │ │ │ ├── FileSearchManager.cs │ │ │ └── SearchResult.cs │ │ └── FileTransfer │ │ │ ├── BitTorrent │ │ │ ├── BitTorrentFileTransfer.cs │ │ │ ├── BitTorrentFileTransferPeer.cs │ │ │ ├── BitTorrentFileTransferProvider.cs │ │ │ ├── MeshworkPeerConnection.cs │ │ │ ├── MeshworkPeerConnectionListener.cs │ │ │ └── MeshworkTrackerClient.cs │ │ │ ├── FileTransferBase.cs │ │ │ ├── FileTransferDirection.cs │ │ │ ├── FileTransferManager.cs │ │ │ ├── FileTransferPeerBase.cs │ │ │ ├── FileTransferPeerStatus.cs │ │ │ ├── FileTransferStatus.cs │ │ │ ├── IFileTransfer.cs │ │ │ ├── IFileTransferPeer.cs │ │ │ └── IFileTransferProvider.cs │ ├── Meshwork.Backend.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Client.ConsoleClient │ ├── AvatarManager.cs │ ├── Meshwork.Client.ConsoleClient.csproj │ ├── MeshworkDaemon.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Settings.cs │ └── SettingsCreator.cs ├── Meshwork.Client.GtkClient │ ├── AvatarManager.cs │ ├── BuiltinActionGroup.cs │ ├── DispatchService.cs │ ├── DndUtils.cs │ ├── DrawingUtilities.cs │ ├── GtkHelper.cs │ ├── GtkMeshworkOptions.cs │ ├── Gui.cs │ ├── GuiSyncContext.cs │ ├── Menus │ │ ├── ChatMenu.cs │ │ ├── ChatPageMenu.cs │ │ ├── ConnectionMenu.cs │ │ ├── MemoMenu.cs │ │ ├── TransfersMenu.cs │ │ └── UserMenu.cs │ ├── Meshwork.Client.GtkClient.csproj │ ├── Pages │ │ ├── ChatRoomSubpage.cs │ │ ├── ChatSubpageBase.cs │ │ ├── ChatsPage.cs │ │ ├── ConnectionsPage.cs │ │ ├── IPage.cs │ │ ├── MemosPage.cs │ │ ├── NetworkOverviewPage.UserList.cs │ │ ├── NetworkOverviewPage.cs │ │ ├── NewSearchPage.cs │ │ ├── PrivateChatSubpage.cs │ │ ├── SearchResultsPage.cs │ │ ├── StatusLogPage.cs │ │ ├── TransfersPage.cs │ │ └── UserBrowserPage.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RunOnMainThread.cs │ ├── Runtime.cs │ ├── Settings.cs │ ├── SidebarItems │ │ ├── ChatsItem.cs │ │ ├── ConnectionsItem.cs │ │ ├── FileSearchItem.cs │ │ ├── ISidebarItem.cs │ │ ├── MemosItem.cs │ │ ├── NetworkOverviewItem.cs │ │ ├── NewSearchItem.cs │ │ ├── SeparatorItem.cs │ │ ├── StatusItem.cs │ │ ├── TransfersItem.cs │ │ ├── UserBrowserItem.cs │ │ ├── WhatsNewSearchItem.cs │ │ └── WhatsPopularSearchItem.cs │ ├── SyncContext.cs │ ├── TrayIcon.cs │ ├── Widgets │ │ ├── Actor.cs │ │ ├── AnimatedImage.cs │ │ ├── FadingAlignment.cs │ │ ├── FileSearchEntry.cs │ │ ├── FileSelector.cs │ │ ├── FilterWidget.cs │ │ ├── FolderDialog.cs │ │ ├── GladeWidgetExtract.cs │ │ ├── Header.cs │ │ ├── HoverImageButton.cs │ │ ├── MainSidebar.cs │ │ ├── NavigationBar.cs │ │ ├── NetworkGroupedTreeStore.cs │ │ ├── SearchEntry.cs │ │ ├── SingleActorStage.cs │ │ ├── Stage.cs │ │ ├── ZoomableCairoArea.cs │ │ └── ZoomableNetworkMap.cs │ └── Windows │ │ ├── AboutDialog.cs │ │ ├── AcceptKeyDialog.cs │ │ ├── AddNetworkDialog.cs │ │ ├── AddTrustedNodeDialog.cs │ │ ├── BadOptionsDialog.cs │ │ ├── ChatRoomInvitationDialog.cs │ │ ├── ChatRoomPasswordDialog.cs │ │ ├── ConnectDialog.cs │ │ ├── DownloadPublicKeyDialog.cs │ │ ├── EditMemoDialog.cs │ │ ├── EditNetworkDialog.cs │ │ ├── FilePropertiesWindow.cs │ │ ├── FileTransferWindow.cs │ │ ├── GenerateKeyDialog.cs │ │ ├── GladeDialog.cs │ │ ├── GladeWindow.cs │ │ ├── IndexingStatusWindow.cs │ │ ├── InviteToChatDialog.cs │ │ ├── JoinChatroomDialog.cs │ │ ├── MainWindow.cs │ │ ├── MemoWindow.cs │ │ ├── PreferencesDialog.cs │ │ ├── SelectAvatarDialog.cs │ │ ├── SplashWindow.cs │ │ ├── StartupProblemsDialog.cs │ │ ├── UserInfoDialog.cs │ │ └── winEditTrustedNode.cs ├── Meshwork.Common │ ├── EndianBitConverter.cs │ ├── Extensions.cs │ ├── IPAddressExtensions.cs │ ├── IPv6Util.cs │ ├── JSONFormatter.cs │ ├── Meshwork.Common.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ReadOnlyDictionary.cs │ ├── Serialization │ │ ├── DontSerializeAttribute.cs │ │ └── JSON.cs │ ├── StringWriterWithEncoding.cs │ ├── Utils.cs │ └── packages.config ├── Meshwork.Library.CRC │ ├── CRC.cs │ ├── CRCParameters.cs │ ├── CRCStandard.cs │ ├── HashAlgorithmParameters.cs │ ├── Meshwork.Library.CRC.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Library.Hyena │ ├── Data │ │ └── Sqlite │ │ │ ├── DatabaseColumnAttribute.cs │ │ │ ├── FileTypeQueryValue.cs │ │ │ └── SqliteUtils.cs │ ├── DateTimeUtil.cs │ ├── Meshwork.Library.Hyena.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Query │ │ ├── AliasedObjectSet.cs │ │ ├── DateQueryValue.cs │ │ ├── ExactStringQueryValue.cs │ │ ├── FileSizeQueryValue.cs │ │ ├── IntegerKeyedObjectQueryValue.cs │ │ ├── IntegerQueryValue.cs │ │ ├── NullQueryValue.cs │ │ ├── QueryField.cs │ │ ├── QueryFieldSet.cs │ │ ├── QueryLimit.cs │ │ ├── QueryListNode.cs │ │ ├── QueryNode.cs │ │ ├── QueryOperator.cs │ │ ├── QueryOrder.cs │ │ ├── QueryParser.cs │ │ ├── QueryTermNode.cs │ │ ├── QueryToken.cs │ │ ├── QueryValue.cs │ │ ├── RelativeTimeSpanQueryValue.cs │ │ ├── StringQueryValue.cs │ │ ├── TimeSpanQueryValue.cs │ │ ├── UserQueryParser.cs │ │ └── XmlQueryParser.cs │ └── StringUtil.cs ├── Meshwork.Library.Stun │ ├── AddressAttributeBase.cs │ ├── ChangeRequestAttribute.cs │ ├── MappedAddressAttribute.cs │ ├── Meshwork.Library.Stun.csproj │ ├── MessageAttribute.cs │ ├── MessageHeader.cs │ ├── MessageType.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SourceAddressAttribute.cs │ ├── StunClient.cs │ └── Utility.cs ├── Meshwork.Platform.Linux │ ├── LinuxPlatform.cs │ ├── Meshwork.Platform.Linux.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Platform.MacOS │ ├── MacOSPlatform.cs │ ├── Meshwork.Platform.MacOS.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Meshwork.Platform.Windows │ ├── Meshwork.Platform.Windows.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Windows.cs ├── Meshwork.Platform │ ├── IPlatform.cs │ ├── InterfaceAddress.cs │ ├── Meshwork.Platform.csproj │ └── Properties │ │ └── AssemblyInfo.cs └── global.json └── version.sh /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | *.swp 4 | *.swo 5 | build/ 6 | aclocal.m4 7 | autom4te.cache/ 8 | intltool-* 9 | config.log 10 | config.status 11 | configure 12 | mkinstalldirs 13 | *~ 14 | config.guess* 15 | config.sub* 16 | install-sh 17 | meshwork 18 | meshwork.pc 19 | missing 20 | po/Makefile.in.in 21 | po/POTFILES 22 | po/stamp-it 23 | src/FileFind.Meshwork.GtkClient/Defines.cs 24 | *.userprefs 25 | *.usertasks 26 | *.pidb 27 | .DS_Store 28 | Thumbs.db 29 | obj/ 30 | meshwork-gtk.pc 31 | *~.cs 32 | tests/ 33 | debian/changelog 34 | debian/stamp* 35 | .idea/ 36 | bin/ 37 | packages/ 38 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Meshwork was created by: 2 | 3 | Eric Butler 4 | http://eric.extremeboredom.net/ 5 | 6 | Special thanks to: 7 | 8 | Idan Gazit 9 | Christian Hergert 10 | -------------------------------------------------------------------------------- /BuildWindowsInstaller.bat: -------------------------------------------------------------------------------- 1 | REM BuildWindowsInstaller.bat - Create the windows installer exe 2 | REM 3 | REM Authors: 4 | REM Eric Butler 5 | REM 6 | REM 7 | 8 | path=%path%;C:\program files\NSIS 9 | 10 | del "MeshworkSetup.exe" 11 | 12 | makensis meshwork.nsi 13 | 14 | pause 15 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/ChangeLog -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | TODO: Put INSTALL here. 2 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = contrib po resources src plugins 2 | bin_SCRIPTS = meshwork 3 | 4 | desktopdir = $(datadir)/applications 5 | desktop_DATA = meshwork.desktop 6 | 7 | # for application icon 8 | pixmapdir = $(datadir)/pixmaps 9 | pixmap_DATA = 10 | 11 | # for linking with pkg-config at some point 12 | pkgconfig_in_files = meshwork.pc.in meshwork-gtk.pc.in 13 | 14 | pkgconfigdir=$(prefix)/lib/pkgconfig 15 | pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc) 16 | 17 | run: 18 | $(MONO) --debug $(top_builddir)/build/FileFind.Meshwork.GtkClient.exe 19 | 20 | REWRITE = \ 21 | sed -e "s|\@prefix\@|$(prefix)|g" \ 22 | -e "s|\@pkglibdir\@|$(pkglibdir)|g" \ 23 | -e "s|\@bindir\@|$(bindir)|g" \ 24 | -e "s|\@MONO\@|$(MONO)|g" 25 | 26 | $(bin_SCRIPTS): $(srcdir)/meshwork.in Makefile 27 | $(REWRITE) $(srcdir)/meshwork.in > $@.tmp 28 | mv $@.tmp $@ 29 | 30 | CLEANFILES = \ 31 | intltool-merge \ 32 | intltool-extract \ 33 | intltool-update \ 34 | meshwork \ 35 | meshwork.pc \ 36 | meshwork-gtk.pc 37 | 38 | EXTRA_DIST = \ 39 | meshwork.in \ 40 | meshwork.desktop \ 41 | meshwork.pc.in \ 42 | intltool-extract.in \ 43 | intltool-merge.in \ 44 | intltool-update.in 45 | 46 | DISCLEANFILES = \ 47 | configure \ 48 | config.guess \ 49 | config.sub \ 50 | Makefile.in \ 51 | install-sh \ 52 | aclocal.m4 \ 53 | INSTALL \ 54 | COPYING \ 55 | missing 56 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | About 2 | ----- 3 | 4 | Meshwork allows you to create a private virtual network of friends that you 5 | can use to chat, share files, and more without worrying about compromising 6 | your privacy. 7 | 8 | Meshwork was created by Eric Butler. 9 | 10 | Meshwork is currently an abandoned project. Some things work, some things don't. 11 | If you're interested in the project, please contact me (eric@extremeboredom.net). 12 | I'd be happy to chat about it. 13 | 14 | Build Dependencies 15 | ------------------ 16 | 17 | - Automake 1.9 18 | - gmcs 19 | - avahi-sharp 20 | - dbus-sharp 21 | - Mono.Cairo 22 | - glib-gettextize 23 | - GTK# 2.x 24 | 25 | Ubuntu users can install everything in one command... 26 | 27 | Ubuntu 11.04 Natty: 28 | 29 | sudo apt-get install automake1.9 mono-gmcs libavahi1.0-cil \ 30 | libdbus1.0-cil libmono-cairo2.0-cil libglib2.0-dev gtk-sharp2 \ 31 | intltool libgdiplus mono-1.0-devel 32 | 33 | Instructions 34 | ------------ 35 | 36 | First install all build dependencies as explained above. 37 | 38 | If you are building from a git repository: 39 | 40 | ./autogen.sh 41 | 42 | Otherwise if you are building from a release tarball: 43 | 44 | ./configure 45 | 46 | Next run: 47 | 48 | make 49 | sudo make install 50 | 51 | Then just type 'meshwork' to start it. 52 | 53 | If you would rather not install Meshwork, you can run it out 54 | of the source tree: 55 | 56 | make run 57 | 58 | Have fun. 59 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([meshwork], 0.1, [meshwork@lists.filefind.net]) 2 | AC_PREREQ(2.53) 3 | AC_CANONICAL_SYSTEM 4 | AM_INIT_AUTOMAKE([1.9 tar-ustar]) 5 | AM_MAINTAINER_MODE 6 | 7 | AC_PROG_INTLTOOL([0.25]) 8 | 9 | AC_PROG_INSTALL 10 | 11 | dnl pkg-config 12 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 13 | if test "x$PKG_CONFIG" = "xno"; then 14 | AC_MSG_ERROR([You need to install pkg-config]) 15 | fi 16 | 17 | dnl C# compiler 18 | AC_PATH_PROG(CSC, csc, no) 19 | AC_PATH_PROG(MCS, gmcs, no) 20 | AC_PATH_PROG(MONO, mono, no) 21 | 22 | CS="C#" 23 | if test "x$CSC" = "xno" -a "x$MCS" = "xno" ; then 24 | dnl AC_MSG_ERROR([You need to install a C# compiler]) 25 | AC_MSG_ERROR([No $CS compiler found]) 26 | fi 27 | 28 | if test "x$MCS" = "xno" ; then 29 | MCS=$CSC 30 | fi 31 | 32 | if test "x$MONO" = "xno"; then 33 | AC_MSG_ERROR([No mono runtime found]) 34 | fi 35 | 36 | dnl library dependencies 37 | MONO_REQUIRED_VERSION=1.2.6 38 | GTKSHARP_REQUIRED_VERSION=2.8.2 39 | 40 | PKG_CHECK_MODULES(MONO, mono >= $MONO_REQUIRED_VERSION) 41 | 42 | PKG_CHECK_MODULES(GTKSHARP, gtk-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION) 43 | AC_SUBST(GTK_SHARP_LIBS) 44 | 45 | PKG_CHECK_MODULES(GLADE_SHARP, glade-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION) 46 | AC_SUBST(GLADE_SHARP_LIBS) 47 | 48 | dnl Intl 49 | ALL_LINGUAS="" 50 | GETTEXT_PACKAGE=meshwork 51 | AC_SUBST(GETTEXT_PACKAGE) 52 | AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package]) 53 | AM_GLIB_GNU_GETTEXT 54 | 55 | # CSC_FLAGS="-langversion:ISO-1" 56 | CSC_FLAGS="" 57 | 58 | MESHWORK_DIR='$(prefix)/lib/meshwork' 59 | 60 | AC_SUBST(MCS) 61 | AC_SUBST(MESHWORK_DIR) 62 | AC_SUBST(CSC_FLAGS) 63 | 64 | AC_OUTPUT([ 65 | meshwork.pc 66 | meshwork-gtk.pc 67 | Makefile 68 | src/Makefile 69 | src/FileFind.Meshwork/Makefile 70 | src/FileFind.Meshwork.GtkClient/Makefile 71 | src/FileFind.Meshwork.DaemonClient/Makefile 72 | contrib/Makefile 73 | resources/Makefile 74 | po/Makefile.in 75 | plugins/Makefile 76 | plugins/Debug/Makefile 77 | ]) 78 | 79 | echo " 80 | meshwork-$VERSION 81 | 82 | Install Prefix: ${prefix} 83 | Mono C# Compiler: ${MCS} 84 | Mono Runtime: ${MONO} 85 | " 86 | -------------------------------------------------------------------------------- /contrib/DiffieHellman.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/DiffieHellman.dll -------------------------------------------------------------------------------- /contrib/Makefile.am: -------------------------------------------------------------------------------- 1 | BINDIR=$(top_builddir)/build 2 | 3 | DIFFIEHELLMAN_DLL=DiffieHellman.dll 4 | DIFFIEHELLMAN=$(BINDIR)/$(DIFFIEHELLMAN_DLL) 5 | 6 | GTKSPELLSHARP_DLL=gtkspell-sharp.dll 7 | GTKSPELLSHARP=$(BINDIR)/$(GTKSPELLSHARP_DLL) 8 | 9 | MONOTORRENT_DLL=MonoTorrent.dll 10 | MONOTORRENT=$(BINDIR)/$(MONOTORRENT_DLL) 11 | 12 | MACINTEGRATION_DYLIB=libigemacintegration.dylib 13 | MACINTEGRATION=$(BINDIR)/osx/$(MACINTEGRATION_DYLIB) 14 | 15 | MACINTEGRATION_SHARP_DLL=ige-mac-integration-sharp.dll 16 | MACINTEGRATION_SHARP=$(BINDIR)/$(MACINTEGRATION_SHARP_DLL) 17 | 18 | GETOPTIONS_DLL=Mono.GetOptions.dll 19 | GETOPTIONS=$(BINDIR)/$(GETOPTIONS_DLL) 20 | 21 | all: $(DIFFIEHELLMAN) $(GTKSPELLSHARP) $(MONOTORRENT) $(MACINTEGRATION) $(MACINTEGRATION_SHARP) $(GETOPTIONS) 22 | 23 | $(DIFFIEHELLMAN): 24 | mkdir -p $(BINDIR) 25 | cp $(srcdir)/$(DIFFIEHELLMAN_DLL) $(DIFFIEHELLMAN) 26 | 27 | $(GTKSPELLSHARP): 28 | mkdir -p $(BINDIR) 29 | cp $(srcdir)/$(GTKSPELLSHARP_DLL) $(GTKSPELLSHARP) 30 | 31 | $(MONOTORRENT): 32 | mkdir -p $(BINDIR) 33 | cp $(srcdir)/$(MONOTORRENT_DLL) $(MONOTORRENT) 34 | 35 | $(MACINTEGRATION_SHARP): 36 | mkdir -p $(BINDIR) 37 | cp $(srcdir)/$(MACINTEGRATION_SHARP_DLL) $(MACINTEGRATION_SHARP) 38 | 39 | $(MACINTEGRATION): 40 | mkdir -p $(BINDIR)/osx 41 | cp $(srcdir)/osx/$(MACINTEGRATION_DYLIB) $(MACINTEGRATION) 42 | 43 | $(GETOPTIONS): 44 | mkdir -p $(BINDIR) 45 | cp $(srcdir)/dotnet/$(GETOPTIONS_DLL) $(GETOPTIONS) 46 | 47 | CLEANFILES = $(DIFFIEHELLMAN) $(GTKSPELLSHARP) $(MONOTORRENT) $(MACINTEGRATION) $(MACINTEGRATION_SHARP) $(GETOPTIONS) 48 | EXTRA_DIST = $(DIFFIEHELLMAN_DLL) $(GTKSPELLSHARP_DLL) $(MONOTORRENT_DLL) $(MACINTEGRATION_DYLIB) $(MACINTEGRATION_SHARP_DLL) $(GETOPTIONS_DLL) 49 | 50 | meshworkdir = $(MESHWORK_DIR) 51 | meshwork_DATA = $(DIFFIEHELLMAN) $(GTKSPELLSHARP) $(MONOTORRENT) $(MACINTEGRATION) $(MACINTEGRATION_SHARP) $(GETOPTIONS) 52 | -------------------------------------------------------------------------------- /contrib/MonoTorrent.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/MonoTorrent.dll -------------------------------------------------------------------------------- /contrib/MonoTorrent.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/MonoTorrent.dll.mdb -------------------------------------------------------------------------------- /contrib/dotnet/Mono.Data.Sqlite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/dotnet/Mono.Data.Sqlite.dll -------------------------------------------------------------------------------- /contrib/dotnet/Mono.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/dotnet/Mono.Data.dll -------------------------------------------------------------------------------- /contrib/dotnet/Mono.GetOptions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/dotnet/Mono.GetOptions.dll -------------------------------------------------------------------------------- /contrib/dotnet/Mono.Posix.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/dotnet/Mono.Posix.dll -------------------------------------------------------------------------------- /contrib/dotnet/add.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/dotnet/add.reg -------------------------------------------------------------------------------- /contrib/dotnet/install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set OLDDIR=%CD% 4 | 5 | mkdir C:\MeshworkDLLs 6 | copy *.dll C:\MeshworkDLLs 7 | 8 | if not exist %systemroot%\syswow64\regedit goto 20 9 | echo Detected 32-bit system 10 | regedit %CD%\add.reg 11 | :20 12 | echo Detected 64-bit system, using 32-bit registry... 13 | %systemroot%\syswow64\regedit %CD%\add.reg 14 | goto end 15 | :end 16 | -------------------------------------------------------------------------------- /contrib/gtkspell-sharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/gtkspell-sharp.dll -------------------------------------------------------------------------------- /contrib/ige-mac-integration-sharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/ige-mac-integration-sharp.dll -------------------------------------------------------------------------------- /contrib/osx/libigemacintegration.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/osx/libigemacintegration.dylib -------------------------------------------------------------------------------- /contrib/win32/libgtkspell.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/win32/libgtkspell.dll -------------------------------------------------------------------------------- /contrib/win32/sqlite3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/contrib/win32/sqlite3.dll -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: meshwork 2 | Section: contrib/net 3 | Priority: optional 4 | Maintainer: Eric Butler 5 | Build-Depends: debhelper (>= 5), cdbs, cli-common-dev (>= 0.4.4), mono-gmcs (>= 1.2.6), libmono-dev (>= 1.2.6), libgtk2.0-cil (>= 2.10), libglib2.0-cil (>= 2.10), libglade2.0-cil (>= 2.10), libgtk2.0-dev (>= 2.12), pkg-config, intltool, libgdiplus (>= 1.2.4), cdbs, libcairo2-dev, libmono-cairo2.0-cil (>= 1.2.6), automake (>= 1:1.10), libmono-sqlite2.0-cil (>= 1.2.6), mono-2.0-devel (>= 1.2.6), mono-1.0-devel (>= 1.2.6) 6 | Standards-Version: 3.6.2 7 | 8 | Package: meshwork 9 | Architecture: all 10 | Depends: ${shlibs:Depends}, ${cli:Depends}, ${misc:Depends}, libgdiplus (>= 1.2.4), libgtkspell0, libmono-cairo2.0-cil (>= 1.2.6), libmono-sqlite2.0-cil (>= 1.2.6) 11 | Description: Your own private, distributed, and secure P2P network. 12 | Meshwork allows you to create a private virtual network of friends that you 13 | can use to chat, share files, and more without worrying about compromising 14 | your privacy. 15 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | include /usr/share/cdbs/1/rules/debhelper.mk 4 | include /usr/share/cdbs/1/rules/simple-patchsys.mk 5 | include /usr/share/cdbs/1/class/gnome.mk 6 | 7 | export MONO_SHARED_DIR=$(CURDIR) 8 | 9 | install/meshwork:: 10 | find debian/ -type f -name "*.dll" -or -name "*.mdb" -or -name "*.cs" -or -name "*.config" | xargs chmod -x 11 | find debian/ -type f -name "*.exe" | xargs chmod +x 12 | 13 | binary-predeb/meshwork:: 14 | dh_clideps 15 | 16 | clean:: 17 | rm -rf $(MONO_SHARED_DIR)/.wapi 18 | 19 | 20 | VERSION=$(shell ./version.sh) 21 | REV=$(shell git rev-list HEAD^!) 22 | DATE=$(shell date --rfc-2822) 23 | DIST=$(shell lsb_release -c -s) 24 | 25 | update-version: 26 | echo "\ 27 | meshwork (${VERSION}-1~${DIST}0) ${DIST}; urgency=low\n\ 28 | \n\ 29 | * Automatic package for revision ${REV}. \n\ 30 | \n\ 31 | -- Eric Butler ${DATE}" > debian/changelog 32 | echo "\n\n*** PACKAGE WILL BE BUILT FOR ${DIST} ***\n\n" 33 | -------------------------------------------------------------------------------- /meshwork-gtk.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | plugindir=${exec_prefix}/lib/meshwork/plugins 5 | 6 | Name: Meshwork (GTK GUI) 7 | Description: A distributed, secure, peer-to-peer networking application. 8 | Version: @VERSION@ 9 | Libs: -r:${libdir}/meshwork/FileFind.Meshwork.GtkClient.exe 10 | -------------------------------------------------------------------------------- /meshwork.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=Meshwork 5 | GenericName=Meshwork 6 | Comment=Distributed secure private p2p network. 7 | Exec=meshwork 8 | TryExec=meshwork 9 | Icon=meshwork.png 10 | StartupNotify=true 11 | Terminal=false 12 | Type=Application 13 | MimeType= 14 | Categories=Application;Network;P2P; 15 | -------------------------------------------------------------------------------- /meshwork.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | @MONO@ --debug @prefix@/lib/meshwork/FileFind.Meshwork.GtkClient.exe $MONO_EXTRA_ARGS "$@" 4 | -------------------------------------------------------------------------------- /meshwork.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | plugindir=${exec_prefix}/lib/meshwork/plugins 5 | 6 | Name: Meshwork 7 | Description: A distributed, secure, peer-to-peer networking application. 8 | Version: @VERSION@ 9 | Libs: -r:${libdir}/meshwork/FileFind.Meshwork.dll 10 | -------------------------------------------------------------------------------- /plugins/Debug/DebugActionGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gtk; 3 | using Mono.Unix; 4 | 5 | namespace Debug 6 | { 7 | public class DebugPluginActionGroup : ActionGroup 8 | { 9 | DebugPlugin plugin; 10 | 11 | private static readonly string string_debug_window = 12 | Catalog.GetString ("_Debug Window"); 13 | 14 | private static ActionEntry[] entries = { 15 | new ActionEntry("ShowDebugWindow", null, string_debug_window, 16 | null, null, null) 17 | }; 18 | 19 | public DebugPluginActionGroup (DebugPlugin plugin) : base ("DebugPluginActions") 20 | { 21 | Add(entries); 22 | 23 | this.plugin = plugin; 24 | 25 | this["ShowDebugWindow"].Activated += ShowDebugWindow_Activated; 26 | } 27 | 28 | private void ShowDebugWindow_Activated (object sender, EventArgs args) 29 | { 30 | plugin.DebugWindow.Show(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /plugins/Debug/DebugPlugin.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Debug; 3 | using FileFind.Meshwork.GtkClient; 4 | using Gtk; 5 | 6 | [assembly: PluginName("Debug Console")] 7 | [assembly: PluginAuthor("Eric Butler ")] 8 | [assembly: PluginVersion("0.0.0.1")] 9 | [assembly: PluginType(typeof(DebugPlugin))] 10 | 11 | namespace Debug 12 | { 13 | public class DebugPlugin : IPlugin 14 | { 15 | DebugPluginActionGroup debug_actions; 16 | UIManager ui_manager; 17 | uint merge_id; 18 | DebugWindow debug_window; 19 | List messages = new List(); 20 | bool trafficLogEnabled; 21 | 22 | public DebugPlugin () 23 | { 24 | debug_actions = new DebugPluginActionGroup(this); 25 | debug_window = new DebugWindow(this); 26 | } 27 | 28 | public void Load () 29 | { 30 | ui_manager = Runtime.UIManager; 31 | ui_manager.InsertActionGroup(debug_actions, 0); 32 | merge_id = ui_manager.AddUiFromResource("DebugPluginMenus.xml"); 33 | } 34 | 35 | public void Unload () 36 | { 37 | ui_manager.RemoveUi(merge_id); 38 | 39 | Core.MessageReceived -= AddMessage; 40 | Core.MessageSent -= AddMessage; 41 | } 42 | 43 | public bool EnableTrafficLog { 44 | get { 45 | return trafficLogEnabled; 46 | } 47 | set { 48 | if (value) { 49 | if (!trafficLogEnabled) { 50 | Core.MessageReceived += AddMessage; 51 | Core.MessageSent += AddMessage; 52 | } 53 | } else { 54 | if (trafficLogEnabled) { 55 | Core.MessageReceived -= AddMessage; 56 | Core.MessageSent -= AddMessage; 57 | } 58 | } 59 | trafficLogEnabled = value; 60 | } 61 | } 62 | 63 | public MessageInfo[] Messages { 64 | get { 65 | return messages.ToArray(); 66 | } 67 | } 68 | 69 | internal DebugWindow DebugWindow { 70 | get { 71 | return debug_window; 72 | } 73 | } 74 | 75 | private void AddMessage (MessageInfo messageInfo) 76 | { 77 | messages.Add(messageInfo); 78 | debug_window.AddMessage(messageInfo); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /plugins/Debug/DebugPluginMenus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/Debug/Makefile.am: -------------------------------------------------------------------------------- 1 | MCS_FLAGS = -t:library -debug 2 | 3 | DLL = $(top_builddir)/build/plugins/DebugPlugin.dll 4 | 5 | REFERENCES = \ 6 | -r:Mono.Posix \ 7 | -pkg:gtk-sharp-2.0 \ 8 | -pkg:glade-sharp-2.0 \ 9 | -r:$(top_builddir)/build/FileFind.Meshwork.dll \ 10 | -r:$(top_builddir)/build/FileFind.Meshwork.GtkClient.exe 11 | 12 | RESOURCES = \ 13 | -resource:debugplugin.glade \ 14 | -resource:DebugPluginMenus.xml 15 | 16 | FILES = \ 17 | DebugPlugin.cs \ 18 | DebugActionGroup.cs \ 19 | DebugWindow.cs 20 | 21 | all: $(DLL) 22 | 23 | $(DLL): $(FILES) 24 | mkdir -p $(top_builddir)/build/plugins 25 | $(MCS) $(MCS_FLAGS) $(REFERENCES) $(RESOURCES) -t:library -out:$@ $(FILES) 26 | 27 | clean: 28 | rm -f $(DLL) $(DLL).mdb 29 | -------------------------------------------------------------------------------- /plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = Debug 2 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-10-28 Christian Hergert 2 | 3 | * ChangeLog: Add po ChangeLog to translation changes. 4 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/po/POTFILES.skip -------------------------------------------------------------------------------- /po/README: -------------------------------------------------------------------------------- 1 | Notes on how to do a localization (l10n) for Meshwork 2 | ===================================================== 3 | 4 | Creating a l10n: 5 | ---------------- 6 | First of all you create a template to base your translation on: 7 | intltool-update --pot 8 | 9 | Then copy it to your translation 10 | cp meshwork.pot da.po 11 | Do your translation, with some kind of editor 12 | gtranslator da.po 13 | 14 | Add your l10n to configure.in, find the ALL_LINGUAS variable and add your 15 | l10n to it. 16 | 17 | Updating your l10n: 18 | ------------------- 19 | To update an existing po fx da.po: 20 | intltool-update da 21 | -------------------------------------------------------------------------------- /resources/images/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/arrow_down.png -------------------------------------------------------------------------------- /resources/images/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/arrow_up.png -------------------------------------------------------------------------------- /resources/images/attachment-col-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/attachment-col-small.png -------------------------------------------------------------------------------- /resources/images/avatar-generic-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/avatar-generic-large.png -------------------------------------------------------------------------------- /resources/images/avatar-generic-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/avatar-generic-medium.png -------------------------------------------------------------------------------- /resources/images/avatar-generic-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/avatar-generic-small.png -------------------------------------------------------------------------------- /resources/images/firewall-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/firewall-small.png -------------------------------------------------------------------------------- /resources/images/install_header.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/install_header.bmp -------------------------------------------------------------------------------- /resources/images/install_side.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/install_side.bmp -------------------------------------------------------------------------------- /resources/images/meshwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/meshwork.png -------------------------------------------------------------------------------- /resources/images/network1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/network1.png -------------------------------------------------------------------------------- /resources/images/smallclose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/smallclose.png -------------------------------------------------------------------------------- /resources/images/star1_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/star1_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/application-exit_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/application-exit_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/application-exit_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/application-exit_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/application-exit_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/application-exit_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/application-exit_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/application-exit_32.png -------------------------------------------------------------------------------- /resources/images/stock_icons/application-x-executable_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/application-x-executable_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/audio-x-generic_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/audio-x-generic_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/computer_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/computer_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/connect_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/connect_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/connect_established_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/connect_established_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/dialog-information_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/dialog-information_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/dialog-password_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/dialog-password_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/dialog-password_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/dialog-password_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/dialog-password_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/dialog-password_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/dialog-password_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/dialog-password_32.png -------------------------------------------------------------------------------- /resources/images/stock_icons/dialog-warning_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/dialog-warning_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/down_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/down_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/down_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/down_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/find_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/find_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/find_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/find_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/folder_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/folder_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/folder_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/folder_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-down_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-down_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-down_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-down_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-home_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-home_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-home_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-home_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-next_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-next_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-next_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-next_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-previous_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-previous_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-previous_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-previous_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-up_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-up_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/go-up_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/go-up_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/gtk-new_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/gtk-new_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/gtk-new_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/gtk-new_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/gtk-preferences_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/gtk-preferences_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/gtk-preferences_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/gtk-preferences_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/gtk-preferences_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/gtk-preferences_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/image-x-generic_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/image-x-generic_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/info_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/info_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/internet-group-chat_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/internet-group-chat_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/internet-group-chat_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/internet-group-chat_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/internet-group-chat_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/internet-group-chat_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/list-add_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/list-add_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/list-add_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/list-add_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/list-add_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/list-add_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/list-remove_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/list-remove_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/list-remove_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/list-remove_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/list-remove_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/list-remove_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/locked_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/locked_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/mail-message-new_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/mail-message-new_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/mail-message-new_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/mail-message-new_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/mail-message-new_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/mail-message-new_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/mail-message-new_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/mail-message-new_32.png -------------------------------------------------------------------------------- /resources/images/stock_icons/mail_generic_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/mail_generic_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/network-transmit-receive_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/network-transmit-receive_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/process-working_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/process-working_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_channel_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_channel_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_internet_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_internet_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_internet_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_internet_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_new-text_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_new-text_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_person_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_person_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_person_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_person_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_refresh_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_refresh_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/stock_refresh_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/stock_refresh_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/system-search_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/system-search_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/system-search_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/system-search_24.png -------------------------------------------------------------------------------- /resources/images/stock_icons/text-x-generic_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/text-x-generic_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/unknown_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/unknown_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/up_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/up_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/up_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/up_22.png -------------------------------------------------------------------------------- /resources/images/stock_icons/user-home_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/user-home_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/video-x-generic_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/video-x-generic_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/view-refresh_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/view-refresh_16.png -------------------------------------------------------------------------------- /resources/images/stock_icons/x-office-document_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/stock_icons/x-office-document_16.png -------------------------------------------------------------------------------- /resources/images/tray_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/tray_icon.png -------------------------------------------------------------------------------- /resources/images/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/meshwork/553367aeb7808e70872ce2d42d4ec5a09b514bec/resources/images/zoom.png -------------------------------------------------------------------------------- /resources/ui/MainWindow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /resources/ui/MapPopupMenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/ui/SearchPopupMenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/ui/TrayPopupMenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = FileFind.Meshwork FileFind.Meshwork.GtkClient FileFind.Meshwork.DaemonClient 2 | -------------------------------------------------------------------------------- /src/Meshwork.Backend.Core.Logging/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | 9 | [assembly: AssemblyTitle("Meshwork.Backend.Core.Logging")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Meshwork.Backend.Core.Logging")] 14 | [assembly: AssemblyCopyright("Copyright © 2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | 22 | [assembly: ComVisible(false)] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | 26 | [assembly: Guid("315C4C8E-30B5-4212-8D66-5A4783CD1C3D")] 27 | 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the values or you can default the Build and Revision Numbers 36 | // by using the '*' as shown below: 37 | // [assembly: AssemblyVersion("1.0.*")] 38 | 39 | [assembly: AssemblyVersion("1.0.0.0")] 40 | [assembly: AssemblyFileVersion("1.0.0.0")] 41 | 42 | -------------------------------------------------------------------------------- /src/Meshwork.Backend.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | 9 | [assembly: AssemblyTitle("Meshwork.Backend.Core")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Meshwork.Backend.Core")] 14 | [assembly: AssemblyCopyright("Copyright © 2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | 22 | [assembly: ComVisible(false)] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | 26 | [assembly: Guid("6D3236AC-6434-4DE9-A664-541F9067F64B")] 27 | 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the values or you can default the Build and Revision Numbers 36 | // by using the '*' as shown below: 37 | // [assembly: AssemblyVersion("1.0.*")] 38 | 39 | [assembly: AssemblyVersion("1.0.0.0")] 40 | [assembly: AssemblyFileVersion("1.0.0.0")] 41 | 42 | -------------------------------------------------------------------------------- /src/Meshwork.Backend.Transport/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | 9 | [assembly: AssemblyTitle("Meshwork.Backend.Transport")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Meshwork.Backend.Transport")] 14 | [assembly: AssemblyCopyright("Copyright © 2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | 22 | [assembly: ComVisible(false)] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | 26 | [assembly: Guid("A433E22E-D84A-4D02-992E-1DBCAA573AE8")] 27 | 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the values or you can default the Build and Revision Numbers 36 | // by using the '*' as shown below: 37 | // [assembly: AssemblyVersion("1.0.*")] 38 | 39 | [assembly: AssemblyVersion("1.0.0.0")] 40 | [assembly: AssemblyFileVersion("1.0.0.0")] 41 | 42 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/AckMethod.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AckMethod.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | 12 | namespace Meshwork.Backend.Core 13 | { 14 | /// 15 | /// Stores information used to invoke a method after recieving 16 | /// an ack for a specific messageID. 17 | /// 18 | public class AckMethod 19 | { 20 | public AckMethod () 21 | { 22 | } 23 | 24 | public AckMethod (string messageID, MethodEventHandler method, object[] args) 25 | { 26 | MessageID = messageID; 27 | Method = method; 28 | this.args = args; 29 | } 30 | 31 | /// The MessageID this is intended for. 32 | public string MessageID; 33 | 34 | /// The EventHandler used to invoke the method 35 | public delegate void MethodEventHandler(DateTime timeReceived, object[] args); 36 | 37 | /// The method to invoke 38 | public event MethodEventHandler Method; 39 | 40 | /// An object[] of arguments to be passed to Method 41 | public object[] args; 42 | 43 | /// 44 | /// Invokes the method. 45 | /// 46 | /// The DateTime the ack for this message was received. 47 | public void CallMethod(DateTime TimeReceived) 48 | { 49 | if (Method != null) { 50 | Method(TimeReceived, args); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/ChatRoom.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ChatRoom.cs: A Meshwork chat room 3 | // 4 | // Author: 5 | // Eric Butler 6 | // 7 | // (C) 2005-2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using Meshwork.Backend.Core.Protocol; 13 | using Meshwork.Common; 14 | 15 | namespace Meshwork.Backend.Core 16 | { 17 | public class ChatRoom 18 | { 19 | private string password; 20 | private readonly Dictionary users = new Dictionary(); 21 | 22 | public ChatRoom (Network network, string id, string name) 23 | { 24 | Network = network; 25 | Id = id; 26 | Name = name; 27 | } 28 | 29 | internal ChatRoom (Network network, ChatRoomInfo info) 30 | { 31 | Network = network; 32 | Id = info.Id; 33 | Name = info.Name; 34 | } 35 | 36 | [Obsolete] 37 | public Dictionary Properties { get; } = new Dictionary(); 38 | 39 | public Network Network { get; } 40 | 41 | public string Id { get; } 42 | 43 | public string Name { get; } 44 | 45 | public IDictionary Users => new ReadOnlyDictionary(users); 46 | 47 | internal void AddUser (Node node) 48 | { 49 | users.Add(node.NodeID, node); 50 | } 51 | 52 | internal void RemoveUser (Node node) 53 | { 54 | users.Remove(node.NodeID); 55 | } 56 | 57 | public string Password { 58 | get { 59 | return password; 60 | } 61 | internal set { 62 | if (!string.IsNullOrEmpty(value)) { 63 | if (!TestPassword(value)) 64 | throw new ArgumentException("Invalid password"); 65 | password = value; 66 | } else 67 | password = null; 68 | } 69 | } 70 | 71 | public bool HasPassword => Id != Common.Utils.SHA512Str(Name); 72 | 73 | public bool InRoom => users.ContainsKey(Network.Core.MyNodeID); 74 | 75 | public bool TestPassword (string password) 76 | { 77 | if (!HasPassword) 78 | return true; 79 | 80 | return (Id == Common.Utils.SHA512Str(Name + password)); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Collections/MessageIdCollection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MessageIdCollection.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | 13 | namespace Meshwork.Backend.Core.Collections 14 | { 15 | public class MessageIdCollection : Dictionary 16 | { 17 | public void Add (string messageID) 18 | { 19 | if (messageID == null) { 20 | throw new ArgumentNullException("messageID"); 21 | } 22 | 23 | base.Add(messageID, DateTime.Now); 24 | } 25 | 26 | public void Purge() 27 | { 28 | var deleteList = new List(); 29 | 30 | lock (this) { 31 | foreach (var pair in this) { 32 | var key = pair.Key; 33 | var dt = pair.Value; 34 | 35 | if (DateTime.Now.Subtract(dt).Milliseconds >= 6000) { 36 | deleteList.Add(key); 37 | } 38 | } 39 | } 40 | 41 | foreach (var key in deleteList) { 42 | Remove(key); 43 | } 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Collections/NodeConnectionCollection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NodeConnectionCollection.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | 13 | namespace Meshwork.Backend.Core.Collections 14 | { 15 | public class NodeConnectionCollection : List 16 | { 17 | Network network; 18 | 19 | public NodeConnectionCollection (Network network) 20 | { 21 | this.network = network; 22 | } 23 | 24 | public new void Add (INodeConnection c) 25 | { 26 | if (c.NodeLocal == null) { 27 | throw new Exception("Trying to add a connection with no NodeLocal object!!"); 28 | } 29 | if (c is RemoteNodeConnection && c.NodeRemote == null) { 30 | throw new Exception("Trying to add a connection with no NodeRemote object!!"); 31 | } 32 | if (c is RemoteNodeConnection && (!network.Nodes.ContainsKey(c.NodeRemote.NodeID))) { 33 | throw new Exception("Trying to add a connection with a NodeRemote thats not in network collection!! ('" + c.NodeRemote.NodeID + "')"); 34 | } 35 | if (!network.Nodes.ContainsKey(c.NodeLocal.NodeID)) { 36 | throw new Exception("Trying to add a connection with a NodeLocal thats not in network collection!!"); 37 | } 38 | base.Add(c); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/ConnectionState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionState.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Core 11 | { 12 | public enum ConnectionState 13 | { 14 | Connecting, 15 | Authenticating, 16 | Remote, 17 | Ready, 18 | Disconnected 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/ConnectionType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionType.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections; 11 | 12 | namespace Meshwork.Backend.Core 13 | { 14 | public static class ConnectionType 15 | { 16 | static Hashtable friendlyNames = new Hashtable (); 17 | static ConnectionType () 18 | { 19 | friendlyNames.Add (NodeConnection, "Node Connection"); 20 | friendlyNames.Add (TransferConnection, "Transfer Connection"); 21 | } 22 | 23 | public static readonly ulong NodeConnection = 0x01; 24 | public static readonly ulong TransferConnection = 0x02; 25 | 26 | public static string GetFriendlyName (ulong connectionType) 27 | { 28 | if (friendlyNames.ContainsKey (connectionType)) 29 | return friendlyNames [connectionType].ToString (); 30 | return "Unknown"; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/DestinationBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Meshwork.Backend.Core.Transport; 3 | 4 | namespace Meshwork.Backend.Core.Destination 5 | { 6 | public abstract class DestinationBase : IDestination 7 | { 8 | protected DestinationBase(Core core) 9 | { 10 | Core = core; 11 | } 12 | 13 | public abstract ITransport CreateTransport (ulong connectionType); 14 | 15 | public abstract DestinationInfo CreateDestinationInfo(); 16 | 17 | public Core Core { get; } 18 | 19 | public abstract bool IsExternal { 20 | get; 21 | } 22 | 23 | public abstract bool CanConnect { 24 | get; 25 | } 26 | 27 | // FIXME: Make readonly 28 | public bool IsOpenExternally { get; protected set; } = false; 29 | 30 | public IList ParentList { get; protected internal set; } 31 | 32 | public string FriendlyTypeName => DestinationTypeFriendlyNames.GetFriendlyName(GetType().ToString()); 33 | 34 | public abstract int CompareTo (IDestination other); 35 | } 36 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/DestinationInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Meshwork.Common.Serialization; 4 | 5 | namespace Meshwork.Backend.Core.Destination 6 | { 7 | public class DestinationInfo 8 | { 9 | public string TypeName { get; set; } 10 | 11 | public string[] Data { get; set; } 12 | 13 | [DontSerialize] 14 | public bool Local { get; set; } 15 | 16 | public bool IsOpenExternally { get; set; } 17 | 18 | public bool IsSupported(Core core) 19 | { 20 | return core.DestinationManager.SupportsDestinationType(TypeName); 21 | } 22 | 23 | public IDestination CreateDestination (Core core) 24 | { 25 | if (!Local) { 26 | throw new InvalidOperationException("May not call CreateDestination() on non-local DestinationInfo. Use CreateAndAddDestination() instead."); 27 | } 28 | 29 | var destinationType = Type.GetType(TypeName); 30 | var destination = (IDestination)Activator.CreateInstance(destinationType, core, this); 31 | return destination; 32 | } 33 | 34 | public IDestination CreateAndAddDestination (Core core, List parentList) 35 | { 36 | var destinationType = Type.GetType(TypeName); 37 | var destination = (IDestination)Activator.CreateInstance(destinationType, core, this); 38 | 39 | ((DestinationBase)destination).ParentList = parentList.AsReadOnly(); 40 | parentList.Add(destination); 41 | 42 | return destination; 43 | } 44 | 45 | [DontSerialize] 46 | public string FriendlyName => DestinationTypeFriendlyNames.GetFriendlyName(TypeName); 47 | } 48 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/DestinationTypeFriendlyNames.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Meshwork.Backend.Core.Destination 5 | { 6 | public static class DestinationTypeFriendlyNames 7 | { 8 | private static readonly Dictionary FriendlyNames = new Dictionary(); 9 | 10 | public static void RegisterFriendlyName (Type type, string friendlyName) 11 | { 12 | FriendlyNames[type.ToString()] = friendlyName; 13 | } 14 | 15 | public static string GetFriendlyName (Type type) 16 | { 17 | return GetFriendlyName(type.ToString()); 18 | } 19 | 20 | public static string GetFriendlyName (string typeName) 21 | { 22 | if (FriendlyNames.ContainsKey(typeName)) { 23 | return FriendlyNames[typeName]; 24 | } 25 | return typeName; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/IDestination.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IDestination.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using Meshwork.Backend.Core.Transport; 13 | 14 | namespace Meshwork.Backend.Core.Destination 15 | { 16 | 17 | /* 18 | public static class DestinationFactory 19 | { 20 | static Dictionary sources = new Dictionary(); 21 | 22 | public static void RegisterSource (IDestinationSource source) 23 | { 24 | sources[source.DestinationType.ToString()] = source; 25 | } 26 | 27 | public static bool SupportsDestinationType (string typeName) 28 | { 29 | return sources.ContainsKey(typeName); 30 | } 31 | 32 | public static IDestination Create (DestinationInfo info) 33 | { 34 | if (!SupportsDestinationType(info.TypeName)) { 35 | throw new InvalidOperationException(String.Format("Destination type {0} is not supported.", info.TypeName)); 36 | } 37 | 38 | Type type = sources[info.TypeName].DestinationType; 39 | 40 | IDestination destination; 41 | destination = (IDestination)type.InvokeMember("CreateFromInfo", 42 | BindingFlags.Static, 43 | null, null, new object[]{info}); 44 | return destination; 45 | } 46 | 47 | public static ITransportListener CreateListener (DestinationInfo info) 48 | { 49 | throw new NotImplementedException(); 50 | } 51 | }*/ 52 | 53 | public interface IDestination : IComparable 54 | { 55 | DestinationInfo CreateDestinationInfo(); 56 | 57 | ITransport CreateTransport(ulong connectionType); 58 | 59 | bool IsExternal { 60 | get; 61 | } 62 | 63 | bool CanConnect { 64 | get; 65 | } 66 | 67 | bool IsOpenExternally { 68 | get; 69 | } 70 | 71 | IList ParentList { 72 | get; 73 | } 74 | 75 | string FriendlyTypeName { 76 | get; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/IDestinationSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Meshwork.Backend.Core.Destination 5 | { 6 | public delegate void DestinationEventHandler (IDestination destination); 7 | 8 | public interface IDestinationSource 9 | { 10 | event DestinationEventHandler DestinationAdded; 11 | event DestinationEventHandler DestinationRemoved; 12 | 13 | void Update (); 14 | 15 | Type DestinationType { 16 | get; 17 | } 18 | 19 | Type ListenerType { 20 | get; 21 | } 22 | 23 | IList Destinations { 24 | get; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/IPDestination.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IPDestination.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Net; 11 | 12 | namespace Meshwork.Backend.Core.Destination 13 | { 14 | public abstract class IPDestination : DestinationBase 15 | { 16 | protected IPDestination (Core core, IPAddress ip, uint port, bool isOpenExternally) : base(core) 17 | { 18 | IPAddress = ip; 19 | Port = port; 20 | IsOpenExternally = isOpenExternally; 21 | } 22 | 23 | public IPAddress IPAddress { get; } 24 | 25 | public uint Port { get; } 26 | 27 | public override bool IsExternal => !Common.Utils.IsInternalIP(IPAddress); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/TCPIPv4Destination.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TCPDestination.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Net; 11 | using Meshwork.Backend.Core.Transport; 12 | 13 | namespace Meshwork.Backend.Core.Destination 14 | { 15 | public class TCPIPv4Destination : IPv4Destination 16 | { 17 | static TCPIPv4Destination () 18 | { 19 | DestinationTypeFriendlyNames.RegisterFriendlyName(typeof(TCPIPv4Destination), "TCP"); 20 | } 21 | 22 | public TCPIPv4Destination (Core core, DestinationInfo info) 23 | : base(core, IPAddress.Parse(info.Data[0]), uint.Parse(info.Data[1]), info.IsOpenExternally) 24 | { 25 | } 26 | 27 | public TCPIPv4Destination (Core core, IPAddress ip, uint port, bool isOpenExternally) 28 | : base (core, ip, port, isOpenExternally) 29 | { 30 | } 31 | 32 | public override ITransport CreateTransport (ulong connectionType) 33 | { 34 | return new TcpTransport(IPAddress, (int)Port, connectionType); 35 | } 36 | 37 | public override string ToString () => $"{IPAddress}:{Port}"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/TCPIPv4DestinationSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Meshwork.Backend.Core.Transport; 3 | 4 | namespace Meshwork.Backend.Core.Destination 5 | { 6 | public class TCPIPv4DestinationSource : TCPIPDestinationSource 7 | { 8 | public TCPIPv4DestinationSource(Core core) : base(core) 9 | { 10 | } 11 | 12 | public override Type DestinationType { get; } = typeof(TCPIPv4Destination); 13 | 14 | public override Type ListenerType { get; } = typeof(TcpTransportListener); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/TCPIPv6Destination.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using Meshwork.Backend.Core.Transport; 3 | 4 | namespace Meshwork.Backend.Core.Destination 5 | { 6 | public class TCPIPv6Destination : IPv6Destination 7 | { 8 | static TCPIPv6Destination () 9 | { 10 | DestinationTypeFriendlyNames.RegisterFriendlyName(typeof(TCPIPv6Destination), "TCP (IPv6)"); 11 | } 12 | 13 | public TCPIPv6Destination(Core core, DestinationInfo info) 14 | : base(core, int.Parse(info.Data[1]), IPAddress.Parse(info.Data[0]), uint.Parse(info.Data[2]), info.IsOpenExternally) 15 | { 16 | } 17 | 18 | public TCPIPv6Destination (Core core, int prefixLength, IPAddress ip, uint port, bool isOpenExternally) 19 | : base (core, prefixLength, ip, port, isOpenExternally) 20 | { 21 | } 22 | 23 | public override ITransport CreateTransport (ulong connectionType) 24 | { 25 | return new TcpTransport(IPAddress, (int)Port, connectionType); 26 | } 27 | 28 | public override string ToString () => $"[{IPAddress}/{PrefixLength}]:{Port}"; 29 | } 30 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Destination/TCPIPv6DestinationSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Meshwork.Backend.Core.Destination 4 | { 5 | public class TCPIPv6DestinationSource : TCPIPDestinationSource 6 | { 7 | public TCPIPv6DestinationSource(Core core) : base(core) 8 | { 9 | } 10 | 11 | public override Type DestinationType => typeof(TCPIPv6Destination); 12 | 13 | // We piggyback on TCPIPv4DestinationSource's listener. 14 | public override Type ListenerType => null; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Encryption.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Encryption.cs: Cryptography helper methods 3 | // 4 | // Author: 5 | // Eric Butler 6 | // 7 | // (C) 2005 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.IO; 12 | using System.Security.Cryptography; 13 | using System.Text; 14 | 15 | namespace Meshwork.Backend.Core 16 | { 17 | public static class Encryption 18 | { 19 | public static byte[] Decrypt(ICryptoTransform transform, byte[] buffer) 20 | { 21 | return transform.TransformFinalBlock(buffer, 0, buffer.Length); 22 | } 23 | 24 | public static byte[] Encrypt(ICryptoTransform transform, byte[] buffer) 25 | { 26 | return transform.TransformFinalBlock(buffer, 0, buffer.Length); 27 | } 28 | 29 | public static string PasswordEncrypt (string password, string text, byte[] salt) 30 | { 31 | var passwordBytes = new Rfc2898DeriveBytes(password, salt); 32 | 33 | SymmetricAlgorithm alg = RijndaelManaged.Create(); 34 | alg.Key = passwordBytes.GetBytes(32); 35 | alg.IV = passwordBytes.GetBytes(16); 36 | 37 | var buf = Encoding.UTF8.GetBytes(text); 38 | 39 | using (var ms = new MemoryStream()) { 40 | var encryptStream = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write); 41 | 42 | encryptStream.Write(buf, 0, buf.Length); 43 | encryptStream.Flush(); 44 | encryptStream.Close(); 45 | 46 | return Convert.ToBase64String(ms.ToArray()); 47 | } 48 | } 49 | 50 | public static string PasswordDecrypt(string password, string text, byte[] salt) 51 | { 52 | var bytes = new Rfc2898DeriveBytes(password, salt); 53 | 54 | SymmetricAlgorithm alg = RijndaelManaged.Create(); 55 | alg.Key = bytes.GetBytes(32); 56 | alg.IV = bytes.GetBytes(16); 57 | 58 | var buf = Convert.FromBase64String(text); 59 | 60 | using (var ms = new MemoryStream()) { 61 | var decryptStream = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write); 62 | 63 | decryptStream.Write(buf, 0, buf.Length); 64 | decryptStream.Close(); 65 | 66 | return Encoding.UTF8.GetString(ms.ToArray()); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/IAvatarManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IAvatarManager.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | 12 | namespace Meshwork.Backend.Core 13 | { 14 | public interface IAvatarManager 15 | { 16 | //T GetAvatar (Node node); 17 | //T GetSmallAvatar (Node node); 18 | 19 | event EventHandler AvatarsChanged; 20 | 21 | void UpdateMyAvatar (); 22 | 23 | byte[] GetAvatarBytes (string nodeId); 24 | byte[] GetSmallAvatarBytes (string nodeId); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/INodeConnection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // INodeConnection.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Core { 11 | public interface INodeConnection { 12 | 13 | Node NodeLocal { 14 | get; 15 | set; 16 | } 17 | 18 | Node NodeRemote { 19 | get; 20 | set; 21 | } 22 | 23 | ConnectionState ConnectionState { 24 | get; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/KeyManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | 4 | namespace Meshwork.Backend.Core 5 | { 6 | public class KeyManager 7 | { 8 | private readonly ISettings settings; 9 | private readonly bool _isKeyEncrypted; 10 | 11 | public KeyManager(ISettings settings) 12 | { 13 | this.settings = settings; 14 | } 15 | 16 | public RSAParameters EncryptionParameters 17 | { 18 | get { 19 | if (settings.PrivateKey == null) { 20 | throw new InvalidOperationException(); 21 | } 22 | var rsa = new RSACryptoServiceProvider(); 23 | rsa.FromXmlString(settings.PrivateKey); 24 | return rsa.ExportParameters(true); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Logging/ILogger.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ILogger.cs 3 | // 4 | // Author: 5 | // Michael Hutchinson 6 | // 7 | // Copyright (C) 2007 Novell, Inc (http://www.novell.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Meshwork.Backend.Core.Logging 30 | { 31 | public interface ILogger 32 | { 33 | EnabledLoggingLevel EnabledLevel { get; } 34 | 35 | string Name { get; } 36 | 37 | void Log (LogLevel level, string message); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Logging/LogLevel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogLevel.cs 3 | // 4 | // Author: 5 | // Michael Hutchinson 6 | // 7 | // Copyright (C) 2007 Novell, Inc (http://www.novell.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace Meshwork.Backend.Core.Logging 32 | { 33 | 34 | public enum LogLevel 35 | { 36 | Fatal = 1, 37 | Error = 2, 38 | Warn = 4, 39 | Info = 8, 40 | Debug = 16 41 | } 42 | 43 | [Flags] 44 | public enum EnabledLoggingLevel 45 | { 46 | Fatal = 1, 47 | Error = 2, 48 | Warn = 4, 49 | Info = 8, 50 | Debug = 16, 51 | 52 | None = 0, 53 | 54 | UpToFatal = Fatal, 55 | UpToError = Error | UpToFatal, 56 | UpToWarn = Warn | UpToError, 57 | UpToInfo = Info | UpToWarn, 58 | UpToDebug = Debug | UpToInfo, 59 | 60 | All = UpToDebug 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/NearbyNode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NearbyNode.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Net; 11 | 12 | namespace Meshwork.Backend.Core 13 | { 14 | public class NearbyNode 15 | { 16 | string networkId; 17 | string nodeId; 18 | string nickname; 19 | IPAddress address; 20 | int port; 21 | 22 | public NearbyNode (string networkId, string nodeId, 23 | string nickname, IPAddress address, 24 | int port) 25 | { 26 | this.networkId = networkId; 27 | this.nodeId = nodeId; 28 | this.address = address; 29 | this.port = port; 30 | this.nickname = nickname; 31 | } 32 | 33 | /* 34 | public void AddAddress (IPAddress address) 35 | { 36 | if (address.AddressFamily == AddressFamily.InterNetwork) { 37 | if (IPv4Address.Equals (IPAddress.None)) 38 | IPv4Address = address; 39 | else 40 | throw new Exception ("This node already has an IPv4 address!"); 41 | 42 | return; 43 | } 44 | 45 | if (address.AddressFamily == AddressFamily.InterNetworkV6) { 46 | if (IPv6Address.Equals (IPAddress.None)) 47 | IPv6Address = address; 48 | else 49 | throw new Exception ("This node already has an IPv6 address!"); 50 | 51 | } 52 | 53 | } 54 | */ 55 | 56 | public string NetworkId { 57 | get { 58 | return networkId; 59 | } 60 | } 61 | 62 | public string NodeId { 63 | get { 64 | return nodeId; 65 | } 66 | } 67 | 68 | public string NickName { 69 | get { 70 | return nickname; 71 | } 72 | } 73 | 74 | public IPAddress Address { 75 | get { 76 | return address; 77 | } 78 | } 79 | 80 | public int Port { 81 | get { 82 | return port; 83 | } 84 | } 85 | 86 | /* 87 | public IPAddress IPv4Address { 88 | get { 89 | if (IPv4Address.Equals (IPAddress.None) == false) 90 | return IPv4Address; 91 | else 92 | return null; 93 | } 94 | } 95 | 96 | public IPAddress IPv6Address { 97 | get { 98 | if (IPv6Address.Equals (IPAddress.None) == false) 99 | return IPv6Address; 100 | else 101 | return null; 102 | } 103 | } 104 | */ 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/NetworkInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkInfo.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections.Generic; 11 | using Meshwork.Backend.Core.Protocol; 12 | using Meshwork.Common.Serialization; 13 | 14 | namespace Meshwork.Backend.Core 15 | { 16 | public class NetworkInfo 17 | { 18 | // FIXME: Should be a list/array. 19 | public Dictionary TrustedNodes { get; } = new Dictionary(); 20 | 21 | // FIXME: readonly list!? 22 | public List Memos { get; } = new List(); 23 | 24 | public string NetworkName { get; set; } 25 | 26 | [DontSerialize] 27 | public string NetworkId => Common.Utils.SHA512Str(NetworkName); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/NetworkState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkState.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Backend.Core.Protocol; 11 | 12 | namespace Meshwork.Backend.Core 13 | { 14 | internal class NetworkState 15 | { 16 | public NetworkState (HelloInfo info) 17 | { 18 | KnownConnections = info.KnownConnections; 19 | KnownChatRooms = info.KnownChatRooms; 20 | KnownMemos = info.KnownMemos; 21 | } 22 | 23 | public NetworkState (NodeInfo info) 24 | { 25 | KnownConnections = info.KnownConnections; 26 | KnownChatRooms = info.KnownChatRooms; 27 | KnownMemos = info.KnownMemos; 28 | } 29 | 30 | public ConnectionInfo[] KnownConnections { get; } 31 | 32 | public ChatRoomInfo[] KnownChatRooms { get; } 33 | 34 | public MemoInfo[] KnownMemos { get; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Protocol/MemoInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MemoInfo.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | 12 | namespace Meshwork.Backend.Core.Protocol 13 | { 14 | public struct MemoInfo 15 | { 16 | public MemoInfo (Memo memo) 17 | { 18 | ID = memo.ID; 19 | FromNodeID = memo.Node.NodeID; 20 | CreatedOn = memo.CreatedOn; 21 | Signature = memo.Signature; 22 | Subject = memo.Subject; 23 | Text = memo.Text; 24 | } 25 | 26 | public string ID; 27 | public string FromNodeID; 28 | public DateTime CreatedOn; 29 | public byte[] Signature; 30 | public string Subject; 31 | public string Text; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Protocol/SearchResultInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Backend.Core.Protocol 2 | { 3 | public struct SearchResultInfo 4 | { 5 | public int SearchId; 6 | public string[] Directories; 7 | public SharedFileListing[] Files; 8 | } 9 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/RemoteNodeConnection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RemoteNodeConnection.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Backend.Core.Protocol; 11 | 12 | namespace Meshwork.Backend.Core { 13 | public class RemoteNodeConnection : INodeConnection 14 | { 15 | private Network parentNetwork; 16 | private Node thisNodeLocal; 17 | private Node thisNodeRemote; 18 | 19 | internal RemoteNodeConnection(Network theNetwork) 20 | { 21 | parentNetwork = theNetwork; 22 | } 23 | 24 | internal RemoteNodeConnection(Network theNetwork, ConnectionInfo info) 25 | { 26 | parentNetwork = theNetwork; 27 | thisNodeLocal = parentNetwork.Nodes[info.SourceNodeID]; 28 | thisNodeRemote = parentNetwork.Nodes[info.DestNodeID]; 29 | } 30 | 31 | public ConnectionState ConnectionState { 32 | get { 33 | return ConnectionState.Remote; 34 | } 35 | set { 36 | } 37 | } 38 | 39 | public Node NodeLocal { 40 | get { 41 | return thisNodeLocal; 42 | } 43 | set { 44 | thisNodeLocal = value; 45 | } 46 | } 47 | 48 | public Node NodeRemote { 49 | get { 50 | return thisNodeRemote; 51 | } 52 | set { 53 | thisNodeRemote = value; 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/TextCatalog.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Globalization; 3 | //using System.Resources; 4 | 5 | //namespace FileFind 6 | //{ 7 | // public class TextCatalog 8 | // { 9 | // ResourceManager manager; 10 | 11 | // static TextCatalog () 12 | // { 13 | // manager = ResourceManager.CreateFileBasedResourceManager (baseName, 14 | // resourceDir, 15 | // singResourceSet); 16 | // } 17 | 18 | // public static string GetString (string str) 19 | // { 20 | // return manager.GetString(str); 21 | // } 22 | 23 | // public static string GetString (string str, params string[] args) 24 | // { 25 | // return String.Format(TextCatalog.GetString(str), args); 26 | // } 27 | // } 28 | //} 29 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Transport/AESTransportEncryptor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AESTransportEncryptor.cs: Encrypt transport data using AES 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Security.Cryptography; 12 | 13 | namespace Meshwork.Backend.Core.Transport 14 | { 15 | public class AESTransportEncryptor : ITransportEncryptor 16 | { 17 | int keySize = 32; 18 | int ivSize = 16; 19 | 20 | RijndaelManaged algorithm; 21 | 22 | byte[] keyBytes; 23 | byte[] ivBytes; 24 | 25 | public int KeySize { 26 | get { 27 | return keySize; 28 | } 29 | } 30 | 31 | public int IvSize { 32 | get { 33 | return ivSize; 34 | } 35 | } 36 | 37 | public int KeyExchangeLength { 38 | get { 39 | // XXX: return keySize + ivSize; 40 | return 128; 41 | } 42 | } 43 | 44 | public void SetKey (byte[] keyBytes, byte[] ivBytes) 45 | { 46 | this.keyBytes = keyBytes; 47 | this.ivBytes = ivBytes; 48 | 49 | algorithm = new RijndaelManaged(); 50 | } 51 | 52 | public byte[] Encrypt (byte[] buffer) 53 | { 54 | if (algorithm != null) { 55 | var encryptor = algorithm.CreateEncryptor(keyBytes, ivBytes); 56 | return encryptor.TransformFinalBlock(buffer, 0, buffer.Length); 57 | } 58 | throw new Exception("No key"); 59 | } 60 | 61 | public byte[] Decrypt (byte[] buffer) 62 | { 63 | if (algorithm != null) { 64 | var decryptor = algorithm.CreateDecryptor(keyBytes, ivBytes); 65 | return decryptor.TransformFinalBlock(buffer, 0, buffer.Length); 66 | } 67 | throw new Exception("No key"); 68 | } 69 | 70 | public bool Ready { 71 | get { 72 | return (algorithm != null); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Transport/IMeshworkOperation.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMeshworkOperation.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Core.Transport 11 | { 12 | public interface IMeshworkOperation 13 | { 14 | ITransport Transport { 15 | get; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Transport/ITransport.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ITransport.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Net; 12 | 13 | namespace Meshwork.Backend.Core.Transport 14 | { 15 | public delegate void TransportCallback (ITransport transport); 16 | public delegate void TransportErrorEventHandler (ITransport transport, Exception ex); 17 | 18 | public interface ITransport 19 | { 20 | int Send (byte[] buffer); 21 | int Send (byte[] buffer, int offset, int size); 22 | int Receive (byte[] buffer); 23 | int Receive (byte[] buffer, int offset, int size); 24 | 25 | IAsyncResult BeginSend (byte[] buffer, int offset, int size, AsyncCallback callback, object state); 26 | IAsyncResult BeginReceive (byte[] buffer, int offset, int size, AsyncCallback callback, object state); 27 | 28 | int EndSend (IAsyncResult asyncResult); 29 | int EndReceive (IAsyncResult asyncResult); 30 | 31 | void SendMessage (byte[] buffer); 32 | byte[] ReceiveMessage(); 33 | 34 | IAsyncResult BeginSendMessage (byte[] buffer, AsyncCallback callback, object state); 35 | IAsyncResult BeginReceiveMessage (AsyncCallback callback, object state); 36 | 37 | void EndSendMessage (IAsyncResult asyncResult); 38 | byte[] EndReceiveMessage (IAsyncResult asyncResult); 39 | 40 | void Connect (TransportCallback callback); 41 | 42 | void Disconnect (); 43 | void Disconnect (Exception ex); 44 | 45 | event TransportEventHandler Connected; 46 | event TransportErrorEventHandler Disconnected; 47 | 48 | ITransportEncryptor Encryptor { 49 | get; 50 | set; // XXX: Get rid of this setter 51 | } 52 | 53 | Network Network { 54 | get; 55 | set; 56 | } 57 | 58 | ulong ConnectionType { 59 | get; 60 | set; 61 | } 62 | 63 | bool Incoming { 64 | get; 65 | } 66 | 67 | EndPoint RemoteEndPoint { 68 | get; 69 | } 70 | 71 | TransportState State { 72 | get; 73 | } 74 | 75 | IMeshworkOperation Operation { 76 | get; 77 | set; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Transport/ITransportEncryptor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ITransportEncryptor.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Core.Transport 11 | { 12 | public interface ITransportEncryptor 13 | { 14 | void SetKey (byte[] keyBytes, byte[] ivBytes); 15 | 16 | byte[] Encrypt (byte[] buffer); 17 | byte[] Decrypt (byte[] buffer); 18 | 19 | int KeySize { 20 | get; 21 | } 22 | 23 | int IvSize { 24 | get; 25 | } 26 | 27 | int KeyExchangeLength { 28 | get; 29 | } 30 | 31 | bool Ready { 32 | get; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Transport/ITransportListener.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ITransportListener.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | 12 | namespace Meshwork.Backend.Core.Transport 13 | { 14 | public interface ITransportListener 15 | { 16 | void StartListening (); 17 | void StopListening (); 18 | } 19 | 20 | public class FailedTransportListener 21 | { 22 | public ITransportListener Listener; 23 | public Exception Error; 24 | 25 | public FailedTransportListener (ITransportListener listener, Exception error) 26 | { 27 | Listener = listener; 28 | Error = error; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Core/Transport/TransportState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TransportState.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Core.Transport 11 | { 12 | public enum TransportState 13 | { 14 | Waiting, 15 | Connecting, 16 | Securing, 17 | Connected, 18 | Disconnected 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/AbstractDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AbstractDirectory.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 11 | { 12 | public abstract class AbstractDirectory : IDirectory 13 | { 14 | public IFile GetFile (string name) 15 | { 16 | foreach (var file in Files) { 17 | if (file.Name == name) { 18 | return file; 19 | } 20 | } 21 | return null; 22 | } 23 | 24 | public bool HasFile (string name) 25 | { 26 | foreach (var file in Files) { 27 | if (file.Name == name) { 28 | return true; 29 | } 30 | } 31 | return false; 32 | } 33 | 34 | public IDirectory GetSubdirectory (string name) 35 | { 36 | foreach (var subdir in Directories) { 37 | if (subdir.Name == name) { 38 | return subdir; 39 | } 40 | } 41 | return null; 42 | } 43 | 44 | public abstract string Name { 45 | get; 46 | } 47 | 48 | public virtual long Size { 49 | get { 50 | return (FileCount + DirectoryCount); 51 | } 52 | } 53 | 54 | public virtual string Type { 55 | get { 56 | return "Directory"; 57 | } 58 | } 59 | 60 | public abstract IDirectory Parent { 61 | get; 62 | } 63 | 64 | public virtual string FullPath { 65 | get { return PathUtil.Join(Parent.FullPath, Name); } 66 | } 67 | 68 | public abstract IDirectory[] Directories { 69 | get; 70 | } 71 | 72 | public abstract IFile[] Files { 73 | get; 74 | } 75 | 76 | public abstract int FileCount { 77 | get; 78 | } 79 | 80 | public abstract int DirectoryCount { 81 | get; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/AbstractFile.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AbstractFile.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections.Generic; 11 | 12 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 13 | { 14 | public abstract class AbstractFile : IFile 15 | { 16 | public abstract string InfoHash { 17 | get; 18 | } 19 | 20 | public abstract string SHA1 { 21 | get; 22 | } 23 | 24 | public abstract string[] Pieces { 25 | get; 26 | } 27 | 28 | public abstract int PieceLength { 29 | get; 30 | } 31 | 32 | public virtual string FullPath { 33 | get { return PathUtil.Join(Parent.FullPath, Name); } 34 | } 35 | 36 | public abstract long Size { 37 | get; 38 | } 39 | 40 | public abstract string Name { 41 | get; 42 | } 43 | 44 | public abstract string Type { 45 | get; 46 | } 47 | 48 | public abstract Dictionary Metadata { 49 | get; 50 | } 51 | 52 | public abstract IDirectory Parent { 53 | get; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/IDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IDirectory.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 11 | { 12 | public interface IDirectory : IDirectoryItem 13 | { 14 | IDirectory[] Directories 15 | { 16 | get; 17 | } 18 | 19 | IFile[] Files 20 | { 21 | get; 22 | } 23 | 24 | int FileCount { 25 | get; 26 | } 27 | 28 | int DirectoryCount { 29 | get; 30 | } 31 | 32 | IDirectory GetSubdirectory (string name); 33 | IFile GetFile (string name); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/IDirectoryItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IDirectoryItem.cs: An item in a directory in the Meshwork virtual filesystem. 3 | // 4 | // Author: 5 | // Eric Butler 6 | // 7 | // (C) 2005-2006 FileFind.net (http://filefind.net/) 8 | // 9 | 10 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 11 | { 12 | public interface IDirectoryItem 13 | { 14 | string Name { 15 | get; 16 | } 17 | 18 | long Size { 19 | get; 20 | } 21 | 22 | string Type { 23 | get; 24 | } 25 | 26 | IDirectory Parent { 27 | get; 28 | } 29 | 30 | string FullPath { 31 | get; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/IFile.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IFile.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections.Generic; 11 | 12 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 13 | { 14 | public interface IFile : IDirectoryItem 15 | { 16 | string InfoHash { 17 | get; 18 | } 19 | 20 | string SHA1 { 21 | get; 22 | } 23 | 24 | string[] Pieces { 25 | get; 26 | } 27 | 28 | int PieceLength { 29 | get; 30 | } 31 | 32 | Dictionary Metadata { 33 | get; 34 | } 35 | } 36 | 37 | public enum FileType 38 | { 39 | Audio, 40 | Video, 41 | Image, 42 | Document, 43 | Other 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/ILocalDirectoryItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ILocalDirectoryItem.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 11 | { 12 | public interface ILocalDirectoryItem : IDirectoryItem 13 | { 14 | int Id { 15 | get; 16 | } 17 | 18 | string LocalPath { 19 | get; 20 | } 21 | 22 | void Delete(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/IRemoteDirectoryItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IRemoteDirectoryItem.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Backend.Core; 11 | 12 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 13 | { 14 | public interface IRemoteDirectoryItem 15 | { 16 | Network Network { 17 | get; 18 | } 19 | 20 | Node Node { 21 | get; 22 | } 23 | 24 | string RemoteFullPath { 25 | get; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/MyDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MyDirectory.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 11 | { 12 | public class MyDirectory : LocalDirectory 13 | { 14 | public MyDirectory (FileSystemProvider fileSystem) : base (fileSystem, 0, 0, "local", null, "/local") 15 | { 16 | } 17 | 18 | public override int FileCount { 19 | get { 20 | return (int)LocalFile.CountByParentId(fileSystem, 0); 21 | } 22 | } 23 | 24 | public override int DirectoryCount { 25 | get { 26 | return (int)CountByParentId(fileSystem, 0); 27 | } 28 | 29 | } 30 | 31 | public override IDirectory Parent => fileSystem.RootDirectory; 32 | 33 | public new void InvalidateCache () 34 | { 35 | /* Don't need to do anything */ 36 | } 37 | 38 | public new void Delete () 39 | { 40 | /* Don't allow this */ 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/NetworkDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkDirectory.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections.Generic; 11 | using Meshwork.Backend.Core; 12 | 13 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 14 | { 15 | public class NetworkDirectory : AbstractDirectory 16 | { 17 | Network m_Network; 18 | 19 | public NetworkDirectory (Network network) 20 | { 21 | m_Network = network; 22 | } 23 | 24 | public Network Network { 25 | get { return m_Network; } 26 | } 27 | 28 | public override IDirectory[] Directories { 29 | get { 30 | var directories = new List(); 31 | foreach (var node in m_Network.Nodes.Values) { 32 | if (node != m_Network.LocalNode) 33 | directories.Add(node.Directory); 34 | } 35 | return directories.ToArray(); 36 | } 37 | } 38 | 39 | public override int DirectoryCount { 40 | get { 41 | return m_Network.Nodes.Count - 1; 42 | } 43 | } 44 | 45 | public override int FileCount { 46 | get { return 0; } 47 | } 48 | 49 | public override IFile[] Files { 50 | get { return new IFile[0]; } 51 | } 52 | 53 | public override string Name { 54 | get { return m_Network.NetworkID; } 55 | } 56 | 57 | public override IDirectory Parent { 58 | get { return Network.Core.FileSystem.RootDirectory; } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/NodeDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NodeDirectory.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Backend.Core; 11 | 12 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 13 | { 14 | public class NodeDirectory : RemoteDirectory 15 | { 16 | Node m_Node; 17 | 18 | internal NodeDirectory (Core.Core core, Node node) 19 | : base (core, PathUtil.Join(node.Network.Directory.FullPath, node.NodeID)) 20 | { 21 | m_Node = node; 22 | } 23 | 24 | public override Node Node { 25 | get { 26 | return m_Node; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileBrowsing/Filesystem/RootDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RootDirectory.cs 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2009 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Backend.Feature.FileBrowsing.Filesystem 11 | { 12 | public class RootDirectory : AbstractDirectory 13 | { 14 | private readonly Core.Core core; // FIXME: Remove this 15 | private readonly FileSystemProvider fileSystem; 16 | 17 | private readonly MyDirectory m_MyDirectory; 18 | 19 | internal RootDirectory (Core.Core core, FileSystemProvider fileSystem) 20 | { 21 | this.core = core; 22 | m_MyDirectory = new MyDirectory(fileSystem); 23 | } 24 | 25 | public MyDirectory MyDirectory { 26 | get { 27 | return m_MyDirectory; 28 | } 29 | } 30 | 31 | public override string FullPath { 32 | get { 33 | return "/"; 34 | } 35 | } 36 | 37 | public override IDirectory[] Directories { 38 | get { 39 | var directories = new IDirectory[DirectoryCount]; 40 | directories[0] = MyDirectory; 41 | for (var x = 1; x < directories.Length; x++) { 42 | directories[x] = core.Networks[x - 1].Directory; 43 | } 44 | return directories; 45 | } 46 | } 47 | 48 | public override IFile[] Files { 49 | get { 50 | return new IFile[0]; 51 | } 52 | } 53 | 54 | public override int FileCount { 55 | get { 56 | return 0; 57 | } 58 | } 59 | 60 | public override int DirectoryCount { 61 | get { 62 | return core.Networks.Length + 1; 63 | } 64 | } 65 | 66 | public override string Name { 67 | get { 68 | return "/"; 69 | } 70 | } 71 | 72 | public override IDirectory Parent { 73 | get { 74 | return null; 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileSearch/FileSearchGroup.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FileSearchGroup.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections.Generic; 11 | 12 | namespace Meshwork.Backend.Feature.FileSearch 13 | { 14 | public class FileSearchGroup 15 | { 16 | string name; 17 | List searches; 18 | List groups; 19 | 20 | public FileSearchGroup () 21 | { 22 | searches = new List(); 23 | groups = new List(); 24 | } 25 | 26 | public string Name { 27 | get { 28 | return name; 29 | } 30 | set { 31 | name = value; 32 | } 33 | } 34 | 35 | public List Groups { 36 | get { 37 | return groups; 38 | } 39 | set { 40 | groups = value; 41 | } 42 | } 43 | 44 | public List Searches { 45 | get { 46 | return searches; 47 | } 48 | set { 49 | searches = value; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/BitTorrent/MeshworkPeerConnectionListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Text; 4 | using Meshwork.Backend.Core; 5 | using Meshwork.Backend.Core.Transport; 6 | using MonoTorrent.Client; 7 | using MonoTorrent.Client.Encryption; 8 | 9 | namespace Meshwork.Backend.Feature.FileTransfer.BitTorrent 10 | { 11 | internal class MeshworkPeerConnectionListener : PeerListener 12 | { 13 | private readonly Core.Core core; 14 | 15 | public MeshworkPeerConnectionListener (Core.Core core) 16 | : base (new IPEndPoint (IPAddress.Loopback, 0)) 17 | { 18 | this.core = core; 19 | // Nothing 20 | } 21 | 22 | public override void Start() 23 | { 24 | // Nothing 25 | } 26 | 27 | public override void Stop() 28 | { 29 | // Nothing 30 | } 31 | 32 | public void AddConnection (TorrentConnection connection, TorrentManager manager) 33 | { 34 | var remoteId = string.Empty; 35 | 36 | LoggingService.LogDebug("AddConnection(): Start"); 37 | 38 | if (!connection.IsIncoming) { 39 | // Send my identity. 40 | // XXX: This absolutely needs to be signed. 41 | connection.Transport.SendMessage(Encoding.ASCII.GetBytes(core.MyNodeID)); 42 | 43 | // Get other end's identity. 44 | var message = connection.Transport.ReceiveMessage(); 45 | remoteId = Encoding.ASCII.GetString(message); 46 | 47 | } else { 48 | // Get other end's identity. 49 | var message = connection.Transport.ReceiveMessage(); 50 | remoteId = Encoding.ASCII.GetString(message); 51 | 52 | // Send my identity. 53 | // XXX: This absolutely needs to be signed. 54 | connection.Transport.SendMessage(Encoding.ASCII.GetBytes(core.MyNodeID)); 55 | } 56 | 57 | LoggingService.LogDebug("Pushing connection to engine: {0} - {1}", connection.IsIncoming ? "Incoming" : "Outgoing", 58 | ((TcpTransport)connection.Transport).RemoteEndPoint.ToString()); 59 | 60 | var p = new Peer("", new Uri($"meshwork:{remoteId}"), EncryptionTypes.PlainText); 61 | RaiseConnectionReceived(p, connection, manager); 62 | 63 | LoggingService.LogDebug("AddConnection(): End"); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/BitTorrent/MeshworkTrackerClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoTorrent.Client.Tracker; 3 | 4 | namespace Meshwork.Backend.Feature.FileTransfer.BitTorrent 5 | { 6 | public class MeshworkTracker : Tracker 7 | { 8 | public MeshworkTracker(Uri announceUrl) 9 | : base (announceUrl) 10 | { 11 | CanScrape = false; 12 | } 13 | 14 | 15 | public override void Scrape (ScrapeParameters parameters, object state) 16 | { 17 | throw new NotSupportedException(); 18 | } 19 | 20 | public override void Announce (AnnounceParameters parameters, object state) 21 | { 22 | var e = new AnnounceResponseEventArgs(this, state, true); 23 | RaiseAnnounceComplete(e); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/FileTransferDirection.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Backend.Feature.FileTransfer 2 | { 3 | public enum FileTransferDirection 4 | { 5 | Upload, 6 | Download 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/FileTransferPeerBase.cs: -------------------------------------------------------------------------------- 1 | using Meshwork.Backend.Core; 2 | 3 | namespace Meshwork.Backend.Feature.FileTransfer 4 | { 5 | public abstract class FileTransferPeerBase : IFileTransferPeer 6 | { 7 | protected Network network; 8 | protected Node node; 9 | 10 | public Network Network { 11 | get { 12 | return network; 13 | } 14 | } 15 | 16 | public Node Node { 17 | get { 18 | return node; 19 | } 20 | } 21 | 22 | public abstract ulong UploadSpeed { 23 | get; 24 | } 25 | 26 | public abstract ulong DownloadSpeed { 27 | get; 28 | } 29 | 30 | public abstract FileTransferPeerStatus Status { 31 | get; 32 | } 33 | 34 | public abstract string StatusDetail { 35 | get; 36 | } 37 | 38 | public abstract double Progress { 39 | get; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/FileTransferPeerStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Backend.Feature.FileTransfer 2 | { 3 | /// 4 | ///Possible transfer peer statuses, all received remotely from peer, or 5 | ///infered from what's going on. 6 | /// 7 | public enum FileTransferPeerStatus 8 | { 9 | /// 10 | ///We are trying to connect to peer, or peer is trying to 11 | ///connect to us. 12 | /// 13 | Connecting, 14 | 15 | /// 16 | ///Peer is hasing file. The StatusDetail field will have the 17 | ///percent. 18 | Hashing, 19 | 20 | /// 21 | ///Peer is waiting for us to send them information. 22 | WaitingForInfo, 23 | 24 | /// 25 | ///Peer has this transfer queued. The StatusDetail field will 26 | ///have place this transfer's place in line. 27 | /// 28 | Queued, 29 | 30 | /// 31 | ///Transfer is going. We set this automatically when we start 32 | ///sending/receving data. 33 | /// 34 | Transfering, 35 | 36 | /// 37 | ///Peer has paused transfer. 38 | /// 39 | Paused, 40 | 41 | /// 42 | ///Something went wrong. 43 | /// 44 | Error 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/FileTransferStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Backend.Feature.FileTransfer 2 | { 3 | /// 4 | ///Possible transfer statuses, all set locally 5 | /// 6 | public enum FileTransferStatus 7 | { 8 | ///No peers available 9 | NoPeers, 10 | 11 | ///Waiting for file info 12 | WaitingForInfo, 13 | 14 | ///We have info, connecting or waiting for connection now. 15 | Connecting, 16 | /// 17 | 18 | /// 19 | ///We have peers, but they are all busy (hashing or paused) 20 | /// 21 | AllPeersBusy, 22 | 23 | ///Transfer is queued locally. 24 | Queued, 25 | 26 | /// 27 | ///We are hashing the file, used only when uploading. 28 | /// 29 | Hashing, 30 | 31 | ///Transfer is going. 32 | Transfering, 33 | 34 | ///User has paused transfer 35 | Paused, 36 | 37 | /* 38 | /// 39 | ///Something went horribly wrong, check the Error field for 40 | ///details. 41 | /// 42 | Failed, 43 | */ 44 | 45 | ///User canceled transfer 46 | Canceled, 47 | 48 | ///Transfer completed successfully. 49 | Completed 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/IFileTransferPeer.cs: -------------------------------------------------------------------------------- 1 | using Meshwork.Backend.Core; 2 | 3 | namespace Meshwork.Backend.Feature.FileTransfer 4 | { 5 | public interface IFileTransferPeer 6 | { 7 | ///The Network that Node is part of 8 | Network Network { 9 | get; 10 | } 11 | 12 | ///The remote Node 13 | Node Node { 14 | get; 15 | } 16 | 17 | /// 18 | ///Speed at which we are download data from this peer. 19 | /// 20 | ulong DownloadSpeed { 21 | get; 22 | } 23 | 24 | /// 25 | ///Speed at which we are uploading data to this peer. 26 | /// 27 | ulong UploadSpeed { 28 | get; 29 | } 30 | 31 | /// 32 | ///Percent of the file this peer has. 33 | /// 34 | double Progress { 35 | get; 36 | } 37 | 38 | ///Status of the peer. 39 | FileTransferPeerStatus Status { 40 | get; 41 | } 42 | 43 | /// 44 | ///Extra status information, see FileTransferPeerStatus 45 | ///documentation for details. 46 | /// 47 | string StatusDetail { 48 | get; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Feature/FileTransfer/IFileTransferProvider.cs: -------------------------------------------------------------------------------- 1 | using Meshwork.Backend.Feature.FileBrowsing.Filesystem; 2 | 3 | namespace Meshwork.Backend.Feature.FileTransfer 4 | { 5 | internal interface IFileTransferProvider 6 | { 7 | IFileTransfer CreateFileTransfer(IFile file); 8 | 9 | int GlobalUploadSpeedLimit { 10 | get; 11 | set; 12 | } 13 | 14 | int GlobalDownloadSpeedLimit { 15 | get; 16 | set; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Meshwork.Backend/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Backend")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Backend")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("14D462D1-0164-486E-823B-DC25F1F38EDA")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Client.ConsoleClient/AvatarManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AvatarManager.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.IO; 13 | using Meshwork.Backend.Core; 14 | 15 | namespace Meshwork.Client.Console 16 | { 17 | public class AvatarManager : IAvatarManager 18 | { 19 | public event EventHandler AvatarsChanged; 20 | 21 | private readonly Core core; 22 | 23 | Dictionary avatars = new Dictionary(); 24 | int avatarSize = 0; 25 | 26 | public AvatarManager (Core core) 27 | { 28 | this.core = core; 29 | 30 | foreach (var network in core.Networks) { 31 | AddNetwork (network); 32 | } 33 | 34 | core.NetworkAdded += AddNetwork; 35 | 36 | UpdateMyAvatar (); 37 | } 38 | 39 | private void AddNetwork (Network network) 40 | { 41 | network.LocalNode.AvatarSize = this.avatarSize; 42 | } 43 | 44 | public void UpdateMyAvatar () 45 | { 46 | var fileName = ((Settings)core.Settings).AvatarFile; 47 | if (fileName == null) { 48 | return; 49 | } 50 | 51 | var file = new FileInfo(fileName); 52 | 53 | if (file.Exists) { 54 | var buffer = new byte[file.Length]; 55 | using (var stream = new FileStream(file.FullName, FileMode.Open)) { 56 | stream.Read(buffer, 0, (int)file.Length); 57 | } 58 | 59 | this.avatarSize = (int)file.Length; 60 | avatars[core.MyNodeID] = buffer; 61 | 62 | foreach (var network in core.Networks) { 63 | network.LocalNode.AvatarSize = this.avatarSize; 64 | } 65 | 66 | if (AvatarsChanged != null) { 67 | AvatarsChanged(this, EventArgs.Empty); 68 | } 69 | } 70 | } 71 | 72 | public byte[] GetAvatarBytes (string nodeId) 73 | { 74 | return avatars[nodeId]; 75 | } 76 | 77 | public byte[] GetSmallAvatarBytes (string nodeId) 78 | { 79 | throw new NotImplementedException(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/Meshwork.Client.ConsoleClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Client.Console")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Client.Console")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("3CD7D0AD-15ED-48AE-B324-DCF1BE1B2C14")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Client.ConsoleClient/Settings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using Meshwork.Backend.Core; 5 | using Meshwork.Common.Serialization; 6 | 7 | namespace Meshwork.Client.Console 8 | { 9 | public class Settings : SettingsBase 10 | { 11 | public static Settings ReadSettings (string fileName) 12 | { 13 | if (File.Exists (fileName)) { 14 | var settingsText = File.ReadAllText (fileName); 15 | var result = (Settings)Json.Deserialize(settingsText, typeof(Settings)); 16 | result.FileName = fileName; 17 | return result; 18 | } else { 19 | throw new Exception("Settings file not found: " + fileName); 20 | } 21 | } 22 | 23 | string fileName; 24 | string dataPath; 25 | List adminIDs = new List(); 26 | object moo = new object(); 27 | string avatarFile; 28 | 29 | public string AvatarFile { 30 | get { 31 | return avatarFile; 32 | } 33 | set { 34 | avatarFile = value; 35 | } 36 | } 37 | 38 | public List AdminIDs { 39 | get { 40 | return adminIDs; 41 | } 42 | set { 43 | adminIDs = value; 44 | } 45 | } 46 | 47 | public override string ClientName { 48 | get { 49 | return "Meshwork Daemon client"; 50 | } 51 | } 52 | 53 | public override string ClientVersion { 54 | get { 55 | return "0.1"; 56 | } 57 | } 58 | 59 | public override string OperatingSystem { 60 | get { 61 | return "Linux"; 62 | } 63 | } 64 | 65 | public string FileName { 66 | get { 67 | return fileName; 68 | } 69 | set { 70 | fileName = value; 71 | } 72 | } 73 | 74 | [DontSerialize] 75 | public override string DataPath { 76 | get { 77 | return dataPath; 78 | } 79 | set { dataPath = value; } 80 | } 81 | 82 | public override void SaveSettings () 83 | { 84 | lock (moo) { 85 | File.WriteAllText(FileName, Json.Serialize(this)); 86 | } 87 | } 88 | 89 | [DontSerialize] 90 | public override bool FirstRun 91 | { 92 | get { 93 | return false; // FIXME: !! 94 | } 95 | set 96 | { 97 | // FIXME 98 | } 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/Meshwork.Client.ConsoleClient/SettingsCreator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | using Meshwork.Backend.Core; 5 | 6 | namespace Meshwork.Client.Console 7 | { 8 | public class SettingsCreator 9 | { 10 | public SettingsCreator (string fileName) 11 | { 12 | // Create settings file 13 | var settings = new Settings (); 14 | settings.FileName = fileName; 15 | 16 | System.Console.Write("NickName = "); 17 | settings.NickName = System.Console.ReadLine(); 18 | 19 | System.Console.Write("\nReal Name = "); 20 | settings.RealName = System.Console.ReadLine(); 21 | 22 | System.Console.Write("\nGenerating keypair...."); 23 | 24 | var newKey = new RSACryptoServiceProvider (2048); 25 | settings.PrivateKey = newKey.ToXmlString(true); 26 | 27 | System.Console.Write("Done!\n\nNow you need to define a network.\n\n"); 28 | 29 | var networkInfo = new NetworkInfo(); 30 | 31 | System.Console.Write("Network Name = "); 32 | networkInfo.NetworkName = System.Console.ReadLine(); 33 | 34 | settings.Networks.Add(networkInfo); 35 | 36 | System.Console.WriteLine("All done, saving settings now!"); 37 | 38 | if (fileName.IndexOf(Path.DirectorySeparatorChar) > -1) { 39 | settings.DataPath = fileName.Substring(0, fileName.LastIndexOf(Path.DirectorySeparatorChar)); 40 | } else { 41 | settings.DataPath = Environment.CurrentDirectory; 42 | } 43 | 44 | settings.SaveSettings(); 45 | 46 | System.Console.WriteLine("WARNING: The first person who connects to me will become the admin!"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/DndUtils.cs: -------------------------------------------------------------------------------- 1 | using Gtk; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace Meshwork.Client.GtkClient 5 | { 6 | public static class DndUtils 7 | { 8 | public enum TargetType { 9 | UriList 10 | } 11 | 12 | public static readonly TargetEntry TargetUriList = 13 | new TargetEntry ("text/uri-list", 0, (uint) TargetType.UriList); 14 | 15 | public static string SelectionDataToString (Gtk.SelectionData data) 16 | { 17 | return System.Text.Encoding.UTF8.GetString (data.Data); 18 | } 19 | 20 | public static string [] SplitSelectionData (Gtk.SelectionData data) 21 | { 22 | string s = SelectionDataToString (data); 23 | return SplitSelectionData (s); 24 | } 25 | 26 | public static string [] SplitSelectionData (string data) 27 | { 28 | return Regex.Split (data, "\r\n"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/GtkMeshworkOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GtkMeshworkOptions.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Mono.GetOptions; 11 | 12 | namespace Meshwork.Client.GtkClient 13 | { 14 | public class GtkMeshworkOptions : Options 15 | { 16 | public GtkMeshworkOptions () 17 | { 18 | base.ParsingMode = OptionsParsingMode.GNU_DoubleDash; 19 | } 20 | 21 | [Option ("Modify how the main window is initially displayed. May be 'shown', 'iconified', or 'hidden'", "mainwindow-state")] 22 | public string MainWindowState; 23 | 24 | [Option("Override the default config path", "config-path")] 25 | public string ConfigPath; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/GuiSyncContext.cs: -------------------------------------------------------------------------------- 1 | // GuiSyncContext.cs 2 | // 3 | // Author: 4 | // Lluis Sanchez Gual 5 | // 6 | // Copyright (c) 2005 Novell, Inc (http://www.novell.com) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // 27 | 28 | 29 | namespace Meshwork.Client.GtkClient 30 | { 31 | public class GuiSyncContext: SyncContext 32 | { 33 | public override void Dispatch (StatefulMessageHandler cb, object ob) 34 | { 35 | if (DispatchService.IsGuiThread) 36 | cb (ob); 37 | else 38 | DispatchService.GuiSyncDispatch (cb, ob); 39 | } 40 | 41 | public override void AsyncDispatch (StatefulMessageHandler cb, object ob) 42 | { 43 | if (DispatchService.IsGuiThread) 44 | cb (ob); 45 | else 46 | DispatchService.GuiDispatch (cb, ob); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Menus/ChatMenu.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ChatMenu: Chat room context menu 3 | // 4 | // Author: 5 | // Eric Butler 6 | // 7 | // (C) 2005-2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | using Meshwork.Client.GtkClient.Windows; 13 | using Glade; 14 | using Gtk; 15 | using Meshwork.Backend.Core; 16 | 17 | namespace Meshwork.Client.GtkClient.Menus 18 | { 19 | public class ChatMenu 20 | { 21 | [Widget] MenuItem mnuChatJoinRoom; 22 | [Widget] SeparatorMenuItem mnuChatJoinRoomSeporator; 23 | [Widget] MenuItem mnuChatCreateNewChatroom; 24 | [Widget] Statusbar statusBar; 25 | Gtk.Menu mnuChat; 26 | ChatRoom selectedRoom; 27 | 28 | public ChatMenu () 29 | { 30 | Glade.XML xmlMnuChat = new Glade.XML(null, "Meshwork.Client.GtkClient.meshwork.glade","mnuChat",null); 31 | mnuChat = (xmlMnuChat.GetWidget("mnuChat") as Gtk.Menu); 32 | xmlMnuChat.Autoconnect(this); 33 | } 34 | 35 | public void Popup (ChatRoom selectedRoom) 36 | { 37 | this.selectedRoom = selectedRoom; 38 | mnuChat.Popup (); 39 | } 40 | 41 | private void on_mnuChat_show (object o, EventArgs args) 42 | { 43 | if (selectedRoom != null) { 44 | if (selectedRoom.InRoom == true) { 45 | (mnuChatJoinRoom.Child as Gtk.Label).Markup = "Show " + selectedRoom.Name + ""; 46 | } else { 47 | (mnuChatJoinRoom.Child as Gtk.Label).Markup = "Join " + selectedRoom.Name + ""; 48 | } 49 | mnuChatJoinRoom.Visible = true; 50 | mnuChatJoinRoomSeporator.Visible = true; 51 | } else { 52 | mnuChatJoinRoom.Visible = false; 53 | mnuChatJoinRoomSeporator.Visible = false; 54 | } 55 | } 56 | 57 | public void on_mnuChatJoinRoom_activate (object o, EventArgs e) 58 | { 59 | if (selectedRoom.InRoom == false) { 60 | Gui.JoinChatRoom(selectedRoom); 61 | } else { 62 | (selectedRoom.Properties["Window"] as ChatRoomSubpage).GrabFocus(); 63 | } 64 | } 65 | 66 | public void on_mnuChatCreateNewChatroom_activate (object o, EventArgs e) 67 | { 68 | JoinChatroomDialog w = new JoinChatroomDialog (Gui.MainWindow.Window); 69 | w.Run (); 70 | } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Menus/ChatPageMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Meshwork.Client.GtkClient.Pages; 3 | using Gtk; 4 | 5 | namespace Meshwork.Client.GtkClient.Menus 6 | { 7 | public class ChatPageMenu 8 | { 9 | ChatSubpageBase m_Page; 10 | Menu m_Menu; 11 | 12 | public ChatPageMenu(ChatSubpageBase page) 13 | { 14 | m_Page = page; 15 | m_Menu = new Menu(); 16 | var closeItem = new ImageMenuItem(Stock.Close, null); 17 | closeItem.Activated += HandleCloseItemActivated; 18 | m_Menu.Append(closeItem); 19 | m_Menu.ShowAll(); 20 | } 21 | 22 | public void Popup () 23 | { 24 | m_Menu.Popup(); 25 | } 26 | 27 | void HandleCloseItemActivated(object sender, EventArgs e) 28 | { 29 | m_Page.Close(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Pages/IPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IPage.cs: 3 | // 4 | // Author: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net 8 | // 9 | 10 | using System; 11 | 12 | namespace Meshwork.Client.GtkClient.Pages 13 | { 14 | public interface IPage 15 | { 16 | event EventHandler UrgencyHintChanged; 17 | 18 | bool UrgencyHint { 19 | get; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Pages/NewSearchPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NewSearchPage.cs: 3 | // 4 | // Author: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Widgets; 12 | using Gtk; 13 | 14 | namespace Meshwork.Client.GtkClient.Pages 15 | { 16 | 17 | public class NewSearchPage : Alignment, IPage 18 | { 19 | public event EventHandler UrgencyHintChanged; 20 | 21 | static NewSearchPage instance; 22 | 23 | public static NewSearchPage Instance { 24 | get { 25 | if (instance == null) { 26 | instance = new NewSearchPage(); 27 | } 28 | return instance; 29 | } 30 | } 31 | 32 | Button searchButton; 33 | VBox mainVBox; 34 | FileSearchEntry searchEntry; 35 | 36 | public NewSearchPage () : base (0.5f, 0.5f, 0f, 0f) 37 | { 38 | base.SetPadding(36, 36, 36, 36); 39 | base.FocusGrabbed += base_FocusGrabbed; 40 | 41 | mainVBox = new VBox(); 42 | 43 | Label label = new Label(); 44 | label.Xalign = 0; 45 | label.Markup = "Search for files..."; 46 | mainVBox.PackStart(label, false, false, 0); 47 | label.Show(); 48 | 49 | searchEntry = new FileSearchEntry(); 50 | searchEntry.WidthRequest = 400; 51 | mainVBox.PackStart(searchEntry, false, false, 6); 52 | searchEntry.Show(); 53 | 54 | searchButton = new Button("_Search"); 55 | searchButton.Image = new Image(Stock.Find, IconSize.Button); 56 | searchButton.Clicked += searchButton_Clicked; 57 | searchButton.Show(); 58 | 59 | HButtonBox buttonBox = new HButtonBox(); 60 | buttonBox.Layout = ButtonBoxStyle.End; 61 | buttonBox.PackStart(searchButton, false, false, 0); 62 | mainVBox.PackStart(buttonBox, false, false, 0); 63 | buttonBox.Show(); 64 | 65 | base.Add(mainVBox); 66 | mainVBox.Show(); 67 | } 68 | 69 | public bool UrgencyHint { 70 | get { 71 | return false; 72 | } 73 | } 74 | 75 | private void searchButton_Clicked (object sender, EventArgs args) 76 | { 77 | searchEntry.Activate(); 78 | } 79 | 80 | private void base_FocusGrabbed (object sender, EventArgs args) 81 | { 82 | searchEntry.HasFocus = true; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Client.Gtk")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Client.Gtk")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("4577A0A2-5A95-4E1F-96A9-829B1829FAE9")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/RunOnMainThread.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RunOnMainThread.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Reflection; 11 | using GLib; 12 | 13 | namespace Meshwork.Client.GtkClient 14 | { 15 | public class RunOnMainThread 16 | { 17 | private object methodClass; 18 | private string methodName; 19 | private object[] arguments; 20 | 21 | public static void Run(object methodClass, string methodName, params object[] arguments) 22 | { 23 | new RunOnMainThread(methodClass, methodName, arguments); 24 | } 25 | 26 | public RunOnMainThread(object methodClass, string methodName, params object[] arguments) 27 | { 28 | this.methodClass = methodClass; 29 | this.methodName = methodName; 30 | this.arguments = arguments; 31 | GLib.Idle.Add(new IdleHandler(Go)); 32 | } 33 | 34 | private bool Go() 35 | { 36 | methodClass.GetType().InvokeMember (methodName, BindingFlags.Default | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null,methodClass, arguments); 37 | return false; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/ChatsItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TransfersItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class ChatsItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public ChatsItem () 20 | { 21 | icon = Gui.LoadIcon(16, "internet-group-chat"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "Chats"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return ChatsPage.Instance.ChatCount; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return ChatsPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/ConnectionsItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TransfersItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class ConnectionsItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public ConnectionsItem () 20 | { 21 | icon = Gui.LoadIcon(16, "network-transmit-receive"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "Connections"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return Runtime.Core.TransportManager.TransportCount; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return ConnectionsPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/FileSearchItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FileSearchItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Client.GtkClient.Pages; 11 | using Meshwork.Backend.Feature.FileSearch; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class FileSearchItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | SearchResultsPage pageWidget; 19 | FileSearch search; 20 | 21 | public FileSearchItem (FileSearch search) 22 | { 23 | icon = Gui.LoadIcon(16, "system-search"); 24 | this.search = search; 25 | pageWidget = new SearchResultsPage(search); 26 | } 27 | 28 | public virtual string Name { 29 | get { 30 | return search.Name; 31 | } 32 | } 33 | 34 | public int Count { 35 | get { 36 | return search.Results.Count; 37 | } 38 | } 39 | 40 | public virtual Gdk.Pixbuf Icon { 41 | get { 42 | return icon; 43 | } 44 | } 45 | 46 | public Gtk.Widget PageWidget { 47 | get { 48 | return pageWidget; 49 | } 50 | } 51 | 52 | public FileSearch Search { 53 | get { 54 | return search; 55 | } 56 | } 57 | 58 | public void Destroy () 59 | { 60 | pageWidget.Destroy(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/ISidebarItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ISidebarItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Gdk; 11 | using Gtk; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | public interface ISidebarItem 16 | { 17 | string Name { 18 | get; 19 | } 20 | 21 | int Count { 22 | get; 23 | } 24 | 25 | Pixbuf Icon { 26 | get; 27 | } 28 | 29 | Widget PageWidget { 30 | get; 31 | } 32 | 33 | void Destroy(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/MemosItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TransfersItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class MemosItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public MemosItem () 20 | { 21 | icon = Gui.LoadIcon(16, "mail_generic"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "Memos"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return MemosPage.Instance.MemoCount; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return MemosPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/NetworkOverviewItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ISidebarItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class NetworkOverviewItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public NetworkOverviewItem () 20 | { 21 | icon = Gui.LoadIcon(24, "stock_internet"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "Network Overview"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return -1; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return NetworkOverviewPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/NewSearchItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NewSearchItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class NewSearchItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public NewSearchItem () 20 | { 21 | icon = Gui.LoadIcon(24, "system-search"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "New Search"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return -1; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return NewSearchPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/SeparatorItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ISidebarItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Client.GtkClient.SidebarItems 11 | { 12 | internal class SeparatorItem : ISidebarItem 13 | { 14 | public string Name { 15 | get { 16 | return string.Empty; 17 | } 18 | } 19 | 20 | public int Count { 21 | get { 22 | return -1; 23 | } 24 | } 25 | 26 | public Gdk.Pixbuf Icon { 27 | get { 28 | return null; 29 | } 30 | } 31 | 32 | public Gtk.Widget PageWidget { 33 | get { 34 | return null; 35 | } 36 | } 37 | 38 | public void Destroy () 39 | { 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/StatusItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TransfersItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class StatusItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public StatusItem () 20 | { 21 | icon = Gui.LoadIcon(16, "text-x-generic"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "Status Log"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return -1; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return StatusLogPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/TransfersItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TransfersItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class TransfersItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public TransfersItem () 20 | { 21 | icon = Gui.LoadIcon(16, "go-down"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "File Transfers"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return Runtime.Core.FileTransferManager.Transfers.Count; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return TransfersPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/UserBrowserItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UserBrowserItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Meshwork.Client.GtkClient.Pages; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class UserBrowserItem : ISidebarItem 16 | { 17 | Gdk.Pixbuf icon; 18 | 19 | public UserBrowserItem () 20 | { 21 | icon = Gui.LoadIcon(24, "folder"); 22 | } 23 | 24 | public string Name { 25 | get { 26 | return "File Browser"; 27 | } 28 | } 29 | 30 | public int Count { 31 | get { 32 | return -1; 33 | } 34 | } 35 | 36 | public Gdk.Pixbuf Icon { 37 | get { 38 | return icon; 39 | } 40 | } 41 | 42 | public Gtk.Widget PageWidget { 43 | get { 44 | return UserBrowserPage.Instance; 45 | } 46 | } 47 | 48 | public void Destroy () 49 | { 50 | throw new InvalidOperationException("This should never be destroyed."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/WhatsNewSearchItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WhatsNewSearchItem.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Backend.Core; 11 | using Meshwork.Backend.Feature.FileSearch; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class WhatsNewSearchItem : FileSearchItem 16 | { 17 | Gdk.Pixbuf starPixbuf; 18 | 19 | private static WhatsNewSearchItem instance; 20 | public static WhatsNewSearchItem Instance { 21 | get { 22 | if (instance == null) { 23 | instance = new WhatsNewSearchItem(); 24 | Runtime.Core.FileSearchManager.AddFileSearch(instance.Search); 25 | } 26 | return instance; 27 | } 28 | } 29 | 30 | private WhatsNewSearchItem () : base (new WhatsNewFileSearch(Runtime.Core)) 31 | { 32 | starPixbuf = Gui.LoadIcon(16, "star1"); 33 | } 34 | 35 | public override Gdk.Pixbuf Icon { 36 | get { 37 | return starPixbuf; 38 | } 39 | } 40 | 41 | private class WhatsNewFileSearch : FileSearch 42 | { 43 | public WhatsNewFileSearch (Core core) : base(core) 44 | { 45 | base.Name = "What's New?"; 46 | // XXX: Set query and stuff. 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/SidebarItems/WhatsPopularSearchItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // WhatsPopularSearch.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Meshwork.Backend.Core; 11 | using Meshwork.Backend.Feature.FileSearch; 12 | 13 | namespace Meshwork.Client.GtkClient.SidebarItems 14 | { 15 | internal class WhatsPopularSearchItem : FileSearchItem 16 | { 17 | Gdk.Pixbuf starPixbuf; 18 | 19 | private static WhatsPopularSearchItem instance; 20 | public static WhatsPopularSearchItem Instance { 21 | get { 22 | if (instance == null) { 23 | instance = new WhatsPopularSearchItem(); 24 | Runtime.Core.FileSearchManager.AddFileSearch(instance.Search); 25 | } 26 | return instance; 27 | } 28 | } 29 | 30 | public WhatsPopularSearchItem () : base (new WhatsPopularFileSearch(Runtime.Core)) 31 | { 32 | starPixbuf = Gui.LoadIcon(16, "star1"); 33 | } 34 | 35 | public override Gdk.Pixbuf Icon { 36 | get { 37 | return starPixbuf; 38 | } 39 | } 40 | 41 | private class WhatsPopularFileSearch : FileSearch 42 | { 43 | public WhatsPopularFileSearch (Core core) : base(core) 44 | { 45 | base.Name = "What's Popular?"; 46 | // XXX: Set query and stuff. 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/TrayIcon.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TrayIcon.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // Copyright (C) 2006 FileFind.net 8 | // 9 | 10 | using System; 11 | using Gtk; 12 | using Gdk; 13 | 14 | namespace Meshwork.Client.GtkClient 15 | { 16 | public class TrayIcon 17 | { 18 | Menu trayMenu; 19 | StatusIcon statusIcon = null; 20 | 21 | public TrayIcon () 22 | { 23 | Pixbuf pixbuf = new Pixbuf(null, "Meshwork.Client.GtkClient.tray_icon.png"); 24 | statusIcon = new StatusIcon(pixbuf); 25 | statusIcon.Visible = true; 26 | 27 | trayMenu = (Menu) Runtime.UIManager.GetWidget ("/TrayPopupMenu"); 28 | 29 | statusIcon.PopupMenu += statusIcon_PopupMenu; 30 | statusIcon.Activate += statusIcon_Activate; 31 | } 32 | 33 | private void statusIcon_Activate (object o, EventArgs e) 34 | { 35 | Gui.MainWindow.ToggleVisible (); 36 | } 37 | 38 | private void statusIcon_PopupMenu (object o, PopupMenuArgs args) 39 | { 40 | trayMenu.Show (); 41 | trayMenu.Popup (); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Widgets/FileSearchEntry.cs: -------------------------------------------------------------------------------- 1 | // 2 | // FileSearchEntry.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using Meshwork.Backend.Core; 13 | 14 | namespace Meshwork.Client.GtkClient.Widgets 15 | { 16 | public class FileSearchEntry : SearchEntry 17 | { 18 | Dictionary networkIDs = new Dictionary(); 19 | 20 | public FileSearchEntry () 21 | { 22 | base.EmptyMessage = "Search for files"; 23 | base.WidthRequest = 200; 24 | base.AddFilterOption(0, "All Networks"); 25 | base.AddFilterSeparator(); 26 | base.Activated += searchEntry_Activated; 27 | base.FilterChanged += searchEntry_FilterChanged; 28 | 29 | Runtime.Core.NetworkAdded += Core_NetworkAdded; 30 | 31 | foreach (Network network in Runtime.Core.Networks) { 32 | Core_NetworkAdded(network); 33 | } 34 | } 35 | 36 | public new void Activate () 37 | { 38 | searchEntry_Activated(this, EventArgs.Empty); 39 | } 40 | 41 | private void searchEntry_Activated (object sender, EventArgs args) 42 | { 43 | try { 44 | if (base.ActiveFilterID > 0) { 45 | Runtime.Core.FileSearchManager.NewFileSearch(base.Query, networkIDs[base.ActiveFilterID]); 46 | } else { 47 | Runtime.Core.FileSearchManager.NewFileSearch(base.Query, null); 48 | } 49 | } catch (Exception ex) { 50 | Gui.ShowErrorDialog(ex.Message); 51 | } 52 | 53 | base.Query = string.Empty; 54 | } 55 | 56 | private void searchEntry_FilterChanged (object sender, EventArgs args) 57 | { 58 | SearchEntry entry = (SearchEntry)sender; 59 | 60 | int selectedId = entry.ActiveFilterID; 61 | if (selectedId == 0) { 62 | entry.EmptyMessage = "Search for files"; 63 | } else { 64 | string network = entry.GetLabelForFilterID(selectedId); 65 | entry.EmptyMessage = string.Format("Search '{0}' for files", network); 66 | } 67 | } 68 | 69 | private void Core_NetworkAdded (Network network) 70 | { 71 | base.AddFilterOption(networkIDs.Count + 1, network.NetworkName); 72 | networkIDs[networkIDs.Count + 1] = network.NetworkID; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Widgets/FolderDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Author: John Luke 3 | // License: LGPL 4 | // 5 | 6 | using Gtk; 7 | 8 | namespace Meshwork.Client.GtkClient.Widgets 9 | { 10 | public class FolderDialog : FileSelector 11 | { 12 | public FolderDialog (string title) : base (title, FileChooserAction.SelectFolder) 13 | { 14 | this.SelectMultiple = false; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Widgets/SingleActorStage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SingleActorStage.cs 3 | // 4 | // Author: 5 | // Aaron Bockover 6 | // 7 | // Copyright (C) 2008 Novell, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Meshwork.Client.GtkClient.Widgets 30 | { 31 | public class SingleActorStage : Stage 32 | { 33 | private object target = new object (); 34 | 35 | public SingleActorStage () : base () 36 | { 37 | } 38 | 39 | public SingleActorStage (uint actorDuration) : base (actorDuration) 40 | { 41 | } 42 | 43 | protected override bool OnActorStep (Actor actor) 44 | { 45 | return true; 46 | } 47 | 48 | public void Reset () 49 | { 50 | AddOrReset (target); 51 | } 52 | 53 | public void Reset (uint duration) 54 | { 55 | AddOrReset (target, duration); 56 | } 57 | 58 | public Actor Actor { 59 | get { return this[target]; } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/AboutDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AboutDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Reflection; 11 | using Gtk; 12 | 13 | namespace Meshwork.Client.GtkClient.Windows 14 | { 15 | public class AboutDialog : GladeDialog 16 | { 17 | public AboutDialog (Window parent) : base(parent, "AboutDialog") 18 | { 19 | string title = string.Empty; 20 | string version = string.Empty; 21 | 22 | var assembly = Assembly.GetExecutingAssembly(); 23 | 24 | var titleAttributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 25 | if (titleAttributes.Length > 0) { 26 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)titleAttributes[0]; 27 | if (!string.IsNullOrEmpty(titleAttribute.Title)) { 28 | title = titleAttribute.Title; 29 | } 30 | } 31 | 32 | var versionAttributes = assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false); 33 | if (versionAttributes.Length > 0) { 34 | AssemblyVersionAttribute versionAttribute = (AssemblyVersionAttribute)versionAttributes[0]; 35 | if (!string.IsNullOrEmpty(versionAttribute.Version)) { 36 | version = versionAttribute.Version; 37 | } 38 | } 39 | 40 | Gtk.AboutDialog dialog = (Gtk.AboutDialog)base.Dialog; 41 | 42 | if (!string.IsNullOrEmpty(title)) 43 | dialog.ProgramName = title; 44 | 45 | if (!string.IsNullOrEmpty(version)) 46 | dialog.Version = version; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/AddNetworkDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AddNetworkDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Glade; 11 | using Gtk; 12 | using Meshwork.Backend.Core; 13 | 14 | namespace Meshwork.Client.GtkClient.Windows 15 | { 16 | public class AddNetworkDialog : GladeDialog 17 | { 18 | [Widget] Entry networkNameEntry; 19 | NetworkInfo newNetwork; 20 | 21 | public AddNetworkDialog (Window parentWindow) : base (parentWindow, "AddNetworkDialog") 22 | { 23 | } 24 | 25 | public string NetworkName { 26 | get { 27 | return networkNameEntry.Text; 28 | } 29 | } 30 | 31 | protected override void OnResponded (int responseId) 32 | { 33 | if (responseId == (int)ResponseType.Ok) { 34 | newNetwork = new NetworkInfo (); 35 | newNetwork.NetworkName = NetworkName; 36 | } 37 | } 38 | 39 | public NetworkInfo NetworkInfo { 40 | get { 41 | return newNetwork; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/BadOptionsDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BadOptionsDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Collections; 12 | using Glade; 13 | using Gtk; 14 | 15 | namespace Meshwork.Client.GtkClient.Windows 16 | { 17 | public class BadOptionsDialog : GladeDialog 18 | { 19 | [Widget] TreeView badOptionsTree; 20 | 21 | TreeStore badOptionsTreeStore; 22 | 23 | public BadOptionsDialog (Gtk.Window parent, ArrayList badOptions) : base (parent, "BadOptionsDialog") 24 | { 25 | badOptionsTreeStore = new TreeStore (typeof (string)); 26 | badOptionsTree.Model = badOptionsTreeStore; 27 | badOptionsTree.AppendColumn ("Name", new CellRendererText (), "text", 0); 28 | 29 | badOptionsTree.Selection.SelectFunction = new TreeSelectionFunc (SelectFunc); 30 | 31 | for (int x = 0; x < badOptions.Count; x++) 32 | badOptionsTreeStore.AppendValues (new string[] {badOptions[x].ToString()}); 33 | } 34 | 35 | private void on_btnOk_clicked (object sender, EventArgs e) 36 | { 37 | base.Dialog.Respond((int)Gtk.ResponseType.Ok); 38 | } 39 | 40 | private bool SelectFunc (TreeSelection selection, TreeModel model, TreePath path, bool path_currently_selected) 41 | { 42 | return false; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/ChatRoomInvitationDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ChatRoomInvitationDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Glade; 12 | using Gtk; 13 | using Meshwork.Backend.Core; 14 | using Meshwork.Backend.Core.Protocol; 15 | 16 | namespace Meshwork.Client.GtkClient.Windows 17 | { 18 | public class ChatRoomInvitationDialog : GladeWindow 19 | { 20 | ChatRoom room; 21 | [Widget] Widget messageContainer; 22 | [Widget] Widget passwordInfoBox; 23 | [Widget] Label descLabel; 24 | [Widget] Label messageLabel; 25 | [Widget] Entry passwordEntry; 26 | [Widget] CheckButton showPasswordCheck; 27 | [Widget] Button joinButton; 28 | 29 | ChatInviteInfo invitation; 30 | 31 | public ChatRoomInvitationDialog (Network network, Node inviteFrom, ChatRoom room, ChatInviteInfo invitation) : base ("ChatRoomInvitationDialog") 32 | { 33 | this.room = room; 34 | this.invitation = invitation; 35 | 36 | descLabel.Markup = string.Format(descLabel.Text, GLib.Markup.EscapeText(inviteFrom.ToString()), GLib.Markup.EscapeText(room.Name)); 37 | 38 | messageContainer.Visible = !string.IsNullOrEmpty(invitation.Message); 39 | messageLabel.Text = GLib.Markup.EscapeText(invitation.Message); 40 | 41 | passwordInfoBox.Visible = room.HasPassword; 42 | 43 | passwordEntry.Text = invitation.Password; 44 | showPasswordCheck.Visible = !string.IsNullOrEmpty(invitation.Password); 45 | 46 | Validate(); 47 | } 48 | 49 | private void joinButton_Clicked (object sender, EventArgs args) 50 | { 51 | Window.Destroy(); 52 | Gui.JoinChatRoom(room, passwordEntry.Text); 53 | } 54 | 55 | private void denyButton_Clicked (object sender, EventArgs args) 56 | { 57 | Window.Destroy(); 58 | } 59 | 60 | void HandleShowPasswordCheckToggled (object sender, EventArgs args) 61 | { 62 | passwordEntry.Visibility = showPasswordCheck.Active; 63 | } 64 | 65 | void HandlePasswordEntryChanged (object sender, EventArgs args) 66 | { 67 | Validate(); 68 | } 69 | 70 | void Validate () 71 | { 72 | joinButton.Sensitive = !room.HasPassword || (room.HasPassword && room.TestPassword(passwordEntry.Text)); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/ChatRoomPasswordDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ChatRoomPasswordDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Glade; 12 | using Gtk; 13 | using Meshwork.Backend.Core; 14 | 15 | namespace Meshwork.Client.GtkClient.Windows 16 | { 17 | public class ChatRoomPasswordDialog : GladeDialog 18 | { 19 | [Widget] Label infoLabel; 20 | [Widget] Entry passwordEntry; 21 | [Widget] Label badPasswordLabel; 22 | 23 | ChatRoom room; 24 | 25 | public ChatRoomPasswordDialog (Window parent, ChatRoom room) 26 | : base (parent, "ChatRoomPasswordDialog") 27 | { 28 | this.room = room; 29 | infoLabel.Markup = "" + string.Format(infoLabel.Text, room.Name) + ""; 30 | } 31 | 32 | private void on_okbutton_clicked (object sender, EventArgs args) 33 | { 34 | if (room.TestPassword(passwordEntry.Text) == false) { 35 | badPasswordLabel.Visible = true; 36 | passwordEntry.GrabFocus(); 37 | Dialog.Respond((int)ResponseType.None); 38 | } 39 | } 40 | 41 | private void on_passwordEntry_changed (object sender, EventArgs args) 42 | { 43 | if (badPasswordLabel.Visible == true) { 44 | badPasswordLabel.Visible = false; 45 | } 46 | } 47 | 48 | public string Password 49 | { 50 | get { 51 | return passwordEntry.Text; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/DownloadPublicKeyDialog.cs: -------------------------------------------------------------------------------- 1 | // created on 05/31/2004 at 19:55 2 | 3 | using System; 4 | using System.Net; 5 | using Glade; 6 | using Gtk; 7 | 8 | namespace Meshwork.Client.GtkClient.Windows 9 | { 10 | public class DownloadPublicKeyDialog : GladeDialog 11 | { 12 | public string result = ""; 13 | 14 | [Widget] Entry txtUrl; 15 | 16 | public DownloadPublicKeyDialog (Window parentWindow) : base (parentWindow, "DownloadPublicKeyDialog") 17 | { 18 | } 19 | 20 | public string Result { 21 | get { 22 | return result; 23 | } 24 | } 25 | 26 | private void downloadButton_Clicked (object sender, EventArgs e) 27 | { 28 | if (txtUrl.Text.Trim() != "") { 29 | try { 30 | using (WebClient web = new WebClient()) { 31 | byte[] b = web.DownloadData(txtUrl.Text); 32 | result = System.Text.Encoding.Default.GetString(b); 33 | base.Dialog.Respond(ResponseType.Ok); 34 | } 35 | } 36 | catch { 37 | Gui.ShowMessageDialog ("Invalid URL.", base.Dialog, Gtk.MessageType.Error, Gtk.ButtonsType.Ok); 38 | base.Dialog.Respond(ResponseType.None); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/GenerateKeyDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GenerateKeyDialog.cs: Key generation status dialog 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // Copyright (C) 2005 FileFind.net 8 | // 9 | 10 | using System; 11 | using System.Threading; 12 | using Glade; 13 | using Gtk; 14 | 15 | namespace Meshwork.Client.GtkClient.Windows 16 | { 17 | public class GenerateKeyDialog : GladeDialog 18 | { 19 | bool keyGenerated = false; 20 | 21 | [Widget] ProgressBar generateKeyProgress; 22 | 23 | string key; 24 | 25 | public GenerateKeyDialog (Gtk.Window parent) : base (parent, "GenerateKeyDialog") 26 | { 27 | base.Dialog.ActionArea.Visible = false; 28 | } 29 | 30 | public override int Run() 31 | { 32 | 33 | GLib.Timeout.Add (50, new GLib.TimeoutHandler (PulseGenerateKeyProgress)); 34 | 35 | Thread thread = new Thread (new ThreadStart (GenerateKey)); 36 | thread.Start (); 37 | 38 | return base.Run(); 39 | } 40 | 41 | public string Key { 42 | get { 43 | if (keyGenerated == true) 44 | return key; 45 | else 46 | throw new InvalidOperationException (); 47 | } 48 | } 49 | 50 | private bool PulseGenerateKeyProgress () 51 | { 52 | generateKeyProgress.Pulse (); 53 | 54 | return !keyGenerated; 55 | } 56 | 57 | private void GenerateKey () 58 | { 59 | System.Security.Cryptography.RSACryptoServiceProvider newKey; 60 | newKey = new System.Security.Cryptography.RSACryptoServiceProvider (2048); 61 | key = newKey.ToXmlString(true); 62 | keyGenerated = true; 63 | 64 | Gtk.Application.Invoke(delegate { 65 | FinishedGeneratingKey(); 66 | }); 67 | } 68 | 69 | private void FinishedGeneratingKey () 70 | { 71 | base.Dialog.Respond(ResponseType.Ok); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/GladeDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GladeDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Gtk; 12 | 13 | namespace Meshwork.Client.GtkClient.Windows 14 | { 15 | public abstract class GladeDialog : GladeWindow 16 | { 17 | Dialog dialog; 18 | 19 | public GladeDialog (Window parentWindow, string dialogName) : base (dialogName) 20 | { 21 | dialog = (Dialog)base.Window; 22 | dialog.Modal = true; 23 | dialog.WindowPosition = WindowPosition.CenterOnParent; 24 | dialog.TransientFor = parentWindow; 25 | 26 | // Dialog button order is reversed on windows 27 | if (Environment.OSVersion.Platform != PlatformID.Unix) { 28 | if (dialog.ActionArea != null) { 29 | HButtonBox box = dialog.ActionArea; 30 | int count = 0; 31 | foreach (Widget widget in box.AllChildren) { 32 | box.ReorderChild (widget, ++count); 33 | } 34 | } 35 | } 36 | } 37 | 38 | public virtual int Run () 39 | { 40 | base.Show(); 41 | 42 | int result = (int)ResponseType.None; 43 | do { 44 | result = dialog.Run (); 45 | } while (result == (int)ResponseType.None); 46 | 47 | OnResponded (result); 48 | 49 | base.Close(); 50 | 51 | return result; 52 | } 53 | 54 | public override void Show () 55 | { 56 | this.Run(); 57 | } 58 | 59 | protected Dialog Dialog { 60 | get { 61 | return dialog; 62 | } 63 | } 64 | 65 | protected virtual void OnResponded (int responseId) 66 | { 67 | 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/GladeWindow.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GladeWindow.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using System.Reflection; 12 | using Glade; 13 | using Gtk; 14 | 15 | namespace Meshwork.Client.GtkClient.Windows 16 | { 17 | public delegate void UrgentChangedEventHandler (GladeWindow window, bool urgent); 18 | 19 | public abstract class GladeWindow 20 | { 21 | protected event EventHandler Closed; 22 | XML xml; 23 | Window window; 24 | 25 | public GladeWindow (string windowName) : this (null, "Meshwork.Client.GtkClient.meshwork.glade", windowName) 26 | { 27 | } 28 | 29 | public GladeWindow (Assembly assembly, string resourceName, string windowName) 30 | { 31 | xml = new XML (assembly, resourceName, windowName, null); 32 | xml.Autoconnect (this); 33 | window = (Window)xml[windowName]; 34 | window.DeleteEvent += window_DeleteEvent; 35 | } 36 | 37 | public virtual void Show () 38 | { 39 | window.Show(); 40 | window.Present(); 41 | } 42 | 43 | public virtual void Close () 44 | { 45 | window.Hide(); 46 | if (Closed != null) { 47 | Closed(this, EventArgs.Empty); 48 | } 49 | } 50 | 51 | public virtual bool ToggleVisible () 52 | { 53 | return (window.Visible = !window.Visible); 54 | } 55 | 56 | public bool IsVisible { 57 | get { 58 | return window.Visible; 59 | } 60 | } 61 | 62 | public Window Window { 63 | get { 64 | return window; 65 | } 66 | } 67 | 68 | protected void SetUrgent () 69 | { 70 | Gui.SetWindowUrgencyHint (window, true); 71 | } 72 | 73 | protected void SetNotUrgent () 74 | { 75 | Gui.SetWindowUrgencyHint (window, false); 76 | } 77 | 78 | protected Gdk.Pixbuf Icon { 79 | get { 80 | return window.Icon; 81 | } 82 | set { 83 | window.Icon = value; 84 | } 85 | } 86 | 87 | protected Widget GetWidget (string name) 88 | { 89 | return xml.GetWidget(name); 90 | } 91 | 92 | protected virtual void window_DeleteEvent (object sender, DeleteEventArgs args) 93 | { 94 | args.RetVal = true; 95 | Close(); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/SplashWindow.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SplashWindow.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Glade; 11 | using Gtk; 12 | 13 | namespace Meshwork.Client.GtkClient.Windows 14 | { 15 | public class SplashWindow : GladeWindow 16 | { 17 | [Widget] Image splashImage; 18 | 19 | public SplashWindow() : base ("SplashWindow") 20 | { 21 | splashImage.Pixbuf = new Gdk.Pixbuf(null, "Meshwork.Client.GtkClient.meshwork.png"); 22 | } 23 | 24 | public new void Show() 25 | { 26 | base.Show(); 27 | 28 | base.Window.QueueDraw(); 29 | 30 | while (Application.EventsPending()) 31 | Application.RunIteration(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Meshwork.Client.GtkClient/Windows/StartupProblemsDialog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // StartupProblemsDialog.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using Glade; 11 | using Gtk; 12 | using Meshwork.Backend.Core.Transport; 13 | 14 | namespace Meshwork.Client.GtkClient.Windows 15 | { 16 | public class StartupProblemsDialog : GladeDialog 17 | { 18 | [Widget] TreeView tree; 19 | 20 | ListStore store; 21 | 22 | public StartupProblemsDialog () : base (Gui.MainWindow.Window, "StartupProblemsDialog") 23 | { 24 | store = new ListStore(typeof(string), typeof(string)); 25 | 26 | tree.AppendColumn("Object", new CellRendererText(), "text", 0); 27 | tree.AppendColumn("Error", new CellRendererText(), "text", 1); 28 | tree.Model = store; 29 | 30 | foreach (FailedTransportListener failedListenerInfo in Runtime.Core.FailedTransportListeners) { 31 | store.AppendValues(failedListenerInfo.Listener.ToString(), failedListenerInfo.Error.Message); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Meshwork.Common/IPAddressExtensions.cs: -------------------------------------------------------------------------------- 1 | // http://blogs.msdn.com/knom/archive/2008/12/31/ip-address-calculations-with-c-subnetmasks-networks.aspx 2 | 3 | using System; 4 | using System.Net; 5 | 6 | namespace Meshwork.Common 7 | { 8 | public static class IPAddressExtensions 9 | { 10 | public static IPAddress GetBroadcastAddress (this IPAddress address, IPAddress subnetMask) 11 | { 12 | var ipAdressBytes = address.GetAddressBytes(); 13 | var subnetMaskBytes = subnetMask.GetAddressBytes(); 14 | 15 | if (ipAdressBytes.Length != subnetMaskBytes.Length) 16 | throw new ArgumentException("Lengths of IP address and subnet mask do not match."); 17 | 18 | var broadcastAddress = new byte[ipAdressBytes.Length]; 19 | for (var i = 0; i < broadcastAddress.Length; i++) { 20 | broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255)); 21 | } 22 | return new IPAddress(broadcastAddress); 23 | } 24 | 25 | public static IPAddress GetNetworkAddress (this IPAddress address, IPAddress subnetMask) 26 | { 27 | var ipAdressBytes = address.GetAddressBytes(); 28 | var subnetMaskBytes = subnetMask.GetAddressBytes(); 29 | 30 | if (ipAdressBytes.Length != subnetMaskBytes.Length) 31 | throw new ArgumentException("Lengths of IP address and subnet mask do not match."); 32 | 33 | var broadcastAddress = new byte[ipAdressBytes.Length]; 34 | for (var i = 0; i < broadcastAddress.Length; i++) { 35 | broadcastAddress[i] = (byte)(ipAdressBytes[i] & (subnetMaskBytes[i])); 36 | } 37 | return new IPAddress(broadcastAddress); 38 | } 39 | 40 | public static bool IsInSameSubnet (this IPAddress address2, IPAddress address, IPAddress subnetMask) 41 | { 42 | IPAddress network1 = address.GetNetworkAddress(subnetMask); 43 | IPAddress network2 = address2.GetNetworkAddress(subnetMask); 44 | 45 | return network1.Equals(network2); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/Meshwork.Common/IPv6Util.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IPv6Util.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006-2008 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Net; 11 | 12 | namespace Meshwork.Common 13 | { 14 | public class IPv6Util 15 | { 16 | public static string GetNetworkPrefix (int prefixLength, IPAddress address) 17 | { 18 | var bytes = address.GetAddressBytes (); 19 | var prefix = ""; 20 | for (var y = 0; y < (prefixLength / 8); y += 2) { 21 | if (y > 0) prefix += ":"; 22 | prefix += EndianBitConverter.ToString (bytes, y,2).Replace ("-",""); 23 | } 24 | 25 | for (long y = (prefixLength / 8); y < bytes.Length; y+=2) 26 | prefix += ":0000"; 27 | 28 | prefix += "/" + prefixLength; 29 | 30 | return prefix.ToLower(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Meshwork.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Common")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("592E20C9-16CB-431C-8BAC-879FDAE9EF14")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Common/Serialization/DontSerializeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Meshwork.Common.Serialization 4 | { 5 | public class DontSerializeAttribute : Attribute 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /src/Meshwork.Common/Serialization/JSON.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Serialization.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System; 11 | using Newtonsoft.Json; 12 | 13 | namespace Meshwork.Common.Serialization 14 | { 15 | public static class Json 16 | { 17 | public static string Serialize (object obj) 18 | { 19 | return JsonConvert.SerializeObject(obj); 20 | } 21 | 22 | public static object Deserialize (string json, Type type) 23 | { 24 | return JsonConvert.DeserializeObject(json, type); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Meshwork.Common/StringWriterWithEncoding.cs: -------------------------------------------------------------------------------- 1 | // 2 | // StringWriterWithEncoding.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.IO; 11 | using System.Text; 12 | 13 | namespace Meshwork.Common 14 | { 15 | public class StringWriterWithEncoding : StringWriter 16 | { 17 | private Encoding m_encoding; 18 | 19 | public StringWriterWithEncoding(StringBuilder sb, Encoding encoding) : base (sb) 20 | { 21 | m_encoding = encoding; 22 | } 23 | 24 | public override Encoding Encoding { 25 | get { 26 | return m_encoding; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Meshwork.Common/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Meshwork.Library.CRC/HashAlgorithmParameters.cs: -------------------------------------------------------------------------------- 1 | // $Id: HashAlgorithmParameters.cs 2 2004-06-25 23:07:43Z jayclassless $ 2 | 3 | #region License 4 | /* ***** BEGIN LICENSE BLOCK ***** 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is Classless.Hasher - C#/.NET Hash and Checksum Algorithm Library. 18 | * 19 | * The Initial Developer of the Original Code is Classless.net. 20 | * Portions created by the Initial Developer are Copyright (C) 2004 the Initial 21 | * Developer. All Rights Reserved. 22 | * 23 | * Contributor(s): 24 | * Jason Simeone (jay@classless.net) 25 | * 26 | * ***** END LICENSE BLOCK ***** */ 27 | #endregion 28 | 29 | namespace Meshwork.Library.CRC { 30 | /// An abstract class that represents the parameters necessary to initialize a hashing algorithm. 31 | abstract public class HashAlgorithmParameters { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Meshwork.Library.CRC/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Library.CRC")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Library.CRC")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("86CEC195-22E0-4CA9-8B17-16C01A0C3647")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Hyena/Data/Sqlite/FileTypeQueryValue.cs: -------------------------------------------------------------------------------- 1 | using Meshwork.Library.Hyena.Query; 2 | using Mono.Unix; 3 | 4 | namespace Meshwork.Library.Hyena.Data.Sqlite 5 | { 6 | public class FileTypeQueryValue : ExactStringQueryValue 7 | { 8 | // Don't do substring comparisons on type field since it's currently only 'D' or 'F', 9 | // but make the ":", "!:" and "=" operators still work. 10 | public new static readonly Operator Equal = new Operator ("equals", Catalog.GetString ("is"), "= '{0}'", ":", "="); 11 | public new static readonly Operator NotEqual = new Operator ("notEqual", Catalog.GetString ("is not"), "!= '{0}'", true, "!:"); 12 | 13 | public override AliasedObjectSet OperatorSet { 14 | get { 15 | return new AliasedObjectSet(Equal, NotEqual, StringQueryValue.Equal, StringQueryValue.NotEqual); 16 | } 17 | } 18 | 19 | public override void ParseUserQuery (string input) 20 | { 21 | if (input == "directory" || input == "dir" || input == "d" || input == "folder") { 22 | input = "D"; 23 | } else { 24 | input = "F"; 25 | } 26 | base.ParseUserQuery(input); 27 | } 28 | 29 | public override string ToSql (Operator op) 30 | { 31 | return string.IsNullOrEmpty (value) ? null : EscapeString (op, value); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Hyena/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Library.Hyena")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Library.Hyena")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("4F89B3C4-2837-4020-9D91-96AAC8718911")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Hyena/Query/ExactStringQueryValue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ExactStringQueryValue.cs 3 | // 4 | // Authors: 5 | // John Millikin 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining 8 | // a copy of this software and associated documentation files (the 9 | // "Software"), to deal in the Software without restriction, including 10 | // without limitation the rights to use, copy, modify, merge, publish, 11 | // distribute, sublicense, and/or sell copies of the Software, and to 12 | // permit persons to whom the Software is furnished to do so, subject to 13 | // the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be 16 | // included in all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | // 26 | 27 | namespace Meshwork.Library.Hyena.Query 28 | { 29 | // A query value that requires the string match exactly 30 | public class ExactStringQueryValue : StringQueryValue 31 | { 32 | public override string ToSql (Operator op) 33 | { 34 | return string.IsNullOrEmpty (value) ? null : EscapeString (op, value.ToLower ()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Hyena/Query/IntegerKeyedObjectQueryValue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IntegerKeyedObjectQueryValue.cs 3 | // 4 | // Authors: 5 | // Scott Peterson 6 | // 7 | // Copyright (C) 2008 Scott Peterson 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace Meshwork.Library.Hyena.Query 30 | { 31 | public abstract class IntegerKeyedObjectQueryValue : IntegerQueryValue where T : class 32 | { 33 | private T object_value; 34 | 35 | public override void SetValue (long value) 36 | { 37 | object_value = null; 38 | base.SetValue (value); 39 | } 40 | 41 | public T ObjectValue { 42 | get { 43 | if (object_value == null) { 44 | object_value = Resolve (); 45 | } 46 | return object_value; 47 | } 48 | } 49 | 50 | protected abstract T Resolve (); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Hyena/Query/QueryFieldSet.cs: -------------------------------------------------------------------------------- 1 | // 2 | // QueryFieldSet.cs 3 | // 4 | // Authors: 5 | // Gabriel Burt 6 | // Aaron Bockover 7 | // 8 | // Copyright (C) 2007-2008 Novell, Inc. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining 11 | // a copy of this software and associated documentation files (the 12 | // "Software"), to deal in the Software without restriction, including 13 | // without limitation the rights to use, copy, modify, merge, publish, 14 | // distribute, sublicense, and/or sell copies of the Software, and to 15 | // permit persons to whom the Software is furnished to do so, subject to 16 | // the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be 19 | // included in all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | namespace Meshwork.Library.Hyena.Query 31 | { 32 | public class QueryFieldSet : AliasedObjectSet 33 | { 34 | public QueryFieldSet (params QueryField [] fields) : base (fields) 35 | { 36 | } 37 | 38 | public QueryField [] Fields { 39 | get { return Objects; } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Hyena/Query/QueryParser.cs: -------------------------------------------------------------------------------- 1 | // 2 | // QueryParser.cs 3 | // 4 | // Author: 5 | // Aaron Bockover 6 | // Gabriel Burt 7 | // 8 | // Copyright (C) 2007 Novell, Inc. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining 11 | // a copy of this software and associated documentation files (the 12 | // "Software"), to deal in the Software without restriction, including 13 | // without limitation the rights to use, copy, modify, merge, publish, 14 | // distribute, sublicense, and/or sell copies of the Software, and to 15 | // permit persons to whom the Software is furnished to do so, subject to 16 | // the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be 19 | // included in all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | using System.IO; 31 | using System.Text; 32 | 33 | namespace Meshwork.Library.Hyena.Query 34 | { 35 | public abstract class QueryParser 36 | { 37 | protected StreamReader reader; 38 | 39 | public QueryParser() 40 | { 41 | Reset (); 42 | } 43 | 44 | public QueryParser(string inputQuery) : this(new MemoryStream(Encoding.UTF8.GetBytes(inputQuery))) 45 | { 46 | } 47 | 48 | public QueryParser(Stream stream) : this(new StreamReader(stream)) 49 | { 50 | } 51 | 52 | public QueryParser(StreamReader reader) : this() 53 | { 54 | InputReader = reader; 55 | } 56 | 57 | public abstract QueryNode BuildTree (QueryFieldSet fieldSet); 58 | public abstract void Reset (); 59 | 60 | public StreamReader InputReader { 61 | get { return reader; } 62 | set { reader = value; } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/AddressAttributeBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | 5 | namespace Meshwork.Library.Stun 6 | { 7 | public class AddressAttributeBase : MessageAttribute 8 | { 9 | private readonly AddressFamily addressFamily; 10 | private readonly int port; 11 | private readonly IPAddress address; 12 | 13 | public AddressAttributeBase (MessageAttributeType type) : base (type) 14 | { 15 | 16 | } 17 | 18 | public AddressAttributeBase (MessageAttributeType type, byte[] data) : base (type) 19 | { 20 | var familyBytes = new byte[1]; 21 | Array.Copy (data, 1, familyBytes, 0, 1); 22 | 23 | if (familyBytes[0] != 0x01) 24 | throw new Exception ("Invalid network family!"); 25 | addressFamily = AddressFamily.InterNetwork; 26 | 27 | var portBytes = new byte [2]; 28 | Array.Copy (data, 2, portBytes, 0, 2); 29 | port = Utility.TwoBytesToInteger (portBytes); 30 | 31 | var addressBytes = new byte [4]; 32 | Array.Copy (data, 4, addressBytes, 0, 4); 33 | address = new IPAddress (BitConverter.ToInt32 (addressBytes, 0)); 34 | } 35 | 36 | public IPAddress Address { 37 | get { 38 | return address; 39 | } 40 | } 41 | 42 | public int Port { 43 | get { 44 | return port; 45 | } 46 | } 47 | 48 | public AddressFamily AddressFamily { 49 | get { 50 | return addressFamily; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/ChangeRequestAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Library.Stun 2 | { 3 | public class ChangeRequestAttribute : MessageAttribute 4 | { 5 | public ChangeRequestAttribute (bool changeIP, bool changePort) : base (MessageAttributeType.ChangeRequest) 6 | { 7 | var valueBuffer = new byte [4]; 8 | Value = valueBuffer; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/MappedAddressAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Library.Stun 2 | { 3 | public class MappedAddressAttribute : AddressAttributeBase 4 | { 5 | 6 | 7 | public MappedAddressAttribute () : base (MessageAttributeType.MappedAddress) 8 | { 9 | } 10 | 11 | public MappedAddressAttribute (byte[] data) : base (MessageAttributeType.MappedAddress, data) 12 | { 13 | 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/MessageAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Meshwork.Library.Stun 5 | { 6 | public abstract class MessageAttribute 7 | { 8 | public static Dictionary TypeTable; 9 | 10 | static MessageAttribute () 11 | { 12 | TypeTable = new Dictionary (); 13 | TypeTable.Add (MessageAttributeType.MappedAddress, typeof (MappedAddressAttribute)); 14 | TypeTable.Add (MessageAttributeType.SourceAddress, typeof (SourceAddressAttribute)); 15 | } 16 | 17 | 18 | public MessageAttribute (MessageAttributeType type) 19 | { 20 | this.type = type; 21 | } 22 | 23 | MessageAttributeType type; 24 | protected byte[] Value; 25 | 26 | public int Length { 27 | get { 28 | return Value.Length + 32; 29 | } 30 | } 31 | 32 | public byte[] GetBytes () 33 | { 34 | var buffer = new byte [Value.Length + 32]; 35 | 36 | var index = 0; 37 | 38 | Array.Copy (BitConverter.GetBytes ((ushort)type), 0, buffer, index, 2); 39 | index += 2; 40 | 41 | Array.Copy (BitConverter.GetBytes ((ushort)Value.Length - 32), 0, buffer, index, 2); 42 | index += 2; 43 | 44 | Array.Copy (Value, 0, buffer, index, Value.Length); 45 | index += Value.Length; 46 | 47 | return buffer; 48 | } 49 | } 50 | 51 | public enum MessageAttributeType : ushort 52 | { 53 | MappedAddress = 0x0001, 54 | ResponseAddress = 0x0002, 55 | ChangeRequest = 0x0003, 56 | SourceAddress = 0x0004, 57 | ChangedAddress = 0x0005, 58 | Username = 0x0006, 59 | Password = 0x0007, 60 | MessageIntegrity = 0x0008, 61 | ErrorCode = 0x0009, 62 | UnknownAttributes = 0x00a, 63 | ReflectedFrom = 0x00b 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/MessageType.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Library.Stun 2 | { 3 | public enum MessageType 4 | { 5 | BindingRequest = 0x0001, 6 | BindingResponse = 0x0101, 7 | BindingErrorResponse = 0x0111, 8 | SharedSecretRequest = 0x0002, 9 | SharedSecretResponse = 0x0102, 10 | SharedSecretErrorResponse = 0x0112 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Library.Stun")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Library.Stun")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("01539583-6736-4E2C-933B-09F7F9CCD2C5")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/SourceAddressAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Library.Stun 2 | { 3 | public class SourceAddressAttribute : AddressAttributeBase 4 | { 5 | public SourceAddressAttribute () : base (MessageAttributeType.SourceAddress) 6 | { 7 | } 8 | 9 | public SourceAddressAttribute (byte[] data) : base (MessageAttributeType.SourceAddress, data) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/StunClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | 5 | namespace Meshwork.Library.Stun 6 | { 7 | public class StunClient 8 | { 9 | static string stunServer = "stun.ekiga.net"; 10 | public static string StunServer { 11 | get { 12 | return stunServer; 13 | } 14 | set { 15 | stunServer = value; 16 | } 17 | } 18 | 19 | public static IPAddress GetExternalAddress () 20 | { 21 | var entry = Dns.GetHostEntry (stunServer); 22 | var endPoint = new IPEndPoint (entry.AddressList [0], 3478); 23 | var client = new UdpClient (); 24 | client.Connect (endPoint); 25 | 26 | var header = new MessageHeader (); 27 | header.MessageType = MessageType.BindingRequest; 28 | 29 | var bytes = header.GetBytes (); 30 | client.Send (bytes, bytes.Length); 31 | 32 | bytes = client.Receive (ref endPoint); 33 | 34 | header = new MessageHeader (bytes); 35 | if (header.MessageType == MessageType.BindingResponse) { 36 | foreach (var attribute in header.MessageAttributes) { 37 | if (attribute is MappedAddressAttribute) { 38 | return (attribute as AddressAttributeBase).Address; 39 | } 40 | } 41 | throw new Exception ("Resposne was missing Mapped-address!"); 42 | } 43 | throw new Exception ("Wrong response message!"); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Meshwork.Library.Stun/Utility.cs: -------------------------------------------------------------------------------- 1 | namespace Meshwork.Library.Stun 2 | { 3 | public class Utility 4 | { 5 | public static byte[] IntegerToTwoBytes (int integer) 6 | { 7 | var result = new byte [2]; 8 | result [0] = (byte) (integer >> 8); 9 | result [1] = (byte) integer; 10 | return result; 11 | } 12 | 13 | public static int TwoBytesToInteger (byte[] bytes) 14 | { 15 | return ((bytes[0] << 8) + bytes[1]); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Meshwork.Platform.Linux/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Platform.Linux")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Platform.Linux")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("699E3784-28E7-490D-96F1-FFEBCAF930B9")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Platform.MacOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Platform.MacOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Platform.MacOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("920ABE15-340F-4BF4-80D7-F49CB940E5F2")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Platform.Windows/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Platform.Windows")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Platform.Windows")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("84CB86DC-05A8-427E-8C49-13258361DA55")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/Meshwork.Platform.Windows/Windows.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Windows.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2006 FileFind.net (http://filefind.net) 8 | // 9 | 10 | using System.Collections.Generic; 11 | using System.Net.NetworkInformation; 12 | using System.Net.Sockets; 13 | 14 | namespace Meshwork.Platform.Windows 15 | { 16 | /// 17 | /// Description of Windows. 18 | /// 19 | public class WindowsPlatform : IPlatform 20 | { 21 | public InterfaceAddress[] GetInterfaceAddresses () 22 | { 23 | var result = new List (); 24 | 25 | var index = 0; 26 | foreach (var iface in NetworkInterface.GetAllNetworkInterfaces()) { 27 | foreach (var ip in iface.GetIPProperties().UnicastAddresses) { 28 | if (ip.Address.AddressFamily == AddressFamily.InterNetwork && ip.IPv4Mask != null) 29 | result.Add(new InterfaceAddress(index, iface.Name, ip.Address, ip.IPv4Mask)); 30 | // FIXME: How do I get the prefix length? 31 | //else if (ip.Address.AddressFamily == AddressFamily.InterNetworkV6) 32 | //results.Add(new InterfaceAddress(iface.Id, iface.Name, ip.Address, prefixLength); 33 | } 34 | index ++; 35 | } 36 | 37 | return result.ToArray(); 38 | } 39 | 40 | public void SetProcessName(string name) 41 | { 42 | /* do nothing */ 43 | } 44 | 45 | public string OSName => "Windows"; 46 | 47 | public string UserName { 48 | get { 49 | return string.Empty; 50 | } 51 | } 52 | 53 | public string RealName { 54 | get { 55 | return string.Empty; 56 | } 57 | } 58 | 59 | public string VersionInfo { 60 | get { 61 | return "Windows"; // XXX: Get winver 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Meshwork.Platform/IPlatform.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IPlatform.cs: 3 | // 4 | // Authors: 5 | // Eric Butler 6 | // 7 | // (C) 2007 FileFind.net (http://filefind.net) 8 | // 9 | 10 | namespace Meshwork.Platform 11 | { 12 | public interface IPlatform 13 | { 14 | InterfaceAddress[] GetInterfaceAddresses(); 15 | 16 | void SetProcessName(string name); 17 | 18 | string OSName { 19 | get; 20 | } 21 | 22 | string UserName { 23 | get; 24 | } 25 | 26 | string RealName { 27 | get; 28 | } 29 | 30 | string VersionInfo { 31 | get; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Meshwork.Platform/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Meshwork.Platform")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Meshwork.Platform")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("D981A690-6340-404C-96F5-B32E18C6AF8D")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] 40 | 41 | -------------------------------------------------------------------------------- /src/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "projects":[ 3 | "FileFind.Meshwork", 4 | "FileFind.Meshwork.DaemonClient", 5 | "FileFind.Meshwork.GtkClient" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -d .git ]; then 4 | rev_num=`git rev-list HEAD | wc -l | sed "s/[ \t]//g"` 5 | echo -n 0.1-0+git${rev_num} 6 | else 7 | echo -n "ERROR" 8 | fi 9 | --------------------------------------------------------------------------------