2 // WSDualHttpBindingElement.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
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:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
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.
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
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;
55 namespace System.ServiceModel.Configuration
58 public partial class WSDualHttpBindingElement
59 : StandardBindingElement, IBindingConfigurationElement
62 static ConfigurationPropertyCollection properties;
63 static ConfigurationProperty bypass_proxy_on_local;
64 static ConfigurationProperty client_base_address;
65 static ConfigurationProperty host_name_comparison_mode;
66 static ConfigurationProperty max_buffer_pool_size;
67 static ConfigurationProperty max_received_message_size;
68 static ConfigurationProperty message_encoding;
69 static ConfigurationProperty proxy_address;
70 static ConfigurationProperty reader_quotas;
71 static ConfigurationProperty reliable_session;
72 static ConfigurationProperty security;
73 static ConfigurationProperty text_encoding;
74 static ConfigurationProperty transaction_flow;
75 static ConfigurationProperty use_default_web_proxy;
77 static WSDualHttpBindingElement ()
81 static void FillProperties (ConfigurationPropertyCollection baseProps)
83 properties = new ConfigurationPropertyCollection ();
84 foreach (ConfigurationProperty prop in baseProps)
85 properties.Add (prop);
87 bypass_proxy_on_local = new ConfigurationProperty ("bypassProxyOnLocal",
88 typeof (bool), "false", new BooleanConverter (), null,
89 ConfigurationPropertyOptions.None);
91 client_base_address = new ConfigurationProperty ("clientBaseAddress",
92 typeof (Uri), null, new UriTypeConverter (), null,
93 ConfigurationPropertyOptions.None);
95 host_name_comparison_mode = new ConfigurationProperty ("hostNameComparisonMode",
96 typeof (HostNameComparisonMode), "StrongWildcard", null/* FIXME: get converter for HostNameComparisonMode*/, null,
97 ConfigurationPropertyOptions.None);
99 max_buffer_pool_size = new ConfigurationProperty ("maxBufferPoolSize",
100 typeof (long), "524288", null/* FIXME: get converter for long*/, null,
101 ConfigurationPropertyOptions.None);
103 max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize",
104 typeof (long), "65536", null/* FIXME: get converter for long*/, null,
105 ConfigurationPropertyOptions.None);
107 message_encoding = new ConfigurationProperty ("messageEncoding",
108 typeof (WSMessageEncoding), "Text", null/* FIXME: get converter for WSMessageEncoding*/, null,
109 ConfigurationPropertyOptions.None);
111 proxy_address = new ConfigurationProperty ("proxyAddress",
112 typeof (Uri), null, new UriTypeConverter (), null,
113 ConfigurationPropertyOptions.None);
115 reader_quotas = new ConfigurationProperty ("readerQuotas",
116 typeof (XmlDictionaryReaderQuotasElement), null, null/* FIXME: get converter for XmlDictionaryReaderQuotasElement*/, null,
117 ConfigurationPropertyOptions.None);
119 reliable_session = new ConfigurationProperty ("reliableSession",
120 typeof (StandardBindingReliableSessionElement), null, null/* FIXME: get converter for StandardBindingReliableSessionElement*/, null,
121 ConfigurationPropertyOptions.None);
123 security = new ConfigurationProperty ("security",
124 typeof (WSDualHttpSecurityElement), null, null/* FIXME: get converter for WSDualHttpSecurityElement*/, null,
125 ConfigurationPropertyOptions.None);
127 text_encoding = new ConfigurationProperty ("textEncoding",
128 typeof (Encoding), "utf-8", null/* FIXME: get converter for Encoding*/, null,
129 ConfigurationPropertyOptions.None);
131 transaction_flow = new ConfigurationProperty ("transactionFlow",
132 typeof (bool), "false", new BooleanConverter (), null,
133 ConfigurationPropertyOptions.None);
135 use_default_web_proxy = new ConfigurationProperty ("useDefaultWebProxy",
136 typeof (bool), "true", new BooleanConverter (), null,
137 ConfigurationPropertyOptions.None);
139 properties.Add (bypass_proxy_on_local);
140 properties.Add (client_base_address);
141 properties.Add (host_name_comparison_mode);
142 properties.Add (max_buffer_pool_size);
143 properties.Add (max_received_message_size);
144 properties.Add (message_encoding);
145 properties.Add (proxy_address);
146 properties.Add (reader_quotas);
147 properties.Add (reliable_session);
148 properties.Add (security);
149 properties.Add (text_encoding);
150 properties.Add (transaction_flow);
151 properties.Add (use_default_web_proxy);
154 public WSDualHttpBindingElement ()
161 protected override Type BindingElementType {
162 get { return typeof (WSDualHttpBindingElement); }
165 [ConfigurationProperty ("bypassProxyOnLocal",
166 DefaultValue = false,
167 Options = ConfigurationPropertyOptions.None)]
168 public bool BypassProxyOnLocal {
169 get { return (bool) base [bypass_proxy_on_local]; }
170 set { base [bypass_proxy_on_local] = value; }
173 [ConfigurationProperty ("clientBaseAddress",
175 Options = ConfigurationPropertyOptions.None)]
176 public Uri ClientBaseAddress {
177 get { return (Uri) base [client_base_address]; }
178 set { base [client_base_address] = value; }
181 [ConfigurationProperty ("hostNameComparisonMode",
182 DefaultValue = "StrongWildcard",
183 Options = ConfigurationPropertyOptions.None)]
184 public HostNameComparisonMode HostNameComparisonMode {
185 get { return (HostNameComparisonMode) base [host_name_comparison_mode]; }
186 set { base [host_name_comparison_mode] = value; }
189 [LongValidator ( MinValue = 0,
190 MaxValue = 9223372036854775807,
191 ExcludeRange = false)]
192 [ConfigurationProperty ("maxBufferPoolSize",
193 DefaultValue = "524288",
194 Options = ConfigurationPropertyOptions.None)]
195 public long MaxBufferPoolSize {
196 get { return (long) base [max_buffer_pool_size]; }
197 set { base [max_buffer_pool_size] = value; }
200 [LongValidator ( MinValue = 1,
201 MaxValue = 9223372036854775807,
202 ExcludeRange = false)]
203 [ConfigurationProperty ("maxReceivedMessageSize",
204 DefaultValue = "65536",
205 Options = ConfigurationPropertyOptions.None)]
206 public long MaxReceivedMessageSize {
207 get { return (long) base [max_received_message_size]; }
208 set { base [max_received_message_size] = value; }
211 [ConfigurationProperty ("messageEncoding",
212 DefaultValue = "Text",
213 Options = ConfigurationPropertyOptions.None)]
214 public WSMessageEncoding MessageEncoding {
215 get { return (WSMessageEncoding) base [message_encoding]; }
216 set { base [message_encoding] = value; }
219 protected override ConfigurationPropertyCollection Properties {
221 if (properties == null) {
222 var baseProps = base.Properties;
224 FillProperties (baseProps);
230 [ConfigurationProperty ("proxyAddress",
232 Options = ConfigurationPropertyOptions.None)]
233 public Uri ProxyAddress {
234 get { return (Uri) base [proxy_address]; }
235 set { base [proxy_address] = value; }
238 [ConfigurationProperty ("readerQuotas",
239 Options = ConfigurationPropertyOptions.None)]
240 public XmlDictionaryReaderQuotasElement ReaderQuotas {
241 get { return (XmlDictionaryReaderQuotasElement) base [reader_quotas]; }
244 [ConfigurationProperty ("reliableSession",
245 Options = ConfigurationPropertyOptions.None)]
246 public StandardBindingReliableSessionElement ReliableSession {
247 get { return (StandardBindingReliableSessionElement) base [reliable_session]; }
250 [ConfigurationProperty ("security",
251 Options = ConfigurationPropertyOptions.None)]
252 public WSDualHttpSecurityElement Security {
253 get { return (WSDualHttpSecurityElement) base [security]; }
256 [ConfigurationProperty ("textEncoding",
257 DefaultValue = "utf-8",
258 Options = ConfigurationPropertyOptions.None)]
259 [TypeConverter (typeof(EncodingConverter))]
260 public Encoding TextEncoding {
261 get { return (Encoding) base [text_encoding]; }
262 set { base [text_encoding] = value; }
265 [ConfigurationProperty ("transactionFlow",
266 DefaultValue = false,
267 Options = ConfigurationPropertyOptions.None)]
268 public bool TransactionFlow {
269 get { return (bool) base [transaction_flow]; }
270 set { base [transaction_flow] = value; }
273 [ConfigurationProperty ("useDefaultWebProxy",
275 Options = ConfigurationPropertyOptions.None)]
276 public bool UseDefaultWebProxy {
277 get { return (bool) base [use_default_web_proxy]; }
278 set { base [use_default_web_proxy] = value; }
283 protected override void OnApplyConfiguration (Binding binding) {
284 throw new NotImplementedException ();