public OpaqueEndpointI(short type, BasicStream s) { _type = type; _rawEncoding = s.startReadEncaps(); int sz = s.getReadEncapsSize(); _rawBytes = new byte[sz]; s.readBlob(_rawBytes); s.endReadEncaps(); calcHashValue(); }
public TcpEndpointI(BasicStream s) { _instance = s.instance(); s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); _timeout = s.readInt(); _compress = s.readBool(); s.endReadEncaps(); calcHashValue(); }
public EndpointI create(string str, bool oaEndpoint) { string[] arr = IceUtilInternal.StringUtil.splitString(str, " \t\r\n"); if(arr == null) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "mismatched quote"; throw e; } if(arr.Length == 0) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "value has no non-whitespace characters"; throw e; } List<string> v = new List<string>(arr); string protocol = v[0]; v.RemoveAt(0); if(protocol.Equals("default")) { protocol = instance_.defaultsAndOverrides().defaultProtocol; } EndpointFactory factory = null; lock(this) { for(int i = 0; i < _factories.Count; i++) { EndpointFactory f = _factories[i]; if(f.protocol().Equals(protocol)) { factory = f; } } } if(factory != null) { EndpointI e = factory.create(v, oaEndpoint); if(v.Count > 0) { Ice.EndpointParseException ex = new Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v[0] + "' in endpoint `" + str + "'"; throw ex; } return e; // Code below left in place for debugging. /* EndpointI e = f.create(s.Substring(m.Index + m.Length), oaEndpoint); BasicStream bs = new BasicStream(instance_, true); e.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); short type = bs.readShort(); EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); System.Console.Error.WriteLine("Normal: " + e); System.Console.Error.WriteLine("Opaque: " + ue); return e; */ } // // If the stringified endpoint is opaque, create an unknown endpoint, // then see whether the type matches one of the known endpoints. // if(protocol.Equals("opaque")) { EndpointI ue = new OpaqueEndpointI(v); if(v.Count > 0) { Ice.EndpointParseException ex = new Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v[0] + "' in endpoint `" + str + "'"; throw ex; } factory = get(ue.type()); if(factory != null) { // // Make a temporary stream, write the opaque endpoint data into the stream, // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // BasicStream bs = new BasicStream(instance_, Ice.Util.currentProtocolEncoding); bs.writeShort(ue.type()); ue.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); buf.b.limit(buf.size()); bs.readShort(); // type bs.startReadEncaps(); EndpointI e = factory.read(bs); bs.endReadEncaps(); return e; } return ue; // Endpoint is opaque, but we don't have a factory for its type. } return null; }
public EndpointI read(BasicStream s) { lock(this) { short type = s.readShort(); EndpointFactory factory = get(type); EndpointI e = null; s.startReadEncaps(); if(factory != null) { e = factory.read(s); } else { e = new OpaqueEndpointI(type, s); } s.endReadEncaps(); return e; } }
public UdpEndpointI(BasicStream s) { instance_ = s.instance(); s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); if(s.getReadEncoding().Equals(Ice.Util.Encoding_1_0)) { s.readByte(); s.readByte(); s.readByte(); s.readByte(); } // Not transmitted. //_connect = s.readBool(); _connect = false; _compress = s.readBool(); s.endReadEncaps(); calcHashValue(); }
public UdpEndpointI(BasicStream s) { instance_ = s.instance(); s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); _protocolMajor = s.readByte(); _protocolMinor = s.readByte(); _encodingMajor = s.readByte(); _encodingMinor = s.readByte(); if(_protocolMajor != Protocol.protocolMajor) { Ice.UnsupportedProtocolException e = new Ice.UnsupportedProtocolException(); e.badMajor = _protocolMajor < 0?_protocolMajor + 255:_protocolMajor; e.badMinor = _protocolMinor < 0?_protocolMinor + 255:_protocolMinor; e.major = Protocol.protocolMajor; e.minor = Protocol.protocolMinor; throw e; } if(_encodingMajor != Protocol.encodingMajor) { Ice.UnsupportedEncodingException e = new Ice.UnsupportedEncodingException(); e.badMajor = _encodingMajor < 0?_encodingMajor + 255:_encodingMajor; e.badMinor = _encodingMinor < 0?_encodingMinor + 255:_encodingMinor; e.major = Protocol.encodingMajor; e.minor = Protocol.encodingMinor; throw e; } // Not transmitted. //_connect = s.readBool(); _connect = false; _compress = s.readBool(); s.endReadEncaps(); calcHashValue(); }