Apache2
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 
96 typedef enum {
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 
112 void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg);
113 
114 typedef 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 
150 typedef struct
151 {
152  /* value of the LuaRoot directive */
153  const char *root_path;
155 
156 typedef struct
157 {
158  const char *function_name;
161 
162 typedef struct
163 {
167 
168 typedef struct
169 {
170  lua_State *L;
171  const char *function;
173 
175 
176 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_open,
177  (lua_State *L, apr_pool_t *p))
178 
179 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_request,
180  (lua_State *L, request_rec *r))
181 
182 const char *ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c,
183  request_rec *r, const char *var);
184 
186 
187 #endif /* !_MOD_LUA_H_ */
const char * dir
Definition: mod_lua.h:138
Apache Configuration.
APR Reader/Writer Lock Routines.
lua_State * L
Definition: mod_lua.h:170
Definition: apr_tables.h:62
ap_lua_inherit_t
Definition: mod_lua.h:96
apr_array_header_t * mapped_handlers
Definition: mod_lua.h:122
APR File Information.
apr_hash_t * hooks
Definition: mod_lua.h:135
Definition: mod_lua.h:162
void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg)
unsigned int vm_scope
Definition: mod_lua.h:130
APR Hash Tables.
Apache Regex defines.
Definition: mod_lua.h:97
CORE HTTP Daemon.
ap_lua_vm_spec * spec
Definition: mod_lua.h:159
unsigned int vm_max
Definition: mod_lua.h:132
Structure to store things which are per connection.
Definition: httpd.h:1183
APR-UTIL Resource List Routines.
const char * function_name
Definition: mod_lua.h:158
Symbol export macros and hook functions.
Definition: mod_lua.h:99
apr_pool_t * pool
Definition: mod_lua.h:125
Apache Logging library.
mapped_request_details * mapped_request_details
Definition: mod_lua.h:164
HTTP Daemon routines.
Apache hook functions.
apr_array_header_t * package_paths
Definition: mod_lua.h:116
Definition: mod_lua.h:114
A structure to store information for each virtual server.
Definition: httpd.h:1370
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition: apr_hooks.h:118
APR Table library.
APR-UTIL Buckets/Bucket Brigades.
unsigned int codecache
Definition: mod_lua.h:146
module AP_MODULE_DECLARE_DATA lua_module
struct apr_hash_t apr_hash_t
Definition: apr_hash.h:52
HTTP protocol handling.
apr_hash_t * request_scoped_vms
Definition: mod_lua.h:165
apr_pool_t * p
Definition: mod_lua.h:150
Definition: mod_lua.h:168
#define AP_MODULE_DECLARE_DATA
Definition: macros.h:16
Definition: mod_lua.h:156
Definition: lua_vmprep.h:58
Apache Request library.
A structure that represents the current request.
Definition: httpd.h:860
Apache filter library.
APR Strings library.
int ap_lua_ssl_is_https(conn_rec *c)
Definition: mod_lua.h:98
apr_array_header_t * mapped_filters
Definition: mod_lua.h:123
apr_array_header_t * package_cpaths
Definition: mod_lua.h:117
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: mod_lua.h:100
Definition: http_config.h:355
request_rec * r
Definition: mod_dav.h:518
ap_lua_inherit_t inherit
Definition: mod_lua.h:141
APR Time Library.
const char * root_path
Definition: mod_lua.h:153
const char * ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var)
unsigned int vm_min
Definition: mod_lua.h:131
SSL protocol handling.