ACSE/Presentation and ROSE Interface Programmer's Guide

40 Chapter 3
Using ACSE/Presentation
Step 3. Exchanging Data
Step 3. Exchanging Data
Once an association is established, processes can send and receive
control data (primitives) and user data.
It is the responsibility of the process to encode and decode data with the
selected transfer syntax. For complex data types, you can choose to use
an ASN.1 compiler to assist in the creation of these routines.
Process A retrieves its supported and negotiated transfer syntaxes by
calling ap_get_env() using the AP_DCS attribute, and to find out the
result of each proposed presentation context by calling ap_get_env()
using AP_PCDRL to look at the res and prov_rsn fields. (See Figure 3-8.)
Process A is now ready to send data using the P_DATA_REQ primitive in
the ap_snd() call in the agreed upon presentation context.
Process B uses ap_poll() to monitor events. The data received by ap_rcv()
is indicated by the P_DATA_IND primitive.
Note that the AP_ALLOC option is not supported. The buffer pointed to
by ubuf must be allocated by the user.
If the data received is more than the allocated buffer, the flags parameter
AP_MORE bit is set. If set, continue to invoke ap_rcv() until the
AP_MORE bit is off.
Check the sptype parameter each time ap_rcv() is called. Some
primitives such as A_ABORT_IND are not flow-controlled and may
interrupt the receipt of a partially received primitive (for example,
AP_MORE bit is set). If this occurs, any remaining data from the
previous primitive is lost.
NOTE Note that handling expedited data is not supported in this release.