Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
serverremotingprotocol.cs101 linesDownload Raw Back to server
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using Dbg = System.Management.Automation.Diagnostics;5 6using System.Management.Automation.Remoting.Server;7 8namespace System.Management.Automation.Remoting9{10    /// <summary>11    /// This abstract class defines the server side data structure handler that a remote connection has12    /// at the remote session level.13    /// There are two other data structure handler levels:14    /// 1) at the runspace level,15    /// 2) at the pipeline level.16    ///17    /// This session level data structure handler defines what can be done at the session level.18    /// </summary>19    internal abstract class ServerRemoteSessionDataStructureHandler : BaseSessionDataStructureHandler20    {21        #region Constructors22 23        /// <summary>24        /// Constructor does no special initialization.25        /// </summary>26        internal ServerRemoteSessionDataStructureHandler()27        {28        }29 30        #endregion Constructors31 32        #region Abstract_API33 34        /// <summary>35        /// Makes a connect call asynchronously.36        /// </summary>37        internal abstract void ConnectAsync();38 39        /// <summary>40        /// Send capability negotiation asynchronously.41        /// </summary>42        internal abstract void SendNegotiationAsync();43 44        /// <summary>45        /// This event indicates that a client's capability negotiation packet has been received.46        /// </summary>47        internal abstract event EventHandler<RemoteSessionNegotiationEventArgs> NegotiationReceived;48 49        /// <summary>50        /// Close the connection asynchronously.51        /// </summary>52        /// <param name="reasonForClose">53        /// Message describing why the session is closing54        /// </param>55        internal abstract void CloseConnectionAsync(Exception reasonForClose);56 57        /// <summary>58        /// Event that raised when session datastructure handler is closing.59        /// </summary>60        internal abstract event EventHandler<EventArgs> SessionClosing;61 62        /// <summary>63        /// This event indicates a request for creating a new runspace pool64        /// has been received on the server side.65        /// </summary>66        internal abstract event EventHandler<RemoteDataEventArgs> CreateRunspacePoolReceived;67 68        /// <summary>69        /// A reference to the Finite State Machine.70        /// </summary>71        internal abstract ServerRemoteSessionDSHandlerStateMachine StateMachine72        {73            get;74        }75 76        /// <summary>77        /// Transport manager used by this data structure handler.78        /// </summary>79        internal abstract AbstractServerSessionTransportManager TransportManager80        {81            get;82        }83 84        /// <summary>85        /// This method is used by the client data dispatching mechanism.86        /// </summary>87        /// <param name="arg">88        /// This parameter contains the remote data from the client.89        /// </param>90        internal abstract void RaiseDataReceivedEvent(RemoteDataEventArgs arg); // this is the API the Transport calls91 92        internal abstract event EventHandler<RemoteDataEventArgs<string>> PublicKeyReceived;93 94        internal abstract void SendRequestForPublicKey();95 96        internal abstract void SendEncryptedSessionKey(string encryptedSessionKey);97 98        #endregion Abstract_API99    }100}101