source: Main/trunk/Server/tw_module.h@ 313

Last change on this file since 313 was 313, checked in by Nishi, on Oct 14, 2024 at 8:22:06 AM

dll does not work somehow

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1/* $Id: tw_module.h 313 2024-10-13 23:22:06Z nishi $ */
2
3#ifndef __TW_MODULE_H__
4#define __TW_MODULE_H__
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#include "tw_config.h"
11#include "tw_http.h"
12
13#if defined(__OS2__)
14#define INCL_DOSMODULEMGR
15#define INCL_DOSERRORS
16#include <os2.h>
17#define MODULE_DECL APIENTRY
18#else
19#define MODULE_DECL
20#endif
21
22struct tw_tool {
23 void (*log)(const char* name, const char* log, ...);
24 void (*add_version)(const char* string);
25 void (*add_define)(const char* string);
26 void (*delete_define)(const char* string);
27};
28
29enum TW_MODULE_RETURN {
30 _TW_MODULE_PASS = 0, /* Pass to the next module. */
31 _TW_MODULE_STOP, /* Do not pass to the next module. */
32 _TW_MODULE_STOP2, /* Do not pass to the next module, and do not handle response. */
33 _TW_MODULE_ERROR, /* Error, and do not pass to the next module. */
34
35 _TW_CONFIG_PARSED, /* Got parsed */
36 _TW_CONFIG_NOTME, /* Did not parse */
37 _TW_CONFIG_ERROR /* Error */
38};
39
40#define TW_MODULE_PASS _TW_MODULE_PASS
41#define TW_MODULE_STOP _TW_MODULE_STOP
42#define TW_MODULE_STOP2 _TW_MODULE_STOP2
43#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
44
45#define TW_CONFIG_PARSED _TW_CONFIG_PARSED
46#define TW_CONFIG_NOTME _TW_CONFIG_NOTME
47#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
48
49typedef int (MODULE_DECL *tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
50typedef int (MODULE_DECL *tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
51typedef int (MODULE_DECL *tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
52
53#ifdef SOURCE
54void* tw_module_load(const char* path);
55void* tw_module_symbol(void* mod, const char* sym);
56void tw_init_tools(struct tw_tool* tools);
57int tw_module_init(void* mod);
58
59void tw_add_version(const char* string);
60void tw_add_define(const char* string);
61void tw_delete_define(const char* string);
62#endif
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif
Note: See TracBrowser for help on using the repository browser.