public UnixClientChannel()
 {
     this._sinkProvider = new UnixBinaryClientFormatterSinkProvider()
     {
         Next = new UnixClientTransportSinkProvider()
     };
 }
        public UnixClientChannel(IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            object item = properties["name"];

            if (item != null)
            {
                this.name = item as string;
            }
            item = properties["priority"];
            if (item != null)
            {
                this.priority = Convert.ToInt32(item);
            }
            if (sinkProvider == null)
            {
                this._sinkProvider = new UnixBinaryClientFormatterSinkProvider()
                {
                    Next = new UnixClientTransportSinkProvider()
                };
            }
            else
            {
                this._sinkProvider = sinkProvider;
                IClientChannelSinkProvider next = sinkProvider;
                while (next.Next != null)
                {
                    next = next.Next;
                }
                next.Next = new UnixClientTransportSinkProvider();
            }
        }
        /// <summary>
        /// Start connection with specified engine interface
        /// </summary>
        /// <param name="typeEngineInterface">Type of engine interface</param>
        /// <param name="urlClient">Asscoiated URL</param>
        /// <param name="ensureSecurity">Remoting security attribute</param>
        public void Start(string urlClient, bool ensureSecurity, uint timeOut, Type iProxyType)
        {
            Trace.TraceInformation("Configuring client connection");

            _ensureSecurity = ensureSecurity;

            IDictionary t = new Hashtable();
            t.Add("timeout", timeOut);
            t.Add("name", urlClient);

            #if MONO
            _sinkProvider = new BinaryClientFormatterSinkProvider();
            #endif

            #if MONO
            /* MoMA moans about this line, but not clear why?
            Message	10	MonoTodo: void HttpClientChannel..ctor(IDictionary, IClientChannelSinkProvider)
            Reason: Handle the machineName, proxyName, proxyPort, servicePrincipalName, useAuthenticatedConnectionSharing properties	D:\Source\Projects\FluidEarth_Trunk\FluidEarth\SDK\src\ConnectionHttp.cs	148	14	PluginInterfaces
            */
            _channel = new HttpClientChannel(t, _sinkProvider);
            #else
            // need to make ChannelNames unique so need to use this
            // constructor even though we dont care about the sink provider
            _channel = new HttpClientChannel(t, _sinkProvider);
            #endif

            ChannelServices.RegisterChannel(_channel, _ensureSecurity);

            Trace.TraceInformation("Configured client connection");

            _base = (IBase)Activator.GetObject(iProxyType, urlClient);

            Trace.TraceInformation("Acquired proxy");
        }
        /// <summary>
        /// Start connection with specified engine interface
        /// </summary>
        /// <param name="typeEngineInterface">Type of engine interface</param>
        /// <param name="urlClient">Asscoiated URL</param>
        /// <param name="ensureSecurity">Remoting security attribute</param>
        public void Start(string urlClient, bool ensureSecurity, uint timeOut, Type iProxyType)
        {
            Trace.TraceInformation("Configuring client connection");

            _ensureSecurity = ensureSecurity;

            #if MONO
            _sinkProvider = new BinaryClientFormatterSinkProvider();
            #endif

            IDictionary t = new Hashtable();
            t.Add("timeout", timeOut);
            t.Add("name", urlClient);

            Console.WriteLine("New IPC channel");

            // need to make ChannelNames unique so need to use this
            // constructor even though we dont care about the sink provider
            _channel = new IpcClientChannel(urlClient, _sinkProvider);

            Console.WriteLine("\tRegister");

            ChannelServices.RegisterChannel(_channel, _ensureSecurity);

            Console.WriteLine("\tActivate object proxy to IEngine");

            _base = (IBase)Activator.GetObject(iProxyType, urlClient);

            Console.WriteLine("\tActivated.");
        }
        } // HttpChannel

        public HttpChannel(IDictionary properties, 
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();
        
            // divide properties up for respective channels
            if (properties != null)
            {            
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;
                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break;
                    case "secure": _secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); 
                                    clientData["secure"] = entry.Value;
                                    serverData["secure"] = entry.Value;
                                    break;
                    default: 
                        clientData[entry.Key] = entry.Value;
                        serverData[entry.Key] = entry.Value;
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
		public HttpClientChannel(String name, IClientChannelSinkProvider sinkProvider)
		{
			if(name != null)
				_channelName = name;
			
			SetupProvider (sinkProvider, null);
		}
		/// <summary></summary>
		public ClientWorkflowInvoker(IDictionary properties, IClientChannelSinkProvider clientSinkProvider) 
		{	
			try 
			{	
                // configuration file
			    if(properties.Contains("timeout"))
                    _TimeOut = Convert.ToInt32(properties["timeout"]);
                if (properties.Contains("name"))
                    _ChannelName = Convert.ToString(properties["name"]);
                if (properties.Contains("callcontextActor"))
                    _CallContextActor = Convert.ToString(properties["callcontextActor"]);
             
				// channel provider
				_Provider = clientSinkProvider == null ? new BinaryClientFormatterSinkProvider() : clientSinkProvider;

				// add the ClientWorkflowInvokerProvider at the end
				IClientChannelSinkProvider provider = _Provider;
                while (provider.Next != null)
                {
                    provider = provider.Next;
                }
				provider.Next = new ClientWorkflowInvokerProvider();
			}
			catch(Exception ex) 
			{
                Trace.WriteLine(ex);
			}
		}
Esempio n. 8
0
        /// <summary>
        /// Creates a client channel.
        /// </summary>
        /// <param name="properties">The properties.</param>
        /// <param name="sinkProvider">The provider</param>
        public IpcClientChannel(IDictionary properties, IClientChannelSinkProvider provider)
        {
            if (properties != null) 
            {
                foreach (DictionaryEntry e in properties) 
                {
                    switch ((string)e.Key) 
                    {
                        case "name":
                            channelName = (string)e.Value;
                            break;
                        case "priority":
                            channelPriority = Convert.ToInt32(e.Value);
                            break;
                    }
                }
            }

            if (provider == null) 
            {
                clientProvider = new BinaryClientFormatterSinkProvider();
                clientProvider.Next = new IpcClientChannelSinkProvider();
            }
            else 
            {
                // add us to the sink chain.
                clientProvider = provider;
                IClientChannelSinkProvider p;
                for (p = clientProvider; p.Next != null; p = p.Next) {}
                p.Next = new IpcClientChannelSinkProvider();
            }
                                        
        }
Esempio n. 9
0
        } // HttpClientChannel()

        public HttpClientChannel(String name, IClientChannelSinkProvider sinkProvider)
        {
            _channelName  = name;
            _sinkProvider = sinkProvider;

            SetupChannel();
        } // HttpClientChannel(IClientChannelSinkProvider sinkProvider)
Esempio n. 10
0
        // constructor used by config file
        /// <include file='doc\TcpClientChannel.uex' path='docs/doc[@for="TcpClientChannel.TcpClientChannel2"]/*' />
        public TcpClientChannel(IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32(entry.Value); break;

                    default:
                        throw new ArgumentException(
                                  String.Format(
                                      CoreChannel.GetResourceString(
                                          "Remoting_Channels_BadCtorArgs"),
                                      entry.Key));
                    }
                }
            }

            _sinkProvider = sinkProvider;

            SetupChannel();
        } // TcpClientChannel
Esempio n. 11
0
        // constructor used by config file
        /// <include file='doc\TcpClientChannel.uex' path='docs/doc[@for="TcpClientChannel.TcpClientChannel2"]/*' />
        public TcpClientChannel(IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    case "name": _channelName = (String)entry.Value; break;
                    case "priority": _channelPriority = Convert.ToInt32(entry.Value); break;

                    default: 
                         throw new ArgumentException(
                            String.Format(
                                CoreChannel.GetResourceString(
                                    "Remoting_Channels_BadCtorArgs"),
                                entry.Key));
                    }
                }
            }

            _sinkProvider = sinkProvider;

            SetupChannel();
        } // TcpClientChannel
Esempio n. 12
0
        /// <summary>
        /// Creates a client channel.
        /// </summary>
        /// <param name="properties">The properties.</param>
        /// <param name="sinkProvider">The provider</param>
        public IpcClientChannel(IDictionary properties, IClientChannelSinkProvider provider)
        {
            if (properties != null)
            {
                foreach (DictionaryEntry e in properties)
                {
                    switch ((string)e.Key)
                    {
                    case "name":
                        channelName = (string)e.Value;
                        break;

                    case "priority":
                        channelPriority = Convert.ToInt32(e.Value);
                        break;
                    }
                }
            }

            if (provider == null)
            {
                clientProvider      = new BinaryClientFormatterSinkProvider();
                clientProvider.Next = new IpcClientChannelSinkProvider();
            }
            else
            {
                // add us to the sink chain.
                clientProvider = provider;
                IClientChannelSinkProvider p;
                for (p = clientProvider; p.Next != null; p = p.Next)
                {
                }
                p.Next = new IpcClientChannelSinkProvider();
            }
        }
Esempio n. 13
0
        /// <summary></summary>
        public ClientWorkflowInvoker(IDictionary properties, IClientChannelSinkProvider clientSinkProvider)
        {
            try
            {
                // configuration file
                if (properties.Contains("timeout"))
                {
                    _TimeOut = Convert.ToInt32(properties["timeout"]);
                }
                if (properties.Contains("name"))
                {
                    _ChannelName = Convert.ToString(properties["name"]);
                }
                if (properties.Contains("callcontextActor"))
                {
                    _CallContextActor = Convert.ToString(properties["callcontextActor"]);
                }

                // channel provider
                _Provider = clientSinkProvider == null ? new BinaryClientFormatterSinkProvider() : clientSinkProvider;

                // add the ClientWorkflowInvokerProvider at the end
                IClientChannelSinkProvider provider = _Provider;
                while (provider.Next != null)
                {
                    provider = provider.Next;
                }
                provider.Next = new ClientWorkflowInvokerProvider();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }
Esempio n. 14
0
        // constructor used by config file
        public IpcClientChannel(IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            if (properties != null)
            {
                _prop = properties;
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32(entry.Value, CultureInfo.InvariantCulture); break;

                    case "secure": _secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); break;

                    default:
                        break;
                    }
                }
            }

            _sinkProvider = sinkProvider;

            SetupChannel();
        } // IpcClientChannel
        /// <summary>
        /// Constructs an instance of the GenuineUdpChannel class.
        /// </summary>
        /// <param name="properties">An IDictionary of the channel properties which hold the configuration information for the current channel.</param>
        /// <param name="iClientChannelSinkProvider">The IClientChannelSinkProvider that creates the client channel sinks for the underlying channel through which remoting messages flow through.</param>
        /// <param name="iServerChannelSinkProvider">The IServerChannelSinkProvider that creates server channel sinks for the underlying channel through which remoting messages flow through.</param>
        public GenuineUdpChannel(IDictionary properties, IClientChannelSinkProvider iClientChannelSinkProvider, IServerChannelSinkProvider iServerChannelSinkProvider)
            : base(iClientChannelSinkProvider, iServerChannelSinkProvider)
        {
            this.ITransportContext = TransportContextServices.CreateDefaultUdpContext(properties, this);
            this.InitializeInstance(properties);

            if (this._channelName == null)
            {
                this._channelName = "gudp";
            }
            if (this._urlPrefix == null)
            {
                this._urlPrefix = "gudp";
            }
            this._possibleChannelPrefixes = new string[] { this.UrlPrefix, this.UriPrefix, GetBroadcastUriPrefix(this.UrlPrefix), GetBroadcastUriPrefix(this.UriPrefix) };

            // retrieve settings
            string uriToListen = this["Address"] as string;

            foreach (DictionaryEntry entry in properties)
            {
                if (string.Compare(entry.Key.ToString(), "Address", true) == 0)
                {
                    uriToListen = entry.Value.ToString();
                }
            }
            if (uriToListen == null || uriToListen.Length <= 0 || !uriToListen.StartsWith(this.UrlPrefix + ":"))
            {
                throw GenuineExceptions.Get_Server_IncorrectAddressToListen(uriToListen);
            }

            this.StartListening(uriToListen);
        }
Esempio n. 16
0
        /// <summary>
        /// Builds the client sink chain.
        /// </summary>
        /// <returns>First sink provider in sink chain</returns>
        protected virtual IClientChannelSinkProvider BuildClientSinkChain()
        {
            IClientChannelSinkProvider firstProvider = null;
            IClientChannelSinkProvider lastProvider  = null;

            foreach (var sinkProvider in _clientSinkChain)
            {
                sinkProvider.Next = null;

                if (firstProvider == null)
                {
                    firstProvider = sinkProvider;
                }

                if (lastProvider == null)
                {
                    lastProvider = sinkProvider;
                }
                else
                {
                    lastProvider.Next = sinkProvider;
                    lastProvider      = sinkProvider;
                }
            }
            return(firstProvider);
        }
Esempio n. 17
0
        private void InitializeWithFormatters(IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
        {
            ClientSinkProvider = clientSinkProvider = clientSinkProvider ?? new BinaryClientFormatterSinkProvider();
            serverSinkProvider = serverSinkProvider ?? new BinaryServerFormatterSinkProvider {
                TypeFilterLevel = TypeFilterLevel.Full
            };

            // add our client sink provider to the end of ClientSinkProvider chain
            while (clientSinkProvider.Next != null)
            {
                clientSinkProvider = clientSinkProvider.Next;
            }
            clientSinkProvider.Next = new NullClientChannelSink.Provider();

            // collect channel data
            var provider = serverSinkProvider;

            while (provider.Next != null)
            {
                provider.GetChannelData(ChannelDataStore);
                provider = provider.Next;
            }

            // create server sink chain
            var nextSink = ChannelServices.CreateServerChannelSinkChain(serverSinkProvider, this);

            ServerSink = new NullServerChannelSink(nextSink);
        }
Esempio n. 18
0
        public System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)
        {
            if (url == null && remoteChannelData != null && remoteChannelData as IChannelDataStore != null)
            {
                IChannelDataStore ds = (IChannelDataStore)remoteChannelData;
                url = ds.ChannelUris[0];
            }

            // format:   "BidirTCP://hostname:port/URI/to/object"
            if (url != null && (url.ToLower().StartsWith(Helper.TCP_PREFIX) || url.ToLower().StartsWith(Helper.TCPGUID_PREFIX)))
            {
                // walk to last provider and add this channel sink's provider
                IClientChannelSinkProvider prov = _clientProvider;
                while (prov.Next != null)
                {
                    prov = prov.Next;
                }
                ;
                prov.Next = new BidirTcpClientTransportSinkProvider(url);

                Helper.ParseURL(url, out objectURI);
                IMessageSink msgsink = (IMessageSink)_clientProvider.CreateSink(this, url, remoteChannelData);
                return(msgsink);
            }
            else
            {
                objectURI = null;
                return(null);
            }
        }
Esempio n. 19
0
        } // IpcClientChannel


        public IpcClientChannel(String name, IClientChannelSinkProvider sinkProvider)
        {
            _channelName = name;
            _sinkProvider = sinkProvider;

            SetupChannel();
        }
        } // HttpChannel

        public HttpChannel(IDictionary properties,
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();

            // divide properties up for respective channels
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break;

                    case "secure": _secure   = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                        clientData["secure"] = entry.Value;
                        serverData["secure"] = entry.Value;
                        break;

                    default:
                        clientData[entry.Key] = entry.Value;
                        serverData[entry.Key] = entry.Value;
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
Esempio n. 21
0
        public IpcChannel(IDictionary properties,
                          IClientChannelSinkProvider clientSinkProvider,
                          IServerChannelSinkProvider serverSinkProvider)
        {
            if (properties != null)
            {
                _portName = properties ["portName"] as string;
                if (properties ["name"] != null)
                {
                    _name = properties ["name"] as string;
                }
                else
                {
                    properties ["name"] = _name;
                }
                if (properties ["priority"] != null)
                {
                    _priority = Convert.ToInt32(properties ["priority"]);
                }
            }

            if (_portName != null)
            {
                _serverChannel = new IpcServerChannel(properties, serverSinkProvider);
            }

            _clientChannel = new IpcClientChannel(properties, clientSinkProvider);
        }
 public UdpClientChannel(IDictionary properties, IClientChannelSinkProvider provider)
 {
     ChannelName        = properties.GetValue("name", UdpChannelHelper.DefaultName);
     ChannelPriority    = properties.GetValue("priority", UdpChannelHelper.DefaultPriority);
     ClientSinkProvider = provider ?? UdpChannelHelper.CreateClientSinkProvider();
     SetupClientProviderChain(ClientSinkProvider, new UdpClientChannelSinkProvider());
 }
Esempio n. 23
0
        public CedonkeyCRemoto()
        {
            props = new Hashtable();
            props.Add("name","eLePhantClient");
            props.Add("priority","10");
            props.Add("port",0);

            #if (!COMPRESSION)

            props.Add("supressChannelData",true);
            props.Add("useIpAddress",true);
            props.Add("rejectRemoteRequests",false);
            provider = new BinaryClientFormatterSinkProvider();

            #else
            //iniciacion
            Hashtable propsinks = new Hashtable();
            propsinks.Add("includeVersions",true);
            Hashtable datasinks = new Hashtable();

            //2ª Opcion
            provider = new eLePhantClientSinkProvider(propsinks,datasinks);

            #endif
        }
Esempio n. 24
0
		public TcpClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
		{
			if (properties != null) {
				object val = properties ["name"];
				if (val != null) name = val as string;
			
				val = properties ["priority"];
				if (val != null) priority = Convert.ToInt32 (val);
			}
			
			if (sinkProvider != null)
			{
				_sinkProvider = sinkProvider;

				// add the tcp provider at the end of the chain
				IClientChannelSinkProvider prov = sinkProvider;
				while (prov.Next != null) prov = prov.Next;
				prov.Next = new TcpClientTransportSinkProvider ();

				// Note: a default formatter is added only when
				// no sink providers are specified in the config file.
			}
			else
			{
				_sinkProvider = new BinaryClientFormatterSinkProvider ();
				_sinkProvider.Next = new TcpClientTransportSinkProvider ();
			}

		}
Esempio n. 25
0
        public UnixClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            object val = properties ["name"];
            if (val != null) name = val as string;
            
            val = properties ["priority"];
            if (val != null) priority = Convert.ToInt32 (val);
            
            if (sinkProvider != null)
            {
                _sinkProvider = sinkProvider;

                // add the unix provider at the end of the chain
                IClientChannelSinkProvider prov = sinkProvider;
                while (prov.Next != null) prov = prov.Next;
                prov.Next = new UnixClientTransportSinkProvider ();

                // Note: a default formatter is added only when
                // no sink providers are specified in the config file.
            }
            else
            {
                _sinkProvider = new UnixBinaryClientFormatterSinkProvider ();
                _sinkProvider.Next = new UnixClientTransportSinkProvider ();
            }

        }
Esempio n. 26
0
        private void Initialize(IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            if (properties != null)
            {
                // read property values
                foreach (DictionaryEntry property in properties)
                {
                    switch ((string)property.Key)
                    {
                    case "name": _channelName = Convert.ToString(property.Value); break;

                    case "priority": _channelPriority = Convert.ToInt32(property.Value); break;

                    case "cachedConnections": _cachedConnections = Convert.ToInt32(property.Value); break;
                    }
                }
            }

            // create the chain of the sink providers that will process all messages
            _sinkProvider = ChannelHelper.ClientChannelCreateSinkProviderChain(
                sinkProvider, new PipeClientTransportSinkProvider());

            //  create connection cache
            _connectionCache = new ConnectionCache(_cachedConnections, new ConnectionFactory(CreateConnection));
        }
Esempio n. 27
0
        } // HttpClientChannel

        private void SetupChannel()
        {
            if (_sinkProvider != null)
            {
                CoreChannel.AppendProviderToClientProviderChain(
                    _sinkProvider, new HttpClientTransportSinkProvider());
            }
            else
            {
                _sinkProvider = CreateDefaultClientProviderChain();
            }


            // proxy might have been created by setting proxyname/port in constructor with dictionary
            if (_proxyObject == null)
            {
                // In this case, try to use the default proxy settings.
                WebProxy defaultProxy = WebProxy.GetDefaultProxy();
                if (defaultProxy != null)
                {
                    Uri address = defaultProxy.Address;
                    if (address != null)
                    {
                        _proxyName = address.Host;
                        _proxyPort = address.Port;
                    }
                }
                UpdateProxy();
            }
        } // SetupChannel()
Esempio n. 28
0
 public UdpClientChannel(IDictionary properties, IClientChannelSinkProvider provider)
 {
     ChannelName = properties.GetValue("name", UdpChannelHelper.DefaultName);
     ChannelPriority = properties.GetValue("priority", UdpChannelHelper.DefaultPriority);
     ClientSinkProvider = provider ?? UdpChannelHelper.CreateClientSinkProvider();
     SetupClientProviderChain(ClientSinkProvider, new UdpClientChannelSinkProvider());
 }
Esempio n. 29
0
 public IpcClientChannel (string name,
                          IClientChannelSinkProvider sinkProvider)
 {
         if (IpcChannel.IsUnix)
                 _innerChannel = new Unix.IpcClientChannel (name, sinkProvider);
         else
                 _innerChannel = new Win32.IpcClientChannel (name, sinkProvider);
 }
Esempio n. 30
0
 public IpcClientChannel (IDictionary properties,
                          IClientChannelSinkProvider sinkProvider)
 {
         if (IpcChannel.IsUnix)
                 _innerChannel = new Unix.IpcClientChannel (properties, sinkProvider);
         else
                 _innerChannel = new Win32.IpcClientChannel (properties, sinkProvider);
 }
Esempio n. 31
0
 /// <summary>
 /// Creates both server and client channels.
 /// </summary>
 /// <param name="properties">The channel properties.</param>
 /// <param name="clientProvider">The client sink provider. It may be <c>null</c>.</param>
 /// <param name="serverProvider">The server sink provider. It may be <c>null</c>.</param>
 public IpcChannel(IDictionary properties,
     IClientChannelSinkProvider clientProvider,
     IServerChannelSinkProvider serverProvider
     )
 {
     clientChannel = new IpcClientChannel(properties, clientProvider);
     serverChannel = new IpcServerChannel(properties, serverProvider);
 }
Esempio n. 32
0
 public IpcClientChannel(string name, IClientChannelSinkProvider sinkProvider)
 {
     this._channelPriority = 1;
     this._channelName     = "ipc client";
     this._channelName     = name;
     this._sinkProvider    = sinkProvider;
     this.SetupChannel();
 }
 public LocalUnixIpcClientChannel(IDictionary properties,
                                  IClientChannelSinkProvider sinkProvider)
 {
     _innerChannel = Activator.CreateInstance(LocalUnixChannelLoader.LoadClientChannel(), new object [] {
         properties,
         sinkProvider
     });
 }
Esempio n. 34
0
 /// <summary>
 /// Creates both server and client channels.
 /// </summary>
 /// <param name="properties">The channel properties.</param>
 /// <param name="clientProvider">The client sink provider. It may be <c>null</c>.</param>
 /// <param name="serverProvider">The server sink provider. It may be <c>null</c>.</param>
 public IpcChannel(IDictionary properties,
                   IClientChannelSinkProvider clientProvider,
                   IServerChannelSinkProvider serverProvider
                   )
 {
     clientChannel = new IpcClientChannel(properties, clientProvider);
     serverChannel = new IpcServerChannel(properties, serverProvider);
 }
 public IpcClientChannel(string name, IClientChannelSinkProvider sinkProvider)
 {
     this._channelPriority = 1;
     this._channelName = "ipc client";
     this._channelName = name;
     this._sinkProvider = sinkProvider;
     this.SetupChannel();
 }
Esempio n. 36
0
 private void Initialize(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
 {
     _clientChannel = new TcpClientChannel(properties, clientSinkProvider);
     if ((properties != null) && (properties["port"] != null))
     {
         _serverChannel = new TcpServerChannel(properties, serverSinkProvider);
     }
 }
Esempio n. 37
0
        private IClientChannelSinkProvider CreateDefaultClientProviderChain()
        {
            IClientChannelSinkProvider provider  = new SoapClientFormatterSinkProvider();
            IClientChannelSinkProvider provider2 = provider;

            provider2.Next = new HttpClientTransportSinkProvider(this._timeout);
            return(provider);
        }
Esempio n. 38
0
        private IClientChannelSinkProvider CreateDefaultClientProviderChain()
        {
            IClientChannelSinkProvider provider  = new BinaryClientFormatterSinkProvider();
            IClientChannelSinkProvider provider2 = provider;

            provider2.Next = new IpcClientTransportSinkProvider(this._prop);
            return(provider);
        }
 public LocalUnixIpcClientChannel(string name,
                                  IClientChannelSinkProvider sinkProvider)
 {
     _innerChannel = Activator.CreateInstance(LocalUnixChannelLoader.LoadClientChannel(), new object [] {
         name,
         sinkProvider
     });
 }
Esempio n. 40
0
        } // TcpChannel

        /// <include file='doc\CombinedTcpChannel.uex' path='docs/doc[@for="TcpChannel.TcpChannel2"]/*' />
        public TcpChannel(IDictionary properties,
                          IClientChannelSinkProvider clientSinkProvider,
                          IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();

            bool portFound = false;

            // divide properties up for respective channels
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value); break;

                    // client properties (none yet)

                    // server properties
                    case "bindTo": serverData["bindTo"] = entry.Value; break;

                    case "machineName": serverData["machineName"] = entry.Value; break;

                    case "port":
                    {
                        serverData["port"] = entry.Value;
                        portFound          = true;
                        break;
                    }

                    case "rejectRemoteRequests": serverData["rejectRemoteRequests"] = entry.Value; break;

                    case "suppressChannelData": serverData["suppressChannelData"] = entry.Value; break;

                    case "useIpAddress": serverData["useIpAddress"] = entry.Value; break;

                    default:
                        throw new ArgumentException(
                                  String.Format(
                                      CoreChannel.GetResourceString(
                                          "Remoting_Channels_BadCtorArgs"),
                                      entry.Key));
                    }
                }
            }

            _clientChannel = new TcpClientChannel(clientData, clientSinkProvider);

            if (portFound)
            {
                _serverChannel = new TcpServerChannel(serverData, serverSinkProvider);
            }
        } // TcpChannel
        internal static IChannel CreateChannelFromConfigEntry(RemotingXmlConfigFileData.ChannelEntry entry)
        {
            object[] objArray;
            Type     c     = RemotingConfigInfo.LoadType(entry.TypeName, entry.AssemblyName);
            bool     flag  = typeof(IChannelReceiver).IsAssignableFrom(c);
            bool     flag2 = typeof(IChannelSender).IsAssignableFrom(c);
            IClientChannelSinkProvider provider  = null;
            IServerChannelSinkProvider provider2 = null;

            if (entry.ClientSinkProviders.Count > 0)
            {
                provider = CreateClientChannelSinkProviderChain(entry.ClientSinkProviders);
            }
            if (entry.ServerSinkProviders.Count > 0)
            {
                provider2 = CreateServerChannelSinkProviderChain(entry.ServerSinkProviders);
            }
            if (flag && flag2)
            {
                objArray = new object[] { entry.Properties, provider, provider2 };
            }
            else if (flag)
            {
                objArray = new object[] { entry.Properties, provider2 };
            }
            else
            {
                if (!flag2)
                {
                    throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_InvalidChannelType"), new object[] { c.FullName }));
                }
                objArray = new object[] { entry.Properties, provider };
            }
            IChannel channel = null;

            try
            {
                channel = (IChannel)Activator.CreateInstance(c, BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance, null, objArray, null, null);
            }
            catch (MissingMethodException)
            {
                string str = null;
                if (flag && flag2)
                {
                    str = "MyChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)";
                }
                else if (flag)
                {
                    str = "MyChannel(IDictionary properties, IServerChannelSinkProvider serverSinkProvider)";
                }
                else if (flag2)
                {
                    str = "MyChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider)";
                }
                throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ChannelMissingCtor"), new object[] { c.FullName, str }));
            }
            return(channel);
        }
Esempio n. 42
0
        } // CreateMessageSink

        //
        // end of IChannelSender implementation
        //

        private IClientChannelSinkProvider CreateDefaultClientProviderChain()
        {
            IClientChannelSinkProvider chain = new BinaryClientFormatterSinkProvider();
            IClientChannelSinkProvider sink  = chain;

            sink.Next = new IpcClientTransportSinkProvider(_prop);

            return(chain);
        } // CreateDefaultClientProviderChain
        void SetupClientProviderChain(IClientChannelSinkProvider clientChain, IClientChannelSinkProvider provider)
        {
            while (clientChain.Next != null)
            {
                clientChain = clientChain.Next;
            }

            clientChain.Next = provider;
        }
Esempio n. 44
0
 public IpcChannel (IDictionary properties,
                    IClientChannelSinkProvider clientSinkProvider,
                    IServerChannelSinkProvider serverSinkProvider)
 {
         if (IsUnix)
                 _innerChannel = new Unix.IpcChannel (properties, clientSinkProvider, serverSinkProvider);
         else
                 _innerChannel = new Win32.IpcChannel (properties, clientSinkProvider, serverSinkProvider);
 }
Esempio n. 45
0
 public PipeChannel(
             IDictionary properties, 
             IClientChannelSinkProvider clientProviderChain,
             IServerChannelSinkProvider serverProviderChain
         )
 {
     _clientChannel = new PipeClientChannel(properties, clientProviderChain);
       _serverChannel = new PipeServerChannel(properties, serverProviderChain);
 }
Esempio n. 46
0
        } // CreateMessageSink

        //
        // end of IChannelSender implementation
        //


        private IClientChannelSinkProvider CreateDefaultClientProviderChain()
        {
            IClientChannelSinkProvider chain = new SoapClientFormatterSinkProvider();
            IClientChannelSinkProvider sink  = chain;

            sink.Next = new HttpClientTransportSinkProvider(_timeout);

            return(chain);
        } // CreateDefaultClientProviderChain
Esempio n. 47
0
 public PipeClientChannel(
     IDictionary properties,
     IClientChannelSinkProvider clientProviderChain
     )
 {
     InitDefaults();
     InitProperties(properties);
     InitProviders(clientProviderChain);
 }
Esempio n. 48
0
 public PipeClientChannel(
                           IDictionary properties, 
                           IClientChannelSinkProvider clientProviderChain
                          )
 {
     InitDefaults();
     InitProperties(properties);
     InitProviders(clientProviderChain);
 }
		public TcpClientChannel (string name, IClientChannelSinkProvider sinkProvider)
		{
			this.name = name;
			_sinkProvider = sinkProvider;

			// add the tcp provider at the end of the chain
			IClientChannelSinkProvider prov = sinkProvider;
			while (prov.Next != null) prov = prov.Next;
			prov.Next = new TcpClientTransportSinkProvider ();
		}
Esempio n. 50
0
		public CORBAClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
		{
			priority = 1;
			sink_provider = sinkProvider;

			// add the tcp provider at the end of the chain
			IClientChannelSinkProvider prov = sinkProvider;
			while (prov.Next != null) prov = prov.Next;
			prov.Next = new CORBAClientTransportSinkProvider ();
		}
Esempio n. 51
0
		public HttpChannel (IDictionary properties,
			IClientChannelSinkProvider clientSinkProvider,
			IServerChannelSinkProvider serverSinkProvider)
		{
			if (properties != null && properties.Contains ("name")) {
				this.name = (string)properties["name"];
			}

			client = new HttpClientChannel (properties, clientSinkProvider);
			server = new HttpServerChannel (properties, serverSinkProvider);
		}
Esempio n. 52
0
 public UdpChannel(IDictionary properties, IClientChannelSinkProvider clientChain, IServerChannelSinkProvider serverChain)
 {
     if (serverChain != null || (properties != null && properties.Contains("port")))
     {
         ServerChannel = new UdpServerChannel(properties, serverChain);
     }
     else
     {
         ClientChannel = new UdpClientChannel(properties, clientChain);
     }
 }
Esempio n. 53
0
		public CORBAClientChannel (string name, IClientChannelSinkProvider sinkProvider)
		{
			priority = 1;		
			this.name = name;
			sink_provider = sinkProvider;

			// add the tcp provider at the end of the chain
			IClientChannelSinkProvider prov = sinkProvider;
			while (prov.Next != null) prov = prov.Next;
			prov.Next = new CORBAClientTransportSinkProvider ();
		}
Esempio n. 54
0
    public IceClientChannel (string n, IClientChannelSinkProvider sp)
    {
      _name = n;
      _sinkProvider = sp;

      // find the end of the chain to put the transport provider
      IClientChannelSinkProvider prov = _sinkProvider;
      while (prov.Next != null) prov = prov.Next;

      prov.Next = new IceClientTransportSinkProvider();
    }
        internal ClientChannelSinkProviderForParticularServer(IClientChannelSinkProvider upstream, string id)
        {
            if (upstream == null) 
                throw new ArgumentNullException("upstream");

            if (String.IsNullOrEmpty(id)) 
                throw new ArgumentNullException("id");

            m_Upstream = upstream;
            m_Url = string.Format("ipc://{0}", id);
        }
 internal static void AppendProviderToClientProviderChain(IClientChannelSinkProvider providerChain, IClientChannelSinkProvider provider)
 {
     if (providerChain == null)
     {
         throw new ArgumentNullException("providerChain");
     }
     while (providerChain.Next != null)
     {
         providerChain = providerChain.Next;
     }
     providerChain.Next = provider;
 }
Esempio n. 57
0
        /// <summary>
        /// Adds a specified client sink provider into the client sink chain.
        /// </summary>
        /// <param name="protocolSetup">Protocol setup</param>
        /// <param name="clientSinkProvider">Client sink provider to be added</param>
        /// <returns>Protocol setup</returns>
        public static IServerProtocolSetup AddClientSink(this IServerProtocolSetup protocolSetup, IClientChannelSinkProvider clientSinkProvider)
        {
            if (protocolSetup == null)
                throw new ArgumentNullException("protocolSetup");

            if (clientSinkProvider == null)
                throw new ArgumentNullException("clientSinkProvider");

            protocolSetup.ClientSinkChain.Add(clientSinkProvider);

            return protocolSetup;
        }
Esempio n. 58
0
    public IceClientChannel (IDictionary properties, IClientChannelSinkProvider sp)
    {
      // properties are ignored for now

      _sinkProvider = sp;

      // find the end of the chain to put the transport provider
      IClientChannelSinkProvider prov = _sinkProvider;
      while (prov.Next != null) prov = prov.Next;

      prov.Next = new IceClientTransportSinkProvider();
    }
        /// <summary>
        /// Constructs an instance of the GenuineHttpServerChannel class.
        /// </summary>
        /// <param name="properties">An IDictionary of the channel properties which hold the configuration information for the current channel.</param>
        /// <param name="iClientChannelSinkProvider">The IClientChannelSinkProvider that creates the client channel sinks for the underlying channel through which remoting messages flow through.</param>
        /// <param name="iServerChannelSinkProvider">The IServerChannelSinkProvider that creates server channel sinks for the underlying channel through which remoting messages flow through.</param>
        public GenuineHttpServerChannel(IDictionary properties, IClientChannelSinkProvider iClientChannelSinkProvider, IServerChannelSinkProvider iServerChannelSinkProvider)
            : base(iClientChannelSinkProvider, iServerChannelSinkProvider)
        {
            this.ITransportContext = TransportContextServices.CreateDefaultServerHttpContext(properties, this);
            this.InitializeInstance(properties);

            if (this._channelName == null)
                this._channelName = "ghttp";
            if (this._urlPrefix == null)
                this._urlPrefix = "ghttp";
            this._possibleChannelPrefixes = new string[] { this.UrlPrefix, this.UriPrefix };
        }
Esempio n. 60
0
		void Init (IDictionary properties, IClientChannelSinkProvider clientSink, IServerChannelSinkProvider serverSink)
		{
			_clientChannel = new TcpClientChannel (properties,clientSink);

			if(properties["port"] != null)
				_serverChannel = new TcpServerChannel(properties, serverSink);

			object val = properties ["name"];
			if (val != null) _name = val as string;
			
			val = properties ["priority"];
			if (val != null) _priority = Convert.ToInt32 (val);
		}