internal ServerRemoteSessionDSHandlerlImpl(ServerRemoteSession session, AbstractServerSessionTransportManager transportManager) { this._session = session; this._stateMachine = new ServerRemoteSessionDSHandlerStateMachine(session); this._transportManager = transportManager; this._transportManager.DataReceived += new EventHandler<RemoteDataEventArgs>(session.DispatchInputQueueData); }
internal ServerRemoteSessionDSHandlerlImpl(ServerRemoteSession session, AbstractServerSessionTransportManager transportManager) { this._session = session; this._stateMachine = new ServerRemoteSessionDSHandlerStateMachine(session); this._transportManager = transportManager; this._transportManager.DataReceived += new EventHandler <RemoteDataEventArgs>(session.DispatchInputQueueData); }
internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo senderInfo, string initializationScriptForOutOfProcessRunspace, AbstractServerSessionTransportManager transportManager) { ServerRemoteSession session = CreateServerRemoteSession(senderInfo, "Microsoft.PowerShell", "", transportManager); session._initScriptForOutOfProcRS = initializationScriptForOutOfProcessRunspace; return(session); }
/// <summary> /// Constructs a ServerRemoteSession handler using the supplied transport manager. The /// supplied transport manager will be used to send and receive data from the remote /// client. /// </summary> /// <param name="session"></param> /// <param name="transportManager"></param> internal ServerRemoteSessionDSHandlerImpl(ServerRemoteSession session, AbstractServerSessionTransportManager transportManager) { Dbg.Assert(session != null, "session cannot be null."); Dbg.Assert(transportManager != null, "transportManager cannot be null."); _session = session; _stateMachine = new ServerRemoteSessionDSHandlerStateMachine(session); _transportManager = transportManager; _transportManager.DataReceived += session.DispatchInputQueueData; }
/// <summary> /// Constructs a ServerRemoteSession handler using the supplied transport manager. The /// supplied transport manager will be used to send and receive data from the remote /// client. /// </summary> /// <param name="session"></param> /// <param name="transportManager"></param> internal ServerRemoteSessionDSHandlerImpl(ServerRemoteSession session, AbstractServerSessionTransportManager transportManager) { Dbg.Assert(null != session, "session cannot be null."); Dbg.Assert(null != transportManager, "transportManager cannot be null."); _session = session; _stateMachine = new ServerRemoteSessionDSHandlerStateMachine(session); _transportManager = transportManager; _transportManager.DataReceived += session.DispatchInputQueueData; }
internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo senderInfo, string configurationProviderId, string initializationParameters, AbstractServerSessionTransportManager transportManager) { _trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "Finding InitialSessionState provider for id : {0}", new object[] { configurationProviderId }), new object[0]); if (string.IsNullOrEmpty(configurationProviderId)) { throw PSTraceSource.NewInvalidOperationException("remotingerroridstrings", "NonExistentInitialSessionStateProvider", new object[] { configurationProviderId }); } ServerRemoteSession session = new ServerRemoteSession(senderInfo, configurationProviderId, initializationParameters, transportManager); RemoteSessionStateMachineEventArgs fsmEventArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.CreateSession); session._sessionDSHandler.StateMachine.RaiseEvent(fsmEventArg); return session; }
internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo senderInfo, string configurationProviderId, string initializationParameters, AbstractServerSessionTransportManager transportManager) { _trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "Finding InitialSessionState provider for id : {0}", new object[] { configurationProviderId }), new object[0]); if (string.IsNullOrEmpty(configurationProviderId)) { throw PSTraceSource.NewInvalidOperationException("remotingerroridstrings", "NonExistentInitialSessionStateProvider", new object[] { configurationProviderId }); } ServerRemoteSession session = new ServerRemoteSession(senderInfo, configurationProviderId, initializationParameters, transportManager); RemoteSessionStateMachineEventArgs fsmEventArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.CreateSession); session._sessionDSHandler.StateMachine.RaiseEvent(fsmEventArg); return(session); }
/// <summary> /// This constructor instantiates a FSM object for the server side to control the remote connection. /// It initializes the event handling matrix with event handlers. /// It sets the initial state of the FSM to be Idle. /// </summary> /// <param name="session"> /// This is the remote session object. /// </param> /// <exception cref="ArgumentNullException"> /// If the parameter is null. /// </exception> internal ServerRemoteSessionDSHandlerStateMachine(ServerRemoteSession session) { if (session == null) { throw PSTraceSource.NewArgumentNullException("session"); } _session = session; _syncObject = new object(); _stateMachineHandle = new EventHandler<RemoteSessionStateMachineEventArgs>[(int)RemoteSessionState.MaxState, (int)RemoteSessionEvent.MaxEvent]; for (int i = 0; i < _stateMachineHandle.GetLength(0); i++) { _stateMachineHandle[i, (int)RemoteSessionEvent.FatalError] += DoFatalError; _stateMachineHandle[i, (int)RemoteSessionEvent.Close] += DoClose; _stateMachineHandle[i, (int)RemoteSessionEvent.CloseFailed] += DoCloseFailed; _stateMachineHandle[i, (int)RemoteSessionEvent.CloseCompleted] += DoCloseCompleted; _stateMachineHandle[i, (int)RemoteSessionEvent.NegotiationTimeout] += DoNegotiationTimeout; _stateMachineHandle[i, (int)RemoteSessionEvent.SendFailed] += DoSendFailed; _stateMachineHandle[i, (int)RemoteSessionEvent.ReceiveFailed] += DoReceiveFailed; _stateMachineHandle[i, (int)RemoteSessionEvent.ConnectSession] += DoConnect; } _stateMachineHandle[(int)RemoteSessionState.Idle, (int)RemoteSessionEvent.CreateSession] += DoCreateSession; _stateMachineHandle[(int)RemoteSessionState.NegotiationPending, (int)RemoteSessionEvent.NegotiationReceived] += DoNegotiationReceived; _stateMachineHandle[(int)RemoteSessionState.NegotiationReceived, (int)RemoteSessionEvent.NegotiationSending] += DoNegotiationSending; _stateMachineHandle[(int)RemoteSessionState.NegotiationSending, (int)RemoteSessionEvent.NegotiationSendCompleted] += DoNegotiationCompleted; _stateMachineHandle[(int)RemoteSessionState.NegotiationSent, (int)RemoteSessionEvent.NegotiationCompleted] += DoEstablished; _stateMachineHandle[(int)RemoteSessionState.NegotiationSent, (int)RemoteSessionEvent.NegotiationPending] += DoNegotiationPending; _stateMachineHandle[(int)RemoteSessionState.Established, (int)RemoteSessionEvent.MessageReceived] += DoMessageReceived; _stateMachineHandle[(int)RemoteSessionState.NegotiationReceived, (int)RemoteSessionEvent.NegotiationFailed] += DoNegotiationFailed; _stateMachineHandle[(int)RemoteSessionState.Connecting, (int)RemoteSessionEvent.ConnectFailed] += DoConnectFailed; _stateMachineHandle[(int)RemoteSessionState.Established, (int)RemoteSessionEvent.KeyReceived] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.Established, (int)RemoteSessionEvent.KeyRequested] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.Established, (int)RemoteSessionEvent.KeyReceiveFailed] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyRequested, (int)RemoteSessionEvent.KeyReceived] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyRequested, (int)RemoteSessionEvent.KeySent] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyRequested, (int)RemoteSessionEvent.KeyReceiveFailed] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyReceived, (int)RemoteSessionEvent.KeySendFailed] += DoKeyExchange; _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyReceived, (int)RemoteSessionEvent.KeySent] += DoKeyExchange; //with connect, a new client can negotiate a key change to a server that has already negotiated key exchange with a previous client _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyExchanged, (int)RemoteSessionEvent.KeyReceived] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyExchanged, (int)RemoteSessionEvent.KeyRequested] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyExchanged, (int)RemoteSessionEvent.KeyReceiveFailed] += DoKeyExchange; // for (int i = 0; i < _stateMachineHandle.GetLength(0); i++) { for (int j = 0; j < _stateMachineHandle.GetLength(1); j++) { if (_stateMachineHandle[i, j] == null) { _stateMachineHandle[i, j] += DoClose; } } } // Initially, set state to Idle SetState(RemoteSessionState.Idle, null); }
internal ServerRemoteSessionDSHandlerStateMachine(ServerRemoteSession session) { EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray9 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray10 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray11 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray12 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray13 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray14 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray15 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray16 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray17 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray18 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray19 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray20 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray21 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray22 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray23 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray24 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray25 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray26 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray27 = null; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray28 = null; this.processPendingEventsQueue = new Queue <RemoteSessionStateMachineEventArgs>(); if (session == null) { throw PSTraceSource.NewArgumentNullException("session"); } this._session = session; this._syncObject = new object(); this._stateMachineHandle = new EventHandler <RemoteSessionStateMachineEventArgs> [20, 0x20]; for (int i = 0; i < this._stateMachineHandle.GetLength(0); i++) { EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray = null; IntPtr ptr = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray2 = null; IntPtr ptr2 = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray3 = null; IntPtr ptr3 = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray4 = null; IntPtr ptr4 = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray5 = null; IntPtr ptr5 = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray6 = null; IntPtr ptr6 = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray7 = null; IntPtr ptr7 = IntPtr.Zero; EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray8 = null; IntPtr ptr8 = IntPtr.Zero; (handlerArray = this._stateMachineHandle)[(int)(ptr = (IntPtr)i), 0x11] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray[(int)ptr, 0x11], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoFatalError)); (handlerArray2 = this._stateMachineHandle)[(int)(ptr2 = (IntPtr)i), 9] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray2[(int)ptr2, 9], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoClose)); (handlerArray3 = this._stateMachineHandle)[(int)(ptr3 = (IntPtr)i), 11] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray3[(int)ptr3, 11], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoCloseFailed)); (handlerArray4 = this._stateMachineHandle)[(int)(ptr4 = (IntPtr)i), 10] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray4[(int)ptr4, 10], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoCloseCompleted)); (handlerArray5 = this._stateMachineHandle)[(int)(ptr5 = (IntPtr)i), 14] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray5[(int)ptr5, 14], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationTimeout)); (handlerArray6 = this._stateMachineHandle)[(int)(ptr6 = (IntPtr)i), 15] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray6[(int)ptr6, 15], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoSendFailed)); (handlerArray7 = this._stateMachineHandle)[(int)(ptr7 = (IntPtr)i), 0x10] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray7[(int)ptr7, 0x10], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoReceiveFailed)); (handlerArray8 = this._stateMachineHandle)[(int)(ptr8 = (IntPtr)i), 2] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray8[(int)ptr8, 2], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoConnect)); } (handlerArray9 = this._stateMachineHandle)[1, 1] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray9[1, 1], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoCreateSession)); (handlerArray10 = this._stateMachineHandle)[8, 6] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray10[8, 6], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationReceived)); (handlerArray11 = this._stateMachineHandle)[7, 3] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray11[7, 3], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationSending)); (handlerArray12 = this._stateMachineHandle)[4, 5] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray12[4, 5], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationCompleted)); (handlerArray13 = this._stateMachineHandle)[6, 7] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray13[6, 7], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoEstablished)); (handlerArray14 = this._stateMachineHandle)[6, 8] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray14[6, 8], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationPending)); (handlerArray15 = this._stateMachineHandle)[11, 0x12] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray15[11, 0x12], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoMessageReceived)); (handlerArray16 = this._stateMachineHandle)[7, 13] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray16[7, 13], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationFailed)); (handlerArray17 = this._stateMachineHandle)[2, 12] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray17[2, 12], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoConnectFailed)); (handlerArray18 = this._stateMachineHandle)[11, 0x15] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray18[11, 0x15], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray19 = this._stateMachineHandle)[11, 0x17] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray19[11, 0x17], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray20 = this._stateMachineHandle)[11, 0x16] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray20[11, 0x16], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray21 = this._stateMachineHandle)[14, 0x15] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray21[14, 0x15], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray22 = this._stateMachineHandle)[14, 0x13] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray22[14, 0x13], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray23 = this._stateMachineHandle)[14, 0x16] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray23[14, 0x16], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray24 = this._stateMachineHandle)[13, 20] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray24[13, 20], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray25 = this._stateMachineHandle)[13, 0x13] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray25[13, 0x13], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray26 = this._stateMachineHandle)[15, 0x15] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray26[15, 0x15], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray27 = this._stateMachineHandle)[15, 0x17] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray27[15, 0x17], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray28 = this._stateMachineHandle)[15, 0x16] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray28[15, 0x16], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); for (int j = 0; j < this._stateMachineHandle.GetLength(0); j++) { for (int k = 0; k < this._stateMachineHandle.GetLength(1); k++) { if (this._stateMachineHandle[j, k] == null) { EventHandler <RemoteSessionStateMachineEventArgs>[,] handlerArray29 = null; IntPtr ptr9 = IntPtr.Zero; IntPtr ptr10 = IntPtr.Zero; (handlerArray29 = this._stateMachineHandle)[(int)(ptr9 = (IntPtr)j), (int)(ptr10 = (IntPtr)k)] = (EventHandler <RemoteSessionStateMachineEventArgs>)Delegate.Combine(handlerArray29[(int)ptr9, (int)ptr10], new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoClose)); } } } this.SetState(RemoteSessionState.Idle, null); }
internal WSManPluginCommandSession( WSManNativeApi.WSManPluginRequest creationRequestDetails, WSManPluginServerTransportManager transportMgr, ServerRemoteSession remoteSession) : base(creationRequestDetails, transportMgr) { _remoteSession = remoteSession; cmdSyncObject = new System.Object(); }
internal WSManPluginShellSession( WSManNativeApi.WSManPluginRequest creationRequestDetails, WSManPluginServerTransportManager transportMgr, ServerRemoteSession remoteSession, WSManPluginOperationShutdownContext shutDownContext) : base(creationRequestDetails, transportMgr) { _remoteSession = remoteSession; _remoteSession.Closed += new EventHandler<RemoteSessionStateMachineEventArgs>(this.HandleServerRemoteSessionClosed); _activeCommandSessions = new Dictionary<IntPtr, WSManPluginCommandSession>(); this.shellSyncObject = new System.Object(); this.shutDownContext = shutDownContext; }
/// <summary> /// Creates a server remote session for the supplied <paramref name="configurationProviderId"/> /// and <paramref name="transportManager"/>. /// </summary> /// <param name="senderInfo"></param> /// <param name="configurationProviderId"></param> /// <param name="initializationParameters"> /// Initialization Parameters xml passed by WSMan API. This data is read from the config /// xml. /// </param> /// <param name="transportManager"></param> /// <param name="configurationName">Optional configuration endpoint name for OutOfProc sessions</param> /// <returns></returns> /// <exception cref="InvalidOperationException"> /// InitialSessionState provider with <paramref name="configurationProviderId"/> does /// not exist on the remote server. /// </exception> /* <InitializationParameters> <Param Name="PSVersion" Value="2.0" /> <Param Name="ApplicationBase" Value="<folder path>" /> ... </InitializationParameters> */ internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo senderInfo, string configurationProviderId, string initializationParameters, AbstractServerSessionTransportManager transportManager, string configurationName = null) { Dbg.Assert((senderInfo != null) & (senderInfo.UserInfo != null), "senderInfo and userInfo cannot be null."); s_trace.WriteLine("Finding InitialSessionState provider for id : {0}", configurationProviderId); if (string.IsNullOrEmpty(configurationProviderId)) { throw PSTraceSource.NewInvalidOperationException("RemotingErrorIdStrings.NonExistentInitialSessionStateProvider", configurationProviderId); } ServerRemoteSession result = new ServerRemoteSession(senderInfo, configurationProviderId, initializationParameters, transportManager) { _configurationName = configurationName }; // start state machine. RemoteSessionStateMachineEventArgs startEventArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.CreateSession); result.SessionDataStructureHandler.StateMachine.RaiseEvent(startEventArg); return result; }
private void EnsureSessionSecurity (ServerRemoteSession session) { if (session.Identity.Name != System.Threading.Thread.CurrentPrincipal.Identity.Name) { throw new PSSecurityException("Access Denied to requested session"); } }
internal ServerRemoteSessionDSHandlerStateMachine(ServerRemoteSession session) { EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray9 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray10 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray11 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray12 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray13 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray14 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray15 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray16 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray17 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray18 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray19 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray20 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray21 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray22 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray23 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray24 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray25 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray26 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray27 = null; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray28 = null; this.processPendingEventsQueue = new Queue<RemoteSessionStateMachineEventArgs>(); if (session == null) { throw PSTraceSource.NewArgumentNullException("session"); } this._session = session; this._syncObject = new object(); this._stateMachineHandle = new EventHandler<RemoteSessionStateMachineEventArgs>[20, 0x20]; for (int i = 0; i < this._stateMachineHandle.GetLength(0); i++) { EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray = null; IntPtr ptr = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray2 = null; IntPtr ptr2 = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray3 = null; IntPtr ptr3 = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray4 = null; IntPtr ptr4 = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray5 = null; IntPtr ptr5 = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray6 = null; IntPtr ptr6 = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray7 = null; IntPtr ptr7 = IntPtr.Zero; EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray8 = null; IntPtr ptr8 = IntPtr.Zero; (handlerArray = this._stateMachineHandle)[(int) (ptr = (IntPtr) i), 0x11] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray[(int) ptr, 0x11], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoFatalError)); (handlerArray2 = this._stateMachineHandle)[(int) (ptr2 = (IntPtr) i), 9] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray2[(int) ptr2, 9], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoClose)); (handlerArray3 = this._stateMachineHandle)[(int) (ptr3 = (IntPtr) i), 11] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray3[(int) ptr3, 11], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoCloseFailed)); (handlerArray4 = this._stateMachineHandle)[(int) (ptr4 = (IntPtr) i), 10] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray4[(int) ptr4, 10], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoCloseCompleted)); (handlerArray5 = this._stateMachineHandle)[(int) (ptr5 = (IntPtr) i), 14] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray5[(int) ptr5, 14], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoNegotiationTimeout)); (handlerArray6 = this._stateMachineHandle)[(int) (ptr6 = (IntPtr) i), 15] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray6[(int) ptr6, 15], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoSendFailed)); (handlerArray7 = this._stateMachineHandle)[(int) (ptr7 = (IntPtr) i), 0x10] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray7[(int) ptr7, 0x10], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoReceiveFailed)); (handlerArray8 = this._stateMachineHandle)[(int) (ptr8 = (IntPtr) i), 2] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray8[(int) ptr8, 2], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoConnect)); } (handlerArray9 = this._stateMachineHandle)[1, 1] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray9[1, 1], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoCreateSession)); (handlerArray10 = this._stateMachineHandle)[8, 6] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray10[8, 6], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoNegotiationReceived)); (handlerArray11 = this._stateMachineHandle)[7, 3] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray11[7, 3], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoNegotiationSending)); (handlerArray12 = this._stateMachineHandle)[4, 5] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray12[4, 5], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoNegotiationCompleted)); (handlerArray13 = this._stateMachineHandle)[6, 7] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray13[6, 7], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoEstablished)); (handlerArray14 = this._stateMachineHandle)[6, 8] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray14[6, 8], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoNegotiationPending)); (handlerArray15 = this._stateMachineHandle)[11, 0x12] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray15[11, 0x12], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoMessageReceived)); (handlerArray16 = this._stateMachineHandle)[7, 13] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray16[7, 13], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoNegotiationFailed)); (handlerArray17 = this._stateMachineHandle)[2, 12] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray17[2, 12], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoConnectFailed)); (handlerArray18 = this._stateMachineHandle)[11, 0x15] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray18[11, 0x15], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray19 = this._stateMachineHandle)[11, 0x17] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray19[11, 0x17], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray20 = this._stateMachineHandle)[11, 0x16] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray20[11, 0x16], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray21 = this._stateMachineHandle)[14, 0x15] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray21[14, 0x15], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray22 = this._stateMachineHandle)[14, 0x13] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray22[14, 0x13], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray23 = this._stateMachineHandle)[14, 0x16] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray23[14, 0x16], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray24 = this._stateMachineHandle)[13, 20] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray24[13, 20], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray25 = this._stateMachineHandle)[13, 0x13] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray25[13, 0x13], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray26 = this._stateMachineHandle)[15, 0x15] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray26[15, 0x15], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray27 = this._stateMachineHandle)[15, 0x17] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray27[15, 0x17], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); (handlerArray28 = this._stateMachineHandle)[15, 0x16] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray28[15, 0x16], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoKeyExchange)); for (int j = 0; j < this._stateMachineHandle.GetLength(0); j++) { for (int k = 0; k < this._stateMachineHandle.GetLength(1); k++) { if (this._stateMachineHandle[j, k] == null) { EventHandler<RemoteSessionStateMachineEventArgs>[,] handlerArray29 = null; IntPtr ptr9 = IntPtr.Zero; IntPtr ptr10 = IntPtr.Zero; (handlerArray29 = this._stateMachineHandle)[(int) (ptr9 = (IntPtr) j), (int) (ptr10 = (IntPtr) k)] = (EventHandler<RemoteSessionStateMachineEventArgs>) Delegate.Combine(handlerArray29[(int) ptr9, (int) ptr10], new EventHandler<RemoteSessionStateMachineEventArgs>(this.DoClose)); } } } this.SetState(RemoteSessionState.Idle, null); }
internal ServerRemoteSessionDSHandlerStateMachine(ServerRemoteSession session) { using (ServerRemoteSessionDSHandlerStateMachine._trace.TraceConstructor((object)this)) { this._session = session != null ? session : throw ServerRemoteSessionDSHandlerStateMachine._trace.NewArgumentNullException(nameof(session)); this._syncObject = new object(); this._stateMachineHandle = new EventHandler <RemoteSessionStateMachineEventArgs> [15, 24]; for (int index = 0; index < this._stateMachineHandle.GetLength(0); ++index) { EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle1; IntPtr num1; (stateMachineHandle1 = this._stateMachineHandle)[(int)(num1 = (IntPtr)index), 16] = stateMachineHandle1[(int)num1, 16] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoFatalError); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle2; IntPtr num2; (stateMachineHandle2 = this._stateMachineHandle)[(int)(num2 = (IntPtr)index), 8] = stateMachineHandle2[(int)num2, 8] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoClose); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle3; IntPtr num3; (stateMachineHandle3 = this._stateMachineHandle)[(int)(num3 = (IntPtr)index), 10] = stateMachineHandle3[(int)num3, 10] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoCloseFailed); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle4; IntPtr num4; (stateMachineHandle4 = this._stateMachineHandle)[(int)(num4 = (IntPtr)index), 9] = stateMachineHandle4[(int)num4, 9] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoCloseCompleted); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle5; IntPtr num5; (stateMachineHandle5 = this._stateMachineHandle)[(int)(num5 = (IntPtr)index), 13] = stateMachineHandle5[(int)num5, 13] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationTimeout); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle6; IntPtr num6; (stateMachineHandle6 = this._stateMachineHandle)[(int)(num6 = (IntPtr)index), 14] = stateMachineHandle6[(int)num6, 14] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoSendFailed); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle7; IntPtr num7; (stateMachineHandle7 = this._stateMachineHandle)[(int)(num7 = (IntPtr)index), 15] = stateMachineHandle7[(int)num7, 15] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoReceiveFailed); } EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle8; (stateMachineHandle8 = this._stateMachineHandle)[1, 1] = stateMachineHandle8[1, 1] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoStart); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle9; (stateMachineHandle9 = this._stateMachineHandle)[7, 5] = stateMachineHandle9[7, 5] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationReceived); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle10; (stateMachineHandle10 = this._stateMachineHandle)[6, 3] = stateMachineHandle10[6, 3] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationSending); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle11; (stateMachineHandle11 = this._stateMachineHandle)[4, 4] = stateMachineHandle11[4, 4] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationCompleted); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle12; (stateMachineHandle12 = this._stateMachineHandle)[5, 6] = stateMachineHandle12[5, 6] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoEstablished); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle13; (stateMachineHandle13 = this._stateMachineHandle)[5, 7] = stateMachineHandle13[5, 7] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationPending); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle14; (stateMachineHandle14 = this._stateMachineHandle)[10, 17] = stateMachineHandle14[10, 17] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoMessageReceived); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle15; (stateMachineHandle15 = this._stateMachineHandle)[6, 12] = stateMachineHandle15[6, 12] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoNegotiationFailed); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle16; (stateMachineHandle16 = this._stateMachineHandle)[2, 11] = stateMachineHandle16[2, 11] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoConnectFailed); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle17; (stateMachineHandle17 = this._stateMachineHandle)[10, 20] = stateMachineHandle17[10, 20] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle18; (stateMachineHandle18 = this._stateMachineHandle)[10, 22] = stateMachineHandle18[10, 22] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle19; (stateMachineHandle19 = this._stateMachineHandle)[10, 21] = stateMachineHandle19[10, 21] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle20; (stateMachineHandle20 = this._stateMachineHandle)[13, 20] = stateMachineHandle20[13, 20] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle21; (stateMachineHandle21 = this._stateMachineHandle)[13, 18] = stateMachineHandle21[13, 18] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle22; (stateMachineHandle22 = this._stateMachineHandle)[13, 21] = stateMachineHandle22[13, 21] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle23; (stateMachineHandle23 = this._stateMachineHandle)[12, 19] = stateMachineHandle23[12, 19] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); EventHandler <RemoteSessionStateMachineEventArgs>[,] stateMachineHandle24; (stateMachineHandle24 = this._stateMachineHandle)[12, 18] = stateMachineHandle24[12, 18] + new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoKeyExchange); for (int index1 = 0; index1 < this._stateMachineHandle.GetLength(0); ++index1) { for (int index2 = 0; index2 < this._stateMachineHandle.GetLength(1); ++index2) { if (this._stateMachineHandle[index1, index2] == null) { this._stateMachineHandle[index1, index2] += new EventHandler <RemoteSessionStateMachineEventArgs>(this.DoClose); } } } this.SetState(RemoteSessionState.Idle, (Exception)null); } }