Annotation of 43BSDReno/contrib/isode-beta/psap/ts2ps.c, revision 1.1

1.1     ! root        1: /* ts2ps.c - TSDU-backed abstraction for PStreams
        !             2:                (really just a refinement of datagram-backed PStreams) */
        !             3: 
        !             4: #ifndef        lint
        !             5: static char *rcsid = "$Header: /f/osi/psap/RCS/ts2ps.c,v 7.0 89/11/23 22:13:55 mrose Rel $";
        !             6: #endif
        !             7: 
        !             8: /* 
        !             9:  * $Header: /f/osi/psap/RCS/ts2ps.c,v 7.0 89/11/23 22:13:55 mrose Rel $
        !            10:  *
        !            11:  *
        !            12:  * $Log:       ts2ps.c,v $
        !            13:  * Revision 7.0  89/11/23  22:13:55  mrose
        !            14:  * Release 6.0
        !            15:  * 
        !            16:  */
        !            17: 
        !            18: /*
        !            19:  *                               NOTICE
        !            20:  *
        !            21:  *    Acquisition, use, and distribution of this module and related
        !            22:  *    materials are subject to the restrictions of a license agreement.
        !            23:  *    Consult the Preface in the User's Manual for the full terms of
        !            24:  *    this agreement.
        !            25:  *
        !            26:  */
        !            27: 
        !            28: 
        !            29: /* LINTLIBRARY */
        !            30: 
        !            31: #include <stdio.h>
        !            32: #include "psap.h"
        !            33: #include "tsap.h"
        !            34: #include "tailor.h"
        !            35: 
        !            36: /*  */
        !            37: 
        !            38: int    ts_read (fd, q)
        !            39: int    fd;
        !            40: struct qbuf **q;
        !            41: {
        !            42:     register struct qbuf *qb;
        !            43:     struct TSAPdata  txs;
        !            44:     register struct TSAPdata *tx = &txs;
        !            45:     struct TSAPdisconnect  tds;
        !            46:     register struct TSAPdisconnect *td = &tds;
        !            47: 
        !            48:     if (TReadRequest (fd, tx, NOTOK, td) == NOTOK) {
        !            49:        if (td -> td_reason == DR_NORMAL) {
        !            50:            *q = NULL;
        !            51:            return OK;
        !            52:        }
        !            53: 
        !            54:        SLOG (psap_log, LLOG_EXCEPTIONS, NULLCP,
        !            55:              (td -> td_cc > 0 ? "ts_read: [%s] %*.*s" : "ts_read: [%s]",
        !            56:               TErrString (td -> td_reason), td -> td_cc, td -> td_cc,
        !            57:                td -> td_data));
        !            58: 
        !            59:        return NOTOK;
        !            60:     }
        !            61: 
        !            62:     qb = &tx -> tx_qbuf;
        !            63:     if (qb -> qb_forw -> qb_forw != qb && qb_pullup (qb) == NOTOK) {
        !            64:        SLOG (psap_log, LLOG_EXCEPTIONS, NULLCP,
        !            65:              ("ts_read: qb_pullup fails"));
        !            66:        TXFREE (tx);
        !            67: 
        !            68:        return NOTOK;
        !            69:     }
        !            70: 
        !            71:     remque (qb = tx -> tx_qbuf.qb_forw);
        !            72:     qb -> qb_forw = qb -> qb_back = qb;
        !            73: 
        !            74:     *q = qb;
        !            75: 
        !            76:     TXFREE (tx);
        !            77: 
        !            78:     return qb -> qb_len;
        !            79: }
        !            80: 
        !            81: 
        !            82: int    ts_write (fd, qb)
        !            83: int    fd;
        !            84: register struct qbuf *qb;
        !            85: {
        !            86:     struct TSAPdisconnect  tds;
        !            87:     register struct TSAPdisconnect *td = &tds;
        !            88:     
        !            89:     if (TDataRequest (fd, qb -> qb_data, qb -> qb_len, td) == NOTOK) {
        !            90:        SLOG (psap_log, LLOG_EXCEPTIONS, NULLCP,
        !            91:              (td -> td_cc > 0 ? "ts_write: [%s] %*.*s" : "ts_write: [%s]",
        !            92:               TErrString (td -> td_reason), td -> td_cc, td -> td_cc,
        !            93:                td -> td_data));
        !            94: 
        !            95:        return NOTOK;
        !            96:     }
        !            97: 
        !            98:     return qb -> qb_len;
        !            99: }

unix.superglobalmegacorp.com

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