public IMessageSink CreateMessageSink(string url,
                                              object remoteChannelData,
                                              out string objectURI)
        {
            objectURI = null;

            if (url != null)
            {
                if (Parse(url, out objectURI) != null)
                {
                    return((IMessageSink)sink_provider.CreateSink(this, url,
                                                                  remoteChannelData));
                }
            }

            if (remoteChannelData != null)
            {
                IChannelDataStore ds = remoteChannelData as IChannelDataStore;
                if (ds != null)
                {
                    foreach (string chnl_uri in ds.ChannelUris)
                    {
                        if (Parse(chnl_uri, out objectURI) == null)
                        {
                            continue;
                        }
                        return((IMessageSink)sink_provider.CreateSink(this, chnl_uri,
                                                                      remoteChannelData));
                    }
                }
            }

            return(null);
        }
        public IMessageSink CreateMessageSink(string url,
                                              object remoteChannelData,
                                              out string objectURI)
        {
            if (url != null && Parse(url, out objectURI) != null)
            {
                return((IMessageSink)_sinkProvider.CreateSink(this, url, remoteChannelData));
            }

            if (remoteChannelData != null)
            {
                IChannelDataStore ds = remoteChannelData as IChannelDataStore;
                if (ds != null && ds.ChannelUris.Length > 0)
                {
                    url = ds.ChannelUris [0];
                }
                else
                {
                    objectURI = null;
                    return(null);
                }
            }

            if (Parse(url, out objectURI) == null)
            {
                return(null);
            }

            return((IMessageSink)_sinkProvider.CreateSink(this, url, remoteChannelData));
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Returns a channel message sink that delivers messages to the specified URL or channel data object.
        /// </summary>
        /// <param name="url">The URL to which the new sink will deliver messages. Can be null.</param>
        /// <param name="remoteChannelData">The channel data object of the remote host to which the new sink will deliver messages. Can be null.</param>
        /// <param name="objectURI">When this method returns, contains a URI of the new channel message sink that delivers messages to the specified URL or channel data object. This parameter is passed uninitialized.</param>
        /// <returns>
        /// A channel message sink that delivers messages to the specified URL or channel data object, or null if the channel cannot connect to the given endpoint.
        /// </returns>
        /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
        public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)
        {
            objectURI = null;

            if (url == null)
            {
                TcpExChannelData channelData = remoteChannelData as TcpExChannelData;
                if (channelData != null)
                {
                    url = Manager.CreateUrl(channelData.ChannelID);
                }
                else
                {
                    return(null);
                }
            }
            if (Manager.Parse(url, out objectURI) != null)
            {
                IClientChannelSink clientChannelSink = clientSinkProvider.CreateSink(this, url, remoteChannelData);
                IMessageSink       messageSink       = clientChannelSink as IMessageSink;

                if (clientChannelSink != null && messageSink == null)
                {
                    throw new RemotingException(LanguageResource.RemotingException_MessageSinkNotSet);
                }

                return(messageSink);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)
        {
            objectURI = null;
            string channelUri = null;

            if (url != null)
            {
                channelUri = Parse(url, out objectURI);
            }

            if (channelUri == null)
            {
                // get url from the channel data
                IChannelDataStore ds = remoteChannelData as IChannelDataStore;
                if (ds != null)
                {
                    channelUri = Parse(ds.ChannelUris[0], out objectURI);
                    if (channelUri != null)
                    {
                        url = ds.ChannelUris[0];
                    }
                }
            }

            if (channelUri != null)
            {
                return((IMessageSink)clientProvider.CreateSink(this, url, remoteChannelData));
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        IClientChannelSink IClientChannelSinkProvider.CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);
            IClientChannelSink thisSink = new PrivateEventHandlersClientChannelSink(nextSink as IClientFormatterSink);

            return(thisSink);
        }
        public IClientChannelSink CreateSink(IChannelSender channel,
                                             string url, object remoteChannelData)
        {
            IClientChannelSink nextsink =
                next.CreateSink(channel, url, remoteChannelData);

            return(new PriorityEmitterSink(nextsink));
        }
Beispiel #8
0
        /// <summary>
        /// factory method that create the concrete corresponding client sink object
        /// </summary>
        /// <param name="channel">channel object</param>
        /// <param name="url">destination's uri</param>
        /// <param name="remoteChannelData"></param>
        /// <returns>newly created CyrptoRemotingClientSink object </returns>
        public IClientChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink;

            //create the next sink that is located after the new CryptoRemotingClientSink object
            nextSink = next.CreateSink(channel, url, remoteChannelData);
            //create and return the new CyrptoRemotingClientSink object
            return(new CryptoRemotingClientSink(nextSink, url));
        }
        /// <summary>
        /// create a sink, hard coded with our encryption sink
        /// </summary>
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            // create other sinks in the chain
            IClientChannelSink next = FNextProvider.CreateSink(channel,
                                                               url,
                                                               remoteChannelData);

            // put our sink on top of the chain and return it
            return(new EncryptionClientSink(next, FPublicKeyServer));
        }
Beispiel #10
0
    public IClientChannelSink CreateSink(IChannelSender channel, String url, Object remoteChannelData)
    {
        Console.WriteLine("Creating ClientSink for {0}", url);

        // Create the next sink in the chain.
        IClientChannelSink nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);

        // Hook our sink up to it.
        return(new ClientSink(nextSink));
    }
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (nextProvider != null)
            {
                nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);
            }
            return(new ClientEncryptionSink(nextSink, encrHelper));
        }
        IClientChannelSink IClientChannelSinkProvider.CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (nextProvider != null)
            {
                nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);
            }
            return(new ClientChannelSecureSink(nextSink));
        }
Beispiel #13
0
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (nextProvider != null)
            {
                nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);
            }
            return(new ClientChannelImpersonationSink(nextSink, username, password));
        }
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            // create other sinks in the chain
            IClientChannelSink next = _nextProvider.CreateSink(channel,
                                                               url,
                                                               remoteChannelData);

            // put our sink on top of the chain and return it
            return(new CompressionClientSink(next));
        }
Beispiel #15
0
        // IChannelSender
        public IMessageSink CreateMessageSink(String url, Object data, out String objuri)
        {
            DBG.Info(null, "CreateMessageSink: url = " + url);
            // Set the out parameters
            objuri = null;
            String chanuri = null;

            if (url != null) // Is this a well known object?
            {
                /*
                 * String urlCompare = String.ToLower(url);
                 *
                 * // Starts with pipe:// ?
                 * if (urlCompare.StartsWith(ChannelScheme) == false)
                 * {
                 *  return null;
                 * }
                 */

                // Parse returns null if this is not one of the pipe channel url's
                chanuri = Parse(url, out objuri);
            }
            else if (data != null)
            {
                IChannelDataStore cds = data as IChannelDataStore;
                if (cds != null)
                {
                    DBG.Info(null, "ChannelUris[0] = " + cds.ChannelUris[0]);
                    //Console.WriteLine("Channel Uri {0}", cds.ChannelUris[0]);

                    chanuri = Parse(cds.ChannelUris[0], out objuri);
                    DBG.Info(null, "CreateMessageSink: chanuri = " + chanuri + ", objuri = " + objuri);
                    if (chanuri != null)
                    {
                        url = cds.ChannelUris[0];
                    }
                }
            }

            if (null != chanuri)
            {
                if (url == null)
                {
                    url = chanuri;
                }

                DBG.Info(null, "CreateMessageSink: delegating w/ url = " + url);
                //Console.WriteLine("CreateMessageSink: delegating w/ url =  {0}", url);

                return((IMessageSink)_clientSinkProvider.CreateSink(this, url, data));
            }

            DBG.Info(null, "CreateMessageSink: ignoring request...");
            return(null);
        } // CreateMessageSink
        public IClientChannelSink CreateSink(IChannelSender channel,
                                             string url,
                                             object remoteChannelData)
        {
            IClientChannelSink _nextSink = _nextClientChannelSinkProvider.CreateSink(channel, url, remoteChannelData);

            SoapClientFormatterSink scfs = new SoapClientFormatterSink(_nextSink);

            scfs.SoapCore = _soapCore;
            return(scfs);
        }
Beispiel #17
0
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (next != null)
            {
                nextSink = next.CreateSink(channel, url, remoteChannelData);
            }

            return(new DisposerFormatterSink(nextSink));
        }
Beispiel #18
0
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object channelData)
        {
            if (_next == null)
            {
                return(null);
            }

            IClientChannelSink nextSink = _next.CreateSink(channel, url, channelData);

            return(new HashClientChannelSink(nextSink));
        }
Beispiel #19
0
        public virtual IMessageSink CreateMessageSink(String url, Object remoteChannelData, out String objectURI)
        {
            // Set the out parameters
            objectURI = null;
            String channelURI = null;


            if (url != null) // Is this a well known object?
            {
                // Parse returns null if this is not one of our url's
                channelURI = Parse(url, out objectURI);
            }
            else // determine if we want to connect based on the channel data
            {
                if (remoteChannelData != null)
                {
                    if (remoteChannelData is IChannelDataStore)
                    {
                        IChannelDataStore cds = (IChannelDataStore)remoteChannelData;

                        // see if this is an Ipc uri
                        String simpleChannelUri = Parse(cds.ChannelUris[0], out objectURI);
                        if (simpleChannelUri != null)
                        {
                            channelURI = cds.ChannelUris[0];
                        }
                    }
                }
            }

            if (null != channelURI)
            {
                if (url == null)
                {
                    url = channelURI;
                }

                IClientChannelSink sink = _sinkProvider.CreateSink(this, url, remoteChannelData);

                // return sink after making sure that it implements IMessageSink
                IMessageSink msgSink = sink as IMessageSink;
                if ((sink != null) && (msgSink == null))
                {
                    throw new RemotingException(
                              CoreChannel.GetResourceString(
                                  "Remoting_Channels_ChannelSinkNotMsgSink"));
                }

                return(msgSink);
            }

            return(null);
        } // CreateMessageSink
Beispiel #20
0
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (_nextProvider != null)
            {
                // создаем следующий приемник в цепи
                nextSink = _nextProvider.CreateSink(channel, url, remoteChannelData);
            }

            // добавляем наш приемник в цепь
            return(new IpFixClientChannelSink(nextSink, _serverHostNameOrIp));
        }
Beispiel #21
0
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink _nextSink = null;

            if (_next != null)
            {
                _nextSink = _next.CreateSink(channel, url, remoteChannelData);
                if (_nextSink == null)
                {
                    return(null);
                }
            }
            return(new CompressClientChannelSink(_nextSink));
        }
        public System.Runtime.Remoting.Channels.IClientChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (_next != null)
            {
                if ((nextSink = _next.CreateSink(channel, url, remoteChannelData)) == null)
                {
                    return(null);
                }
            }

            return(new SecureClientChannelSink(nextSink, _algorithm, _maxAttempts, _customerID, _ExtensionNumber, _password));
        }
    public IClientChannelSink CreateSink(IChannelSender channel, String myUrl,
                                         Object remoteChannelData)
    {
        IClientChannelSink nextSink = null;

        if (nextProvider != null)
        {
            nextSink = nextProvider.CreateSink(channel, myUrl, remoteChannelData);
            if (nextSink == null)
            {
                return(null);
            }
        }
        return(new MyClientChannelSink(nextSink));
    }
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (nextProvider != null)
            {
                nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);
                if (nextSink == null)
                {
                    return(null);
                }
            }

            return(new CustomBinaryClientFormatterSink(nextSink));
        }
        public IClientChannelSink CreateSink(IChannelSender channel1, String url1,
                                             Object remoteChannelData)
        {
            IClientChannelSink localNextSink = null;

            if (next1 != null)
            {
                localNextSink = next1.CreateSink(channel1, url1, remoteChannelData);
                if (localNextSink == null)
                {
                    return(null);
                }
            }
            return(new LoggingClientChannelSink(localNextSink));
        }
Beispiel #26
0
        public IClientChannelSink CreateSink(IChannelSender channel,
                                             string url,
                                             object remoteChannelData)
        {
            IClientChannelSink     nextsink = null;
            IceClientFormatterSink result;

            if (_next != null)
            {
                nextsink = _next.CreateSink(channel, url, remoteChannelData);
            }

            result = new IceClientFormatterSink(nextsink);

            return(result);
        }
Beispiel #27
0
        /// <summary>
        /// Creates a sink chain.
        /// </summary>
        /// <param name="channel">Channel for which the current sink chain is being constructed.</param>
        /// <param name="url">The URL of the object to connect to. This parameter can be null if the connection is based entirely on the information contained in the <paramref name="remoteChannelData" /> parameter.</param>
        /// <param name="remoteChannelData">A channel data object that describes a channel on the remote server.</param>
        /// <returns>
        /// The first sink of the newly formed channel sink chain, or null, which indicates that this provider will not or cannot provide a connection for this endpoint.
        /// </returns>
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (_next != null)
            {
                nextSink = _next.CreateSink(channel, url, remoteChannelData);

                if (nextSink == null)
                {
                    return(null);
                }
            }

            return(new CryptoClientChannelSink(nextSink, _algorithm, _oaep, _maxAttempts));
        }
        /// <summary>
        /// Creates a sink chain.
        /// </summary>
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            // Create next sink:
            IClientChannelSink nextSink = next.CreateSink(channel, url, remoteChannelData);
            // Return current sink chained to next sink:
            IMessageSink nextMessageSink = nextSink as IMessageSink;

            if (nextMessageSink != null)
            {
                return(new RemotingMockingSink(nextMessageSink));
            }
            else
            {
                throw new RemotingException(String.Format("Remoting configuration error : the '{0}' provider should be defined as provider in the clientProviders section of the channel, before any formatter.", this.GetType()));
            }
        }
        public IClientChannelSink CreateSink(IChannelSender myChannelSenderData, String url,
                                             Object myRemoteChannelData)
        {
            IClientChannelSink myClientChannelSinkNextSink = null;

            if (myClientChannelSinkProviderNext != null)
            {
                myClientChannelSinkNextSink =
                    myClientChannelSinkProviderNext.CreateSink(myChannelSenderData, url, myRemoteChannelData);
                if (myClientChannelSinkNextSink == null)
                {
                    return(null);
                }
            }
            return(new MyLoggingClientChannelSink(myClientChannelSinkNextSink));
        }
Beispiel #30
0
        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
        {
            IClientChannelSink nextSink = null;

            if (_nextProvider != null)
            {
                nextSink = _nextProvider.CreateSink(channel, url, remoteChannelData);
            }

            if (nextSink != null)
            {
                return(new ClientFormatterSink(s_Formatter, nextSink));
            }

            return(null);
        }
		public static IMessageSink ClientChannelCreateMessageSink(
			IChannelSender channel,
			IClientChannelSinkProvider sinkProviderChain,
			string url,
			object remoteChannelData,
			out string objectUri)
		{
			objectUri = null;
			string channelUri = null;

			if (url != null)
			{
				// parse returns null if this is not one of our url's
				channelUri = channel.Parse(url, out objectUri);
			}
			else if (remoteChannelData != null)
			{
				IChannelDataStore cds = remoteChannelData as IChannelDataStore;
				if (cds != null)
				{
					// see if this is a valid uri
					string simpleChannelUri = channel.Parse(cds.ChannelUris[0], out objectUri);
					if (simpleChannelUri != null)
						channelUri = cds.ChannelUris[0];
				}
			}

			if (channelUri != null)
			{
				// create message sink
				return sinkProviderChain.CreateSink(channel,
					(url != null ? url : channelUri), remoteChannelData) as IMessageSink;
			}

			// could not connect
			return null;
		}