gtpc2mb4 | C/C++ Language Support User's Guide |
This function sets the error_direction characteristic. It
overrides the default value set by the cminit or cmaccp
function.
Format
#include <tpfmap.h>
void cmsed(unsigned char *conversation_ID,
signed int *error_direction,
signed int *return_code);
- conversation_ID
- This is a pointer to an 8-byte character array that contains the
conversation ID. This conversation ID must be the ID returned by the
cminit (INITIALIZE) or cmaccp (ACCEPT_CONVERSATION) that
started this conversation.
- error_direction
- This is a pointer to a 4-byte field that specifies the type of
notification the remote program receives after the local program calls
cmserr in send-pending state. Use one of the
following values:
- CM_RECEIVE_ERROR
- This value specifies that, if the local program calls cmserr in
send-pending state, the remote program is notified of the error by
the CM_PROGRAM_ERROR_PURGING return code.
- CM_SEND_ERROR
- This value specifies that, if the local program calls cmserr in
send-pending state, the remote program is notified of the error by
the CM_PROGRAM_ERROR_NO_TRUNC return code.
- return_code
- This is a pointer to a 4-byte field where the return code is to be
placed.
Return Codes
The following is a list of return codes that can be returned to the program
that called the cmsed function. A complete list of the
return codes and their definitions can be found in Table 45.
- CM_OK
- CM_PRODUCT_SPECIFIC_ERROR
- CM_PROGRAM_PARAMETER_CHECK -- This indicates one of the
following:
- The specified conversation_ID is invalid.
- The specified error_direction is invalid.
Programming Considerations
- You can execute this function on any I-stream.
- The conversation can be in any state.
- The value supplied in conversation_ID must be the conversation ID
returned by the cmaccp or cminit function.
- This function changes the value of the error_direction
characteristic.
- The error_direction characteristic takes effect only when a
conversation is in send-pending state and affects only the
cmserr (SEND_ERROR) function. It resolves an ambiguous error
condition that can occur when a program receives both a change of direction
(permission to send) and data on a cmrcv call.
When cmrcv returns data_received set to
CM_COMPLETE_DATA_RECEIVED together with status_received set
to CM_SEND_RECEIVED, the conversation is placed in
send-pending state. Two possible error conditions can
occur:
- The local program finds an error with the data it just received.
- The local program finds an error while processing the data to be sent to
the remote program.
Use the error_direction characteristic to indicate which of
these 2 conditions occurred. If the error is in the received data, set
the error_direction to CM_RECEIVE_ERROR and the remote
program receives a return_code of CM_PROGRAM_ERROR_PURGING. If
the error is in the data to be sent, set the error_direction to
CM_SEND_ERROR, and the remote program receives a return_code
of CM_PROGRAM_ERROR_NO_TRUNC.
- This function causes no state change.
- If return_code is not CM_OK, the error_direction
characteristic remains unchanged.
Examples
The following example changes the error_direction
characteristic.
#include <tpfmap.h>
unsigned char convid[8];
signed int err_dir;
signed int rcode;
.
.
/* set conversation_ID with value returned from accept or initialize */
.
.
cmsed(convid,&err_dir,&rcode);
. /* normal processing path */
.
.
Related Information