source: Main/trunk/Server/tw_config.h@ 22

Last change on this file since 22 was 22, checked in by Nishi, on Sep 14, 2024 at 10:25:38 PM

icon works

  • Property svn:keywords set to Id
File size: 1.5 KB
RevLine 
[4]1/* $Id: tw_config.h 22 2024-09-14 13:25:38Z nishi $ */
2
3#ifndef __TW_CONFIG_H__
4#define __TW_CONFIG_H__
5
[21]6#include "tw_http.h"
7
[7]8#include <stdint.h>
[21]9#include <stdbool.h>
[7]10
[21]11#ifdef __MINGW32__
12#include <winsock2.h>
13#define NO_IPV6
14#else
15#include <netinet/in.h>
16#endif
[6]17
[21]18#ifdef NO_IPV6
19#define SOCKADDR struct sockaddr_in
20#else
21#define SOCKADDR struct sockaddr_in6
22#endif
23
[22]24#define MAX_PORTS 1024
25#define MAX_VHOSTS 1024
26#define MAX_MODULES 1024
27#define MAX_DIRS 1024
28#define MAX_MIME 1024
29#define MAX_ICON 1024
[21]30
31enum TW_DIR_TYPE {
32 TW_DIR_ALLOW = 0,
33 TW_DIR_DENY
34};
35
36struct tw_dir_entry {
37 char* name;
38 char* dir;
39 int type;
40};
41
42struct tw_mime_entry {
43 char* ext;
44 char* mime;
45};
46
[22]47struct tw_icon_entry {
48 char* mime;
49 char* icon;
50};
51
[12]52struct tw_config_entry {
53 char* name;
54 int port;
55 char* sslkey;
56 char* sslcert;
[19]57 char* root;
[21]58 struct tw_dir_entry dirs[MAX_DIRS];
59 int dir_count;
60 struct tw_mime_entry mimes[MAX_DIRS];
61 int mime_count;
[22]62 struct tw_icon_entry icons[MAX_DIRS];
63 int icon_count;
[12]64};
65
[6]66struct tw_config {
[7]67 uint64_t ports[MAX_PORTS + 1]; /* If port & (1 << 32) is non-zero, it is SSL */
[12]68 char hostname[1025];
[6]69 struct tw_config_entry root;
[12]70 struct tw_config_entry vhosts[MAX_VHOSTS];
[18]71 void* modules[MAX_MODULES];
72 int module_count;
[12]73 int vhost_count;
[17]74 char* server_root;
[18]75 char* extension;
[6]76};
77
78void tw_config_init(void);
[4]79int tw_config_read(const char* path);
[12]80struct tw_config_entry* tw_vhost_match(const char* name, int port);
[21]81bool tw_permission_allowed(const char* path, SOCKADDR addr, struct tw_http_request req, struct tw_config_entry* vhost);
[4]82
83#endif
Note: See TracBrowser for help on using the repository browser.