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

Last change on this file since 367 was 367, checked in by Nishi, on Oct 17, 2024 at 1:22:49 PM

some fix

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