Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 "ap_regex.h"
30 
31 #include "ap_config.h"
32 #include "util_filter.h"
33 
34 #include "apr_thread_rwlock.h"
35 #include "apr_strings.h"
36 #include "apr_tables.h"
37 #include "apr_hash.h"
38 #include "apr_buckets.h"
39 #include "apr_file_info.h"
40 #include "apr_time.h"
41 #include "apr_hooks.h"
42 #include "apr_reslist.h"
43 
44 #include "lua.h"
45 #include "lauxlib.h"
46 #include "lualib.h"
47 
48 #if LUA_VERSION_NUM > 501
49 /* Load mode for lua_load() */
50 #define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL)
51 #define lua_resume(a,b) lua_resume(a, NULL, b)
52 #define luaL_setfuncs_compat(a,b) luaL_setfuncs(a,b,0)
53 #else
54 #define lua_rawlen(L,i) lua_objlen(L, (i))
55 #define luaL_setfuncs_compat(a,b) luaL_register(a,NULL,b)
56 #endif
57 #if LUA_VERSION_NUM > 502
58 #define lua_dump(a,b,c) lua_dump(a,b,c,0)
59 #endif
60 
61 /* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and
62  * AP_LUA_DECLARE_DATA with appropriate export and import tags for the platform
63  */
64 #if !defined(WIN32)
65 #define AP_LUA_DECLARE(type) type
66 #define AP_LUA_DECLARE_NONSTD(type) type
67 #define AP_LUA_DECLARE_DATA
68 #elif defined(AP_LUA_DECLARE_STATIC)
69 #define AP_LUA_DECLARE(type) type __stdcall
70 #define AP_LUA_DECLARE_NONSTD(type) type
71 #define AP_LUA_DECLARE_DATA
72 #elif defined(AP_LUA_DECLARE_EXPORT)
73 #define AP_LUA_DECLARE(type) __declspec(dllexport) type __stdcall
74 #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllexport) type
75 #define AP_LUA_DECLARE_DATA __declspec(dllexport)
76 #else
77 #define AP_LUA_DECLARE(type) __declspec(dllimport) type __stdcall
78 #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllimport) type
79 #define AP_LUA_DECLARE_DATA __declspec(dllimport)
80 #endif
81 
82 
83 #include "lua_request.h"
84 #include "lua_vmprep.h"
85 
86 typedef enum {
92 
97 #ifndef lua_boxpointer
98 #define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
99 #define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
100 #endif
101 
102 void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg);
103 
104 typedef struct
105 {
108 
114 
116 
120  unsigned int vm_scope;
121  unsigned int vm_min;
122  unsigned int vm_max;
123 
124  /* info for the hook harnesses */
125  apr_hash_t *hooks; /* <wombat_hook_info> */
126 
127  /* the actual directory being configured */
128  const char *dir;
129 
130  /* Whether Lua scripts in a sub-dir are run before parents */
132 
136  unsigned int codecache;
137 
139 
140 typedef struct
141 {
142  /* value of the LuaRoot directive */
143  const char *root_path;
145 
146 typedef struct
147 {
148  const char *function_name;
151 
152 typedef struct
153 {
157 
158 typedef struct
159 {
160  lua_State *L;
161  const char *function;
163 
165 
166 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_open,
167  (lua_State *L, apr_pool_t *p))
168 
169 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_request,
170  (lua_State *L, request_rec *r))
171 
172 const char *ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c,
173  request_rec *r, const char *var);
174 
176 
177 #endif /* !_MOD_LUA_H_ */
const char * dir
Definition: mod_lua.h:128
Apache Configuration.
APR Reader/Writer Lock Routines.
lua_State * L
Definition: mod_lua.h:160
Definition: apr_tables.h:62
ap_lua_inherit_t
Definition: mod_lua.h:86
apr_array_header_t * mapped_handlers
Definition: mod_lua.h:112
APR File Information.
apr_hash_t * hooks
Definition: mod_lua.h:125
Definition: mod_lua.h:152
void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg)
unsigned int vm_scope
Definition: mod_lua.h:120
APR Hash Tables.
Apache Regex defines.
Definition: mod_lua.h:87
CORE HTTP Daemon.
ap_lua_vm_spec * spec
Definition: mod_lua.h:149
unsigned int vm_max
Definition: mod_lua.h:122
Structure to store things which are per connection.
Definition: httpd.h:1116
APR-UTIL Resource List Routines.
const char * function_name
Definition: mod_lua.h:148
Symbol export macros and hook functions.
Definition: mod_lua.h:89
apr_pool_t * pool
Definition: mod_lua.h:115
Apache Logging library.
mapped_request_details * mapped_request_details
Definition: mod_lua.h:154
HTTP Daemon routines.
Apache hook functions.
apr_array_header_t * package_paths
Definition: mod_lua.h:106
Definition: mod_lua.h:104
A structure to store information for each virtual server.
Definition: httpd.h:1310
#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:136
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:155
apr_pool_t * p
Definition: mod_lua.h:140
Definition: mod_lua.h:158
#define AP_MODULE_DECLARE_DATA
Definition: macros.h:16
Definition: mod_lua.h:146
Definition: lua_vmprep.h:58
Apache Request library.
A structure that represents the current request.
Definition: httpd.h:806
Apache filter library.
APR Strings library.
int ap_lua_ssl_is_https(conn_rec *c)
Definition: mod_lua.h:88
apr_array_header_t * mapped_filters
Definition: mod_lua.h:113
apr_array_header_t * package_cpaths
Definition: mod_lua.h:107
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: mod_lua.h:90
Definition: http_config.h:355
request_rec * r
Definition: mod_dav.h:515
ap_lua_inherit_t inherit
Definition: mod_lua.h:131
APR Time Library.
const char * root_path
Definition: mod_lua.h:143
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:121