diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-01-31 17:21:12 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-01-31 17:21:12 +0100 |
commit | c3f44e70ea6a8c9bd16281f4b7e2bcd8f7bae47f (patch) | |
tree | a02e199af243136b4dc4a83929e8c9a185c9dcd8 /php/src | |
parent | Updated AutoStart description (diff) | |
download | ice-c3f44e70ea6a8c9bd16281f4b7e2bcd8f7bae47f.tar.bz2 ice-c3f44e70ea6a8c9bd16281f4b7e2bcd8f7bae47f.tar.xz ice-c3f44e70ea6a8c9bd16281f4b7e2bcd8f7bae47f.zip |
Added support for ice_fixed, ice_getTimeout, ice_getCompress methods (ICE-7996 & ICE-7976)
Diffstat (limited to 'php/src')
-rw-r--r-- | php/src/php5/Connection.cpp | 6 | ||||
-rw-r--r-- | php/src/php5/Connection.h | 5 | ||||
-rw-r--r-- | php/src/php5/Proxy.cpp | 93 | ||||
-rw-r--r-- | php/src/php7/Connection.cpp | 7 | ||||
-rw-r--r-- | php/src/php7/Connection.h | 5 | ||||
-rw-r--r-- | php/src/php7/Proxy.cpp | 93 |
6 files changed, 207 insertions, 2 deletions
diff --git a/php/src/php5/Connection.cpp b/php/src/php5/Connection.cpp index bdec7d1264b..9718c576cb9 100644 --- a/php/src/php5/Connection.cpp +++ b/php/src/php5/Connection.cpp @@ -21,8 +21,12 @@ ZEND_EXTERN_MODULE_GLOBALS(ice) // // Class entries represent the PHP class implementations we have registered. // -static zend_class_entry* connectionClassEntry = 0; +namespace IcePHP +{ + +zend_class_entry* connectionClassEntry = 0; +} static zend_class_entry* connectionInfoClassEntry = 0; static zend_class_entry* ipConnectionInfoClassEntry = 0; static zend_class_entry* tcpConnectionInfoClassEntry = 0; diff --git a/php/src/php5/Connection.h b/php/src/php5/Connection.h index 191e3b218c7..66d70614c9b 100644 --- a/php/src/php5/Connection.h +++ b/php/src/php5/Connection.h @@ -15,6 +15,11 @@ namespace IcePHP { +// +// Class entry. +// +extern zend_class_entry* connectionClassEntry; + bool connectionInit(TSRMLS_D); bool createConnection(zval*, const Ice::ConnectionPtr& TSRMLS_DC); diff --git a/php/src/php5/Proxy.cpp b/php/src/php5/Proxy.cpp index 5ba77e7e8e1..4758dd3db12 100644 --- a/php/src/php5/Proxy.cpp +++ b/php/src/php5/Proxy.cpp @@ -1167,6 +1167,35 @@ ZEND_METHOD(Ice_ObjectPrx, ice_compress) } } +ZEND_METHOD(Ice_ObjectPrx, ice_getCompress) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + try + { + IceUtil::Optional<bool> compress = _this->proxy->ice_getCompress(); + if(compress) + { + RETURN_BOOL(*compress ? 1 : 0); + } + else + { + assignUnset(return_value TSRMLS_CC); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_timeout) { ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); @@ -1192,6 +1221,35 @@ ZEND_METHOD(Ice_ObjectPrx, ice_timeout) } } +ZEND_METHOD(Ice_ObjectPrx, ice_getTimeout) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + try + { + IceUtil::Optional<int> timeout = _this->proxy->ice_getTimeout(); + if(timeout) + { + ZVAL_LONG(return_value, static_cast<long>(*timeout)); + } + else + { + assignUnset(return_value TSRMLS_CC); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_invocationTimeout) { ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); @@ -1242,6 +1300,38 @@ ZEND_METHOD(Ice_ObjectPrx, ice_connectionId) } } +ZEND_METHOD(Ice_ObjectPrx, ice_fixed) +{ + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + zval* zcon; + if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, const_cast<char*>("O!"), &zcon, connectionClassEntry TSRMLS_CC) != + SUCCESS) + { + RETURN_NULL(); + } + + Ice::ConnectionPtr connection; + if(zcon && !fetchConnection(zcon, connection TSRMLS_CC)) + { + RETURN_NULL(); + } + + try + { + if(!_this->clone(return_value, _this->proxy->ice_fixed(connection) TSRMLS_CC)) + { + RETURN_NULL(); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_getConnection) { if(ZEND_NUM_ARGS() != 0) @@ -1676,9 +1766,12 @@ static zend_function_entry _proxyMethods[] = ZEND_ME(Ice_ObjectPrx, ice_batchDatagram, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_isBatchDatagram, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_compress, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_getCompress, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_timeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_getTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_invocationTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_connectionId, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_fixed, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getConnection, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getCachedConnection, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_flushBatchRequests, ICE_NULLPTR, ZEND_ACC_PUBLIC) diff --git a/php/src/php7/Connection.cpp b/php/src/php7/Connection.cpp index 4c67992750b..458c7c399fb 100644 --- a/php/src/php7/Connection.cpp +++ b/php/src/php7/Connection.cpp @@ -21,7 +21,12 @@ ZEND_EXTERN_MODULE_GLOBALS(ice) // // Class entries represent the PHP class implementations we have registered. // -static zend_class_entry* connectionClassEntry = 0; +namespace IcePHP +{ + +zend_class_entry* connectionClassEntry = 0; + +} static zend_class_entry* connectionInfoClassEntry = 0; static zend_class_entry* ipConnectionInfoClassEntry = 0; diff --git a/php/src/php7/Connection.h b/php/src/php7/Connection.h index adb29df586b..474bc639655 100644 --- a/php/src/php7/Connection.h +++ b/php/src/php7/Connection.h @@ -15,6 +15,11 @@ namespace IcePHP { +// +// Class entry. +// +extern zend_class_entry* connectionClassEntry; + bool connectionInit(void); bool createConnection(zval*, const Ice::ConnectionPtr&); diff --git a/php/src/php7/Proxy.cpp b/php/src/php7/Proxy.cpp index 23b6e4d7806..54772d4afe3 100644 --- a/php/src/php7/Proxy.cpp +++ b/php/src/php7/Proxy.cpp @@ -1154,6 +1154,35 @@ ZEND_METHOD(Ice_ObjectPrx, ice_compress) } } +ZEND_METHOD(Ice_ObjectPrx, ice_getCompress) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + try + { + IceUtil::Optional<bool> compress = _this->proxy->ice_getCompress(); + if(compress) + { + RETURN_BOOL(*compress ? 1 : 0); + } + else + { + assignUnset(return_value TSRMLS_CC); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_timeout) { ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis()); @@ -1179,6 +1208,35 @@ ZEND_METHOD(Ice_ObjectPrx, ice_timeout) } } +ZEND_METHOD(Ice_ObjectPrx, ice_getTimeout) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + try + { + IceUtil::Optional<int> timeout = _this->proxy->ice_getTimeout(); + if(timeout) + { + ZVAL_LONG(return_value, static_cast<long>(*timeout)); + } + else + { + assignUnset(return_value TSRMLS_CC); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_invocationTimeout ) { ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis()); @@ -1229,6 +1287,38 @@ ZEND_METHOD(Ice_ObjectPrx, ice_connectionId) } } +ZEND_METHOD(Ice_ObjectPrx, ice_fixed) +{ + ProxyPtr _this = Wrapper<ProxyPtr>::value(getThis() TSRMLS_CC); + assert(_this); + + zval* zcon; + if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, const_cast<char*>("O!"), &zcon, connectionClassEntry TSRMLS_CC) != + SUCCESS) + { + RETURN_NULL(); + } + + Ice::ConnectionPtr connection; + if(zcon && !fetchConnection(zcon, connection TSRMLS_CC)) + { + RETURN_NULL(); + } + + try + { + if(!_this->clone(return_value, _this->proxy->ice_fixed(connection) TSRMLS_CC)) + { + RETURN_NULL(); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_ObjectPrx, ice_getConnection) { if(ZEND_NUM_ARGS() != 0) @@ -1629,9 +1719,12 @@ static zend_function_entry _proxyMethods[] = ZEND_ME(Ice_ObjectPrx, ice_batchDatagram, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_isBatchDatagram, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_compress, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_getCompress, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_timeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_getTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_invocationTimeout, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_connectionId, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_ObjectPrx, ice_fixed, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getConnection, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_getCachedConnection, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_ObjectPrx, ice_flushBatchRequests, ICE_NULLPTR, ZEND_ACC_PUBLIC) |