ICE 3.4.2
[php5-ice-freebsdport.git] / py / test / Ice / info / TestI.py
blob9b18ee32095ebe80bf6de16722564cce220a89fd
1 # **********************************************************************
3 # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 # This copy of Ice is licensed to you under the terms described in the
6 # ICE_LICENSE file included in this distribution.
8 # **********************************************************************
10 import Ice, Test
11 import time
13 class MyDerivedClassI(Test.TestIntf):
14 def __init__(self):
15 self.ctx = None
17 def shutdown(self, current=None):
18 current.adapter.getCommunicator().shutdown()
20 def getEndpointInfoAsContext(self, current):
21 ctx = {}
22 info = current.con.getEndpoint().getInfo()
23 ctx["timeout"] = str(info.timeout)
24 if info.compress:
25 ctx["compress"] = "true"
26 else:
27 ctx["compress"] ="false"
28 if info.datagram():
29 ctx["datagram"] = "true"
30 else:
31 ctx["datagram"] ="false"
32 if info.secure():
33 ctx["secure"] = "true"
34 else:
35 ctx["secure"] ="false"
36 ctx["type"] = str(info.type())
38 ctx["host"] = info.host
39 ctx["port"] = str(info.port)
41 if isinstance(info, Ice.UDPEndpointInfo):
42 ctx["protocolMajor"] = str(info.protocolMajor)
43 ctx["protocolMinor"] = str(info.protocolMinor)
44 ctx["encodingMajor"] = str(info.encodingMajor)
45 ctx["encodingMinor"] = str(info.encodingMinor)
46 ctx["mcastInterface"] = info.mcastInterface
47 ctx["mcastTtl"] = str(info.mcastTtl)
49 return ctx
51 def getConnectionInfoAsContext(self, current):
52 ctx = {}
53 info = current.con.getInfo()
54 ctx["adapterName"] = info.adapterName
55 if info.incoming:
56 ctx["incoming"] = "true"
57 else:
58 ctx["incoming"] ="false"
60 ctx["localAddress"] = info.localAddress
61 ctx["localPort"] = str(info.localPort)
62 ctx["remoteAddress"] = info.remoteAddress
63 ctx["remotePort"] = str(info.remotePort)
65 return ctx