public virtual void TightUnmarshal( OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) { }
protected virtual int TightMarshalNestedObject1( OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) { return wireFormat.TightMarshalNestedObject1(o, bs); }
protected virtual DataStructure TightUnmarshalNestedObject( OpenWireFormat wireFormat, BinaryReader dataIn, BooleanStream bs) { return wireFormat.TightUnmarshalNestedObject(dataIn, bs); }
public virtual void TightMarshal2( OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) { }
protected virtual void TightMarshalNestedObject2( OpenWireFormat wireFormat, DataStructure o, BinaryWriter dataOut, BooleanStream bs) { wireFormat.TightMarshalNestedObject2(o, dataOut, bs); }
protected virtual void LooseMarshalObjectArray( OpenWireFormat wireFormat, DataStructure[] objects, BinaryWriter dataOut) { dataOut.Write(objects!=null); if (objects!=null) { dataOut.Write((short) objects.Length); for (int i = 0; i < objects.Length; i++) { LooseMarshalNestedObject(wireFormat, objects[i], dataOut); } } }
protected virtual BrokerError LooseUnmarshalBrokerError( OpenWireFormat wireFormat, BinaryReader dataIn) { if (dataIn.ReadBoolean()) { BrokerError answer = new BrokerError(); answer.ExceptionClass = LooseUnmarshalString(dataIn); answer.Message = LooseUnmarshalString(dataIn); if (wireFormat.StackTraceEnabled) { short length = dataIn.ReadInt16(); StackTraceElement[] stackTrace = new StackTraceElement[length]; for (int i = 0; i < stackTrace.Length; i++) { StackTraceElement element = new StackTraceElement(); element.ClassName = LooseUnmarshalString(dataIn); element.MethodName = LooseUnmarshalString(dataIn); element.FileName = LooseUnmarshalString(dataIn); element.LineNumber = dataIn.ReadInt32(); stackTrace[i] = element; } answer.StackTraceElements = stackTrace; answer.Cause = LooseUnmarshalBrokerError(wireFormat, dataIn); } return answer; } else { return null; } }
public virtual int TightMarshalLong1(OpenWireFormat wireFormat, long o, BooleanStream bs) { if (o == 0L) { bs.WriteBoolean(false); bs.WriteBoolean(false); return 0; } else { ulong ul = (ulong) o; if ((ul & 0xFFFFFFFFFFFF0000ul) == 0L) { bs.WriteBoolean(false); bs.WriteBoolean(true); return 2; } else if ((ul & 0xFFFFFFFF00000000ul) == 0L) { bs.WriteBoolean(true); bs.WriteBoolean(false); return 4; } else { bs.WriteBoolean(true); bs.WriteBoolean(true); return 8; } } }
public virtual long LooseUnmarshalLong(OpenWireFormat wireFormat, BinaryReader dataIn) { return dataIn.ReadInt64(); }
public override void BeforeMarshall(OpenWireFormat wireFormat) { if (body == null) { Content = null; } else { MemoryStream stream = new MemoryStream(); Formatter.Serialize(stream, body); Content = stream.ToArray(); } //Console.WriteLine("BeforeMarshalling, content is: " + Content); base.BeforeMarshall(wireFormat); }
public override void BeforeMarshall(OpenWireFormat wireFormat) { if(body == null) { Content = null; } else { MemoryStream buffer = new MemoryStream(); Stream target = buffer; if(this.Connection != null && this.Connection.UseCompression) { target = this.Connection.CompressionPolicy.CreateCompressionStream(target); this.Compressed = true; } this.body.Marshal(target); target.Close(); this.Content = buffer.ToArray(); } Tracer.Debug("BeforeMarshalling, content is: " + Content); base.BeforeMarshall(wireFormat); }
protected void LooseMarshalBrokerError( OpenWireFormat wireFormat, BrokerError o, BinaryWriter dataOut) { dataOut.Write(o!=null); if (o!=null) { LooseMarshalString(o.ExceptionClass, dataOut); LooseMarshalString(o.Message, dataOut); if (wireFormat.StackTraceEnabled) { StackTraceElement[] stackTrace = o.StackTraceElements; dataOut.Write((short) stackTrace.Length); for (int i = 0; i < stackTrace.Length; i++) { StackTraceElement element = stackTrace[i]; LooseMarshalString(element.ClassName, dataOut); LooseMarshalString(element.MethodName, dataOut); LooseMarshalString(element.FileName, dataOut); dataOut.Write(element.LineNumber); } LooseMarshalBrokerError(wireFormat, o.Cause, dataOut); } } }
public virtual long TightUnmarshalLong(OpenWireFormat wireFormat, BinaryReader dataIn, BooleanStream bs) { if (bs.ReadBoolean()) { if (bs.ReadBoolean()) { return dataIn.ReadInt64(); // dataIn.ReadInt64(); } else { return dataIn.ReadInt32(); } } else { if (bs.ReadBoolean()) { return dataIn.ReadInt16(); } else { return 0; } } }
public virtual void LooseUnmarshal( OpenWireFormat wireFormat, Object o, BinaryReader dataIn) { }
protected virtual DataStructure LooseUnmarshalNestedObject( OpenWireFormat wireFormat, BinaryReader dataIn) { return wireFormat.LooseUnmarshalNestedObject(dataIn); }
public virtual void LooseMarshal( OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) { }
protected void TightMarshalBrokerError2( OpenWireFormat wireFormat, BrokerError o, BinaryWriter dataOut, BooleanStream bs) { if (bs.ReadBoolean()) { TightMarshalString2(o.ExceptionClass, dataOut, bs); TightMarshalString2(o.Message, dataOut, bs); if (wireFormat.StackTraceEnabled) { StackTraceElement[] stackTrace = o.StackTraceElements; dataOut.Write((short) stackTrace.Length); for (int i = 0; i < stackTrace.Length; i++) { StackTraceElement element = stackTrace[i]; TightMarshalString2(element.ClassName, dataOut, bs); TightMarshalString2(element.MethodName, dataOut, bs); TightMarshalString2(element.FileName, dataOut, bs); dataOut.Write(element.LineNumber); } TightMarshalBrokerError2(wireFormat, o.Cause, dataOut, bs); } } }
protected int TightMarshalBrokerError1(OpenWireFormat wireFormat, BrokerError o, BooleanStream bs) { if (o == null) { bs.WriteBoolean(false); return 0; } else { int rc = 0; bs.WriteBoolean(true); rc += TightMarshalString1(o.ExceptionClass, bs); rc += TightMarshalString1(o.Message, bs); if (wireFormat.StackTraceEnabled) { rc += 2; StackTraceElement[] stackTrace = o.StackTraceElements; for (int i = 0; i < stackTrace.Length; i++) { StackTraceElement element = stackTrace[i]; rc += TightMarshalString1(element.ClassName, bs); rc += TightMarshalString1(element.MethodName, bs); rc += TightMarshalString1(element.FileName, bs); rc += 4; } rc += TightMarshalBrokerError1(wireFormat, o.Cause, bs); } return rc; } }
protected virtual void TightMarshalObjectArray2( OpenWireFormat wireFormat, DataStructure[] objects, BinaryWriter dataOut, BooleanStream bs) { if (bs.ReadBoolean()) { dataOut.Write((short) objects.Length); for (int i = 0; i < objects.Length; i++) { TightMarshalNestedObject2(wireFormat, objects[i], dataOut, bs); } } }
protected virtual int TightMarshalObjectArray1( OpenWireFormat wireFormat, DataStructure[] objects, BooleanStream bs) { if (objects != null) { int rc = 0; bs.WriteBoolean(true); rc += 2; for (int i = 0; i < objects.Length; i++) { rc += TightMarshalNestedObject1(wireFormat, objects[i], bs); } return rc; } else { bs.WriteBoolean(false); return 0; } }
protected virtual void LooseMarshalNestedObject( OpenWireFormat wireFormat, DataStructure o, BinaryWriter dataOut) { wireFormat.LooseMarshalNestedObject(o, dataOut); }
public virtual void TightMarshalLong2( OpenWireFormat wireFormat, long o, BinaryWriter dataOut, BooleanStream bs) { if (bs.ReadBoolean()) { if (bs.ReadBoolean()) { dataOut.Write(o); } else { dataOut.Write((int)o); } } else { if (bs.ReadBoolean()) { dataOut.Write((short)o); } } }
protected virtual DataStructure LooseUnmarshalCachedObject( OpenWireFormat wireFormat, BinaryReader dataIn) { /* if (wireFormat.isCacheEnabled()) { if (bs.ReadBoolean()) { short index = dataIndataIn.ReadInt16()Int16(); DataStructure value = wireFormat.UnmarshalNestedObject(dataIn, bs); wireFormat.setInUnmarshallCache(index, value); return value; } else { short index = dataIn.ReadInt16(); return wireFormat.getFromUnmarshallCache(index); } } else { return wireFormat.UnmarshalNestedObject(dataIn, bs); } */ return wireFormat.LooseUnmarshalNestedObject(dataIn); }
protected virtual void LooseMarshalCachedObject( OpenWireFormat wireFormat, DataStructure o, BinaryWriter dataOut) { /* if (wireFormat.isCacheEnabled()) { Short index = wireFormat.getMarshallCacheIndex(o); if (bs.ReadBoolean()) { dataOut.Write(index.shortValue(), dataOut); wireFormat.Marshal2NestedObject(o, dataOut, bs); } else { dataOut.Write(index.shortValue(), dataOut); } } else { wireFormat.Marshal2NestedObject(o, dataOut, bs); } */ wireFormat.LooseMarshalNestedObject(o, dataOut); }
public ITransport CompositeConnect(Uri location, SetTransport setTransport) { // Extract query parameters from broker Uri StringDictionary map = URISupport.ParseQuery(location.Query); // Set transport. properties on this (the factory) URISupport.SetProperties(this, map, "transport."); // See if there is a local address and port specified string localAddress = null; int localPort = -1; if(!String.IsNullOrEmpty(location.AbsolutePath) && !location.AbsolutePath.Equals("/")) { int index = location.AbsolutePath.IndexOf(':'); try { localPort = Int16.Parse(location.AbsolutePath.Substring(index + 1)); localAddress = location.AbsolutePath.Substring(1, index - 1); Tracer.DebugFormat("Binding Socket to {0} on port: {1}", localAddress, localPort); } catch { Tracer.Warn("Invalid Port value on URI for local bind option, ignoring."); } } Tracer.Debug("Opening socket to: " + location.Host + " on port: " + location.Port); Socket socket = DoConnect(location.Host, location.Port, localAddress, localPort ); #if !NETCF socket.ReceiveBufferSize = ReceiveBufferSize; socket.SendBufferSize = SendBufferSize; socket.ReceiveTimeout = ReceiveTimeout; socket.SendTimeout = SendTimeout; #endif OpenWireFormat wireformat = new OpenWireFormat(); // Set wireformat. properties on the wireformat owned by the tcpTransport URISupport.SetProperties(wireformat.PreferredWireFormatInfo, map, "wireFormat."); ITransport transport = DoCreateTransport(location, socket, wireformat); wireformat.Transport = transport; if(UseLogging) { transport = new LoggingTransport(transport); } if(UseInactivityMonitor) { transport = new InactivityMonitor(transport); } transport = new WireFormatNegotiator(transport, wireformat); if(setTransport != null) { setTransport(transport, location); } return transport; }
public virtual void LooseMarshalLong( OpenWireFormat wireFormat, long o, BinaryWriter dataOut) { dataOut.Write(o); }
public WireFormatNegotiator(ITransport next, OpenWireFormat wireFormat) : base(next) { this.wireFormat = wireFormat; }
public virtual int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) { return 0; }
public override void BeforeMarshall(OpenWireFormat wireFormat) { MarshalledProperties = null; if(properties != null) { MarshalledProperties = properties.Marshal(); } }
public override void BeforeMarshall(OpenWireFormat wireFormat) { if (body == null) { Content = null; } else { MemoryStream result = new MemoryStream(); Stream target = result; if(this.Connection != null && this.Connection.UseCompression) { this.Compressed = true; target = this.Connection.CompressionPolicy.CreateCompressionStream(target); } Formatter.Serialize(target, body); target.Close(); Content = result.ToArray(); } //Console.WriteLine("BeforeMarshalling, content is: " + Content); base.BeforeMarshall(wireFormat); }