The Labs \ Source Viewer \ SSCLI \ System.Runtime.Remoting.Channels \ DispatchChannelSink

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. // File: DispatchChannelSink.cs
  16. using System;
  17. using System.Collections;
  18. using System.IO;
  19. using System.Runtime.Remoting;
  20. using System.Runtime.Remoting.Messaging;
  21. namespace System.Runtime.Remoting.Channels
  22. {
  23.     internal class DispatchChannelSinkProvider : IServerChannelSinkProvider
  24.     {
  25.         internal DispatchChannelSinkProvider()
  26.         {
  27.         }
  28.         // DispatchChannelSinkProvider
  29.         public void GetChannelData(IChannelDataStore channelData)
  30.         {
  31.         }
  32.        
  33.         public IServerChannelSink CreateSink(IChannelReceiver channel)
  34.         {
  35.             return new DispatchChannelSink();
  36.         }
  37.        
  38.         public IServerChannelSinkProvider Next {
  39.             get { return null; }
  40.             set {
  41.                 throw new NotSupportedException();
  42.             }
  43.         }
  44.     }
  45.     // class DispatchChannelSinkProvider
  46.    
  47.     internal class DispatchChannelSink : IServerChannelSink
  48.     {
  49.        
  50.         internal DispatchChannelSink()
  51.         {
  52.         }
  53.         // DispatchChannelSink
  54.        
  55.         public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
  56.         {
  57.             if (requestMsg == null) {
  58.                 throw new ArgumentNullException("requestMsg", Environment.GetResourceString("Remoting_Channel_DispatchSinkMessageMissing"));
  59.             }
  60.            
  61.             // check arguments
  62.             if (requestStream != null) {
  63.                 throw new RemotingException(Environment.GetResourceString("Remoting_Channel_DispatchSinkWantsNullRequestStream"));
  64.             }
  65.            
  66.             responseHeaders = null;
  67.             responseStream = null;
  68.             return ChannelServices.DispatchMessage(sinkStack, requestMsg, out responseMsg);
  69.         }
  70.         // ProcessMessage
  71.        
  72.         public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, Stream stream)
  73.         {
  74.             // We never push ourselves to the sink stack, so this won't be called.
  75.             throw new NotSupportedException();
  76.         }
  77.         // AsyncProcessResponse
  78.        
  79.         public Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers)
  80.         {
  81.             // We never push ourselves to the sink stack, so this won't be called.
  82.             throw new NotSupportedException();
  83.         }
  84.         // GetResponseStream
  85.        
  86.         public IServerChannelSink NextChannelSink {
  87.             get { return null; }
  88.         }
  89.        
  90.        
  91.         public IDictionary Properties {
  92.             get { return null; }
  93.         }
  94.        
  95.        
  96.     }
  97.     // class DispatchChannelSink
  98.    
  99. }
  100. // namespace System.Runtime.Remoting.Channels

Developer Fusion