2
0

DispatchRuntime.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. }
  84. public AuditLogLocation SecurityAuditLogLocation {
  85. get { return audit_log_location; }
  86. set { audit_log_location = value; }
  87. }
  88. public bool AutomaticInputSessionShutdown {
  89. get { return automatic_input_session_shutdown; }
  90. set { automatic_input_session_shutdown = value; }
  91. }
  92. public ChannelDispatcher ChannelDispatcher {
  93. get { return endpoint_dispatcher.ChannelDispatcher; }
  94. }
  95. public ConcurrencyMode ConcurrencyMode {
  96. get { return concurrency_mode; }
  97. set { concurrency_mode = value; }
  98. }
  99. public EndpointDispatcher EndpointDispatcher {
  100. get { return endpoint_dispatcher; }
  101. }
  102. [MonoTODO] // needs update when we can explore Duplex channels.
  103. public ClientRuntime CallbackClientRuntime {
  104. get { return callback_client_runtime; }
  105. }
  106. public ReadOnlyCollection<IAuthorizationPolicy> ExternalAuthorizationPolicies {
  107. get { return ext_auth_policies; }
  108. set { ext_auth_policies = value; }
  109. }
  110. public bool IgnoreTransactionMessageProperty {
  111. get { return ignore_tx_msg_props; }
  112. set { ignore_tx_msg_props = value; }
  113. }
  114. public bool ImpersonateCallerForAllOperations {
  115. get { return inpersonate; }
  116. set { inpersonate = value; }
  117. }
  118. public SynchronizedCollection<IInputSessionShutdown>
  119. InputSessionShutdownHandlers {
  120. get { return shutdown_handlers; }
  121. }
  122. public SynchronizedCollection<IInstanceContextInitializer> InstanceContextInitializers {
  123. get { return inst_ctx_initializers; }
  124. }
  125. public IInstanceProvider InstanceProvider {
  126. get { return instance_provider; }
  127. set { instance_provider = value; }
  128. }
  129. public IInstanceContextProvider InstanceContextProvider {
  130. get { return instance_context_provider; }
  131. set { instance_context_provider = value; }
  132. }
  133. public AuditLevel MessageAuthenticationAuditLevel {
  134. get { return msg_auth_audit_level; }
  135. set { msg_auth_audit_level = value; }
  136. }
  137. public SynchronizedCollection<IDispatchMessageInspector> MessageInspectors {
  138. get { return msg_inspectors; }
  139. }
  140. public SynchronizedKeyedCollection<string,DispatchOperation> Operations {
  141. get { return operations; }
  142. }
  143. public IDispatchOperationSelector OperationSelector {
  144. get { return operation_selector; }
  145. set { operation_selector = value; }
  146. }
  147. public PrincipalPermissionMode PrincipalPermissionMode {
  148. get { return perm_mode; }
  149. set { perm_mode = value; }
  150. }
  151. public bool ReleaseServiceInstanceOnTransactionComplete {
  152. get { return release_tx_complete; }
  153. set { release_tx_complete = value; }
  154. }
  155. public RoleProvider RoleProvider {
  156. get { return role_provider; }
  157. set { role_provider = value; }
  158. }
  159. public AuditLevel ServiceAuthorizationAuditLevel {
  160. get { return svc_auth_audit_level; }
  161. set { svc_auth_audit_level = value; }
  162. }
  163. public ServiceAuthorizationManager ServiceAuthorizationManager {
  164. get { return auth_manager; }
  165. set { auth_manager = value; }
  166. }
  167. public InstanceContext SingletonInstanceContext {
  168. get { return instance_context; }
  169. set { instance_context = value; }
  170. }
  171. public bool SuppressAuditFailure {
  172. get { return suppress_audio_failure; }
  173. set { suppress_audio_failure = value; }
  174. }
  175. public SynchronizationContext SynchronizationContext {
  176. get { return sync_context; }
  177. set { sync_context = value; }
  178. }
  179. public bool TransactionAutoCompleteOnSessionClose {
  180. get { return completes_tx_on_close; }
  181. set { completes_tx_on_close = value; }
  182. }
  183. public Type Type {
  184. get { return type; }
  185. set { type = value; }
  186. }
  187. public DispatchOperation UnhandledDispatchOperation {
  188. get { return unhandled_dispatch_oper; }
  189. set { unhandled_dispatch_oper = value; }
  190. }
  191. }
  192. }