public IceClientTransportSink(string url) { IceChannelUtils.ParseIceURL(url, out _host, out _port, out _objectUri); Ice.TcpEndpoint te = new Ice.TcpEndpoint(_host, _port); _e = Ice.Manager.GetManager().GetEndpoint(te); }
public virtual void WriteProxy(object o, Type ot) { if (!RemotingServices.IsTransparentProxy(o)) { Console.WriteLine("o {0} ot {1} is not transparent proxy!", o, ot); throw new InvalidOperationException("object which is not a transparent proxy passed to WriteProxy, type " + ot); } ObjRef or = RemotingServices.GetObjRefForProxy((System.MarshalByRefObject)o); Ice.Identity proxy_ident = new Ice.Identity(or.URI.StartsWith("/") ? or.URI.Substring(1) : or.URI); Ice.Endpoint proxy_ep = null; foreach (object cdo in or.ChannelInfo.ChannelData) { ChannelDataStore cd = cdo as ChannelDataStore; if (cd == null) { continue; } foreach (string ch_uri in cd.ChannelUris) { string host; int port; string uri; if (IceChannelUtils.ParseIceURL(ch_uri, out host, out port, out uri)) { proxy_ep = new Ice.TcpEndpoint(host, port); proxy_ep.Incoming = true; break; } } } if (proxy_ep == null) { throw new InvalidOperationException("Couldn't find valid Ice endpoint/channel for " + o); } Ice.ProxyData pd = new Ice.ProxyData(); pd.id = proxy_ident; pd.facet = new string[0]; pd.mode = ProxyMode.Twoway; // FIXME -- do I need to send multiple proxy things here? pd.secure = false; WriteStruct(pd); WriteSize(1); // one endpoint follows // tcp endpoint encapsulation WriteObject((short)1); // it's a TCP endpoint BeginEncapsulation(); Ice.TcpEndpoint te = proxy_ep as Ice.TcpEndpoint; Write(te.host); WriteObject(te.port); WriteObject(te.timeout); WriteObject(te.compress); EndEncapsulation(); }
public string Parse(string url, out string objectURI) { string host; int port; string rest; IceChannelUtils.ParseIceURL(url, out host, out port, out rest); objectURI = rest; return("ice://" + host + ":" + port); }
public string Parse(string url, out string objectURI) { int port; string host; string uri; objectURI = null; if (!IceChannelUtils.ParseIceURL(url, out host, out port, out uri)) { return(null); } objectURI = uri; return("ice://" + host + ":" + port); }
private void FormatMessage(IMessage msg, out Stream msgStream) { IMethodCallMessage mcall = msg as IMethodCallMessage; // if the identity wasn't set by the custom proxy, then we // extract it from the uri if (mcall.LogicalCallContext.GetData("__iceIdentity") == null) { // extract the Identity from the URI // FIXME FIXME FIXME -- this is supposed to be a Uri, why's it look like a Url?? Trace.WriteLine("IceClientFormatterSink: using identity from " + mcall.Uri); if (mcall.Uri == null) { throw new Exception("__iceIdentity property not set by IceClientFormatterSink upstream, and mcall.Uri == null!"); } string h, r; int p; IceChannelUtils.ParseIceURL(mcall.Uri, out h, out p, out r); mcall.LogicalCallContext.SetData("__iceIdentity", new Ice.Identity(r)); } mcall.LogicalCallContext.SetData("__iceFacetPath", new string[0]); mcall.LogicalCallContext.SetData("__iceContext", new Ice.Context()); OperationMode opmode = OperationMode.Normal; Ice.OperationModeAttribute opmodeattr = (Ice.OperationModeAttribute)Attribute.GetCustomAttribute(mcall.MethodBase, typeof(Ice.OperationModeAttribute)); if (opmodeattr != null) { opmode = opmodeattr.mode; } mcall.LogicalCallContext.SetData("__iceOperationMode", opmode); if (Attribute.GetCustomAttribute(mcall.MethodBase, typeof(OneWayAttribute)) != null) { mcall.LogicalCallContext.SetData("__iceOneWay", true); } else { mcall.LogicalCallContext.SetData("__iceOneWay", false); } msgStream = new MemoryStream(); IceChannelUtils.MessageToProtocolRequest(msgStream, msg); }
public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) { string host; int port; string rest; IceChannelUtils.ParseIceURL(url, out host, out port, out rest); string key = host + ":" + port; if (!_uriMap.Contains(key)) { IClientChannelSink cs = new IceClientTransportSink(url); _uriMap[key] = cs; } return((IClientChannelSink)_uriMap[key]); }
public Proxy(Type rootType, string url) : base(rootType) { string host; int port; string rest; IceChannelUtils.ParseIceURL(url, out host, out port, out rest); _url = url; _identity = new Ice.Identity(rest); _facetPath = new string[0]; _secure = false; _typeIds = null; _realObject = null; FindChannel(); }