Annotation of 43BSDReno/contrib/isode-beta/psap2/psaplose.c, revision 1.1

1.1     ! root        1: /* psaplose.c - PPM: you lose */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/psap2/RCS/psaplose.c,v 7.1 90/07/01 21:05:04 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/psap2/RCS/psaplose.c,v 7.1 90/07/01 21:05:04 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       psaplose.c,v $
        !            12:  * Revision 7.1  90/07/01  21:05:04  mrose
        !            13:  * pepsy
        !            14:  * 
        !            15:  * Revision 7.0  89/11/23  22:14:21  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 <varargs.h>
        !            35: #include "PS-types.h"
        !            36: #include "ppkt.h"
        !            37: #include "tailor.h"
        !            38: 
        !            39: /*  */
        !            40: 
        !            41: #ifndef        lint
        !            42: int    ppktlose (va_alist)
        !            43: va_dcl
        !            44: {
        !            45:     int            len,
        !            46:            ppdu,
        !            47:            reason,
        !            48:            result,
        !            49:            value;
        !            50:     char   *base;
        !            51:     register struct psapblk *pb;
        !            52:     PE     pe;
        !            53:     register struct PSAPindication *pi;
        !            54:     register struct PSAPabort *pa;
        !            55:     struct SSAPindication   sis;
        !            56:     struct type_PS_ARP__PPDU pdus;
        !            57:     register struct type_PS_ARP__PPDU *pdu = &pdus;
        !            58:     va_list ap;
        !            59: 
        !            60:     va_start (ap);
        !            61: 
        !            62:     pb = va_arg (ap, struct psapblk *);
        !            63:     pi = va_arg (ap, struct PSAPindication *);
        !            64:     reason = va_arg (ap, int);
        !            65:     ppdu = va_arg (ap, int);
        !            66: 
        !            67:     result = _psaplose (pi, reason, ap);
        !            68: 
        !            69:     va_end (ap);
        !            70: 
        !            71:     if ((pa = &pi -> pi_abort) -> pa_cc > 0) {
        !            72:        SLOG (psap2_log, LLOG_EXCEPTIONS, NULLCP,
        !            73:              ("ppktlose [%s] %*.*s", PErrString (pa -> pa_reason),
        !            74:               pa -> pa_cc, pa -> pa_cc, pa -> pa_data));
        !            75:     }
        !            76:     else
        !            77:        SLOG (psap2_log, LLOG_EXCEPTIONS, NULLCP,
        !            78:              ("ppktlose [%s]", PErrString (pa -> pa_reason)));
        !            79: 
        !            80:     if (pb -> pb_fd == NOTOK)
        !            81:        return result;
        !            82: 
        !            83:     switch (reason) {
        !            84:        case PC_NOTSPECIFIED:
        !            85:        default: 
        !            86:            reason = int_PS_Abort__reason_reason__not__specified;
        !            87:            break;
        !            88: 
        !            89:        case PC_UNRECOGNIZED:
        !            90:        case PC_UNEXPECTED:
        !            91:        case PC_SSPRIMITIVE:
        !            92:        case PC_PPPARAM1:
        !            93:        case PC_PPPARAM2:
        !            94:        case PC_INVALID:
        !            95:            reason -= PC_ABORT_BASE;
        !            96:            break;
        !            97:     }
        !            98: 
        !            99:     pdu -> provider__reason = (struct type_PS_Abort__reason *) &reason;
        !           100:     pdu -> event = ppdu != PPDU_NONE
        !           101:                                ? (struct type_PS_Event__identifier *) &ppdu
        !           102:                                : NULL;
        !           103: 
        !           104:     pe = NULLPE;
        !           105:     base = NULL, len = 0;
        !           106:     if (encode_PS_ARP__PPDU (&pe, 1, 0, NULLCP, pdu) == NOTOK) {
        !           107:        PLOGP (psap2_log,PS_ARP__PPDU, pe, "ARP-PPDU", 0);
        !           108: 
        !           109:        (void) pe2ssdu (pe, &base, &len);
        !           110:     }
        !           111:     if (pe)
        !           112:        pe_free (pe);
        !           113: 
        !           114:     if (SUAbortRequest (pb -> pb_fd, base, len, &sis) != NOTOK)
        !           115:        pb -> pb_fd = NOTOK;
        !           116: 
        !           117:     if (base)
        !           118:        free (base);
        !           119: 
        !           120:     return result;
        !           121: }
        !           122: #else
        !           123: /* VARARGS6 */
        !           124: 
        !           125: int    ppktlose (pb, pi, reason, ppdu, what, fmt)
        !           126: register struct psapblk *pb;
        !           127: register struct PSAPindication *pi;
        !           128: int    reason,
        !           129:        ppdu;
        !           130: char   *what,
        !           131:        *fmt;
        !           132: {
        !           133:     return ppktlose (pb, pi, reason, ppdu, what, fmt);
        !           134: }
        !           135: #endif
        !           136: 
        !           137: /*  */
        !           138: 
        !           139: #ifndef        lint
        !           140: int    psaplose (va_alist)
        !           141: va_dcl
        !           142: {
        !           143:     int     reason,
        !           144:            result;
        !           145:     struct PSAPindication *pi;
        !           146:     va_list ap;
        !           147: 
        !           148:     va_start (ap);
        !           149: 
        !           150:     pi = va_arg (ap, struct PSAPindication *);
        !           151:     reason = va_arg (ap, int);
        !           152: 
        !           153:     result = _psaplose (pi, reason, ap);
        !           154: 
        !           155:     va_end (ap);
        !           156: 
        !           157:     return result;
        !           158: }
        !           159: #else
        !           160: /* VARARGS4 */
        !           161: 
        !           162: int    psaplose (pi, reason, what, fmt)
        !           163: struct PSAPindication *pi;
        !           164: int     reason;
        !           165: char   *what,
        !           166:        *fmt;
        !           167: {
        !           168:     return psaplose (pi, reason, what, fmt);
        !           169: }
        !           170: #endif
        !           171: 
        !           172: /*  */
        !           173: 
        !           174: #ifndef        lint
        !           175: static int  _psaplose (pi, reason, ap) /* what, fmt, args ... */
        !           176: register struct PSAPindication *pi;
        !           177: int     reason;
        !           178: va_list        ap;
        !           179: {
        !           180:     register char  *bp;
        !           181:     char    buffer[BUFSIZ];
        !           182:     register struct PSAPabort *pa;
        !           183: 
        !           184:     if (pi) {
        !           185:        bzero ((char *) pi, sizeof *pi);
        !           186:        pi -> pi_type = PI_ABORT;
        !           187:        pa = &pi -> pi_abort;
        !           188: 
        !           189:        asprintf (bp = buffer, ap);
        !           190:        bp += strlen (bp);
        !           191: 
        !           192:        pa -> pa_peer = 0;
        !           193:        pa -> pa_reason = reason;
        !           194:        pa -> pa_ninfo = 0;
        !           195:        copyPSAPdata (buffer, bp - buffer, pa);
        !           196:     }
        !           197: 
        !           198:     return NOTOK;
        !           199: }
        !           200: #endif

unix.superglobalmegacorp.com

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