summaryrefslogtreecommitdiff
path: root/php/src/ice/communicator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'php/src/ice/communicator.cpp')
-rw-r--r--php/src/ice/communicator.cpp53
1 files changed, 53 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)