using System; using System.Collections; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Remoting.Activation; using System.Runtime.Remoting.Channels; using Mono.Xml; namespace System.Runtime.Remoting { /// Provides various static methods for configuring the remoting infrastructure. // Token: 0x02000445 RID: 1093 [ComVisible(true)] public static class RemotingConfiguration { /// Gets the ID of the currently executing application. /// A that contains the ID of the currently executing application. /// The immediate caller does not have infrastructure permission. /// /// /// // Token: 0x1700085B RID: 2139 // (get) Token: 0x06002A05 RID: 10757 RVA: 0x00086D40 File Offset: 0x00084F40 public static string ApplicationId { get { RemotingConfiguration.applicationID = RemotingConfiguration.ApplicationName; return RemotingConfiguration.applicationID; } } /// Gets or sets the name of a remoting application. /// The name of a remoting application. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. This exception is thrown only when setting the property value. /// /// /// // Token: 0x1700085C RID: 2140 // (get) Token: 0x06002A06 RID: 10758 RVA: 0x00086D54 File Offset: 0x00084F54 // (set) Token: 0x06002A07 RID: 10759 RVA: 0x00086D5C File Offset: 0x00084F5C public static string ApplicationName { get { return RemotingConfiguration.applicationName; } set { RemotingConfiguration.applicationName = value; } } /// Gets or sets value that indicates how custom errors are handled. /// A member of the enumeration that indicates how custom errors are handled. /// /// /// // Token: 0x1700085D RID: 2141 // (get) Token: 0x06002A08 RID: 10760 RVA: 0x00086D64 File Offset: 0x00084F64 // (set) Token: 0x06002A09 RID: 10761 RVA: 0x00086D6C File Offset: 0x00084F6C [MonoTODO] public static CustomErrorsModes CustomErrorsMode { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } /// Gets the ID of the currently executing process. /// A that contains the ID of the currently executing process. /// The immediate caller does not have infrastructure permission. /// /// /// // Token: 0x1700085E RID: 2142 // (get) Token: 0x06002A0A RID: 10762 RVA: 0x00086D74 File Offset: 0x00084F74 public static string ProcessId { get { if (RemotingConfiguration.processGuid == null) { RemotingConfiguration.processGuid = AppDomain.GetProcessGuid(); } return RemotingConfiguration.processGuid; } } /// Reads the configuration file and configures the remoting infrastructure. /// The name of the remoting configuration file. Can be null. /// If set to true security is required. If set to false, security is not required but still may be used. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. // Token: 0x06002A0B RID: 10763 RVA: 0x00086D90 File Offset: 0x00084F90 [MonoTODO("Implement ensureSecurity")] public static void Configure(string filename, bool ensureSecurity) { Hashtable hashtable = RemotingConfiguration.channelTemplates; lock (hashtable) { if (!RemotingConfiguration.defaultConfigRead) { RemotingConfiguration.ReadConfigFile(Environment.GetMachineConfigPath()); RemotingConfiguration.defaultConfigRead = true; } if (filename != null) { RemotingConfiguration.ReadConfigFile(filename); } } } /// Reads the configuration file and configures the remoting infrastructure. is obsolete. Please use instead. /// The name of the remoting configuration file. Can be null. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// /// /// // Token: 0x06002A0C RID: 10764 RVA: 0x00086DF8 File Offset: 0x00084FF8 [Obsolete("Use Configure(String,Boolean)")] public static void Configure(string filename) { RemotingConfiguration.Configure(filename, false); } // Token: 0x06002A0D RID: 10765 RVA: 0x00086E04 File Offset: 0x00085004 private static void ReadConfigFile(string filename) { try { SmallXmlParser smallXmlParser = new SmallXmlParser(); using (TextReader textReader = new StreamReader(filename)) { ConfigHandler configHandler = new ConfigHandler(false); smallXmlParser.Parse(textReader, configHandler); } } catch (Exception ex) { throw new RemotingException("Configuration file '" + filename + "' could not be loaded: " + ex.Message, ex); } } // Token: 0x06002A0E RID: 10766 RVA: 0x00086E9C File Offset: 0x0008509C internal static void LoadDefaultDelayedChannels() { Hashtable hashtable = RemotingConfiguration.channelTemplates; lock (hashtable) { if (!RemotingConfiguration.defaultDelayedConfigRead && !RemotingConfiguration.defaultConfigRead) { SmallXmlParser smallXmlParser = new SmallXmlParser(); using (TextReader textReader = new StreamReader(Environment.GetMachineConfigPath())) { ConfigHandler configHandler = new ConfigHandler(true); smallXmlParser.Parse(textReader, configHandler); } RemotingConfiguration.defaultDelayedConfigRead = true; } } } /// Retrieves an array of object types registered on the client as types that will be activated remotely. /// An array of object types registered on the client as types that will be activated remotely. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A0F RID: 10767 RVA: 0x00086F48 File Offset: 0x00085148 public static ActivatedClientTypeEntry[] GetRegisteredActivatedClientTypes() { Hashtable hashtable = RemotingConfiguration.channelTemplates; ActivatedClientTypeEntry[] array2; lock (hashtable) { ActivatedClientTypeEntry[] array = new ActivatedClientTypeEntry[RemotingConfiguration.activatedClientEntries.Count]; RemotingConfiguration.activatedClientEntries.Values.CopyTo(array, 0); array2 = array; } return array2; } /// Retrieves an array of object types registered on the service end that can be activated on request from a client. /// An array of object types registered on the service end that can be activated on request from a client. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A10 RID: 10768 RVA: 0x00086FB4 File Offset: 0x000851B4 public static ActivatedServiceTypeEntry[] GetRegisteredActivatedServiceTypes() { Hashtable hashtable = RemotingConfiguration.channelTemplates; ActivatedServiceTypeEntry[] array2; lock (hashtable) { ActivatedServiceTypeEntry[] array = new ActivatedServiceTypeEntry[RemotingConfiguration.activatedServiceEntries.Count]; RemotingConfiguration.activatedServiceEntries.Values.CopyTo(array, 0); array2 = array; } return array2; } /// Retrieves an array of object types registered on the client end as well-known types. /// An array of object types registered on the client end as well-known types. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A11 RID: 10769 RVA: 0x00087020 File Offset: 0x00085220 public static WellKnownClientTypeEntry[] GetRegisteredWellKnownClientTypes() { Hashtable hashtable = RemotingConfiguration.channelTemplates; WellKnownClientTypeEntry[] array2; lock (hashtable) { WellKnownClientTypeEntry[] array = new WellKnownClientTypeEntry[RemotingConfiguration.wellKnownClientEntries.Count]; RemotingConfiguration.wellKnownClientEntries.Values.CopyTo(array, 0); array2 = array; } return array2; } /// Retrieves an array of object types registered on the service end as well-known types. /// An array of object types registered on the service end as well-known types. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A12 RID: 10770 RVA: 0x0008708C File Offset: 0x0008528C public static WellKnownServiceTypeEntry[] GetRegisteredWellKnownServiceTypes() { Hashtable hashtable = RemotingConfiguration.channelTemplates; WellKnownServiceTypeEntry[] array2; lock (hashtable) { WellKnownServiceTypeEntry[] array = new WellKnownServiceTypeEntry[RemotingConfiguration.wellKnownServiceEntries.Count]; RemotingConfiguration.wellKnownServiceEntries.Values.CopyTo(array, 0); array2 = array; } return array2; } /// Returns a Boolean value that indicates whether the specified is allowed to be client activated. /// true if the specified is allowed to be client activated; otherwise, false. /// The object to check. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A13 RID: 10771 RVA: 0x000870F8 File Offset: 0x000852F8 public static bool IsActivationAllowed(Type svrType) { Hashtable hashtable = RemotingConfiguration.channelTemplates; bool flag; lock (hashtable) { flag = RemotingConfiguration.activatedServiceEntries.ContainsKey(svrType); } return flag; } /// Checks whether the specified object is registered as a remotely activated client type. /// The that corresponds to the specified object type. /// The object type to check. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A14 RID: 10772 RVA: 0x0008714C File Offset: 0x0008534C public static ActivatedClientTypeEntry IsRemotelyActivatedClientType(Type svrType) { Hashtable hashtable = RemotingConfiguration.channelTemplates; ActivatedClientTypeEntry activatedClientTypeEntry; lock (hashtable) { activatedClientTypeEntry = RemotingConfiguration.activatedClientEntries[svrType] as ActivatedClientTypeEntry; } return activatedClientTypeEntry; } /// Checks whether the object specified by its type name and assembly name is registered as a remotely activated client type. /// The that corresponds to the specified object type. /// The type name of the object to check. /// The assembly name of the object to check. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A15 RID: 10773 RVA: 0x000871A4 File Offset: 0x000853A4 public static ActivatedClientTypeEntry IsRemotelyActivatedClientType(string typeName, string assemblyName) { return RemotingConfiguration.IsRemotelyActivatedClientType(Assembly.Load(assemblyName).GetType(typeName)); } /// Checks whether the specified object is registered as a well-known client type. /// The that corresponds to the specified object type. /// The object to check. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A16 RID: 10774 RVA: 0x000871B8 File Offset: 0x000853B8 public static WellKnownClientTypeEntry IsWellKnownClientType(Type svrType) { Hashtable hashtable = RemotingConfiguration.channelTemplates; WellKnownClientTypeEntry wellKnownClientTypeEntry; lock (hashtable) { wellKnownClientTypeEntry = RemotingConfiguration.wellKnownClientEntries[svrType] as WellKnownClientTypeEntry; } return wellKnownClientTypeEntry; } /// Checks whether the object specified by its type name and assembly name is registered as a well-known client type. /// The that corresponds to the specified object type. /// The type name of the object to check. /// The assembly name of the object to check. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A17 RID: 10775 RVA: 0x00087210 File Offset: 0x00085410 public static WellKnownClientTypeEntry IsWellKnownClientType(string typeName, string assemblyName) { return RemotingConfiguration.IsWellKnownClientType(Assembly.Load(assemblyName).GetType(typeName)); } /// Registers an object recorded in the provided on the client end as a type that can be activated on the server. /// Configuration settings for the client-activated type. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A18 RID: 10776 RVA: 0x00087224 File Offset: 0x00085424 public static void RegisterActivatedClientType(ActivatedClientTypeEntry entry) { Hashtable hashtable = RemotingConfiguration.channelTemplates; lock (hashtable) { if (RemotingConfiguration.wellKnownClientEntries.ContainsKey(entry.ObjectType) || RemotingConfiguration.activatedClientEntries.ContainsKey(entry.ObjectType)) { throw new RemotingException("Attempt to redirect activation of type '" + entry.ObjectType.FullName + "' which is already redirected."); } RemotingConfiguration.activatedClientEntries[entry.ObjectType] = entry; ActivationServices.EnableProxyActivation(entry.ObjectType, true); } } /// Registers an object on the client end as a type that can be activated on the server, using the given parameters to initialize a new instance of the class. /// The object . /// URL of the application where this type is activated. /// The or parameter is null. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A19 RID: 10777 RVA: 0x000872CC File Offset: 0x000854CC public static void RegisterActivatedClientType(Type type, string appUrl) { if (type == null) { throw new ArgumentNullException("type"); } if (appUrl == null) { throw new ArgumentNullException("appUrl"); } RemotingConfiguration.RegisterActivatedClientType(new ActivatedClientTypeEntry(type, appUrl)); } /// Registers an object type recorded in the provided on the service end as one that can be activated on request from a client. /// Configuration settings for the client-activated type. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// /// // Token: 0x06002A1A RID: 10778 RVA: 0x00087308 File Offset: 0x00085508 public static void RegisterActivatedServiceType(ActivatedServiceTypeEntry entry) { Hashtable hashtable = RemotingConfiguration.channelTemplates; lock (hashtable) { RemotingConfiguration.activatedServiceEntries.Add(entry.ObjectType, entry); } } /// Registers a specified object type on the service end as a type that can be activated on request from a client. /// The of object to register. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// /// // Token: 0x06002A1B RID: 10779 RVA: 0x0008735C File Offset: 0x0008555C public static void RegisterActivatedServiceType(Type type) { RemotingConfiguration.RegisterActivatedServiceType(new ActivatedServiceTypeEntry(type)); } /// Registers an object on the client end as a well-known type that can be activated on the server, using the given parameters to initialize a new instance of the class. /// The object . /// URL of a well-known client object. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A1C RID: 10780 RVA: 0x0008736C File Offset: 0x0008556C public static void RegisterWellKnownClientType(Type type, string objectUrl) { if (type == null) { throw new ArgumentNullException("type"); } if (objectUrl == null) { throw new ArgumentNullException("objectUrl"); } RemotingConfiguration.RegisterWellKnownClientType(new WellKnownClientTypeEntry(type, objectUrl)); } /// Registers an object recorded in the provided on the client end as a well-known type that can be activated on the server. /// Configuration settings for the well-known type. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A1D RID: 10781 RVA: 0x000873A8 File Offset: 0x000855A8 public static void RegisterWellKnownClientType(WellKnownClientTypeEntry entry) { Hashtable hashtable = RemotingConfiguration.channelTemplates; lock (hashtable) { if (RemotingConfiguration.wellKnownClientEntries.ContainsKey(entry.ObjectType) || RemotingConfiguration.activatedClientEntries.ContainsKey(entry.ObjectType)) { throw new RemotingException("Attempt to redirect activation of type '" + entry.ObjectType.FullName + "' which is already redirected."); } RemotingConfiguration.wellKnownClientEntries[entry.ObjectType] = entry; ActivationServices.EnableProxyActivation(entry.ObjectType, true); } } /// Registers an object on the service end as a well-known type, using the given parameters to initialize a new instance of . /// The object . /// The object URI. /// The activation mode of the well-known object type being registered. (See .) /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A1E RID: 10782 RVA: 0x00087450 File Offset: 0x00085650 public static void RegisterWellKnownServiceType(Type type, string objectUri, WellKnownObjectMode mode) { RemotingConfiguration.RegisterWellKnownServiceType(new WellKnownServiceTypeEntry(type, objectUri, mode)); } /// Registers an object recorded in the provided on the service end as a well-known type. /// Configuration settings for the well-known type. /// At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. /// /// /// // Token: 0x06002A1F RID: 10783 RVA: 0x00087460 File Offset: 0x00085660 public static void RegisterWellKnownServiceType(WellKnownServiceTypeEntry entry) { Hashtable hashtable = RemotingConfiguration.channelTemplates; lock (hashtable) { RemotingConfiguration.wellKnownServiceEntries[entry.ObjectUri] = entry; RemotingServices.CreateWellKnownServerIdentity(entry.ObjectType, entry.ObjectUri, entry.Mode); } } // Token: 0x06002A20 RID: 10784 RVA: 0x000874CC File Offset: 0x000856CC internal static void RegisterChannelTemplate(ChannelData channel) { RemotingConfiguration.channelTemplates[channel.Id] = channel; } // Token: 0x06002A21 RID: 10785 RVA: 0x000874E0 File Offset: 0x000856E0 internal static void RegisterClientProviderTemplate(ProviderData prov) { RemotingConfiguration.clientProviderTemplates[prov.Id] = prov; } // Token: 0x06002A22 RID: 10786 RVA: 0x000874F4 File Offset: 0x000856F4 internal static void RegisterServerProviderTemplate(ProviderData prov) { RemotingConfiguration.serverProviderTemplates[prov.Id] = prov; } // Token: 0x06002A23 RID: 10787 RVA: 0x00087508 File Offset: 0x00085708 internal static void RegisterChannels(ArrayList channels, bool onlyDelayed) { foreach (object obj in channels) { ChannelData channelData = (ChannelData)obj; if (!onlyDelayed || !(channelData.DelayLoadAsClientChannel != "true")) { if (!RemotingConfiguration.defaultDelayedConfigRead || !(channelData.DelayLoadAsClientChannel == "true")) { if (channelData.Ref != null) { ChannelData channelData2 = (ChannelData)RemotingConfiguration.channelTemplates[channelData.Ref]; if (channelData2 == null) { throw new RemotingException("Channel template '" + channelData.Ref + "' not found"); } channelData.CopyFrom(channelData2); } foreach (object obj2 in channelData.ServerProviders) { ProviderData providerData = (ProviderData)obj2; if (providerData.Ref != null) { ProviderData providerData2 = (ProviderData)RemotingConfiguration.serverProviderTemplates[providerData.Ref]; if (providerData2 == null) { throw new RemotingException("Provider template '" + providerData.Ref + "' not found"); } providerData.CopyFrom(providerData2); } } foreach (object obj3 in channelData.ClientProviders) { ProviderData providerData3 = (ProviderData)obj3; if (providerData3.Ref != null) { ProviderData providerData4 = (ProviderData)RemotingConfiguration.clientProviderTemplates[providerData3.Ref]; if (providerData4 == null) { throw new RemotingException("Provider template '" + providerData3.Ref + "' not found"); } providerData3.CopyFrom(providerData4); } } ChannelServices.RegisterChannelConfig(channelData); } } } } // Token: 0x06002A24 RID: 10788 RVA: 0x0008775C File Offset: 0x0008595C internal static void RegisterTypes(ArrayList types) { foreach (object obj in types) { TypeEntry typeEntry = (TypeEntry)obj; if (typeEntry is ActivatedClientTypeEntry) { RemotingConfiguration.RegisterActivatedClientType((ActivatedClientTypeEntry)typeEntry); } else if (typeEntry is ActivatedServiceTypeEntry) { RemotingConfiguration.RegisterActivatedServiceType((ActivatedServiceTypeEntry)typeEntry); } else if (typeEntry is WellKnownClientTypeEntry) { RemotingConfiguration.RegisterWellKnownClientType((WellKnownClientTypeEntry)typeEntry); } else if (typeEntry is WellKnownServiceTypeEntry) { RemotingConfiguration.RegisterWellKnownServiceType((WellKnownServiceTypeEntry)typeEntry); } } } /// Indicates whether the server channels in this application domain return filtered or complete exception information to local or remote callers. /// true if only filtered exception information is returned to local or remote callers, as specified by the parameter; false if complete exception information is returned. /// true to specify local callers; false to specify remote callers. // Token: 0x06002A25 RID: 10789 RVA: 0x00087828 File Offset: 0x00085A28 public static bool CustomErrorsEnabled(bool isLocalRequest) { return !(RemotingConfiguration._errorMode == "off") && (RemotingConfiguration._errorMode == "on" || !isLocalRequest); } // Token: 0x06002A26 RID: 10790 RVA: 0x00087868 File Offset: 0x00085A68 internal static void SetCustomErrorsMode(string mode) { if (mode == null) { throw new RemotingException("mode attribute is required"); } string text = mode.ToLower(); if (text != "on" && text != "off" && text != "remoteonly") { throw new RemotingException("Invalid custom error mode: " + mode); } RemotingConfiguration._errorMode = text; } // Token: 0x0400101E RID: 4126 private static string applicationID = null; // Token: 0x0400101F RID: 4127 private static string applicationName = null; // Token: 0x04001020 RID: 4128 private static string processGuid = null; // Token: 0x04001021 RID: 4129 private static bool defaultConfigRead = false; // Token: 0x04001022 RID: 4130 private static bool defaultDelayedConfigRead = false; // Token: 0x04001023 RID: 4131 private static string _errorMode; // Token: 0x04001024 RID: 4132 private static Hashtable wellKnownClientEntries = new Hashtable(); // Token: 0x04001025 RID: 4133 private static Hashtable activatedClientEntries = new Hashtable(); // Token: 0x04001026 RID: 4134 private static Hashtable wellKnownServiceEntries = new Hashtable(); // Token: 0x04001027 RID: 4135 private static Hashtable activatedServiceEntries = new Hashtable(); // Token: 0x04001028 RID: 4136 private static Hashtable channelTemplates = new Hashtable(); // Token: 0x04001029 RID: 4137 private static Hashtable clientProviderTemplates = new Hashtable(); // Token: 0x0400102A RID: 4138 private static Hashtable serverProviderTemplates = new Hashtable(); } }