Changing Conversation States

A change in the conversation state can result from:

The following example shows how CPI-C calls can change the state of the conversation from SEND to RECEIVE and from RECEIVE to SEND.

Note  Any TP can send or receive data, regardless of whether it is the invoking TP (the TP that started the conversation) or the invokable TP (the TP that responded to a request to start a conversation).

This example shows how CPI-C calls can change the conversation state. In this table, each conversation state appears in bold and precedes the CPI-C calls that are used while in that state.

Issued by the invoking TP Issued by the invokable TP
Conversation state: RESET
Initialize_Conversation
Conversation state: INITIALIZE
Set_Sync_Level
(sync_level=CM_CONFIRM)
Allocate
Conversation state: SEND
Send_Data
Prepare_to_Receive Conversation state: RESET
Accept_Conversation
Conversation state: RECEIVE
(status_received= 
   CM_CONFIRM_SEND_RECEIVED)
Conversation state: CONFIRM_SEND
Confirm
Conversation state: SEND
(return_code=CM_OK)
Send_Data
Conversation state: RECEIVE
Confirm
(status_received=
CM_CONFIRM_RECEIVED)
Conversation state: CONFIRM
Request_To_Send
Confirmed
Conversation state: RECEIVE (return_code=CM_OK)
(request_to_send_received=
   CM_REQ_TO_SEND_RECEIVED)
Prepare_To_Receive
Receive
(status_received=
CM_CONFIRM_SEND_RECEIVED)
Conversation state: CONFIRM_SEND
Confirmed
Conversation state: SEND (return_code=CM_OK)
Conversation state: RECEIVE
Send_Data
Deallocate
Receive
(status_received=
CM_CONFIRM_DEALLOC_RECEIVED)
Conversation state:
CONFIRM_DEALLOCATE
Confirmed
(return_code=CM_OK) Conversation state: RESET
Conversation state: RESET

Initial States

Before the conversation is allocated, the state is RESET for both TPs.

In the example, after the conversation is allocated, the initial state is SEND for the invoking TP and RECEIVE for the invokable TP.

Changing to RECEIVE State

The Prepare_To_Receive call allows a TP to change the conversation from SEND to RECEIVE state. This call:

Changing to SEND State

The Request_To_Send call informs the partner TP (for which the conversation is in SEND state) that the local TP (for which the conversation is in RECEIVE state) wants to send data. This request is communicated to the partner TP through the request_to_send_received parameter of the Confirm call. (The request_to_send_received parameter is also returned to Send_Data and other calls.)

When the partner TP issues the Prepare_To_Receive call, the conversation state changes to RECEIVE for the partner TP, making it possible for the local TP to send data.

Important  Issuing Request_To_Send does not change the state of the conversation. Upon receiving a request to send, the partner TP is not required to change the conversation state; it can ignore the request.