From 61270a10f980933cf582edb766f10c8ac6d86e8a Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Mon, 30 Jan 2017 13:45:21 -0800 Subject: merging IceBridge into master --- php/src/php7/Connection.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'php/src/php7/Connection.cpp') diff --git a/php/src/php7/Connection.cpp b/php/src/php7/Connection.cpp index 2d598fc7da9..57c0b197767 100644 --- a/php/src/php7/Connection.cpp +++ b/php/src/php7/Connection.cpp @@ -78,15 +78,22 @@ ZEND_METHOD(Ice_Connection, close) Ice::ConnectionPtr _this = Wrapper::value(getThis()); assert(_this); - zend_bool b; - if(zend_parse_parameters(ZEND_NUM_ARGS(), const_cast("b"), &b) != SUCCESS) + zval* mode; + if(zend_parse_parameters(ZEND_NUM_ARGS(), const_cast("z"), &mode) != SUCCESS) { RETURN_NULL(); } + if(Z_TYPE_P(mode) != IS_LONG) + { + invalidArgument("value for 'mode' argument must be an enumerator of ConnectionClose"); + RETURN_NULL(); + } + Ice::ConnectionClose cc = static_cast(Z_LVAL_P(mode)); + try { - _this->close(b ? true : false); + _this->close(cc); } catch(const IceUtil::Exception& ex) { @@ -140,6 +147,27 @@ ZEND_METHOD(Ice_Connection, flushBatchRequests) } } +ZEND_METHOD(Ice_Connection, heartbeat) +{ + if(ZEND_NUM_ARGS() > 0) + { + WRONG_PARAM_COUNT; + } + + Ice::ConnectionPtr _this = Wrapper::value(getThis()); + assert(_this); + + try + { + _this->heartbeat(); + } + catch(const IceUtil::Exception& ex) + { + throwException(ex); + RETURN_NULL(); + } +} + ZEND_METHOD(Ice_Connection, setACM) { Ice::ConnectionPtr _this = Wrapper::value(getThis()); @@ -331,6 +359,27 @@ ZEND_METHOD(Ice_Connection, setBufferSize) } } +ZEND_METHOD(Ice_Connection, throwException) +{ + if(ZEND_NUM_ARGS() > 0) + { + WRONG_PARAM_COUNT; + } + + Ice::ConnectionPtr _this = Wrapper::value(getThis()); + assert(_this); + + try + { + _this->throwException(); + } + catch(const IceUtil::Exception& ex) + { + throwException(ex); + RETURN_NULL(); + } +} + #ifdef _WIN32 extern "C" #endif @@ -406,6 +455,7 @@ static zend_function_entry _connectionClassMethods[] = ZEND_ME(Ice_Connection, close, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, getEndpoint, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, flushBatchRequests, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_Connection, heartbeat, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, setACM, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, getACM, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, type, ICE_NULLPTR, ZEND_ACC_PUBLIC) @@ -413,6 +463,7 @@ static zend_function_entry _connectionClassMethods[] = ZEND_ME(Ice_Connection, toString, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, getInfo, ICE_NULLPTR, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, setBufferSize, ICE_NULLPTR, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_Connection, throwException, ICE_NULLPTR, ZEND_ACC_PUBLIC) {0, 0, 0} }; -- cgit v1.2.3