示例#1
0
        internal static Ice.Current CreateCurrent(int requestId, Ice.InputStream requestFrame,
                                                  Ice.ObjectAdapter adapter, Ice.Connection?connection = null)
        {
            var identity = new Ice.Identity(requestFrame);

            // For compatibility with the old FacetPath.
            string[] facetPath = requestFrame.ReadStringArray();
            if (facetPath.Length > 1)
            {
                throw new Ice.MarshalException();
            }
            string facet     = facetPath.Length == 0 ? "" : facetPath[0];
            string operation = requestFrame.ReadString();
            var    mode      = requestFrame.ReadByte();

            if (mode > 2)
            {
                throw new Ice.MarshalException(
                          $"received invalid operation mode `{mode}' with operation `{operation}'");
            }
            bool idempotent = mode > 0;
            var  context    = requestFrame.ReadContext();

            Ice.EncodingVersion encoding = requestFrame.StartEncapsulation();

            return(new Ice.Current(adapter, identity, facet, operation, idempotent, context,
                                   requestId, connection, encoding));
        }
示例#2
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.Encoding v = str.SkipEncapsulation();
                s.Write("\nencoding = ");
                s.Write(v.ToString());
            }
            catch (System.IO.IOException)
            {
                Debug.Assert(false);
            }
        }
 public override int ReadByte()
 {
     try
     {
         return(_stream.ReadByte());
     }
     catch (Exception ex)
     {
         throw new IOException("could not read from stream", ex);
     }
 }
示例#4
0
        private static void PrintReply(System.IO.StringWriter s, Ice.InputStream str)
        {
            int requestId = str.ReadInt();

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

            var replyStatus = (ReplyStatus)str.ReadByte();

            s.Write($"\nreply status = {replyStatus}");

            if (replyStatus == ReplyStatus.OK || replyStatus == ReplyStatus.UserException)
            {
                _ = str.SkipEncapsulation();
                s.Write("\nencoding = ");
            }
        }
示例#5
0
        private static Ice1Definitions.MessageType PrintHeader(System.IO.StringWriter s, Ice.InputStream 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);

                var type = (Ice1Definitions.MessageType)str.ReadByte();
                s.Write("\nmessage type = " + (int)type + " (" + GetMessageTypeAsString(type) + ')');

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

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

                case 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);
            }
        }
示例#6
0
文件: Version.cs 项目: xingx001/ice
 public void ice_readMembers(InputStream istr)
 {
     this.major = istr.ReadByte();
     this.minor = istr.ReadByte();
 }