From e005c8924048305f3aa01ccd3951544835d922f8 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Thu, 2 Jul 2020 18:02:39 +0200 Subject: [PATCH] Move openssl/ssl.h dependency out of the way The src/core/ddsi/tests/locators.c test directly includes the header files related to DDSI support for TCP and this pulled in openssl/ssl.h, which in turn results in a build error in some environments because the file can't be found. There was no good reason why this dependency existed, the definitions that relied on it were used only in the implementation of the TCP and TLS support. Signed-off-by: Erik Boasson --- src/core/ddsi/include/dds/ddsi/ddsi_ssl.h | 14 ++++++++++- src/core/ddsi/include/dds/ddsi/ddsi_tcp.h | 29 +---------------------- src/core/ddsi/src/ddsi_tcp.c | 1 + 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_ssl.h b/src/core/ddsi/include/dds/ddsi/ddsi_ssl.h index edddd26..66a74b7 100644 --- a/src/core/ddsi/include/dds/ddsi/ddsi_ssl.h +++ b/src/core/ddsi/include/dds/ddsi/ddsi_ssl.h @@ -24,7 +24,19 @@ extern "C" { #endif -struct ddsi_ssl_plugins; +struct ddsi_ssl_plugins +{ + bool (*init) (struct ddsi_domaingv *gv); + void (*fini) (void); + void (*ssl_free) (SSL *ssl); + void (*bio_vfree) (BIO *bio); + ssize_t (*read) (SSL *ssl, void *buf, size_t len, dds_return_t *err); + ssize_t (*write) (SSL *ssl, const void *msg, size_t len, dds_return_t *err); + SSL * (*connect) (const struct ddsi_domaingv *gv, ddsrt_socket_t sock); + BIO * (*listen) (ddsrt_socket_t sock); + SSL * (*accept) (const struct ddsi_domaingv *gv, BIO *bio, ddsrt_socket_t *sock); +}; + void ddsi_ssl_config_plugin (struct ddsi_ssl_plugins *plugin); #if defined (__cplusplus) diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_tcp.h b/src/core/ddsi/include/dds/ddsi/ddsi_tcp.h index cf92a45..c745768 100644 --- a/src/core/ddsi/include/dds/ddsi/ddsi_tcp.h +++ b/src/core/ddsi/include/dds/ddsi/ddsi_tcp.h @@ -14,38 +14,11 @@ #include "dds/ddsi/ddsi_tran.h" -#ifdef DDSI_INCLUDE_SSL - -#include "dds/ddsi/ddsi_ssl.h" - #if defined (__cplusplus) extern "C" { #endif -struct ddsi_ssl_plugins -{ - bool (*init) (struct ddsi_domaingv *gv); - void (*fini) (void); - void (*ssl_free) (SSL *ssl); - void (*bio_vfree) (BIO *bio); - ssize_t (*read) (SSL *ssl, void *buf, size_t len, dds_return_t *err); - ssize_t (*write) (SSL *ssl, const void *msg, size_t len, dds_return_t *err); - SSL * (*connect) (const struct ddsi_domaingv *gv, ddsrt_socket_t sock); - BIO * (*listen) (ddsrt_socket_t sock); - SSL * (*accept) (const struct ddsi_domaingv *gv, BIO *bio, ddsrt_socket_t *sock); -}; - -#if defined (__cplusplus) -} -#endif - -#endif /* DDSI_INCLUDE_SSL */ - -#if defined (__cplusplus) -extern "C" { -#endif - -int ddsi_tcp_init (struct ddsi_domaingv *gv); +DDS_EXPORT int ddsi_tcp_init (struct ddsi_domaingv *gv); #if defined (__cplusplus) } diff --git a/src/core/ddsi/src/ddsi_tcp.c b/src/core/ddsi/src/ddsi_tcp.c index e6544e2..5b6a269 100644 --- a/src/core/ddsi/src/ddsi_tcp.c +++ b/src/core/ddsi/src/ddsi_tcp.c @@ -25,6 +25,7 @@ #include "dds/ddsi/q_log.h" #include "dds/ddsi/q_entity.h" #include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsi/ddsi_ssl.h" #define INVALID_PORT (~0u)