OSI/AS Programming Manual

Example 1: Session Layer
Sample Programs
056783 Tandem Computers Incorporated E–25
remote_appl_1.zpsap.zpsel.zlen = 0; /* not used */
remote_appl_1.zpsap.zssel.zlen = 0; /* not used */
remote_appl_1.zpsap.ztsel.zlen = 0; /* not used */
remote_appl_1.zpsap.znsap.zlen = 0; /* not used */
remote_appl_1.zappl_name.zlen = 5;
memcpy( remote_appl_1.zappl_name.u_zc.zb, "APPL2", 5 );
local_appl_2.zpsap.zpsel.zlen = 0; /* not used */
local_appl_2.zpsap.zssel.zlen = 0; /* not used */
local_appl_2.zpsap.ztsel.zlen = 0; /* not used */
local_appl_2.zpsap.znsap.zlen = 0; /* not used */
local_appl_2.zappl_name.zlen = 5;
memcpy( local_appl_2.zappl_name.u_zc.zb, "APPL2", 5 );
remote_appl_2.zpsap.zpsel.zlen = 0; /* not used */
remote_appl_2.zpsap.zssel.zlen = 0; /* not used */
remote_appl_2.zpsap.ztsel.zlen = 0; /* not used */
remote_appl_2.zpsap.znsap.zlen = 0; /* not used */
remote_appl_2.zappl_name.zlen = 5;
memcpy( remote_appl_2.zappl_name.u_zc.zb, "APPL1", 5 );
/* */
/* APPLICATION 1 */
/* Inform the OSI/AS subsystem that the application is */
/* willing to establish a connection if a remote user */
/* requests one. The fourth parameter, service^id, is */
/* not used here, because its default is session. */
/* */
printf( "APPL1: attach\n" );
status = APS_ASSOC_ATTACH_( &cepi_1
, (int *) &api_environment
, (int *) &local_appl_1
);
if ( status != ZAPS_VAL_STATUS_OK )
display_aps_status( cepi_1, error_attach_proc );
/* */
/* Get OSI address information. */
/* */
error =
APS_ASSOC_GETPARAM_( cepi_1
, /* conid */
, (int *) &local_appl
, /* remote-appl */
, /* connect-result */
, /* session-rqmnts */
, /* release-result */
, /* abort-reason */
);
if ( error != ZAPS_ERR_OK )
display_aps_error( error_assoc_getparam_proc );
/* */
/* APPLICATION 2 */
/* Issue connect request */
/* */