Mercurial
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 18:fa2b8af609d9 | 19:875bb6e10db7 |
|---|---|
| 1 #ifndef SEOBEO_SERVER_INTERNAL_H | |
| 2 #define SEOBEO_SERVER_INTERNAL_H | |
| 3 | |
| 4 // SSL | |
| 5 #include <openssl/ssl.h> | |
| 6 #include <openssl/err.h> | |
| 7 | |
| 8 #include "dowa/dowa.h" | |
| 9 | |
| 10 typedef enum { | |
| 11 SEOBEO_STREAM_TYPE_SERVER, | |
| 12 SEOBEO_STREAM_TYPE_CLIENT, | |
| 13 } Seobeo_SocketType; | |
| 14 | |
| 15 typedef struct { | |
| 16 int32 socket; | |
| 17 Seobeo_SocketType type; | |
| 18 boolean connected; | |
| 19 | |
| 20 char *host; | |
| 21 char *port; | |
| 22 | |
| 23 SSL_CTX *ssl_ctx; | |
| 24 SSL *ssl; | |
| 25 | |
| 26 uint8 *read_buffer; | |
| 27 uint32 read_buffer_capacity; | |
| 28 uint32 read_buffer_len; // current size | |
| 29 uint32 read_buffer_used; // TODO: Implement this for client | |
| 30 | |
| 31 uint8 *write_buffer; | |
| 32 uint32 write_buffer_capacity; | |
| 33 uint32 write_buffer_len; // current size | |
| 34 | |
| 35 void *file; | |
| 36 void *text_copy; | |
| 37 char *file_name; | |
| 38 | |
| 39 atomic_bool destroyed; | |
| 40 } Sebeo_Handle, *Seobeo_PHandle; | |
| 41 | |
| 42 typedef struct { | |
| 43 Seobeo_PHandle srv; | |
| 44 Dowa_PHashMap cache; | |
| 45 int evfd; // epoll‐fd or kqueue‐fd | |
| 46 } WorkerArgs; | |
| 47 | |
| 48 typedef enum { | |
| 49 SEOBEO_MODE_FORK, | |
| 50 SEOBEO_MODE_EDGE, | |
| 51 } Seobeo_ServerMode; | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 // --- Parse Header into Dowa Map ---// | |
| 57 extern int Seobeo_Web_Header_Parse(Seobeo_PHandle p_handle, Dowa_PHashMap map); | |
| 58 | |
| 59 // --- Handle Request --- // | |
| 60 extern void Seobeo_Web_HandleClientRequest(Seobeo_PHandle cli, Dowa_PHashMap p_html_cache); | |
| 61 | |
| 62 // --- SSL --- // | |
| 63 extern void Seobeo_Web_SSL_Init(); | |
| 64 extern void Seobeo_Web_SSL_Cleanup(); // Not used | |
| 65 | |
| 66 // --- Serving using Edge --- // | |
| 67 extern void *Seobeo_Web_Edge_Worker(void *vargs); | |
| 68 extern void Seobeo_Web_Edge(Seobeo_PHandle p_server_handle, int thread_count, Dowa_PHashMap p_html_cache); | |
| 69 | |
| 70 #endif | |
| 71 |