-
Notifications
You must be signed in to change notification settings - Fork 3
/
php_jam.h
134 lines (99 loc) · 4.67 KB
/
php_jam.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
128
129
130
131
132
133
134
/*
+----------------------------------------------------------------------+
| PHP Version 5 / jam |
+----------------------------------------------------------------------+
| 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_JAM_H_
# define _PHP_JAM_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_JAM_EXTVER "0.1.0-dev"
#include <sys/resource.h>
#define PHP_5_3_X_API_NO 20090626
#define PHP_5_4_X_API_NO 20100525
#define PHP_5_5_X_API_NO 20121212
#define PHP_5_6_X_API_NO 20131226
/* Original error callback */
typedef void (*php_jam_orig_error_cb_t)(int, const char *, const uint, const char *, va_list);
typedef struct _php_jam_serialize_cache {
char *data;
int data_len;
char *uuid;
zend_bool has_item;
} php_jam_serialize_cache;
ZEND_BEGIN_MODULE_GLOBALS(jam)
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_jam_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_jam_serialize_cache s_cache; /* serialize cache, repeated serializations are stored here */
char *source_baseurl; /* base URL of your code repo, for displaying a link to the file when reporting the error */
char *appname; /* report the appname in which the err was triggered */
char *error_page; /* Display pretty error page on fatal if set */
ZEND_END_MODULE_GLOBALS(jam)
ZEND_EXTERN_MODULE_GLOBALS(jam)
#ifdef ZTS
# define JAM_G(v) TSRMG(jam_globals_id, zend_jam_globals *, v)
#else
# define JAM_G(v) (jam_globals.v)
#endif
extern zend_module_entry jam_module_entry;
#define phpext_jam_ptr &jam_module_entry
#ifdef _JAM_DEBUG_
# define jam_printf(...) fprintf (stderr, __VA_ARGS__)
#else
# define jam_printf(...)
#endif
/*
API exports
*/
#ifndef MY_JAM_EXPORTS
# ifdef PHP_WIN32
# define MY_JAM_EXPORTS __declspec(dllexport)
# else
# define MY_JAM_EXPORTS PHPAPI
# endif
#endif
MY_JAM_EXPORTS void php_jam_original_error_cb(int type TSRMLS_DC, const char *format, ...);
#endif