Message buffers are declared as “void *” in the function prototypes. They can be a byte array, or the address of a data structure. The meaning is solely defined by the user programs. For example, a message buffer may be a custom protocol defined by the sender and receiver, or a TCP/IP packet, or any other data.
The contents of the message buffers are copied as part of the message passing API calls. The API function prototypes include arguments that specify the length of the message buffers. In most cases, a message originator and its recipient should use buffers of the same size, but in case there happens to be a length mismatch, the shorter length is used.
For example, if a task sends six bytes in a message and the receiver’s buffer is only four bytes long, then only the first four bytes of the message are copied to the receiver’s buffer. Likewise, if a task sends four bytes in a message and the receiver’s buffer is six bytes long, then again, only four bytes of the message are copied.
In the function prototype, REXIS_MessageSend is called with two message buffers, named sendbuf and reqbuf, and corresponding length arguments sendlen and reqlen. sendbuf contains the message being sent to the receiver, and reqbuf is the buffer to receive the reply from the receiver.
REXIS_MessageReceive is called with a receive buffer, recbuf, with length reclen. The message sent by the sender (the sendbuf argument) is copied into recbuf. The number of bytes copied is the smaller of reclen and sendlen, and is the return value of the REXIS_MessageReceive function.
REXIS_MessageReply is called with the reply message (named reqbuf with length reqlen) by the receiver, and the reply message is copied into the sender reqbuf buffer. The number of bytes copied is the smaller of sender’s reqlen and receiver’s reqlen.