[PATCH] Added mamaTransportImpl_setAdvisoryCauseAndPlatformInfo()


Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

This method allows bridges to pass middleware specific details regarding errors
and events.

Signed-off-by: John Gray <jgray@...>
---
mama/c_cpp/src/c/transport.c | 67 +++++++++++++++++++++++---------------
mama/c_cpp/src/c/transportimpl.h | 39 ++++++++++++++++++---
2 files changed, 74 insertions(+), 32 deletions(-)

diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c
index 95e912c..20ee0cc 100644
--- a/mama/c_cpp/src/c/transport.c
+++ b/mama/c_cpp/src/c/transport.c
@@ -1960,32 +1960,6 @@ mamaTransportImpl_unsetAllPossiblyStale (mamaTransport transport)
}
}

-/**
- * Return the cause and platform info for the last message processed on the
- * transport.
- *
- * @param transport The transport.
- * @param cause To return the cause.
- * @param platformInfo To return the bridge specific info, under no circumstances
- * should the returned object be deleted.
- */
-void
-mamaTransportImpl_getAdvisoryCauseAndPlatformInfo (mamaTransport transport,
- short* cause,
- const void** platformInfo)
-{
- if (!self)
- {
- mama_log (MAMA_LOG_LEVEL_ERROR,
- "mamaTransportImpl_getAdvisoryCauseAndPlatformInfo (): "
- "NULL transport.");
- return;
- }
-
- *cause = self->mCause;
- *platformInfo = self->mPlatformInfo;
-}
-
void
mamaTransportImpl_getTransportIndex (mamaTransport transport,
int* transportIndex)
@@ -2363,3 +2337,44 @@ mama_status mamaTransport_removePublisher (mamaTransport transport, void *handle
return MAMA_STATUS_OK;
}

+/* *************************************************** */
+/* Internal Functions. */
+/* *************************************************** */
+
+void mamaTransportImpl_getAdvisoryCauseAndPlatformInfo(mamaTransport transport,
+ short *cause, const void **platformInfo)
+{
+ /* Get the impl. */
+ transportImpl *impl = (transportImpl *)transport;
+ if(NULL != impl)
+ {
+ /* Return the cause. */
+ *cause = impl->mCause;
+ *platformInfo = impl->mPlatformInfo;
+ }
+ else
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "mamaTransportImpl_getAdvisoryCauseAndPlatformInfo(): NULL "
+ "transport.");
+ }
+}
+
+void mamaTransportImpl_setAdvisoryCauseAndPlatformInfo (mamaTransport transport,
+ short cause, const void *platformInfo)
+{
+ /* Get the impl. */
+ transportImpl *impl = (transportImpl *)transport;
+ if(NULL != impl)
+ {
+ /* Set the cause. */
+ impl->mCause = cause;
+ impl->mPlatformInfo = (void*)platformInfo;
+ }
+ else
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "mamaTransportImpl_setAdvisoryCauseAndPlatformInfo(): NULL "
+ "transport.");
+ }
+}
diff --git a/mama/c_cpp/src/c/transportimpl.h b/mama/c_cpp/src/c/transportimpl.h
index cf4b3d0..5ae83c6 100644
--- a/mama/c_cpp/src/c/transportimpl.h
+++ b/mama/c_cpp/src/c/transportimpl.h
@@ -158,12 +158,6 @@ MAMAExpDLL
extern void
mamaTransportImpl_unsetAllPossiblyStale (mamaTransport tport);

-MAMAExpDLL
-extern void
-mamaTransportImpl_getAdvisoryCauseAndPlatformInfo (mamaTransport tport,
- short* cause,
- const void** platformInfo);
-
/*
Get the bridge impl associated with the specified transport.
This will be how other objects gain access to the bridge.
@@ -251,4 +245,37 @@ preInitialScheme mamaTransportImpl_getPreInitialScheme (mamaTransport transport)
}
#endif

+
+/**
+ * This function will return the cause and platform info for the last message
+ * processed on the transport.
+ *
+ * @param[in] transport The transport.
+ * @param[out] cause To return the cause.
+ * @param[out] platformInfo To return the bridge specific info, under no
+ * circumstances should the returned object be deleted.
+ *
+ */
+MAMAExpDLL
+extern void
+mamaTransportImpl_getAdvisoryCauseAndPlatformInfo(
+ mamaTransport tport,
+ short *cause,
+ const void **platformInfo);
+
+/**
+ * This function will set the cause and platform info for the transport.
+ *
+ * @param[in] transport The transport.
+ * @param[in] cause The cause.
+ * @param[in] platformInfo Bridge specific info.
+ *
+ */
+MAMAExpDLL
+extern void
+mamaTransportImpl_setAdvisoryCauseAndPlatformInfo(
+ mamaTransport transport,
+ short cause,
+ const void *platformInfo);
+
#endif /* TransportImplH__ */
--
1.7.5.4