|
|
1.1 ! root 1: /* ssaprelease2.c - SPM: respond to release */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/ssap/RCS/ssaprelease2.c,v 7.0 89/11/23 22:25:36 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/ssap/RCS/ssaprelease2.c,v 7.0 89/11/23 22:25:36 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: ssaprelease2.c,v $ ! 12: * Revision 7.0 89/11/23 22:25:36 mrose ! 13: * Release 6.0 ! 14: * ! 15: */ ! 16: ! 17: /* ! 18: * NOTICE ! 19: * ! 20: * Acquisition, use, and distribution of this module and related ! 21: * materials are subject to the restrictions of a license agreement. ! 22: * Consult the Preface in the User's Manual for the full terms of ! 23: * this agreement. ! 24: * ! 25: */ ! 26: ! 27: ! 28: /* LINTLIBRARY */ ! 29: ! 30: #include <stdio.h> ! 31: #include <signal.h> ! 32: #include "spkt.h" ! 33: ! 34: /* S-RELEASE.RESPONSE */ ! 35: ! 36: int SRelResponse (sd, status, data, cc, si) ! 37: int sd; ! 38: int status, ! 39: cc; ! 40: char *data; ! 41: struct SSAPindication *si; ! 42: { ! 43: SBV smask; ! 44: int result; ! 45: register struct ssapblk *sb; ! 46: ! 47: missingP (si); ! 48: ! 49: smask = sigioblock (); ! 50: ! 51: ssapFsig (sb, sd); ! 52: toomuchP (sb, data, cc, SR_SIZE, "release"); ! 53: ! 54: result = SRelResponseAux (sb, status, data, cc, si); ! 55: ! 56: (void) sigiomask (smask); ! 57: ! 58: return result; ! 59: } ! 60: ! 61: /* S-RELEASE.RESPONSE */ ! 62: ! 63: static int SRelResponseAux (sb, status, data, cc, si) ! 64: register struct ssapblk *sb; ! 65: int status, ! 66: cc; ! 67: char *data; ! 68: struct SSAPindication *si; ! 69: { ! 70: int code, ! 71: result; ! 72: register struct ssapkt *s; ! 73: ! 74: switch (status) { ! 75: case SC_ACCEPT: ! 76: code = SPDU_DN; ! 77: break; ! 78: ! 79: case SC_REJECTED: ! 80: if (!(sb -> sb_requirements & SR_NEGOTIATED)) ! 81: return ssaplose (si, SC_OPERATION, NULLCP, ! 82: "negotiated release service unavailable"); ! 83: if (!(sb -> sb_requirements & SR_RLS_EXISTS)) ! 84: return ssaplose (si, SC_OPERATION, NULLCP, ! 85: "release token unavailable"); ! 86: if (sb -> sb_owned & ST_RLS_TOKEN) ! 87: return ssaplose (si, SC_OPERATION, NULLCP, ! 88: "release token owned by you"); ! 89: ! 90: code = SPDU_NF; ! 91: break; ! 92: ! 93: default: ! 94: return ssaplose (si, SC_PARAMETER, NULLCP, ! 95: "invalid value for status parameter"); ! 96: } ! 97: ! 98: if ((s = newspkt (code)) == NULL) ! 99: return ssaplose (si, SC_CONGEST, NULLCP, "out of memory"); ! 100: ! 101: if (cc > 0) { ! 102: s -> s_mask |= SMASK_UDATA_PGI; ! 103: s -> s_udata = data, s -> s_ulen = cc; ! 104: } ! 105: else ! 106: s -> s_udata = NULL, s -> s_ulen = 0; ! 107: result = spkt2sd (s, sb -> sb_fd, 0, si); ! 108: s -> s_mask &= ~SMASK_UDATA_PGI; ! 109: s -> s_udata = NULL, s -> s_ulen = 0; ! 110: ! 111: freespkt (s); ! 112: if (result == NOTOK || code == SPDU_DN) ! 113: freesblk (sb); ! 114: else ! 115: sb -> sb_flags &= ~SB_FINN; ! 116: ! 117: return result; ! 118: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.