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

Last change on this file since 163 was 156, checked in by Nishi, on Sep 25, 2024 at 9:28:10 PM

release 1.07

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