Mercurial
diff seobeo/seobeo_internal.h @ 19:875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Mon, 06 Oct 2025 09:55:34 -0700 |
| parents | adcfad6e86fb |
| children | 84672efec192 |
line wrap: on
line diff
--- a/seobeo/seobeo_internal.h Mon Oct 06 08:21:34 2025 -0700 +++ b/seobeo/seobeo_internal.h Mon Oct 06 09:55:34 2025 -0700 @@ -0,0 +1,71 @@ +#ifndef SEOBEO_SERVER_INTERNAL_H +#define SEOBEO_SERVER_INTERNAL_H + +// SSL +#include <openssl/ssl.h> +#include <openssl/err.h> + +#include "dowa/dowa.h" + +typedef enum { + SEOBEO_STREAM_TYPE_SERVER, + SEOBEO_STREAM_TYPE_CLIENT, +} Seobeo_SocketType; + +typedef struct { + int32 socket; + Seobeo_SocketType type; + boolean connected; + + char *host; + char *port; + + SSL_CTX *ssl_ctx; + SSL *ssl; + + uint8 *read_buffer; + uint32 read_buffer_capacity; + uint32 read_buffer_len; // current size + uint32 read_buffer_used; // TODO: Implement this for client + + uint8 *write_buffer; + uint32 write_buffer_capacity; + uint32 write_buffer_len; // current size + + void *file; + void *text_copy; + char *file_name; + + atomic_bool destroyed; +} Sebeo_Handle, *Seobeo_PHandle; + +typedef struct { + Seobeo_PHandle srv; + Dowa_PHashMap cache; + int evfd; // epoll‐fd or kqueue‐fd +} WorkerArgs; + +typedef enum { + SEOBEO_MODE_FORK, + SEOBEO_MODE_EDGE, +} Seobeo_ServerMode; + + + + +// --- Parse Header into Dowa Map ---// +extern int Seobeo_Web_Header_Parse(Seobeo_PHandle p_handle, Dowa_PHashMap map); + +// --- Handle Request --- // +extern void Seobeo_Web_HandleClientRequest(Seobeo_PHandle cli, Dowa_PHashMap p_html_cache); + +// --- SSL --- // +extern void Seobeo_Web_SSL_Init(); +extern void Seobeo_Web_SSL_Cleanup(); // Not used + +// --- Serving using Edge --- // +extern void *Seobeo_Web_Edge_Worker(void *vargs); +extern void Seobeo_Web_Edge(Seobeo_PHandle p_server_handle, int thread_count, Dowa_PHashMap p_html_cache); + +#endif +