internal OutOfProcessClientCommandTransportManager( ClientRemotePowerShell cmd, bool noInput, OutOfProcessClientSessionTransportManager sessnTM, OutOfProcessTextWriter stdInWriter) : base(cmd, sessnTM.CryptoHelper, (BaseClientSessionTransportManager)sessnTM) { this.stdInWriter = stdInWriter; this.onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); this.signalTimeOutTimer = new Timer(60000.0); this.signalTimeOutTimer.Elapsed += new ElapsedEventHandler(this.OnSignalTimeOutTimerElapsed); }
internal WSManClientCommandTransportManager( WSManConnectionInfo connectionInfo, IntPtr wsManShellOperationHandle, ClientRemotePowerShell shell, bool noInput, WSManClientSessionTransportManager sessnTM) : base(shell, sessnTM.CryptoHelper, (BaseClientSessionTransportManager)sessnTM) { this.wsManShellOperationHandle = wsManShellOperationHandle; this.ReceivedDataCollection.MaximumReceivedDataSize = connectionInfo.MaximumReceivedDataSizePerCommand; this.ReceivedDataCollection.MaximumReceivedObjectSize = connectionInfo.MaximumReceivedObjectSize; this.onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); }
internal WSManClientSessionTransportManager( Guid runspacePoolInstanceId, WSManConnectionInfo connectionInfo, PSRemotingCryptoHelper cryptoHelper) : base(runspacePoolInstanceId, cryptoHelper) { using (BaseClientTransportManager.tracer.TraceConstructor((object)this)) { this.resourceUri = connectionInfo.ShellUri; this.CryptoHelper = cryptoHelper; this.dataToBeSent.Fragmentor = this.Fragmentor; this.ReceivedDataCollection.MaximumReceivedDataSize = new int?(); this.ReceivedDataCollection.MaximumReceivedObjectSize = connectionInfo.MaximumReceivedObjectSize; this.onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); this.Initialize(connectionInfo.ConnectionUri, connectionInfo); } }
internal OutOfProcessClientSessionTransportManager( Guid runspaceId, NewProcessConnectionInfo connectionInfo, PSRemotingCryptoHelper cryptoHelper) : base(runspaceId, cryptoHelper) { this.onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); this.cmdTransportManagers = new Dictionary <Guid, OutOfProcessClientCommandTransportManager>(); this.connectionInfo = connectionInfo; this.dataProcessingCallbacks = new OutOfProcessUtils.DataProcessingDelegates(); this.dataProcessingCallbacks.DataPacketReceived += new OutOfProcessUtils.DataPacketReceived(this.OnDataPacketReceived); this.dataProcessingCallbacks.DataAckPacketReceived += new OutOfProcessUtils.DataAckPacketReceived(this.OnDataAckPacketReceived); this.dataProcessingCallbacks.CommandCreationPacketReceived += new OutOfProcessUtils.CommandCreationPacketReceived(this.OnCommandCreationPacketReceived); this.dataProcessingCallbacks.CommandCreationAckReceived += new OutOfProcessUtils.CommandCreationAckReceived(this.OnCommandCreationAckReceived); this.dataProcessingCallbacks.SignalPacketReceived += new OutOfProcessUtils.SignalPacketReceived(this.OnSignalPacketReceived); this.dataProcessingCallbacks.SignalAckPacketReceived += new OutOfProcessUtils.SignalAckPacketReceived(this.OnSiganlAckPacketReceived); this.dataProcessingCallbacks.ClosePacketReceived += new OutOfProcessUtils.ClosePacketReceived(this.OnClosePacketReceived); this.dataProcessingCallbacks.CloseAckPacketReceived += new OutOfProcessUtils.CloseAckPacketReceived(this.OnCloseAckReceived); this.dataToBeSent.Fragmentor = this.Fragmentor; this.ReceivedDataCollection.MaximumReceivedDataSize = new int?(); this.ReceivedDataCollection.MaximumReceivedObjectSize = new int?(10485760); this.closeTimeOutTimer = new System.Timers.Timer(60000.0); this.closeTimeOutTimer.Elapsed += new ElapsedEventHandler(this.OnCloseTimeOutTimerElapsed); }
/// <summary> /// Constructor. This will create a new PrioritySendDataCollection which should be used to /// send data to the server. /// </summary> /// <param name="runspacePoolInstanceId"> /// This is used for logging trace/operational crimson messages. Having this id in the logs /// helps a user to map which transport is created for which runspace. /// </param> /// <param name="connectionInfo"> /// Connection info to use while connecting to the remote machine. /// </param> /// <param name="cryptoHelper">crypto helper</param> /// <param name="sessionName">session friendly name</param> /// <exception cref="PSInvalidOperationException"> /// 1. Create Session failed with a non-zero error code. /// </exception> internal WSManClientSessionTransportManager(Guid runspacePoolInstanceId, WSManConnectionInfo connectionInfo, PSRemotingCryptoHelper cryptoHelper, string sessionName) : base(runspacePoolInstanceId, cryptoHelper) { // Initialize WSMan instance WSManAPIData = new WSManAPIDataCommon(); if (WSManAPIData.WSManAPIHandle == IntPtr.Zero) { throw new PSRemotingTransportException( StringUtil.Format(RemotingErrorIdStrings.WSManInitFailed, WSManAPIData.ErrorCode)); } Dbg.Assert(null != connectionInfo, "connectionInfo cannot be null"); CryptoHelper = cryptoHelper; dataToBeSent.Fragmentor = base.Fragmentor; _sessionName = sessionName; // session transport manager can receive unlimited data..however each object is limited // by maxRecvdObjectSize. this is to allow clients to use a session for an unlimited time.. // also the messages that can be sent to a session are limited and very controlled. // However a command transport manager can be restricted to receive only a fixed amount of data // controlled by maxRecvdDataSizeCommand..This is because commands can accept any number of input // objects. ReceivedDataCollection.MaximumReceivedDataSize = null; ReceivedDataCollection.MaximumReceivedObjectSize = connectionInfo.MaximumReceivedObjectSize; _onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(OnDataAvailableCallback); Initialize(connectionInfo.ConnectionUri, connectionInfo); }
/// <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; }
internal OutOfProcessClientSessionTransportManagerBase( Guid runspaceId, PSRemotingCryptoHelper cryptoHelper) : base(runspaceId, cryptoHelper) { _onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(OnDataAvailableCallback); _cmdTransportManagers = new Dictionary<Guid, OutOfProcessClientCommandTransportManager>(); _dataProcessingCallbacks = new OutOfProcessUtils.DataProcessingDelegates(); _dataProcessingCallbacks.DataPacketReceived += new OutOfProcessUtils.DataPacketReceived(OnDataPacketReceived); _dataProcessingCallbacks.DataAckPacketReceived += new OutOfProcessUtils.DataAckPacketReceived(OnDataAckPacketReceived); _dataProcessingCallbacks.CommandCreationPacketReceived += new OutOfProcessUtils.CommandCreationPacketReceived(OnCommandCreationPacketReceived); _dataProcessingCallbacks.CommandCreationAckReceived += new OutOfProcessUtils.CommandCreationAckReceived(OnCommandCreationAckReceived); _dataProcessingCallbacks.SignalPacketReceived += new OutOfProcessUtils.SignalPacketReceived(OnSignalPacketReceived); _dataProcessingCallbacks.SignalAckPacketReceived += new OutOfProcessUtils.SignalAckPacketReceived(OnSiganlAckPacketReceived); _dataProcessingCallbacks.ClosePacketReceived += new OutOfProcessUtils.ClosePacketReceived(OnClosePacketReceived); _dataProcessingCallbacks.CloseAckPacketReceived += new OutOfProcessUtils.CloseAckPacketReceived(OnCloseAckReceived); dataToBeSent.Fragmentor = base.Fragmentor; // session transport manager can receive unlimited data..however each object is limited // by maxRecvdObjectSize. this is to allow clients to use a session for an unlimited time.. // also the messages that can be sent to a session are limited and very controlled. // However a command transport manager can be restricted to receive only a fixed amount of data // controlled by maxRecvdDataSizeCommand..This is because commands can accept any number of input // objects. ReceivedDataCollection.MaximumReceivedDataSize = null; ReceivedDataCollection.MaximumReceivedObjectSize = BaseTransportManager.MaximumReceivedObjectSize; // timers initialization _closeTimeOutTimer = new Timer(OnCloseTimeOutTimerElapsed, null, Timeout.Infinite, Timeout.Infinite); _tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
internal OutOfProcessClientCommandTransportManager( ClientRemotePowerShell cmd, bool noInput, OutOfProcessClientSessionTransportManagerBase sessnTM, OutOfProcessTextWriter stdInWriter) : base(cmd, sessnTM.CryptoHelper, sessnTM) { _stdInWriter = stdInWriter; _onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(OnDataAvailableCallback); _signalTimeOutTimer = new Timer(OnSignalTimeOutTimerElapsed, null, Timeout.Infinite, Timeout.Infinite); }