forked from zorxx/microhttpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmicrohttpd.h
More file actions
61 lines (48 loc) · 1.83 KB
/
microhttpd.h
File metadata and controls
61 lines (48 loc) · 1.83 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*! \copyright 2018 Zorxx Software. All rights reserved.
* \license This file is released under the MIT License. See the LICENSE file for details.
* \file microhttpd.h
* \brief microhttpd External Interface
*/
#ifndef _MICROHTTPD_H
#define _MICROHTTPD_H
#include <stdint.h>
#include <stdbool.h>
#if defined(__cplusplus)
extern "C" {
#endif
typedef void *tMicroHttpdContext;
typedef void *tMicroHttpdClient;
typedef void (*tMicroHttpdGetHandler)(tMicroHttpdClient client, const char *uri,
const char *param_list[], const uint32_t param_count, const char *source_address, void *cookie);
typedef struct
{
const char *uri;
tMicroHttpdGetHandler handler;
void *cookie;
} tMicroHttpdGetHandlerEntry;
typedef void (*tMicroHttpdPostHandler)(tMicroHttpdClient client, const char *uri, const char *filename,
const char *param_list[], const uint32_t param_count, const char *source_address, void *cookie,
bool start, bool finish, const char *data, const uint32_t data_length, const uint32_t total_length);
typedef struct
{
uint16_t server_port;
uint32_t process_timeout; /* milliseconds */
uint32_t rx_buffer_size;
/* GET */
tMicroHttpdGetHandlerEntry *get_handler_list;
uint32_t get_handler_count;
tMicroHttpdGetHandler default_get_handler;
void *default_get_handler_cookie;
/* POST */
tMicroHttpdPostHandler post_handler;
void *post_handler_cookie;
} tMicroHttpdParams;
tMicroHttpdContext microhttpd_start(tMicroHttpdParams *params);
int microhttpd_process(tMicroHttpdContext context);
int microhttpd_send_response(tMicroHttpdClient client, uint16_t code, const char *content_type,
uint32_t content_length, const char *extra_header_options, const char *content);
int microhttpd_send_data(tMicroHttpdClient client, uint32_t length, const char *content);
#if defined(__cplusplus)
}
#endif
#endif /* _MICROHTTPD_H */