fix(API): Add missing trace init function 01/101/1
authorE. Scott Daniels <daniels@research.att.com>
Thu, 2 May 2019 15:44:16 +0000 (15:44 +0000)
committerE. Scott Daniels <daniels@research.att.com>
Thu, 2 May 2019 15:44:16 +0000 (15:44 +0000)
The trace init funciton was missing from the nanomsg support
in the library.

Change-Id: I4afae697c32e1d7eb99685f10843890fd98be73c
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
src/nanomsg/src/rmr.c

index e67402f..392feb7 100644 (file)
@@ -634,6 +634,26 @@ static void* init( char* uproto_port, int max_msg_size, int flags ) {
        return (void *) ctx;
 }
 
+/*
+       This sets the default trace length which will be added to any message buffers
+       allocated.  It can be set at any time, and if rmr_set_trace() is given a
+       trace len that is different than the default allcoated in a message, the message
+       will be resized.
+
+       Returns 0 on failure and 1 on success. If failure, then errno will be set.
+*/
+extern int rmr_init_trace( void* vctx, int tr_len ) {
+       uta_ctx_t* ctx;
+
+       errno = 0;
+       if( (ctx = (uta_ctx_t *) vctx) == NULL ) {
+               errno = EINVAL;
+               return 0;
+       }
+
+       ctx->trace_data_len = tr_len;
+       return 1;
+}
 
 /*
        Publicly facing initialisation function. Wrapper for the init() funcion above