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

Last change on this file since 349 was 315, checked in by Nishi, on Oct 14, 2024 at 7:01:02 PM

wip

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