]> granicus.if.org Git - php/commitdiff
changes related to the latest commit of the zend engine
authorHarald Radi <phanto@php.net>
Mon, 22 Apr 2002 14:25:46 +0000 (14:25 +0000)
committerHarald Radi <phanto@php.net>
Mon, 22 Apr 2002 14:25:46 +0000 (14:25 +0000)
ext/rpc/com/com.c
ext/rpc/handler.h
ext/rpc/rpc.c
ext/rpc/rpc.h
ext/rpc/rpc_proxy.c [new file with mode: 0644]
ext/rpc/rpc_proxy.h [new file with mode: 0644]

index 522be7dcd101cbba07b8399130cd2ca4ec58a3fb..11f4d4930b49863b056bb19917beff0c1d65cfeb 100644 (file)
@@ -6,7 +6,7 @@ static int com_ctor(char *, zend_uint, void **, int , zval ***);
 static int com_dtor(void **);
 static int com_call(char *, zend_uint, void **, zval **, int, zval ***);
 static int com_get(char *, zend_uint, zval *, void **);
-static int com_set(char *, zend_uint, zval *, zval *, void **);
+static int com_set(char *, zend_uint, zval *, void **);
 static int com_compare(void **, void **);
 static int com_get_classname(char **, zend_uint *, void **);
 static int com_has_property(char *, zend_uint, void **);
@@ -79,7 +79,7 @@ static int com_get(char *property_name, zend_uint property_name_len, zval *retur
        return SUCCESS;
 }
 
-static int com_set(char *property_name, zend_uint property_name_len, zval *value, zval *return_value, void **data)
+static int com_set(char *property_name, zend_uint property_name_len, zval *value, void **data)
 {
        return SUCCESS;
 }
index 3b108d57548c7a4c1101c071d5b91e160c6f44b3..04ec2c2f09eb1b59530aa7ee6fe2a59fb10492ae 100644 (file)
@@ -61,7 +61,7 @@ typedef struct _rpc_object_handlers {
        int (*rpc_dtor)(void **data);
        int (*rpc_call)(char *method_name, zend_uint method_name_len, void **data, zval **return_value, int num_args, zval **args[]);
        int (*rpc_get)(char *property_name, zend_uint property_name_len, zval *return_value, void **data);
-       int (*rpc_set)(char *property_name, zend_uint property_name_len, zval *value, zval *return_value, void **data);
+       int (*rpc_set)(char *property_name, zend_uint property_name_len, zval *value, void **data);
        int (*rpc_compare)(void **data1, void **data2);
        int (*rpc_get_classname)(char **class_name, zend_uint *class_name_length, void **data);
        int (*rpc_has_property)(char *property_name, zend_uint property_name_length, void **data);
@@ -71,12 +71,12 @@ typedef struct _rpc_object_handlers {
 
 /* handler entry */
 typedef struct _rpc_handler_entry {
-       char                            *name;
+       char                                            *name;
        void (*rpc_handler_init)();
        rpc_object_handlers     *handlers;
-       zend_class_entry        *ce;
-       function_entry          *functions;
-       function_entry          *methods;
+       zend_class_entry                *ce;
+       function_entry                  *functions;
+       function_entry                  *methods;
 } rpc_handler_entry;
 
 /* string */
@@ -88,24 +88,30 @@ typedef struct _rpc_string {
 /* class/method/function hash */
 typedef struct _rpc_class_hash {
        rpc_string name; /* must be first entry */
-       WormHashTable methods;
-       WormHashTable properties;
+       TsHashTable methods;
+       TsHashTable properties;
 } rpc_class_hash;
 
 /* internal data */
 typedef struct _rpc_internal {
-       char                            *class_name;
-       zend_uint                       class_name_len;
-       zend_class_entry        *ce;
+       char                                            *class_name;
+       zend_uint                               class_name_len;
+       zend_class_entry                *ce;
        rpc_object_handlers     **handlers;
-       void                            *data;
-       zend_uint                       refcount;
-       zend_uint                       clonecount;
-       zend_bool                       pool_instances;
-       rpc_class_hash          *hash;
-       WormHashTable           function_table;
-       MUTEX_T                         mx_handler;
+       void                                            *data;
+       zend_uint                               refcount;
+       zend_uint                               clonecount;
+       zend_bool                               pool_instances;
+       rpc_class_hash                  *hash;
+       TsHashTable                             function_table;
+       MUTEX_T                                 mx_handler;
 } rpc_internal;
 
+/* proxy data */
+typedef struct _rpc_proxy {
+       zend_uint                               refcount;
+       zend_uint                               clonecount;
+} rpc_proxy;
+
 
 #endif /* HANDLER_H */
\ No newline at end of file
index 7c63ab7a3c120cb68121a4e67f14cef598a6382e..eea46cbb125f6bd584187c7134afd48812616fef 100644 (file)
@@ -34,10 +34,16 @@ static void rpc_unset_property(zval *, zval * TSRMLS_DC);
 static HashTable* rpc_get_properties(zval * TSRMLS_DC);
 static union _zend_function* rpc_get_method(zval *, char *, int TSRMLS_DC);
 static union _zend_function* rpc_get_constructor(zval * TSRMLS_DC);
+static zend_class_entry** rpc_get_class_entry(zval *object TSRMLS_DC);
 static int rpc_get_classname(zval *, char **, zend_uint *, int  TSRMLS_DC);
 static int rpc_compare(zval *, zval * TSRMLS_DC);
 /**/
 
+/* pseudo handler */
+static void rpc_internal_get(rpc_internal *, char *, zend_uint, zval *);
+static void rpc_internal_set(rpc_internal *, char *, zend_uint, zval *);
+/**/
+
 static zend_object_handlers rpc_handlers = {
        rpc_add_ref,
        rpc_del_ref,
@@ -55,6 +61,7 @@ static zend_object_handlers rpc_handlers = {
        rpc_get_method,
        NULL,
        rpc_get_constructor,
+       rpc_get_class_entry,
        rpc_get_classname,
        rpc_compare
 };
@@ -83,8 +90,8 @@ zend_module_entry rpc_module_entry = {
 /* }}} */
 
 static HashTable *handlers;
-static WormHashTable *instance;
-static WormHashTable *classes;
+static TsHashTable *instance;
+static TsHashTable *classes;
 static zend_llist *classes_list;
 
 #ifdef COMPILE_DL_RPC
@@ -107,13 +114,13 @@ static void rpc_globals_ctor(zend_rpc_globals *rpc_globals TSRMLS_DC)
 ZEND_MINIT_FUNCTION(rpc)
 {
        handlers = (HashTable *) pemalloc(sizeof(HashTable), TRUE);
-       instance = (WormHashTable *) pemalloc(sizeof(WormHashTable), TRUE);
-       classes = (WormHashTable *) pemalloc(sizeof(WormHashTable), TRUE);
+       instance = (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_worm_hash_init(instance, 0, NULL, rpc_instance_dtor, TRUE);
-       zend_worm_hash_init(classes, 0, NULL, NULL, TRUE);
+       zend_ts_hash_init(instance, 0, 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 {
@@ -149,8 +156,8 @@ ZEND_MINIT_FUNCTION(rpc)
 ZEND_MSHUTDOWN_FUNCTION(rpc)
 {
        /* destroy instances first */
-       zend_worm_hash_destroy(instance);
-       zend_worm_hash_destroy(classes);
+       zend_ts_hash_destroy(instance);
+       zend_ts_hash_destroy(classes);
 
        zend_llist_destroy(classes_list);
        zend_hash_destroy(handlers);
@@ -197,8 +204,8 @@ static void rpc_class_dtor(void *pDest)
 
        hash = (rpc_class_hash **) pDest;
 
-       zend_worm_hash_destroy(&((*hash)->methods));
-       zend_worm_hash_destroy(&((*hash)->properties));
+       zend_ts_hash_destroy(&((*hash)->methods));
+       zend_ts_hash_destroy(&((*hash)->properties));
 
        free((*hash)->name.str);
        pefree((*hash), TRUE);
@@ -249,7 +256,7 @@ static zend_object_value rpc_create_object(zend_class_entry *class_type TSRMLS_D
        tsrm_mutex_lock(instance->mx_writer);
        {
                zov->handle = zend_hash_next_free_element(&(instance->hash));
-               zend_worm_hash_next_index_insert(instance, &intern, sizeof(rpc_internal *), NULL);
+               zend_ts_hash_next_index_insert(instance, &intern, sizeof(rpc_internal *), NULL);
        }
        tsrm_mutex_unlock(instance->mx_writer);
 
@@ -274,7 +281,7 @@ static void rpc_del_ref(zval *object TSRMLS_DC)
                }
 
                if (RPC_REFCOUNT(intern) == 0) {
-                       zend_worm_hash_index_del(instance, Z_OBJ_HANDLE(*object));
+                       zend_ts_hash_index_del(instance, Z_OBJ_HANDLE(*object));
                }
        }
 }
@@ -289,7 +296,7 @@ static void rpc_delete(zval *object TSRMLS_DC)
                }
 
                if (RPC_CLONECOUNT(intern) == 0) {
-                       zend_worm_hash_index_del(instance, Z_OBJ_HANDLE_P(object));
+                       zend_ts_hash_index_del(instance, Z_OBJ_HANDLE_P(object));
                }
        }
 }
@@ -313,23 +320,43 @@ static zend_object_value rpc_clone(zval *object TSRMLS_DC)
 
 static zval* rpc_read(zval *object, zval *member, int type TSRMLS_DC)
 {
-//     GET_INTERNAL(intern);
+       zval *return_value;
+       GET_INTERNAL(intern);
 
-       /* FIXME */
-       return NULL;
+       /* seting up the return value and decrease the refcounter as we don't
+        * keep a reference to this zval.
+        */
+       MAKE_STD_ZVAL(return_value);
+       ZVAL_DELREF(return_value);
+       ZVAL_NULL(return_value);
+
+       if ((*intern)->hash && Z_TYPE_P(member) == IS_LONG) {
+               rpc_internal_get(*intern, NULL, Z_LVAL_P(member), return_value);
+       } else if (Z_TYPE_P(member) == IS_STRING) {
+               rpc_internal_get(*intern, Z_STRVAL_P(member), Z_STRLEN_P(member), return_value);
+       } else {
+               /* TODO: exception here */
+       }
+
+       return return_value;
 }
 
 static void rpc_write(zval *object, zval *member, zval *value TSRMLS_DC)
 {
-//     GET_INTERNAL(intern);
-       /* FIXME */
+       GET_INTERNAL(intern);
+
+       if ((*intern)->hash && Z_TYPE_P(member) == IS_LONG) {
+               rpc_internal_set(*intern, NULL, Z_LVAL_P(member), value);
+       } else if (Z_TYPE_P(member) == IS_STRING) {
+               rpc_internal_set(*intern, Z_STRVAL_P(member), Z_STRLEN_P(member), value);
+       } else {
+               /* TODO: exception here */
+       }
 }
 
 static zval** rpc_get_property(zval *object, zval *member TSRMLS_DC)
 {
-/* no idea how to return an object - wait for andi */
-
-//     GET_INTERNAL(intern);
+       GET_INTERNAL(intern);
 
        /* FIXME */
        return NULL;
@@ -373,7 +400,7 @@ static union _zend_function* rpc_get_method(zval *object, char *method, int meth
        zend_function *function;
        GET_INTERNAL(intern);
 
-       if (zend_worm_hash_find(&((*intern)->function_table), method, method_len + 1, &function) != SUCCESS) {
+       if (zend_ts_hash_find(&((*intern)->function_table), method, method_len + 1, &function) != SUCCESS) {
                zend_internal_function *zif;
 
                zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
@@ -384,7 +411,7 @@ static union _zend_function* rpc_get_method(zval *object, char *method, int meth
                zif->type = ZEND_INTERNAL_FUNCTION;
 
                /* add new method to the method table */
-               zend_worm_hash_add(&((*intern)->function_table), method, method_len + 1, zif, sizeof(zend_function), &function);
+               zend_ts_hash_add(&((*intern)->function_table), method, method_len + 1, zif, sizeof(zend_function), &function);
                efree(zif);
        }
 
@@ -396,7 +423,7 @@ static union _zend_function* rpc_get_constructor(zval *object TSRMLS_DC)
        zend_function *rpc_ctor;
        GET_INTERNAL(intern);
        
-       if (zend_worm_hash_find(&((*intern)->function_table), (*intern)->ce->name, (*intern)->ce->name_length + 1, &rpc_ctor) != SUCCESS) {
+       if (zend_ts_hash_find(&((*intern)->function_table), (*intern)->ce->name, (*intern)->ce->name_length + 1, &rpc_ctor) != SUCCESS) {
                zend_internal_function *zif;
 
                zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
@@ -408,13 +435,20 @@ static union _zend_function* rpc_get_constructor(zval *object TSRMLS_DC)
                zif->handler = ZEND_FN(rpc_load);
 
                /* add new constructor to the method table */
-               zend_worm_hash_add(&((*intern)->function_table), (*intern)->ce->name, (*intern)->ce->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
+               zend_ts_hash_add(&((*intern)->function_table), (*intern)->ce->name, (*intern)->ce->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
                efree(zif);
        }
 
        return rpc_ctor;
 }
 
+static zend_class_entry** rpc_get_class_entry(zval *object TSRMLS_DC)
+{
+       GET_INTERNAL(intern);
+
+       return &((*intern)->ce);
+}
+
 static int rpc_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
 {
 //     GET_INTERNAL(intern);
@@ -490,12 +524,12 @@ ZEND_FUNCTION(rpc_load)
                                GET_CTOR_SIGNATURE(intern, hash_val, num_args, arg_types);
 
                                /* check if already hashed */   
-                               if (zend_worm_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 */
-                                       zend_worm_hash_init(&(class_hash->methods), 0, NULL, rpc_string_dtor, TRUE);
-                                       zend_worm_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE);
+                                       zend_ts_hash_init(&(class_hash->methods), 0, NULL, rpc_string_dtor, TRUE);
+                                       zend_ts_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE);
 
 
                                        /* do hashing */
@@ -508,17 +542,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_worm_hash_add(classes, hash_val.str, hash_val.len + 1, &class_hash, sizeof(rpc_class_hash *), (void **) &class_hash_find);
+                                       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_worm_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 && ((*(*intern)->handlers)->hash_type & HASH_AS_INT)) {
                                                /* register int hashcode */
-                                               zend_worm_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;
@@ -529,18 +563,18 @@ ZEND_FUNCTION(rpc_load)
                }
        } else {
                /* integer classname (hashcode) */
-               if (zend_worm_hash_index_find(classes, (*intern)->class_name_len, (void**) &class_hash_find) != SUCCESS) {
+               if (zend_ts_hash_index_find(classes, (*intern)->class_name_len, (void**) &class_hash_find) != SUCCESS) {
                        class_hash = pemalloc(sizeof(rpc_class_hash), TRUE);
 
                        /* set up the cache */
                        class_hash->name.str = NULL;
                        class_hash->name.len = (*intern)->class_name_len;
 
-                       zend_worm_hash_init(&(class_hash->methods), 0, NULL, rpc_string_dtor, TRUE);
-                       zend_worm_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE);
+                       zend_ts_hash_init(&(class_hash->methods), 0, NULL, rpc_string_dtor, TRUE);
+                       zend_ts_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE);
 
                        /* register int hashcode, we don't know more */
-                       zend_worm_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;
                }
@@ -584,7 +618,7 @@ ZEND_FUNCTION(rpc_call)
                GET_CLASS(ce);
 
                if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Ol", &object, *ce, &hash_len) != SUCCESS) {
-                       if (zend_parse_parameters_ex(0, 2 TSRMLS_CC, "Os", &object, *ce, &hash, &hash_len) != SUCCESS) {
+                       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Os", &object, *ce, &hash, &hash_len) != SUCCESS) {
                                /* none of the two possibilities */
                                /* TODO: exception */
                                php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
@@ -618,14 +652,13 @@ ZEND_FUNCTION(rpc_call)
                                GET_METHOD_SIGNATURE(intern, method_hash, hash_val, num_args, arg_types);
 
                                /* check if already hashed */   
-                               if (zend_worm_hash_find(&((*intern)->hash->methods), hash_val.str, hash_val.len + 1, (void **) &method_hash_find) != SUCCESS) {
-                                       if ((*(*intern)->handlers)->rpc_hash(hash, hash_len, &(method_hash->str), &(method_hash->len),
-                                                                                                                num_args, arg_types, METHOD) != SUCCESS) {
+                               if (zend_ts_hash_find(&((*intern)->hash->methods), hash_val.str, hash_val.len + 1, (void **) &method_hash_find) != SUCCESS) {
+                                       if ((*(*intern)->handlers)->rpc_hash(hash, hash_len, &(method_hash->str), &(method_hash->len), num_args, arg_types, METHOD) != SUCCESS) {
                                                /* TODO: exception */
                                        }
 
                                        /* register with non-hashed key */
-                                       zend_worm_hash_add(&((*intern)->hash->methods), hash_val.str, hash_val.len + 1, &method_hash, sizeof(rpc_string *), NULL);
+                                       zend_ts_hash_add(&((*intern)->hash->methods), hash_val.str, hash_val.len + 1, &method_hash, sizeof(rpc_string *), NULL);
                                } else {
                                        pefree(method_hash, TRUE);
                                        method_hash = *method_hash_find;
@@ -653,12 +686,107 @@ ZEND_FUNCTION(rpc_call)
 
 ZEND_FUNCTION(rpc_set)
 {
-       /* FIXME */
+       zval *object, *value;
+       char *property = NULL;
+       int property_len;
+       rpc_internal **intern;
+       /* get class entry */
+       GET_CLASS(ce);
+
+       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 3 TSRMLS_CC, "Olz", &object, *ce, &property_len, &value) != SUCCESS) {
+               if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 3 TSRMLS_CC, "Osz", &object, *ce, &property, &property_len, &value) != SUCCESS) {
+                       /* none of the two possibilities */
+                       /* TODO: exception */
+                       php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
+               }
+       }
+
+       GET_INTERNAL_EX(intern, object);
+       if (!property && !(*intern)->hash) {
+               /* TODO: exception here */
+       } else {
+               rpc_internal_set(*intern, property, property_len, value);
+       }
 }
 
 ZEND_FUNCTION(rpc_get)
 {
-       /* FIXME */
+       zval *object;
+       char *property = NULL;
+       int property_len;
+       rpc_internal **intern;
+       /* get class entry */
+       GET_CLASS(ce);
+
+       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Ol", &object, *ce, &property_len) != SUCCESS) {
+               if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Os", &object, *ce, &property, &property_len) != SUCCESS) {
+                       /* none of the two possibilities */
+                       /* TODO: exception */
+                       php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
+               }
+       }
+
+       GET_INTERNAL_EX(intern, object);
+       if (!property && !(*intern)->hash) {
+               /* TODO: exception here */
+       } else {
+               rpc_internal_get(*intern, property, property_len, return_value);
+       }
+}
+
+static void rpc_internal_get(rpc_internal *intern, char *property, zend_uint property_len, zval *return_value)
+{
+       int retval;
+       rpc_string *property_hash, **property_hash_find;
+
+       Z_TYPE_P(return_value) = IS_NULL;
+
+       property_hash = (rpc_string *) pemalloc(sizeof(rpc_string), TRUE);
+       property_hash->str = property;
+       property_hash->len = property_len;
+       
+       if (intern->hash) {
+               /* cache method table lookups */
+       
+               if (!property && !((*intern->handlers)->hash_type & HASH_AS_INT)) {
+                       /* TODO: exception */
+               } else if(property) {
+                       /* check if already hashed */   
+                       if (zend_ts_hash_find(&(intern->hash->properties), property, property_len + 1, (void **) &property_hash_find) != SUCCESS) {
+                               if ((*intern->handlers)->rpc_hash(property, property_len, &(property_hash->str), &(property_hash->len), 0, NULL, PROPERTY) != SUCCESS) {
+                                       /* TODO: exception */
+                               }
+
+                               /* register with non-hashed key */
+                               zend_ts_hash_add(&(intern->hash->properties), property, property_len + 1, &property_hash, sizeof(rpc_string *), NULL);
+                       } else {
+                               pefree(property_hash, TRUE);
+                               property_hash = *property_hash_find;
+                       }
+               }
+       }
+
+
+       tsrm_mutex_lock(intern->mx_handler);
+       retval = (*intern->handlers)->rpc_get(property_hash->str, property_hash->len, return_value, intern->data);
+       tsrm_mutex_unlock(intern->mx_handler);
+
+       if (retval != SUCCESS) {
+               /* TODO: exception here */
+       }
+}
+
+static void rpc_internal_set(rpc_internal *intern, char *property, zend_uint property_len, zval *value)
+{
+       int retval;
+
+       tsrm_mutex_lock(intern->mx_handler);
+       retval = (*intern->handlers)->rpc_set(property, property_len, value, intern->data);
+       tsrm_mutex_unlock(intern->mx_handler);
+
+       if (retval != SUCCESS) {
+               /* TODO: exception here */
+       }
 }
 
 /*
index ce2b0e59d61f7721cc70edacd4d0eddace7f6d48..43f6bd8ae3a7f5502ce50d038e05cf10d374d23d 100644 (file)
@@ -10,7 +10,7 @@
                                                                        /* TODO: exception */                                                   \
                                                                }
 
-#define GET_INTERNAL_EX(intern, object)        zend_worm_hash_index_find(instance, object->value.obj.handle, (void **) &intern)
+#define GET_INTERNAL_EX(intern, object)        zend_ts_hash_index_find(instance, object->value.obj.handle, (void **) &intern)
 
 #define GET_CLASS(ce)  char *key;                                                                                                                                                              \
                                                int key_len;                                                                                                                                                    \
diff --git a/ext/rpc/rpc_proxy.c b/ext/rpc/rpc_proxy.c
new file mode 100644 (file)
index 0000000..3ec44ac
--- /dev/null
@@ -0,0 +1,135 @@
+#include "php.h"
+
+#include "rpc_proxy.h"
+
+/* object handler */
+static void rpc_proxy_add_ref(zval * TSRMLS_DC);
+static void rpc_proxy_del_ref(zval * TSRMLS_DC);
+static void rpc_proxy_delete(zval * TSRMLS_DC);
+static zend_object_value rpc_proxy_clone(zval * TSRMLS_DC);
+static zval* rpc_proxy_read(zval *, zval *, int  TSRMLS_DC);
+static void rpc_proxy_write(zval *, zval *, zval * TSRMLS_DC);
+static zval** rpc_proxy_get_property(zval *, zval * TSRMLS_DC);
+static zval* rpc_proxy_get(zval * TSRMLS_DC);
+static void rpc_proxy_set(zval **, zval * TSRMLS_DC);
+static int rpc_proxy_has_property(zval *, zval *, int  TSRMLS_DC);
+static void rpc_proxy_unset_property(zval *, zval * TSRMLS_DC);
+static HashTable* rpc_proxy_get_properties(zval * TSRMLS_DC);
+static union _zend_function* rpc_proxy_get_method(zval *, char *, int TSRMLS_DC);
+static union _zend_function* rpc_proxy_get_constructor(zval * TSRMLS_DC);
+static zend_class_entry** rpc_proxy_get_class_entry(zval *object TSRMLS_DC);
+static int rpc_proxy_get_classname(zval *, char **, zend_uint *, int  TSRMLS_DC);
+static int rpc_proxy_compare(zval *, zval * TSRMLS_DC);
+/**/
+
+static zend_object_handlers rpc_proxy_handlers = {
+       rpc_proxy_add_ref,
+       rpc_proxy_del_ref,
+       rpc_proxy_delete,
+       rpc_proxy_clone,
+       rpc_proxy_read,
+       rpc_proxy_write,
+       rpc_proxy_get_property,
+       NULL,
+       rpc_proxy_get,
+       rpc_proxy_set,
+       rpc_proxy_has_property,
+       rpc_proxy_unset_property,
+       rpc_proxy_get_properties,
+       rpc_proxy_get_method,
+       NULL,
+       rpc_proxy_get_constructor,
+       rpc_proxy_get_class_entry,
+       rpc_proxy_get_classname,
+       rpc_proxy_compare
+};
+
+
+/* object handler */
+
+static void rpc_proxy_add_ref(zval *object TSRMLS_DC)
+{
+}
+
+static void rpc_proxy_del_ref(zval *object TSRMLS_DC)
+{
+}
+
+static void rpc_proxy_delete(zval *object TSRMLS_DC)
+{
+}
+
+static zend_object_value rpc_proxy_clone(zval *object TSRMLS_DC)
+{
+}
+
+static zval* rpc_proxy_read(zval *object, zval *member, int type TSRMLS_DC)
+{
+       return NULL;
+}
+
+static void rpc_proxy_write(zval *object, zval *member, zval *value TSRMLS_DC)
+{
+}
+
+static zval** rpc_proxy_get_property(zval *object, zval *member TSRMLS_DC)
+{
+       return NULL;
+}
+
+static zval* rpc_proxy_get(zval *property TSRMLS_DC)
+{
+       return NULL;
+}
+
+static void rpc_proxy_set(zval **property, zval *value TSRMLS_DC)
+{
+}
+
+static int rpc_proxy_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
+{
+       return NULL;
+}
+
+static void rpc_proxy_unset_property(zval *object, zval *member TSRMLS_DC)
+{
+}
+
+static HashTable* rpc_proxy_get_properties(zval *object TSRMLS_DC)
+{
+       return NULL;
+}
+
+static union _zend_function* rpc_proxy_get_method(zval *object, char *method, int method_len TSRMLS_DC)
+{
+       return NULL;
+}
+
+static union _zend_function* rpc_proxy_get_constructor(zval *object TSRMLS_DC)
+{
+       return NULL;
+}
+
+static zend_class_entry** rpc_proxy_get_class_entry(zval *object TSRMLS_DC)
+{
+       return NULL;
+}
+
+static int rpc_proxy_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
+{
+       return NULL;
+}
+
+static int rpc_proxy_compare(zval *object1, zval *object2 TSRMLS_DC)
+{
+       return NULL;
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/rpc/rpc_proxy.h b/ext/rpc/rpc_proxy.h
new file mode 100644 (file)
index 0000000..179caa9
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef RPC_PROXY_H
+#define RPC_PROXY_H
+
+#endif
\ No newline at end of file