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
RevLine 
[17]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
[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. */
[39]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 */
[18]26};
27
[20]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
[39]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
[17]36typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
[18]37typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
[39]38typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
[17]39
[140]40#ifdef SOURCE
[17]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);
[140]45#endif
[17]46
[140]47#ifdef __cplusplus
48}
[17]49#endif
[140]50
51#endif
Note: See TracBrowser for help on using the repository browser.