blob: ba7ba8baa7f843221b85176a38ed79db79bb14bf (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* ssl.h
*
* Copyright (C) AB Strakt 2001, All rights reserved
*
* Export functions and exceptions from the SSL sub module.
* See the file RATIONALE for a short explanation of why this module was written.
*
* Reviewed 2001-07-23
*
* @(#) $Id: ssl.h,v 1.6 2002/04/08 19:25:43 martin Exp $
*/
#ifndef PyOpenSSL_SSL_H_
#define PyOpenSSL_SSL_H_
#include <Python.h>
#include <pythread.h>
#include "context.h"
#include "connection.h"
#include "../util.h"
#include "../crypto/crypto.h"
extern PyObject *ssl_Error, /* Base class */
*ssl_ZeroReturnError, /* Used with SSL_get_erorr */
*ssl_WantReadError, /* ... */
*ssl_WantWriteError, /* ... */
*ssl_WantX509LookupError, /* ... */
*ssl_SysCallError; /* Uses (errno,errstr) */
#define ssl_Context_New_NUM 0
#define ssl_Context_New_RETURN ssl_ContextObj *
#define ssl_Context_New_PROTO (int method)
#define ssl_Connection_New_NUM 1
#define ssl_Connection_New_RETURN ssl_ConnectionObj *
#define ssl_Connection_New_PROTO (ssl_ContextObj *ctx, PyObject *sock)
#define ssl_API_pointers 2
#ifdef WITH_THREAD
extern int _pyOpenSSL_tstate_key;
#endif /* WITH_THREAD */
#ifdef SSL_MODULE
extern ssl_Context_New_RETURN ssl_Context_New ssl_Context_New_PROTO;
extern ssl_Connection_New_RETURN ssl_Connection_New ssl_Connection_New_PROTO;
#else /* SSL_MODULE */
extern void **ssl_API;
#define ssl_Context_New \
(*(ssl_Context_New_RETURN (*)ssl_Context_New_PROTO) ssl_API[ssl_Context_New_NUM])
#define ssl_Connection_New \
(*(ssl_Connection_New_RETURN (*)ssl_Connection_New_PROTO) ssl_API[ssl_Connection_New_NUM])
#define import_SSL() \
{ \
PyObject *module = PyImport_ImportModule("OpenSSL.SSL"); \
if (module != NULL) { \
PyObject *module_dict = PyModule_GetDict(module); \
PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \
if (PyCObject_Check(c_api_object)) { \
ssl_API = (void **)PyCObject_AsVoidPtr(c_api_object); \
} \
} \
}
#endif /* SSL_MODULE */
#endif /* PyOpenSSL_SSL_H_ */
|