root/ext/standard/basic_functions.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 5                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 The PHP Group                                |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 3.01 of the PHP license,      |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.php.net/license/3_01.txt                                  |
  11    | If you did not receive a copy of the PHP license and are unable to   |
  12    | obtain it through the world-wide-web, please send a note to          |
  13    | license@php.net so we can mail you a copy immediately.               |
  14    +----------------------------------------------------------------------+
  15    | Authors: Andi Gutmans <andi@zend.com>                                |
  16    |          Zeev Suraski <zeev@zend.com>                                |
  17    +----------------------------------------------------------------------+
  18 */
  19 
  20 /* $Id$ */
  21 
  22 #ifndef BASIC_FUNCTIONS_H
  23 #define BASIC_FUNCTIONS_H
  24 
  25 #include <sys/stat.h>
  26 
  27 #ifdef HAVE_WCHAR_H
  28 #include <wchar.h>
  29 #endif
  30 
  31 #include "php_filestat.h"
  32 
  33 #include "zend_highlight.h"
  34 
  35 #include "url_scanner_ex.h"
  36 
  37 extern zend_module_entry basic_functions_module;
  38 #define basic_functions_module_ptr &basic_functions_module
  39 
  40 PHP_MINIT_FUNCTION(basic);
  41 PHP_MSHUTDOWN_FUNCTION(basic);
  42 PHP_RINIT_FUNCTION(basic);
  43 PHP_RSHUTDOWN_FUNCTION(basic);
  44 PHP_MINFO_FUNCTION(basic);
  45 
  46 PHP_FUNCTION(constant);
  47 PHP_FUNCTION(sleep);
  48 PHP_FUNCTION(usleep);
  49 #if HAVE_NANOSLEEP
  50 PHP_FUNCTION(time_nanosleep);
  51 PHP_FUNCTION(time_sleep_until);
  52 #endif
  53 PHP_FUNCTION(flush);
  54 #ifdef HAVE_INET_NTOP
  55 PHP_NAMED_FUNCTION(php_inet_ntop);
  56 #endif
  57 #ifdef HAVE_INET_PTON
  58 PHP_NAMED_FUNCTION(php_inet_pton);
  59 #endif
  60 PHP_FUNCTION(ip2long);
  61 PHP_FUNCTION(long2ip);
  62 
  63 /* system functions */
  64 PHP_FUNCTION(getenv);
  65 PHP_FUNCTION(putenv);
  66 
  67 PHP_FUNCTION(getopt);
  68 
  69 PHP_FUNCTION(get_current_user);
  70 PHP_FUNCTION(set_time_limit);
  71 
  72 PHP_FUNCTION(header_register_callback);
  73 
  74 PHP_FUNCTION(get_cfg_var);
  75 PHP_FUNCTION(set_magic_quotes_runtime);
  76 PHP_FUNCTION(get_magic_quotes_runtime);
  77 PHP_FUNCTION(get_magic_quotes_gpc);
  78 
  79 PHP_FUNCTION(error_log);
  80 PHP_FUNCTION(error_get_last);
  81 
  82 PHP_FUNCTION(call_user_func);
  83 PHP_FUNCTION(call_user_func_array);
  84 PHP_FUNCTION(call_user_method);
  85 PHP_FUNCTION(call_user_method_array);
  86 PHP_FUNCTION(forward_static_call);
  87 PHP_FUNCTION(forward_static_call_array);
  88 
  89 PHP_FUNCTION(register_shutdown_function);
  90 PHP_FUNCTION(highlight_file);
  91 PHP_FUNCTION(highlight_string);
  92 PHP_FUNCTION(php_strip_whitespace);
  93 ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
  94 
  95 PHP_FUNCTION(ini_get);
  96 PHP_FUNCTION(ini_get_all);
  97 PHP_FUNCTION(ini_set);
  98 PHP_FUNCTION(ini_restore);
  99 PHP_FUNCTION(get_include_path);
 100 PHP_FUNCTION(set_include_path);
 101 PHP_FUNCTION(restore_include_path);
 102 
 103 PHP_FUNCTION(print_r);
 104 PHP_FUNCTION(fprintf);
 105 PHP_FUNCTION(vfprintf);
 106 
 107 PHP_FUNCTION(connection_aborted);
 108 PHP_FUNCTION(connection_status);
 109 PHP_FUNCTION(ignore_user_abort);
 110 
 111 PHP_FUNCTION(getservbyname);
 112 PHP_FUNCTION(getservbyport);
 113 PHP_FUNCTION(getprotobyname);
 114 PHP_FUNCTION(getprotobynumber);
 115 
 116 PHP_NAMED_FUNCTION(php_if_crc32);
 117 
 118 PHP_FUNCTION(register_tick_function);
 119 PHP_FUNCTION(unregister_tick_function);
 120 #ifdef HAVE_GETLOADAVG
 121 PHP_FUNCTION(sys_getloadavg);
 122 #endif
 123 
 124 PHP_FUNCTION(is_uploaded_file);
 125 PHP_FUNCTION(move_uploaded_file);
 126 
 127 /* From the INI parser */
 128 PHP_FUNCTION(parse_ini_file);
 129 PHP_FUNCTION(parse_ini_string);
 130 #if ZEND_DEBUG
 131 PHP_FUNCTION(config_get_hash);
 132 #endif
 133 
 134 PHP_FUNCTION(str_rot13);
 135 PHP_FUNCTION(stream_get_filters);
 136 PHP_FUNCTION(stream_filter_register);
 137 PHP_FUNCTION(stream_bucket_make_writeable);
 138 PHP_FUNCTION(stream_bucket_prepend);
 139 PHP_FUNCTION(stream_bucket_append);
 140 PHP_FUNCTION(stream_bucket_new);
 141 PHP_MINIT_FUNCTION(user_filters);
 142 PHP_RSHUTDOWN_FUNCTION(user_filters);
 143 PHP_RSHUTDOWN_FUNCTION(browscap);
 144 
 145 /* Left for BC (not binary safe!) */
 146 PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
 147 PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC);
 148 PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC);
 149 
 150 #if SIZEOF_INT == 4
 151 /* Most 32-bit and 64-bit systems have 32-bit ints */
 152 typedef unsigned int php_uint32;
 153 typedef signed int php_int32;
 154 #elif SIZEOF_LONG == 4
 155 /* 16-bit systems? */
 156 typedef unsigned long php_uint32;
 157 typedef signed long php_int32;
 158 #else
 159 #error Need type which holds 32 bits
 160 #endif
 161 
 162 #define MT_N (624)
 163 
 164 typedef struct _php_basic_globals {
 165         HashTable *user_shutdown_function_names;
 166         HashTable putenv_ht;
 167         zval *strtok_zval;
 168         char *strtok_string;
 169         char *locale_string;
 170         char *strtok_last;
 171         char strtok_table[256];
 172         ulong strtok_len;
 173         char str_ebuf[40];
 174         zend_fcall_info array_walk_fci;
 175         zend_fcall_info_cache array_walk_fci_cache;
 176         zend_fcall_info user_compare_fci;
 177         zend_fcall_info_cache user_compare_fci_cache;
 178         zend_llist *user_tick_functions;
 179 
 180         zval *active_ini_file_section;
 181         
 182         /* pageinfo.c */
 183         long page_uid;
 184         long page_gid;
 185         long page_inode;
 186         time_t page_mtime;
 187 
 188         /* filestat.c && main/streams/streams.c */
 189         char *CurrentStatFile, *CurrentLStatFile;
 190         php_stream_statbuf ssb, lssb;
 191 
 192         /* rand.c */
 193         php_uint32   state[MT_N+1];  /* state vector + 1 extra to not violate ANSI C */
 194         php_uint32   *next;       /* next random value is computed from here */
 195         int      left;        /* can *next++ this many times before reloading */
 196 
 197         unsigned int rand_seed; /* Seed for rand(), in ts version */
 198 
 199         zend_bool rand_is_seeded; /* Whether rand() has been seeded */
 200         zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */
 201     
 202         /* syslog.c */
 203         char *syslog_device;
 204 
 205         /* var.c */
 206         zend_class_entry *incomplete_class;
 207         unsigned serialize_lock; /* whether to use the locally supplied var_hash instead (__sleep/__wakeup) */
 208         struct {
 209                 void *var_hash;
 210                 unsigned level;
 211         } serialize;
 212         struct {
 213                 void *var_hash;
 214                 unsigned level;
 215         } unserialize;
 216 
 217         /* url_scanner_ex.re */
 218         url_adapt_state_ex_t url_adapt_state_ex;
 219 
 220 #ifdef HAVE_MMAP
 221         void *mmap_file;
 222         size_t mmap_len;
 223 #endif
 224 
 225         HashTable *user_filter_map;
 226 
 227         /* file.c */
 228 #if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
 229         mbstate_t mblen_state;
 230 #endif
 231 
 232         int umask;
 233 } php_basic_globals;
 234 
 235 #ifdef ZTS
 236 #define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
 237 PHPAPI extern int basic_globals_id;
 238 #else
 239 #define BG(v) (basic_globals.v)
 240 PHPAPI extern php_basic_globals basic_globals;
 241 #endif
 242 
 243 #if HAVE_PUTENV
 244 typedef struct {
 245         char *putenv_string;
 246         char *previous_value;
 247         char *key;
 248         int key_len;
 249 } putenv_entry;
 250 #endif
 251 
 252 PHPAPI double php_get_nan(void);
 253 PHPAPI double php_get_inf(void);
 254 
 255 typedef struct _php_shutdown_function_entry {
 256         zval **arguments;
 257         int arg_count;
 258 } php_shutdown_function_entry;
 259 
 260 PHPAPI extern zend_bool register_user_shutdown_function(char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC);
 261 PHPAPI extern zend_bool remove_user_shutdown_function(char *function_name, size_t function_len TSRMLS_DC);
 262 PHPAPI extern zend_bool append_user_shutdown_function(php_shutdown_function_entry shutdown_function_entry TSRMLS_DC);
 263 
 264 PHPAPI void php_call_shutdown_functions(TSRMLS_D);
 265 PHPAPI void php_free_shutdown_functions(TSRMLS_D);
 266 
 267 
 268 #endif /* BASIC_FUNCTIONS_H */

/* [<][>][^][v][top][bottom][index][help] */