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
RevLine 
[17]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
[140]6#ifdef __cplusplus
7extern "C" {
8#endif
9
[17]10#include "tw_config.h"
[18]11#include "tw_http.h"
[17]12
13struct tw_tool {
14 void (*log)(const char* name, const char* log, ...);
[18]15 void (*add_version)(const char* string);
[17]16};
17
[18]18enum TW_MODULE_RETURN {
[20]19 _TW_MODULE_PASS = 0, /* Pass to the next module. */
20 _TW_MODULE_STOP, /* Do not pass to the next module. */
[141]21 _TW_MODULE_STOP2, /* Do not pass to the next module, and do not handle response. */
[39]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 */
[18]27};
28
[20]29#define TW_MODULE_PASS _TW_MODULE_PASS
30#define TW_MODULE_STOP _TW_MODULE_STOP
[141]31#define TW_MODULE_STOP2 _TW_MODULE_STOP2
[20]32#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
33
[39]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
[17]38typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
[18]39typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
[39]40typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
[17]41
[140]42#ifdef SOURCE
[17]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);
[140]47#endif
[17]48
[140]49#ifdef __cplusplus
50}
[17]51#endif
[140]52
53#endif
Note: See TracBrowser for help on using the repository browser.