Exemple #1
0
 public override void IceWritePayload(OutputStream ostr)
 {
     Debug.Assert(Protocol == Protocol.Ice1);
     base.IceWritePayload(ostr);
     ostr.WriteInt((int)Timeout.TotalMilliseconds);
     ostr.WriteBool(HasCompressionFlag);
 }
Exemple #2
0
        /// <summary>Writes a request header body This implementation is slightly more efficient than the generated code
        /// because it avoids the allocation of a string[] to write the location.</summary>
        internal static void WriteIce2RequestHeaderBody(
            this OutputStream ostr,
            Identity identity,
            string facet,
            IReadOnlyList <string> location,
            string operation,
            bool idempotent,
            DateTime deadline,
            IReadOnlyDictionary <string, string> context)
        {
            Debug.Assert(ostr.Encoding == Encoding);

            // All bits are set to true by default, and true means the corresponding value is set.
            BitSequence bitSequence = ostr.WriteBitSequence(5);

            identity.IceWrite(ostr);
            if (facet.Length > 0)
            {
                ostr.WriteString(facet);
            }
            else
            {
                bitSequence[0] = false;
            }

            if (location.Count > 0)
            {
                ostr.WriteSequence(location, OutputStream.IceWriterFromString);
            }
            else
            {
                bitSequence[1] = false;
            }

            ostr.WriteString(operation);

            if (idempotent)
            {
                ostr.WriteBool(true);
            }
            else
            {
                bitSequence[2] = false;
            }

            bitSequence[3] = false; // TODO: source for priority.

            // DateTime.MaxValue represents an infinite deadline and it is encoded as -1
            ostr.WriteVarLong(
                deadline == DateTime.MaxValue ? -1 : (long)(deadline - DateTime.UnixEpoch).TotalMilliseconds);

            if (context.Count > 0)
            {
                ostr.WriteDictionary(context, OutputStream.IceWriterFromString, OutputStream.IceWriterFromString);
            }
            else
            {
                bitSequence[4] = false;
            }
        }
 internal static void WriteProxyData11(
     this OutputStream ostr,
     string facet,
     InvocationMode invocationMode,
     Protocol protocol,
     Encoding encoding)
 {
     Debug.Assert(ostr.Encoding == Encoding.V11);
     ostr.WriteIce1Facet(facet);
     ostr.Write(invocationMode);
     ostr.WriteBool(false); // "secure"
     ostr.Write(protocol);
     ostr.WriteByte(0);     // protocol minor
     encoding.IceWrite(ostr);
 }
        /// <summary>Writes a request header body without constructing an Ice2RequestHeaderBody instance. This
        /// implementation is slightly more efficient than the generated code because it avoids the allocation of a
        /// string[] to write the location.</summary>
        internal static void WriteIce2RequestHeaderBody(
            this OutputStream ostr,
            Identity identity,
            string facet,
            IReadOnlyList <string> location,
            string operation,
            bool idempotent)
        {
            Debug.Assert(ostr.Encoding == Encoding);
            BitSequence bitSequence = ostr.WriteBitSequence(4); // bit set to true (set) by default

            identity.IceWrite(ostr);
            if (facet.Length > 0)
            {
                ostr.WriteString(facet);
            }
            else
            {
                bitSequence[0] = false;
            }

            if (location.Count > 0)
            {
                ostr.WriteSequence(location, OutputStream.IceWriterFromString);
            }
            else
            {
                bitSequence[1] = false;
            }

            ostr.WriteString(operation);

            if (idempotent)
            {
                ostr.WriteBool(true);
            }
            else
            {
                bitSequence[2] = false;
            }

            bitSequence[3] = false; // TODO: source for priority.
        }
Exemple #5
0
 public override void IceWritePayload(OutputStream ostr)
 {
     base.IceWritePayload(ostr);
     ostr.WriteBool(HasCompressionFlag);
 }