int luaopen_ssl(lua_State *L) { int i; SSL_load_error_strings(); SSLeay_add_ssl_algorithms(); auxiliar_newclass(L, "openssl.ssl_ctx", ssl_ctx_funcs); auxiliar_newclass(L, "openssl.ssl_session", ssl_session_funcs); auxiliar_newclass(L, "openssl.ssl", ssl_funcs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); for (i = 0; i < sizeof(ssl_options) / sizeof(LuaL_Enum) - 1; i++) { LuaL_Enum e = ssl_options[i]; lua_pushinteger(L, e.val); lua_setfield(L, -2, e.name); } return 1; }
int luaopen_shaders(lua_State *L) { auxiliar_newclass(L, "gl{shader}", shader_reg); auxiliar_newclass(L, "gl{program}", program_reg); luaL_openlib(L, "core.shader", shaderlib, 0); lua_pop(L, 1); return 1; }
int luaopen_x509_crl(lua_State *L) { auxiliar_newclass(L, "openssl.x509_crl", crl_funcs); auxiliar_newclass(L, "openssl.x509_revoked", revoked_funcs); lua_newtable(L); luaL_setfuncs(L, R, 0); return 1; }
LUATHREAD_API int luaopen_thread_core(lua_State *L) { auxiliar_open(L); auxiliar_newclass(L, "mutex", mutex_ops); auxiliar_newclass(L, "cond", cond_ops); luaL_openlib(L, "thread", lib_ops, 0); lua_pushstring(L, "_VERSION"); lua_pushstring(L, LUATHREAD_VERSION); lua_settable(L, -3); return 1; }
int luaopen_digest(lua_State *L) { auxiliar_newclass(L, "openssl.evp_digest", digest_funs); auxiliar_newclass(L, "openssl.evp_digest_ctx", digest_ctx_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); return 1; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int udp_open(lua_State *L) { /* create classes */ auxiliar_newclass(L, "udp{connected}", udp); auxiliar_newclass(L, "udp{unconnected}", udp); /* create class groups */ auxiliar_add2group(L, "udp{connected}", "udp{any}"); auxiliar_add2group(L, "udp{unconnected}", "udp{any}"); auxiliar_add2group(L, "udp{connected}", "select{able}"); auxiliar_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ luaL_openlib(L, NULL, func, 0); return 0; }
int luaopen_ocsp(lua_State *L) { auxiliar_newclass(L, "openssl.ocsp_request", ocsp_req_cfuns); auxiliar_newclass(L, "openssl.ocsp_response", ocsp_res_cfuns); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); return 1; }
int luaopen_ec(lua_State *L) { auxiliar_newclass(L, "openssl.ec_point", ec_point_funs); auxiliar_newclass(L, "openssl.ec_group", ec_group_funs); auxiliar_newclass(L, "openssl.ec_key", ec_key_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); return 1; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int tcp_open(lua_State *L) { /* create classes */ auxiliar_newclass(L, "tcp{master}", tcp); auxiliar_newclass(L, "tcp{client}", tcp); auxiliar_newclass(L, "tcp{server}", tcp); /* create class groups */ auxiliar_add2group(L, "tcp{master}", "tcp{any}"); auxiliar_add2group(L, "tcp{client}", "tcp{any}"); auxiliar_add2group(L, "tcp{server}", "tcp{any}"); /* define library functions */ luaL_openlib(L, NULL, func, 0); return 0; }
int luaopen_cms(lua_State *L) { #if OPENSSL_VERSION_NUMBER > 0x00909000L && !defined (LIBRESSL_VERSION_NUMBER) int i; ERR_load_CMS_strings(); auxiliar_newclass(L, "openssl.cms", cms_ctx_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); for (i = 0; i < sizeof(cms_flags) / sizeof(LuaL_Enum) - 1; i++) { LuaL_Enum e = cms_flags[i]; lua_pushinteger(L, e.val); lua_setfield(L, -2, e.name); } #else lua_pushnil(L); #endif return 1; }
int openssl_register_xextension(lua_State*L) { auxiliar_newclass(L, "openssl.x509_extension", x509_extension_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); return 1; }
int luaopen_gas(lua_State *L) { auxiliar_newclass(L, "core{gas}", gas_reg); luaL_openlib(L, "core.gas", gaslib, 0); lua_pop(L, 1); return 1; }
int openssl_register_xextension(lua_State*L) { auxiliar_newclass(L, "openssl.x509_extension", x509_extension_funs); openssl_register_sk_x509_extension(L); luaL_register(L, MYNAME, R); return 1; }
int openssl_register_xattribute(lua_State*L) { auxiliar_newclass(L, "openssl.x509_attribute", x509_attribute_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); return 1; }
int openssl_register_lhash(lua_State* L) { auxiliar_newclass(L, "openssl.lhash", lhash_funs); AUXILIAR_SET(L, -1, "lhash_read", openssl_lhash_read, cfunction); AUXILIAR_SET(L, -1, "lhash_load", openssl_lhash_load, cfunction); return 0; };
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int luaopen_socket_unix(lua_State *L) { /* create classes */ auxiliar_newclass(L, "unix{master}", un); auxiliar_newclass(L, "unix{client}", un); auxiliar_newclass(L, "unix{server}", un); /* create class groups */ auxiliar_add2group(L, "unix{master}", "unix{any}"); auxiliar_add2group(L, "unix{client}", "unix{any}"); auxiliar_add2group(L, "unix{server}", "unix{any}"); /* make sure the function ends up in the package table */ luaL_openlib(L, "socket", func, 0); /* return the function instead of the 'socket' table */ lua_pushstring(L, "unix"); lua_gettable(L, -2); return 1; }
int luaopen_particles(lua_State *L) { auxiliar_newclass(L, "core{particles}", particles_reg); luaL_openlib(L, "core.particles", particleslib, 0); lua_pushstring(L, "ETERNAL"); lua_pushnumber(L, PARTICLE_ETERNAL); lua_rawset(L, -3); lua_pushstring(L, "ENGINE_LINES"); lua_pushnumber(L, ENGINE_LINES); lua_rawset(L, -3); lua_pushstring(L, "ENGINE_POINTS"); lua_pushnumber(L, ENGINE_POINTS); lua_rawset(L, -3); lua_pushstring(L, "BLEND_NORMAL"); lua_pushnumber(L, BLEND_NORMAL); lua_rawset(L, -3); lua_pushstring(L, "BLEND_ADDITIVE"); lua_pushnumber(L, BLEND_ADDITIVE); lua_rawset(L, -3); lua_pop(L, 1); // Make a table to store all textures lua_newtable(L); textures_ref = luaL_ref(L, LUA_REGISTRYINDEX); return 1; }
int openssl_register_xname(lua_State*L) { auxiliar_newclass(L, "openssl.x509_name", xname_funcs); lua_newtable(L); luaL_setfuncs(L, R, 0); return 1; }
int openssl_register_xattribute(lua_State*L) { auxiliar_newclass(L, "openssl.x509_attribute", x509_attribute_funs); openssl_register_sk_x509_attribute(L); luaL_register(L, MYNAME, R); return 1; }
int openssl_register_xalgor(lua_State*L) { auxiliar_newclass(L, "openssl.x509_algor", xalgor_funcs); lua_newtable(L); luaL_setfuncs(L, R, 0); return 1; }
int luaopen_x509_req(lua_State *L) { auxiliar_newclass(L, "openssl.x509_req", csr_cfuns); lua_newtable(L); luaL_setfuncs(L, R, 0); return 1; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int udp_open(lua_State *L) { /* create classes */ auxiliar_newclass(L, "udp{connected}", udp_methods); auxiliar_newclass(L, "udp{unconnected}", udp_methods); /* create class groups */ auxiliar_add2group(L, "udp{connected}", "udp{any}"); auxiliar_add2group(L, "udp{unconnected}", "udp{any}"); auxiliar_add2group(L, "udp{connected}", "select{able}"); auxiliar_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ luaL_setfuncs(L, func, 0); /* export default UDP size */ lua_pushliteral(L, "_DATAGRAMSIZE"); lua_pushinteger(L, UDP_DATAGRAMSIZE); lua_rawset(L, -3); return 0; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int udp_open(lua_State *L) { /* create classes */ auxiliar_newclass(L, "udp{connected}", udp_methods); auxiliar_newclass(L, "udp{unconnected}", udp_methods); /* create class groups */ auxiliar_add2group(L, "udp{connected}", "udp{any}"); auxiliar_add2group(L, "udp{unconnected}", "udp{any}"); auxiliar_add2group(L, "udp{connected}", "select{able}"); auxiliar_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) luaL_setfuncs(L, func, 0); #else luaL_openlib(L, NULL, func, 0); #endif return 0; }
int luaopen_serial(lua_State *L) { auxiliar_newclass(L, "core{serial}", serial_reg); luaL_openlib(L, "core.serial", seriallib, 0); lua_pop(L, 1); create_save_thread(); return 1; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int luaopen_socket_unix(lua_State *L) { /* create classes */ auxiliar_newclass(L, "unix{master}", un); auxiliar_newclass(L, "unix{client}", un); auxiliar_newclass(L, "unix{server}", un); /* create class groups */ auxiliar_add2group(L, "unix{master}", "unix{any}"); auxiliar_add2group(L, "unix{client}", "unix{any}"); auxiliar_add2group(L, "unix{server}", "unix{any}"); /* make sure the function ends up in the package table */ lua_pushcfunction(L, global_create); luax_c_insistglobal(L, "socket"); lua_pushstring(L, "unix"); lua_pushvalue(L, -3); lua_settable(L, -3); /* return the function instead of the 'socket' table */ return 1; }
int luaopen_dh(lua_State *L) { auxiliar_newclass(L, "openssl.dh", dh_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); lua_pushliteral(L, MYVERSION); lua_settable(L, -3); return 1; }
int luaopen_bio(lua_State *L) { auxiliar_newclass(L, "openssl.bio", bio_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); return 1; }
LUALIB_API int luaopen_crl(lua_State *L) { auxiliar_newclass(L, "openssl.x509_crl", crl_funcs); luaL_register(L, MYNAME, R); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); return 1; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ LUASOCKET_API int luaopen_socket_serial(lua_State *L) { /* create classes */ auxiliar_newclass(L, "serial{client}", serial_methods); /* create class groups */ auxiliar_add2group(L, "serial{client}", "serial{any}"); #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) lua_pushcfunction(L, global_create); (void) func; #else /* set function into socket namespace */ luaL_openlib(L, "socket", func, 0); lua_pushcfunction(L, global_create); #endif return 1; }
int luaopen_cms(lua_State *L) { #if OPENSSL_VERSION_NUMBER > 0x00909000L ERR_load_CMS_strings(); auxiliar_newclass(L, "openssl.cms", cms_ctx_funs); lua_newtable(L); luaL_setfuncs(L, R, 0); lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, MYVERSION); lua_settable(L, -3); #else lua_pushnil(L); #endif return 1; }