PageRenderTime 56ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/ext/standard/basic_functions.h

https://github.com/gmphp/PHP
C Header | 251 lines | 168 code | 50 blank | 33 comment | 4 complexity | cf1b8dc291e625443916db8ddeaf073c MD5 | raw file
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2011 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. /* $Id: basic_functions.h 306939 2011-01-01 02:19:59Z felipe $ */
  20. #ifndef BASIC_FUNCTIONS_H
  21. #define BASIC_FUNCTIONS_H
  22. #include <sys/stat.h>
  23. #ifdef HAVE_WCHAR_H
  24. #include <wchar.h>
  25. #endif
  26. #include "php_filestat.h"
  27. #include "zend_highlight.h"
  28. #include "url_scanner_ex.h"
  29. extern zend_module_entry basic_functions_module;
  30. #define basic_functions_module_ptr &basic_functions_module
  31. PHP_MINIT_FUNCTION(basic);
  32. PHP_MSHUTDOWN_FUNCTION(basic);
  33. PHP_RINIT_FUNCTION(basic);
  34. PHP_RSHUTDOWN_FUNCTION(basic);
  35. PHP_MINFO_FUNCTION(basic);
  36. PHP_FUNCTION(constant);
  37. PHP_FUNCTION(sleep);
  38. PHP_FUNCTION(usleep);
  39. #if HAVE_NANOSLEEP
  40. PHP_FUNCTION(time_nanosleep);
  41. PHP_FUNCTION(time_sleep_until);
  42. #endif
  43. PHP_FUNCTION(flush);
  44. #ifdef HAVE_INET_NTOP
  45. PHP_NAMED_FUNCTION(php_inet_ntop);
  46. #endif
  47. #ifdef HAVE_INET_PTON
  48. PHP_NAMED_FUNCTION(php_inet_pton);
  49. #endif
  50. PHP_FUNCTION(ip2long);
  51. PHP_FUNCTION(long2ip);
  52. /* system functions */
  53. PHP_FUNCTION(getenv);
  54. PHP_FUNCTION(putenv);
  55. PHP_FUNCTION(getopt);
  56. PHP_FUNCTION(get_current_user);
  57. PHP_FUNCTION(set_time_limit);
  58. PHP_FUNCTION(get_cfg_var);
  59. PHP_FUNCTION(import_request_variables);
  60. PHP_FUNCTION(error_log);
  61. PHP_FUNCTION(error_get_last);
  62. PHP_FUNCTION(call_user_func);
  63. PHP_FUNCTION(call_user_func_array);
  64. PHP_FUNCTION(call_user_method);
  65. PHP_FUNCTION(call_user_method_array);
  66. PHP_FUNCTION(forward_static_call);
  67. PHP_FUNCTION(forward_static_call_array);
  68. PHP_FUNCTION(register_shutdown_function);
  69. PHP_FUNCTION(highlight_file);
  70. PHP_FUNCTION(highlight_string);
  71. PHP_FUNCTION(php_strip_whitespace);
  72. ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
  73. PHP_FUNCTION(ini_get);
  74. PHP_FUNCTION(ini_get_all);
  75. PHP_FUNCTION(ini_set);
  76. PHP_FUNCTION(ini_restore);
  77. PHP_FUNCTION(get_include_path);
  78. PHP_FUNCTION(set_include_path);
  79. PHP_FUNCTION(restore_include_path);
  80. PHP_FUNCTION(print_r);
  81. PHP_FUNCTION(fprintf);
  82. PHP_FUNCTION(vfprintf);
  83. PHP_FUNCTION(connection_aborted);
  84. PHP_FUNCTION(connection_status);
  85. PHP_FUNCTION(ignore_user_abort);
  86. PHP_FUNCTION(getservbyname);
  87. PHP_FUNCTION(getservbyport);
  88. PHP_FUNCTION(getprotobyname);
  89. PHP_FUNCTION(getprotobynumber);
  90. PHP_NAMED_FUNCTION(php_if_crc32);
  91. PHP_FUNCTION(register_tick_function);
  92. PHP_FUNCTION(unregister_tick_function);
  93. #ifdef HAVE_GETLOADAVG
  94. PHP_FUNCTION(sys_getloadavg);
  95. #endif
  96. PHP_FUNCTION(is_uploaded_file);
  97. PHP_FUNCTION(move_uploaded_file);
  98. /* From the INI parser */
  99. PHP_FUNCTION(parse_ini_file);
  100. PHP_FUNCTION(parse_ini_string);
  101. #if ZEND_DEBUG
  102. PHP_FUNCTION(config_get_hash);
  103. #endif
  104. PHP_FUNCTION(str_rot13);
  105. PHP_FUNCTION(stream_get_filters);
  106. PHP_FUNCTION(stream_filter_register);
  107. PHP_FUNCTION(stream_bucket_make_writeable);
  108. PHP_FUNCTION(stream_bucket_prepend);
  109. PHP_FUNCTION(stream_bucket_append);
  110. PHP_FUNCTION(stream_bucket_new);
  111. PHP_MINIT_FUNCTION(user_filters);
  112. PHP_RSHUTDOWN_FUNCTION(user_filters);
  113. /* Left for BC (not binary safe!) */
  114. PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
  115. PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC);
  116. PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC);
  117. #if SIZEOF_INT == 4
  118. /* Most 32-bit and 64-bit systems have 32-bit ints */
  119. typedef unsigned int php_uint32;
  120. typedef signed int php_int32;
  121. #elif SIZEOF_LONG == 4
  122. /* 16-bit systems? */
  123. typedef unsigned long php_uint32;
  124. typedef signed long php_int32;
  125. #else
  126. #error Need type which holds 32 bits
  127. #endif
  128. #define MT_N (624)
  129. typedef struct _php_basic_globals {
  130. HashTable *user_shutdown_function_names;
  131. HashTable putenv_ht;
  132. zval *strtok_zval;
  133. char *strtok_string;
  134. char *locale_string;
  135. char *strtok_last;
  136. char strtok_table[256];
  137. ulong strtok_len;
  138. char str_ebuf[40];
  139. zend_fcall_info array_walk_fci;
  140. zend_fcall_info_cache array_walk_fci_cache;
  141. zend_fcall_info user_compare_fci;
  142. zend_fcall_info_cache user_compare_fci_cache;
  143. zend_llist *user_tick_functions;
  144. zval *active_ini_file_section;
  145. HashTable sm_protected_env_vars;
  146. char *sm_allowed_env_vars;
  147. /* pageinfo.c */
  148. long page_uid;
  149. long page_gid;
  150. long page_inode;
  151. time_t page_mtime;
  152. /* filestat.c && main/streams/streams.c */
  153. char *CurrentStatFile, *CurrentLStatFile;
  154. php_stream_statbuf ssb, lssb;
  155. /* rand.c */
  156. php_uint32 state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */
  157. php_uint32 *next; /* next random value is computed from here */
  158. int left; /* can *next++ this many times before reloading */
  159. unsigned int rand_seed; /* Seed for rand(), in ts version */
  160. zend_bool rand_is_seeded; /* Whether rand() has been seeded */
  161. zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */
  162. /* syslog.c */
  163. int syslog_started;
  164. char *syslog_device;
  165. /* var.c */
  166. zend_class_entry *incomplete_class;
  167. /* url_scanner_ex.re */
  168. url_adapt_state_ex_t url_adapt_state_ex;
  169. #ifdef HAVE_MMAP
  170. void *mmap_file;
  171. size_t mmap_len;
  172. #endif
  173. HashTable *user_filter_map;
  174. /* file.c */
  175. #if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
  176. mbstate_t mblen_state;
  177. #endif
  178. int umask;
  179. } php_basic_globals;
  180. #ifdef ZTS
  181. #define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
  182. PHPAPI extern int basic_globals_id;
  183. #else
  184. #define BG(v) (basic_globals.v)
  185. PHPAPI extern php_basic_globals basic_globals;
  186. #endif
  187. #if HAVE_PUTENV
  188. typedef struct {
  189. char *putenv_string;
  190. char *previous_value;
  191. char *key;
  192. int key_len;
  193. } putenv_entry;
  194. #endif
  195. /* Values are comma-delimited
  196. */
  197. #define SAFE_MODE_PROTECTED_ENV_VARS "LD_LIBRARY_PATH"
  198. #define SAFE_MODE_ALLOWED_ENV_VARS "PHP_"
  199. PHPAPI double php_get_nan(void);
  200. PHPAPI double php_get_inf(void);
  201. #endif /* BASIC_FUNCTIONS_H */