Mercurial
annotate seobeo/seobeo.h @ 119:c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 07 Jan 2026 16:05:57 -0800 |
| parents | 70401cf61e97 |
| children | cbbf78b17cfa |
| rev | line source |
|---|---|
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 #ifndef SEOBEO_SERVER_H |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 #define SEOBEO_SERVER_H |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
4 /** |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
5 * Seobeo |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
6 * ------ |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
7 * |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
8 * Library for starting TCP, UDP server and serving static file or path. |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
9 */ |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 |
| 96 | 11 #include "seobeo/seobeo_internal.h" |
|
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:
36
diff
changeset
|
12 |
| 96 | 13 #include <stdarg.h> |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 #include <unistd.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 #include <errno.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 #include <string.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 #include <sys/types.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 #include <sys/socket.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 #include <netinet/in.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 #include <netdb.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 #include <arpa/inet.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 #include <sys/wait.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 #include <signal.h> |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 #include <fcntl.h> |
|
7
114cad94008f
[Seobeo] Updated to support thread and edge server calls.
June Park <parkjune1995@gmail.com>
parents:
6
diff
changeset
|
25 #include <pthread.h> |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 |
|
4
0b3b4f5887bb
[Seobeo] Updated so that it create socket for both server and clients.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
28 #define INITIAL_BUFFER_CAPACITY 4096 |
|
0b3b4f5887bb
[Seobeo] Updated so that it create socket for both server and clients.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
29 |
|
6
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
30 // HTTP STATUS CODE |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
31 #define HTTP_OK 200 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
32 #define HTTP_CREATED 201 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
33 #define HTTP_MOVED_PERMANENTLY 301 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
34 #define HTTP_FOUND 302 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
35 #define HTTP_BAD_REQUEST 400 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
36 #define HTTP_UNAUTHORIZED 401 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
37 #define HTTP_FORBIDDEN 403 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
38 #define HTTP_NOT_FOUND 404 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
39 #define HTTP_INTERNAL_ERROR 500 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
40 |
|
79
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
41 #define CREATE_REDIRECT_HANDLER(name, target_url) \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
42 Seobeo_Request_Entry* GetRedirect##name(Seobeo_Request_Entry *req, Dowa_Arena *arena) \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
43 { \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
44 Seobeo_Request_Entry *resp = NULL; \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
45 Dowa_HashMap_Push_Arena(resp, "status", "301", arena); \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
46 Dowa_HashMap_Push_Arena(resp, "content-type", "text/plain", arena); \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
47 Dowa_HashMap_Push_Arena(resp, "Body", "", arena); \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
48 Dowa_HashMap_Push_Arena(resp, "Location", target_url, arena); \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
49 return resp; \ |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
50 } |
|
5710108c949e
[Seobeo] Added Redirect logic.
June Park <parkjune1995@gmail.com>
parents:
78
diff
changeset
|
51 |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
19
diff
changeset
|
52 extern volatile sig_atomic_t stop_server; |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
19
diff
changeset
|
53 |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
54 // --- TCP --- // |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
55 // --- Generate a Server Handle. ---// |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
56 extern Seobeo_Handle *Seobeo_Stream_Handle_Server_Create(const char *host, const char* port); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
57 // --- Generate a Client Handle. ---// |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
58 extern Seobeo_Handle *Seobeo_Stream_Handle_Client_Create(const char *host, const char* port, boolean use_tls); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
59 // --- Generate a Client Handle from given Server Handle. ---// |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
60 extern Seobeo_Handle *Seobeo_Stream_Handle_Server_Accept(Seobeo_Handle *p_server_handle); |
|
6
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
61 |
|
1e61008b9980
[Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents:
5
diff
changeset
|
62 // --- Web --- // |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
63 /* Generate HTTP 1.1 Header value with given content_types and length. */ |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
64 extern void Seobeo_Web_Header_Generate(void *buffer, int status, const char *content_type, const int content_length); |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
65 /* Start a Generic HTTP static file server with given folder. It will store folder into memory. */ |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
66 extern int Seobeo_Web_Server_Start(const char *folder_path, const char *port, Seobeo_ServerMode mode, int thread_count); |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
67 /* Generic HTTP GET Rquest to given host and port with path. It will mimic chrome. */ |
|
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
68 extern int Seobeo_Web_Client_Get(const char *host, const char *port, const char *path); |
|
119
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
69 |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
70 // --- HTTP Client (curl-like API) --- // |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
71 /* Create a new HTTP client request with the given URL. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
72 extern Seobeo_Client_Request *Seobeo_Client_Request_Create(const char *url); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
73 /* Set HTTP method (GET, POST, PUT, DELETE, etc.). Default is GET. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
74 extern void Seobeo_Client_Request_Set_Method(Seobeo_Client_Request *p_req, const char *method); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
75 /* Add a header using key-value pairs (stored in HashMap). */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
76 extern void Seobeo_Client_Request_Add_Header_Map(Seobeo_Client_Request *p_req, const char *key, const char *value); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
77 /* Add a header as a string "Key: Value" (stored in Array). */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
78 extern void Seobeo_Client_Request_Add_Header_Array(Seobeo_Client_Request *p_req, const char *header); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
79 /* Set request body with given data and length. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
80 extern void Seobeo_Client_Request_Set_Body(Seobeo_Client_Request *p_req, const char *body, size_t length); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
81 /* Enable/disable following redirects with max redirect count. Default is FALSE with 10 max. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
82 extern void Seobeo_Client_Request_Set_Follow_Redirects(Seobeo_Client_Request *p_req, boolean follow, int32 max_redirects); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
83 /* Set download path to save response body to file instead of memory. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
84 extern void Seobeo_Client_Request_Set_Download_Path(Seobeo_Client_Request *p_req, const char *path); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
85 /* Execute the HTTP request and return response. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
86 extern Seobeo_Client_Response *Seobeo_Client_Request_Execute(Seobeo_Client_Request *p_req); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
87 /* Destroy request and free all resources. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
88 extern void Seobeo_Client_Request_Destroy(Seobeo_Client_Request *p_req); |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
89 /* Destroy response and free all resources. */ |
|
c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
June Park <parkjune1995@gmail.com>
parents:
96
diff
changeset
|
90 extern void Seobeo_Client_Response_Destroy(Seobeo_Client_Response *p_resp); |
|
72
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
91 /* Initialize the router system (called automatically by Seobeo_Web_Server_Start) */ |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
92 extern void Seobeo_Router_Init(); |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
93 /* Register an API route handler. Call before starting server. */ |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
94 extern void Seobeo_Router_Register(const char *method, const char *path_pattern, Seobeo_Route_Handler handler); |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
95 /* Clean up router resources */ |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
96 extern void Seobeo_Router_Destroy(); |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
97 /* Find matching route handler (internal use) */ |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
98 extern Seobeo_Route_Handler Seobeo_Router_Find_Handler(const char *method, const char *path, Seobeo_Request_Entry **pp_request_map, Dowa_Arena *p_arena); |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
99 /* Send HTTP response from response map (internal use) */ |
|
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
100 extern void Seobeo_Router_Send_Response(Seobeo_Handle *p_handle, Seobeo_Request_Entry *p_response_map, Dowa_Arena *p_arena); |
| 78 | 101 extern char *Seobeo_Web_LoadFile(const char *file_path, size_t *p_file_size); |
|
72
4532ce6d9eb8
[Seobeo] Added router to the server logic. Few dowa string manipulation logics.
June Park <parkjune1995@gmail.com>
parents:
66
diff
changeset
|
102 |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
4
diff
changeset
|
103 // --- Helper functions --- // |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
104 /* Destroy handle. It will handle all NULL poointers. */ |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
105 extern void Seobeo_Handle_Destroy(Seobeo_Handle *p_handle); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
106 /* Write to socket from write_buffer in the handle. */ |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
107 extern int Seobeo_Handle_Flush(Seobeo_Handle *p_handle); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
108 /* Write to socket with given data source, if the data source is bigger than the write buffer for handle then we just directly write from the data source. */ |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
109 extern int Seobeo_Handle_Queue(Seobeo_Handle *p_handle, const uint8_t *data, uint32_t data_size); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
110 /* Read to socket from read_buffer in the handle. */ |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
111 extern int Seobeo_Handle_Read(Seobeo_Handle *p_handle); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
112 /* Move to read_buffer to front and we already consumed the given amount in the handle. */ |
|
66
a0f0ad5e42eb
[Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents:
64
diff
changeset
|
113 extern void Seobeo_Handle_Consume(Seobeo_Handle *p_handle, uint32 consumed); |
|
19
875bb6e10db7
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
114 /* Assign IP4 or IP6 to sockaddr. TODO: Maybe create my own struct for this? */ |
| 96 | 115 extern void *Seobeo_Get_IP4_Or_IP6(struct sockaddr *sa); |
| 116 /* Logging */ | |
| 117 typedef enum { | |
| 118 SEOBEO_INFO = 0, | |
| 119 SEOBEO_WARNING, | |
| 120 SEOBEO_ERROR, | |
| 121 SEOBEO_DEBUG, | |
| 122 } Seobeo_Log_Level; | |
| 123 extern int Seobeo_Log(Seobeo_Log_Level level, const char *format, ...); | |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
124 #endif |