123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #ifndef HTTP_SERVER_H_INCLUDED
- #define HTTP_SERVER_H_INCLUDED
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <stdbool.h>
- #include "esp_http_server.h"
- #include "wifi_manager.h"
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "freertos/event_groups.h"
- #include "esp_wifi.h"
- #include <esp_event.h>
- #include "nvs_flash.h"
- #include "esp_log.h"
- #include "driver/gpio.h"
- #include "mdns.h"
- #include "lwip/api.h"
- #include "lwip/err.h"
- #include "lwip/netdb.h"
- #include "lwip/opt.h"
- #include "lwip/memp.h"
- #include "lwip/ip.h"
- #include "lwip/raw.h"
- #include "lwip/udp.h"
- #include "lwip/priv/api_msg.h"
- #include "lwip/priv/tcp_priv.h"
- #include "lwip/priv/tcpip_priv.h"
- #include "esp_vfs.h"
- #include "esp_console.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define ESP_LOGE_LOC(t,str, ...) ESP_LOGE(t, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__)
- #define ESP_LOGI_LOC(t,str, ...) ESP_LOGI(t, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__)
- #define ESP_LOGD_LOC(t,str, ...) ESP_LOGD(t, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__)
- #define ESP_LOGW_LOC(t,str, ...) ESP_LOGW(t, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__)
- #define ESP_LOGV_LOC(t,str, ...) ESP_LOGV(t, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__)
- esp_err_t root_get_handler(httpd_req_t *req);
- esp_err_t resource_filehandler(httpd_req_t *req);
- esp_err_t resource_filehandler(httpd_req_t *req);
- esp_err_t resource_filehandler(httpd_req_t *req);
- esp_err_t resource_filehandler(httpd_req_t *req);
- esp_err_t resource_filehandler(httpd_req_t *req);
- esp_err_t resource_filehandler(httpd_req_t *req);
- esp_err_t ap_get_handler(httpd_req_t *req);
- esp_err_t config_get_handler(httpd_req_t *req);
- esp_err_t config_post_handler(httpd_req_t *req);
- esp_err_t connect_post_handler(httpd_req_t *req);
- esp_err_t connect_delete_handler(httpd_req_t *req);
- esp_err_t reboot_ota_post_handler(httpd_req_t *req);
- esp_err_t reboot_post_handler(httpd_req_t *req);
- esp_err_t recovery_post_handler(httpd_req_t *req);
- esp_err_t flash_post_handler(httpd_req_t *req);
- esp_err_t status_get_handler(httpd_req_t *req);
- esp_err_t messages_get_handler(httpd_req_t *req);
- esp_err_t console_cmd_get_handler(httpd_req_t *req);
- esp_err_t ap_scan_handler(httpd_req_t *req);
- esp_err_t redirect_ev_handler(httpd_req_t *req);
- esp_err_t redirect_200_ev_handler(httpd_req_t *req);
- esp_err_t err_handler(httpd_req_t *req, httpd_err_code_t error);
- #define SCRATCH_BUFSIZE (10240)
- #define FILE_PATH_MAX (ESP_VFS_PATH_MAX + 128)
- typedef struct rest_server_context {
- char base_path[ESP_VFS_PATH_MAX + 1];
- char scratch[SCRATCH_BUFSIZE];
- } rest_server_context_t;
- void http_server(void *pvParameters);
- void http_server_netconn_serve(struct netconn *conn);
- esp_err_t http_server_start();
- char* http_server_get_header(char *request, char *header_name, int *len);
- void strreplace(char *src, char *str, char *rep);
- bool http_server_lock_json_object(TickType_t xTicksToWait);
- void http_server_unlock_json_object();
- #define PROTECTED_JSON_CALL(a) if(http_server_lock_json_object( portMAX_DELAY )){ \ a; http_server_unlocklock_json_object(); } else{ ESP_LOGE(TAG, "could not get access to json mutex in wifi_scan"); }
- #ifdef __cplusplus
- }
- #endif
- #endif
|