comparison seobeo/seobeo.h @ 195:f8f5004a920a

Merging back hg-web-tip
author MrJuneJune <me@mrjunejune.com>
date Tue, 27 Jan 2026 06:51:44 -0800
parents 8cf4ec5e2191
children
comparison
equal deleted inserted replaced
189:14cc84ba35a0 195:f8f5004a920a
89 /* Destroy request and free all resources. */ 89 /* Destroy request and free all resources. */
90 extern void Seobeo_Client_Request_Destroy(Seobeo_Client_Request *p_req); 90 extern void Seobeo_Client_Request_Destroy(Seobeo_Client_Request *p_req);
91 /* Destroy response and free all resources. */ 91 /* Destroy response and free all resources. */
92 extern void Seobeo_Client_Response_Destroy(Seobeo_Client_Response *p_resp); 92 extern void Seobeo_Client_Response_Destroy(Seobeo_Client_Response *p_resp);
93 93
94 // --- HTTP Web related helper functions --- //
95 extern void Seobeo_Url_Decode(char *dst, const char *src);
96
94 /** 97 /**
95 * WebSocket Client API 98 * WebSocket Client API
96 * ------ 99 * ------
97 * 100 *
98 * # Overview 101 * # Overview
322 extern void Seobeo_WebSocket_Server_Broadcast_Binary(const uint8 *data, size_t length); 325 extern void Seobeo_WebSocket_Server_Broadcast_Binary(const uint8 *data, size_t length);
323 /* Close WebSocket connection with status code and reason. */ 326 /* Close WebSocket connection with status code and reason. */
324 extern void Seobeo_WebSocket_Server_Connection_Close(Seobeo_WebSocket_Server_Connection *p_conn, uint16 code, const char *reason); 327 extern void Seobeo_WebSocket_Server_Connection_Close(Seobeo_WebSocket_Server_Connection *p_conn, uint16 code, const char *reason);
325 328
326 /* Initialize the router system (called automatically by Seobeo_Web_Server_Start) */ 329 /* Initialize the router system (called automatically by Seobeo_Web_Server_Start) */
327 extern void Seobeo_Router_Init(); 330 extern void Seobeo_Router_Init();
328 /* Register an API route handler. Call before starting server. */ 331 /* Register an API route handler. Call before starting server. */
329 extern void Seobeo_Router_Register(const char *method, const char *path_pattern, Seobeo_Route_Handler handler); 332 extern void Seobeo_Router_Register(const char *method, const char *path_pattern, Seobeo_Route_Handler handler);
333 /* Register a streaming route handler. Handler receives client handle for direct streaming. */
334 extern void Seobeo_Router_Register_Stream(const char *method, const char *path_pattern, Seobeo_Stream_Handler handler);
330 /* Clean up router resources */ 335 /* Clean up router resources */
331 extern void Seobeo_Router_Destroy(); 336 extern void Seobeo_Router_Destroy();
332 /* Find matching route handler (internal use) */ 337 /* Find matching route handler (internal use) */
333 extern Seobeo_Route_Handler Seobeo_Router_Find_Handler(const char *method, const char *path, Seobeo_Request_Entry **pp_request_map, Dowa_Arena *p_arena); 338 extern Seobeo_Route_Handler Seobeo_Router_Find_Handler(const char *method, const char *path, Seobeo_Request_Entry **pp_request_map, Dowa_Arena *p_arena);
334 /* Send HTTP response from response map (internal use) */ 339 /* Send HTTP response from response map (internal use) */
335 extern void Seobeo_Router_Send_Response(Seobeo_Handle *p_handle, Seobeo_Request_Entry *p_response_map, Dowa_Arena *p_arena); 340 extern void Seobeo_Router_Send_Response(Seobeo_Handle *p_handle, Seobeo_Request_Entry *p_response_map, Dowa_Arena *p_arena);
336 /* Send HTTP response with keep-alive option */ 341 /* Send HTTP response with keep-alive option */
337 extern void Seobeo_Router_Send_Response_KeepAlive(Seobeo_Handle *p_handle, Seobeo_Request_Entry *p_response_map, Dowa_Arena *p_arena, boolean keep_alive); 342 extern void Seobeo_Router_Send_Response_KeepAlive(Seobeo_Handle *p_handle, Seobeo_Request_Entry *p_response_map, Dowa_Arena *p_arena, boolean keep_alive);
338 extern char *Seobeo_Web_LoadFile(const char *file_path, size_t *p_file_size); 343 extern char *Seobeo_Web_LoadFile(const char *file_path, size_t *p_file_size);
344 /* Being a proxy and keeping the client open */
345 extern Seobeo_Stream_Handler Seobeo_Router_Find_Stream_Handler(const char *method, const char *path, Seobeo_Request_Entry **pp_request_map, Dowa_Arena *p_arena);
339 346
340 // --- Helper functions --- // 347 // --- Helper functions --- //
341 /* Destroy handle. It will handle all NULL poointers. */ 348 /* Destroy handle. It will handle all NULL poointers. */
342 extern void Seobeo_Handle_Destroy(Seobeo_Handle *p_handle); 349 extern void Seobeo_Handle_Destroy(Seobeo_Handle *p_handle);
343 /* Write to socket from write_buffer in the handle. */ 350 /* Write to socket from write_buffer in the handle. */