-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_http_server.h
More file actions
33 lines (25 loc) · 845 Bytes
/
simple_http_server.h
File metadata and controls
33 lines (25 loc) · 845 Bytes
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
/*
* simple_http_server.h
*
* Created on: May 31, 2018
* Author: hhdang
*/
#ifndef _SIMPLE_HTTP_SERVER_SIMPLE_HTTP_SERVER_H_
#define _SIMPLE_HTTP_SERVER_SIMPLE_HTTP_SERVER_H_
#include <stdio.h>
#define Dprintf(format, ...) fprintf (stderr,"%s:%d : " format , __FILE__, __LINE__, ##__VA_ARGS__)
#define PATH_MAX_LENGTH 256
#define VERSION_MAX_LENGTH 64
typedef void (*urlCallback)(FILE *);
typedef struct simple_http_request_handler
{
char path[PATH_MAX_LENGTH];
urlCallback f;
} simple_http_request_handler;
void simple_http_server_init(int port);
int simple_http_server_add_handler(const char *path, urlCallback f);
void simple_http_server_destroy_handlers();
void doResponseNotFound(FILE *f);
void simple_http_server_start();
void simple_http_server_stop();
#endif /* _SIMPLE_HTTP_SERVER_SIMPLE_HTTP_SERVER_H_ */