Annotation of 43BSDReno/contrib/isode-beta/psap2/psapabort.c, revision 1.1.1.1

1.1       root        1: /* psapabort.c - PPM: user abort */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/psap2/RCS/psapabort.c,v 7.1 90/07/01 21:04:56 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/psap2/RCS/psapabort.c,v 7.1 90/07/01 21:04:56 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       psapabort.c,v $
                     12:  * Revision 7.1  90/07/01  21:04:56  mrose
                     13:  * pepsy
                     14:  * 
                     15:  * Revision 7.0  89/11/23  22:14:17  mrose
                     16:  * Release 6.0
                     17:  * 
                     18:  */
                     19: 
                     20: /*
                     21:  *                               NOTICE
                     22:  *
                     23:  *    Acquisition, use, and distribution of this module and related
                     24:  *    materials are subject to the restrictions of a license agreement.
                     25:  *    Consult the Preface in the User's Manual for the full terms of
                     26:  *    this agreement.
                     27:  *
                     28:  */
                     29: 
                     30: 
                     31: /* LINTLIBRARY */
                     32: 
                     33: #include <stdio.h>
                     34: #include <signal.h>
                     35: #include "PS-types.h"
                     36: #include "ppkt.h"
                     37: #include "tailor.h"
                     38: 
                     39: /*    P-U-ABORT.REQUEST */
                     40: 
                     41: int    PUAbortRequest (sd, data, ndata, pi)
                     42: int    sd;
                     43: PE     *data;
                     44: int    ndata;
                     45: struct PSAPindication *pi;
                     46: {
                     47:     SBV            smask;
                     48:     int            len,
                     49:            result;
                     50:     char   *base;
                     51:     PE     pe;
                     52:     register struct psapblk *pb;
                     53:     struct SSAPindication   sis;
                     54:     register struct SSAPabort  *sa = &sis.si_abort;
                     55:     register struct type_PS_ARU__PPDU *pdu;
                     56: 
                     57:     toomuchP (data, ndata, NPDATA, "abort");
                     58:     missingP (pi);
                     59: 
                     60:     smask = sigioblock ();
                     61: 
                     62:     if ((pb = findpblk (sd)) == NULL) {
                     63:        (void) sigiomask (smask);
                     64:        return psaplose (pi, PC_PARAMETER, NULLCP,
                     65:                "invalid presentation descriptor");
                     66:     }
                     67: 
                     68:     pe = NULLPE;
                     69:     base = NULLCP;
                     70:     result = NOTOK;
                     71:     if ((pdu = (struct type_PS_ARU__PPDU *) calloc (1, sizeof *pdu)) == NULL) {
                     72: no_mem: ;
                     73:        (void) psaplose (pi, PC_CONGEST, NULLCP, "out of memory");
                     74:        goto out2;
                     75:     }
                     76:     pdu -> offset = type_PS_ARU__PPDU_normal__mode;
                     77:     if ((pdu -> un.normal__mode = (struct element_PS_4 *)
                     78:                                calloc (1, sizeof (struct element_PS_4)))
                     79:            == NULL)
                     80:        goto no_mem;
                     81:     if (data && ndata > 0) {
                     82:        if (pb -> pb_ncontext > 0
                     83:                && (pdu -> un.normal__mode -> context__list =
                     84:                                silly_list (pb, pi)) == NULL)
                     85:            goto out2;
                     86: 
                     87:        if ((pdu -> un.normal__mode -> user__data = info2ppdu (pb, pi,
                     88:                                                               data, ndata,
                     89:                                                               PPDU_NONE))
                     90:            == NULL)
                     91:        goto out2;
                     92:     }
                     93: 
                     94:     if (encode_PS_ARU__PPDU (&pe, 1, 0, NULLCP, pdu) == NOTOK) {
                     95:        (void) psaplose (pi, PC_CONGEST, NULLCP, "error encoding PDU: %s",
                     96:                         PY_pepy);
                     97:        goto out2;
                     98:     }
                     99: 
                    100:     PLOGP (psap2_log,PS_ARU__PPDU, pe, "ARU-PPDU", 0);
                    101: 
                    102:     if (pe2ssdu (pe, &base, &len) == NOTOK)
                    103:        goto no_mem;
                    104: 
                    105:     if ((result = SUAbortRequest (pb -> pb_fd, base, len, &sis)) == NOTOK)
                    106:        if (SC_FATAL (sa -> sa_reason)) {
                    107:            (void) ss2pslose (pb, pi, "SUAbortRequest", sa);
                    108:            goto out2;
                    109:        }
                    110:        else {
                    111:            (void) ss2pslose (NULLPB, pi, "SUAbortRequest", sa);            
                    112:            goto out1;
                    113:        }
                    114: 
                    115:     result = OK;
                    116:     pb -> pb_fd = NOTOK;
                    117: 
                    118: out2: ;
                    119:     freepblk (pb);
                    120: 
                    121: out1: ;
                    122:     if (pdu)
                    123:        free_PS_ARU__PPDU (pdu);
                    124:     if (pe)
                    125:        pe_free (pe);
                    126:     if (base)
                    127:        free (base);
                    128: 
                    129:     (void) sigiomask (smask);
                    130: 
                    131:     return result;
                    132: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.