protected OutOfProcessMediatorBase(bool exitProcessOnError)
        {
            _exitProcessOnError = exitProcessOnError;

            // Set up data handling callbacks.
            callbacks = new OutOfProcessUtils.DataProcessingDelegates();
            callbacks.DataPacketReceived            += new OutOfProcessUtils.DataPacketReceived(OnDataPacketReceived);
            callbacks.DataAckPacketReceived         += new OutOfProcessUtils.DataAckPacketReceived(OnDataAckPacketReceived);
            callbacks.CommandCreationPacketReceived += new OutOfProcessUtils.CommandCreationPacketReceived(OnCommandCreationPacketReceived);
            callbacks.CommandCreationAckReceived    += new OutOfProcessUtils.CommandCreationAckReceived(OnCommandCreationAckReceived);
            callbacks.ClosePacketReceived           += new OutOfProcessUtils.ClosePacketReceived(OnClosePacketReceived);
            callbacks.CloseAckPacketReceived        += new OutOfProcessUtils.CloseAckPacketReceived(OnCloseAckPacketReceived);
            callbacks.SignalPacketReceived          += new OutOfProcessUtils.SignalPacketReceived(OnSignalPacketReceived);
            callbacks.SignalAckPacketReceived       += new OutOfProcessUtils.SignalAckPacketReceived(OnSignalAckPacketReceived);

            allcmdsClosedEvent = new ManualResetEvent(true);
        }
示例#2
0
        protected OutOfProcessMediatorBase(bool exitProcessOnError)
        {
            _exitProcessOnError = exitProcessOnError;

            // Set up data handling callbacks.
            callbacks = new OutOfProcessUtils.DataProcessingDelegates();
            callbacks.DataPacketReceived += new OutOfProcessUtils.DataPacketReceived(OnDataPacketReceived);
            callbacks.DataAckPacketReceived += new OutOfProcessUtils.DataAckPacketReceived(OnDataAckPacketReceived);
            callbacks.CommandCreationPacketReceived += new OutOfProcessUtils.CommandCreationPacketReceived(OnCommandCreationPacketReceived);
            callbacks.CommandCreationAckReceived += new OutOfProcessUtils.CommandCreationAckReceived(OnCommandCreationAckReceived);
            callbacks.ClosePacketReceived += new OutOfProcessUtils.ClosePacketReceived(OnClosePacketReceived);
            callbacks.CloseAckPacketReceived += new OutOfProcessUtils.CloseAckPacketReceived(OnCloseAckPacketReceived);
            callbacks.SignalPacketReceived += new OutOfProcessUtils.SignalPacketReceived(OnSignalPacketReceived);
            callbacks.SignalAckPacketReceived += new OutOfProcessUtils.SignalAckPacketReceived(OnSignalAckPacketReceived);

            allcmdsClosedEvent = new ManualResetEvent(true);
        }
 private OutOfProcessMediator()
 {
     Console.SetIn(TextReader.Null);
     this.originalStdOut = new OutOfProcessTextWriter(Console.Out);
     Console.SetOut(TextWriter.Null);
     this.originalStdErr = new OutOfProcessTextWriter(Console.Error);
     Console.SetError(TextWriter.Null);
     this.callbacks = new OutOfProcessUtils.DataProcessingDelegates();
     this.callbacks.DataPacketReceived            = (OutOfProcessUtils.DataPacketReceived)Delegate.Combine(this.callbacks.DataPacketReceived, new OutOfProcessUtils.DataPacketReceived(this.OnDataPacketReceived));
     this.callbacks.DataAckPacketReceived         = (OutOfProcessUtils.DataAckPacketReceived)Delegate.Combine(this.callbacks.DataAckPacketReceived, new OutOfProcessUtils.DataAckPacketReceived(this.OnDataAckPacketReceived));
     this.callbacks.CommandCreationPacketReceived = (OutOfProcessUtils.CommandCreationPacketReceived)Delegate.Combine(this.callbacks.CommandCreationPacketReceived, new OutOfProcessUtils.CommandCreationPacketReceived(this.OnCommandCreationPacketReceived));
     this.callbacks.CommandCreationAckReceived    = (OutOfProcessUtils.CommandCreationAckReceived)Delegate.Combine(this.callbacks.CommandCreationAckReceived, new OutOfProcessUtils.CommandCreationAckReceived(this.OnCommandCreationAckReceived));
     this.callbacks.ClosePacketReceived           = (OutOfProcessUtils.ClosePacketReceived)Delegate.Combine(this.callbacks.ClosePacketReceived, new OutOfProcessUtils.ClosePacketReceived(this.OnClosePacketReceived));
     this.callbacks.CloseAckPacketReceived        = (OutOfProcessUtils.CloseAckPacketReceived)Delegate.Combine(this.callbacks.CloseAckPacketReceived, new OutOfProcessUtils.CloseAckPacketReceived(this.OnCloseAckPacketReceived));
     this.callbacks.SignalPacketReceived          = (OutOfProcessUtils.SignalPacketReceived)Delegate.Combine(this.callbacks.SignalPacketReceived, new OutOfProcessUtils.SignalPacketReceived(this.OnSignalPacketReceived));
     this.callbacks.SignalAckPacketReceived       = (OutOfProcessUtils.SignalAckPacketReceived)Delegate.Combine(this.callbacks.SignalAckPacketReceived, new OutOfProcessUtils.SignalAckPacketReceived(this.OnSignalAckPacketReceived));
     this.allcmdsClosedEvent = new ManualResetEvent(true);
 }
 private OutOfProcessMediator()
 {
     this.originalStdIn = Console.In;
     Console.SetIn(TextReader.Null);
     this.originalStdOut = new OutOfProcessTextWriter(Console.Out);
     Console.SetOut(TextWriter.Null);
     this.originalStdErr = new OutOfProcessTextWriter(Console.Error);
     Console.SetError(TextWriter.Null);
     this.callbacks = new OutOfProcessUtils.DataProcessingDelegates();
     this.callbacks.DataPacketReceived            += new OutOfProcessUtils.DataPacketReceived(this.OnDataPacketReceived);
     this.callbacks.DataAckPacketReceived         += new OutOfProcessUtils.DataAckPacketReceived(this.OnDataAckPacketReceived);
     this.callbacks.CommandCreationPacketReceived += new OutOfProcessUtils.CommandCreationPacketReceived(this.OnCommandCreationPacketReceived);
     this.callbacks.CommandCreationAckReceived    += new OutOfProcessUtils.CommandCreationAckReceived(this.OnCommandCreationAckReceived);
     this.callbacks.ClosePacketReceived           += new OutOfProcessUtils.ClosePacketReceived(this.OnClosePacketReceived);
     this.callbacks.CloseAckPacketReceived        += new OutOfProcessUtils.CloseAckPacketReceived(this.OnCloseAckPacketReceived);
     this.callbacks.SignalPacketReceived          += new OutOfProcessUtils.SignalPacketReceived(this.OnSignalPacketReceived);
     this.callbacks.SignalAckPacketReceived       += new OutOfProcessUtils.SignalAckPacketReceived(this.OnSignalAckPacketReceived);
 }
 internal OutOfProcessClientSessionTransportManager(Guid runspaceId, NewProcessConnectionInfo connectionInfo, PSRemotingCryptoHelper cryptoHelper) : base(runspaceId, cryptoHelper)
 {
     this._processCreated = true;
     this.onDataAvailableToSendCallback = new System.Management.Automation.Remoting.PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback);
     this.cmdTransportManagers          = new Dictionary <Guid, OutOfProcessClientCommandTransportManager>();
     this.connectionInfo          = connectionInfo;
     this.dataProcessingCallbacks = new OutOfProcessUtils.DataProcessingDelegates();
     this.dataProcessingCallbacks.DataPacketReceived            = (OutOfProcessUtils.DataPacketReceived)Delegate.Combine(this.dataProcessingCallbacks.DataPacketReceived, new OutOfProcessUtils.DataPacketReceived(this.OnDataPacketReceived));
     this.dataProcessingCallbacks.DataAckPacketReceived         = (OutOfProcessUtils.DataAckPacketReceived)Delegate.Combine(this.dataProcessingCallbacks.DataAckPacketReceived, new OutOfProcessUtils.DataAckPacketReceived(this.OnDataAckPacketReceived));
     this.dataProcessingCallbacks.CommandCreationPacketReceived = (OutOfProcessUtils.CommandCreationPacketReceived)Delegate.Combine(this.dataProcessingCallbacks.CommandCreationPacketReceived, new OutOfProcessUtils.CommandCreationPacketReceived(this.OnCommandCreationPacketReceived));
     this.dataProcessingCallbacks.CommandCreationAckReceived    = (OutOfProcessUtils.CommandCreationAckReceived)Delegate.Combine(this.dataProcessingCallbacks.CommandCreationAckReceived, new OutOfProcessUtils.CommandCreationAckReceived(this.OnCommandCreationAckReceived));
     this.dataProcessingCallbacks.SignalPacketReceived          = (OutOfProcessUtils.SignalPacketReceived)Delegate.Combine(this.dataProcessingCallbacks.SignalPacketReceived, new OutOfProcessUtils.SignalPacketReceived(this.OnSignalPacketReceived));
     this.dataProcessingCallbacks.SignalAckPacketReceived       = (OutOfProcessUtils.SignalAckPacketReceived)Delegate.Combine(this.dataProcessingCallbacks.SignalAckPacketReceived, new OutOfProcessUtils.SignalAckPacketReceived(this.OnSiganlAckPacketReceived));
     this.dataProcessingCallbacks.ClosePacketReceived           = (OutOfProcessUtils.ClosePacketReceived)Delegate.Combine(this.dataProcessingCallbacks.ClosePacketReceived, new OutOfProcessUtils.ClosePacketReceived(this.OnClosePacketReceived));
     this.dataProcessingCallbacks.CloseAckPacketReceived        = (OutOfProcessUtils.CloseAckPacketReceived)Delegate.Combine(this.dataProcessingCallbacks.CloseAckPacketReceived, new OutOfProcessUtils.CloseAckPacketReceived(this.OnCloseAckReceived));
     base.dataToBeSent.Fragmentor = base.Fragmentor;
     base.ReceivedDataCollection.MaximumReceivedDataSize   = null;
     base.ReceivedDataCollection.MaximumReceivedObjectSize = 0xa00000;
     this.closeTimeOutTimer          = new Timer(60000.0);
     this.closeTimeOutTimer.Elapsed += new ElapsedEventHandler(this.OnCloseTimeOutTimerElapsed);
     this._tracer = PowerShellTraceSourceFactory.GetTraceSource();
 }
示例#6
0
 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);
 }
        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();
        }