18#include <unordered_map>
23#define HTTP_STACK_SIZE 10 * 1024 / sizeof(StackType_t)
90 size_t& contentLength, std::unordered_map<std::string, std::string>& headers);
HTTP routing with middleware and optional JWT-based authorization. Part of the PicoFramework HTTP ser...
Forward declaration for potential routing needs.
HTTP Server that listens for incoming connections and dispatches requests.
bool initNetwork()
Initialize the network stack (wait for DHCP or static IP).
static void startServerTask(void *pvParameters)
Launch the HTTP server task (used by FreeRTOS).
HttpRequest receiveRequest(Tcp *conn, char *method, char *path, std::string &body, size_t &contentLength, std::unordered_map< std::string, std::string > &headers)
Receive an HTTP request and parse key components.
static constexpr int BUFFER_SIZE
void handleClient(Tcp *conn)
Accept a client connection and handle it directly (not task-based).
static StackType_t xStack[HTTP_STACK_SIZE]
Stack for static FreeRTOS task.
static constexpr int BOUNDARY_MAX_LEN
Router & getRouter()
Return the router associated with the server.
Tcp * initListener()
Create, bind, and listen on the server.
int port
Accept client connections in a blocking loop and spawn handlers.
void startHandlingClient(Tcp *conn)
Spawn a task to handle the client connection.
Router & router
Reference to router for dispatching requests.
static void handleClientTask(void *pvParameters)
Handle client logic inside a FreeRTOS task.
static StaticTask_t xTaskBuffer
Task control block buffer.
bool start()
Start the HTTP server as a FreeRTOS task.
void run()
Main server loop: initializes, binds, and begins accepting connections.
The central router for handling HTTP requests and middleware.
General-purpose TCP socket wrapper with optional TLS support via mbedTLS (altcp).