/* acsaprovider.c - implement the association control protocol */
static char *rcsid
= "$Header: /f/osi/acsap/RCS/acsaprovider.c,v 7.1 91/02/22 09:14:18 mrose Interim $";
* $Header: /f/osi/acsap/RCS/acsaprovider.c,v 7.1 91/02/22 09:14:18 mrose Interim $
* $Log: acsaprovider.c,v $
* Revision 7.1 91/02/22 09:14:18 mrose
* Revision 7.0 89/11/23 21:21:59 mrose
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
int ps2acslose (acb
, aci
, event
, pa
)
register struct assocblk
*acb
;
register struct AcSAPindication
*aci
;
register struct PSAPabort
*pa
;
SLOG (addr_log
, LLOG_EXCEPTIONS
, NULLCP
,
(pa
-> pa_cc
> 0 ? "%s: %s [%*.*s]": "%s: %s", event
,
PErrString (pa
-> pa_reason
), pa
-> pa_cc
, pa
-> pa_cc
,
switch (pa
-> pa_reason
) {
(void) sprintf (cp
= buffer
, " (%s at presentation)",
PErrString (pa
-> pa_reason
));
reason
= ACS_PRESENTATION
;
if (ACS_FATAL (reason
)) {
return acpktlose (acb
, aci
, reason
, NULLCP
, "%*.*s%s",
pa
-> pa_cc
, pa
-> pa_cc
, pa
-> pa_data
, cp
);
return acpktlose (acb
, aci
, reason
, NULLCP
, "%s",
return acsaplose (aci
, reason
, NULLCP
, "%*.*s%s",
pa
-> pa_cc
, pa
-> pa_cc
, pa
-> pa_data
, cp
);
return acsaplose (aci
, reason
, NULLCP
, "%s",
Owing to laziness on our part, we use only ASN.1 transfer syntax.
struct type_ACS_Association__information
*info2apdu (acb
, aci
, data
, ndata
)
struct AcSAPindication
*aci
;
struct type_ACS_Association__information
*info
;
register struct type_ACS_Association__information
**pp
,
register struct type_UNIV_EXTERNAL
*q
;
for (pp
= &info
; ndata
-- > 0; pp
= &p
-> next
) {
if ((*pp
= p
= (struct type_ACS_Association__information
*)
calloc (1, sizeof *p
)) == NULL
|| (p
-> EXTERNAL
= (struct type_UNIV_EXTERNAL
*)
calloc (1, sizeof *q
)) == NULL
|| (p
-> EXTERNAL
-> encoding
= (struct choice_UNIV_0
*)
malloc (sizeof (struct choice_UNIV_0
))) == NULL
)
if (!(acb
-> acb_flags
& ACB_CONN
)
&& (q
-> direct__reference
= oid_cpy (ode2oid (BER
)))
q
-> indirect__reference
= (pe
= *data
++) -> pe_context
;
q
-> encoding
-> offset
= choice_UNIV_0_single__ASN1__type
;
(q
-> encoding
-> un
.single__ASN1__type
= pe
) -> pe_refcnt
++;
free_ACS_Association__information (info
);
(void) acsaplose (aci
, ACS_CONGEST
, NULLCP
, "out of memory");
int apdu2info (acb
, aci
, info
, data
, ndata
)
struct AcSAPindication
*aci
;
struct type_ACS_Association__information
*info
;
register struct type_UNIV_EXTERNAL
*q
;
for (i
= 0; info
; info
= info
-> next
, i
++) {
return acpktlose (acb
, aci
, ACS_CONGEST
, NULLCP
,
"too much user information");
if (q
-> encoding
-> offset
!= choice_UNIV_0_single__ASN1__type
)
return acpktlose (acb
, aci
, ACS_PROTOCOL
, NULLCP
,
"EXTERNAL data not single-ASN1-type");
(pe
= q
-> encoding
-> un
.single__ASN1__type
) -> pe_refcnt
++;
pe
-> pe_context
= q
-> indirect__reference
;