summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/rpc/com/com.c48
-rw-r--r--ext/rpc/com/com.h4
-rw-r--r--ext/rpc/com/php_com.h (renamed from ext/rpc/layer.h)14
-rw-r--r--ext/rpc/handler.h31
-rw-r--r--ext/rpc/php_rpc.h14
-rw-r--r--ext/rpc/rpc.c152
-rw-r--r--ext/rpc/rpc.h6
-rw-r--r--ext/rpc/skeleton/skeleton.c2
-rw-r--r--ext/rpc/skeleton/skeleton.h4
9 files changed, 124 insertions, 151 deletions
diff --git a/ext/rpc/com/com.c b/ext/rpc/com/com.c
index c069da076b..ae678909c2 100644
--- a/ext/rpc/com/com.c
+++ b/ext/rpc/com/com.c
@@ -50,7 +50,7 @@ static IBindCtx *pBindCtx;
static unsigned char arg1and2_force_ref[] = { 2, BYREF_FORCE, BYREF_FORCE };
/* register rpc callback function */
-RPC_REGISTER_HANDLERS_START(com)
+RPC_REGISTER_HANDLERS_BEGIN(com)
TRUE, /* poolable */
HASH_AS_INT_WITH_SIGNATURE,
com_hash,
@@ -68,16 +68,16 @@ com_get_properties
RPC_REGISTER_HANDLERS_END()
/* register ini settings */
-RPC_INI_START(com)
+PHP_INI_BEGIN()
PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, com_typelib_file_change)
-RPC_INI_END()
+PHP_INI_END()
/* register userspace functions */
-RPC_FUNCTION_ENTRY_START(com)
+RPC_FUNCTION_ENTRY_BEGIN(com)
ZEND_FALIAS(com_invoke, rpc_call, NULL)
ZEND_FE(com_addref, NULL)
ZEND_FE(com_release, NULL)
@@ -90,8 +90,21 @@ RPC_FUNCTION_ENTRY_START(com)
ZEND_FE(com_print_typeinfo, NULL)
RPC_FUNCTION_ENTRY_END()
+zend_module_entry com_module_entry = {
+ ZE2_STANDARD_MODULE_HEADER,
+ "com",
+ RPC_FUNCTION_ENTRY(com),
+ ZEND_MINIT(com),
+ ZEND_MSHUTDOWN(com),
+ NULL,
+ NULL,
+ ZEND_MINFO(com),
+ "0.1a",
+ STANDARD_MODULE_PROPERTIES
+};
+
/* register class methods */
-RPC_METHOD_ENTRY_START(com)
+RPC_METHOD_ENTRY_BEGIN(com)
ZEND_FALIAS(addref, com_addref, NULL)
ZEND_FALIAS(release, com_release, NULL)
ZEND_FALIAS(next, com_next, NULL)
@@ -101,21 +114,36 @@ RPC_METHOD_ENTRY_START(com)
RPC_METHOD_ENTRY_END()
-/* init function that is called before the class is registered
- * so you can do any tricky stuff in here
- */
-RPC_INIT_FUNCTION(com)
+ZEND_MINIT_FUNCTION(com)
{
CreateBindCtx(0, &pBindCtx);
php_variant_init(module_number TSRMLS_CC);
+
+ RPC_REGISTER_LAYER(com);
+ REGISTER_INI_ENTRIES();
+
+ return SUCCESS;
}
-RPC_SHUTDOWN_FUNCTION(com)
+ZEND_MSHUTDOWN_FUNCTION(com)
{
php_variant_shutdown(TSRMLS_C);
pBindCtx->lpVtbl->Release(pBindCtx);
+
+ UNREGISTER_INI_ENTRIES();
+
+ return SUCCESS;
+}
+
+ZEND_MINFO_FUNCTION(com)
+{
+ DISPLAY_INI_ENTRIES();
}
+#ifdef COMPILE_DL_COM
+ZEND_GET_MODULE(com);
+#endif
+
/* rpc handler functions */
static int com_hash(rpc_string name, rpc_string *hash, void *data, int num_args, char *arg_types, int type)
diff --git a/ext/rpc/com/com.h b/ext/rpc/com/com.h
index ccf5bf6c7c..8cb15ad83d 100644
--- a/ext/rpc/com/com.h
+++ b/ext/rpc/com/com.h
@@ -24,6 +24,10 @@
RPC_DECLARE_HANDLER(com);
+ZEND_MINIT_FUNCTION(com);
+ZEND_MSHUTDOWN_FUNCTION(com);
+ZEND_MINFO_FUNCTION(com);
+
ZEND_FUNCTION(com_addref);
ZEND_FUNCTION(com_release);
ZEND_FUNCTION(com_isenum);
diff --git a/ext/rpc/layer.h b/ext/rpc/com/php_com.h
index fe860e792b..6a3fb61d7b 100644
--- a/ext/rpc/layer.h
+++ b/ext/rpc/com/php_com.h
@@ -16,14 +16,10 @@
+----------------------------------------------------------------------+
*/
-#ifndef LAYER_H
-#define LAYER_H
+#ifndef PHP_COM_H
+#define PHP_COM_H
-#include "handler.h"
-#include "com/com.h"
+extern zend_module_entry com_module_entry;
+#define phpext_com_ptr &com_module_entry
-rpc_handler_entry handler_entries[] = {
- RPC_HANDLER(com)
-};
-
-#endif /* LAYER_H */ \ No newline at end of file
+#endif /* PHP_COM_H */ \ No newline at end of file
diff --git a/ext/rpc/handler.h b/ext/rpc/handler.h
index d4d746536f..ef39c0eac0 100644
--- a/ext/rpc/handler.h
+++ b/ext/rpc/handler.h
@@ -22,31 +22,22 @@
#include "php.h"
#include "php_ini.h"
-#define RPC_HANDLER(layer) {#layer, layer##_handler_init, layer##_handler_shutdown, \
- &layer##_object_handlers, &layer##_class_entry, \
- layer##_function_entry, layer##_method_entry, \
- layer##_ini_entry}
-
-#define RPC_DECLARE_HANDLER(layer) void layer##_handler_init(int module_number TSRMLS_DC); \
- void layer##_handler_shutdown(TSRMLS_D); \
- rpc_object_handlers layer##_object_handlers; \
+#define RPC_REGISTER_LAYER(layer) rpc_register_layer(&layer##_handler_entry TSRMLS_CC);
+#define RPC_DECLARE_HANDLER(layer) rpc_object_handlers layer##_object_handlers; \
zend_class_entry *layer##_class_entry; \
function_entry layer##_function_entry[]; \
function_entry layer##_method_entry[]; \
- zend_ini_entry layer##_ini_entry[];
+ static rpc_handler_entry layer##_handler_entry = \
+ {#layer, &layer##_object_handlers, &layer##_class_entry,\
+ layer##_function_entry, layer##_method_entry}
-#define RPC_INIT_FUNCTION(layer) void layer##_handler_init(int module_number TSRMLS_DC)
-#define RPC_SHUTDOWN_FUNCTION(layer) void layer##_handler_shutdown(TSRMLS_D)
-
-#define RPC_REGISTER_HANDLERS_START(layer) zend_class_entry *layer##_class_entry; \
+#define RPC_REGISTER_HANDLERS_BEGIN(layer) zend_class_entry *layer##_class_entry; \
rpc_object_handlers layer##_object_handlers = {
#define RPC_REGISTER_HANDLERS_END() };
-#define RPC_INI_START(layer) zend_ini_entry layer##_ini_entry[] = {
-#define RPC_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
-
-#define RPC_FUNCTION_ENTRY_START(layer) function_entry layer##_function_entry[] = { \
+#define RPC_FUNCTION_ENTRY(layer) layer##_function_entry
+#define RPC_FUNCTION_ENTRY_BEGIN(layer) function_entry layer##_function_entry[] = { \
ZEND_FALIAS(layer##_load, rpc_load, NULL) \
ZEND_FALIAS(layer##_call, rpc_call, NULL) \
ZEND_FALIAS(layer##_get, rpc_get, NULL) \
@@ -57,7 +48,7 @@
#define RPC_FUNCTION_ENTRY_END() {NULL, NULL, NULL} \
};
-#define RPC_METHOD_ENTRY_START(layer) function_entry layer##_method_entry[] = {
+#define RPC_METHOD_ENTRY_BEGIN(layer) function_entry layer##_method_entry[] = {
#define RPC_METHOD_ENTRY_END() {NULL, NULL, NULL} \
};
@@ -103,13 +94,10 @@ typedef struct _rpc_object_handlers {
/* handler entry */
typedef struct _rpc_handler_entry {
char *name;
- void (*rpc_handler_init)();
- void (*rpc_handler_shutdown)();
rpc_object_handlers *handlers;
zend_class_entry **ce;
function_entry *functions;
function_entry *methods;
- zend_ini_entry *ini;
} rpc_handler_entry;
/* class/method/function hash */
@@ -139,5 +127,6 @@ typedef struct _rpc_proxy {
zend_uint dummy;
} rpc_proxy;
+ZEND_API rpc_register_layer(rpc_handler_entry *entry TSRMLS_DC);
#endif /* HANDLER_H */ \ No newline at end of file
diff --git a/ext/rpc/php_rpc.h b/ext/rpc/php_rpc.h
index 4373647a13..1e36ece531 100644
--- a/ext/rpc/php_rpc.h
+++ b/ext/rpc/php_rpc.h
@@ -34,16 +34,14 @@ ZEND_RINIT_FUNCTION(rpc);
ZEND_RSHUTDOWN_FUNCTION(rpc);
ZEND_MINFO_FUNCTION(rpc);
-ZEND_FUNCTION(rpc_load);
-ZEND_FUNCTION(rpc_call);
-ZEND_FUNCTION(rpc_set);
-ZEND_FUNCTION(rpc_get);
-ZEND_FUNCTION(rpc_singleton);
-ZEND_FUNCTION(rpc_poolable);
+ZEND_API ZEND_FUNCTION(rpc_load);
+ZEND_API ZEND_FUNCTION(rpc_call);
+ZEND_API ZEND_FUNCTION(rpc_set);
+ZEND_API ZEND_FUNCTION(rpc_get);
+ZEND_API ZEND_FUNCTION(rpc_singleton);
+ZEND_API ZEND_FUNCTION(rpc_poolable);
ZEND_API void rpc_error(int type, const char *format, ...);
ZEND_API zend_object_value rpc_objects_new(zend_class_entry * TSRMLS_DC);
-#define phpext_rpc_ptr &rpc_module_entry
-
#endif /* PHP_RPC_H */ \ No newline at end of file
diff --git a/ext/rpc/rpc.c b/ext/rpc/rpc.c
index d8629e20aa..ef52d95457 100644
--- a/ext/rpc/rpc.c
+++ b/ext/rpc/rpc.c
@@ -26,14 +26,15 @@
#include "php_rpc.h"
#include "rpc.h"
-#include "layer.h"
#include "hash.h"
+#include "handler.h"
static void rpc_instance_dtor(void *);
static void rpc_class_dtor(void *);
static void rpc_string_dtor(void *);
static void rpc_objects_delete(void *, zend_object_handle TSRMLS_DC);
+static void rpc_ini_cb(void *arg TSRMLS_DC);
/* object handler */
static zval* rpc_read(zval *, zval *, int TSRMLS_DC);
@@ -102,79 +103,33 @@ zend_module_entry rpc_module_entry = {
zend_class_entry rpc_class_entry;
+static zend_class_entry *rpc_entry;
static zend_function *rpc_ctor;
-static HashTable *handlers;
-static TsHashTable *pool;
-static TsHashTable *classes;
-static zend_llist *classes_list;
+static HashTable handlers;
+static TsHashTable pool;
+static TsHashTable classes;
+static zend_llist classes_list;
+static zend_llist layers;
#ifdef COMPILE_DL_RPC
ZEND_GET_MODULE(rpc);
#endif
-ZEND_INI_BEGIN()
-ZEND_INI_END()
-
/* {{{ ZEND_MINIT_FUNCTION
*/
ZEND_MINIT_FUNCTION(rpc)
{
zend_internal_function *zif;
- zend_class_entry *rpc_entry;
/* rpc base class entry */
INIT_CLASS_ENTRY(rpc_class_entry, "rpc", NULL);
rpc_entry = zend_register_internal_class(&rpc_class_entry TSRMLS_CC);
- handlers = (HashTable *) pemalloc(sizeof(HashTable), TRUE);
- pool = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE);
- classes = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE);
- classes_list = (zend_llist *) pemalloc(sizeof(zend_llist), TRUE);
-
- zend_hash_init(handlers, 0, NULL, NULL, TRUE);
- zend_ts_hash_init(pool, sizeof(rpc_internal **), NULL, rpc_instance_dtor, TRUE);
- zend_ts_hash_init(classes, 0, NULL, NULL, TRUE);
- zend_llist_init(classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, TRUE);
-
- FOREACH_HANDLER {
- /*
- handle = DL_LOAD(path);
- if (!handle) {
-#ifndef ZEND_WIN32
- fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
-#else
- fprintf(stderr, "Failed loading %s\n", path);
-#endif
- return FAILURE;
- }
-
- extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
- new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
- if (!extension_version_info || !new_extension) {
- fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
- return FAILURE;
- }
-*/
- zend_class_entry ce;
-
- HANDLER.rpc_handler_init(module_number TSRMLS_CC);
-
- /* create a class entry for every rpc handler */
- INIT_CLASS_ENTRY(ce,
- HANDLER.name,
- HANDLER.methods);
-
- ce.create_object = rpc_objects_new;
-
- /* load all available rpc handler into a hash */
- zend_hash_add(handlers, HANDLER.name, strlen(HANDLER.name) + 1, &(HANDLER.handlers), sizeof(rpc_object_handlers *), NULL);
-
- /* register classes and functions */
- *HANDLER.ce = zend_register_internal_class_ex(&ce, rpc_entry, NULL TSRMLS_CC);
- zend_register_functions(NULL, HANDLER.functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
- zend_register_ini_entries(HANDLER.ini, module_number TSRMLS_CC);
- }
-
+ zend_hash_init(&handlers, 0, NULL, NULL, TRUE);
+ zend_ts_hash_init(&pool, sizeof(rpc_internal **), NULL, rpc_instance_dtor, TRUE);
+ zend_ts_hash_init(&classes, 0, NULL, NULL, TRUE);
+ zend_llist_init(&classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, TRUE);
+ zend_llist_init(&layers, sizeof(char *), NULL, TRUE);
zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
@@ -188,8 +143,6 @@ ZEND_MINIT_FUNCTION(rpc)
zend_hash_add(&(rpc_entry->function_table), rpc_entry->name, rpc_entry->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
efree(zif);
- REGISTER_INI_ENTRIES();
-
return SUCCESS;
}
/* }}} */
@@ -198,21 +151,14 @@ ZEND_MINIT_FUNCTION(rpc)
*/
ZEND_MSHUTDOWN_FUNCTION(rpc)
{
- FOREACH_HANDLER {
- HANDLER.rpc_handler_shutdown(TSRMLS_C);
- }
-
/* destroy instances first */
- zend_ts_hash_destroy(pool);
+ zend_ts_hash_destroy(&pool);
- zend_ts_hash_destroy(classes);
- zend_llist_destroy(classes_list);
- zend_hash_destroy(handlers);
+ zend_ts_hash_destroy(&classes);
+ zend_llist_destroy(&classes_list);
+ zend_llist_destroy(&layers);
+ zend_hash_destroy(&handlers);
- pefree(handlers, TRUE);
- pefree(classes, TRUE);
-
- UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
@@ -222,12 +168,28 @@ ZEND_MSHUTDOWN_FUNCTION(rpc)
ZEND_MINFO_FUNCTION(rpc)
{
php_info_print_table_start();
- php_info_print_table_header(2, "rpc support", "enabled");
+ zend_llist_apply(&layers, rpc_ini_cb TSRMLS_CC);
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
/* }}} */
+
+ZEND_API rpc_register_layer(rpc_handler_entry *entry TSRMLS_DC)
+{
+ zend_class_entry ce;
+
+ INIT_CLASS_ENTRY(ce, entry->name, entry->methods);
+
+ ce.create_object = rpc_objects_new;
+
+ /* load all available rpc handler into a hash */
+ zend_hash_add(&handlers, entry->name, strlen(entry->name) + 1, &(entry->handlers), sizeof(rpc_object_handlers *), NULL);
+ zend_llist_add_element(&layers, &(entry->name));
+
+ /* register classes */
+ *(entry->ce) = zend_register_internal_class_ex(&ce, rpc_entry, NULL TSRMLS_CC);
+}
static void rpc_class_dtor(void *pDest)
{
@@ -267,6 +229,12 @@ static void rpc_instance_dtor(void *pDest)
pefree(*intern, TRUE);
}
+static void rpc_ini_cb(void *arg TSRMLS_DC)
+{
+ char *name = *((char **) arg);
+ php_info_print_table_header(2, name, "loaded");
+}
+
static zend_object_value rpc_create_proxy(TSRMLS_D)
{
zend_object_value *zov;
@@ -302,9 +270,9 @@ static void rpc_objects_delete(void *object, zend_object_handle handle TSRMLS_DC
pefree(intern, TRUE);
} else if (RPC_CLASS(intern) && RPC_CLASS(intern)->poolable) {
if (RPC_CLASS(intern)->name.str) {
- zend_ts_hash_add(pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
+ zend_ts_hash_add(&pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
} else {
- zend_ts_hash_index_update(pool, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
+ zend_ts_hash_index_update(&pool, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
}
} else {
if (intern->data != NULL) {
@@ -450,7 +418,7 @@ static int rpc_compare(zval *object1, zval *object2 TSRMLS_DC)
/**/
/* constructor */
-ZEND_FUNCTION(rpc_load)
+ZEND_API ZEND_FUNCTION(rpc_load)
{
zval *object = getThis();
zval ***args, ***args_free;
@@ -511,7 +479,7 @@ ZEND_FUNCTION(rpc_load)
GET_SIGNATURE(intern, class_val.str, class_val.len, hash_val, num_args, arg_types);
/* check if already hashed */
- if (zend_ts_hash_find(classes, hash_val.str, hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) {
+ if (zend_ts_hash_find(&classes, hash_val.str, hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) {
class_hash = pemalloc(sizeof(rpc_class_hash), TRUE);
/* set up the cache */
@@ -541,17 +509,17 @@ ZEND_FUNCTION(rpc_load)
* also track all instaces in a llist for destruction later on, because there might be duplicate entries in
* the hashtable and we can't determine if a pointer references to an already freed element
*/
- zend_ts_hash_add(classes, hash_val.str, hash_val.len + 1, &class_hash, sizeof(rpc_class_hash *), (void **) &class_hash_find);
- tsrm_mutex_lock(classes->mx_writer);
- zend_llist_add_element(classes_list, class_hash_find);
- tsrm_mutex_unlock(classes->mx_writer);
+ zend_ts_hash_add(&classes, hash_val.str, hash_val.len + 1, &class_hash, sizeof(rpc_class_hash *), (void **) &class_hash_find);
+ tsrm_mutex_lock(classes.mx_writer);
+ zend_llist_add_element(&classes_list, class_hash_find);
+ tsrm_mutex_unlock(classes.mx_writer);
if (class_hash->name.str) {
/* register string hashcode */
- zend_ts_hash_add(classes, class_hash->name.str, class_hash->name.len + 1, &class_hash, sizeof(rpc_class_hash *), NULL);
+ zend_ts_hash_add(&classes, class_hash->name.str, class_hash->name.len + 1, &class_hash, sizeof(rpc_class_hash *), NULL);
} else if (!class_hash->name.str && (RPC_HT(intern)->hash_type & HASH_AS_INT)) {
/* register int hashcode */
- zend_ts_hash_index_update(classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL);
+ zend_ts_hash_index_update(&classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL);
}
} else {
class_hash = *class_hash_find;
@@ -567,7 +535,7 @@ ZEND_FUNCTION(rpc_load)
}
} else {
/* integer classname (hashcode) */
- if (zend_ts_hash_index_find(classes, class_val.len, (void**) &class_hash_find) != SUCCESS) {
+ if (zend_ts_hash_index_find(&classes, class_val.len, (void**) &class_hash_find) != SUCCESS) {
class_hash = pemalloc(sizeof(rpc_class_hash), TRUE);
/* set up the cache */
@@ -588,7 +556,7 @@ ZEND_FUNCTION(rpc_load)
intern->ce = class_hash->ce;
/* register int hashcode, we don't know more */
- zend_ts_hash_index_update(classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL);
+ zend_ts_hash_index_update(&classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL);
} else {
class_hash = *class_hash_find;
intern->ce = class_hash->ce;
@@ -602,7 +570,7 @@ ZEND_FUNCTION(rpc_load)
/* assign cache structure */
RPC_CLASS(intern) = class_hash;
- if (zend_ts_hash_remove_key_or_index(pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, (void **) &pool_intern) == SUCCESS) {
+ if (zend_ts_hash_remove_key_or_index(&pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, (void **) &pool_intern) == SUCCESS) {
intern->data = pool_intern->data;
pefree(pool_intern, TRUE);
@@ -631,7 +599,7 @@ ZEND_FUNCTION(rpc_load)
}
}
-ZEND_FUNCTION(rpc_call)
+ZEND_API ZEND_FUNCTION(rpc_call)
{
zval *object = getThis();
zval ***args, ***args_free;
@@ -714,7 +682,7 @@ ZEND_FUNCTION(rpc_call)
}
}
-ZEND_FUNCTION(rpc_set)
+ZEND_API ZEND_FUNCTION(rpc_set)
{
zval *object, *value;
char *property = NULL;
@@ -739,7 +707,7 @@ ZEND_FUNCTION(rpc_set)
}
}
-ZEND_FUNCTION(rpc_get)
+ZEND_API ZEND_FUNCTION(rpc_get)
{
zval *object;
char *property = NULL;
@@ -764,7 +732,7 @@ ZEND_FUNCTION(rpc_get)
}
}
-ZEND_FUNCTION(rpc_singleton)
+ZEND_API ZEND_FUNCTION(rpc_singleton)
{
zval *object;
rpc_internal *intern;
@@ -783,7 +751,7 @@ ZEND_FUNCTION(rpc_singleton)
}
}
-ZEND_FUNCTION(rpc_poolable)
+ZEND_API ZEND_FUNCTION(rpc_poolable)
{
zval *object;
rpc_internal *intern;
@@ -830,7 +798,7 @@ ZEND_API zend_object_value rpc_objects_new(zend_class_entry *class_type TSRMLS_D
intern->function_table.mx_writer = tsrm_mutex_alloc();
intern->mx_handler = tsrm_mutex_alloc();
- if (zend_hash_find(handlers, class_type->name, class_type->name_length + 1, (void **) &(intern->handlers)) != SUCCESS) {
+ if (zend_hash_find(&handlers, class_type->name, class_type->name_length + 1, (void **) &(intern->handlers)) != SUCCESS) {
/* TODO: exception */
}
diff --git a/ext/rpc/rpc.h b/ext/rpc/rpc.h
index 1e77567493..7cbb73564f 100644
--- a/ext/rpc/rpc.h
+++ b/ext/rpc/rpc.h
@@ -19,10 +19,6 @@
#ifndef RPC_H
#define RPC_H
-#define FOREACH_HANDLER for (__handler_counter=0; __handler_counter < HANDLER_COUNT; __handler_counter++)
-#define HANDLER handler_entries[__handler_counter]
-#define HANDLER_COUNT (sizeof(handler_entries) / sizeof(rpc_handler_entry))
-
#define RPC_HT(intern) (*((intern)->handlers))
#define RPC_CLASS(intern) ((intern)->hash)
@@ -127,6 +123,4 @@
efree(arg_types); \
efree(hash_val.str);
-static int __handler_counter;
-
#endif \ No newline at end of file
diff --git a/ext/rpc/skeleton/skeleton.c b/ext/rpc/skeleton/skeleton.c
index b9a2d4d775..5f1440ab86 100644
--- a/ext/rpc/skeleton/skeleton.c
+++ b/ext/rpc/skeleton/skeleton.c
@@ -36,7 +36,7 @@ static int skeleton_unset_property(rpc_string, void **);
static int skeleton_get_properties(HashTable **, void **);
/* register rpc callback function */
-RPC_REGISTER_HANDLERS_START(skeleton)
+RPC_REGISTER_HANDLERS_BEGIN(skeleton)
FALSE, /* poolable TRUE|FALSE*/
DONT_HASH, /* hash function name lookups to avoid reflection of the object for each
* method call. hashing is done either by mapping only the function name
diff --git a/ext/rpc/skeleton/skeleton.h b/ext/rpc/skeleton/skeleton.h
index bb88225701..25745b3b08 100644
--- a/ext/rpc/skeleton/skeleton.h
+++ b/ext/rpc/skeleton/skeleton.h
@@ -16,10 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* TODO: include this file in ext/rpc/layer.h and add your handlers to
- * the handler_entries[] array.
- */
-
#ifndef SKELETON_H
#define SKELETON_H