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

Last change on this file since 88 was 39, checked in by Nishi, on Sep 17, 2024 at 9:20:48 PM

custom config

  • Property svn:keywords set to Id
File size: 1.2 KB
RevLine 
[17]1/* $Id: tw_module.h 39 2024-09-17 12:20:48Z nishi $ */
2
3#ifndef __TW_MODULE_H__
4#define __TW_MODULE_H__
5
6#include "tw_config.h"
[18]7#include "tw_http.h"
[17]8
9struct tw_tool {
10 void (*log)(const char* name, const char* log, ...);
[18]11 void (*add_version)(const char* string);
[17]12};
13
[18]14enum TW_MODULE_RETURN {
[20]15 _TW_MODULE_PASS = 0, /* Pass to the next module. */
16 _TW_MODULE_STOP, /* Do not pass to the next module. */
[39]17 _TW_MODULE_ERROR, /* Error, and do not pass to the next module. */
18
19 _TW_CONFIG_PARSED, /* Got parsed */
20 _TW_CONFIG_NOTME, /* Did not parse */
21 _TW_CONFIG_ERROR /* Error */
[18]22};
23
[20]24#define TW_MODULE_PASS _TW_MODULE_PASS
25#define TW_MODULE_STOP _TW_MODULE_STOP
26#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
27
[39]28#define TW_CONFIG_PARSED _TW_CONFIG_PARSED
29#define TW_CONFIG_NOTME _TW_CONFIG_NOTME
30#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
31
[17]32typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
[18]33typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
[39]34typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
[17]35
36void* tw_module_load(const char* path);
37void* tw_module_symbol(void* mod, const char* sym);
38void tw_init_tools(struct tw_tool* tools);
39int tw_module_init(void* mod);
40
41#endif
Note: See TracBrowser for help on using the repository browser.