2008-11-13 Gonzalo Paniagua Javier <gonzalo@novell.com>
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Channels / LayeredReplyChannel.cs
1 //
2 // SecurityReplyChannel.cs
3 //
4 // Author: Atsushi Enomoto (atsushi@ximian.com)
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
30 namespace System.ServiceModel.Channels
31 {
32         internal abstract class LayeredReplyChannel : LayeredCommunicationObject, IReplyChannel
33         {
34                 IReplyChannel inner;
35
36                 public LayeredReplyChannel (IReplyChannel innerChannel)
37                         : base (innerChannel)
38                 {
39                         inner = innerChannel;
40                 }
41
42                 public abstract ChannelListenerBase Listener { get; }
43
44                 public override ChannelManagerBase ChannelManager {
45                         get { return Listener; }
46                 }
47
48                 // IReplyChannel
49
50                 public virtual EndpointAddress LocalAddress {
51                         get { return inner.LocalAddress; }
52                 }
53
54                 public virtual IAsyncResult BeginReceiveRequest (
55                         AsyncCallback callback, object state)
56                 {
57                         return BeginReceiveRequest (Listener.DefaultReceiveTimeout, callback, state);
58                 }
59
60                 public virtual IAsyncResult BeginReceiveRequest (
61                         TimeSpan timeout, AsyncCallback callback, object state)
62                 {
63                         return inner.BeginReceiveRequest (timeout, callback, state);
64                 }
65
66                 public virtual IAsyncResult BeginTryReceiveRequest (
67                         TimeSpan timeout, AsyncCallback callback, object state)
68                 {
69                         return inner.BeginTryReceiveRequest (timeout, callback, state);
70                 }
71
72                 public virtual IAsyncResult BeginWaitForRequest (
73                         TimeSpan timeout, AsyncCallback callback, object state)
74                 {
75                         return inner.BeginWaitForRequest (timeout, callback, state);
76                 }
77
78                 public virtual RequestContext EndReceiveRequest (IAsyncResult result)
79                 {
80                         return inner.EndReceiveRequest (result);
81                 }
82
83                 public virtual bool EndTryReceiveRequest (IAsyncResult result, out RequestContext context)
84                 {
85                         return inner.EndTryReceiveRequest (result, out context);
86                 }
87
88                 public virtual bool EndWaitForRequest (IAsyncResult result)
89                 {
90                         return inner.EndWaitForRequest (result);
91                 }
92
93                 public virtual RequestContext ReceiveRequest ()
94                 {
95                         return ReceiveRequest (Listener.DefaultReceiveTimeout);
96                 }
97
98                 public virtual RequestContext  ReceiveRequest (TimeSpan timeout)
99                 {
100                         return inner.ReceiveRequest (timeout);
101                 }
102
103                 public virtual bool TryReceiveRequest (TimeSpan timeout, out RequestContext context)
104                 {
105                         return inner.TryReceiveRequest (timeout, out context);
106                 }
107
108                 public virtual bool WaitForRequest (TimeSpan timeout)
109                 {
110                         return inner.WaitForRequest (timeout);
111                 }
112
113                 // IChannel
114
115                 public virtual T GetProperty<T> () where T : class
116                 {
117                         return inner.GetProperty<T> ();
118                 }
119         }
120 }