frankenphp.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef _FRANKENPPHP_H
  2. #define _FRANKENPPHP_H
  3. #include <Zend/zend_types.h>
  4. #include <stdbool.h>
  5. #include <stdint.h>
  6. #ifndef FRANKENPHP_VERSION
  7. #define FRANKENPHP_VERSION dev
  8. #endif
  9. #define STRINGIFY(x) #x
  10. #define TOSTRING(x) STRINGIFY(x)
  11. typedef struct go_string {
  12. size_t len;
  13. char *data;
  14. } go_string;
  15. typedef struct ht_key_value_pair {
  16. zend_string *key;
  17. char *val;
  18. size_t val_len;
  19. } ht_key_value_pair;
  20. typedef struct php_variable {
  21. const char *var;
  22. size_t data_len;
  23. char *data;
  24. } php_variable;
  25. typedef struct frankenphp_version {
  26. unsigned char major_version;
  27. unsigned char minor_version;
  28. unsigned char release_version;
  29. const char *extra_version;
  30. const char *version;
  31. unsigned long version_id;
  32. } frankenphp_version;
  33. frankenphp_version frankenphp_get_version();
  34. typedef struct frankenphp_config {
  35. frankenphp_version version;
  36. bool zts;
  37. bool zend_signals;
  38. bool zend_max_execution_timers;
  39. } frankenphp_config;
  40. frankenphp_config frankenphp_get_config();
  41. int frankenphp_new_main_thread(int num_threads);
  42. bool frankenphp_new_php_thread(uintptr_t thread_index);
  43. int frankenphp_update_server_context(
  44. bool create, bool has_main_request, bool has_active_request,
  45. const char *request_method, char *query_string, zend_long content_length,
  46. char *path_translated, char *request_uri, const char *content_type,
  47. char *auth_user, char *auth_password, int proto_num);
  48. int frankenphp_request_startup();
  49. int frankenphp_execute_script(char *file_name);
  50. int frankenphp_execute_script_cli(char *script, int argc, char **argv);
  51. int frankenphp_execute_php_function(const char *php_function);
  52. void frankenphp_register_variables_from_request_info(
  53. zval *track_vars_array, zend_string *content_type,
  54. zend_string *path_translated, zend_string *query_string,
  55. zend_string *auth_user, zend_string *request_method);
  56. void frankenphp_register_variable_safe(char *key, char *var, size_t val_len,
  57. zval *track_vars_array);
  58. zend_string *frankenphp_init_persistent_string(const char *string, size_t len);
  59. void frankenphp_release_zend_string(zend_string *z_string);
  60. int frankenphp_reset_opcache(void);
  61. void frankenphp_register_single(zend_string *z_key, char *value, size_t val_len,
  62. zval *track_vars_array);
  63. void frankenphp_register_bulk(
  64. zval *track_vars_array, ht_key_value_pair remote_addr,
  65. ht_key_value_pair remote_host, ht_key_value_pair remote_port,
  66. ht_key_value_pair document_root, ht_key_value_pair path_info,
  67. ht_key_value_pair php_self, ht_key_value_pair document_uri,
  68. ht_key_value_pair script_filename, ht_key_value_pair script_name,
  69. ht_key_value_pair https, ht_key_value_pair ssl_protocol,
  70. ht_key_value_pair request_scheme, ht_key_value_pair server_name,
  71. ht_key_value_pair server_port, ht_key_value_pair content_length,
  72. ht_key_value_pair gateway_interface, ht_key_value_pair server_protocol,
  73. ht_key_value_pair server_software, ht_key_value_pair http_host,
  74. ht_key_value_pair auth_type, ht_key_value_pair remote_ident,
  75. ht_key_value_pair request_uri);
  76. #endif