/[osn-commons]/trunk/freehttpd/freehttpd.h
ViewVC logotype

Contents of /trunk/freehttpd/freehttpd.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 45 - (show annotations)
Sun Aug 11 17:35:46 2024 UTC (7 months, 2 weeks ago) by rakinar2
File MIME type: text/x-c
File size: 1395 byte(s)
feat(freehttpd): file serving and directory indexing

1 #ifndef FREEHTTPD_H
2 #define FREEHTTPD_H
3
4 #include <magic.h>
5 #include <stddef.h>
6
7 typedef struct freehttpd_config
8 {
9 unsigned int port;
10 char *addr;
11 unsigned int max_listen_queue;
12 char *docroot;
13 size_t max_method_len;
14 size_t max_uri_len;
15 size_t max_version_len;
16
17 /* The following fields are for internal use only */
18 size_t _docroot_length;
19 } freehttpd_config_t;
20
21 typedef enum freehttpd_error_code
22 {
23 E_OK,
24 E_UNKNOWN,
25 E_UNKNOWN_OPT,
26 E_MALFORMED_REQUEST,
27 E_SYSCALL_SOCKET,
28 E_SYSCALL_BIND,
29 E_SYSCALL_LISTEN,
30 E_SYSCALL_ACCEPT,
31 E_SYSCALL_RECV,
32 E_SYSCALL_SETSOCKOPT,
33 E_SYSCALL_READ,
34 E_SYSCALL_WRITE,
35 E_LIBC_FDOPEN,
36 E_LIBC_MALLOC
37 } ecode_t;
38
39 typedef enum freehttpd_config_option
40 {
41 FREEHTTPD_CONFIG_PORT,
42 FREEHTTPD_CONFIG_ADDR,
43 FREEHTTPD_CONFIG_MAX_LISTEN_QUEUE,
44 FREEHTTPD_CONFIG_MAX_METHOD_LEN,
45 FREEHTTPD_CONFIG_MAX_URI_LEN,
46 FREEHTTPD_CONFIG_MAX_VERSION_LEN,
47 FREEHTTPD_CONFIG_DOCROOT,
48 } freehttpd_opt_t;
49
50 typedef struct freehttpd freehttpd_t;
51
52 freehttpd_t *freehttpd_init (magic_t magic);
53 void freehttpd_free (freehttpd_t *freehttpd);
54 ecode_t freehttpd_start (freehttpd_t *restrict freehttpd);
55 ecode_t freehttpd_setopt (freehttpd_t *freehttpd, freehttpd_opt_t opt,
56 void *value);
57
58 const freehttpd_config_t *freehttpd_get_config (freehttpd_t *freehttpd);
59
60 #endif

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26