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
|
#ifndef _PHP_INI_H
#define _PHP_INI_H
#define PHP_INI_USER (1<<0)
#define PHP_INI_PERDIR (1<<1)
#define PHP_INI_SYSTEM (1<<2)
#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM)
typedef struct _php_ini_entry php_ini_entry;
#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3)
struct _php_ini_entry {
int module_number;
int modifyable;
char *name;
uint name_length;
PHP_INI_MH((*on_modify));
void *mh_arg1;
void *mh_arg2;
void *mh_arg3;
char *value;
uint value_length;
char *orig_value;
uint orig_value_length;
int modified;
};
int php_ini_mstartup();
int php_ini_mshutdown();
int php_ini_rshutdown();
int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
void php_unregister_ini_entries(int module_number);
int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
int php_restore_ini_entry(char *name, uint name_length);
long php_ini_long(char *name, uint name_length, int orig);
double php_ini_double(char *name, uint name_length, int orig);
char *php_ini_string(char *name, uint name_length, int orig);
#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = {
#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
{ 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0 },
#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, NULL, NULL)
#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \
PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, NULL, NULL, NULL)
#define PHP_INI_END() \
{ 0, 0, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, 0 } };
#define INI_INT(name) php_ini_long((name), sizeof(name), 0)
#define INI_FLT(name) php_ini_double((name), sizeof(name), 0)
#define INI_STR(name) php_ini_string((name), sizeof(name), 0)
#define INI_ORIG_INT(name) php_ini_long((name), sizeof(name), 1)
#define INI_ORIG_FLT(name) php_ini_double((name), sizeof(name), 1)
#define INI_ORIG_STR(name) php_ini_string((name), sizeof(name), 1)
#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number)
#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number)
pval *cfg_get_entry(char *name, uint name_length);
/* Standard message handlers */
PHP_INI_MH(OnUpdateInt);
PHP_INI_MH(OnUpdateReal);
PHP_INI_MH(OnUpdateString);
PHP_INI_MH(OnUpdateStringUnempty);
#endif /* _PHP_INI_H */
|