Annotation of 43BSDReno/contrib/isode-beta/ssap/ssapresync2.c, revision 1.1.1.1

1.1       root        1: /* ssapresync2.c - SPM: respond to resyncs */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/ssap/RCS/ssapresync2.c,v 7.0 89/11/23 22:25:42 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/ssap/RCS/ssapresync2.c,v 7.0 89/11/23 22:25:42 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       ssapresync2.c,v $
                     12:  * Revision 7.0  89/11/23  22:25:42  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-RESYNCHRONIZE.RESPONSE */
                     35: 
                     36: int    SReSyncResponse (sd, ssn, settings, data, cc, si)
                     37: int    sd;
                     38: int    settings;
                     39: long   ssn;
                     40: char   *data;
                     41: int    cc;
                     42: struct SSAPindication *si;
                     43: {
                     44:     SBV            smask;
                     45:     int     result;
                     46:     register struct ssapblk *sb;
                     47: 
                     48:     missingP (si);
                     49: 
                     50:     smask = sigioblock ();
                     51: 
                     52:     ssapRsig (sb, sd);
                     53:     toomuchP (sb, data, cc, SN_SIZE, "resync");
                     54: 
                     55:     result = SReSyncResponseAux (sb, ssn, settings, data, cc, si);
                     56: 
                     57:     (void) sigiomask (smask);
                     58: 
                     59:     return result;
                     60: }
                     61: 
                     62: /*  */
                     63: 
                     64: static int SReSyncResponseAux (sb, ssn, settings, data, cc, si)
                     65: register struct ssapblk *sb;
                     66: long   ssn;
                     67: int    settings;
                     68: char   *data;
                     69: int    cc;
                     70: register struct SSAPindication *si;
                     71: {
                     72:     int            result;
                     73: 
                     74:     if (!(sb -> sb_requirements & SR_RESYNC))
                     75:        return ssaplose (si, SC_OPERATION, NULLCP,
                     76:                "resynchronize service unavailable");
                     77:     if (!(sb -> sb_flags & SB_RA))
                     78:        return ssaplose (si, SC_OPERATION, NULLCP,
                     79:                "no resync in progress");
                     80: 
                     81:     switch (sb -> sb_rs) {
                     82:        case SYNC_RESTART:
                     83:            ssn = sb -> sb_rsn;
                     84:            break;
                     85: 
                     86:        case SYNC_ABANDON:
                     87:            ssn = sb -> sb_V_A;
                     88:            break;
                     89: 
                     90:        case SYNC_SET:
                     91:            break;
                     92:     }
                     93: 
                     94: #define        dotoken(requires,shift,bit,type) \
                     95: { \
                     96:     if (sb -> sb_requirements & requires) \
                     97:        switch (sb -> sb_rsettings & (ST_MASK << shift)) { \
                     98:            dotoken1 (requires,shift,bit,type); \
                     99:  \
                    100:            dotoken2 (requires,shift,bit,type); \
                    101:        } \
                    102: }
                    103: #define        dotoken1(requires,shift,bit,type) \
                    104:            case ST_CALL_VALUE << shift: \
                    105:                switch (settings & (ST_MASK << shift)) { \
                    106:                    case ST_INIT_VALUE << shift: \
                    107:                        settings &= ~(ST_MASK << shift); \
                    108:                        settings |= ST_INIT_VALUE << shift; \
                    109:                        break; \
                    110:  \
                    111:                    case ST_RESP_VALUE << shift: \
                    112:                        settings &= ~(ST_MASK << shift); \
                    113:                        settings |= ST_RESP_VALUE << shift; \
                    114:                        break; \
                    115:  \
                    116:                    default: \
                    117:                        return ssaplose (si, SC_PARAMETER, NULLCP, \
                    118:                                "improper choice of %s token setting", type); \
                    119:                } \
                    120:                break;
                    121: #define        dotoken2(requires,shift,bit,type) \
                    122:            default: \
                    123:                if ((sb -> sb_rsettings & (ST_MASK << shift)) \
                    124:                        != (settings & (ST_MASK << shift))) \
                    125:                    return ssaplose (si, SC_OPERATION, NULLCP, \
                    126:                            "setting of %s token is not your choice"); \
                    127:                break;
                    128:     dotokens ();
                    129: #undef dotoken
                    130: #undef dotoken1
                    131: #undef dotoken2
                    132: 
                    133:     if ((result = SWriteRequestAux (sb, SPDU_RA, data, cc, 0, ssn,
                    134:                settings, NULLSD, NULLSD, NULLSR, si)) == NOTOK)
                    135:        freesblk (sb);
                    136:     else {
                    137:        sb -> sb_flags &= ~SB_RA;
                    138:        sb -> sb_V_A = sb -> sb_V_M = ssn;
                    139:        if (sb -> sb_rs != SYNC_RESTART)
                    140:            sb -> sb_V_R = 0;
                    141: 
                    142: #define        dotoken(requires,shift,bit,type) \
                    143: { \
                    144:        if (sb -> sb_requirements & requires) \
                    145:            switch (settings & (ST_MASK << shift)) { \
                    146:                case ST_INIT_VALUE << shift: \
                    147:                    if (sb -> sb_flags & SB_INIT) \
                    148:                        sb -> sb_owned |= bit; \
                    149:                    else \
                    150:                        sb -> sb_owned &= ~bit; \
                    151:                    break; \
                    152:  \
                    153:                case ST_RESP_VALUE << shift: \
                    154:                    if (!(sb -> sb_flags & SB_INIT)) \
                    155:                        sb -> sb_owned |= bit; \
                    156:                    else \
                    157:                        sb -> sb_owned &= ~bit; \
                    158:                    break; \
                    159:            } \
                    160: } 
                    161:        dotokens ();
                    162: #undef dotoken
                    163:     }
                    164:     
                    165:     return result;
                    166: }

unix.superglobalmegacorp.com

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