示例#1
0
        private static void PrintRequestHeader(System.IO.StringWriter s, Ice.InputStream str)
        {
            PrintIdentityFacetOperation(s, str);

            try
            {
                byte mode = str.ReadByte();
                s.Write("\noperation mode = " + (int)mode + ' ');
                switch (mode)
                {
                case 0:
                {
                    s.Write("(non-idempotent)");
                    break;
                }

                case 1:
                {
                    s.Write("(idempotent/nonmutating)");
                    break;
                }

                case 2:
                {
                    s.Write("(idempotent)");
                    break;
                }

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

                int sz = str.ReadSize();
                s.Write("\ncontext = ");
                while (sz-- > 0)
                {
                    string key = str.ReadString();
                    string val = str.ReadString();
                    s.Write(key + '/' + val);
                    if (sz > 0)
                    {
                        s.Write(", ");
                    }
                }

                Ice.EncodingVersion v = str.SkipEncapsulation();
                if (!v.Equals(Ice.Util.Encoding_1_0))
                {
                    s.Write("\nencoding = ");
                    s.Write(Ice.Util.EncodingVersionToString(v));
                }
            }
            catch (System.IO.IOException)
            {
                Debug.Assert(false);
            }
        }
示例#2
0
        private static void PrintReply(System.IO.StringWriter s, Ice.InputStream 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.SkipEncapsulation();
                if (!v.Equals(Ice.Util.Encoding_1_0))
                {
                    s.Write("\nencoding = ");
                    s.Write(Ice.Util.EncodingVersionToString(v));
                }
            }
        }