-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuweb.h
67 lines (54 loc) · 2.2 KB
/
uweb.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
// --------------------------------------------------------
// uweb : a minimal web server which compile under MacOS, Linux and Windows
// by Ph. Jounin November 2019
//
// License: GPLv2
// Module:
// uweb.h
// --------------------------------------------------------
#define UWEB_VERSION "1.8"
#ifndef FALSE
# define FALSE (0==1)
# define TRUE (1==1)
#endif
typedef int BOOL;
// ---------------------------------------------------------
// default parameters
// ---------------------------------------------------------
#define DEFAULT_BURST_PKTS 5
#define DEFAULT_BUFLEN (1448*DEFAULT_BURST_PKTS) // buffer size for reading HTTP command and file content (2 pkts of 1500 bytes)
#define DEFAULT_PORT "8080"
#define DEFAULT_MAXTHREADS 1024 // maximum simultaneous connections
#define DEFAULT_HTMLFILE "index.html" // if request is "GET / HTTP/1.1"
#define DEFAULT_BINARY_TYPE "application/octet-stream"
#define DEFAULT_TEXT_TYPE "text/plain"
#define SELECT_TIMEOUT 5 // every 5 seconds, look for terminated threads
#define LISTENING_QUEUE_SIZE 3 // do not need a large queue
// ---------------------------------------------------------
// sSettings is a global variable
// ---------------------------------------------------------
// uweb Settings
struct S_Settings
{
// roughly used by log.c
int uVerbose;
int timestamp;
// order does not matter now
BOOL bIPv4;
BOOL bIPv6;
char *szPort;
char *szBoundTo;
char *szDirectory;
const char *szDefaultHtmlFile;
const char *szDefaultContentType; // all files accepted with this content-type
int max_threads; // maximum simultaneous connections
int slow_down; // msec to wait between two frames
};
extern struct S_Settings sSettings;
// sSettings = { WARN, FALSE, FALSE, DEFAULT_PORT, NULL, ".", DEFAULT_HTMLFILE, NULL, DEFAULT_MAXTHREADS, FALSE };
// ---------------------------------------------------------
// Arduino-like behavior
// ---------------------------------------------------------
int Setup(void);
void doLoop(void);
void Cleanup(void);