2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.ServiceModel / System.ServiceModel.Configuration / WSDualHttpBindingElement.cs
blobd64c7a9a9149ca076bcf8a527b1e9278f7a33c9c
1 //
2 // WSDualHttpBindingElement.cs
3 //
4 // Author:
5 // Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System;
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
35 using System.Net;
36 using System.Net.Security;
37 using System.Reflection;
38 using System.Security.Cryptography.X509Certificates;
39 using System.Security.Principal;
40 using System.IdentityModel.Claims;
41 using System.IdentityModel.Policy;
42 using System.IdentityModel.Tokens;
43 using System.ServiceModel;
44 using System.ServiceModel.Channels;
45 using System.ServiceModel.Description;
46 using System.ServiceModel.Diagnostics;
47 using System.ServiceModel.Dispatcher;
48 using System.ServiceModel.MsmqIntegration;
49 using System.ServiceModel.PeerResolvers;
50 using System.ServiceModel.Security;
51 using System.Runtime.Serialization;
52 using System.Text;
53 using System.Xml;
55 namespace System.ServiceModel.Configuration
57 [MonoTODO]
58 public partial class WSDualHttpBindingElement
59 : StandardBindingElement, IBindingConfigurationElement
61 // Static Fields
62 static ConfigurationPropertyCollection properties;
63 static ConfigurationProperty binding_element_type;
64 static ConfigurationProperty bypass_proxy_on_local;
65 static ConfigurationProperty client_base_address;
66 static ConfigurationProperty host_name_comparison_mode;
67 static ConfigurationProperty max_buffer_pool_size;
68 static ConfigurationProperty max_received_message_size;
69 static ConfigurationProperty message_encoding;
70 static ConfigurationProperty proxy_address;
71 static ConfigurationProperty reader_quotas;
72 static ConfigurationProperty reliable_session;
73 static ConfigurationProperty security;
74 static ConfigurationProperty text_encoding;
75 static ConfigurationProperty transaction_flow;
76 static ConfigurationProperty use_default_web_proxy;
78 static WSDualHttpBindingElement ()
80 properties = new ConfigurationPropertyCollection ();
81 binding_element_type = new ConfigurationProperty ("",
82 typeof (Type), null, new TypeConverter (), null,
83 ConfigurationPropertyOptions.None);
85 bypass_proxy_on_local = new ConfigurationProperty ("bypassProxyOnLocal",
86 typeof (bool), "false", new BooleanConverter (), null,
87 ConfigurationPropertyOptions.None);
89 client_base_address = new ConfigurationProperty ("clientBaseAddress",
90 typeof (Uri), null, new UriTypeConverter (), null,
91 ConfigurationPropertyOptions.None);
93 host_name_comparison_mode = new ConfigurationProperty ("hostNameComparisonMode",
94 typeof (HostNameComparisonMode), "StrongWildcard", null/* FIXME: get converter for HostNameComparisonMode*/, null,
95 ConfigurationPropertyOptions.None);
97 max_buffer_pool_size = new ConfigurationProperty ("maxBufferPoolSize",
98 typeof (long), "524288", null/* FIXME: get converter for long*/, null,
99 ConfigurationPropertyOptions.None);
101 max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize",
102 typeof (long), "65536", null/* FIXME: get converter for long*/, null,
103 ConfigurationPropertyOptions.None);
105 message_encoding = new ConfigurationProperty ("messageEncoding",
106 typeof (WSMessageEncoding), "Text", null/* FIXME: get converter for WSMessageEncoding*/, null,
107 ConfigurationPropertyOptions.None);
109 proxy_address = new ConfigurationProperty ("proxyAddress",
110 typeof (Uri), null, new UriTypeConverter (), null,
111 ConfigurationPropertyOptions.None);
113 reader_quotas = new ConfigurationProperty ("readerQuotas",
114 typeof (XmlDictionaryReaderQuotasElement), null, null/* FIXME: get converter for XmlDictionaryReaderQuotasElement*/, null,
115 ConfigurationPropertyOptions.None);
117 reliable_session = new ConfigurationProperty ("reliableSession",
118 typeof (StandardBindingReliableSessionElement), null, null/* FIXME: get converter for StandardBindingReliableSessionElement*/, null,
119 ConfigurationPropertyOptions.None);
121 security = new ConfigurationProperty ("security",
122 typeof (WSDualHttpSecurityElement), null, null/* FIXME: get converter for WSDualHttpSecurityElement*/, null,
123 ConfigurationPropertyOptions.None);
125 text_encoding = new ConfigurationProperty ("textEncoding",
126 typeof (Encoding), "utf-8", null/* FIXME: get converter for Encoding*/, null,
127 ConfigurationPropertyOptions.None);
129 transaction_flow = new ConfigurationProperty ("transactionFlow",
130 typeof (bool), "false", new BooleanConverter (), null,
131 ConfigurationPropertyOptions.None);
133 use_default_web_proxy = new ConfigurationProperty ("useDefaultWebProxy",
134 typeof (bool), "true", new BooleanConverter (), null,
135 ConfigurationPropertyOptions.None);
137 properties.Add (binding_element_type);
138 properties.Add (bypass_proxy_on_local);
139 properties.Add (client_base_address);
140 properties.Add (host_name_comparison_mode);
141 properties.Add (max_buffer_pool_size);
142 properties.Add (max_received_message_size);
143 properties.Add (message_encoding);
144 properties.Add (proxy_address);
145 properties.Add (reader_quotas);
146 properties.Add (reliable_session);
147 properties.Add (security);
148 properties.Add (text_encoding);
149 properties.Add (transaction_flow);
150 properties.Add (use_default_web_proxy);
153 public WSDualHttpBindingElement ()
158 // Properties
160 protected override Type BindingElementType {
161 get { return (Type) base [binding_element_type]; }
164 [ConfigurationProperty ("bypassProxyOnLocal",
165 DefaultValue = false,
166 Options = ConfigurationPropertyOptions.None)]
167 public bool BypassProxyOnLocal {
168 get { return (bool) base [bypass_proxy_on_local]; }
169 set { base [bypass_proxy_on_local] = value; }
172 [ConfigurationProperty ("clientBaseAddress",
173 DefaultValue = null,
174 Options = ConfigurationPropertyOptions.None)]
175 public Uri ClientBaseAddress {
176 get { return (Uri) base [client_base_address]; }
177 set { base [client_base_address] = value; }
180 [ConfigurationProperty ("hostNameComparisonMode",
181 DefaultValue = "StrongWildcard",
182 Options = ConfigurationPropertyOptions.None)]
183 public HostNameComparisonMode HostNameComparisonMode {
184 get { return (HostNameComparisonMode) base [host_name_comparison_mode]; }
185 set { base [host_name_comparison_mode] = value; }
188 [LongValidator ( MinValue = 0,
189 MaxValue = 9223372036854775807,
190 ExcludeRange = false)]
191 [ConfigurationProperty ("maxBufferPoolSize",
192 DefaultValue = "524288",
193 Options = ConfigurationPropertyOptions.None)]
194 public long MaxBufferPoolSize {
195 get { return (long) base [max_buffer_pool_size]; }
196 set { base [max_buffer_pool_size] = value; }
199 [LongValidator ( MinValue = 1,
200 MaxValue = 9223372036854775807,
201 ExcludeRange = false)]
202 [ConfigurationProperty ("maxReceivedMessageSize",
203 DefaultValue = "65536",
204 Options = ConfigurationPropertyOptions.None)]
205 public long MaxReceivedMessageSize {
206 get { return (long) base [max_received_message_size]; }
207 set { base [max_received_message_size] = value; }
210 [ConfigurationProperty ("messageEncoding",
211 DefaultValue = "Text",
212 Options = ConfigurationPropertyOptions.None)]
213 public WSMessageEncoding MessageEncoding {
214 get { return (WSMessageEncoding) base [message_encoding]; }
215 set { base [message_encoding] = value; }
218 protected override ConfigurationPropertyCollection Properties {
219 get { return properties; }
222 [ConfigurationProperty ("proxyAddress",
223 DefaultValue = null,
224 Options = ConfigurationPropertyOptions.None)]
225 public Uri ProxyAddress {
226 get { return (Uri) base [proxy_address]; }
227 set { base [proxy_address] = value; }
230 [ConfigurationProperty ("readerQuotas",
231 Options = ConfigurationPropertyOptions.None)]
232 public XmlDictionaryReaderQuotasElement ReaderQuotas {
233 get { return (XmlDictionaryReaderQuotasElement) base [reader_quotas]; }
236 [ConfigurationProperty ("reliableSession",
237 Options = ConfigurationPropertyOptions.None)]
238 public StandardBindingReliableSessionElement ReliableSession {
239 get { return (StandardBindingReliableSessionElement) base [reliable_session]; }
242 [ConfigurationProperty ("security",
243 Options = ConfigurationPropertyOptions.None)]
244 public WSDualHttpSecurityElement Security {
245 get { return (WSDualHttpSecurityElement) base [security]; }
248 [ConfigurationProperty ("textEncoding",
249 DefaultValue = "utf-8",
250 Options = ConfigurationPropertyOptions.None)]
251 [TypeConverter (typeof(EncodingConverter))]
252 public Encoding TextEncoding {
253 get { return (Encoding) base [text_encoding]; }
254 set { base [text_encoding] = value; }
257 [ConfigurationProperty ("transactionFlow",
258 DefaultValue = false,
259 Options = ConfigurationPropertyOptions.None)]
260 public bool TransactionFlow {
261 get { return (bool) base [transaction_flow]; }
262 set { base [transaction_flow] = value; }
265 [ConfigurationProperty ("useDefaultWebProxy",
266 DefaultValue = true,
267 Options = ConfigurationPropertyOptions.None)]
268 public bool UseDefaultWebProxy {
269 get { return (bool) base [use_default_web_proxy]; }
270 set { base [use_default_web_proxy] = value; }
275 protected override void OnApplyConfiguration (Binding binding) {
276 throw new NotImplementedException ();