protected BaseClientCommandTransportManager(ClientRemotePowerShell shell, PSRemotingCryptoHelper cryptoHelper, BaseClientSessionTransportManager sessnTM) : base(sessnTM.RunspacePoolInstanceId, cryptoHelper) { RemoteDataObject obj2; base.Fragmentor.FragmentSize = sessnTM.Fragmentor.FragmentSize; base.Fragmentor.TypeTable = sessnTM.Fragmentor.TypeTable; base.dataToBeSent.Fragmentor = base.Fragmentor; this.powershellInstanceId = shell.PowerShell.InstanceId; this.cmdText = new StringBuilder(); foreach (Command command in shell.PowerShell.Commands.Commands) { this.cmdText.Append(command.CommandText); this.cmdText.Append(" | "); } this.cmdText.Remove(this.cmdText.Length - 3, 3); if (shell.PowerShell.IsGetCommandMetadataSpecialPipeline) { obj2 = RemotingEncoder.GenerateGetCommandMetadata(shell); } else { obj2 = RemotingEncoder.GenerateCreatePowerShell(shell); } this.serializedPipeline = new SerializedDataStream(base.Fragmentor.FragmentSize); base.Fragmentor.Fragment<object>(obj2, this.serializedPipeline); }
internal OutOfProcessClientCommandTransportManager(ClientRemotePowerShell cmd, bool noInput, OutOfProcessClientSessionTransportManager sessnTM, OutOfProcessTextWriter stdInWriter) : base(cmd, sessnTM.CryptoHelper, sessnTM) { this.stdInWriter = stdInWriter; this.onDataAvailableToSendCallback = new System.Management.Automation.Remoting.PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); this.signalTimeOutTimer = new Timer(60000.0); this.signalTimeOutTimer.Elapsed += new ElapsedEventHandler(this.OnSignalTimeOutTimerElapsed); }
internal virtual void CreatePowerShellOnServerAndInvoke(ClientRemotePowerShell shell) { this.dataStructureHandler.CreatePowerShellOnServerAndInvoke(shell); if (!shell.NoInput) { shell.SendInput(); } }
internal WSManClientCommandTransportManager(WSManConnectionInfo connectionInfo, IntPtr wsManShellOperationHandle, ClientRemotePowerShell shell, bool noInput, WSManClientSessionTransportManager sessnTM) : base(shell, sessnTM.CryptoHelper, sessnTM) { this.wsManShellOperationHandle = wsManShellOperationHandle; base.ReceivedDataCollection.MaximumReceivedDataSize = connectionInfo.MaximumReceivedDataSizePerCommand; base.ReceivedDataCollection.MaximumReceivedObjectSize = connectionInfo.MaximumReceivedObjectSize; this.cmdLine = shell.PowerShell.Commands.Commands.GetCommandStringForHistory(); this.onDataAvailableToSendCallback = new System.Management.Automation.Remoting.PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); this._sessnTm = sessnTM; sessnTM.RobustConnectionsInitiated += new EventHandler<EventArgs>(this.HandleRobustConnectionsIntiated); sessnTM.RobustConnectionsCompleted += new EventHandler<EventArgs>(this.HandleRobusConnectionsCompleted); }
internal override BaseClientCommandTransportManager CreateClientCommandTransportManager( System.Management.Automation.Runspaces.Internal.ClientRemotePowerShell cmd, bool noInput) { BaseClientCommandTransportManager cmdTransportMgr = _transportManager.CreateClientCommandTransportManager(_connectionInfo, cmd, noInput); // listen to data ready events. cmdTransportMgr.DataReceived += DispatchInputQueueData; return(cmdTransportMgr); }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> internal static void ExitHandler(object sender, RemoteDataEventArgs <RemoteHostCall> eventArgs) { RemoteHostCall hostcall = eventArgs.Data; if (hostcall.IsSetShouldExitOrPopRunspace) { return; } // use the method from the RemotePowerShell to indeed execute this call ClientRemotePowerShell remotePowerShell = (ClientRemotePowerShell)sender; remotePowerShell.ExecuteHostCall(hostcall); }
internal override BaseClientCommandTransportManager CreateClientCommandTransportManager(ClientRemotePowerShell cmd, bool noInput) { BaseClientCommandTransportManager manager = this._transportManager.CreateClientCommandTransportManager(this._connectionInfo, cmd, noInput); manager.DataReceived += new EventHandler<RemoteDataEventArgs>(this.DispatchInputQueueData); return manager; }
internal virtual void CreatePowerShellOnServerAndInvoke(ClientRemotePowerShell shell) { this.dataStructureHandler.CreatePowerShellOnServerAndInvoke(shell); if (!shell.NoInput) { shell.SendInput(); } }
/// <summary> /// This is an internal constructor used by WSManClientSessionTransportManager. /// </summary> /// <param name="connectionInfo"> /// connection info to be used for creating the command. /// </param> /// <param name="wsManShellOperationHandle"> /// Shell operation handle in whose context this transport manager sends/receives /// data packets. /// </param> /// <param name="shell"> /// The command to be sent to the remote end. /// </param> /// <param name="noInput"> /// true if the command has input, false otherwise. /// </param> /// <param name="sessnTM"> /// Session transport manager creating this command transport manager instance. /// Used by Command TM to apply session specific properties /// </param> internal WSManClientCommandTransportManager(WSManConnectionInfo connectionInfo, IntPtr wsManShellOperationHandle, ClientRemotePowerShell shell, bool noInput, WSManClientSessionTransportManager sessnTM) : base(shell, sessnTM.CryptoHelper, sessnTM) { Dbg.Assert(IntPtr.Zero != wsManShellOperationHandle, "Shell operation handle cannot be IntPtr.Zero."); Dbg.Assert(null != connectionInfo, "connectionInfo cannot be null"); _wsManShellOperationHandle = wsManShellOperationHandle; // Apply quota limits.. allow for data to be unlimited.. ReceivedDataCollection.MaximumReceivedDataSize = connectionInfo.MaximumReceivedDataSizePerCommand; ReceivedDataCollection.MaximumReceivedObjectSize = connectionInfo.MaximumReceivedObjectSize; _cmdLine = shell.PowerShell.Commands.Commands.GetCommandStringForHistory(); _onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(OnDataAvailableCallback); _sessnTm = sessnTM; // Suspend queue on robust connections initiated event. sessnTM.RobustConnectionsInitiated += HandleRobustConnectionsIntiated; // Resume queue on robust connections completed event. sessnTM.RobustConnectionsCompleted += HandleRobusConnectionsCompleted; }
/// <summary> /// Creates a command transport manager. This will create a new PrioritySendDataCollection which should be used to /// send data to the server. /// </summary> /// <param name="connectionInfo"> /// Connection info to be used for creating the command. /// </param> /// <param name="cmd"> /// Command for which transport manager is created. /// </param> /// <param name="noInput"> /// true if the command has input. /// </param> /// <returns></returns> internal override BaseClientCommandTransportManager CreateClientCommandTransportManager(RunspaceConnectionInfo connectionInfo, ClientRemotePowerShell cmd, bool noInput) { Dbg.Assert(null != cmd, "Cmd cannot be null"); WSManConnectionInfo wsmanConnectionInfo = connectionInfo as WSManConnectionInfo; Dbg.Assert(null != wsmanConnectionInfo, "ConnectionInfo must be WSManConnectionInfo"); WSManClientCommandTransportManager result = new WSManClientCommandTransportManager(wsmanConnectionInfo, _wsManShellOperationHandle, cmd, noInput, this); return result; }
internal abstract BaseClientCommandTransportManager CreateClientCommandTransportManager(ClientRemotePowerShell cmd, bool noInput);
/// <summary> /// /// </summary> /// <param name="shell"></param> internal void CreatePowerShellOnServerAndInvoke(ClientRemotePowerShell shell) { DataStructureHandler.CreatePowerShellOnServerAndInvoke(shell); // send any input that may be available if (!shell.NoInput) { shell.SendInput(); } }
internal override BaseClientCommandTransportManager CreateClientCommandTransportManager(RunspaceConnectionInfo connectionInfo, ClientRemotePowerShell cmd, bool noInput) { return new WSManClientCommandTransportManager(connectionInfo as WSManConnectionInfo, this.wsManShellOperationHandle, cmd, noInput, this); }
internal override BaseClientCommandTransportManager CreateClientCommandTransportManager(RunspaceConnectionInfo connectionInfo, ClientRemotePowerShell cmd, bool noInput) { OutOfProcessClientCommandTransportManager cmdTM = new OutOfProcessClientCommandTransportManager(cmd, noInput, this, this.stdInWriter); this.AddCommandTransportManager(cmd.InstanceId, cmdTM); return cmdTM; }
internal virtual BaseClientCommandTransportManager CreateClientCommandTransportManager(RunspaceConnectionInfo connectionInfo, ClientRemotePowerShell cmd, bool noInput) { throw new NotImplementedException(); }