summaryrefslogtreecommitdiff
path: root/php/src
diff options
context:
space:
mode:
Diffstat (limited to 'php/src')
-rw-r--r--php/src/ice/communicator.cpp53
-rw-r--r--php/src/ice/ice_communicator.h4
2 files changed, 57 insertions, 0 deletions
diff --git a/php/src/ice/communicator.cpp b/php/src/ice/communicator.cpp
index b5cdd3c80d0..5331cc0e085 100644
--- a/php/src/ice/communicator.cpp
+++ b/php/src/ice/communicator.cpp
@@ -55,6 +55,8 @@ static function_entry _methods[] =
{"getProperty", PHP_FN(Ice_Communicator_getProperty), NULL},
{"stringToProxy", PHP_FN(Ice_Communicator_stringToProxy), NULL},
{"proxyToString", PHP_FN(Ice_Communicator_proxyToString), NULL},
+ {"stringToIdentity", PHP_FN(Ice_Communicator_stringToIdentity), NULL},
+ {"identityToString", PHP_FN(Ice_Communicator_identityToString), NULL},
{"addObjectFactory", PHP_FN(Ice_Communicator_addObjectFactory), NULL},
{"removeObjectFactory", PHP_FN(Ice_Communicator_removeObjectFactory), NULL},
{"findObjectFactory", PHP_FN(Ice_Communicator_findObjectFactory), NULL},
@@ -280,6 +282,57 @@ ZEND_FUNCTION(Ice_Communicator_proxyToString)
}
}
+ZEND_FUNCTION(Ice_Communicator_identityToString)
+{
+ if(ZEND_NUM_ARGS() != 1)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ zend_class_entry* cls = findClass("Ice_Identity" TSRMLS_CC);
+ assert(cls);
+
+ zval *zid;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zid, cls) == FAILURE)
+ {
+ RETURN_NULL();
+ }
+
+ Ice::Identity id;
+ if(extractIdentity(zid, id TSRMLS_CC))
+ {
+ string s = (*_this)->identityToString(id);
+ RETURN_STRINGL(const_cast<char*>(s.c_str()), s.length(), 1);
+ }
+}
+
+ZEND_FUNCTION(Ice_Communicator_stringToIdentity)
+{
+ if(ZEND_NUM_ARGS() != 1)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ char* str;
+ int len;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len) == FAILURE)
+ {
+ RETURN_NULL();
+ }
+
+ try
+ {
+ Ice::Identity id = (*_this)->stringToIdentity(str);
+ createIdentity(return_value, id TSRMLS_CC);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ throwException(ex TSRMLS_CC);
+ }
+}
+
ZEND_FUNCTION(Ice_Communicator_addObjectFactory)
{
if(ZEND_NUM_ARGS() != 2)
diff --git a/php/src/ice/ice_communicator.h b/php/src/ice/ice_communicator.h
index a8f829a472e..9e173628a9d 100644
--- a/php/src/ice/ice_communicator.h
+++ b/php/src/ice/ice_communicator.h
@@ -21,6 +21,8 @@ ZEND_FUNCTION(Ice_Communicator___construct);
ZEND_FUNCTION(Ice_Communicator_getProperty);
ZEND_FUNCTION(Ice_Communicator_stringToProxy);
ZEND_FUNCTION(Ice_Communicator_proxyToString);
+ZEND_FUNCTION(Ice_Communicator_stringToIdentity);
+ZEND_FUNCTION(Ice_Communicator_identityToString);
ZEND_FUNCTION(Ice_Communicator_addObjectFactory);
ZEND_FUNCTION(Ice_Communicator_removeObjectFactory);
ZEND_FUNCTION(Ice_Communicator_findObjectFactory);
@@ -33,6 +35,8 @@ ZEND_FUNCTION(Ice_Communicator_flushBatchRequests);
ZEND_FE(Ice_Communicator_getProperty, NULL) \
ZEND_FE(Ice_Communicator_stringToProxy, NULL) \
ZEND_FE(Ice_Communicator_proxyToString, NULL) \
+ ZEND_FE(Ice_Communicator_stringToIdentity, NULL) \
+ ZEND_FE(Ice_Communicator_identityToString, NULL) \
ZEND_FE(Ice_Communicator_addObjectFactory, NULL) \
ZEND_FE(Ice_Communicator_removeObjectFactory, NULL) \
ZEND_FE(Ice_Communicator_findObjectFactory, NULL) \