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 p

⟦386e2aa73⟧ TextFile

    Length: 3839 (0xeff)
    Types: TextFile
    Names: »psaplose.c«

Derivation

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

TextFile

/* psaplose.c - PPM: you lose */

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

/* 
 * $Header: /f/osi/psap2/RCS/psaplose.c,v 6.0 89/03/18 23:39:52 mrose Rel $
 *
 *
 * $Log:	psaplose.c,v $
 * Revision 6.0  89/03/18  23:39:52  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 <varargs.h>
#include "PS-types.h"
#include "ppkt.h"
#include "tailor.h"

/* \f

 */

#ifndef	lint
int	ppktlose (va_alist)
va_dcl
{
    int	    len,
	    ppdu,
    	    reason,
	    result,
    	    value;
    char   *base;
    register struct psapblk *pb;
    PE	    pe;
    register struct PSAPindication *pi;
    register struct PSAPabort *pa;
    struct SSAPindication   sis;
    struct type_PS_ARP__PPDU pdus;
    register struct type_PS_ARP__PPDU *pdu = &pdus;
    va_list ap;

    va_start (ap);

    pb = va_arg (ap, struct psapblk *);
    pi = va_arg (ap, struct PSAPindication *);
    reason = va_arg (ap, int);
    ppdu = va_arg (ap, int);

    result = _psaplose (pi, reason, ap);

    va_end (ap);

    if ((pa = &pi -> pi_abort) -> pa_cc > 0) {
	SLOG (psap2_log, LLOG_EXCEPTIONS, NULLCP,
	      ("ppktlose [%s] %*.*s", PErrString (pa -> pa_reason),
	       pa -> pa_cc, pa -> pa_cc, pa -> pa_data));
    }
    else
	SLOG (psap2_log, LLOG_EXCEPTIONS, NULLCP,
	      ("ppktlose [%s]", PErrString (pa -> pa_reason)));

    if (pb -> pb_fd == NOTOK)
	return result;

    switch (reason) {
	case PC_NOTSPECIFIED:
	default: 
	    reason = int_PS_Abort__reason_reason__not__specified;
	    break;

	case PC_UNRECOGNIZED:
	case PC_UNEXPECTED:
	case PC_SSPRIMITIVE:
	case PC_PPPARAM1:
	case PC_PPPARAM2:
	case PC_INVALID:
	    reason -= PC_ABORT_BASE;
	    break;
    }

    pdu -> provider__reason = (struct type_PS_Abort__reason *) &reason;
    pdu -> event = ppdu != PPDU_NONE
				? (struct type_PS_Event__identifier *) &ppdu
				: NULL;

    pe = NULLPE;
    base = NULL, len = 0;
    if (encode_PS_ARP__PPDU (&pe, 1, 0, NULLCP, pdu) == NOTOK) {
	PLOG (psap2_log, print_PS_ARP__PPDU, pe, "ARP-PPDU", 0);

	(void) pe2ssdu (pe, &base, &len);
    }
    if (pe)
	pe_free (pe);

    if (SUAbortRequest (pb -> pb_fd, base, len, &sis) != NOTOK)
	pb -> pb_fd = NOTOK;

    if (base)
	free (base);

    return result;
}
#else
/* VARARGS6 */

int	ppktlose (pb, pi, reason, ppdu, what, fmt)
register struct psapblk *pb;
register struct PSAPindication *pi;
int	reason,
	ppdu;
char   *what,
       *fmt;
{
    return ppktlose (pb, pi, reason, ppdu, what, fmt);
}
#endif

/* \f

 */

#ifndef	lint
int	psaplose (va_alist)
va_dcl
{
    int     reason,
    	    result;
    struct PSAPindication *pi;
    va_list ap;

    va_start (ap);

    pi = va_arg (ap, struct PSAPindication *);
    reason = va_arg (ap, int);

    result = _psaplose (pi, reason, ap);

    va_end (ap);

    return result;
}
#else
/* VARARGS4 */

int	psaplose (pi, reason, what, fmt)
struct PSAPindication *pi;
int     reason;
char   *what,
       *fmt;
{
    return psaplose (pi, reason, what, fmt);
}
#endif

/* \f

 */

#ifndef	lint
static int  _psaplose (pi, reason, ap)	/* what, fmt, args ... */
register struct PSAPindication *pi;
int     reason;
va_list	ap;
{
    register char  *bp;
    char    buffer[BUFSIZ];
    register struct PSAPabort *pa;

    if (pi) {
	bzero ((char *) pi, sizeof *pi);
	pi -> pi_type = PI_ABORT;
	pa = &pi -> pi_abort;

	asprintf (bp = buffer, ap);
	bp += strlen (bp);

	pa -> pa_peer = 0;
	pa -> pa_reason = reason;
	pa -> pa_ninfo = 0;
	copyPSAPdata (buffer, bp - buffer, pa);
    }

    return NOTOK;
}
#endif