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
RevLine 
[17]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
[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);
[156]16 void (*add_define)(const char* string);
17 void (*delete_define)(const char* string);
[17]18};
19
[18]20enum TW_MODULE_RETURN {
[20]21 _TW_MODULE_PASS = 0, /* Pass to the next module. */
22 _TW_MODULE_STOP, /* Do not pass to the next module. */
[141]23 _TW_MODULE_STOP2, /* Do not pass to the next module, and do not handle response. */
[39]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 */
[18]29};
30
[20]31#define TW_MODULE_PASS _TW_MODULE_PASS
32#define TW_MODULE_STOP _TW_MODULE_STOP
[141]33#define TW_MODULE_STOP2 _TW_MODULE_STOP2
[20]34#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
35
[39]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
[17]40typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
[18]41typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
[39]42typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
[17]43
[140]44#ifdef SOURCE
[17]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);
[156]49
50void tw_add_version(const char* string);
51void tw_add_define(const char* string);
52void tw_delete_define(const char* string);
[140]53#endif
[17]54
[140]55#ifdef __cplusplus
56}
[17]57#endif
[140]58
59#endif
Note: See TracBrowser for help on using the repository browser.