root/eaccelerator/tags/0.9.2a/eaccelerator.h

Revision 49, 6.8 kB (checked in by everaldo_canuto, 4 years ago)

Move encoder version information to eaccelerator.h, today this information are in two places, encoder.h and loader.h now it is unified.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2    +----------------------------------------------------------------------+
3    | eAccelerator project                                                 |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2004 eAccelerator                                      |
6    | http://eaccelerator.sourceforge.net                                  |
7    +----------------------------------------------------------------------+
8    | This program is free software; you can redistribute it and/or        |
9    | modify it under the terms of the GNU General Public License          |
10    | as published by the Free Software Foundation; either version 2       |
11    | of the License, or (at your option) any later version.               |
12    |                                                                      |
13    | This program is distributed in the hope that it will be useful,      |
14    | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
15    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
16    | GNU General Public License for more details.                         |
17    |                                                                      |
18    | You should have received a copy of the GNU General Public License    |
19    | along with this program; if not, write to the Free Software          |
20    | Foundation, Inc., 59 Temple Place - Suite 330, Boston,               |
21    | MA  02111-1307, USA.                                                 |
22    |                                                                      |
23    | A copy is availble at http://www.gnu.org/copyleft/gpl.txt            |
24    +----------------------------------------------------------------------+
25    | Author(s): Dmitry Stogov <dstogov@users.sourceforge.net>             |
26    |            Everaldo Canuto <everaldo_canuto@yahoo.com.br>            |
27    +----------------------------------------------------------------------+
28    $Id$
29 */
30
31 #ifndef INCLUDED_EACCELERATOR_H
32 #define INCLUDED_EACCELERATOR_H
33
34 #include "php.h"
35 #include "zend.h"
36 #include "zend_API.h"
37 #include "zend_extensions.h"
38
39 /* Handle __attribute__ for nongcc compilers */
40 #if (__GNUC__ >= 3)  || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96))
41 #  define HAS_ATTRIBUTE
42 #else
43 #  define __attribute__(x)
44 #endif
45
46 #ifndef ZEND_WIN32
47 #  if ZEND_MODULE_API_NO >= 20001222
48 #    include "config.h"
49 #  else
50 #    include "php_config.h"
51 #  endif
52 #endif
53
54 #ifndef ZEND_WIN32
55 /* UnDefine if your filesystem doesn't support inodes */
56 #  define EACCELERATOR_USE_INODE
57 #endif
58
59 /* Define some of the following macros if you like to debug eAccelerator */
60 /*#define DEBUG*/
61 /*#define TEST_PERFORMANCE*/
62 /*#define PROFILE_OPCODES*/
63
64 #ifdef WITH_EACCELERATOR_CRASH_DETECTION
65 #  include <signal.h>
66 #endif
67
68 #if defined(DEBUG) || defined(TEST_PERFORMANCE)  || defined(PROFILE_OPCODES)
69 /* Here you can chage debuging log filename */
70 #define DEBUG_LOGFILE     "/var/log/httpd/eaccelerator_log"
71 #define DEBUG_LOGFILE_CGI "/tmp/eaccelerator_log"
72 #endif
73
74 #define EACCELERATOR_MM_FILE "/tmp/eaccelerator"
75
76 #ifdef HAVE_EACCELERATOR
77 /*
78  * Where to cache
79  */
80 typedef enum _eaccelerator_cache_place {
81   eaccelerator_shm_and_disk, /* in shm and in disk */
82   eaccelerator_shm,          /* in shm, but if it is not possible then on disk */
83   eaccelerator_shm_only,     /* in shm only  */
84   eaccelerator_disk_only,    /* on disk only */
85   eaccelerator_none          /* don't cache  */
86 } eaccelerator_cache_place;
87
88 extern eaccelerator_cache_place eaccelerator_content_cache_place;
89
90 unsigned int eaccelerator_crc32(const char *p, size_t n);
91 int eaccelerator_put(const char* key, int key_len, zval* val, time_t ttl, eaccelerator_cache_place where TSRMLS_DC);
92 int eaccelerator_get(const char* key, int key_len, zval* return_value, eaccelerator_cache_place where  TSRMLS_DC);
93 int eaccelerator_rm(const char* key, int key_len, eaccelerator_cache_place where  TSRMLS_DC);
94 size_t eaccelerator_gc(TSRMLS_D);
95 #  ifdef WITH_EACCELERATOR_EXECUTOR
96 ZEND_DLEXPORT void eaccelerator_execute(zend_op_array *op_array TSRMLS_DC);
97 #  endif
98 #  ifdef WITH_EACCELERATOR_OPTIMIZER
99 void eaccelerator_optimize(zend_op_array *op_array);
100 #  endif
101 #ifdef WITH_EACCELERATOR_ENCODER
102 PHP_FUNCTION(eaccelerator_encode);
103 #endif
104 #ifdef WITH_EACCELERATOR_LOADER
105 zend_op_array* eaccelerator_load(char* src, int src_len TSRMLS_DC);
106 PHP_FUNCTION(eaccelerator_load);
107 PHP_FUNCTION(_eaccelerator_loader_file);
108 PHP_FUNCTION(_eaccelerator_loader_line);
109 #endif
110 #ifdef WITH_EACCELERATOR_CONTENT_CACHING
111 void eaccelerator_content_cache_startup();
112 void eaccelerator_content_cache_shutdown();
113
114 PHP_FUNCTION(_eaccelerator_output_handler);
115 PHP_FUNCTION(eaccelerator_cache_page);
116 PHP_FUNCTION(eaccelerator_rm_page);
117 PHP_FUNCTION(eaccelerator_cache_output);
118 PHP_FUNCTION(eaccelerator_cache_result);
119 #endif
120 #endif
121
122 /*
123  * conditional filter
124  */
125 typedef struct _mm_cond_entry {
126   char     *str;
127   int       len;
128   zend_bool not;
129   struct  _mm_cond_entry  *next;
130 } mm_cond_entry;
131
132 /*
133  * Globals (different for each process/thread)
134  */
135 ZEND_BEGIN_MODULE_GLOBALS(eaccelerator)
136   void          *used_entries;     /* list of files which are used     */
137                                    /* by process/thread                */
138   zend_bool     enabled;
139   zend_bool     optimizer_enabled;
140   zend_bool     compression_enabled;
141   zend_bool     compiler;
142   zend_bool     encoder;
143   zend_bool     compress;
144   zend_bool     compress_content;
145   zend_bool     in_request;
146   zend_llist*   content_headers;
147   long          compress_level;
148   char          *cache_dir;
149   char          *name_space;
150   char          *mem;
151   HashTable     strings;
152   zend_class_entry *class_entry;
153   mm_cond_entry *cond_list;
154   zend_uint      refcount_helper;
155   char          hostname[32];
156 #ifdef WITH_EACCELERATOR_CRASH_DETECTION
157 #ifdef SIGSEGV
158   void (*original_sigsegv_handler)(int);
159 #endif
160 #ifdef SIGFPE
161   void (*original_sigfpe_handler)(int);
162 #endif
163 #ifdef SIGBUS
164   void (*original_sigbus_handler)(int);
165 #endif
166 #ifdef SIGILL
167   void (*original_sigill_handler)(int);
168 #endif
169 #ifdef SIGABRT
170   void (*original_sigabrt_handler)(int);
171 #endif
172 #endif
173 #if defined(DEBUG) || defined(TEST_PERFORMANCE)  || defined(PROFILE_OPCODES)
174   int  xpad;
175 #endif
176 #ifdef WITH_EACCELERATOR_SESSIONS
177   char *session;
178 #endif
179 #ifdef PROFILE_OPCODES
180   int  profile_level;
181   long self_time[256];
182 #endif
183 ZEND_END_MODULE_GLOBALS(eaccelerator)
184
185 ZEND_EXTERN_MODULE_GLOBALS(eaccelerator)
186
187 #ifdef ZTS
188 #  define MMCG(v) TSRMG(eaccelerator_globals_id, zend_eaccelerator_globals*, v)
189 #else
190 #  define MMCG(v) (eaccelerator_globals.v)
191 #endif
192
193 #define EACCELERATOR_EXTENSION_NAME "eAccelerator"
194 #define EACCELERATOR_LOADER_EXTENSION_NAME "eLoader"
195
196 #define MMC_ENCODER_VERSION   0x00000003
197 #define MMC_ENCODER_END       0x00
198 #define MMC_ENCODER_NAMESPACE 0x01
199 #define MMC_ENCODER_CLASS     0x02
200 #define MMC_ENCODER_FUNCTION  0x03
201
202 #endif /*#ifndef INCLUDED_EACCELERATOR_H*/
Note: See TracBrowser for help on using the browser.