HP-UX SNAplus2 R7 APPC Programmer's Guide

Writing Transaction Programs
Writing TP Servers
2.11.4 Timeouts Versus Critical Errors
In a basic conversation, a TP can indicate whether an abend was caused by a timeout or by a critical error.
2.12 Writing TP Servers
UNIX
Use the following operational guidelines for writing TP servers:
1. Use REGISTER_TP_SERVER to register the application as a TP server. The REGISTER_TP_SERVER verb
provides the address of a callback function used in later Attach notications.
2. Use REGISTER_TP to register the TP names and local and remote LUs for which the TP server wishes to
process Attaches. The TP server can use wildcards for both TP names and LU names so that it can choose
to process Attaches from a TP over a particular pair of LUs or to Attaches for all TPs over all LUs, or any
combination of those conditions.
3. Use QUERY_ATTACH (with the unique identier received when the notication callback is made after an
Attach is received for the registered TP or LU) to query the Attach parameters to determine whether and how
to process the Attach. The TP server can reject the Attach using REJECT_ATTACH or accept the Attach using
ACCEPT_ATTACH and start a suitable application to process the Attach.
4. Issue the standard RECEIVE_ALLOCATE call to retrieve the Attach. The previously reserved dload_id
parameter is used to specify the unique identier of the Attach.
5. Use ABORT_ATTACH to cancel any further processing if, after issuing ACCEPT_ATTACH, an error is
encountered.
6. Deregister the TP server for any of the previously registered TPs and LUs using UNREGISTER_TP.
7. Deregister the application as a TP server using the UNREGISTER_TP_SERVER verb.
2.12.1 TP Server Responsibilities
When a TP server handles an Attach, the TP server inherits a number of responsibilities normally performed by the
SNAplus2 Attach Manager. These responsibilities include the following:
Starting TPs to handle the conversations if a TP is congured to be automatically started
Handling conversation security including parsing the Attach data returned on QUERY_ATTACH
Conveying information from the Attach to the TP that the TP server starts to process the ensuing conversation
2.12.2 Default TP Server
SNAplus2 provides a default TP server, snatpsrvd, that is installed on all systems. This TP server uses the
sna_tps le as the source for the conguration of the TPs that it can load. Other TP servers can modify and use
this le by using DEFINE_TP_LOAD_INFO verbs. For more information about the DEFINE_TP_LOAD_INFO
verb, refer to the HP-UX SNAplus2 NOF Programmers Guide. APPC provides the tp_le_updates parameter on a
REGISTER_TP verb so that a TP server is notied when a change has been made to the sna_tps le and can
take the required action.
75