Ejemplo n.º 1
0
        internal IpcClientTransportSink(string channelURI, IpcClientChannel channel)
        {
            string str;

            this.portCache = new ConnectionCache();
            this._tokenImpersonationLevel = TokenImpersonationLevel.Identification;
            this._timeout = 0x3e8;
            this._channel = channel;
            string str2       = IpcChannelHelper.ParseURL(channelURI, out str);
            int    startIndex = str2.IndexOf("://") + 3;

            this._portName = str2.Substring(startIndex);
        }
Ejemplo n.º 2
0
        internal IpcClientTransportSink(String channelURI, IpcClientChannel channel)
        {
            String objectURI;

            _channel = channel;
            // Parse the URI
            String simpleChannelUri = IpcChannelHelper.ParseURL(channelURI, out objectURI);
            // extract machine name and port
            int start = simpleChannelUri.IndexOf("://");

            start += 3;

            _portName = simpleChannelUri.Substring(start);;
        } // IpcClientTransportSink
Ejemplo n.º 3
0
 public String Parse(String url, out String objectURI)
 {
     return(IpcChannelHelper.ParseURL(url, out objectURI));
 } // Parse
        protected new void ReadToEndOfHeaders(BaseTransportHeaders headers)
        {
            bool   bError       = false;
            String statusPhrase = null;

            UInt16 headerType = ReadUInt16();

            while (headerType != TcpHeaders.EndOfHeaders)
            {
                if (headerType == TcpHeaders.Custom)
                {
                    String headerName  = ReadCountedString();
                    String headerValue = ReadCountedString();

                    headers[headerName] = headerValue;
                }
                else
                if (headerType == TcpHeaders.RequestUri)
                {
                    ReadAndVerifyHeaderFormat("RequestUri", TcpHeaderFormat.CountedString);

                    // read uri (and make sure that no channel specific data is present)
                    String uri = ReadCountedString();

                    String channelURI;
                    String objectURI;
                    channelURI = IpcChannelHelper.ParseURL(uri, out objectURI);
                    if (channelURI == null)
                    {
                        objectURI = uri;
                    }

                    headers.RequestUri = objectURI;
                }
                else
                if (headerType == TcpHeaders.StatusCode)
                {
                    ReadAndVerifyHeaderFormat("StatusCode", TcpHeaderFormat.UInt16);

                    UInt16 statusCode = ReadUInt16();
                    // We'll throw an exception here if there was an error. If an error
                    //   occurs above the transport level, the status code will still be
                    //   success here.
                    if (statusCode != TcpStatusCode.Success)
                    {
                        bError = true;
                    }
                }
                else
                if (headerType == TcpHeaders.StatusPhrase)
                {
                    ReadAndVerifyHeaderFormat("StatusPhrase", TcpHeaderFormat.CountedString);

                    statusPhrase = ReadCountedString();
                }
                else
                if (headerType == TcpHeaders.ContentType)
                {
                    ReadAndVerifyHeaderFormat("Content-Type", TcpHeaderFormat.CountedString);

                    String contentType = ReadCountedString();
                    headers.ContentType = contentType;
                }
                else
                {
                    // unknown header: Read header format and ignore rest of data
                    byte headerFormat = (byte)ReadByte();

                    switch (headerFormat)
                    {
                    case TcpHeaderFormat.Void: break;

                    case TcpHeaderFormat.CountedString: ReadCountedString(); break;

                    case TcpHeaderFormat.Byte: ReadByte(); break;

                    case TcpHeaderFormat.UInt16: ReadUInt16(); break;

                    case TcpHeaderFormat.Int32: ReadInt32(); break;

                    default:
                    {
                        // unknown format
                        throw new RemotingException(
                                  String.Format(
                                      CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Tcp_UnknownHeaderType"),
                                      headerType, headerFormat));
                    }
                    } // switch (format)
                }

                // read next header token
                headerType = ReadUInt16();
            } // loop until end of headers

            // if an error occurred, throw an exception
            if (bError)
            {
                if (statusPhrase == null)
                {
                    statusPhrase = "";
                }

                throw new RemotingException(
                          String.Format(
                              CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Tcp_GenericServerError"),
                              statusPhrase));
            }
        } // ReadToEndOfHeaders
 public string Parse(string url, out string objectURI)
 {
     return(IpcChannelHelper.ParseURL(url, out objectURI));
 }
        protected void ReadToEndOfHeaders(BaseTransportHeaders headers)
        {
            bool   flag = false;
            string str  = null;

            for (ushort i = base.ReadUInt16(); i != 0; i = base.ReadUInt16())
            {
                switch (i)
                {
                case 1:
                {
                    string str2 = base.ReadCountedString();
                    string str3 = base.ReadCountedString();
                    headers[str2] = str3;
                    break;
                }

                case 4:
                {
                    string str6;
                    this.ReadAndVerifyHeaderFormat("RequestUri", 1);
                    string url = base.ReadCountedString();
                    if (IpcChannelHelper.ParseURL(url, out str6) == null)
                    {
                        str6 = url;
                    }
                    headers.RequestUri = str6;
                    break;
                }

                case 2:
                    this.ReadAndVerifyHeaderFormat("StatusCode", 3);
                    if (base.ReadUInt16() != 0)
                    {
                        flag = true;
                    }
                    break;

                case 3:
                    this.ReadAndVerifyHeaderFormat("StatusPhrase", 1);
                    str = base.ReadCountedString();
                    break;

                case 6:
                {
                    this.ReadAndVerifyHeaderFormat("Content-Type", 1);
                    string str7 = base.ReadCountedString();
                    headers.ContentType = str7;
                    break;
                }

                default:
                {
                    byte num3 = (byte)base.ReadByte();
                    switch (num3)
                    {
                    case 1:
                    {
                        base.ReadCountedString();
                        continue;
                    }

                    case 2:
                    {
                        base.ReadByte();
                        continue;
                    }

                    case 3:
                    {
                        base.ReadUInt16();
                        continue;
                    }

                    case 4:
                    {
                        base.ReadInt32();
                        continue;
                    }
                    }
                    throw new RemotingException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Tcp_UnknownHeaderType"), new object[] { i, num3 }));
                }
                }
            }
            if (flag)
            {
                if (str == null)
                {
                    str = "";
                }
                throw new RemotingException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_Tcp_GenericServerError"), new object[] { str }));
            }
        }