summaryrefslogtreecommitdiff
path: root/ext/rpc/com/com.c
blob: 0b51925ed762d95c2b432d896501fc59b8ade7a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "com.h"

/* protos */
static int com_hash(rpc_string, rpc_string *, int, char *, int);
static int com_name(rpc_string, rpc_string *, int);
static int com_ctor(rpc_string, void **, int , zval ***);
static int com_dtor(void **);
static int com_call(rpc_string, void **, zval **, int, zval ***);
static int com_get(rpc_string, zval *, void **);
static int com_set(rpc_string, zval *, void **);
static int com_compare(void **, void **);
static int com_has_property(rpc_string, void **);
static int com_unset_property(rpc_string, void **);
static int com_get_properties(HashTable **, void **);


/* register rpc callback function */
RPC_REGISTER_HANDLERS_START(com)
TRUE,							/* poolable */
HASH_AS_INT_WITH_SIGNATURE,
com_hash,
com_name,
com_ctor,
com_dtor,
com_call,
com_get,
com_set,
com_compare,
com_has_property,
com_unset_property,
com_get_properties
RPC_REGISTER_HANDLERS_END()

/* register ini settings */
RPC_INI_START(com)
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)
RPC_INI_END()

/* register userspace functions */
RPC_FUNCTION_ENTRY_START(com)
	ZEND_FALIAS(com_invoke, rpc_call, NULL)
	ZEND_FE(com_addref, NULL)
	ZEND_FE(com_release, NULL)
RPC_FUNCTION_ENTRY_END()

/* register class methods */
RPC_METHOD_ENTRY_START(com)
	ZEND_FALIAS(addref, com_addref, NULL)
	ZEND_FALIAS(release, com_release, NULL)
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)
{
}

/* rpc handler functions */

static int com_hash(rpc_string name, rpc_string *hash, int num_args, char *arg_types, int type)
{
	hash->str = strdup(name.str);
	hash->len = name.len;

	return SUCCESS;
}

static int com_name(rpc_string hash, rpc_string *name, int type)
{
	name->str = strdup(hash.str);
	name->len = hash.len;

	return SUCCESS;
}

static int com_ctor(rpc_string class_name, void **data, int num_args, zval **args[])
{
	return SUCCESS;
}

static int com_dtor(void **data)
{
	return SUCCESS;
}

static int com_call(rpc_string method_name, void **data, zval **return_value, int num_args, zval **args[])
{
	return SUCCESS;
}

static int com_get(rpc_string property_name, zval *return_value, void **data)
{
	return SUCCESS;
}

static int com_set(rpc_string property_name, zval *value, void **data)
{
	return SUCCESS;
}

static int com_compare(void **data1, void **data2)
{
	return SUCCESS;
}

static int com_has_property(rpc_string property_name, void **data)
{
	return SUCCESS;
}

static int com_unset_property(rpc_string property_name, void **data)
{
	return SUCCESS;
}

static int com_get_properties(HashTable **properties, void **data)
{
	return SUCCESS;
}

/* custom functions */
ZEND_FUNCTION(com_addref)
{
}

ZEND_FUNCTION(com_release)
{
}