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 /* Allow for Lua 5.2 backwards compatibility */
45 #define LUA_COMPAT_ALL
46 /* Allow for Lua 5.3 backwards compatibility */
47 #define LUA_COMPAT_5_2
48 #define LUA_COMPAT_5_1
49 #define LUA_COMPAT_MODULE
50 
51 #include "lua.h"
52 #include "lauxlib.h"
53 #include "lualib.h"
54 
55 #if LUA_VERSION_NUM > 501
56 /* Load mode for lua_load() */
57 #define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL)
58 #define lua_resume(a,b) lua_resume(a, NULL, b)
59 #else
60 #define lua_rawlen(L,i) lua_objlen(L, (i))
61 #endif
62 
63 /* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and
64  * AP_LUA_DECLARE_DATA with appropriate export and import tags for the platform
65  */
66 #if !defined(WIN32)
67 #define AP_LUA_DECLARE(type) type
68 #define AP_LUA_DECLARE_NONSTD(type) type
69 #define AP_LUA_DECLARE_DATA
70 #elif defined(AP_LUA_DECLARE_STATIC)
71 #define AP_LUA_DECLARE(type) type __stdcall
72 #define AP_LUA_DECLARE_NONSTD(type) type
73 #define AP_LUA_DECLARE_DATA
74 #elif defined(AP_LUA_DECLARE_EXPORT)
75 #define AP_LUA_DECLARE(type) __declspec(dllexport) type __stdcall
76 #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllexport) type
77 #define AP_LUA_DECLARE_DATA __declspec(dllexport)
78 #else
79 #define AP_LUA_DECLARE(type) __declspec(dllimport) type __stdcall
80 #define AP_LUA_DECLARE_NONSTD(type) __declspec(dllimport) type
81 #define AP_LUA_DECLARE_DATA __declspec(dllimport)
82 #endif
83 
84 
85 #include "lua_request.h"
86 #include "lua_vmprep.h"
87 
88 typedef enum {
94 
99 #ifndef lua_boxpointer
100 #define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
101 #define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
102 #endif
103 
104 void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg);
105 
106 typedef struct
107 {
110 
116 
118 
122  unsigned int vm_scope;
123  unsigned int vm_min;
124  unsigned int vm_max;
125 
126  /* info for the hook harnesses */
127  apr_hash_t *hooks; /* <wombat_hook_info> */
128 
129  /* the actual directory being configured */
130  const char *dir;
131 
132  /* Whether Lua scripts in a sub-dir are run before parents */
134 
138  unsigned int codecache;
139 
141 
142 typedef struct
143 {
144  /* value of the LuaRoot directive */
145  const char *root_path;
147 
148 typedef struct
149 {
150  const char *function_name;
153 
154 typedef struct
155 {
159 
160 typedef struct
161 {
162  lua_State *L;
163  const char *function;
165 
167 
168 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_open,
169  (lua_State *L, apr_pool_t *p))
170 
171 APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_request,
172  (lua_State *L, request_rec *r))
173 
174 const char *ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c,
175  request_rec *r, const char *var);
176 
178 
179 #endif /* !_MOD_LUA_H_ */
const char * dir
Definition: mod_lua.h:130
Apache Configuration.
APR Reader/Writer Lock Routines.
lua_State * L
Definition: mod_lua.h:162
Definition: apr_tables.h:62
ap_lua_inherit_t
Definition: mod_lua.h:88
apr_array_header_t * mapped_handlers
Definition: mod_lua.h:114
APR File Information.
apr_hash_t * hooks
Definition: mod_lua.h:127
Definition: mod_lua.h:154
void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg)
unsigned int vm_scope
Definition: mod_lua.h:122
APR Hash Tables.
Apache Regex defines.
Definition: mod_lua.h:89
CORE HTTP Daemon.
ap_lua_vm_spec * spec
Definition: mod_lua.h:151
unsigned int vm_max
Definition: mod_lua.h:124
Structure to store things which are per connection.
Definition: httpd.h:1110
APR-UTIL Resource List Routines.
const char * function_name
Definition: mod_lua.h:150
Symbol export macros and hook functions.
Definition: mod_lua.h:91
apr_pool_t * pool
Definition: mod_lua.h:117
Apache Logging library.
mapped_request_details * mapped_request_details
Definition: mod_lua.h:156
HTTP Daemon routines.
Apache hook functions.
apr_array_header_t * package_paths
Definition: mod_lua.h:108
Definition: mod_lua.h:106
A structure to store information for each virtual server.
Definition: httpd.h:1302
#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:138
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:157
apr_pool_t * p
Definition: mod_lua.h:142
Definition: mod_lua.h:160
#define AP_MODULE_DECLARE_DATA
Definition: macros.h:16
Definition: mod_lua.h:148
Definition: lua_vmprep.h:58
Apache Request library.
A structure that represents the current request.
Definition: httpd.h:805
Apache filter library.
APR Strings library.
int ap_lua_ssl_is_https(conn_rec *c)
Definition: mod_lua.h:90
apr_array_header_t * mapped_filters
Definition: mod_lua.h:115
apr_array_header_t * package_cpaths
Definition: mod_lua.h:109
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: mod_lua.h:92
Definition: http_config.h:349
request_rec * r
Definition: mod_dav.h:519
ap_lua_inherit_t inherit
Definition: mod_lua.h:133
APR Time Library.
const char * root_path
Definition: mod_lua.h:145
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:123