--- include/asterisk/iostream.h (Asterisk 15.4) +++ include/asterisk/iostream.h (working copy) @@ -26,19 +26,17 @@ */ +#include "asterisk.h" /* for size_t, ssize_t, HAVE_OPENSSL */ + #if defined(HAVE_OPENSSL) #define DO_SSL /* comment in/out if you want to support ssl */ #endif -#ifdef DO_SSL -#include -#include -#include -#else -/* declare dummy types so we can define a pointer to them */ -typedef struct {} SSL; -typedef struct {} SSL_CTX; -#endif /* DO_SSL */ +struct ssl_st; /* forward declaration */ +struct ssl_ctx_st; /* forward declaration */ +struct timeval; /* forward declaration */ +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; -struct ast_iostream; +struct ast_iostream; /* forward declaration */ /*! --- main/iostream.c (Asterisk 15.4) +++ main/iostream.c (working copy) @@ -19,10 +19,21 @@ #include "asterisk.h" -#include -#include +#include "asterisk/iostream.h" /* for DO_SSL */ -#include "asterisk/utils.h" -#include "asterisk/astobj2.h" -#include "asterisk/iostream.h" +#include /* for O_NONBLOCK */ +#ifdef DO_SSL +#include /* for ERR_error_string */ +#include /* for OPENSSL_VERSION_NUMBER */ +#include /* for SSL_get_error, SSL_free, SSL_... */ +#endif +#include /* for shutdown, SHUT_RDWR */ +#include /* for timeval */ + +#include "asterisk/astobj2.h" /* for ao2_alloc_options, ao2_alloc_... */ +#include "asterisk/logger.h" /* for ast_debug, ast_log, LOG_ERROR */ +#include "asterisk/strings.h" /* for asterisk/threadstorage.h */ +#include "asterisk/threadstorage.h" /* for ast_threadstorage_get, AST_TH... */ +#include "asterisk/time.h" /* for ast_remaining_ms, ast_tvnow */ +#include "asterisk/utils.h" /* for ast_wait_for_input, ast_wait_... */ struct ast_iostream { --- main/tcptls.c (Asterisk 15.4) +++ main/tcptls.c (working copy) @@ -26,29 +26,46 @@ */ -/*** MODULEINFO - openssl - core - ***/ - #include "asterisk.h" -#ifdef HAVE_FCNTL_H -#include -#endif - -#include -#include +#include "asterisk/tcptls.h" /* for ast_tls_config, ast_tcptls_se... */ +#include "asterisk/iostream.h" /* for DO_SSL, ast_iostream_close, a... */ -#include "asterisk/compat.h" -#include "asterisk/tcptls.h" -#include "asterisk/io.h" -#include "asterisk/http.h" -#include "asterisk/utils.h" -#include "asterisk/strings.h" -#include "asterisk/options.h" -#include "asterisk/manager.h" -#include "asterisk/astobj2.h" -#include "asterisk/pbx.h" -#include "asterisk/app.h" +#ifdef HAVE_FCNTL_H +#include /* for O_NONBLOCK */ +#endif /* HAVE_FCNTL_H */ +#include /* for IPPROTO_TCP */ +#ifdef DO_SSL +#include /* for ASN1_STRING_to_UTF8 */ +#include /* for OPENSSL_free */ +#include /* for OPENSSL_NO_SSL3_METHOD, OPENS... */ +#include /* for OPENSSL_VERSION_NUMBER */ +#include /* for STACK_OF */ +#include /* for SSL_CTX_free, SSL_get_error, ... */ +#include /* for X509_free, X509_NAME_ENTRY_ge... */ +#include /* for GENERAL_NAME, sk_GENERAL_NAME... */ +#ifndef OPENSSL_NO_DH +#include /* for BIO_free, BIO_new_file */ +#include /* for DH_free */ +#include /* for PEM_read_bio_DHparams */ +#endif /* OPENSSL_NO_DH */ +#ifndef OPENSSL_NO_EC +#include /* for EC_KEY_free, EC_KEY_new_by_cu... */ +#endif /* OPENSSL_NO_EC */ +#endif /* DO_SSL */ +#include /* for pthread_cancel, pthread_join */ +#include /* for pthread_kill, SIGURG */ +#include /* for setsockopt, shutdown, socket */ +#include /* for stat */ + +#include "asterisk/app.h" /* for ast_read_textfile */ +#include "asterisk/astobj2.h" /* for ao2_ref, ao2_t_ref, ao2_alloc */ +#include "asterisk/compat.h" /* for strcasecmp */ +#include "asterisk/config.h" /* for ast_parse_arg, ast_parse_flag... */ +#include "asterisk/io.h" /* for ast_sd_get_fd */ +#include "asterisk/lock.h" /* for AST_PTHREADT_NULL */ +#include "asterisk/logger.h" /* for ast_log, LOG_ERROR, ast_debug */ +#include "asterisk/netsock2.h" /* for ast_sockaddr_copy, ast_sockad... */ +#include "asterisk/pbx.h" /* for ast_thread_inhibit_escalations */ +#include "asterisk/utils.h" /* for ast_true, ast_free, ast_wait_... */ static void session_instance_destructor(void *obj) --- main/Makefile (Asterisk 15.4) +++ main/Makefile (working copy) @@ -311,2 +311,3 @@ +iostream.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) -Wno-deprecated-declarations --- include/asterisk/tcptls.h (Asterisk 15.4) +++ include/asterisk/tcptls.h (working copy) @@ -47,8 +47,4 @@ * * \ref AstTlsOverview - * - * \todo For SIP, the SubjectAltNames should be checked on verification - * of the certificate. (Check RFC 5922) - * */ @@ -56,7 +52,13 @@ #define _ASTERISK_TCPTLS_H -#include "asterisk/netsock2.h" -#include "asterisk/utils.h" +#include /* for pthread_t */ +#include /* for MAXHOSTNAMELEN */ + #include "asterisk/iostream.h" +#include "asterisk/netsock2.h" /* for ast_sockaddr */ +#include "asterisk/utils.h" /* for ast_flags */ + +struct ssl_ctx_st; /* forward declaration */ +typedef struct ssl_ctx_st SSL_CTX; /*! SSL support */