|
|
1.1 ! root 1: /* psaprelease2.c - PPM: respond to release */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap2-lpp/RCS/psaprelease2.c,v 7.1 90/07/01 21:05:30 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap2-lpp/RCS/psaprelease2.c,v 7.1 90/07/01 21:05:30 mrose Exp $ ! 9: * ! 10: * Contributed by The Wollongong Group, Inc. ! 11: * ! 12: * ! 13: * $Log: psaprelease2.c,v $ ! 14: * Revision 7.1 90/07/01 21:05:30 mrose ! 15: * pepsy ! 16: * ! 17: * Revision 7.0 89/11/23 22:15:57 mrose ! 18: * Release 6.0 ! 19: * ! 20: */ ! 21: ! 22: /* ! 23: * NOTICE ! 24: * ! 25: * Acquisition, use, and distribution of this module and related ! 26: * materials are subject to the restrictions of a license agreement. ! 27: * Consult the Preface in the User's Manual for the full terms of ! 28: * this agreement. ! 29: * ! 30: */ ! 31: ! 32: ! 33: /* LINTLIBRARY */ ! 34: ! 35: #include <stdio.h> ! 36: #include <signal.h> ! 37: #define LPP ! 38: #include "PS-types.h" ! 39: #include "ppkt.h" ! 40: #include "tailor.h" ! 41: ! 42: /* P-RELEASE.RESPONSE */ ! 43: ! 44: int PRelResponse (sd, status, data, ndata, pi) ! 45: int sd; ! 46: int status; ! 47: PE *data; ! 48: int ndata; ! 49: struct PSAPindication *pi; ! 50: { ! 51: SBV smask; ! 52: int result; ! 53: register struct psapblk *pb; ! 54: ! 55: if (status != SC_ACCEPT) ! 56: return psaplose (pi, PC_PARAMETER, NULLCP, ! 57: "must accept release request"); ! 58: if (data == NULL || ndata <= 0 || data[0] == NULLPE || ndata > NPDATA_PS) ! 59: return psaplose (pi, PC_PARAMETER, NULLCP, "bad release user data"); ! 60: if (data[0] -> pe_context != PCI_ACSE) ! 61: return psaplose (pi, PC_PARAMETER, NULLCP, ! 62: "wrong context for release user data"); ! 63: missingP (pi); ! 64: ! 65: smask = sigioblock (); ! 66: ! 67: psapFsig (pb, sd); ! 68: ! 69: result = PRelResponseAux (pb, data[0], pi); ! 70: ! 71: freepblk (pb); ! 72: ! 73: (void) sigiomask (smask); ! 74: ! 75: return result; ! 76: } ! 77: ! 78: /* */ ! 79: ! 80: static int PRelResponseAux (pb, data, pi) ! 81: register struct psapblk *pb; ! 82: PE data; ! 83: struct PSAPindication *pi; ! 84: { ! 85: int result; ! 86: PE pe; ! 87: PS ps; ! 88: register struct type_PS_ReleaseResponse__PDU *pdu; ! 89: ! 90: if ((pdu = (struct type_PS_ReleaseResponse__PDU *) malloc (sizeof *pdu)) ! 91: == NULL) ! 92: return psaplose (pi, PC_CONGEST, NULLCP, "out of memory"); ! 93: pdu -> reference = pb -> pb_reliability == LOW_QUALITY ? pb -> pb_reference ! 94: : NULLRF; ! 95: pdu -> user__data = data; ! 96: ! 97: pe = NULLPE; ! 98: result = encode_PS_ReleaseResponse__PDU (&pe, 1, 0, NULLCP, pdu); ! 99: ! 100: pdu -> reference = NULL; ! 101: pdu -> user__data = NULLPE; ! 102: free_PS_ReleaseResponse__PDU (pdu); ! 103: ! 104: if (result != NOTOK) { ! 105: PLOGP (psap2_log,PS_PDUs, pe, "ReleaseResponse-PDU", 0); ! 106: ! 107: if ((result = pe2ps (ps = pb -> pb_stream, pe)) == NOTOK) ! 108: (void) pslose (pi, ps -> ps_errno); ! 109: else ! 110: result = OK; ! 111: } ! 112: else ! 113: (void) psaplose (pi, PC_CONGEST, NULLCP, "error encoding PDU: %s", ! 114: PY_pepy); ! 115: ! 116: if (pe) ! 117: pe_free (pe); ! 118: ! 119: return result; ! 120: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.