Annotation of 43BSDReno/contrib/isode-beta/rosap/rosaplose.c, revision 1.1.1.1

1.1       root        1: /* rosaplose.c - ROPM: you lose */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/rosap/RCS/rosaplose.c,v 6.0 89/03/18 23:42:27 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/rosap/RCS/rosaplose.c,v 6.0 89/03/18 23:42:27 mrose Rel $
                      9:  *
                     10:  * Based on an TCP-based implementation by George Michaelson of University
                     11:  * College London.
                     12:  *
                     13:  *
                     14:  * $Log:       rosaplose.c,v $
                     15:  * Revision 6.0  89/03/18  23:42:27  mrose
                     16:  * Release 5.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 "ropkt.h"
                     36: #include "tailor.h"
                     37: 
                     38: /*  */
                     39: 
                     40: #ifndef        lint
                     41: int    ropktlose (va_alist)
                     42: va_dcl
                     43: {
                     44:     int            reason,
                     45:            result,
                     46:            value;
                     47:     register struct assocblk *acb;
                     48:     register struct RoSAPindication *roi;
                     49:     register struct RoSAPpreject *rop;
                     50:     va_list ap;
                     51: 
                     52:     va_start (ap);
                     53: 
                     54:     acb = va_arg (ap, struct assocblk *);
                     55:     roi = va_arg (ap, struct RoSAPindication *);
                     56:     reason = va_arg (ap, int);
                     57: 
                     58:     result = _rosaplose (roi, reason, ap);
                     59: 
                     60:     va_end (ap);
                     61: 
                     62:     if ((rop = &roi -> roi_preject) -> rop_cc > 0) {
                     63:        SLOG (rosap_log, LLOG_EXCEPTIONS, NULLCP,
                     64:              ("ropktlose [%s] %*.*s", RoErrString (rop -> rop_reason),
                     65:               rop -> rop_cc, rop -> rop_cc, rop -> rop_data));
                     66:     }
                     67:     else
                     68:        SLOG (rosap_log, LLOG_EXCEPTIONS, NULLCP,
                     69:              ("ropktlose [%s]", RoErrString (rop -> rop_reason)));
                     70: 
                     71:     if (acb == NULLACB
                     72:            || acb -> acb_fd == NOTOK
                     73:            || acb -> acb_ropktlose == NULLIFP)
                     74:        return result;
                     75: 
                     76:     switch (reason) {
                     77:        case ROS_PROTOCOL: 
                     78:            value = ABORT_PROTO;
                     79:            break;
                     80: 
                     81:        case ROS_CONGEST: 
                     82:            value = ABORT_TMP;
                     83:            break;
                     84: 
                     85:        default: 
                     86:            value = ABORT_LSP;
                     87:            break;
                     88:     }
                     89: 
                     90:     (*acb -> acb_ropktlose) (acb, value);
                     91: 
                     92:     return result;
                     93: }
                     94: #else
                     95: /* VARARGS5 */
                     96: 
                     97: int    ropktlose (acb, roi, reason, what, fmt)
                     98: struct assocblk *acb;
                     99: struct RoSAPindication *roi;
                    100: int     reason;
                    101: char   *what,
                    102:        *fmt;
                    103: {
                    104:     return ropktlose (acb, roi, reason, what, fmt);
                    105: }
                    106: #endif
                    107: 
                    108: /*  */
                    109: 
                    110: #ifndef        lint
                    111: int    rosapreject (va_alist)
                    112: va_dcl
                    113: {
                    114:     int            reason,
                    115:            result;
                    116:     register struct assocblk *acb;
                    117:     struct RoSAPindication  rois;
                    118:     register struct RoSAPindication *roi;
                    119:     va_list ap;
                    120: 
                    121:     va_start (ap);
                    122: 
                    123:     acb = va_arg (ap, struct assocblk *);
                    124:     roi = va_arg (ap, struct RoSAPindication *);
                    125:     reason = va_arg (ap, int);
                    126:     
                    127:     result = _rosaplose (roi, reason, ap);
                    128: 
                    129:     va_end (ap);
                    130: 
                    131:     if (RoURejectRequestAux (acb, NULLIP, reason - REJECT_GENERAL_BASE,
                    132:                REJECT_GENERAL, 0, &rois) == NOTOK
                    133:            && ROS_FATAL (rois.roi_preject.rop_reason)) {
                    134:        *roi = rois;            /* struct copy */
                    135:        result = NOTOK;
                    136:     }
                    137: 
                    138:     return result;
                    139: }
                    140: #else
                    141: /* VARARGS5 */
                    142: 
                    143: int    rosapreject (acb, roi, reason, what, fmt)
                    144: struct assocblk *acb;
                    145: struct RoSAPindication *roi;
                    146: int     reason;
                    147: char   *what,
                    148:        *fmt;
                    149: {
                    150:     return rosapreject (acb, roi, reason, what, fmt);
                    151: }
                    152: #endif
                    153: 
                    154: /*  */
                    155: 
                    156: #ifndef        lint
                    157: int    rosaplose (va_alist)
                    158: va_dcl
                    159: {
                    160:     int            reason,
                    161:            result;
                    162:     struct RoSAPindication *roi;
                    163:     va_list (ap);
                    164: 
                    165:     va_start (ap);
                    166: 
                    167:     roi = va_arg (ap, struct RoSAPindication *);
                    168:     reason = va_arg (ap, int);
                    169: 
                    170:     result = _rosaplose (roi, reason, ap);
                    171: 
                    172:     va_end (ap);
                    173: 
                    174:     return result;
                    175: }
                    176: #else
                    177: /* VARARGS4 */
                    178: 
                    179: int    rosaplose (roi, reason, what, fmt)
                    180: struct RoSAPindication *roi;
                    181: int    reason;
                    182: char   *what,
                    183:        *fmt;
                    184: {
                    185:     return rosaplose (roi, reason, what, fmt);
                    186: }
                    187: #endif
                    188: 
                    189: /*  */
                    190: 
                    191: #ifndef        lint
                    192: static int  _rosaplose (roi, reason, ap)  /* what, fmt, args ... */
                    193: register struct RoSAPindication *roi;
                    194: int     reason;
                    195: va_list        ap;
                    196: {
                    197:     register char  *bp;
                    198:     char    buffer[BUFSIZ];
                    199:     register struct RoSAPpreject *rop;
                    200: 
                    201:     if (roi) {
                    202:        bzero ((char *) roi, sizeof *roi);
                    203:        roi -> roi_type = ROI_PREJECT;
                    204:        rop = &roi -> roi_preject;
                    205: 
                    206:        asprintf (bp = buffer, ap);
                    207:        bp += strlen (bp);
                    208: 
                    209:        rop -> rop_reason = reason;
                    210:        copyRoSAPdata (buffer, bp - buffer, rop);
                    211:     }
                    212: 
                    213:     return NOTOK;
                    214: }
                    215: #endif

unix.superglobalmegacorp.com

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