2014-03-14 02:57:24 +01:00
|
|
|
#ifndef STREAM_PEER_SSL_H
|
|
|
|
#define STREAM_PEER_SSL_H
|
|
|
|
|
2014-04-15 03:43:44 +02:00
|
|
|
#ifdef OPENSSL_ENABLED
|
|
|
|
|
2014-03-14 02:57:24 +01:00
|
|
|
#include "io/stream_peer.h"
|
2014-04-15 03:43:44 +02:00
|
|
|
#include <openssl/applink.c> // To prevent crashing (see the OpenSSL FAQ)
|
|
|
|
#include <openssl/bio.h> // BIO objects for I/O
|
|
|
|
#include <openssl/ssl.h> // SSL and SSL_CTX for SSL connections
|
|
|
|
#include <openssl/err.h> // Error reporting
|
2014-03-14 02:57:24 +01:00
|
|
|
|
2014-04-15 03:43:44 +02:00
|
|
|
#include <stdio.h> // If you don't know what this is for stop reading now.
|
2014-03-14 02:57:24 +01:00
|
|
|
class StreamPeerSSL : public StreamPeer {
|
|
|
|
|
|
|
|
OBJ_TYPE(StreamPeerSSL,StreamPeer);
|
2014-04-15 03:43:44 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum ConnectFlags {
|
|
|
|
|
|
|
|
CONNECT_FLAG_BUG_WORKAROUNDS=1,
|
|
|
|
CONNECT_FLAG_NO_SSLV2=2,
|
|
|
|
CONNECT_FLAG_NO_SSLV3=4,
|
|
|
|
CONNECT_FLAG_NO_TLSV1=8,
|
|
|
|
CONNECT_FLAG_NO_COMPRESSION=16,
|
|
|
|
};
|
2014-03-14 02:57:24 +01:00
|
|
|
|
2014-04-15 03:43:44 +02:00
|
|
|
SSL_CTX* ctx;
|
|
|
|
SSL* ssl;
|
|
|
|
BIO* bio;
|
2014-03-14 02:57:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
public:
|
2014-04-15 03:43:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
Error connect(const String &p_host,int p_port);
|
|
|
|
static void initialize_ssl();
|
|
|
|
static void finalize_ssl();
|
|
|
|
|
2014-03-14 02:57:24 +01:00
|
|
|
StreamPeerSSL();
|
|
|
|
};
|
|
|
|
|
2014-04-15 03:43:44 +02:00
|
|
|
#endif
|
2014-03-14 02:57:24 +01:00
|
|
|
#endif // STREAM_PEER_SSL_H
|