DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T t

⟦6f1ed34e2⟧ TextFile

    Length: 3204 (0xc84)
    Types: TextFile
    Names: »tsapstate.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/tsap/tsapstate.c« 

TextFile

/* tsapstate.c - TPM: hack state */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/tsap/RCS/tsapstate.c,v 6.0 89/03/18 23:45:39 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/tsap/RCS/tsapstate.c,v 6.0 89/03/18 23:45:39 mrose Rel $
 *
 *
 * $Log:	tsapstate.c,v $
 * Revision 6.0  89/03/18  23:45:39  mrose
 * Release 5.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


/* LINTLIBRARY */

#include <stdio.h>
#include <signal.h>
#include "tpkt.h"

/* \f

 */

int	TSaveState (sd, vec, td)
int	sd;
char  **vec;
register struct TSAPdisconnect *td;
{
    SBV     smask;
    register struct tsapblk *tb;
    static char buffer[sizeof *tb * 2 + 1];

    missingP (vec);

    smask = sigioblock ();

    tsapPsig (tb, sd);

    if (tb -> tb_len > 0) {
	(void) sigiomask (smask);

	return tsaplose (td, DR_WAITING, NULLCP, NULLCP);
    }

    buffer[explode (buffer, (u_char *) tb, sizeof *tb)] = NULL;
    *vec++ = buffer;
    *vec = NULL;

    tb -> tb_fd = NOTOK;

    freetblk (tb);

    (void) sigiomask (smask);

    return OK;
}

/* \f

 */

int	TRestoreState (buffer, ts, td)
char   *buffer;
register struct TSAPstart *ts;
register struct TSAPdisconnect *td;
{
    struct tsapblk  tbs;
    register struct tsapblk *tb;

    missingP (buffer);
    missingP (ts);

    if ((tb = newtblk ()) == NULL)
	return tsaplose (td, DR_CONGEST, NULLCP, "out of memory");

    if (implode ((u_char *) &tbs, buffer, strlen (buffer)) != sizeof tbs) {
	(void) tsaplose (td, DR_PARAMETER, NULLCP, "bad state vector");
	goto out1;
    }

    if (findtblk (tbs.tb_fd)) {
	(void) tsaplose (td, DR_PARAMETER, NULLCP, "transport descriptor active");
	goto out1;
    }
    tb -> tb_fd = tbs.tb_fd;
    tb -> tb_flags = tbs.tb_flags & (TB_CONN | TB_EXPD | TB_TP0 | TB_TP4);
    tb -> tb_srcref = tbs.tb_srcref;
    tb -> tb_dstref = tbs.tb_dstref;
    tb -> tb_tsdusize = tbs.tb_tsdusize;
    tb -> tb_initiating = tbs.tb_initiating;	/* struct copy */
    tb -> tb_responding = tbs.tb_responding;	/* struct copy */

    switch (tb -> tb_flags & (TB_TP0 | TB_TP4)) {
#ifdef	TCP
	case TB_TCP: 
	    (void) TTService (tb);
	    break;
#endif

#ifdef	X25
	case TB_X25: 
	    (void) XTService (tb);
	    break;
#endif

#ifdef	BRIDGE_X25
	case TB_BRG:
	    (void) BTService (tb);
	    break;
#endif

#ifdef        CONS
        case TB_CONS:
            (void) nTService (tb);
            break;
#endif

#ifdef	TP4
	case TB_TP4: 
	    (void) tp4init (tb);
	    break;
#endif

	default: 
	    (void) tsaplose (td, DR_PARAMETER, NULLCP, "network type not set");
	    tb -> tb_fd = NOTOK;
	    goto out1;
    }

    bzero ((char *) ts, sizeof *ts);
    ts -> ts_sd = tb -> tb_fd;
    ts -> ts_calling = tb -> tb_initiating;	/* struct copy */
    ts -> ts_called = tb -> tb_responding;	/* struct copy */
    if (tb -> tb_flags & TB_EXPD)
	ts -> ts_expedited = 1;
    ts -> ts_tsdusize = tb -> tb_tsdusize;
    ts -> ts_qos = tb -> tb_qos;	/* struct copy */

    return OK;

out1: ;
    freetblk (tb);

    return NOTOK;
}