src/context.h

Sat, 17 Dec 2011 10:30:58 -0800

author
Paul Aurich <paul@darkrain42.org>
date
Sat, 17 Dec 2011 10:30:58 -0800
changeset 45
5be249c0ae71
parent 41
e26f1f91118a
permissions
-rw-r--r--

context: Add no_compression for OpenSSL 0.9.8 as well

Since OpenSSL 0.9.8 doesn't have SSL_OP_NO_COMPRESSION, this is
implemented by simplying NULLing out the SSL_CTX->comp_methods stack.

#ifndef __CONTEXT_H__
#define __CONTEXT_H__

/*--------------------------------------------------------------------------
 * LuaSec 0.4
 * Copyright (C) 2006-2009 Bruno Silvestre
 *
 *--------------------------------------------------------------------------*/

#include <lua.h>
#include <openssl/ssl.h>

#if defined(_WIN32)
#define LUASEC_API __declspec(dllexport) 
#else
#define LUASEC_API extern
#endif

#define MD_CTX_INVALID 0
#define MD_CTX_SERVER 1
#define MD_CTX_CLIENT 2

#define LUASEC_VERIFY_FLAGS_NONE            0x0000
#define LUASEC_VERIFY_FLAGS_ALWAYS_CONTINUE 0x0001
#define LUASEC_VERIFY_FLAGS_IGNORE_PURPOSE  0x0002

typedef struct t_context_ {
  SSL_CTX *context;
  lua_State *L;
  unsigned int verify_flags;
  char mode;
} t_context;
typedef t_context* p_context;

p_context checkctx(lua_State *L, int idx);
/* Retrieve the SSL context from the Lua stack */
SSL_CTX *ctx_getcontext(lua_State *L, int idx);
/* Retrieve the mode from the context in the Lua stack */
char ctx_getmode(lua_State *L, int idx);

/* Registre the module. */
LUASEC_API int luaopen_ssl_context(lua_State *L);

#endif

mercurial