Exemplo n.º 1
0
        private static void printRequestHeader(System.IO.StringWriter s, Ice.InputStream str)
        {
            printIdentityFacetOperation(s, str);

            try
            {
                byte mode = str.readByte();
                s.Write("\nmode = " + (int)mode + ' ');
                switch ((Ice.OperationMode)mode)
                {
                case Ice.OperationMode.Normal:
                {
                    s.Write("(normal)");
                    break;
                }

                case Ice.OperationMode.Nonmutating:
                {
                    s.Write("(nonmutating)");
                    break;
                }

                case Ice.OperationMode.Idempotent:
                {
                    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);
            }
        }
Exemplo n.º 2
0
 internal void setEncoding(Ice.EncodingVersion encoding)
 {
     this.encoding = encoding;
     encoding_1_0 = encoding.Equals(Ice.Util.Encoding_1_0);
 }
Exemplo n.º 3
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));
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Skips an empty encapsulation.
        /// </summary>
        /// <returns>The encapsulation's encoding version.</returns>
        public EncodingVersion skipEmptyEncapsulation()
        {
            int sz = readInt();
            if(sz < 6)
            {
                throw new Ice.EncapsulationException();
            }
            if(sz - 4 > _buf.b.remaining())
            {
                throw new Ice.UnmarshalOutOfBoundsException();
            }

            Ice.EncodingVersion encoding = new Ice.EncodingVersion();
            encoding.read__(this);
            if(encoding.Equals(Ice.Util.Encoding_1_0))
            {
                if(sz != 6)
                {
                    throw new Ice.EncapsulationException();
                }
            }
            else
            {
                // Skip the optional content of the encapsulation if we are expecting an
                // empty encapsulation.
                _buf.b.position(_buf.b.position() + sz - 6);
            }
            return encoding;
        }