-
Notifications
You must be signed in to change notification settings - Fork 2
/
php_aware.h
127 lines (93 loc) · 4.35 KB
/
php_aware.h
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
/*
+----------------------------------------------------------------------+
| PHP Version 5 / aware |
+----------------------------------------------------------------------+
| Copyright (c) 2009 Mikko Koppanen |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Mikko Kopppanen <mkoppanen@php.net> |
+----------------------------------------------------------------------+
*/
#ifndef _PHP_AWARE_H_
# define _PHP_AWARE_H_
#include "php.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef ZTS
# include "TSRM.h"
#endif
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_smart_str.h"
#define PHP_AWARE_EXTVER "0.1.0-dev"
#include <sys/resource.h>
/* Original error callback */
typedef void (*php_aware_orig_error_cb_t)(int, const char *, const uint, const char *, va_list);
typedef struct _php_aware_serialize_cache {
char *data;
int data_len;
char *uuid;
zend_bool has_item;
} php_aware_serialize_cache;
ZEND_BEGIN_MODULE_GLOBALS(aware)
zend_bool enabled; /* is the module enabled */
zend_bool log_get; /* whether to log get values */
zend_bool log_post; /* whether to log post values */
zend_bool log_session; /* whether to log session values */
zend_bool log_cookie; /* whether to log cookies */
zend_bool log_env; /* whether to log environment */
zend_bool log_server; /* whether to log server values */
zend_bool log_files; /* whether to log files array */
zend_bool log_backtrace; /* whether to store backtrace */
zend_bool use_cache; /* use serialize cache? stores repeated serializations */
zend_bool enable_event_trigger; /* do we want to log user generated events */
long log_level; /* what sort of events do we store */
long depth; /* how many levels to serialize (arrays) */
long memory_usage_threshold; /* how many bytes is the limit of excess usage */
char *storage_modules; /* which storage modules to enable */
php_aware_orig_error_cb_t orig_error_cb; /* the original zend_error_cb */
void (*orig_set_error_handler)(INTERNAL_FUNCTION_PARAMETERS); /* the set_error_handle entry */
void (*orig_restore_error_handler)(INTERNAL_FUNCTION_PARAMETERS); /* the restore error handler entry */
zend_ptr_stack user_error_handlers; /* previous user error handlers */
zend_stack user_error_handler_levels; /* the levels the user error handler handles */
zval *user_error_handler; /* the current active user error handler */
long slow_request_threshold; /* how many msec is considered slow, setting > 0 turns on the slow request monitor */
struct timeval request_start_tv; /* when the request started */
struct rusage request_start_rusage; /* rsusage at the start of the request */
HashTable module_error_reporting; /* hashtable containing error reporting levels for different storage modules */
php_aware_serialize_cache s_cache; /* serialize cache, repeated serializations are stored here */
char *error_page; /* Display pretty error page on fatal if set */
ZEND_END_MODULE_GLOBALS(aware)
ZEND_EXTERN_MODULE_GLOBALS(aware)
#ifdef ZTS
# define AWARE_G(v) TSRMG(aware_globals_id, zend_aware_globals *, v)
#else
# define AWARE_G(v) (aware_globals.v)
#endif
extern zend_module_entry aware_module_entry;
#define phpext_aware_ptr &aware_module_entry
#ifdef _AWARE_DEBUG_
# define aware_printf(...) fprintf (stderr, __VA_ARGS__)
#else
# define aware_printf(...)
#endif
/*
API exports
*/
#ifndef MY_AWARE_EXPORTS
# ifdef PHP_WIN32
# define MY_AWARE_EXPORTS __declspec(dllexport)
# else
# define MY_AWARE_EXPORTS PHPAPI
# endif
#endif
MY_AWARE_EXPORTS void php_aware_original_error_cb(int type TSRMLS_DC, const char *format, ...);
#endif