OSI/AS Programming Manual

Example 2: Presentation Layer and ACSE
Sample Programs
E–56 056783 Tandem Computers Incorporated
pres_context_list.zelement[1].zts_name[0].zobj_id[0] = 2;
pres_context_list.zelement[1].zts_name[0].zobj_id[1] = 1;
pres_context_list.zelement[1].zts_name[0].zobj_id[2] = 1;
/* */
/* Set the ACSE application context name for this req. */
/* { 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 the mode and service ID for an ACSE association. */
/* */
mode = ZAPS_VAL_MODE_NORMAL;
service_id = ZAPS_VAL_SERVICE_ACSE;
/* */
/* Set up ACSE associate request user data. */
/* Normally, this would be generated by an */
/* 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 ]
, "connectreq"
, 10 /* data */
);
user_data.element.zlen = 19;
/* */
/* Issue ACSE associate request. */
/* ( ACSE is being used, */
/* so there's no default context name ). */
/* */
printf( "APPL1: connect request ->\n" );
status =
APS_ASSOC_CONNECTREQ_( &cepi
, (int *) &api_environment
, (int *) &local_appl