Summary Files Commits Branches @commit @diff @stats
path: root / src / http / callback_http.h
diff options
context:
space:
mode:
Commit74630b4bfe1aa887ef57ee57b22241d030b38d76 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-11-15 21:37:37 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-11-15 21:37:37 +0200
Files3d39c585df1551d69fdb83980c010ec4b579f211 /src/http/callback_http.h
tergiv-74630b4bfe1aa887ef57ee57b22241d030b38d76.tar
tergiv-74630b4bfe1aa887ef57ee57b22241d030b38d76.tar.gz
tergiv-74630b4bfe1aa887ef57ee57b22241d030b38d76.zip
Parent3bca23eaaa49fa01f60ecbc5e0a329d29f088506 (diff)
feat!: Initial web server base implementation
1 files changed, 38 insertions, 0 deletions
-rw-r--r--src/http/callback_http.h38
diff --git a/src/http/callback_http.h b/src/http/callback_http.h
new file mode 100644
index 0000000..5f38c86
--- /dev/null
+++ b/src/http/callback_http.h
@@ -0,0 +1,38 @@
+#ifndef __TERGIV_CALLBACK_HTTP
+#define __TERGIV_CALLBACK_HTTP
+
+#include "../sockets/socket_server.h"
+#include "request_method.h"
+#include "response_code.h"
+#include "http_headers.h"
+
+void callback_http(callback_args* args);
+
+typedef struct client_message {
+ enum RequestMethod method;
+ char* url;
+ char* version;
+ char* headers[HE_LENGTH];
+} client_message;
+
+typedef struct response_message {
+ enum ResponseCode response_code;
+
+ char* headers[HE_LENGTH];
+
+ char* body;
+ size_t body_size;
+ int free_body;
+} response_message;
+
+typedef struct http_callbacks {
+ union {
+ struct {
+ void (*get_callback)(client_message* in_message, response_message* out_message);
+ };
+ void (*all_callbacks[RM_UNKNOWN])(client_message* in_message, response_message* out_message);
+ };
+
+} http_callbacks;
+
+#endif /* __TERGIV_CALLBACK_HTTP */