Back to index

php5  5.3.10
basic_functions.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Andi Gutmans <andi@zend.com>                                |
00016    |          Zeev Suraski <zeev@zend.com>                                |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: basic_functions.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef BASIC_FUNCTIONS_H
00023 #define BASIC_FUNCTIONS_H
00024 
00025 #include <sys/stat.h>
00026 
00027 #ifdef HAVE_WCHAR_H
00028 #include <wchar.h>
00029 #endif
00030 
00031 #include "php_filestat.h"
00032 
00033 #include "zend_highlight.h"
00034 
00035 #include "url_scanner_ex.h"
00036 
00037 extern zend_module_entry basic_functions_module;
00038 #define basic_functions_module_ptr &basic_functions_module
00039 
00040 PHP_MINIT_FUNCTION(basic);
00041 PHP_MSHUTDOWN_FUNCTION(basic);
00042 PHP_RINIT_FUNCTION(basic);
00043 PHP_RSHUTDOWN_FUNCTION(basic);
00044 PHP_MINFO_FUNCTION(basic);
00045 
00046 PHP_FUNCTION(constant);
00047 PHP_FUNCTION(sleep);
00048 PHP_FUNCTION(usleep);
00049 #if HAVE_NANOSLEEP
00050 PHP_FUNCTION(time_nanosleep);
00051 PHP_FUNCTION(time_sleep_until);
00052 #endif
00053 PHP_FUNCTION(flush);
00054 #ifdef HAVE_INET_NTOP
00055 PHP_NAMED_FUNCTION(php_inet_ntop);
00056 #endif
00057 #ifdef HAVE_INET_PTON
00058 PHP_NAMED_FUNCTION(php_inet_pton);
00059 #endif
00060 PHP_FUNCTION(ip2long);
00061 PHP_FUNCTION(long2ip);
00062 
00063 /* system functions */
00064 PHP_FUNCTION(getenv);
00065 PHP_FUNCTION(putenv);
00066 
00067 PHP_FUNCTION(getopt);
00068 
00069 PHP_FUNCTION(get_current_user);
00070 PHP_FUNCTION(set_time_limit);
00071 
00072 PHP_FUNCTION(get_cfg_var);
00073 PHP_FUNCTION(set_magic_quotes_runtime);
00074 PHP_FUNCTION(get_magic_quotes_runtime);
00075 PHP_FUNCTION(get_magic_quotes_gpc);
00076 
00077 PHP_FUNCTION(import_request_variables);
00078 
00079 PHP_FUNCTION(error_log);
00080 PHP_FUNCTION(error_get_last);
00081 
00082 PHP_FUNCTION(call_user_func);
00083 PHP_FUNCTION(call_user_func_array);
00084 PHP_FUNCTION(call_user_method);
00085 PHP_FUNCTION(call_user_method_array);
00086 PHP_FUNCTION(forward_static_call);
00087 PHP_FUNCTION(forward_static_call_array);
00088 
00089 PHP_FUNCTION(register_shutdown_function);
00090 PHP_FUNCTION(highlight_file);
00091 PHP_FUNCTION(highlight_string);
00092 PHP_FUNCTION(php_strip_whitespace);
00093 ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
00094 
00095 PHP_FUNCTION(ini_get);
00096 PHP_FUNCTION(ini_get_all);
00097 PHP_FUNCTION(ini_set);
00098 PHP_FUNCTION(ini_restore);
00099 PHP_FUNCTION(get_include_path);
00100 PHP_FUNCTION(set_include_path);
00101 PHP_FUNCTION(restore_include_path);
00102 
00103 PHP_FUNCTION(print_r);
00104 PHP_FUNCTION(fprintf);
00105 PHP_FUNCTION(vfprintf);
00106 
00107 PHP_FUNCTION(connection_aborted);
00108 PHP_FUNCTION(connection_status);
00109 PHP_FUNCTION(ignore_user_abort);
00110 
00111 PHP_FUNCTION(getservbyname);
00112 PHP_FUNCTION(getservbyport);
00113 PHP_FUNCTION(getprotobyname);
00114 PHP_FUNCTION(getprotobynumber);
00115 
00116 PHP_NAMED_FUNCTION(php_if_crc32);
00117 
00118 PHP_FUNCTION(register_tick_function);
00119 PHP_FUNCTION(unregister_tick_function);
00120 #ifdef HAVE_GETLOADAVG
00121 PHP_FUNCTION(sys_getloadavg);
00122 #endif
00123 
00124 PHP_FUNCTION(is_uploaded_file);
00125 PHP_FUNCTION(move_uploaded_file);
00126 
00127 /* From the INI parser */
00128 PHP_FUNCTION(parse_ini_file);
00129 PHP_FUNCTION(parse_ini_string);
00130 #if ZEND_DEBUG
00131 PHP_FUNCTION(config_get_hash);
00132 #endif
00133 
00134 PHP_FUNCTION(str_rot13);
00135 PHP_FUNCTION(stream_get_filters);
00136 PHP_FUNCTION(stream_filter_register);
00137 PHP_FUNCTION(stream_bucket_make_writeable);
00138 PHP_FUNCTION(stream_bucket_prepend);
00139 PHP_FUNCTION(stream_bucket_append);
00140 PHP_FUNCTION(stream_bucket_new);
00141 PHP_MINIT_FUNCTION(user_filters);
00142 PHP_RSHUTDOWN_FUNCTION(user_filters);
00143 PHP_RSHUTDOWN_FUNCTION(browscap);
00144 
00145 /* Left for BC (not binary safe!) */
00146 PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
00147 PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC);
00148 PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC);
00149 
00150 #if SIZEOF_INT == 4
00151 /* Most 32-bit and 64-bit systems have 32-bit ints */
00152 typedef unsigned int php_uint32;
00153 typedef signed int php_int32;
00154 #elif SIZEOF_LONG == 4
00155 /* 16-bit systems? */
00156 typedef unsigned long php_uint32;
00157 typedef signed long php_int32;
00158 #else
00159 #error Need type which holds 32 bits
00160 #endif
00161 
00162 #define MT_N (624)
00163 
00164 typedef struct _php_basic_globals {
00165        HashTable *user_shutdown_function_names;
00166        HashTable putenv_ht;
00167        zval *strtok_zval;
00168        char *strtok_string;
00169        char *locale_string;
00170        char *strtok_last;
00171        char strtok_table[256];
00172        ulong strtok_len;
00173        char str_ebuf[40];
00174        zend_fcall_info array_walk_fci;
00175        zend_fcall_info_cache array_walk_fci_cache;
00176        zend_fcall_info user_compare_fci;
00177        zend_fcall_info_cache user_compare_fci_cache;
00178        zend_llist *user_tick_functions;
00179 
00180        zval *active_ini_file_section;
00181 
00182        HashTable sm_protected_env_vars;
00183        char *sm_allowed_env_vars;
00184        
00185        /* pageinfo.c */
00186        long page_uid;
00187        long page_gid;
00188        long page_inode;
00189        time_t page_mtime;
00190 
00191        /* filestat.c && main/streams/streams.c */
00192        char *CurrentStatFile, *CurrentLStatFile;
00193        php_stream_statbuf ssb, lssb;
00194 
00195        /* rand.c */
00196        php_uint32   state[MT_N+1];  /* state vector + 1 extra to not violate ANSI C */
00197        php_uint32   *next;       /* next random value is computed from here */
00198        int      left;        /* can *next++ this many times before reloading */
00199 
00200        unsigned int rand_seed; /* Seed for rand(), in ts version */
00201 
00202        zend_bool rand_is_seeded; /* Whether rand() has been seeded */
00203        zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */
00204     
00205        /* syslog.c */
00206        int syslog_started;
00207        char *syslog_device;
00208 
00209        /* var.c */
00210        zend_class_entry *incomplete_class;
00211 
00212        /* url_scanner_ex.re */
00213        url_adapt_state_ex_t url_adapt_state_ex;
00214 
00215 #ifdef HAVE_MMAP
00216        void *mmap_file;
00217        size_t mmap_len;
00218 #endif
00219 
00220        HashTable *user_filter_map;
00221 
00222        /* file.c */
00223 #if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
00224        mbstate_t mblen_state;
00225 #endif
00226 
00227        int umask;
00228 } php_basic_globals;
00229 
00230 #ifdef ZTS
00231 #define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
00232 PHPAPI extern int basic_globals_id;
00233 #else
00234 #define BG(v) (basic_globals.v)
00235 PHPAPI extern php_basic_globals basic_globals;
00236 #endif
00237 
00238 #if HAVE_PUTENV
00239 typedef struct {
00240        char *putenv_string;
00241        char *previous_value;
00242        char *key;
00243        int key_len;
00244 } putenv_entry;
00245 #endif
00246 
00247 /* Values are comma-delimited
00248  */
00249 #define SAFE_MODE_PROTECTED_ENV_VARS      "LD_LIBRARY_PATH"
00250 #define SAFE_MODE_ALLOWED_ENV_VARS        "PHP_"
00251 
00252 PHPAPI double php_get_nan(void);
00253 PHPAPI double php_get_inf(void);
00254 
00255 #endif /* BASIC_FUNCTIONS_H */