ICE 3.4.2
[php5-ice-freebsdport.git] / cs / test / Ice / info / TestI.cs
blob420464033148b7d7328642206de86ae6d3a01966
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 using Test;
11 using System.Collections.Generic;
13 public class TestI : TestIntfDisp_
15 override public void shutdown(Ice.Current current)
17 current.adapter.getCommunicator().shutdown();
20 override public Dictionary<string, string> getEndpointInfoAsContext(Ice.Current c)
22 Dictionary<string, string> ctx = new Dictionary<string, string>();
23 Ice.EndpointInfo info = c.con.getEndpoint().getInfo();
24 ctx["timeout"] = info.timeout.ToString();
25 ctx["compress"] = info.compress ? "true" : "false";
26 ctx["datagram"] = info.datagram() ? "true" : "false";
27 ctx["secure"] = info.datagram() ? "true" : "false";
28 ctx["type"] = info.type().ToString();
30 Ice.IPEndpointInfo ipinfo = (Ice.IPEndpointInfo)info;
31 ctx["host"] = ipinfo.host;
32 ctx["port"] = ipinfo.port.ToString();
34 if(ipinfo is Ice.UDPEndpointInfo)
36 Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)ipinfo;
37 ctx["protocolMajor"] = udp.protocolMajor.ToString();
38 ctx["protocolMinor"] = udp.protocolMinor.ToString();
39 ctx["encodingMajor"] = udp.encodingMajor.ToString();
40 ctx["encodingMinor"] = udp.encodingMinor.ToString();
41 ctx["mcastInterface"] = udp.mcastInterface;
42 ctx["mcastTtl"] = udp.mcastTtl.ToString();
45 return ctx;
48 override public Dictionary<string, string> getConnectionInfoAsContext(Ice.Current c)
50 Dictionary<string, string> ctx = new Dictionary<string, string>();
51 Ice.ConnectionInfo info = c.con.getInfo();
52 ctx["adapterName"] = info.adapterName;
53 ctx["incoming"] = info.incoming ? "true" : "false";
55 Ice.IPConnectionInfo ipinfo = (Ice.IPConnectionInfo)info;
56 ctx["localAddress"] = ipinfo.localAddress;
57 ctx["localPort"] = ipinfo.localPort.ToString();
58 ctx["remoteAddress"] = ipinfo.remoteAddress;
59 ctx["remotePort"] = ipinfo.remotePort.ToString();
61 return ctx;