diff seobeo/seobeo_internal.h @ 71:75de5903355c

Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
author June Park <parkjune1995@gmail.com>
date Sun, 28 Dec 2025 20:34:22 -0800
parents 6626ec933933
children 4532ce6d9eb8
line wrap: on
line diff
--- a/seobeo/seobeo_internal.h	Thu Dec 25 20:10:46 2025 -0800
+++ b/seobeo/seobeo_internal.h	Sun Dec 28 20:34:22 2025 -0800
@@ -1,7 +1,6 @@
 #ifndef SEOBEO_SERVER_INTERNAL_H
 #define SEOBEO_SERVER_INTERNAL_H
 
-// SSL - conditionally included
 #ifndef SEOBEO_NO_SSL
 #include <openssl/ssl.h>
 #include <openssl/err.h>
@@ -49,9 +48,12 @@
   atomic_bool destroyed;
 } Seobeo_Handle;
 
+// HTML cache type: maps file paths (char*) to file contents (char*)
+typedef Dowa_KV(char*, char*) Seobeo_Cache_Entry;
+
 typedef struct {
-  Seobeo_Handle  *srv;
-  Dowa_HashMap   *cache;
+  Seobeo_Handle       *srv;
+  Seobeo_Cache_Entry  *cache;
 } WorkerArgs;
 
 typedef enum {
@@ -60,13 +62,14 @@
 } Seobeo_ServerMode;
 
 
-
+// HTTP request map type: maps header names to header values
+typedef Dowa_KV(char*, char*) Seobeo_Request_Entry;
 
 // --- Parse Header into Dowa Map ---//
-extern int            Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Dowa_HashMap *map);
+extern int            Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Seobeo_Request_Entry **pp_map, Dowa_Arena *p_arena);
 
 // --- Handle Request --- //
-extern void           Seobeo_Web_HandleClientRequest(Seobeo_Handle *cli, Dowa_HashMap *p_html_cache);
+extern void           Seobeo_Web_HandleClientRequest(Seobeo_Handle *cli, Seobeo_Cache_Entry *p_html_cache);
 
 // --- SSL --- //
 extern void           Seobeo_Web_SSL_Init();
@@ -77,8 +80,7 @@
 extern int32          Seobeo_SSL_Read(Seobeo_Handle *p_handle, uint8 *buffer, uint32 length);
 
 // --- Serving using Edge --- //
-extern void          *Seobeo_Web_Edge_Worker(void *vargs); 
-extern void           Seobeo_Web_Edge(Seobeo_Handle *p_server_handle, int thread_count, Dowa_HashMap *p_html_cache);
-extern void           Seobeo_Web_Edge_2(Seobeo_Handle *p_server_handle, Dowa_HashMap *p_html_cache);
+extern void          *Seobeo_Web_Edge_Worker(void *vargs);
+extern void           Seobeo_Web_Edge(Seobeo_Handle *p_server_handle, int thread_count, Seobeo_Cache_Entry *p_html_cache);
 
 #endif