1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
using System.Collections.Generic;
using System.Diagnostics;
internal class EndpointI : IceInternal.EndpointI
{
internal static short TYPE_BASE = 100;
internal EndpointI(IceInternal.EndpointI endpoint)
{
_endpoint = endpoint;
_configuration = Configuration.getInstance();
}
public override string ice_toString_()
{
return "test-" + _endpoint.ToString();
}
public override Ice.EndpointInfo getInfo()
{
return _endpoint.getInfo();
}
public override void streamWriteImpl(Ice.OutputStream s)
{
s.writeShort(_endpoint.type());
_endpoint.streamWrite(s);
}
public override short type()
{
return (short)(TYPE_BASE + _endpoint.type());
}
public override string protocol()
{
return _endpoint.protocol();
}
public override int timeout()
{
return _endpoint.timeout();
}
public override IceInternal.EndpointI timeout(int timeout)
{
IceInternal.EndpointI endpoint = _endpoint.timeout(timeout);
if(endpoint == _endpoint)
{
return this;
}
else
{
return new EndpointI(endpoint);
}
}
public override string connectionId()
{
return _endpoint.connectionId();
}
public override IceInternal.EndpointI connectionId(string connectionId)
{
IceInternal.EndpointI endpoint = _endpoint.connectionId(connectionId);
if(endpoint == _endpoint)
{
return this;
}
else
{
return new EndpointI(endpoint);
}
}
public override bool compress()
{
return _endpoint.compress();
}
public override IceInternal.EndpointI compress(bool compress)
{
IceInternal.EndpointI endpoint = _endpoint.compress(compress);
if(endpoint == _endpoint)
{
return this;
}
else
{
return new EndpointI(endpoint);
}
}
public override bool datagram()
{
return _endpoint.datagram();
}
public override bool secure()
{
return _endpoint.secure();
}
public override IceInternal.Transceiver transceiver()
{
IceInternal.Transceiver transceiver = _endpoint.transceiver();
if(transceiver != null)
{
return new Transceiver(transceiver);
}
else
{
return null;
}
}
private class ConnectorsCallback : IceInternal.EndpointI_connectors
{
internal ConnectorsCallback(IceInternal.EndpointI_connectors cb)
{
_callback = cb;
}
public void connectors(List<IceInternal.Connector> cons)
{
List<IceInternal.Connector> connectors = new List<IceInternal.Connector>();
foreach(IceInternal.Connector connector in cons)
{
connectors.Add(new Connector(connector));
}
_callback.connectors(connectors);
}
public void exception(Ice.LocalException exception)
{
_callback.exception(exception);
}
private IceInternal.EndpointI_connectors _callback;
}
public override void connectors_async(Ice.EndpointSelectionType selType, IceInternal.EndpointI_connectors cb)
{
try
{
_configuration.checkConnectorsException();
_endpoint.connectors_async(selType, new ConnectorsCallback(cb));
}
catch(Ice.LocalException ex)
{
cb.exception(ex);
}
}
public override IceInternal.Acceptor acceptor(string adapterName)
{
return new Acceptor(this, _endpoint.acceptor(adapterName));
}
public EndpointI endpoint(IceInternal.EndpointI delEndp)
{
if(delEndp == _endpoint)
{
return this;
}
else
{
return new EndpointI(delEndp);
}
}
public override List<IceInternal.EndpointI> expandIfWildcard()
{
List<IceInternal.EndpointI> endps = new List<IceInternal.EndpointI>();
foreach(IceInternal.EndpointI endpt in _endpoint.expandIfWildcard())
{
endps.Add(endpt == _endpoint ? this : new EndpointI(endpt));
}
return endps;
}
public override List<IceInternal.EndpointI> expandHost(out IceInternal.EndpointI publish)
{
List<IceInternal.EndpointI> endps = new List<IceInternal.EndpointI>();
foreach(IceInternal.EndpointI endpt in _endpoint.expandHost(out publish))
{
endps.Add(endpt == _endpoint ? this : new EndpointI(endpt));
}
if(publish != null)
{
publish = publish == _endpoint ? this : new EndpointI(publish);
}
return endps;
}
public override bool equivalent(IceInternal.EndpointI endpoint)
{
EndpointI testEndpoint = null;
try
{
testEndpoint = (EndpointI)endpoint;
}
catch(System.InvalidCastException)
{
return false;
}
return testEndpoint._endpoint.equivalent(_endpoint);
}
public override string options()
{
return _endpoint.options();
}
public override int GetHashCode()
{
return _endpoint.GetHashCode();
}
public override int CompareTo(IceInternal.EndpointI obj)
{
EndpointI p = null;
try
{
p = (EndpointI)obj;
}
catch(System.InvalidCastException)
{
try
{
return type() < obj.type() ? -1 : 1;
}
catch(System.InvalidCastException)
{
Debug.Assert(false);
}
}
if(this == p)
{
return 0;
}
return _endpoint.CompareTo(p._endpoint);
}
public IceInternal.EndpointI getDelegate()
{
return _endpoint;
}
private IceInternal.EndpointI _endpoint;
private Configuration _configuration;
}
|