|
1 #ifndef __CONTEXT_H__ |
|
2 #define __CONTEXT_H__ |
|
3 |
|
4 /*-------------------------------------------------------------------------- |
|
5 * LuaSec 0.4 |
|
6 * Copyright (C) 2006-2009 Bruno Silvestre |
|
7 * |
|
8 *--------------------------------------------------------------------------*/ |
|
9 |
|
10 #include <lua.h> |
|
11 #include <openssl/ssl.h> |
|
12 |
|
13 #if defined(_WIN32) |
|
14 #define LUASEC_API __declspec(dllexport) |
|
15 #else |
|
16 #define LUASEC_API extern |
|
17 #endif |
|
18 |
|
19 #define MD_CTX_INVALID 0 |
|
20 #define MD_CTX_SERVER 1 |
|
21 #define MD_CTX_CLIENT 2 |
|
22 |
|
23 typedef struct t_context_ { |
|
24 SSL_CTX *context; |
|
25 char mode; |
|
26 } t_context; |
|
27 typedef t_context* p_context; |
|
28 |
|
29 /* Retrieve the SSL context from the Lua stack */ |
|
30 SSL_CTX *ctx_getcontext(lua_State *L, int idx); |
|
31 /* Retrieve the mode from the context in the Lua stack */ |
|
32 char ctx_getmode(lua_State *L, int idx); |
|
33 |
|
34 /* Registre the module. */ |
|
35 LUASEC_API int luaopen_ssl_context(lua_State *L); |
|
36 |
|
37 #endif |