-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLuaWebserverHelper.h
51 lines (44 loc) · 977 Bytes
/
LuaWebserverHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// LuaWebserverHelper.h
#ifndef LUAWEBSERVERHELPER_H
#define LUAWEBSERVERHELPER_H
#include <lua.h>
#include <stdbool.h>
typedef struct
{
int statusCode;
char* responseBody;
char headersKeys[20][256];
char headersValues[20][256];
int headersCount;
} LuaHttpResponse;
typedef struct
{
char* method;
char* path;
char* url;
char* proto;
long contentLength;
char* host;
char* remoteAddr;
char headersKeys[50][256];
char headersValues[50][256];
int headersCount;
char* body;
} HttpRequest;
typedef struct
{
char* msg;
bool success;
int id;
} Message;
typedef struct
{
Message errHandling;
int clientCount;
char** clientIds;
char** paths;
} ClientInfo;
// Function prototypes
LuaHttpResponse* callLuaFunc(lua_State* L, int luaRef, HttpRequest* request);
void callLuaWebSocketFunc(lua_State* L, int luaRef, char* client, int messagetype, char* message);
#endif // LUAWEBSERVERHELPER_H