luat_httpsrv.h 856 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef LUAT_HTTPSRV_H
  2. #define LUAT_HTTPSRV_H
  3. #include "luat_base.h"
  4. typedef struct luat_httpsrv_ctx
  5. {
  6. uint16_t port;
  7. uint16_t https;
  8. char static_path[32];
  9. int lua_ref_id;
  10. int server_fd;
  11. void* userdata;
  12. uint8_t adapter_id;
  13. struct netif* netif;
  14. struct tcp_pcb* pcb;
  15. uint8_t allpath;
  16. }luat_httpsrv_ctx_t;
  17. typedef struct http_code_str
  18. {
  19. int code;
  20. const char* msg;
  21. }http_code_str_t;
  22. // 声明http_codes数组,定义在.c文件中
  23. extern const http_code_str_t g_luat_http_codes[];
  24. typedef struct ct_reg
  25. {
  26. const char* suff;
  27. const char* value;
  28. }ct_reg_t;
  29. luat_httpsrv_ctx_t* luat_httpsrv_malloc(int port, int adapter_index);
  30. int luat_httpsrv_start(luat_httpsrv_ctx_t* ctx);
  31. int luat_httpsrv_free(luat_httpsrv_ctx_t* ctx);
  32. int luat_httpsrv_stop(luat_httpsrv_ctx_t* ctx);
  33. #endif // LUAT_HTTPSRV_H