Safe stack reorganisation in terms of function casts.
[openssl.git] / ssl / ssl.h
index f29f7753474f28c8265ba8eb48b2898f42ab2685..f41a17e8df7341f43daf27f50d11e96ab971edad 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
 #ifndef HEADER_SSL_H 
 #define HEADER_SSL_H 
 
+#ifndef NO_COMP
+#include <openssl/comp.h>
+#endif
+#ifndef NO_BIO
+#include <openssl/bio.h>
+#endif
+#ifndef NO_X509
+#include <openssl/x509.h>
+#endif
+#include <openssl/safestack.h>
+
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
-#include <openssl/safestack.h>
-
 /* SSLeay version number for ASN.1 encoding of the session information */
 /* Version 0 - initial version
  * Version 1 - added the optional peer certificate
@@ -140,6 +149,10 @@ extern "C" {
 #define SSL_SENT_SHUTDOWN      1
 #define SSL_RECEIVED_SHUTDOWN  2
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <openssl/crypto.h>
 #include <openssl/lhash.h>
 #include <openssl/buffer.h>
@@ -147,6 +160,10 @@ extern "C" {
 #include <openssl/pem.h>
 #include <openssl/x509.h>
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 #if (defined(NO_RSA) || defined(NO_MD5)) && !defined(NO_SSL2)
 #define NO_SSL2
 #endif
@@ -346,7 +363,7 @@ typedef struct ssl_comp_st
 {
     int id;
     char *name;
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
     COMP_METHOD *method;
 #else
     char *method;
@@ -391,9 +408,8 @@ struct ssl_ctx_st
         * SSL_SESSION_free() when it has finished using it.  Otherwise,
         * on 0, it means the callback has finished with it.
         * If remove_session_cb is not null, it will be called when
-        * a session-id is removed from the cache.  Again, a return
-        * of 0 mens that SSLeay should not SSL_SESSION_free() since
-        * the application is doing something with it. */
+        * a session-id is removed from the cache.  After the call,
+        * OpenSSL will SSL_SESSION_free() it. */
        int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess);
        void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);
        SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
@@ -534,7 +550,7 @@ struct ssl_st
         * same.  This is so data can be read and written to different
         * handlers */
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
        BIO *rbio; /* used by SSL_read */
        BIO *wbio; /* used by SSL_write */
        BIO *bbio; /* used during session-id reuse to concatinate
@@ -598,7 +614,7 @@ struct ssl_st
 
        EVP_CIPHER_CTX *enc_read_ctx;           /* cryptographic state */
        const EVP_MD *read_hash;                /* used for mac generation */
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
        COMP_CTX *expand;                       /* uncompress */
 #else
        char *expand;
@@ -606,7 +622,7 @@ struct ssl_st
 
        EVP_CIPHER_CTX *enc_write_ctx;          /* cryptographic state */
        const EVP_MD *write_hash;               /* used for mac generation */
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
        COMP_CTX *compress;                     /* compression */
 #else
        char *compress; 
@@ -656,11 +672,19 @@ struct ssl_st
                                 * SSLv3/TLS rollback check */
        };
 
+#ifdef __cplusplus
+}
+#endif
+
 #include <openssl/ssl2.h>
 #include <openssl/ssl3.h>
 #include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
 #include <openssl/ssl23.h>
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 /* compatibility */
 #define SSL_set_app_data(s,arg)                (SSL_set_ex_data(s,0,(char *)arg))
 #define SSL_get_app_data(s)            (SSL_get_ex_data(s,0))
@@ -884,7 +908,7 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
 #define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_sub_to_stack
 #endif
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 BIO_METHOD *BIO_f_ssl(void);
 BIO *BIO_new_ssl(SSL_CTX *ctx,int client);
 BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
@@ -921,7 +945,7 @@ int SSL_set_fd(SSL *s, int fd);
 int    SSL_set_rfd(SSL *s, int fd);
 int    SSL_set_wfd(SSL *s, int fd);
 #endif
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 void   SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
 BIO *  SSL_get_rbio(SSL *s);
 BIO *  SSL_get_wbio(SSL *s);
@@ -976,7 +1000,7 @@ int        SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b);
 #ifndef NO_FP_API
 int    SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses);
 #endif
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 int    SSL_SESSION_print(BIO *fp,SSL_SESSION *ses);
 #endif
 void   SSL_SESSION_free(SSL_SESSION *ses);
@@ -1172,7 +1196,7 @@ void SSL_set_tmp_dh_callback(SSL *ssl,
                                           int keylength));
 #endif
 
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
 int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
 #else
 int SSL_COMP_add_compression_method(int id,char *cm);
@@ -1215,6 +1239,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 #define SSL_F_SSL2_SET_CERTIFICATE                      126
 #define SSL_F_SSL2_WRITE                                127
 #define SSL_F_SSL3_ACCEPT                               128
+#define SSL_F_SSL3_CALLBACK_CTRL                        233
 #define SSL_F_SSL3_CHANGE_CIPHER_STATE                  129
 #define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM             130
 #define SSL_F_SSL3_CLIENT_HELLO                                 131