frankenphp.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 php_variable {
  16. const char *var;
  17. size_t data_len;
  18. char *data;
  19. } php_variable;
  20. typedef struct frankenphp_version {
  21. unsigned char major_version;
  22. unsigned char minor_version;
  23. unsigned char release_version;
  24. const char *extra_version;
  25. const char *version;
  26. unsigned long version_id;
  27. } frankenphp_version;
  28. frankenphp_version frankenphp_get_version();
  29. typedef struct frankenphp_config {
  30. frankenphp_version version;
  31. bool zts;
  32. bool zend_signals;
  33. bool zend_max_execution_timers;
  34. } frankenphp_config;
  35. frankenphp_config frankenphp_get_config();
  36. int frankenphp_new_main_thread(int num_threads);
  37. bool frankenphp_new_php_thread(uintptr_t thread_index);
  38. int frankenphp_update_server_context(
  39. bool create, bool has_main_request, bool has_active_request,
  40. const char *request_method, char *query_string, zend_long content_length,
  41. char *path_translated, char *request_uri, const char *content_type,
  42. char *auth_user, char *auth_password, int proto_num);
  43. int frankenphp_request_startup();
  44. int frankenphp_execute_script(char *file_name);
  45. int frankenphp_execute_script_cli(char *script, int argc, char **argv);
  46. int frankenphp_execute_php_function(const char *php_function);
  47. void frankenphp_register_variables_from_request_info(
  48. zval *track_vars_array, zend_string *content_type,
  49. zend_string *path_translated, zend_string *query_string,
  50. zend_string *auth_user, zend_string *request_method,
  51. zend_string *request_uri);
  52. void frankenphp_register_variable_safe(char *key, char *var, size_t val_len,
  53. zval *track_vars_array);
  54. void frankenphp_register_trusted_var(zend_string *z_key, char *value,
  55. int val_len, zval *track_vars_array);
  56. zend_string *frankenphp_init_persistent_string(const char *string, size_t len);
  57. void frankenphp_release_zend_string(zend_string *z_string);
  58. int frankenphp_reset_opcache(void);
  59. #endif