Apache HTTPD
lua_vmprep.h
Go to the documentation of this file.
1
18#include "lua.h"
19#include "lauxlib.h"
20#include "lualib.h"
21
22#include "httpd.h"
23
24#include "apr_thread_rwlock.h"
25#include "apr_strings.h"
26#include "apr_tables.h"
27#include "apr_hash.h"
28#include "apr_buckets.h"
29#include "apr_file_info.h"
30#include "apr_time.h"
31#include "apr_pools.h"
32#include "apr_reslist.h"
33
34
35#ifndef VMPREP_H
36#define VMPREP_H
37
38#define AP_LUA_SCOPE_UNSET 0
39#define AP_LUA_SCOPE_ONCE 1
40#define AP_LUA_SCOPE_REQUEST 2
41#define AP_LUA_SCOPE_CONN 3
42#define AP_LUA_SCOPE_THREAD 4
43#define AP_LUA_SCOPE_SERVER 5
44
45#define AP_LUA_CACHE_UNSET 0
46#define AP_LUA_CACHE_NEVER 1
47#define AP_LUA_CACHE_STAT 2
48#define AP_LUA_CACHE_FOREVER 3
49
50#define AP_LUA_FILTER_INPUT 1
51#define AP_LUA_FILTER_OUTPUT 2
52
54 void *ctx);
58typedef struct
59{
60 /* NEED TO ADD ADDITIONAL PACKAGE PATHS AS PART OF SPEC INSTEAD OF DIR CONFIG */
63
64 /* name of base file to load in the vm */
65 const char *file;
66
67 /* APL_SCOPE_ONCE | APL_SCOPE_REQUEST | APL_SCOPE_CONN | APL_SCOPE_THREAD | APL_SCOPE_SERVER */
68 int scope;
69 unsigned int vm_min;
70 unsigned int vm_max;
71
73 void* cb_arg;
74
75 /* pool to use for lifecycle if APL_SCOPE_ONCE is set, otherwise unused */
77
78 /* Pre-compiled Lua Byte code to load directly. If bytecode_len is >0,
79 * the file part of this structure is ignored for loading purposes, but
80 * it is used for error messages.
81 */
82 const char *bytecode;
84
87
98
99typedef struct
100{
101 const char *function_name;
102 const char *file_name;
103 const char* filter_name;
104 int direction; /* AP_LUA_FILTER_INPUT | AP_LUA_FILTER_OUTPUT */
106
112
117
122
123/*
124 * alternate means of getting lua_State (preferred eventually)
125 * Obtain a lua_State which has loaded file and is associated with lifecycle_pool
126 * If one exists, will return extant one, otherwise will create, attach, and return
127 * This does no locking around the lua_State, so if the pool is shared between
128 * threads, locking is up the client.
129 *
130 * @lifecycle_pool -> pool whose lifeycle controls the lua_State
131 * @file file to be opened, also used as a key for uniquing lua_States
132 * @cb callback for vm initialization called *before* the file is opened
133 * @ctx a baton passed to cb
134 */
137
138#if APR_HAS_THREADS || defined(DOXYGEN)
139/*
140 * Initialize mod_lua mutex.
141 * @pool pool for mutex
142 * @s server_rec for logging
143 */
145#endif
146
147#endif
APR-UTIL Buckets/Bucket Brigades.
APR File Information.
APR Hash Tables.
APR memory allocation.
APR-UTIL Resource List Routines.
APR Strings library.
APR Table library.
APR Reader/Writer Lock Routines.
APR Time Library.
request_rec * r
apr_brigade_flush void * ctx
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
const char * s
Definition apr_strings.h:95
apr_int64_t apr_time_t
Definition apr_time.h:45
HTTP Daemon routines.
void ap_lua_init_mutex(apr_pool_t *pool, server_rec *s)
Definition lua_vmprep.c:43
lua_State * ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, ap_lua_vm_spec *spec, request_rec *r)
Definition lua_vmprep.c:436
void ap_lua_load_apache2_lmodule(lua_State *L)
Definition lua_vmprep.c:145
void(* ap_lua_state_open_callback)(lua_State *L, apr_pool_t *p, void *ctx)
Definition lua_vmprep.h:53
apr_pool_t * p
Definition md_event.c:32
apr_time_t modified
Definition lua_vmprep.h:109
apr_size_t runs
Definition lua_vmprep.h:108
apr_off_t size
Definition lua_vmprep.h:110
ap_lua_finfo * finfo
Definition lua_vmprep.h:115
apr_array_header_t * package_paths
Definition lua_vmprep.h:61
unsigned int vm_max
Definition lua_vmprep.h:70
const char * bytecode
Definition lua_vmprep.h:82
apr_pool_t * pool
Definition lua_vmprep.h:76
apr_array_header_t * package_cpaths
Definition lua_vmprep.h:62
unsigned int vm_min
Definition lua_vmprep.h:69
apr_size_t bytecode_len
Definition lua_vmprep.h:83
ap_lua_state_open_callback cb
Definition lua_vmprep.h:72
const char * file
Definition lua_vmprep.h:65
A structure that represents the current request.
Definition httpd.h:845
A structure to store information for each virtual server.
Definition httpd.h:1322