diff options
Diffstat (limited to 'py/modules/IcePy/EndpointInfo.cpp')
-rw-r--r-- | py/modules/IcePy/EndpointInfo.cpp | 83 |
1 files changed, 33 insertions, 50 deletions
diff --git a/py/modules/IcePy/EndpointInfo.cpp b/py/modules/IcePy/EndpointInfo.cpp index ae6c0750458..2af26990059 100644 --- a/py/modules/IcePy/EndpointInfo.cpp +++ b/py/modules/IcePy/EndpointInfo.cpp @@ -123,86 +123,60 @@ endpointInfoSecure(EndpointInfoObject* self) extern "C" #endif static PyObject* -endpointInfoGetTimeout(EndpointInfoObject* self) -{ - return PyLong_FromLong((*self->endpointInfo)->timeout); -} - -#ifdef WIN32 -extern "C" -#endif -static PyObject* -endpointInfoGetCompress(EndpointInfoObject* self) -{ - PyObject* result = (*self->endpointInfo)->compress ? getTrue() : getFalse(); - Py_INCREF(result); - return result; -} - -#ifdef WIN32 -extern "C" -#endif -static PyObject* -ipEndpointInfoGetHost(EndpointInfoObject* self) +endpointInfoGetProtocol(EndpointInfoObject* self) { - Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo); - assert(info); - return createString(info->host); + return createProtocolVersion((*self->endpointInfo)->protocol); } #ifdef WIN32 extern "C" #endif static PyObject* -ipEndpointInfoGetPort(EndpointInfoObject* self) +endpointInfoGetEncoding(EndpointInfoObject* self) { - Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo); - assert(info); - return PyLong_FromLong(info->port); + return createEncodingVersion((*self->endpointInfo)->encoding); } #ifdef WIN32 extern "C" #endif static PyObject* -udpEndpointInfoGetProtocolMajor(EndpointInfoObject* self) +endpointInfoGetTimeout(EndpointInfoObject* self) { - Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo); - assert(info); - return PyLong_FromLong(info->protocolMajor); + return PyLong_FromLong((*self->endpointInfo)->timeout); } #ifdef WIN32 extern "C" #endif static PyObject* -udpEndpointInfoGetProtocolMinor(EndpointInfoObject* self) +endpointInfoGetCompress(EndpointInfoObject* self) { - Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo); - assert(info); - return PyLong_FromLong(info->protocolMinor); + PyObject* result = (*self->endpointInfo)->compress ? getTrue() : getFalse(); + Py_INCREF(result); + return result; } #ifdef WIN32 extern "C" #endif static PyObject* -udpEndpointInfoGetEncodingMajor(EndpointInfoObject* self) +ipEndpointInfoGetHost(EndpointInfoObject* self) { - Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo); + Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo); assert(info); - return PyLong_FromLong(info->encodingMajor); + return createString(info->host); } #ifdef WIN32 extern "C" #endif static PyObject* -udpEndpointInfoGetEncodingMinor(EndpointInfoObject* self) +ipEndpointInfoGetPort(EndpointInfoObject* self) { - Ice::UDPEndpointInfoPtr info = Ice::UDPEndpointInfoPtr::dynamicCast(*self->endpointInfo); + Ice::IPEndpointInfoPtr info = Ice::IPEndpointInfoPtr::dynamicCast(*self->endpointInfo); assert(info); - return PyLong_FromLong(info->encodingMinor); + return PyLong_FromLong(info->port); } #ifdef WIN32 @@ -244,6 +218,17 @@ opaqueEndpointInfoGetRawBytes(EndpointInfoObject* self) #endif } +#ifdef WIN32 +extern "C" +#endif +static PyObject* +opaqueEndpointInfoGetRawEncoding(EndpointInfoObject* self) +{ + Ice::OpaqueEndpointInfoPtr info = Ice::OpaqueEndpointInfoPtr::dynamicCast(*self->endpointInfo); + assert(info); + return IcePy::createEncodingVersion(info->rawEncoding); +} + static PyMethodDef EndpointInfoMethods[] = { { STRCAST("type"), reinterpret_cast<PyCFunction>(endpointInfoType), METH_NOARGS, @@ -257,6 +242,10 @@ static PyMethodDef EndpointInfoMethods[] = static PyGetSetDef EndpointInfoGetters[] = { + { STRCAST("protocol"), reinterpret_cast<getter>(endpointInfoGetProtocol), 0, + PyDoc_STR(STRCAST("protocol version supported by the endpoint")), 0 }, + { STRCAST("encoding"), reinterpret_cast<getter>(endpointInfoGetEncoding), 0, + PyDoc_STR(STRCAST("encoding version supported by the endpoint")), 0 }, { STRCAST("timeout"), reinterpret_cast<getter>(endpointInfoGetTimeout), 0, PyDoc_STR(STRCAST("timeout in milliseconds")), 0 }, { STRCAST("compress"), reinterpret_cast<getter>(endpointInfoGetCompress), 0, @@ -275,14 +264,6 @@ static PyGetSetDef IPEndpointInfoGetters[] = static PyGetSetDef UDPEndpointInfoGetters[] = { - { STRCAST("protocolMajor"), reinterpret_cast<getter>(udpEndpointInfoGetProtocolMajor), 0, - PyDoc_STR(STRCAST("protocol major version")), 0 }, - { STRCAST("protocolMinor"), reinterpret_cast<getter>(udpEndpointInfoGetProtocolMinor), 0, - PyDoc_STR(STRCAST("protocol minor version")), 0 }, - { STRCAST("encodingMajor"), reinterpret_cast<getter>(udpEndpointInfoGetEncodingMajor), 0, - PyDoc_STR(STRCAST("encoding major version")), 0 }, - { STRCAST("encodingMinor"), reinterpret_cast<getter>(udpEndpointInfoGetEncodingMinor), 0, - PyDoc_STR(STRCAST("encoding minor version")), 0 }, { STRCAST("mcastInterface"), reinterpret_cast<getter>(udpEndpointInfoGetMcastInterface), 0, PyDoc_STR(STRCAST("multicast interface")), 0 }, { STRCAST("mcastTtl"), reinterpret_cast<getter>(udpEndpointInfoGetMcastTtl), 0, @@ -294,6 +275,8 @@ static PyGetSetDef OpaqueEndpointInfoGetters[] = { { STRCAST("rawBytes"), reinterpret_cast<getter>(opaqueEndpointInfoGetRawBytes), 0, PyDoc_STR(STRCAST("raw encoding")), 0 }, + { STRCAST("rawEncoding"), reinterpret_cast<getter>(opaqueEndpointInfoGetRawEncoding), 0, + PyDoc_STR(STRCAST("raw encoding version")), 0 }, { 0, 0 } /* sentinel */ }; |