/// <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; } }
/// <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. }
protected internal override void WriteOptions(OutputStream ostr) { if (Protocol == Protocol.Ice1) { base.WriteOptions(ostr); ostr.WriteString(_resource); } else { if (_resource != "/") { ostr.WriteSize(1); ostr.WriteString(_resource); } else { ostr.WriteSize(0); // empty sequence of options } } }
protected internal override void WriteOptions(OutputStream ostr) { if (Protocol == Protocol.Ice1) { ostr.WriteString(Host); ostr.WriteInt(Port); } else { Debug.Assert(false); // the derived class must provide the implementation } }
protected internal override void WriteOptions(OutputStream ostr) { Debug.Assert(Protocol != Protocol.Ice1); if (_resource != "/") { ostr.WriteSize(1); ostr.WriteString(_resource); } else { ostr.WriteSize(0); } }
protected internal override void WriteOptions(OutputStream ostr) { Debug.Assert(Protocol == Protocol.Ice1); base.WriteOptions(ostr); ostr.WriteString(Resource); }
public override void IceWritePayload(OutputStream ostr) { ostr.WriteString(Host); ostr.WriteInt(Port); }
public override void IceWritePayload(OutputStream ostr) { base.IceWritePayload(ostr); ostr.WriteString(_resource); }
internal static void WriteProxyData20( this OutputStream ostr, Identity identity, Protocol protocol, Encoding encoding, IReadOnlyList <string> location, InvocationMode invocationMode, string facet) { Debug.Assert(ostr.Encoding == Encoding.V20); BitSequence bitSequence = ostr.WriteBitSequence(5); identity.IceWrite(ostr); if (protocol != Protocol.Ice2) { ostr.Write(protocol); } else { bitSequence[0] = false; } if (encoding != Encoding.V20) { encoding.IceWrite(ostr); } else { bitSequence[1] = false; } if (location.Count > 0) { ostr.WriteSequence(location, OutputStream.IceWriterFromString); } else { bitSequence[2] = false; } // We only write a non-null invocation mode for ice1. if (protocol == Protocol.Ice1 && invocationMode != InvocationMode.Twoway) { ostr.Write(invocationMode); } else { bitSequence[3] = false; } if (facet.Length > 0) { ostr.WriteString(facet); } else { bitSequence[4] = false; } }
public override void IceWritePayload(OutputStream ostr) { _delegate.IceWritePayload(ostr); ostr.WriteString(Resource); }