blob: 59f659b5d7fd28eb23f416a6cec2621f77885d8a [file] [log] [blame]
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05001/*
2 * connection.h
3 *
Jean-Paul Calderone8671c852011-03-02 19:26:20 -05004 * Copyright (C) AB Strakt
5 * See LICENSE for details.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05006 *
7 * Export SSL Connection data structures and functions.
8 * See the file RATIONALE for a short explanation of why this module was written.
9 *
10 * Reviewed 2001-07-23
11 *
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050012 */
13#ifndef PyOpenSSL_SSL_CONNECTION_H_
14#define PyOpenSSL_SSL_CONNECTION_H_
15
16#include <Python.h>
17#include <openssl/ssl.h>
18
19/* shamelessly stolen from socketmodule.c */
20#ifdef MS_WINDOWS
21# include <winsock.h>
22typedef SOCKET SOCKET_T;
23# ifdef MS_WIN64
24# define SIZEOF_SOCKET_T 8
25# else
26# define SIZEOF_SOCKET_T 4
27# endif
28#else
29typedef int SOCKET_T;
30# define SIZEOF_SOCKET_T SIZEOF_INT
31#endif
32
33
34extern int init_ssl_connection (PyObject *);
35
36extern PyTypeObject ssl_Connection_Type;
37
38#define ssl_Connection_Check(v) ((v)->ob_type == &ssl_Connection_Type)
39
40typedef struct {
41 PyObject_HEAD
42 SSL *ssl;
43 ssl_ContextObj *context;
44 PyObject *socket;
Jean-Paul Calderone00db9da2008-09-21 17:42:34 -040045 PyThreadState *tstate; /* This field is no longer used. */
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050046 PyObject *app_data;
Rick Deanb71c0d22009-04-01 14:09:23 -050047 BIO *into_ssl, *from_ssl; /* for connections without file descriptors */
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050048} ssl_ConnectionObj;
49
50
51
52#endif
53