src/ssl.h

1
#ifndef __SSL_H__
2
#define __SSL_H__
3
 
4
/*--------------------------------------------------------------------------
5
 * LuaSec 0.4
6
 * Copyright (C) 2006-2009 Bruno Silvestre
7
 *
8
 *--------------------------------------------------------------------------*/
9
 
10
#include <openssl/ssl.h>
11
#include <lua.h>
12
 
13
#include "io.h"
14
#include "buffer.h"
15
#include "timeout.h"
16
#include "socket.h"
17
#include "context.h"
18
 
19
#define ST_SSL_NEW       1
20
#define ST_SSL_CONNECTED 2
21
#define ST_SSL_CLOSED    3
22
 
23
typedef struct t_ssl_ {
24
  t_socket sock;
25
  t_io io;
26
  t_buffer buf;
27
  t_timeout tm;
28
  SSL *ssl;
29
  char state;
30
  int error;
31
  int t_cert_errors; /* reference to a table of cert errors...or LUA_NOREF */
32
} t_ssl;
33
typedef t_ssl* p_ssl;
34
 
35
extern int luasec_ssl_idx;
36
LUASEC_API int luaopen_ssl_core(lua_State *L);
37
 
38
#endif