Changeset 1438


Ignore:
Timestamp:
May 18, 2010, 1:34:33 PM (12 years ago)
Author:
Paul Lelgemann
Message:
  • Removed unused configuration options of PeerToPeerProxy
Location:
trunk
Files:
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/P2PManager.cs

    r1433 r1438  
    2525using Cryptool.P2P.Worker;
    2626using DevComponents.WpfRibbon;
    27 using Cryptool.P2P.Helper;
    28 using Cryptool.P2P.Internal;
    2927using Cryptool.Plugins.PeerToPeer;
    3028using Cryptool.Plugins.PeerToPeer.Internal;
     29using Cryptool.P2P.Internal;
    3130
    3231namespace Cryptool.P2P
     
    7776            this.P2PSettings = new P2PSettings();
    7877            this.P2PBase.AllowLoggingToMonitor = this.P2PSettings.Log2Monitor;
    79 
    80             // Validate certificats
    81             if (!PAPCertificate.CheckAndInstallPAPCertificates())
    82             {
    83                 GuiLogMessage("Certificates not validated, P2P might not be working!", NotificationLevel.Error);
    84                 return;
    85             }
    8678
    8779            // Register events
  • trunk/CrypP2P/Worker/ConnectionWorker.cs

    r1378 r1438  
    2525using Cryptool.PluginBase;
    2626using Cryptool.P2P.Internal;
     27using Cryptool.P2P.Helper;
    2728
    2829namespace Cryptool.P2P.Worker
     
    4849            {
    4950                P2PManager.Instance.GuiLogMessage("Connecting to P2P network...", NotificationLevel.Info);
     51
     52                // Validate certificats
     53                if (!PAPCertificate.CheckAndInstallPAPCertificates())
     54                {
     55                    P2PManager.Instance.GuiLogMessage("Certificates not validated, P2P might not be working!", NotificationLevel.Error);
     56                    return;
     57                }
     58
    5059                p2pBase.Initialize(p2pSettings);
    5160                p2pBase.SynchStart();
  • trunk/CrypPlugins/PeerToPeerBaseProxy/P2PPeer.cs

    r1436 r1438  
    1 /* Copyright 2009 Team CrypTool (Christian Arnold), Uni Duisburg-Essen
     1/*
     2   Copyright 2010 Paul Lelgemann, University of Duisburg-Essen
    23
    34   Licensed under the Apache License, Version 2.0 (the "License");
     
    3031namespace Cryptool.Plugins.PeerToPeerProxy
    3132{
    32     [Author("Christian Arnold", "arnold@cryptool.org", "Uni Duisburg-Essen", "http://www.uni-due.de")]
    33     [PluginInfo(false, "P2P_Peer_Proxy", "Creates a new Peer", "", "PeerToPeerBase/icons/peer_inaktiv.png", "PeerToPeerBase/icons/peer_connecting.png", "PeerToPeerBase/icons/peer_online.png", "PeerToPeerBase/icons/peer_error.png")]
     33    [Author("Paul Lelgemann", "lelgemann@cryptool.org", "Uni Duisburg-Essen", "http://www.uni-due.de")]
     34    [PluginInfo(false, "P2P_Peer_Proxy", "Creates a new Peer. Uses the CrypTool2 built-in P2P network and can be used as a replacement for P2P_Peer.", "", "PeerToPeerBaseProxy/icons/peer_inactive.png", "PeerToPeerBaseProxy/icons/peer_connecting.png", "PeerToPeerBaseProxy/icons/peer_online.png", "PeerToPeerBaseProxy/icons/peer_error.png")]
    3435    public class P2PPeer : IIOMisc
    3536    {
     
    183184        public void StartPeer()
    184185        {
    185             GuiLogMessage("Peer is already started by CrypTool!", NotificationLevel.Info);
     186            this.settings.PeerStatusChanged(P2PPeerSettings.PeerStatus.Connecting);
    186187            P2PManager.Instance.P2PBase.OnP2PMessageReceived += new P2PBase.P2PMessageReceived(p2pBase_OnP2PMessageReceived);
     188
     189            if (P2PManager.Instance.P2PConnected())
     190            {
     191                GuiLogMessage("P2P connected.", NotificationLevel.Info);
     192                this.settings.PeerStatusChanged(P2PPeerSettings.PeerStatus.Online);
     193            }
     194            else
     195            {
     196                GuiLogMessage("P2P network must be configured and connecting using the world button.", NotificationLevel.Warning);
     197                this.settings.PeerStatusChanged(P2PPeerSettings.PeerStatus.Error);
     198
     199                // TODO use appropriate exception / abort procedure
     200                throw new ApplicationException("P2P unavailable.");
     201            }
    187202        }
    188203
  • trunk/CrypPlugins/PeerToPeerBaseProxy/P2PPeerSettings.cs

    r1434 r1438  
    5050        #region Start- and Stop-Buttons incl. functionality
    5151
    52         /** ATTENTION: Change property changeableWhileExecuting to false for the Start and Stop Button.
    53          * Only set to true for testing issues.*/
    54 
    55         //[TaskPane("Start", "Initializes and starts Peer", null, 2, false, DisplayLevel.Beginner, ControlType.Button)]
    56         [TaskPane("Start", "Connects to the P2P-system.", null, 2, true, DisplayLevel.Beginner, ControlType.Button)]
    57         public void BtnStart()
    58         {
    59             if (P2PWorldName != null)
    60             {
    61                 this.p2pPeer.StartPeer();
    62             }
    63             else
    64             {
    65                 PeerStatusChanged(PeerStatus.Error);
    66                 // can not initialize Peer, because P2PUserName and/or P2PWorldName are missing
    67                 throw (new Exception("You must set the P2P username and worldname, otherwise starting the peer isn't possible"));
    68             }
    69         }
    70 
    71         //[TaskPane("Stop", "Stops the Peer", null, 3, false, DisplayLevel.Beginner, ControlType.Button)]
    72         [TaskPane("Stop", "Disconnects from the P2P-system", null, 3, true, DisplayLevel.Beginner, ControlType.Button)]
    73         public void BtnStop()
    74         {
    75             this.p2pPeer.StopPeer();
    76          
    77             OnPropertyChanged("PeerStopped");
    78         }
    79 
    8052        [TaskPane("Internal state dump", "Dumps the interla state of the P2P system to syslog.", "P2P Expert Settings", 0, true, DisplayLevel.Beginner, ControlType.Button)]
    8153        public void BtnLogInternalState()
    8254        {
    8355            this.p2pPeer.LogInternalState();
    84         }
    85 
    86         #endregion
    87 
    88         #region Setting-Fields
    89 
    90         private string p2pPeerName = PAPCertificate.CERTIFIED_PEER_NAME;
    91         [TaskPane("P2P Username", "Your username for the peers@play-system. Note that you need to have a corresponding certificate installed on your computer. If you don't know what this means, just leave the default \"CrypTool2\"-username and everything will be taken care of.", null, 0, false, DisplayLevel.Beginner, ControlType.TextBox)]
    92         public string P2PPeerName
    93         {
    94             get { return this.p2pPeerName; }
    95             set
    96             {
    97                 if (value != this.p2pPeerName)
    98                 {
    99                     this.p2pPeerName = value;
    100                     OnPropertyChanged("P2PPeerName");
    101                     HasChanges = true;
    102                 }
    103             }
    104         }
    105 
    106         private string p2pWorldName;
    107         [TaskPane("P2P World", "P2P Name of the world.", null, 1, false, DisplayLevel.Beginner, ControlType.TextBox)]
    108         public string P2PWorldName
    109         {
    110             get { return this.p2pWorldName; }
    111             set
    112             {
    113                 if (value != this.p2pWorldName)
    114                 {
    115                     this.p2pWorldName = value;
    116                     OnPropertyChanged("P2PWorldName");
    117                     HasChanges = true;
    118                 }
    119             }
    120         }
    121 
    122         //private bool p2pUseNatTraversal = false;
    123         //[TaskPane("Use NAT Traversal", "Activate/Deactivate NAT-Traversal (tunneling connections through NATs " +
    124         //    "and Firewalls, necessary to work in different networks in the same world)", "P2P Expert Settings", 0, false,
    125         //    DisplayLevel.Beginner, ControlType.CheckBox)]
    126         //public bool P2PUseNatTraversal
    127         //{
    128         //    get { return this.p2pUseNatTraversal; }
    129         //    set
    130         //    {
    131         //        if (value != this.p2pUseNatTraversal)
    132         //        {
    133         //            this.p2pUseNatTraversal = value;
    134         //            OnPropertyChanged("P2PUseNatTraversal");
    135         //            HasChanges = true;
    136         //        }
    137         //    }
    138         //}
    139 
    140         private bool log2Monitor = true;
    141         [TaskPane("Use syslogging", "Logs all p2p actions to the to a sylog-daemon on localhost.", "P2P Expert Settings", 1, false,
    142             DisplayLevel.Beginner, ControlType.CheckBox)]
    143         public bool Log2Monitor
    144         {
    145             get { return this.log2Monitor; }
    146             set
    147             {
    148                 if (value != this.log2Monitor)
    149                 {
    150                     this.log2Monitor = value;
    151                     OnPropertyChanged("Log2Monitor");
    152                     HasChanges = true;
    153                 }
    154             }
    155         }
    156 
    157         private P2PLinkManagerType p2pLinkManagerType = P2PLinkManagerType.Snal;
    158         [TaskPane("LinkManager-Type", "Select the LinkManager-Type", "P2P Expert Settings", 2, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "Snal" })]
    159         public int P2PLinkMngrType
    160         {
    161             get { return (int)this.p2pLinkManagerType; }
    162             set
    163             {
    164                 if ((P2PLinkManagerType)value != this.p2pLinkManagerType)
    165                 {
    166                     this.p2pLinkManagerType = (P2PLinkManagerType)value;
    167                     OnPropertyChanged("P2PLinkManagerType");
    168                     HasChanges = true;
    169                 }
    170             }
    171         }
    172 
    173         private P2PBootstrapperType p2pBSType = P2PBootstrapperType.LocalMachineBootstrapper;
    174         [TaskPane("Bootstrapper-Type", "Select the Bootstrapper-Type", "P2P Expert Settings", 3, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "LocalMachineBootstrapper", "IrcBootstrapper" })]
    175         public int P2PBSType
    176         {
    177             get { return (int)this.p2pBSType; }
    178             set
    179             {
    180                 if ((P2PBootstrapperType)value != this.p2pBSType)
    181                 {
    182                     this.p2pBSType = (P2PBootstrapperType)value;
    183                     OnPropertyChanged("P2PBSType");
    184                     HasChanges = true;
    185                 }
    186             }
    187         }
    188 
    189         private P2POverlayType p2pOverlayType = P2POverlayType.FullMeshOverlay;
    190         [TaskPane("Overlay-Type", "Select the Overlay-Type", "P2P Expert Settings", 4, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "FullMeshOverlay" })]
    191         public int P2POverlType
    192         {
    193             get { return (int)this.p2pOverlayType; }
    194             set
    195             {
    196                 if ((P2POverlayType)value != this.p2pOverlayType)
    197                 {
    198                     this.p2pOverlayType = (P2POverlayType)value;
    199                     OnPropertyChanged("P2POverlType");
    200                     HasChanges = true;
    201                 }
    202             }
    203         }
    204 
    205         private P2PDHTType p2pDhtType = P2PDHTType.FullMeshDHT;
    206         [TaskPane("DHT-Type", "Select the DHT-Type", "P2P Expert Settings", 5, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "FullMeshDHT" })]
    207         public int P2PDhtType
    208         {
    209             get { return (int)this.p2pDhtType;  }
    210             set
    211             {
    212                 if ((P2PDHTType)value != this.p2pDhtType)
    213                 {
    214                     this.p2pDhtType = (P2PDHTType)value;
    215                     OnPropertyChanged("P2PDhtType");
    216                     HasChanges = true;
    217                 }
    218             }
    21956        }
    22057
  • trunk/CrypPlugins/PeerToPeerBaseProxy/PeerToPeerBaseProxy.csproj

    r1434 r1438  
    9898  </ItemGroup>
    9999  <ItemGroup>
    100     <CodeAnalysisDictionary Include="icons\peer_connecting.png" />
     100    <Resource Include="icons\peer_connecting.png" />
    101101  </ItemGroup>
    102102  <ItemGroup>
    103     <CodeAnalysisDictionary Include="icons\peer_error.png" />
     103    <Resource Include="icons\peer_error.png" />
    104104  </ItemGroup>
    105105  <ItemGroup>
    106     <CodeAnalysisDictionary Include="icons\peer_inaktiv.png" />
     106    <Resource Include="icons\peer_inactive.png" />
    107107  </ItemGroup>
    108108  <ItemGroup>
    109     <CodeAnalysisDictionary Include="icons\peer_online.png" />
     109    <Resource Include="icons\peer_online.png" />
    110110  </ItemGroup>
    111111  <ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.