DispatchRuntime.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. //
  2. // DispatchRuntime.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  6. //
  7. // Copyright (C) 2005 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.Generic;
  30. using System.Collections.ObjectModel;
  31. using System.Reflection;
  32. using System.IdentityModel.Policy;
  33. using System.ServiceModel.Channels;
  34. using System.Text;
  35. using System.Threading;
  36. using System.ServiceModel;
  37. using System.ServiceModel.Description;
  38. using System.Web.Security;
  39. namespace System.ServiceModel.Dispatcher
  40. {
  41. [MonoTODO]
  42. public sealed class DispatchRuntime
  43. {
  44. EndpointDispatcher endpoint_dispatcher;
  45. AuditLogLocation audit_log_location;
  46. bool automatic_input_session_shutdown = true;
  47. bool suppress_audio_failure = true;
  48. bool completes_tx_on_close, ignore_tx_msg_props, inpersonate;
  49. bool release_tx_complete;
  50. ClientRuntime callback_client_runtime;
  51. ConcurrencyMode concurrency_mode;
  52. InstanceContext instance_context;
  53. IInstanceProvider instance_provider;
  54. IInstanceContextProvider instance_context_provider;
  55. AuditLevel msg_auth_audit_level, svc_auth_audit_level;
  56. IDispatchOperationSelector operation_selector;
  57. PrincipalPermissionMode perm_mode =
  58. PrincipalPermissionMode.UseWindowsGroups;
  59. SynchronizationContext sync_context;
  60. Type type;
  61. DispatchOperation unhandled_dispatch_oper;
  62. RoleProvider role_provider;
  63. ServiceAuthorizationManager auth_manager;
  64. SynchronizedCollection<IInputSessionShutdown>
  65. shutdown_handlers =
  66. new SynchronizedCollection<IInputSessionShutdown> ();
  67. SynchronizedCollection<IInstanceContextInitializer>
  68. inst_ctx_initializers =
  69. new SynchronizedCollection<IInstanceContextInitializer> ();
  70. SynchronizedCollection<IDispatchMessageInspector>
  71. msg_inspectors =
  72. new SynchronizedCollection<IDispatchMessageInspector> ();
  73. DispatchOperation.DispatchOperationCollection operations =
  74. new DispatchOperation.DispatchOperationCollection ();
  75. ReadOnlyCollection<IAuthorizationPolicy> ext_auth_policies;
  76. internal DispatchRuntime (EndpointDispatcher dispatcher)
  77. {
  78. endpoint_dispatcher = dispatcher;
  79. // FIXME: is this really created at any time?
  80. callback_client_runtime = new ClientRuntime (this);
  81. unhandled_dispatch_oper = new DispatchOperation (
  82. this, "*", "*", "*");
  83. instance_context_provider = new DefaultInstanceContextProvider ();
  84. }
  85. public AuditLogLocation SecurityAuditLogLocation {
  86. get { return audit_log_location; }
  87. set { audit_log_location = value; }
  88. }
  89. public bool AutomaticInputSessionShutdown {
  90. get { return automatic_input_session_shutdown; }
  91. set { automatic_input_session_shutdown = value; }
  92. }
  93. public ChannelDispatcher ChannelDispatcher {
  94. get { return endpoint_dispatcher.ChannelDispatcher; }
  95. }
  96. public ConcurrencyMode ConcurrencyMode {
  97. get { return concurrency_mode; }
  98. set { concurrency_mode = value; }
  99. }
  100. public EndpointDispatcher EndpointDispatcher {
  101. get { return endpoint_dispatcher; }
  102. }
  103. [MonoTODO] // needs update when we can explore Duplex channels.
  104. public ClientRuntime CallbackClientRuntime {
  105. get { return callback_client_runtime; }
  106. }
  107. public ReadOnlyCollection<IAuthorizationPolicy> ExternalAuthorizationPolicies {
  108. get { return ext_auth_policies; }
  109. set { ext_auth_policies = value; }
  110. }
  111. public bool IgnoreTransactionMessageProperty {
  112. get { return ignore_tx_msg_props; }
  113. set { ignore_tx_msg_props = value; }
  114. }
  115. public bool ImpersonateCallerForAllOperations {
  116. get { return inpersonate; }
  117. set { inpersonate = value; }
  118. }
  119. public SynchronizedCollection<IInputSessionShutdown>
  120. InputSessionShutdownHandlers {
  121. get { return shutdown_handlers; }
  122. }
  123. public SynchronizedCollection<IInstanceContextInitializer> InstanceContextInitializers {
  124. get { return inst_ctx_initializers; }
  125. }
  126. public IInstanceProvider InstanceProvider {
  127. get { return instance_provider; }
  128. set { instance_provider = value; }
  129. }
  130. public IInstanceContextProvider InstanceContextProvider {
  131. get { return instance_context_provider; }
  132. set { instance_context_provider = value; }
  133. }
  134. public AuditLevel MessageAuthenticationAuditLevel {
  135. get { return msg_auth_audit_level; }
  136. set { msg_auth_audit_level = value; }
  137. }
  138. public SynchronizedCollection<IDispatchMessageInspector> MessageInspectors {
  139. get { return msg_inspectors; }
  140. }
  141. public SynchronizedKeyedCollection<string,DispatchOperation> Operations {
  142. get { return operations; }
  143. }
  144. public IDispatchOperationSelector OperationSelector {
  145. get { return operation_selector; }
  146. set { operation_selector = value; }
  147. }
  148. public PrincipalPermissionMode PrincipalPermissionMode {
  149. get { return perm_mode; }
  150. set { perm_mode = value; }
  151. }
  152. public bool ReleaseServiceInstanceOnTransactionComplete {
  153. get { return release_tx_complete; }
  154. set { release_tx_complete = value; }
  155. }
  156. public RoleProvider RoleProvider {
  157. get { return role_provider; }
  158. set { role_provider = value; }
  159. }
  160. public AuditLevel ServiceAuthorizationAuditLevel {
  161. get { return svc_auth_audit_level; }
  162. set { svc_auth_audit_level = value; }
  163. }
  164. public ServiceAuthorizationManager ServiceAuthorizationManager {
  165. get { return auth_manager; }
  166. set { auth_manager = value; }
  167. }
  168. public InstanceContext SingletonInstanceContext {
  169. get { return instance_context; }
  170. set { instance_context = value; }
  171. }
  172. public bool SuppressAuditFailure {
  173. get { return suppress_audio_failure; }
  174. set { suppress_audio_failure = value; }
  175. }
  176. public SynchronizationContext SynchronizationContext {
  177. get { return sync_context; }
  178. set { sync_context = value; }
  179. }
  180. public bool TransactionAutoCompleteOnSessionClose {
  181. get { return completes_tx_on_close; }
  182. set { completes_tx_on_close = value; }
  183. }
  184. public Type Type {
  185. get { return type; }
  186. set { type = value; }
  187. }
  188. public DispatchOperation UnhandledDispatchOperation {
  189. get { return unhandled_dispatch_oper; }
  190. set { unhandled_dispatch_oper = value; }
  191. }
  192. }
  193. }