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

Last change on this file since 27 was 20, checked in by Nishi, on Sep 14, 2024 at 6:59:15 PM

can show index

  • Property svn:keywords set to Id
File size: 942 bytes
Line 
1/* $Id: tw_module.h 20 2024-09-14 09:59:15Z nishi $ */
2
3#ifndef __TW_MODULE_H__
4#define __TW_MODULE_H__
5
6#include "tw_config.h"
7#include "tw_http.h"
8
9struct tw_tool {
10 void (*log)(const char* name, const char* log, ...);
11 void (*add_version)(const char* string);
12};
13
14enum TW_MODULE_RETURN {
15 _TW_MODULE_PASS = 0, /* Pass to the next module. */
16 _TW_MODULE_STOP, /* Do not pass to the next module. */
17 _TW_MODULE_ERROR /* Error, and do not pass to the next module. */
18};
19
20#define TW_MODULE_PASS _TW_MODULE_PASS
21#define TW_MODULE_STOP _TW_MODULE_STOP
22#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
23
24typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
25typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
26
27void* tw_module_load(const char* path);
28void* tw_module_symbol(void* mod, const char* sym);
29void tw_init_tools(struct tw_tool* tools);
30int tw_module_init(void* mod);
31
32#endif
Note: See TracBrowser for help on using the repository browser.