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); } }
/// <summary>Creates a new OutgoingRequestFrame.</summary> /// <param name="communicator">The communicator to use when initializing the stream.</param> /// <param name="data">The frame data as an array segment.</param> public IncomingRequestFrame(Communicator communicator, ArraySegment <byte> data) { _communicator = communicator; Data = data; var istr = new InputStream(communicator, data); Identity = new Identity(istr); // For compatibility with the old FacetPath. string[] facetPath = istr.ReadStringArray(); if (facetPath.Length > 1) { throw new InvalidDataException($"invalid facet path length: {facetPath.Length}"); } Facet = facetPath.Length == 0 ? "" : facetPath[0]; Operation = istr.ReadString(); IsIdempotent = istr.ReadOperationMode() != OperationMode.Normal; Context = istr.ReadContext(); Payload = Data.Slice(istr.Pos); (Encoding encoding, int size) = istr.ReadEncapsulationHeader(); if (size != Payload.Count) { throw new InvalidDataException($"invalid encapsulation size: {size}"); } Encoding = encoding; }
internal WSEndpoint(TransportInstance instance, Endpoint del, Ice.InputStream s) { _instance = instance; _delegate = del; _resource = s.ReadString(); }
internal WSEndpoint(TransportInstance instance, Endpoint del, InputStream istr) { _instance = instance; _delegate = del; Resource = istr.ReadString(); }
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)); }
public IPEndpoint(TransportInstance instance, Ice.InputStream s) { Instance = instance; Host = s.ReadString(); Port = s.ReadInt(); SourceAddr = null; ConnectionId_ = ""; }
internal DispatchException ReadDispatchException() { var istr = new InputStream(_communicator, Payload, 1); var identity = new Identity(istr); string facet = istr.ReadFacet(); string operation = istr.ReadString(); if (ReplyStatus == ReplyStatus.OperationNotExistException) { return(new OperationNotExistException(identity, facet, operation)); } else { return(new ObjectNotExistException(identity, facet, operation)); } }
internal Current(int requestId, InputStream request, ObjectAdapter adapter, Ice.Connection?connection = null) { Adapter = adapter; Id = new Identity(request); // For compatibility with the old FacetPath. string[] facetPath = request.ReadStringArray(); if (facetPath.Length > 1) { throw new MarshalException(); } Facet = facetPath.Length == 0 ? "" : facetPath[0]; Operation = request.ReadString(); IsIdempotent = request.ReadOperationMode() != OperationMode.Normal; Context = request.ReadContext(); RequestId = requestId; Connection = connection; Encoding = request.StartEncapsulation(); }
/// <summary>Creates a new OutgoingRequestFrame.</summary> /// <param name="communicator">The communicator to use when initializing the stream.</param> /// <param name="data">The frame data as an array segment.</param> public IncomingRequestFrame(Communicator communicator, ArraySegment <byte> data) { _communicator = communicator; Data = data; var istr = new InputStream(communicator, data); Identity = new Identity(istr); Facet = istr.ReadFacet(); Operation = istr.ReadString(); IsIdempotent = istr.ReadOperationMode() != OperationMode.Normal; Context = istr.ReadContext(); Payload = Data.Slice(istr.Pos); (Encoding encoding, int size) = istr.ReadEncapsulationHeader(); if (size != Payload.Count) { throw new InvalidDataException($"invalid encapsulation size: {size}"); } Encoding = encoding; }
private static void PrintIdentityFacetOperation(System.IO.StringWriter s, Ice.InputStream str) { try { Ice.ToStringMode toStringMode = str.Communicator.ToStringMode; var identity = new Ice.Identity(str); s.Write("\nidentity = " + identity.ToString(toStringMode)); string[] facet = str.ReadStringArray(); s.Write("\nfacet = "); if (facet.Length > 0) { s.Write(IceUtilInternal.StringUtil.EscapeString(facet[0], "", toStringMode)); } string operation = str.ReadString(); s.Write("\noperation = " + operation); } catch (System.IO.IOException) { Debug.Assert(false); } }
internal DispatchException ReadDispatchException() { var istr = new InputStream(_communicator, Payload, 1); var identity = new Identity(istr); // For compatibility with the old FacetPath. string[] facetPath = istr.ReadStringArray(); if (facetPath.Length > 1) { throw new InvalidDataException($"invalid facet path length: {facetPath.Length}"); } string facet = facetPath.Length > 0 ? facetPath[0] : ""; string operation = istr.ReadString(); if (ReplyStatus == ReplyStatus.OperationNotExistException) { return(new OperationNotExistException(identity, facet, operation)); } else { return(new ObjectNotExistException(identity, facet, operation)); } }
private protected IPEndpoint(TransportInstance instance, InputStream s) { Instance = instance; Host = s.ReadString(); Port = s.ReadInt(); }
internal UnhandledException ReadUnhandledException() => new UnhandledException(InputStream.ReadString(Payload.Slice(1), Encoding), Identity.Empty, "", "");