Annotation of 43BSDReno/contrib/isode-beta/tsap/tsaprespond.c, revision 1.1

1.1     ! root        1: /* tsaprespond.c - TPM: responder */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/tsap/RCS/tsaprespond.c,v 7.1 90/03/23 17:31:49 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/tsap/RCS/tsaprespond.c,v 7.1 90/03/23 17:31:49 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       tsaprespond.c,v $
        !            12:  * Revision 7.1  90/03/23  17:31:49  mrose
        !            13:  * 8
        !            14:  * 
        !            15:  * Revision 7.0  89/11/23  22:30:55  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 "tpkt.h"
        !            35: #include "tailor.h"
        !            36: 
        !            37: /*    T-CONNECT.INDICATION */
        !            38: 
        !            39: int     TInit (vecp, vec, ts, td)
        !            40: register int     vecp;
        !            41: register char  **vec;
        !            42: register struct TSAPstart *ts;
        !            43: register struct TSAPdisconnect *td;
        !            44: {
        !            45:     register struct tsapblk *tb;
        !            46: 
        !            47:     isodetailor (NULLCP, 0);
        !            48: 
        !            49:     if (vecp < 3)
        !            50:        return tsaplose (td, DR_PARAMETER, NULLCP,
        !            51:                    "bad initialization vector");
        !            52:     missingP (vec);
        !            53:     missingP (ts);
        !            54:     missingP (td);
        !            55: 
        !            56:     if ((tb = newtblk ()) == NULL)
        !            57:        return tsaplose (td, DR_CONGEST, NULLCP, "out of memory");
        !            58: 
        !            59:     vec += vecp - 2;
        !            60:     switch (*vec[0]) {
        !            61:        case NT_TCP:
        !            62: #ifdef TCP
        !            63:            if (tcprestore (tb, vec[0] + 1, td) == NOTOK)
        !            64:                goto out;
        !            65:            break;
        !            66: #else
        !            67:            goto not_supported;
        !            68: #endif
        !            69: 
        !            70:        case NT_X25:
        !            71: #ifdef X25
        !            72:            if (x25restore (tb, vec[0] + 1, td) == NOTOK)
        !            73:                goto out;
        !            74:            break;
        !            75: #else
        !            76:            goto not_supported;
        !            77: #endif
        !            78: 
        !            79:        case NT_BRG:
        !            80: #ifdef BRIDGE_X25
        !            81:            if (bridgerestore (tb, vec[0] + 1, td) == NOTOK)
        !            82:                goto out;
        !            83:            break;
        !            84: #else
        !            85:            goto not_supported;
        !            86: #endif
        !            87: 
        !            88:        case NT_BSD:
        !            89: #ifdef BSD_TP4
        !            90:            if (tp4restore (tb, vec[0] + 1, td) == NOTOK)
        !            91:                goto out;
        !            92:            break;
        !            93: #else
        !            94:            goto not_supported;
        !            95: #endif
        !            96: 
        !            97:        case NT_SUN:
        !            98: #ifdef SUN_TP4
        !            99:            if (tp4restore (tb, vec[0] + 1, td) == NOTOK)
        !           100:                goto out;
        !           101:            break;
        !           102: #else
        !           103:            goto not_supported;
        !           104: #endif
        !           105: 
        !           106:        default:
        !           107:            (void) tsaplose (td, DR_PARAMETER, NULLCP,
        !           108:                        "unknown network type: 0x%x (%c)", *vec[0], *vec[0]);
        !           109:            goto out;
        !           110:     }
        !           111:     bzero (vec[0], strlen (vec[0]));
        !           112: 
        !           113:     if ((*tb -> tb_startPfnx) (tb, vec[1], ts, td) == NOTOK)
        !           114:        goto out;
        !           115:     bzero (vec[1], strlen (vec[1]));
        !           116: 
        !           117:     *vec = NULL;
        !           118: 
        !           119:     return OK;
        !           120: 
        !           121: not_supported: ;
        !           122:     (void) tsaplose (td, DR_PARAMETER, NULLCP,
        !           123:                "not configured for network type: 0x%x (%c)",
        !           124:                *vec[0], *vec[0]);
        !           125: 
        !           126: out: ;
        !           127:     freetblk (tb);
        !           128: 
        !           129:     return NOTOK;
        !           130: }
        !           131: 
        !           132: /*    T-CONNECT.RESPONSE */
        !           133: 
        !           134: int     TConnResponse (sd, responding, expedited, data, cc, qos, td)
        !           135: int    sd;
        !           136: register struct TSAPaddr *responding;
        !           137: int    expedited,
        !           138:        cc;
        !           139: char   *data;
        !           140: struct QOStype *qos;
        !           141: register struct TSAPdisconnect *td;
        !           142: {
        !           143:     int            result;
        !           144:     register struct tsapblk *tb;
        !           145:     struct tsapADDR tas;
        !           146: 
        !           147:     if ((tb = findtblk (sd)) == NULL || (tb -> tb_flags & TB_CONN)) 
        !           148:        return tsaplose (td, DR_PARAMETER, NULLCP, "invalid transport descriptor");
        !           149: #ifdef notdef
        !           150:     missingP (responding);
        !           151: #endif
        !           152:     if (responding) {
        !           153:        copyTSAPaddrY (responding, &tas);
        !           154:        if (bcmp ((char *) &tb -> tb_responding, (char *) &tas, sizeof tas))
        !           155:            tb -> tb_responding = tas;  /* struct copy */
        !           156:        else
        !           157:            responding = NULLTA;
        !           158:     }
        !           159:     if (expedited && !(tb -> tb_flags & TB_EXPD))
        !           160:        return tsaplose (td, DR_PARAMETER, NULLCP,
        !           161:                "expedited service not available");
        !           162:     toomuchP (data, cc, TC_SIZE, "initial");
        !           163: #ifdef notdef
        !           164:     missingP (qos);
        !           165: #endif
        !           166:     missingP (td);
        !           167: 
        !           168:     if (!expedited)
        !           169:        tb -> tb_flags &= ~TB_EXPD;
        !           170: 
        !           171:     if ((result = (*tb -> tb_acceptPfnx) (tb, responding ? 1 : 0, data, cc,
        !           172:                            qos, td)) == NOTOK)
        !           173:        freetblk (tb);
        !           174: #ifdef X25
        !           175:     else
        !           176:        if (tb -> tb_flags & TB_X25)
        !           177:            LLOG (x25_log, LLOG_NOTICE,
        !           178:                  ("connection %d from %s",
        !           179:                   sd, na2str (&tb -> tb_initiating.ta_addr)));
        !           180: #endif
        !           181: 
        !           182:     return result;
        !           183: }

unix.superglobalmegacorp.com

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