Mercurial
annotate seobeo/seobeo_internal.h @ 70:4bc56e88e1f3
Remove unnecessary files.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 25 Dec 2025 20:10:46 -0800 |
| parents | 6626ec933933 |
| children | 75de5903355c |
| rev | line source |
|---|---|
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
1 #ifndef SEOBEO_SERVER_INTERNAL_H |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
2 #define SEOBEO_SERVER_INTERNAL_H |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
3 |
|
67
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
4 // SSL - conditionally included |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
5 #ifndef SEOBEO_NO_SSL |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
6 #include <openssl/ssl.h> |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
7 #include <openssl/err.h> |
|
67
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
8 #define SSL_CTX_TYPE SSL_CTX |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
9 #define SSL_TYPE SSL |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
10 #else |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
11 #define SSL_CTX_TYPE void |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
12 #define SSL_TYPE void |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
13 #endif |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
14 |
|
64
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
62
diff
changeset
|
15 #ifndef DIRECTORY |
|
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
62
diff
changeset
|
16 #define DIRECTORY |
|
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
62
diff
changeset
|
17 #endif |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
18 #include "dowa/dowa.h" |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
19 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
20 typedef enum { |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
21 SEOBEO_STREAM_TYPE_SERVER, |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
22 SEOBEO_STREAM_TYPE_CLIENT, |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
23 } Seobeo_SocketType; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
24 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
25 typedef struct { |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
26 int32 socket; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
27 Seobeo_SocketType type; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
28 boolean connected; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
29 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
30 char *host; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
31 char *port; |
|
67
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
32 |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
33 SSL_CTX_TYPE *ssl_ctx; |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
34 SSL_TYPE *ssl; |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
35 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
36 uint8 *read_buffer; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
37 uint32 read_buffer_capacity; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
38 uint32 read_buffer_len; // current size |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
39 uint32 read_buffer_used; // TODO: Implement this for client |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
40 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
41 uint8 *write_buffer; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
42 uint32 write_buffer_capacity; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
43 uint32 write_buffer_len; // current size |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
44 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
45 void *file; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
46 void *text_copy; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
47 char *file_name; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
48 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
49 atomic_bool destroyed; |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
50 } Seobeo_Handle; |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
51 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
52 typedef struct { |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
53 Seobeo_Handle *srv; |
|
65
ecb6ee6a22c3
[Misc] I will no longer drink cool aids of capital P.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
54 Dowa_HashMap *cache; |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
55 } WorkerArgs; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
56 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
57 typedef enum { |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
58 SEOBEO_MODE_FORK, |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
59 SEOBEO_MODE_EDGE, |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
60 } Seobeo_ServerMode; |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
61 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
62 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
63 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
64 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
65 // --- Parse Header into Dowa Map ---// |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
66 extern int Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Dowa_HashMap *map); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
67 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
68 // --- Handle Request --- // |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
69 extern void Seobeo_Web_HandleClientRequest(Seobeo_Handle *cli, Dowa_HashMap *p_html_cache); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
70 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
71 // --- SSL --- // |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
72 extern void Seobeo_Web_SSL_Init(); |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
73 extern void Seobeo_Web_SSL_Cleanup(); // Not used |
|
67
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
74 extern int Seobeo_SSL_Setup_Client(Seobeo_Handle *p_handle, const char *host, int socket_fd); |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
75 extern void Seobeo_SSL_Cleanup(Seobeo_Handle *p_handle); |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
76 extern int32 Seobeo_SSL_Write(Seobeo_Handle *p_handle, const uint8 *data, uint32 length); |
|
6626ec933933
[Seobeo] Separated out Client Server logic. Created test tools.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
77 extern int32 Seobeo_SSL_Read(Seobeo_Handle *p_handle, uint8 *buffer, uint32 length); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
78 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
79 // --- Serving using Edge --- // |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
80 extern void *Seobeo_Web_Edge_Worker(void *vargs); |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
81 extern void Seobeo_Web_Edge(Seobeo_Handle *p_server_handle, int thread_count, Dowa_HashMap *p_html_cache); |
|
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
65
diff
changeset
|
82 extern void Seobeo_Web_Edge_2(Seobeo_Handle *p_server_handle, Dowa_HashMap *p_html_cache); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
83 |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
84 #endif |