summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane van Iperen <z.vaniperen@uq.edu.au>2019-05-13 11:45:02 +1000
committerAlan Antonuk <alan.antonuk@gmail.com>2019-05-14 07:54:08 -0700
commit60adf5f8817f32b25a99aa54ba186a29208c7942 (patch)
treec2fd13defd3433eb210a07ffa7b09496fb3148de
parentafa514ec91d4e85409a3a3dc939b247424305332 (diff)
downloadrabbitmq-c-60adf5f8817f32b25a99aa54ba186a29208c7942.tar.gz
ssl: Add amqp_ssl_socket_get_context()
-rw-r--r--librabbitmq/amqp_openssl.c7
-rw-r--r--librabbitmq/amqp_ssl_socket.h13
2 files changed, 20 insertions, 0 deletions
diff --git a/librabbitmq/amqp_openssl.c b/librabbitmq/amqp_openssl.c
index 1fac25d..4915a6a 100644
--- a/librabbitmq/amqp_openssl.c
+++ b/librabbitmq/amqp_openssl.c
@@ -363,6 +363,13 @@ error:
return NULL;
}
+void *amqp_ssl_socket_get_context(amqp_socket_t *base) {
+ if (base->klass != &amqp_ssl_socket_class) {
+ amqp_abort("<%p> is not of type amqp_ssl_socket_t", base);
+ }
+ return ((struct amqp_ssl_socket_t *)base)->ctx;
+}
+
int amqp_ssl_socket_set_cacert(amqp_socket_t *base, const char *cacert) {
int status;
struct amqp_ssl_socket_t *self;
diff --git a/librabbitmq/amqp_ssl_socket.h b/librabbitmq/amqp_ssl_socket.h
index 9977ae4..70d1a56 100644
--- a/librabbitmq/amqp_ssl_socket.h
+++ b/librabbitmq/amqp_ssl_socket.h
@@ -58,6 +58,19 @@ AMQP_PUBLIC_FUNCTION
amqp_socket_t *AMQP_CALL amqp_ssl_socket_new(amqp_connection_state_t state);
/**
+ * Get the internal OpenSSL context. Caveat emptor.
+ *
+ * \param [in,out] self An SSL/TLS socket object.
+ *
+ * \return A pointer to the internal OpenSSL context. This should be cast to
+ * <tt>SSL_CTX*</tt>.
+ *
+ * \since v0.9.0
+ */
+AMQP_PUBLIC_FUNCTION
+void *AMQP_CALL amqp_ssl_socket_get_context(amqp_socket_t *self);
+
+/**
* Set the CA certificate.
*
* \param [in,out] self An SSL/TLS socket object.