acl/app/jaws/plugin/cgi/http_plugin.h

109 lines
3.5 KiB
C
Raw Normal View History

#ifndef __HTTP_PLUGIN_INCLUDE_H__
2014-11-19 00:25:21 +08:00
#define __HTTP_PLUGIN_INCLUDE_H__
#include "lib_acl.h"
#include "lib_protocol.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* HTTP ,
* @param dll_env {ACL_DLL_ENV*} DLL , dll_env->logfp ,
*
* @param dmptr {ACL_DEBUG_MEM*}
* @param cfg_dir {const char*}
2014-11-19 00:25:21 +08:00
*/
void http_plugin_init(ACL_DLL_ENV *dll_env, const char *cfg_dir);
/**
* HTTP HTTP请求头时调用
* @param client {ACL_VSTREAM*}
* @param hdr_req {HTTP_HDR_REQ*} HTTP请求头
* @param ctx_ptr {void**}
* @return {int} < 0: HTTP请求, -5xx/-4xx;
* 0: HTTP请求继续由主程序处理; > 0: HTTP请求可以由外挂模块的单独
* 线
2014-11-19 00:25:21 +08:00
*/
int http_request_filter(ACL_VSTREAM *client, HTTP_HDR_REQ *hdr_req, void **ctx_ptr);
/**
* HTTP http_request_filter() > 0
* HTTP请求及响应HTTP请求及HTTP响应
* @param client {ACL_VSTREAM*} HTTP客户端数据连接流
* @param hdr_req {HTTP_HDR_REQ*} HTTP请求头
* @param ctx {void*} http_request_filter ctx_ptr
*
2014-11-19 00:25:21 +08:00
*/
void http_request_forward(ACL_VSTREAM *client, HTTP_HDR_REQ *hdr_req, void *ctx);
/*----------------------------------------------------------------------------*/
#define DEBUG_BASE 500
#define DBG_REQ (DEBUG_BASE + 1)
#define DBG_RES (DEBUG_BASE + 2)
#define STR acl_vstring_str
#define LEN ACL_VSTRING_LEN
typedef struct {
char *alias;
char *cgi;
HTTP_HDR_REQ *hdr_req;
HTTP_REQ *req;
HTTP_HDR_RES *hdr_res;
ACL_VSTREAM *client;
} CGI;
/* 全局配置变量 */
2014-11-19 00:25:21 +08:00
extern char *var_cfg_log_name;
extern char *var_cfg_cgi_bin;
extern int var_cfg_data_clone;
/* in http_conf.c */
/**
*
* @param cfg_dir {const char*}
2014-11-19 00:25:21 +08:00
*/
void http_conf_load(const char *cfg_dir);
/* in http_plugin.c */
/**
* 线
* @param threads_limit {int} 线线
* @param threads_idle {int} 线线()
2014-11-19 00:25:21 +08:00
*/
void http_plugin_pool_create(int threads_limit, int threads_idle);
/**
* 线线线
* @param start_routine {void (*)(void*)}
* @param arg {void*} 线线 start_routine
2014-11-19 00:25:21 +08:00
*/
void http_plugin_pool_append(void (*start_routine)(void *), void *arg);
/**
*
* @param level {int} : 1, 2, 3
2014-11-19 00:25:21 +08:00
*/
void http_plugin_debug_memory(int level);
/* in http_cgi.c */
void http_cgi_init(void);
void http_cgi_end(void);
void http_cgi_add2(const char *alias, const char *cgi);
void http_cgi_add1(const ACL_ARGV *args);
CGI *http_cgi_path(const char *alias);
void http_cgi_thread(void *ctx);
#ifdef __cplusplus
}
#endif
#endif