lua_methods.h (1681B)
1 /*
2 * Copyright (c) 2023 Joris Vink <joris@coders.se>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __H_LUA_METHODS_H
18 #define __H_LUA_METHODS_H
19
20 static int lua_http_request_gc(lua_State *);
21 static int lua_http_request_index(lua_State *);
22
23 static int lua_http_response(lua_State *);
24 static int lua_http_request_header(lua_State *);
25 static int lua_http_response_header(lua_State *);
26
27 static const luaL_Reg lua_http_request_meta[] = {
28 { "__gc", lua_http_request_gc },
29 { "__index", lua_http_request_index },
30 { NULL, NULL },
31 };
32
33 static const luaL_Reg lua_http_request_methods[] = {
34 { "response", lua_http_response },
35 { "request_header", lua_http_request_header },
36 { "response_header", lua_http_response_header },
37 { NULL, NULL },
38 };
39
40 static int lua_kore_config(lua_State *);
41 static int lua_kore_server(lua_State *);
42
43 static const luaL_Reg lua_kore_functions[] = {
44 { "config", lua_kore_config },
45 { "server", lua_kore_server },
46 { NULL, NULL },
47 };
48
49 #endif