コード例 #1
0
 public TcpEndpointI(BasicStream s)
 {
     _instance = s.instance();
     s.startReadEncaps();
     _host     = s.readString();
     _port     = s.readInt();
     _timeout  = s.readInt();
     _compress = s.readBool();
     s.endReadEncaps();
     calcHashValue();
 }
コード例 #2
0
        private static byte printHeader(System.IO.StringWriter s, BasicStream str)
        {
            try
            {
                str.readByte(); // Don't bother printing the magic number
                str.readByte();
                str.readByte();
                str.readByte();

                /* byte pMajor = */ str.readByte();
                /* byte pMinor = */ str.readByte();
                //s.Write("\nprotocol version = " + (int)pMajor + "." + (int)pMinor);

                /* byte eMajor = */ str.readByte();
                /* byte eMinor = */ str.readByte();
                //s.Write("\nencoding version = " + (int)eMajor + "." + (int)eMinor);

                byte type = str.readByte();
                s.Write("\nmessage type = " + (int)type + " (" + getMessageTypeAsString(type) + ')');

                byte compress = str.readByte();
                s.Write("\ncompression status = " + (int)compress + ' ');
                switch (compress)
                {
                case (byte)0:
                {
                    s.Write("(not compressed; do not compress response, if any)");
                    break;
                }

                case (byte)1:
                {
                    s.Write("(not compressed; compress response, if any)");
                    break;
                }

                case (byte)2:
                {
                    s.Write("(compressed; compress response, if any)");
                    break;
                }

                default:
                {
                    s.Write("(unknown)");
                    break;
                }
                }

                int size = str.readInt();
                s.Write("\nmessage size = " + size);
                return(type);
            }
            catch (System.IO.IOException)
            {
                Debug.Assert(false);
                return(0);
            }
        }
コード例 #3
0
ファイル: IPEndpointI.cs プロジェクト: sk163/ice-1
 public IPEndpointI(ProtocolInstance instance, BasicStream s)
 {
     instance_        = instance;
     host_            = s.readString();
     port_            = s.readInt();
     sourceAddr_      = null;
     connectionId_    = "";
     _hashInitialized = false;
 }
コード例 #4
0
        private static void printBatchRequest(System.IO.StringWriter s, BasicStream str)
        {
            int batchRequestNum = str.readInt();

            s.Write("\nnumber of requests = " + batchRequestNum);

            for (int i = 0; i < batchRequestNum; ++i)
            {
                s.Write("\nrequest #" + i + ':');
                printRequestHeader(s, str);
            }
        }
コード例 #5
0
        private static void printRequest(System.IO.StringWriter s, BasicStream str)
        {
            int requestId = str.readInt();

            s.Write("\nrequest id = " + requestId);
            if (requestId == 0)
            {
                s.Write(" (oneway)");
            }

            printRequestHeader(s, str);
        }
コード例 #6
0
ファイル: UdpEndpointI.cs プロジェクト: stick/zeroc-ice
 public UdpEndpointI(BasicStream s)
 {
     instance_ = s.instance();
     s.startReadEncaps();
     _host = s.readString();
     _port = s.readInt();
     if (s.getReadEncoding().Equals(Ice.Util.Encoding_1_0))
     {
         s.readByte();
         s.readByte();
         s.readByte();
         s.readByte();
     }
     // Not transmitted.
     //_connect = s.readBool();
     _connect  = false;
     _compress = s.readBool();
     s.endReadEncaps();
     calcHashValue();
 }
コード例 #7
0
ファイル: Incoming.cs プロジェクト: stick/zeroc-ice
        public void invoke(ServantManager servantManager, BasicStream stream)
        {
            _is = stream;

            int start = _is.pos();

            //
            // Read the current.
            //
            current_.id.read__(_is);

            //
            // For compatibility with the old FacetPath.
            //
            string[] facetPath = _is.readStringSeq();
            if (facetPath.Length > 0)
            {
                if (facetPath.Length > 1)
                {
                    throw new Ice.MarshalException();
                }
                current_.facet = facetPath[0];
            }
            else
            {
                current_.facet = "";
            }

            current_.operation = _is.readString();
            current_.mode      = (Ice.OperationMode)(int) _is.readByte();
            current_.ctx       = new Dictionary <string, string>();
            int sz = _is.readSize();

            while (sz-- > 0)
            {
                string first  = _is.readString();
                string second = _is.readString();
                current_.ctx[first] = second;
            }

            Ice.Instrumentation.CommunicatorObserver obsv = instance_.getObserver();
            if (obsv != null)
            {
                // Read the encapsulation size.
                int size = _is.readInt();
                _is.pos(_is.pos() - 4);

                observer_ = obsv.getDispatchObserver(current_, _is.pos() - start + size);
                if (observer_ != null)
                {
                    observer_.attach();
                }
            }

            //
            // Don't put the code above into the try block below. Exceptions
            // in the code above are considered fatal, and must propagate to
            // the caller of this operation.
            //

            if (servantManager != null)
            {
                servant_ = servantManager.findServant(current_.id, current_.facet);
                if (servant_ == null)
                {
                    locator_ = servantManager.findServantLocator(current_.id.category);
                    if (locator_ == null && current_.id.category.Length > 0)
                    {
                        locator_ = servantManager.findServantLocator("");
                    }

                    if (locator_ != null)
                    {
                        try
                        {
                            servant_ = locator_.locate(current_, out cookie_);
                        }
                        catch (Ice.UserException ex)
                        {
                            Ice.EncodingVersion encoding = _is.skipEncaps(); // Required for batch requests.

                            if (observer_ != null)
                            {
                                observer_.userException();
                            }

                            if (response_)
                            {
                                os_.writeByte(ReplyStatus.replyUserException);
                                os_.startWriteEncaps(encoding, Ice.FormatType.DefaultFormat);
                                os_.writeUserException(ex);
                                os_.endWriteEncaps();
                                if (observer_ != null)
                                {
                                    observer_.reply(os_.size() - Protocol.headerSize - 4);
                                }
                                connection_.sendResponse(os_, compress_);
                            }
                            else
                            {
                                connection_.sendNoResponse();
                            }

                            if (observer_ != null)
                            {
                                observer_.detach();
                                observer_ = null;
                            }
                            connection_ = null;
                            return;
                        }
                        catch (System.Exception ex)
                        {
                            _is.skipEncaps(); // Required for batch requests.
                            handleException__(ex);
                            return;
                        }
                    }
                }
            }

            try
            {
                if (servant_ != null)
                {
                    //
                    // DispatchAsync is a "pseudo dispatch status", used internally only
                    // to indicate async dispatch.
                    //
                    if (servant_.dispatch__(this, current_) == Ice.DispatchStatus.DispatchAsync)
                    {
                        //
                        // If this was an asynchronous dispatch, we're done here.
                        //
                        return;
                    }

                    if (locator_ != null && !servantLocatorFinished__())
                    {
                        return;
                    }
                }
                else
                {
                    //
                    // Skip the input parameters, this is required for reading
                    // the next batch request if dispatching batch requests.
                    //
                    _is.skipEncaps();

                    if (servantManager != null && servantManager.hasServant(current_.id))
                    {
                        throw new Ice.FacetNotExistException(current_.id, current_.facet, current_.operation);
                    }
                    else
                    {
                        throw new Ice.ObjectNotExistException(current_.id, current_.facet, current_.operation);
                    }
                }
            }
            catch (System.Exception ex)
            {
                if (servant_ != null && locator_ != null && !servantLocatorFinished__())
                {
                    return;
                }
                handleException__(ex);
                return;
            }

            //
            // Don't put the code below into the try block above. Exceptions
            // in the code below are considered fatal, and must propagate to
            // the caller of this operation.
            //

            Debug.Assert(connection_ != null);

            if (response_)
            {
                if (observer_ != null)
                {
                    observer_.reply(os_.size() - Protocol.headerSize - 4);
                }
                connection_.sendResponse(os_, compress_);
            }
            else
            {
                connection_.sendNoResponse();
            }

            if (observer_ != null)
            {
                observer_.detach();
                observer_ = null;
            }
            connection_ = null;
        }
コード例 #8
0
        private static void printReply(System.IO.StringWriter s, BasicStream str)
        {
            int requestId = str.readInt();

            s.Write("\nrequest id = " + requestId);

            byte replyStatus = str.readByte();

            s.Write("\nreply status = " + (int)replyStatus + ' ');

            switch (replyStatus)
            {
            case ReplyStatus.replyOK:
            {
                s.Write("(ok)");
                break;
            }

            case ReplyStatus.replyUserException:
            {
                s.Write("(user exception)");
                break;
            }

            case ReplyStatus.replyObjectNotExist:
            case ReplyStatus.replyFacetNotExist:
            case ReplyStatus.replyOperationNotExist:
            {
                switch (replyStatus)
                {
                case ReplyStatus.replyObjectNotExist:
                {
                    s.Write("(object not exist)");
                    break;
                }

                case ReplyStatus.replyFacetNotExist:
                {
                    s.Write("(facet not exist)");
                    break;
                }

                case ReplyStatus.replyOperationNotExist:
                {
                    s.Write("(operation not exist)");
                    break;
                }

                default:
                {
                    Debug.Assert(false);
                    break;
                }
                }

                printIdentityFacetOperation(s, str);
                break;
            }

            case ReplyStatus.replyUnknownException:
            case ReplyStatus.replyUnknownLocalException:
            case ReplyStatus.replyUnknownUserException:
            {
                switch (replyStatus)
                {
                case ReplyStatus.replyUnknownException:
                {
                    s.Write("(unknown exception)");
                    break;
                }

                case ReplyStatus.replyUnknownLocalException:
                {
                    s.Write("(unknown local exception)");
                    break;
                }

                case ReplyStatus.replyUnknownUserException:
                {
                    s.Write("(unknown user exception)");
                    break;
                }

                default:
                {
                    Debug.Assert(false);
                    break;
                }
                }

                string unknown = str.readString();
                s.Write("\nunknown = " + unknown);
                break;
            }

            default:
            {
                s.Write("(unknown)");
                break;
            }
            }

            if (replyStatus == ReplyStatus.replyOK || replyStatus == ReplyStatus.replyUserException)
            {
                Ice.EncodingVersion v = str.skipEncaps();
                if (!v.Equals(Ice.Util.Encoding_1_0))
                {
                    s.Write("\nencoding = ");
                    s.Write(Ice.Util.encodingVersionToString(v));
                }
            }
        }
コード例 #9
0
 public TcpEndpointI(ProtocolInstance instance, BasicStream s) :
     base(instance, s)
 {
     _timeout  = s.readInt();
     _compress = s.readBool();
 }
コード例 #10
0
ファイル: TraceUtil.cs プロジェクト: stick/zeroc-ice
        private static void printReply(System.IO.StringWriter s, BasicStream str)
        {
            int requestId = str.readInt();

            s.Write("\nrequest id = " + requestId);

            byte replyStatus = str.readByte();

            s.Write("\nreply status = " + (int)replyStatus + ' ');

            switch (replyStatus)
            {
            case ReplyStatus.replyOK:
            {
                s.Write("(ok)");
                break;
            }

            case ReplyStatus.replyUserException:
            {
                s.Write("(user exception)");
                break;
            }

            case ReplyStatus.replyObjectNotExist:
            case ReplyStatus.replyFacetNotExist:
            case ReplyStatus.replyOperationNotExist:
            {
                switch (replyStatus)
                {
                case ReplyStatus.replyObjectNotExist:
                {
                    s.Write("(object not exist)");
                    break;
                }

                case ReplyStatus.replyFacetNotExist:
                {
                    s.Write("(facet not exist)");
                    break;
                }

                case ReplyStatus.replyOperationNotExist:
                {
                    s.Write("(operation not exist)");
                    break;
                }

                default:
                {
                    Debug.Assert(false);
                    break;
                }
                }

                printIdentityFacetOperation(s, str);
                break;
            }

            case ReplyStatus.replyUnknownException:
            case ReplyStatus.replyUnknownLocalException:
            case ReplyStatus.replyUnknownUserException:
            {
                switch (replyStatus)
                {
                case ReplyStatus.replyUnknownException:
                {
                    s.Write("(unknown exception)");
                    break;
                }

                case ReplyStatus.replyUnknownLocalException:
                {
                    s.Write("(unknown local exception)");
                    break;
                }

                case ReplyStatus.replyUnknownUserException:
                {
                    s.Write("(unknown user exception)");
                    break;
                }

                default:
                {
                    Debug.Assert(false);
                    break;
                }
                }

                string unknown = str.readString();
                s.Write("\nunknown = " + unknown);
                break;
            }

            default:
            {
                s.Write("(unknown)");
                break;
            }
            }
        }