Barracuda Application Server C/C++ Reference
NO
|
balua.h is header file that provides the public symbols for creating, destroying and configuring an LSP VM.
Creating and initializing A Barracuda Lua VM consists of calling balua_create() and calling balua_loadconfig().
See the C startup source code for the two following examples for more information on how to initialize the LSP plugin:
Modules | |
Weak Table reference | |
Functions designed to be similar to using luaL_ref(L,
LUA_REGISTRYINDEX), lua_rawgeti(L, LUA_REGISTRYINDEX, ix), and luaL_unref(L, LUA_REGISTRYINDEX, ix), but with weak references. | |
Auxiliary API | |
The optional Lua code in xrc/lua, header file xrc/lua/lxrc.h. | |
Classes | |
struct | BaLua_param |
The startup and runtime parameters for a Barracuda Server Lua VM. More... | |
struct | LHttpDir |
LHttpDir is the HttpDir instance used by Lua bindings and can be used by advanced Lua bindings creating new HttpDir type Lua interfaces. More... | |
Macros | |
#define | balua_create(p) _balua_create(p, BALUA_VERSION) |
Creates the Barracuda Lua VM. | |
#define | balua_getmutex(L) balua_getparam(L)->mutex |
Get the SoDisp mutex. | |
#define | balua_releasemutex(m) if(m) ThreadMutex_release(m) |
Release mutex 'm'. | |
#define | balua_setmutex(m) if(m) ThreadMutex_set(m) |
Set mutex 'm'. | |
Typedefs | |
typedef struct LHttpDir | LHttpDir |
LHttpDir is the HttpDir instance used by Lua bindings and can be used by advanced Lua bindings creating new HttpDir type Lua interfaces. More... | |
Functions | |
BA_API void * | baLMalloc (lua_State *L, size_t size) |
Same as baMalloc, but does an emergency GC if baMalloc returns NULL. | |
BA_API lua_State * | _balua_create (const BaLua_param *p, int version) |
Creates the Barracuda Lua VM; Note: use macro balua_create(BaLua_param). | |
BA_API int | balua_usertracker_create (lua_State *L, U32 noOfLoginTrackerNodes, U32 maxNumberOfLogins, BaTime banTime) |
Install Lua bindings for the default login tracker. More... | |
BA_API void | balua_getuservalue (lua_State *L, int index) |
Pushes onto the stack the first user value associated with the full userdata at the given index. More... | |
BA_API int | balua_loadconfig (lua_State *L, struct IoIntf *io, const char *filename) |
Load a Lua script and run the script at startup. More... | |
BA_API int | balua_loadconfigExt (lua_State *L, struct IoIntf *io, const char *filename, int nresults) |
Load a Lua script and run the script at startup. More... | |
BA_API IoIntf * | balua_iointf (lua_State *L, const char *name, struct IoIntf *newio) |
Register an IoIntf instance with the Lua VM. More... | |
BA_API void | balua_ubjson (lua_State *L) |
Install the UBJSON lua api. | |
BA_API int | baCheckZipSignature (const U8 *pubKey, U32 fileSize, struct CspReader *reader) |
Verifies the signature of a ZIP file using a public key. More... | |
BA_API void | balua_installZIO (lua_State *L, const char *name, struct ZipReader *reader) |
Installs a Zip I/O interface into the Lua environment. More... | |
BA_API int baCheckZipSignature | ( | const U8 * | pubKey, |
U32 | fileSize, | ||
struct CspReader * | reader | ||
) |
Verifies the signature of a ZIP file using a public key.
This function checks the signature of a ZIP file using the provided public key. It reads data from the given CspReader and validates the ZIP file's signature.
pubKey | Pointer to the public key used for signature verification. |
fileSize | Size of the public key. |
reader | Pointer to the CspReader structure used for reading the ZIP file. |
BA_API void balua_getuservalue | ( | lua_State * | L, |
int | index | ||
) |
Pushes onto the stack the first user value associated with the full userdata at the given index.
This function is similar to lua_getiuservalue(), but creates a table at the first user value if it does not exist. Note index must be absolute i.e. not < 0. A table is pushed on the stack when this function returns.
BA_API void balua_installZIO | ( | lua_State * | L, |
const char * | name, | ||
struct ZipReader * | reader | ||
) |
Installs a Zip I/O interface into the Lua environment.
This function registers a ZIP reader with the Lua environment, making it accessible via the provided name (the handle). It is typically used to enable the Lua function ba.mkio() to open embedded ZIP files.
L | Pointer to the Lua state. |
name | Name under which the ZIP reader will be installed in Lua and made available to ba.mkio(name) |
reader | Pointer to the ZipReader structure to be installed. |
Register an IoIntf instance with the Lua VM.
You may install any number of I/O interfaces, but each I/O interface must be registered with a unique name.
BA_API int balua_loadconfig | ( | lua_State * | L, |
struct IoIntf * | io, | ||
const char * | filename | ||
) |
Load a Lua script and run the script at startup.
You may call this function multiple times during startup.
L | the Lua state. |
io | the I/O interface to use when loading script 'filename'. |
filename | the path+name of the Lua script. The name defaults to .config if this parameter is NULL. |
BA_API int balua_loadconfigExt | ( | lua_State * | L, |
struct IoIntf * | io, | ||
const char * | filename, | ||
int | nresults | ||
) |
Load a Lua script and run the script at startup.
You may call this function multiple times during startup. This function is extends balua_loadconfig and enables you to get return values from the script.
L | the Lua state. |
io | the I/O interface to use when loading script 'filename'. |
filename | the path+name of the Lua script. The name defaults to .config if this parameter is NULL. |
nresults | value passed to lua_pcall |
BA_API int balua_usertracker_create | ( | lua_State * | L, |
U32 | noOfLoginTrackerNodes, | ||
U32 | maxNumberOfLogins, | ||
BaTime | banTime | ||
) |
Install Lua bindings for the default login tracker.
See one of the two following C code examples for how to use this function: MakoMain.c or xedge.c
L | the state |
noOfLoginTrackerNodes | tracker size |
maxNumberOfLogins | how many login attempts before user (IP address) is banned |
banTime | how long in seconds to ban an IP address |