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

Last change on this file since 140 was 140, checked in by Nishi, on Sep 23, 2024 at 8:31:18 PM

adding cplusplus thing

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