LayeredReplyChannel.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // SecurityReplyChannel.cs
  3. //
  4. // Author: Atsushi Enomoto ([email protected])
  5. //
  6. // Copyright (C) 2006 Novell, Inc (http://www.novell.com)
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining
  9. // a copy of this software and associated documentation files (the
  10. // "Software"), to deal in the Software without restriction, including
  11. // without limitation the rights to use, copy, modify, merge, publish,
  12. // distribute, sublicense, and/or sell copies of the Software, and to
  13. // permit persons to whom the Software is furnished to do so, subject to
  14. // the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. //
  27. using System;
  28. using System.ServiceModel;
  29. namespace System.ServiceModel.Channels
  30. {
  31. internal abstract class LayeredReplyChannel : LayeredCommunicationObject, IReplyChannel
  32. {
  33. IReplyChannel inner;
  34. public LayeredReplyChannel (IReplyChannel innerChannel)
  35. : base (innerChannel)
  36. {
  37. inner = innerChannel;
  38. }
  39. public abstract ChannelListenerBase Listener { get; }
  40. public override ChannelManagerBase ChannelManager {
  41. get { return Listener; }
  42. }
  43. // IReplyChannel
  44. public virtual EndpointAddress LocalAddress {
  45. get { return inner.LocalAddress; }
  46. }
  47. public virtual IAsyncResult BeginReceiveRequest (
  48. AsyncCallback callback, object state)
  49. {
  50. return BeginReceiveRequest (Listener.DefaultReceiveTimeout, callback, state);
  51. }
  52. public virtual IAsyncResult BeginReceiveRequest (
  53. TimeSpan timeout, AsyncCallback callback, object state)
  54. {
  55. return inner.BeginReceiveRequest (timeout, callback, state);
  56. }
  57. public virtual IAsyncResult BeginTryReceiveRequest (
  58. TimeSpan timeout, AsyncCallback callback, object state)
  59. {
  60. return inner.BeginTryReceiveRequest (timeout, callback, state);
  61. }
  62. public virtual IAsyncResult BeginWaitForRequest (
  63. TimeSpan timeout, AsyncCallback callback, object state)
  64. {
  65. return inner.BeginWaitForRequest (timeout, callback, state);
  66. }
  67. public virtual RequestContext EndReceiveRequest (IAsyncResult result)
  68. {
  69. return inner.EndReceiveRequest (result);
  70. }
  71. public virtual bool EndTryReceiveRequest (IAsyncResult result, out RequestContext context)
  72. {
  73. return inner.EndTryReceiveRequest (result, out context);
  74. }
  75. public virtual bool EndWaitForRequest (IAsyncResult result)
  76. {
  77. return inner.EndWaitForRequest (result);
  78. }
  79. public virtual RequestContext ReceiveRequest ()
  80. {
  81. return ReceiveRequest (Listener.DefaultReceiveTimeout);
  82. }
  83. public virtual RequestContext ReceiveRequest (TimeSpan timeout)
  84. {
  85. return inner.ReceiveRequest (timeout);
  86. }
  87. public virtual bool TryReceiveRequest (TimeSpan timeout, out RequestContext context)
  88. {
  89. return inner.TryReceiveRequest (timeout, out context);
  90. }
  91. public virtual bool WaitForRequest (TimeSpan timeout)
  92. {
  93. return inner.WaitForRequest (timeout);
  94. }
  95. // IChannel
  96. public virtual T GetProperty<T> () where T : class
  97. {
  98. return inner.GetProperty<T> ();
  99. }
  100. }
  101. }