diff options
Diffstat (limited to 'php/src/IcePHP/Endpoint.cpp')
-rw-r--r-- | php/src/IcePHP/Endpoint.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/php/src/IcePHP/Endpoint.cpp b/php/src/IcePHP/Endpoint.cpp index 317dcb6c3d8..4ca32bbf600 100644 --- a/php/src/IcePHP/Endpoint.cpp +++ b/php/src/IcePHP/Endpoint.cpp @@ -9,6 +9,7 @@ #include <Endpoint.h> #include <Util.h> +#include <IceSSL/EndpointInfo.h> using namespace std; using namespace IcePHP; @@ -26,6 +27,8 @@ static zend_class_entry* tcpEndpointInfoClassEntry = 0; static zend_class_entry* udpEndpointInfoClassEntry = 0; static zend_class_entry* wsEndpointInfoClassEntry = 0; static zend_class_entry* opaqueEndpointInfoClassEntry = 0; +static zend_class_entry* sslEndpointInfoClassEntry = 0; +static zend_class_entry* wssEndpointInfoClassEntry = 0; // // Ice::Endpoint support. @@ -362,7 +365,7 @@ IcePHP::endpointInit(TSRMLS_D) #endif ce.create_object = handleEndpointInfoAlloc; wsEndpointInfoClassEntry = zend_register_internal_class_ex(&ce, ipEndpointInfoClassEntry, NULL TSRMLS_CC); - zend_declare_property_string(udpEndpointInfoClassEntry, STRCAST("resource"), sizeof("resource") - 1, + zend_declare_property_string(wsEndpointInfoClassEntry, STRCAST("resource"), sizeof("resource") - 1, STRCAST(""), ZEND_ACC_PUBLIC TSRMLS_CC); // @@ -380,6 +383,30 @@ IcePHP::endpointInit(TSRMLS_D) zend_declare_property_null(opaqueEndpointInfoClassEntry, STRCAST("rawBytes"), sizeof("rawBytes") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); + // + // Define the SSLEndpointInfo class. + // +#ifdef ICEPHP_USE_NAMESPACES + INIT_NS_CLASS_ENTRY(ce, "Ice", "SSLEndpointInfo", NULL); +#else + INIT_CLASS_ENTRY(ce, "Ice_SSLEndpointInfo", NULL); +#endif + ce.create_object = handleEndpointInfoAlloc; + sslEndpointInfoClassEntry = zend_register_internal_class_ex(&ce, ipEndpointInfoClassEntry, NULL TSRMLS_CC); + + // + // Define the WSSEndpointInfo class. + // +#ifdef ICEPHP_USE_NAMESPACES + INIT_NS_CLASS_ENTRY(ce, "Ice", "WSSEndpointInfo", NULL); +#else + INIT_CLASS_ENTRY(ce, "Ice_WSSEndpointInfo", NULL); +#endif + ce.create_object = handleEndpointInfoAlloc; + wssEndpointInfoClassEntry = zend_register_internal_class_ex(&ce, sslEndpointInfoClassEntry, NULL TSRMLS_CC); + zend_declare_property_string(wssEndpointInfoClassEntry, STRCAST("resource"), sizeof("resource") - 1, + STRCAST(""), ZEND_ACC_PUBLIC TSRMLS_CC); + return true; } @@ -471,6 +498,18 @@ IcePHP::createEndpointInfo(zval* zv, const Ice::EndpointInfoPtr& p TSRMLS_DC) zval_ptr_dtor(&rawBytes); // add_property_zval increased the refcount of rawBytes } } + else if(IceSSL::WSSEndpointInfoPtr::dynamicCast(p)) + { + IceSSL::WSSEndpointInfoPtr info = IceSSL::WSSEndpointInfoPtr::dynamicCast(p); + if((status = object_init_ex(zv, wssEndpointInfoClassEntry)) == SUCCESS) + { + add_property_string(zv, STRCAST("resource"), const_cast<char*>(info->resource.c_str()), 1); + } + } + else if(IceSSL::EndpointInfoPtr::dynamicCast(p)) + { + status = object_init_ex(zv, sslEndpointInfoClassEntry); + } else if(Ice::IPEndpointInfoPtr::dynamicCast(p)) { status = object_init_ex(zv, ipEndpointInfoClassEntry); |