WSDualHttpBindingElement.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. //
  2. // WSDualHttpBindingElement.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  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.
  27. //
  28. using System;
  29. using System.Collections;
  30. using System.Collections.Generic;
  31. using System.Collections.ObjectModel;
  32. using System.ComponentModel;
  33. using System.Configuration;
  34. using System.Net;
  35. using System.Net.Security;
  36. using System.Reflection;
  37. using System.Security.Cryptography.X509Certificates;
  38. using System.Security.Principal;
  39. using System.IdentityModel.Claims;
  40. using System.IdentityModel.Policy;
  41. using System.IdentityModel.Tokens;
  42. using System.ServiceModel;
  43. using System.ServiceModel.Channels;
  44. using System.ServiceModel.Description;
  45. using System.ServiceModel.Diagnostics;
  46. using System.ServiceModel.Dispatcher;
  47. using System.ServiceModel.MsmqIntegration;
  48. using System.ServiceModel.PeerResolvers;
  49. using System.ServiceModel.Security;
  50. using System.Runtime.Serialization;
  51. using System.Text;
  52. using System.Xml;
  53. namespace System.ServiceModel.Configuration
  54. {
  55. [MonoTODO]
  56. public partial class WSDualHttpBindingElement
  57. : StandardBindingElement, IBindingConfigurationElement
  58. {
  59. // Static Fields
  60. static ConfigurationPropertyCollection properties;
  61. static ConfigurationProperty binding_element_type;
  62. static ConfigurationProperty bypass_proxy_on_local;
  63. static ConfigurationProperty client_base_address;
  64. static ConfigurationProperty host_name_comparison_mode;
  65. static ConfigurationProperty max_buffer_pool_size;
  66. static ConfigurationProperty max_received_message_size;
  67. static ConfigurationProperty message_encoding;
  68. static ConfigurationProperty proxy_address;
  69. static ConfigurationProperty reader_quotas;
  70. static ConfigurationProperty reliable_session;
  71. static ConfigurationProperty security;
  72. static ConfigurationProperty text_encoding;
  73. static ConfigurationProperty transaction_flow;
  74. static ConfigurationProperty use_default_web_proxy;
  75. static WSDualHttpBindingElement ()
  76. {
  77. properties = new ConfigurationPropertyCollection ();
  78. binding_element_type = new ConfigurationProperty ("",
  79. typeof (Type), null, new TypeConverter (), null,
  80. ConfigurationPropertyOptions.None);
  81. bypass_proxy_on_local = new ConfigurationProperty ("bypassProxyOnLocal",
  82. typeof (bool), "false", new BooleanConverter (), null,
  83. ConfigurationPropertyOptions.None);
  84. client_base_address = new ConfigurationProperty ("clientBaseAddress",
  85. typeof (Uri), null, new UriTypeConverter (), null,
  86. ConfigurationPropertyOptions.None);
  87. host_name_comparison_mode = new ConfigurationProperty ("hostNameComparisonMode",
  88. typeof (HostNameComparisonMode), "StrongWildcard", null/* FIXME: get converter for HostNameComparisonMode*/, null,
  89. ConfigurationPropertyOptions.None);
  90. max_buffer_pool_size = new ConfigurationProperty ("maxBufferPoolSize",
  91. typeof (long), "524288", null/* FIXME: get converter for long*/, null,
  92. ConfigurationPropertyOptions.None);
  93. max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize",
  94. typeof (long), "65536", null/* FIXME: get converter for long*/, null,
  95. ConfigurationPropertyOptions.None);
  96. message_encoding = new ConfigurationProperty ("messageEncoding",
  97. typeof (WSMessageEncoding), "Text", null/* FIXME: get converter for WSMessageEncoding*/, null,
  98. ConfigurationPropertyOptions.None);
  99. proxy_address = new ConfigurationProperty ("proxyAddress",
  100. typeof (Uri), null, new UriTypeConverter (), null,
  101. ConfigurationPropertyOptions.None);
  102. reader_quotas = new ConfigurationProperty ("readerQuotas",
  103. typeof (XmlDictionaryReaderQuotasElement), null, null/* FIXME: get converter for XmlDictionaryReaderQuotasElement*/, null,
  104. ConfigurationPropertyOptions.None);
  105. reliable_session = new ConfigurationProperty ("reliableSession",
  106. typeof (StandardBindingReliableSessionElement), null, null/* FIXME: get converter for StandardBindingReliableSessionElement*/, null,
  107. ConfigurationPropertyOptions.None);
  108. security = new ConfigurationProperty ("security",
  109. typeof (WSDualHttpSecurityElement), null, null/* FIXME: get converter for WSDualHttpSecurityElement*/, null,
  110. ConfigurationPropertyOptions.None);
  111. text_encoding = new ConfigurationProperty ("textEncoding",
  112. typeof (Encoding), "utf-8", null/* FIXME: get converter for Encoding*/, null,
  113. ConfigurationPropertyOptions.None);
  114. transaction_flow = new ConfigurationProperty ("transactionFlow",
  115. typeof (bool), "false", new BooleanConverter (), null,
  116. ConfigurationPropertyOptions.None);
  117. use_default_web_proxy = new ConfigurationProperty ("useDefaultWebProxy",
  118. typeof (bool), "true", new BooleanConverter (), null,
  119. ConfigurationPropertyOptions.None);
  120. properties.Add (binding_element_type);
  121. properties.Add (bypass_proxy_on_local);
  122. properties.Add (client_base_address);
  123. properties.Add (host_name_comparison_mode);
  124. properties.Add (max_buffer_pool_size);
  125. properties.Add (max_received_message_size);
  126. properties.Add (message_encoding);
  127. properties.Add (proxy_address);
  128. properties.Add (reader_quotas);
  129. properties.Add (reliable_session);
  130. properties.Add (security);
  131. properties.Add (text_encoding);
  132. properties.Add (transaction_flow);
  133. properties.Add (use_default_web_proxy);
  134. }
  135. public WSDualHttpBindingElement ()
  136. {
  137. }
  138. // Properties
  139. protected override Type BindingElementType {
  140. get { return (Type) base [binding_element_type]; }
  141. }
  142. [ConfigurationProperty ("bypassProxyOnLocal",
  143. DefaultValue = false,
  144. Options = ConfigurationPropertyOptions.None)]
  145. public bool BypassProxyOnLocal {
  146. get { return (bool) base [bypass_proxy_on_local]; }
  147. set { base [bypass_proxy_on_local] = value; }
  148. }
  149. [ConfigurationProperty ("clientBaseAddress",
  150. DefaultValue = null,
  151. Options = ConfigurationPropertyOptions.None)]
  152. public Uri ClientBaseAddress {
  153. get { return (Uri) base [client_base_address]; }
  154. set { base [client_base_address] = value; }
  155. }
  156. [ConfigurationProperty ("hostNameComparisonMode",
  157. DefaultValue = "StrongWildcard",
  158. Options = ConfigurationPropertyOptions.None)]
  159. public HostNameComparisonMode HostNameComparisonMode {
  160. get { return (HostNameComparisonMode) base [host_name_comparison_mode]; }
  161. set { base [host_name_comparison_mode] = value; }
  162. }
  163. [LongValidator ( MinValue = 0,
  164. MaxValue = 9223372036854775807,
  165. ExcludeRange = false)]
  166. [ConfigurationProperty ("maxBufferPoolSize",
  167. DefaultValue = "524288",
  168. Options = ConfigurationPropertyOptions.None)]
  169. public long MaxBufferPoolSize {
  170. get { return (long) base [max_buffer_pool_size]; }
  171. set { base [max_buffer_pool_size] = value; }
  172. }
  173. [LongValidator ( MinValue = 1,
  174. MaxValue = 9223372036854775807,
  175. ExcludeRange = false)]
  176. [ConfigurationProperty ("maxReceivedMessageSize",
  177. DefaultValue = "65536",
  178. Options = ConfigurationPropertyOptions.None)]
  179. public long MaxReceivedMessageSize {
  180. get { return (long) base [max_received_message_size]; }
  181. set { base [max_received_message_size] = value; }
  182. }
  183. [ConfigurationProperty ("messageEncoding",
  184. DefaultValue = "Text",
  185. Options = ConfigurationPropertyOptions.None)]
  186. public WSMessageEncoding MessageEncoding {
  187. get { return (WSMessageEncoding) base [message_encoding]; }
  188. set { base [message_encoding] = value; }
  189. }
  190. protected override ConfigurationPropertyCollection Properties {
  191. get { return properties; }
  192. }
  193. [ConfigurationProperty ("proxyAddress",
  194. DefaultValue = null,
  195. Options = ConfigurationPropertyOptions.None)]
  196. public Uri ProxyAddress {
  197. get { return (Uri) base [proxy_address]; }
  198. set { base [proxy_address] = value; }
  199. }
  200. [ConfigurationProperty ("readerQuotas",
  201. Options = ConfigurationPropertyOptions.None)]
  202. public XmlDictionaryReaderQuotasElement ReaderQuotas {
  203. get { return (XmlDictionaryReaderQuotasElement) base [reader_quotas]; }
  204. }
  205. [ConfigurationProperty ("reliableSession",
  206. Options = ConfigurationPropertyOptions.None)]
  207. public StandardBindingReliableSessionElement ReliableSession {
  208. get { return (StandardBindingReliableSessionElement) base [reliable_session]; }
  209. }
  210. [ConfigurationProperty ("security",
  211. Options = ConfigurationPropertyOptions.None)]
  212. public WSDualHttpSecurityElement Security {
  213. get { return (WSDualHttpSecurityElement) base [security]; }
  214. }
  215. [ConfigurationProperty ("textEncoding",
  216. DefaultValue = "utf-8",
  217. Options = ConfigurationPropertyOptions.None)]
  218. [TypeConverter (typeof(EncodingConverter))]
  219. public Encoding TextEncoding {
  220. get { return (Encoding) base [text_encoding]; }
  221. set { base [text_encoding] = value; }
  222. }
  223. [ConfigurationProperty ("transactionFlow",
  224. DefaultValue = false,
  225. Options = ConfigurationPropertyOptions.None)]
  226. public bool TransactionFlow {
  227. get { return (bool) base [transaction_flow]; }
  228. set { base [transaction_flow] = value; }
  229. }
  230. [ConfigurationProperty ("useDefaultWebProxy",
  231. DefaultValue = true,
  232. Options = ConfigurationPropertyOptions.None)]
  233. public bool UseDefaultWebProxy {
  234. get { return (bool) base [use_default_web_proxy]; }
  235. set { base [use_default_web_proxy] = value; }
  236. }
  237. protected override void OnApplyConfiguration (Binding binding) {
  238. throw new NotImplementedException ();
  239. }
  240. }
  241. }