-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.h
More file actions
78 lines (59 loc) · 2.01 KB
/
config.h
File metadata and controls
78 lines (59 loc) · 2.01 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
arfhttpd: Yet another HTTP server
Copyright (C) 2023 arf20 (Ángel Ruiz Fernandez)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#ifndef _CONFIG_H
#define _CONFIG_H
/* Macros */
#define BUFF_SIZE 65535
/* Types */
typedef struct string_node_s {
const char *str;
struct string_node_s *prev;
struct string_node_s *next;
} string_node_t;
typedef struct fd_thread_node_s {
int fd;
pthread_t thread;
struct fd_thread_node_s *prev;
struct fd_thread_node_s *next;
} fd_thread_node_t;
/* Webserver config types */
typedef enum {
CONFIG_ROOT, /* Real path root */
CONFIG_HEADER, /* Defines header */
CONFIG_MIMEHEADER, /* Enables MIME type header */
CONFIG_INDEX, /* Default index file */
CONFIG_AUTOINDEX /* Enable autoindex */
} config_type_t;
extern const char *config_type_strs[];
typedef struct config_node_s {
config_type_t type;
const char *param1;
const char *param2;
struct config_node_s *prev;
struct config_node_s *next;
} config_node_t;
typedef struct location_node_s {
const char *location;
config_node_t *config;
struct location_node_s *prev;
struct location_node_s *next;
} location_node_t;
/* Config */
extern string_node_t *listen_list, *tls_listen_list;
extern location_node_t *location_list;
extern const char *cert_file, *cert_key_file;
int config_parse(const char *config);
#endif