+/*
+ Returns a pointer (reference) to the trace data in the message. If sizeptr
+ is supplied, then the trace data size is assigned to the referenced
+ integer so that the caller doesn't need to make a second call to get the
+ value.
+
+ CAUTION: user programmes should avoid writing to the referenced trace
+ area (use rmr_set_trace() to avoid possible data overruns. This
+ function is a convenience, and it is expected that users will
+ use the trace data as read-only so as a copy is not necessary.
+*/
+extern void* rmr_trace_ref( rmr_mbuf_t* msg, int* sizeptr ) {
+ uta_mhdr_t* hdr = NULL;
+ int size = 0;
+
+ if( sizeptr != NULL ) {
+ *sizeptr = 0; // ensure reset if we bail
+ }
+
+ if( msg == NULL ) {
+ return NULL;
+ }
+
+ hdr = msg->header;
+ if( (size = RMR_TR_LEN( hdr )) <= 0 ) {
+ return NULL;
+ }
+
+ if( sizeptr != NULL ) {
+ *sizeptr = size;
+ }
+
+ return (void *) TRACE_ADDR( hdr );
+}
+