/* ftamaccess2.c - FPM: respond to file access */
static char *rcsid
= "$Header: /f/osi/ftam/RCS/ftamaccess2.c,v 7.1 91/02/22 09:22:34 mrose Interim $";
* $Header: /f/osi/ftam/RCS/ftamaccess2.c,v 7.1 91/02/22 09:22:34 mrose Interim $
* $Log: ftamaccess2.c,v $
* Revision 7.1 91/02/22 09:22:34 mrose
* Revision 7.0 89/11/23 21:53:21 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
/* \f F-{LOCATE,ERASE}.RESPONSE */
int FAccessResponse (sd
, action
, identity
, diag
, ndiag
, fti
)
struct FADUidentity
*identity
; /* F-LOCATE.RESPONSE only */
struct FTAMdiagnostic diag
[];
struct FTAMindication
*fti
;
register struct ftamblk
*fsb
;
return ftamlose (fti
, FS_GEN_NOREASON
, 0, NULLCP
,
"bad value for action parameter");
toomuchP (diag
, ndiag
, NFDIAG
, "diagnostic");
result
= FAccessResponseAux (fsb
, action
, identity
, diag
, ndiag
, fti
);
(void) sigiomask (smask
);
static int FAccessResponseAux (fsb
, action
, identity
, diag
, ndiag
, fti
)
register struct ftamblk
*fsb
;
struct FADUidentity
*identity
;
struct FTAMdiagnostic diag
[];
struct FTAMindication
*fti
;
struct PSAPindication pis
;
struct PSAPindication
*pi
= &pis
;
struct PSAPabort
*pa
= &pi
-> pi_abort
;
register struct type_FTAM_PDU
*pdu
;
register struct type_FTAM_F__LOCATE__response
*loc
;
register struct type_FTAM_F__ERASE__response
*era
;
if (fsb
-> fsb_flags
& FSB_INIT
)
return ftamlose (fti
, FS_GEN (fsb
), 0, NULLCP
, "not responder");
switch (fsb
-> fsb_state
) {
return ftamlose (fti
, FS_GEN (fsb
), 0, NULLCP
,
"FADU identity parameter not allowed");
return ftamlose (fti
, FS_GEN (fsb
), 0, NULLCP
, "wrong state");
if ((pdu
= (struct type_FTAM_PDU
*) calloc (1, sizeof *pdu
)) == NULL
) {
(void) ftamlose (fti
, FS_GEN (fsb
), 1, NULLCP
, "out of memory");
if (fti
-> fti_abort
.fta_action
== FACTION_PERM
)
if (fsb
-> fsb_state
!= FSB_LOCATE
) {
pdu
-> offset
= type_FTAM_PDU_f__erase__response
;
if ((era
= (struct type_FTAM_F__ERASE__response
*)
calloc (1, sizeof *era
)) == NULL
)
pdu
-> un
.f__erase__response
= era
;
if ((era
-> action__result
=
(struct type_FTAM_Action__Result
*)
calloc (1, sizeof *era
-> action__result
)) == NULL
)
era
-> action__result
-> parm
= action
;
&& (era
-> diagnostic
= diag2fpm (fsb
, 0, diag
, ndiag
, fti
))
pdu
-> offset
= type_FTAM_PDU_f__locate__response
;
if ((loc
= (struct type_FTAM_F__LOCATE__response
*)
calloc (1, sizeof *loc
)) == NULL
)
pdu
-> un
.f__locate__response
= loc
;
if ((loc
-> action__result
=
(struct type_FTAM_Action__Result
*)
calloc (1, sizeof *loc
-> action__result
)) == NULL
)
loc
-> action__result
-> parm
= action
;
&& (loc
-> file__access__data__unit__identity
=
faduid2fpm (fsb
, identity
, fti
)) == NULL
)
&& (loc
-> diagnostic
= diag2fpm (fsb
, 0, diag
, ndiag
, fti
))
if (encode_FTAM_PDU (&pe
, 1, 0, NULLCP
, pdu
) == NOTOK
) {
(void) ftamlose (fti
, FS_GEN (fsb
), 1, NULLCP
,
"error encoding PDU: %s", PY_pepy
);
pe
-> pe_context
= fsb
-> fsb_id
;
fsbtrace (fsb
, (fsb
-> fsb_fd
, "P-DATA.REQUEST",
fsb
-> fsb_state
!= FSB_LOCATE
? "F-LOCATE-response"
: "F-ERASE-response", pe
, 0));
result
= PDataRequest (fsb
-> fsb_fd
, &pe
, 1, pi
);
(void) ps2ftamlose (fsb
, fti
, "PDataRequest", pa
);
fsb
-> fsb_state
= FSB_DATAIDLE
;