Initial commit of RMR Library
[ric-plt/lib/rmr.git] / doc / src / man / rmr_send_msg.3.xfm
diff --git a/doc/src/man/rmr_send_msg.3.xfm b/doc/src/man/rmr_send_msg.3.xfm
new file mode 100644 (file)
index 0000000..6497781
--- /dev/null
@@ -0,0 +1,188 @@
+.if false
+==================================================================================
+       Copyright (c) 2019 Nokia 
+       Copyright (c) 2018-2019 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.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================================
+.fi
+.if false
+       Mnemonic        rmr_send_msg_man.xfm
+       Abstract        The manual page for the rmr_send_msg function.
+       Author          E. Scott Daniels
+       Date            28 January 2019
+.fi
+
+.** if formatting with tfm, the roff.im will cause roff output to be generated
+.** if formatting with pfm, then pretty postscript will be generated
+.gv e LIB lib
+.if pfm
+       .im &{lib}/generic_ps.im
+.ei
+       .gv e OUTPUT_RST use_rst
+       .if .ev &use_rst 1 = 
+               .im &{lib}/rst.im
+       .ei
+               .im &{lib}/roff.im
+       .fi
+.fi
+
+&line_len(6i)
+
+&h1(RMR Library Functions)
+&h2(NAME)
+       rmr_send_msg
+
+&h2(SYNOPSIS )
+&indent
+&ex_start
+#include <rmr/rmr.h>
+
+rmr_mbuf_t* rmr_send_msg( void* vctx, rmr_mbuf_t* msg );
+&ex_end
+&uindent
+
+&h2(DESCRIPTION)
+The &cw(rmr_send_msg) function accepts a message buffer from the user application 
+and attempts to send it.
+The destination of the message is selected based on the message type specified
+in the message buffer, and the matching information in the routing tables
+which are currently in use by the RMR library. 
+This may actually result in the sending of the message to multiple destinations
+which could degrade expected overall performance of the user application. 
+(Limiting excessive sending of messages is the responsibility of the application(s)
+responsible for building the routing table used by the RMR library, and not the 
+responsibility of the library.)
+
+
+&h2(RETURN VALUE)
+On success, a new message buffer, with an empty payload, is returned for the application
+to use for the next send.
+The state in this buffer will reflect the overall send operation state and should be
+&cw(RMR_OK.)
+
+&space
+If the state in the returned buffer is anything other than &cw(UT_OK,) the user application 
+may need to attempt a retransmission of the message, or take other action depending on the
+setting of &cw(errno) as described below. 
+
+&space
+In the event of extreme failure, a NULL pointer is returned. In this case the value of 
+&cw(errno) might be of some use, for documentation, but there will be little that the 
+user application can do other than to move on.
+
+&h2(ERRORS)
+The following values may be passed back in the &ital(state) field of the returned message
+buffer. 
+
+&space
+&beg_dlist(.75i : ^&bold_font )
+&di(RMR_ERR_BADARG) The message buffer pointer did not refer to a valid message.
+&di(RMR_ERR_NOHDR)  The header in the message buffer was not valid or corrupted.
+&di(RMR_ERR_NOENDPT)  The message type in the message buffer did not map to a known endpoint.
+&end_dlist
+
+&space
+The following values may be assigned to &cw(errno) on failure.
+&beg_dlist(.75i : ^&bold_font )
+&di(INVAL) Parameter(s) passed to the function were not valid, or the underlying message processing environment was unable to interpret the message.
+
+&half_space
+&di(ENOKEY) The header information in the message buffer was invalid.
+
+&half_space
+&di(ENXIO) No known endpoint for the message could be found.
+
+&half_space
+&di(EMSGSIZE) The underlying transport refused to accept the message because of a size value issue (message was not attempted to be sent).
+
+&half_space
+&di(EFAULT) The message referenced by the message buffer is corrupt (NULL pointer or bad internal length).
+
+&half_space
+&di(EBADF) Internal RMR error; information provided to the message transport environment was not valid.
+
+&half_space
+&di(ENOTSUP) Sending was not supported by the underlying message transport.
+
+&half_space
+&di(EFSM) The device is not in a state that can accept the message.
+
+&half_space
+&di(EAGAIN) The device is not able to accept a message for sending. The user application should attempt to resend.
+
+&half_space
+&di(EINTR) The operation was interrupted by delivery of a signal before the message was sent.
+
+&half_space
+&di(ETIMEDOUT) The underlying message environment timed out during the send process.
+
+&half_space
+&di(ETERM) The underlying message environment is in a shutdown state.
+&end_dlist
+
+&h2(EXAMPLE)
+The following is a simple example of how the &cw(rmr_send_msg) function is called.
+In this example, the send message buffer is saved between calls and reused
+eliminating alloc/free cycles.
+
+&space
+&ex_start
+    static rmr_mbuf_t*  send_msg = NULL;        // message to send; reused on each call
+    msg_t*  send_pm;                            // payload for send
+    msg_t*  pm;                                 // our message format in the received payload
+
+       if( send_msg  == NULL ) {
+        send_msg = rmr_alloc_msg( mr, MAX_SIZE );      // new buffer to send
+       }
+
+       // reference payload and fill in message type
+    pm = (msg_t*) send_msg->payload;
+    send_msg->mtype = MT_ANSWER;               
+
+    msg->len = generate_data( pm );            // something that fills the payload in
+    msg = rmr_send_msg( mr, send_msg );
+       if( ! msg ) {
+               return ERROR;
+       } else {
+               if( msg->state != RMR_OK ) {
+                       // check for eagain, and resend if needed
+                       // else return error
+               }
+       }
+
+       return OK;
+                       
+&ex_end
+
+
+&h2(SEE ALSO )
+.ju off
+rmr_alloc_msg(3),
+rmr_call(3),
+rmr_free_msg(3),
+rmr_init(3),
+rmr_payload_size(3),
+rmr_rcv_msg(3),
+rmr_rcv_specific(3),
+rmr_rts_msg(3),
+rmr_ready(3),
+rmr_mk_ring(3),
+rmr_ring_free(3),
+rmr_torcv_rcv(3),
+rmr_wh_send_msg(3)
+.ju on
+
+
+.qu
+