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 
52 #if LUA_VERSION_NUM > 503
53 #define lua_resume(a,b,c) lua_resume(a, NULL, b, c)
54 #else
55 /* ### For version < 5.4, assume that exactly one stack item is on the
56  * stack, which is what the code did before but seems dubious. */
57 #define lua_resume(a,b,c) (*(c) = 1, lua_resume(a, NULL, b))
58 #endif
59 
60 #define luaL_setfuncs_compat(a,b) luaL_setfuncs(a,b,0)
61 #else
62 #define lua_rawlen(L,i) lua_objlen(L, (i))
63 #define luaL_setfuncs_compat(a,b) luaL_register(a,NULL,b)
64 #define lua_resume(a,b,c) (*(c) = 1, lua_resume(a, b))
65 #endif
66 #if LUA_VERSION_NUM > 502
67 #define lua_dump(a,b,c) lua_dump(a,b,c,0)
68 #endif
69 
70 /* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and
71  * AP_LUA_DECLARE_DATA with appropriate export and import tags for the platform
72  */
73 #if !defined(WIN32)
74 #define AP_LUA_DECLARE(type) type
75 #define AP_LUA_DECLARE_NONSTD(type) type
76 #define AP_LUA_DECLARE_DATA
77 #elif defined(AP_LUA_DECLARE_STATIC)
78 #define AP_LUA_DECLARE(type) type __stdcall
79 #define AP_LUA_DECLARE_NONSTD(type) type
80 #define AP_LUA_DECLARE_DATA
81 #elif defined(AP_LUA_DECLARE_EXPORT)
82 #define AP_LUA_DECLARE(type) __declspec(dllexport) type __stdcall
83 #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllexport) type
84 #define AP_LUA_DECLARE_DATA __declspec(dllexport)
85 #else
86 #define AP_LUA_DECLARE(type) __declspec(dllimport) type __stdcall
87 #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllimport) type
88 #define AP_LUA_DECLARE_DATA __declspec(dllimport)
89 #endif
90 
91 
92 #include "lua_request.h"
93 #include "lua_vmprep.h"
94 
95 typedef enum {
101 
106 #ifndef lua_boxpointer
107 #define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
108 #define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
109 #endif
110 
111 void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg);
112 
113 typedef struct
114 {
117 
123 
125 
129  unsigned int vm_scope;
130  unsigned int vm_min;
131  unsigned int vm_max;
132 
133  /* info for the hook harnesses */
134  apr_hash_t *hooks; /* <wombat_hook_info> */
135 
136  /* the actual directory being configured */
137  const char *dir;
138 
139  /* Whether Lua scripts in a sub-dir are run before parents */
141 
145  unsigned int codecache;
146 
148 
149 typedef struct
150 {
151  /* value of the LuaRoot directive */
152  const char *root_path;
154 
155 typedef struct
156 {
157  const char *function_name;
160 
161 typedef struct
162 {
166 
167 typedef struct
168 {
169  lua_State *L;
170  const char *function;
172 
174 
175 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_open,
176  (lua_State *L, apr_pool_t *p))
177 
178 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_request,
179  (lua_State *L, request_rec *r))
180 
181 const char *ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c,
182  request_rec *r, const char *var);
183 
185 
186 #endif /* !_MOD_LUA_H_ */
const char * dir
Definition: mod_lua.h:137
Apache Configuration.
APR Reader/Writer Lock Routines.
lua_State * L
Definition: mod_lua.h:169
Definition: apr_tables.h:62
ap_lua_inherit_t
Definition: mod_lua.h:95
apr_array_header_t * mapped_handlers
Definition: mod_lua.h:121
APR File Information.
apr_hash_t * hooks
Definition: mod_lua.h:134
Definition: mod_lua.h:161
void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg)
unsigned int vm_scope
Definition: mod_lua.h:129
APR Hash Tables.
Apache Regex defines.
Definition: mod_lua.h:96
CORE HTTP Daemon.
ap_lua_vm_spec * spec
Definition: mod_lua.h:158
unsigned int vm_max
Definition: mod_lua.h:131
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:157
Symbol export macros and hook functions.
Definition: mod_lua.h:98
apr_pool_t * pool
Definition: mod_lua.h:124
Apache Logging library.
mapped_request_details * mapped_request_details
Definition: mod_lua.h:163
HTTP Daemon routines.
Apache hook functions.
apr_array_header_t * package_paths
Definition: mod_lua.h:115
Definition: mod_lua.h:113
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:145
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:164
apr_pool_t * p
Definition: mod_lua.h:149
Definition: mod_lua.h:167
#define AP_MODULE_DECLARE_DATA
Definition: macros.h:16
Definition: mod_lua.h:155
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:97
apr_array_header_t * mapped_filters
Definition: mod_lua.h:122
apr_array_header_t * package_cpaths
Definition: mod_lua.h:116
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: mod_lua.h:99
Definition: http_config.h:355
request_rec * r
Definition: mod_dav.h:518
ap_lua_inherit_t inherit
Definition: mod_lua.h:140
APR Time Library.
const char * root_path
Definition: mod_lua.h:152
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:130