forked from ArduPilot/APWeb
-
Notifications
You must be signed in to change notification settings - Fork 2
/
web_server.h
69 lines (57 loc) · 1.41 KB
/
web_server.h
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
62
63
64
65
66
67
68
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <ctype.h>
#include <getopt.h>
#include <time.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <fnmatch.h>
#include <strings.h>
#include <dlfcn.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <pthread.h>
struct connection_state;
#include "cgi.h"
#define WEB_SERVER_PORT 80
/*
structure for output buffering
*/
struct sock_buf {
bool add_content_length;
uint32_t header_length;
char *buf;
int fd;
};
/*
state of one connection
*/
struct connection_state {
struct sock_buf *sock;
struct cgi_state *cgi;
};
#define FMT_PRINTF(a,b) __attribute__((format(printf, a, b)))
void web_server_task_process(void *pvParameters);
void connection_destroy(struct connection_state *c);
ssize_t sock_write(struct sock_buf *sock, const char *s, size_t size);
void sock_printf(struct sock_buf *sock, const char *fmt, ...) FMT_PRINTF(2,3);
void web_server_set_debug(int debug);
void web_debug(int level, const char *fmt, ...);
void mavlink_fc_write(const uint8_t *buf, size_t len);
#define console_printf printf
#define console_vprintf vprintf