File size: 3,411 Bytes
8c763fb | 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Dbg = System.Management.Automation.Diagnostics;
using System.Management.Automation.Remoting.Server;
namespace System.Management.Automation.Remoting
{
/// <summary>
/// This abstract class defines the server side data structure handler that a remote connection has
/// at the remote session level.
/// There are two other data structure handler levels:
/// 1) at the runspace level,
/// 2) at the pipeline level.
///
/// This session level data structure handler defines what can be done at the session level.
/// </summary>
internal abstract class ServerRemoteSessionDataStructureHandler : BaseSessionDataStructureHandler
{
#region Constructors
/// <summary>
/// Constructor does no special initialization.
/// </summary>
internal ServerRemoteSessionDataStructureHandler()
{
}
#endregion Constructors
#region Abstract_API
/// <summary>
/// Makes a connect call asynchronously.
/// </summary>
internal abstract void ConnectAsync();
/// <summary>
/// Send capability negotiation asynchronously.
/// </summary>
internal abstract void SendNegotiationAsync();
/// <summary>
/// This event indicates that a client's capability negotiation packet has been received.
/// </summary>
internal abstract event EventHandler<RemoteSessionNegotiationEventArgs> NegotiationReceived;
/// <summary>
/// Close the connection asynchronously.
/// </summary>
/// <param name="reasonForClose">
/// Message describing why the session is closing
/// </param>
internal abstract void CloseConnectionAsync(Exception reasonForClose);
/// <summary>
/// Event that raised when session datastructure handler is closing.
/// </summary>
internal abstract event EventHandler<EventArgs> SessionClosing;
/// <summary>
/// This event indicates a request for creating a new runspace pool
/// has been received on the server side.
/// </summary>
internal abstract event EventHandler<RemoteDataEventArgs> CreateRunspacePoolReceived;
/// <summary>
/// A reference to the Finite State Machine.
/// </summary>
internal abstract ServerRemoteSessionDSHandlerStateMachine StateMachine
{
get;
}
/// <summary>
/// Transport manager used by this data structure handler.
/// </summary>
internal abstract AbstractServerSessionTransportManager TransportManager
{
get;
}
/// <summary>
/// This method is used by the client data dispatching mechanism.
/// </summary>
/// <param name="arg">
/// This parameter contains the remote data from the client.
/// </param>
internal abstract void RaiseDataReceivedEvent(RemoteDataEventArgs arg); // this is the API the Transport calls
internal abstract event EventHandler<RemoteDataEventArgs<string>> PublicKeyReceived;
internal abstract void SendRequestForPublicKey();
internal abstract void SendEncryptedSessionKey(string encryptedSessionKey);
#endregion Abstract_API
}
}
|