Apache HTTPD
mod_lua.h
Go to the documentation of this file.
1
18#ifndef _MOD_LUA_H_
19#define _MOD_LUA_H_
20
21#include <stdio.h>
22
23#include "httpd.h"
24#include "http_core.h"
25#include "http_config.h"
26#include "http_request.h"
27#include "http_log.h"
28#include "http_protocol.h"
29#include "http_ssl.h"
30#include "ap_regex.h"
31
32#include "ap_config.h"
33#include "util_filter.h"
34
35#include "apr_thread_rwlock.h"
36#include "apr_strings.h"
37#include "apr_tables.h"
38#include "apr_hash.h"
39#include "apr_buckets.h"
40#include "apr_file_info.h"
41#include "apr_time.h"
42#include "apr_hooks.h"
43#include "apr_reslist.h"
44
45#include "lua.h"
46#include "lauxlib.h"
47#include "lualib.h"
48
49#if LUA_VERSION_NUM > 501
50/* Load mode for lua_load() */
51#define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL)
52
53#if LUA_VERSION_NUM > 503
54#define lua_resume(a,b,c) lua_resume(a, NULL, b, c)
55#else
56/* ### For version < 5.4, assume that exactly one stack item is on the
57 * stack, which is what the code did before but seems dubious. */
58#define lua_resume(a,b,c) (*(c) = 1, lua_resume(a, NULL, b))
59#endif
60
61#define luaL_setfuncs_compat(a,b) luaL_setfuncs(a,b,0)
62#else
63#define lua_rawlen(L,i) lua_objlen(L, (i))
64#define luaL_setfuncs_compat(a,b) luaL_register(a,NULL,b)
65#define lua_resume(a,b,c) (*(c) = 1, lua_resume(a, b))
66#endif
67#if LUA_VERSION_NUM > 502
68#define lua_dump(a,b,c) lua_dump(a,b,c,0)
69#endif
70
71/* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and
72 * AP_LUA_DECLARE_DATA with appropriate export and import tags for the platform
73 */
74#if !defined(WIN32)
75#define AP_LUA_DECLARE(type) type
76#define AP_LUA_DECLARE_NONSTD(type) type
77#define AP_LUA_DECLARE_DATA
78#elif defined(AP_LUA_DECLARE_STATIC)
79#define AP_LUA_DECLARE(type) type __stdcall
80#define AP_LUA_DECLARE_NONSTD(type) type
81#define AP_LUA_DECLARE_DATA
82#elif defined(AP_LUA_DECLARE_EXPORT)
83#define AP_LUA_DECLARE(type) __declspec(dllexport) type __stdcall
84#define AP_LUA_DECLARE_NONSTD(type) __declspec(dllexport) type
85#define AP_LUA_DECLARE_DATA __declspec(dllexport)
86#else
87#define AP_LUA_DECLARE(type) __declspec(dllimport) type __stdcall
88#define AP_LUA_DECLARE_NONSTD(type) __declspec(dllimport) type
89#define AP_LUA_DECLARE_DATA __declspec(dllimport)
90#endif
91
92
93#include "lua_request.h"
94#include "lua_vmprep.h"
95
102
107#ifndef lua_boxpointer
108#define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
109#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
110#endif
111
112void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg);
113
114typedef struct
115{
118
124
126
130 unsigned int vm_scope;
131 unsigned int vm_min;
132 unsigned int vm_max;
133
134 /* info for the hook harnesses */
135 apr_hash_t *hooks; /* <wombat_hook_info> */
136
137 /* the actual directory being configured */
138 const char *dir;
139
140 /* Whether Lua scripts in a sub-dir are run before parents */
142
146 unsigned int codecache;
147
149
150typedef struct
151{
152 /* value of the LuaRoot directive */
153 const char *root_path;
155
156typedef struct
157{
158 const char *function_name;
161
167
168typedef struct
169{
171 const char *function;
173
174extern module AP_MODULE_DECLARE_DATA lua_module;
175
178
181
183 request_rec *r, const char *var);
184
186
187#endif /* !_MOD_LUA_H_ */
Symbol export macros and hook functions.
Apache Regex defines.
APR-UTIL Buckets/Bucket Brigades.
APR File Information.
APR Hash Tables.
Apache hook functions.
APR-UTIL Resource List Routines.
APR Strings library.
APR Table library.
APR Reader/Writer Lock Routines.
APR Time Library.
request_rec * r
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition apr_hooks.h:118
apr_size_t size
apr_vformatter_buff_t * c
Definition apr_lib.h:175
const char * s
Definition apr_strings.h:95
Apache Configuration.
CORE HTTP Daemon.
Apache Logging library.
HTTP protocol handling.
Apache Request library.
SSL protocol handling.
HTTP Daemon routines.
apr_pool_t * p
Definition md_event.c:32
const char * ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var)
Definition mod_lua.c:1705
int ap_lua_ssl_is_https(conn_rec *c)
Definition mod_lua.c:1711
void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg)
Definition lua_request.c:50
ap_lua_inherit_t
Definition mod_lua.h:96
@ AP_LUA_INHERIT_PARENT_LAST
Definition mod_lua.h:100
@ AP_LUA_INHERIT_PARENT_FIRST
Definition mod_lua.h:99
@ AP_LUA_INHERIT_UNSET
Definition mod_lua.h:97
@ AP_LUA_INHERIT_NONE
Definition mod_lua.h:98
apr_hash_t * hooks
Definition mod_lua.h:135
apr_array_header_t * package_paths
Definition mod_lua.h:116
unsigned int vm_min
Definition mod_lua.h:131
unsigned int codecache
Definition mod_lua.h:146
apr_array_header_t * package_cpaths
Definition mod_lua.h:117
unsigned int vm_max
Definition mod_lua.h:132
ap_lua_inherit_t inherit
Definition mod_lua.h:141
apr_array_header_t * mapped_handlers
Definition mod_lua.h:122
apr_pool_t * pool
Definition mod_lua.h:125
const char * dir
Definition mod_lua.h:138
apr_array_header_t * mapped_filters
Definition mod_lua.h:123
unsigned int vm_scope
Definition mod_lua.h:130
const char * function
Definition mod_lua.h:171
lua_State * L
Definition mod_lua.h:170
apr_hash_t * request_scoped_vms
Definition mod_lua.h:165
mapped_request_details * mapped_request_details
Definition mod_lua.h:164
const char * root_path
Definition mod_lua.h:153
Structure to store things which are per connection.
Definition httpd.h:1152
ap_lua_vm_spec * spec
Definition mod_lua.h:159
const char * function_name
Definition mod_lua.h:158
A structure that represents the current request.
Definition httpd.h:845
A structure to store information for each virtual server.
Definition httpd.h:1322
#define var
Apache filter library.