diff options
Diffstat (limited to 'python/modules/IcePy/EndpointInfo.cpp')
-rw-r--r-- | python/modules/IcePy/EndpointInfo.cpp | 104 |
1 files changed, 20 insertions, 84 deletions
diff --git a/python/modules/IcePy/EndpointInfo.cpp b/python/modules/IcePy/EndpointInfo.cpp index 7ce8aa4c978..80001072a91 100644 --- a/python/modules/IcePy/EndpointInfo.cpp +++ b/python/modules/IcePy/EndpointInfo.cpp @@ -124,6 +124,15 @@ endpointInfoSecure(EndpointInfoObject* self) extern "C" #endif static PyObject* +endpointInfoGetUnderlying(EndpointInfoObject* self) +{ + return createEndpointInfo((*self->endpointInfo)->underlying); +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* endpointInfoGetTimeout(EndpointInfoObject* self) { return PyLong_FromLong((*self->endpointInfo)->timeout); @@ -208,17 +217,6 @@ wsEndpointInfoGetResource(EndpointInfoObject* self) extern "C" #endif static PyObject* -wssEndpointInfoGetResource(EndpointInfoObject* self) -{ - IceSSL::WSSEndpointInfoPtr info = IceSSL::WSSEndpointInfoPtr::dynamicCast(*self->endpointInfo); - assert(info); - return createString(info->resource); -} - -#ifdef WIN32 -extern "C" -#endif -static PyObject* opaqueEndpointInfoGetRawBytes(EndpointInfoObject* self) { Ice::OpaqueEndpointInfoPtr info = Ice::OpaqueEndpointInfoPtr::dynamicCast(*self->endpointInfo); @@ -256,6 +254,8 @@ static PyMethodDef EndpointInfoMethods[] = static PyGetSetDef EndpointInfoGetters[] = { + { STRCAST("underlying"), reinterpret_cast<getter>(endpointInfoGetUnderlying), 0, + PyDoc_STR(STRCAST("underling endpoint information")), 0 }, { STRCAST("timeout"), reinterpret_cast<getter>(endpointInfoGetTimeout), 0, PyDoc_STR(STRCAST("timeout in milliseconds")), 0 }, { STRCAST("compress"), reinterpret_cast<getter>(endpointInfoGetCompress), 0, @@ -290,13 +290,6 @@ static PyGetSetDef WSEndpointInfoGetters[] = { 0, 0 } /* sentinel */ }; -static PyGetSetDef WSSEndpointInfoGetters[] = -{ - { STRCAST("resource"), reinterpret_cast<getter>(wssEndpointInfoGetResource), 0, - PyDoc_STR(STRCAST("resource")), 0 }, - { 0, 0 } /* sentinel */ -}; - static PyGetSetDef OpaqueEndpointInfoGetters[] = { { STRCAST("rawBytes"), reinterpret_cast<getter>(opaqueEndpointInfoGetRawBytes), 0, @@ -361,7 +354,7 @@ PyTypeObject IPEndpointInfoType = /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ PyVarObject_HEAD_INIT(0, 0) - STRCAST("IcePy.IPEndpointInfo"), /* tp_name */ + STRCAST(".IPEndpointInfo"), /* tp_name */ sizeof(EndpointInfoObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ @@ -591,53 +584,6 @@ PyTypeObject SSLEndpointInfoType = 0, /* tp_is_gc */ }; -PyTypeObject WSSEndpointInfoType = -{ - /* The ob_type field must be initialized in the module init function - * to be portable to Windows without using C++. */ - PyVarObject_HEAD_INIT(0, 0) - STRCAST("IcePy.WSSEndpointInfo"), /* tp_name */ - sizeof(EndpointInfoObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - reinterpret_cast<destructor>(endpointInfoDealloc), /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - WSSEndpointInfoGetters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - reinterpret_cast<newfunc>(endpointInfoNew), /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ -}; - PyTypeObject OpaqueEndpointInfoType = { /* The ob_type field must be initialized in the module init function @@ -733,7 +679,7 @@ IcePy::initEndpointInfo(PyObject* module) return false; } - WSEndpointInfoType.tp_base = &IPEndpointInfoType; // Force inheritance from IPEndpointType. + WSEndpointInfoType.tp_base = &EndpointInfoType; // Force inheritance from IPEndpointType. if(PyType_Ready(&WSEndpointInfoType) < 0) { return false; @@ -744,7 +690,7 @@ IcePy::initEndpointInfo(PyObject* module) return false; } - SSLEndpointInfoType.tp_base = &IPEndpointInfoType; // Force inheritance from IPEndpointInfoType. + SSLEndpointInfoType.tp_base = &EndpointInfoType; // Force inheritance from IPEndpointInfoType. if(PyType_Ready(&SSLEndpointInfoType) < 0) { return false; @@ -755,17 +701,6 @@ IcePy::initEndpointInfo(PyObject* module) return false; } - WSSEndpointInfoType.tp_base = &SSLEndpointInfoType; // Force inheritance from SSLEndpointInfoType. - if(PyType_Ready(&WSSEndpointInfoType) < 0) - { - return false; - } - type = &WSSEndpointInfoType; // Necessary to prevent GCC's strict-alias warnings. - if(PyModule_AddObject(module, STRCAST("WSSEndpointInfo"), reinterpret_cast<PyObject*>(type)) < 0) - { - return false; - } - OpaqueEndpointInfoType.tp_base = &EndpointInfoType; // Force inheritance from EndpointType. if(PyType_Ready(&OpaqueEndpointInfoType) < 0) { @@ -791,6 +726,12 @@ IcePy::getEndpointInfo(PyObject* obj) PyObject* IcePy::createEndpointInfo(const Ice::EndpointInfoPtr& endpointInfo) { + if(!endpointInfo) + { + Py_INCREF(Py_None); + return Py_None; + } + PyTypeObject* type; if(Ice::WSEndpointInfoPtr::dynamicCast(endpointInfo)) { @@ -804,10 +745,6 @@ IcePy::createEndpointInfo(const Ice::EndpointInfoPtr& endpointInfo) { type = &UDPEndpointInfoType; } - else if(IceSSL::WSSEndpointInfoPtr::dynamicCast(endpointInfo)) - { - type = &WSSEndpointInfoType; - } else if(IceSSL::EndpointInfoPtr::dynamicCast(endpointInfo)) { type = &SSLEndpointInfoType; @@ -822,7 +759,6 @@ IcePy::createEndpointInfo(const Ice::EndpointInfoPtr& endpointInfo) } else { - std::cout << "CREATE" << std::endl; type = &EndpointInfoType; } |