Summary Files Commits Branches @commit @diff @stats
path: root / src / http / callback_http.h
blob: 5f38c86bd765391d7cc8ae67ce893531481764fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 */