OSI/AS Programming Manual

Example 2: Presentation Layer and ACSE
Sample Programs
056783 Tandem Computers Incorporated E–87
/* */
/* Get ACSE associate indication user data. */
/* */
retrieve_user_data();
/* */
/* Set the ACSE application context name for this */
/* request. */
/* { iso standard 8571 */
/* application-context(1) iso-ftam(1) } */
/* */
acse_appl_context_name.znum_elements = 5;
acse_appl_context_name.zobj_id[0] = 1;
acse_appl_context_name.zobj_id[1] = 0;
acse_appl_context_name.zobj_id[2] = 8571;
acse_appl_context_name.zobj_id[3] = 1;
acse_appl_context_name.zobj_id[4] = 1;
/* */
/* Set up ACSE associate response user data. */
/* Normally, this would be generated by an ASN.1 */
/* ASN.1 compiler. */
/* */
user_data.header.znum_elements = 1;
user_data.element.ztype = ZAPS_VAL_DATA_TYPE_VALUE;
user_data.element.zpcid = 1; /* ignored by ACSE */
user_data.value[ 0] = 0x28; /* EXTERNAL */
user_data.value[ 1] = 17; /* length */
user_data.value[ 2] = 0x02; /* INTEGER */
user_data.value[ 3] = 1; /* length of INTEGER */
user_data.value[ 4] = 1; /* pcid */
user_data.value[ 5] = 0x80; /* single-asn1-type */
user_data.value[ 6] = 12; /* length of user-info */
user_data.value[ 7] = 0x04; /* octet string */
user_data.value[ 8] = 10; /* length of octet string */
memcpy( &user_data.value[ 9 ]
, "connectrsp"
, 10 /* data */
);
user_data.element.zlen = 19;
/* */
/* Issue ACSE associate response. */
/* */
connect_result = ZAPS_VAL_CON_ACCEPT;
pres_default_context_result = ZAPS_VAL_CNTXT_RSLT_ACCEPT;
tag = error_connectrsp_proc;
printf( "APPL2: connect response <-\n" );
status =
APS_ASSOC_CONNECTRSP_( cepi
, (int *) &local_appl
, connect_result
, (int *) &session_rqmnts
, /* conid */