[PATCH 1/6] [mama] Add transport closure


Ian Bell <IBell@...>
 

From 6456222f7ea01be922ce869d84b615bcc03cc79c Mon Sep 17 00:00:00 2001

Message-Id: <6456222f7ea01be922ce869d84b615bcc03cc79c.1348657454.git.ibell@...>

From: Ian Bell <ibell@...>

Date: Wed, 26 Sep 2012 11:31:13 +0100

Subject: [PATCH 1/6] [mama] Add transport closure

 

Added a get/set closure on a transport

 

Signed-off-by: Ian Bell <ibell@...>

---

mama/c_cpp/src/c/mama/transport.h |   22 ++++++++++++++++++++++

mama/c_cpp/src/c/transport.c      |   22 ++++++++++++++++++++++

2 files changed, 44 insertions(+)

 

diff --git a/mama/c_cpp/src/c/mama/transport.h b/mama/c_cpp/src/c/mama/transport.h

index 6a31570..d7f06ef 100644

--- a/mama/c_cpp/src/c/mama/transport.h

+++ b/mama/c_cpp/src/c/mama/transport.h

@@ -600,6 +600,28 @@ MAMAExpDLL

extern mamaStatsCollector*

mamaTransport_getStatsCollector (mamaTransport transport);

+/**

+ * Return the closure.

+ *

+ * @param transport The transport.

+ * @param closure holds the result.

+ */

+MAMAExpDLL

+extern mama_status

+mamaTransport_getClosure (mamaTransport transport,

+                          void**        closure);

+

+/**

+ * Set a closure.

+ *

+ * @param transport The transport.

+ * @param closure holds the closure to be added.

+ */

+MAMAExpDLL

+extern mama_status

+mamaTransport_setClosure (mamaTransport transport,

+                          void*         closure);

+

#if defined(__cplusplus)

}

#endif

diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c

index ae1ffca..5319999 100644

--- a/mama/c_cpp/src/c/transport.c

+++ b/mama/c_cpp/src/c/transport.c

@@ -169,6 +169,7 @@ typedef struct transportImpl_

     uint8_t                 mInternal;

     uint8_t                 mDisableDisconnectCb;

     preInitialScheme         mPreInitialScheme;

+    void*                   mClosure;

} transportImpl;

 static mama_status

@@ -186,6 +187,7 @@ init (transportImpl* transport, int createResponder)

     self->mDQStratScheme    = DQ_SCHEME_DELIVER_ALL;

     self->mFTStratScheme    = DQ_FT_DO_NOT_WAIT_FOR_RECAP;

+    self->mClosure          = NULL;

     mama_log (MAMA_LOG_LEVEL_FINEST,

              "%screating CmResponder for transport [%s]",

@@ -2452,6 +2454,26 @@ void mamaTransportImpl_invokeTransportCallback (mamaTransport transport,

     }

}

+mama_status

+mamaTransport_setClosure (mamaTransport transport, void* closure)

+{

+    if (!self) return MAMA_STATUS_NULL_ARG;

+

+    self->mClosure = closure;

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mamaTransport_getClosure (mamaTransport transport, void** closure)

+{

+    if ((!self) || (!closure))

+        return MAMA_STATUS_NULL_ARG;

+

+    *closure = self->mClosure;

+

+    return MAMA_STATUS_OK;

+}

/* *************************************************** */

/* Private Functions. */

/* *************************************************** */

--

1.7.9.5

 




Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.