|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 4079 (0xfef) Types: TextFile Names: »ssaprelease1.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/ssap/ssaprelease1.c«
/* ssaprelease1.c - SPM: initiate release */ #ifndef lint static char *rcsid = "$Header: /f/osi/ssap/RCS/ssaprelease1.c,v 6.0 89/03/18 23:43:57 mrose Rel $"; #endif /* * $Header: /f/osi/ssap/RCS/ssaprelease1.c,v 6.0 89/03/18 23:43:57 mrose Rel $ * * * $Log: ssaprelease1.c,v $ * Revision 6.0 89/03/18 23:43:57 mrose * Release 5.0 * */ /* * NOTICE * * 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 * this agreement. * */ /* LINTLIBRARY */ #include <stdio.h> #include <signal.h> #include "spkt.h" /* \f S-RELEASE.REQUEST */ #define dotoken(requires,shift,bit,type) \ { \ if ((sb -> sb_requirements & requires) && !(sb -> sb_owned & bit)) \ return ssaplose (si, SC_OPERATION, NULLCP, \ "%s token not owned by you", type); \ } /* \f */ int SRelRequest (sd, data, cc, sr, si) int sd; char *data; int cc; struct SSAPrelease *sr; struct SSAPindication *si; { SBV smask; int result; register struct ssapblk *sb; missingP (sr); missingP (si); smask = sigioblock (); ssapPsig (sb, sd); toomuchP (sb, data, cc, SF_SIZE, "release"); result = SRelRequestAux (sb, data, cc, sr, si); (void) sigiomask (smask); return result; } /* \f */ static int SRelRequestAux (sb, data, cc, sr, si) register struct ssapblk *sb; char *data; int cc; struct SSAPrelease *sr; struct SSAPindication *si; { int code, result; register struct ssapkt *s; dotokens (); if (sb -> sb_flags & SB_CD) return ssaplose (si, SC_OPERATION, NULLCP, "capability data request in progress"); if (sb -> sb_flags & SB_CDA) return ssaplose (si, SC_OPERATION, NULLCP, "awaiting your capability data response"); if (sb -> sb_flags & SB_GTC) return ssaplose (si, SC_OPERATION, NULLCP, "give control request in progress"); if (sb -> sb_flags & SB_MAA) return ssaplose (si, SC_OPERATION, "awaiting your majorsync response"); if (sb -> sb_xspdu || sb -> sb_spdu) return ssaplose (si, SC_WAITING, NULLCP, NULLCP); code = SPDU_FN; again: ; if ((s = newspkt (code)) == NULL) return ssaplose (si, SC_CONGEST, NULLCP, "out of memory"); if (code == SPDU_FN) { s -> s_mask |= SMASK_FN_DISC; s -> s_fn_disconnect = FN_DISC_RELEASE; } if (cc > 0) { s -> s_mask |= SMASK_UDATA_PGI; s -> s_udata = data, s -> s_ulen = cc; } else s -> s_udata = NULL, s -> s_ulen = 0; result = spkt2sd (s, sb -> sb_fd, 0, si); s -> s_mask &= ~SMASK_UDATA_PGI; s -> s_udata = NULL, s -> s_ulen = 0; freespkt (s); if (result == NOTOK) goto out1; if ((s = sb2spkt (sb, si, NOTOK, NULLTX)) == NULL) goto out2; bzero ((char *) sr, sizeof *sr); switch (s -> s_code) { case SPDU_FN: freespkt (s); code = SPDU_DN; goto again; case SPDU_DN: sr -> sr_affirmative = 1; copySPKTdata (s, sr); freespkt (s); freesblk (sb); return OK; case SPDU_NF: if (!(sb -> sb_requirements & SR_RLS_EXISTS) || !(sb -> sb_owned & ST_RLS_TOKEN)) goto bad_nf; sr -> sr_affirmative = 0; copySPKTdata (s, sr); freespkt (s); return OK; case SPDU_RS: if (sb -> sb_spdu) /* XXX */ freespkt (sb -> sb_spdu); sb -> sb_spdu = s; return ssaplose (si, SC_WAITING, NULLCP, NULLCP); case SPDU_AB: si -> si_type = SI_ABORT; { register struct SSAPabort *sa = &si -> si_abort; if (!(sa -> sa_peer = (s -> s_ab_disconnect & AB_DISC_USER) ? 1 : 0)) sa -> sa_reason = SC_ABORT; sa -> sa_info = s -> s_udata, sa -> sa_cc = s -> s_ulen; sa -> sa_realinfo = s -> s_udata, s -> s_udata = NULL; } break; default: bad_nf: ; (void) spktlose (sb -> sb_fd, si, SC_PROTOCOL, NULLCP, "session protocol mangled: not expecting 0x%x", s -> s_code); break; } out2: ; freespkt (s); out1: ; freesblk (sb); return NOTOK; } #undef dotoken