frankenphp.h 2.1 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_init(int num_threads);
  37. int frankenphp_update_server_context(
  38. bool create, bool has_main_request, bool has_active_request,
  39. const char *request_method, char *query_string, zend_long content_length,
  40. char *path_translated, char *request_uri, const char *content_type,
  41. char *auth_user, char *auth_password, int proto_num);
  42. int frankenphp_request_startup();
  43. int frankenphp_execute_script(char *file_name);
  44. int frankenphp_execute_script_cli(char *script, int argc, char **argv);
  45. int frankenphp_execute_php_function(const char *php_function);
  46. void frankenphp_register_variables_from_request_info(
  47. zval *track_vars_array, zend_string *content_type,
  48. zend_string *path_translated, zend_string *query_string,
  49. zend_string *auth_user, zend_string *request_method,
  50. zend_string *request_uri);
  51. void frankenphp_register_variable_safe(char *key, char *var, size_t val_len,
  52. zval *track_vars_array);
  53. void frankenphp_register_trusted_var(zend_string *z_key, char *value,
  54. int val_len, zval *track_vars_array);
  55. zend_string *frankenphp_init_persistent_string(const char *string, size_t len);
  56. void frankenphp_release_zend_string(zend_string *z_string);
  57. int frankenphp_reset_opcache(void);
  58. #endif