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

⟦a2bff4b9b⟧ TextFile

    Length: 2544 (0x9f0)
    Types: TextFile
    Names: »psap.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/dsap/common/psap.c« 

TextFile

/* psap.c - General PSAP utility routines */

#ifndef lint
static char *rcsid = "$Header: /f/osi/dsap/common/RCS/psap.c,v 7.0 89/11/23 21:44:24 mrose Rel $";
#endif

/*
 * $Header: /f/osi/dsap/common/RCS/psap.c,v 7.0 89/11/23 21:44:24 mrose Rel $
 *
 *
 * $Log:	psap.c,v $
 * Revision 7.0  89/11/23  21:44:24  mrose
 * Release 6.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 "quipu/util.h"
#include "quipu/attr.h"
#include "psap.h"
#include "isoaddrs.h"

extern LLog * log_dsap;

psap_free (psap)
struct PSAPaddr * psap;
{
	free ((char *)psap) ;
}

struct PSAPaddr * psap_cpy (a)
struct PSAPaddr * a;
{
struct PSAPaddr * r;

	r = (struct PSAPaddr *) smalloc (sizeof (struct PSAPaddr));
	bzero ((char *) r,sizeof (struct PSAPaddr));

	*r = *a;        /* struct copy */

	return (r);
}

psap_dup (r,a)
struct PSAPaddr * r, * a;
{
    *r = *a;    /* struct copy */
}

static psap_cmp (r,a)
struct PSAPaddr *r, *a;
{
    return (bcmp ((char *) r, (char *) a, sizeof *a) ? (-1) : 0);
}

static PE psap_enc (p)
struct PSAPaddr *p;
{
PE ret_pe;

	if (encode_DO_ISODEPresentationAddress (&ret_pe,0,0,NULLCP,p) == NOTOK ) {
		ret_pe = NULLPE;
		LLOG (log_dsap,LLOG_EXCEPTIONS, ("Failed to encode PSAP"));
	}
	return (ret_pe);
}

static struct PSAPaddr * psap_dec (pe)
PE pe;
{
struct PSAPaddr * psap;
	
	psap = (struct PSAPaddr *) calloc (1,sizeof (struct PSAPaddr));
	if (decode_DO_ISODEPresentationAddress (pe,1,NULLIP,NULLVP,psap) == NOTOK) {
		free ((char *)psap);
		return (NULLPA);
	}
		
	return (psap);
}

static struct PSAPaddr * psap_parse (s)
char * s;
{
struct PSAPaddr *pa;
struct PSAPaddr *psap;
	
	psap = (struct PSAPaddr *) calloc (1,sizeof (struct PSAPaddr));
	if (pa=str2paddr(s)) {
		*psap = *pa;  /* struct copy */
		return (psap);
	} else {
		parse_error ("invalid presentation address %s",s);
		free ((char *)psap);
		return (NULLPA);
	}
}

static psap_print (ps,p,format)
PS ps;
struct PSAPaddr *p;
int format;
{
	if (format != READOUT)
		ps_printf (ps, "%s", _paddr2str(p,NULLNA,-1));
	else
		ps_printf (ps, "%s", paddr2str(p,NULLNA));

}

psap_syntax ()
{
	(void) add_attribute_syntax ("presentationAddress",
		(IFP) psap_enc,		(IFP) psap_dec,
		(IFP) psap_parse,	psap_print,
		(IFP) psap_cpy,		psap_cmp,
		psap_free,		NULLCP,
		NULLIFP,		TRUE );
}