X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=doc%2Fsrc%2Fman%2Frmr_wh_call.3.xfm;h=ed72218d695a1a573925fc08580060a25173d402;hb=2d9d6784b306047e94ca9816813e5007b00fd17e;hp=7e1b935055af4f2974eeda048f0f0b55466a837f;hpb=8633a0b93e26b619a367de0614437ef2eb4a0b37;p=ric-plt%2Flib%2Frmr.git diff --git a/doc/src/man/rmr_wh_call.3.xfm b/doc/src/man/rmr_wh_call.3.xfm index 7e1b935..ed72218 100644 --- a/doc/src/man/rmr_wh_call.3.xfm +++ b/doc/src/man/rmr_wh_call.3.xfm @@ -1,7 +1,7 @@ .if false ================================================================================== - Copyright (c) 2020 Nokia - Copyright (c) 2020 AT&T Intellectual Property. + Copyright (c) 2020 Nokia + Copyright (c) 2020 AT&T Intellectual Property. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,20 +17,20 @@ ================================================================================== .fi .if false - Mnemonic rmr_wh_call_3.xfm - Abstract The manual page for the rmr_wh_call function. - Author E. Scott Daniels - Date 28 January 2019 + Mnemonic rmr_wh_call_3.xfm + Abstract The manual page for the rmr_wh_call function. + Author E. Scott Daniels + Date 28 January 2019 .fi .gv e LIB lib -.im &{lib}/man/setup.im +.im &{lib}/man/setup.im &line_len(6i) &h1(RMR Library Functions) &h2(NAME) - rmr_wh_call + rmr_wh_call &h2(SYNOPSIS ) &indent @@ -43,7 +43,7 @@ rmr_mbuf_t* rmr_wh_call( void* vctx, rmr_whid_t whid, rmr_mbuf_t* msg, int call_ &uindent &h2(DESCRIPTION) -The &cw(rmr_wh_call) function accepts a message buffer (msg) from the user application +The &cw(rmr_wh_call) function accepts a message buffer (msg) from the user application and attempts to send it using the wormhole ID provided (whid). If the send is successful, the call will block until either a response message is received, or the &cw(max_wait) number of milliseconds has passed. @@ -52,23 +52,23 @@ use &cw(rmr_rts_msg()) to send their response. &space Like &ital(rmr_wh_send_msg,) this function attempts to send the message directly -to a process at the other end of a wormhole which was created with &ital(rmr_wh-open().) -When sending message via wormholes, the normal RMr routing based on message type is +to a process at the other end of a wormhole which was created with &ital(rmr_wh_open().) +When sending message via wormholes, the normal RMR routing based on message type is ignored, and the caller may leave the message type unspecified in the message buffer (unless it is needed by the receiving process). -The &cw(call_id) parameter is a number in the range of 2 through 255 and is used to +The &cw(call_id) parameter is a number in the range of 2 through 255 and is used to identify the calling thread in order to properly match a response message when it arrives. -Providing this value, and ensuring the proper uniqueness, is the responsibility of the -user application and as such the ability to use the &cw(rmr_wh_call()) function from +Providing this value, and ensuring the proper uniqueness, is the responsibility of the +user application and as such the ability to use the &cw(rmr_wh_call()) function from potentially non-threaded concurrent applications (such as Go's goroutines) is possible. .** pull in common retry text -.im &{lib}/man/retry.im +.im &{lib}/man/retry.im &h2(RETURN VALUE) -On success, new message buffer, with the payload containing the response from the remote +On success, new message buffer, with the payload containing the response from the remote endpoint is returned. The state in this buffer will reflect the overall send operation state and should be &cw(RMR_OK.) @@ -82,7 +82,7 @@ received within the timeout (max_wait) period of time. &h2(ERRORS) The following values may be passed back in the &ital(state) field of the returned message -buffer. +buffer. &space &beg_dlist(.75i : ^&bold_font ) @@ -100,7 +100,7 @@ Some error checking is omitted for clarity. &space &ex_start -#include // system headers omitted for clarity +#include // system headers omitted for clarity int main() { rmr_whid_t whid = -1; // wormhole id for sending @@ -108,14 +108,15 @@ int main() { int i; rmr_mbuf_t* sbuf; // send buffer int count = 0; + int norm_msg_size = 1500; // most messages fit in this size - mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE ); + mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE ); if( mrc == NULL ) { - fprintf( stderr, "[FAIL] unable to initialise RMr environment\n" ); + fprintf( stderr, "[FAIL] unable to initialise RMR environment\n" ); exit( 1 ); } - while( ! rmr_ready( mrc ) ) { // wait for routing table info + while( ! rmr_ready( mrc ) ) { // wait for routing table info sleep( 1 ); } @@ -124,12 +125,12 @@ int main() { while( 1 ) { if( whid < 0 ) { whid = rmr_wh_open( mrc, "localhost:6123" ); // open fails if endpoint refuses conn - if( RMR_WH_CONNECTED( wh ) ) { + if( RMR_WH_CONNECTED( wh ) ) { snprintf( sbuf->payload, 1024, "periodic update from sender: %d", count++ ); sbuf->len = strlen( sbuf->payload ); - sbuf = rmr_wh_call( mrc, whid, sbuf, 1000 ); // expect a response in 1s or less + sbuf = rmr_wh_call( mrc, whid, sbuf, 1000 ); // expect a response in 1s or less if( sbuf != NULL && sbuf->state = RMR_OK ) { - sprintf( stderr, "response: %s\n", sbuf->payload ); // assume they sent a string + sprintf( stderr, "response: %s\n", sbuf->payload ); // assume they sent a string } else { sprintf( stderr, "response not received, or send error\n" ); }