Mercurial
comparison seobeo/seobeo.h @ 72:4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Mon, 29 Dec 2025 07:50:07 -0800 |
| parents | a0f0ad5e42eb |
| children | c348ac875294 |
comparison
equal
deleted
inserted
replaced
| 71:75de5903355c | 72:4532ce6d9eb8 |
|---|---|
| 61 /* Start a Generic HTTP static file server with given folder. It will store folder into memory. */ | 61 /* Start a Generic HTTP static file server with given folder. It will store folder into memory. */ |
| 62 extern int Seobeo_Web_Server_Start(const char *folder_path, const char *port, Seobeo_ServerMode mode, int thread_count); | 62 extern int Seobeo_Web_Server_Start(const char *folder_path, const char *port, Seobeo_ServerMode mode, int thread_count); |
| 63 /* Generic HTTP GET Rquest to given host and port with path. It will mimic chrome. */ | 63 /* Generic HTTP GET Rquest to given host and port with path. It will mimic chrome. */ |
| 64 extern int Seobeo_Web_Client_Get(const char *host, const char *port, const char *path); | 64 extern int Seobeo_Web_Client_Get(const char *host, const char *port, const char *path); |
| 65 | 65 |
| 66 // --- Router --- // | |
| 67 /* Initialize the router system (called automatically by Seobeo_Web_Server_Start) */ | |
| 68 extern void Seobeo_Router_Init(); | |
| 69 /* Register an API route handler. Call before starting server. */ | |
| 70 extern void Seobeo_Router_Register(const char *method, const char *path_pattern, Seobeo_Route_Handler handler); | |
| 71 /* Clean up router resources */ | |
| 72 extern void Seobeo_Router_Destroy(); | |
| 73 /* Find matching route handler (internal use) */ | |
| 74 extern Seobeo_Route_Handler Seobeo_Router_Find_Handler(const char *method, const char *path, Seobeo_Request_Entry **pp_request_map, Dowa_Arena *p_arena); | |
| 75 /* Send HTTP response from response map (internal use) */ | |
| 76 extern void Seobeo_Router_Send_Response(Seobeo_Handle *p_handle, Seobeo_Request_Entry *p_response_map, Dowa_Arena *p_arena); | |
| 77 | |
| 66 // --- Helper functions --- // | 78 // --- Helper functions --- // |
| 67 /* Destroy handle. It will handle all NULL poointers. */ | 79 /* Destroy handle. It will handle all NULL poointers. */ |
| 68 extern void Seobeo_Handle_Destroy(Seobeo_Handle *p_handle); | 80 extern void Seobeo_Handle_Destroy(Seobeo_Handle *p_handle); |
| 69 /* Write to socket from write_buffer in the handle. */ | 81 /* Write to socket from write_buffer in the handle. */ |
| 70 extern int Seobeo_Handle_Flush(Seobeo_Handle *p_handle); | 82 extern int Seobeo_Handle_Flush(Seobeo_Handle *p_handle); |