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

Last change on this file since 147 was 141, checked in by Nishi, on Sep 23, 2024 at 8:37:53 PM

adding new module return

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1/* $Id: tw_module.h 141 2024-09-23 11:37:53Z 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
13struct tw_tool {
14 void (*log)(const char* name, const char* log, ...);
15 void (*add_version)(const char* string);
16};
17
18enum TW_MODULE_RETURN {
19 _TW_MODULE_PASS = 0, /* Pass to the next module. */
20 _TW_MODULE_STOP, /* Do not pass to the next module. */
21 _TW_MODULE_STOP2, /* Do not pass to the next module, and do not handle response. */
22 _TW_MODULE_ERROR, /* Error, and do not pass to the next module. */
23
24 _TW_CONFIG_PARSED, /* Got parsed */
25 _TW_CONFIG_NOTME, /* Did not parse */
26 _TW_CONFIG_ERROR /* Error */
27};
28
29#define TW_MODULE_PASS _TW_MODULE_PASS
30#define TW_MODULE_STOP _TW_MODULE_STOP
31#define TW_MODULE_STOP2 _TW_MODULE_STOP2
32#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
33
34#define TW_CONFIG_PARSED _TW_CONFIG_PARSED
35#define TW_CONFIG_NOTME _TW_CONFIG_NOTME
36#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
37
38typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
39typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
40typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
41
42#ifdef SOURCE
43void* tw_module_load(const char* path);
44void* tw_module_symbol(void* mod, const char* sym);
45void tw_init_tools(struct tw_tool* tools);
46int tw_module_init(void* mod);
47#endif
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif
Note: See TracBrowser for help on using the repository browser.