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 r

⟦849646746⟧ TextFile

    Length: 4295 (0x10c7)
    Types: TextFile
    Names: »referral.c«

Derivation

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

TextFile

/* referral.c - create referral notices */

#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/referral.c,v 6.0 89/03/18 23:41:51 mrose Rel $";
#endif

/*
 * $Header: /f/osi/quipu/RCS/referral.c,v 6.0 89/03/18 23:41:51 mrose Rel $
 *
 *
 * $Log:	referral.c,v $
 * Revision 6.0  89/03/18  23:41:51  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.
 *
 */


#include "quipu/util.h"
#include "quipu/entry.h"

extern LLog * log_dsap;
char remote_lookup = TRUE;

static struct access_point * top_ap = NULLACCESSPOINT;

static struct access_point * ap_new (name,psap)
DN name;
struct PSAPaddr * psap;
{
static struct access_point * ap;

	ap = (struct access_point *) smalloc (sizeof(struct access_point));
	ap->ap_name = dn_cpy (name);
	psap_dup(&ap->ap_address,psap);
	ap->ap_next = NULLACCESSPOINT;
	return (ap);
}

static ContinuationRef new_ref (name,rt,ap)
DN name;
int rt;
struct access_point * ap;
{
ContinuationRef ptr;
struct access_point * aptr;
struct access_point * trail;

	if (ap == NULLACCESSPOINT)
		return (NULLCONTINUATIONREF);

	ptr = (ContinuationRef) smalloc (sizeof(continuation_ref));
	ptr->cr_aliasedRDNs = CR_NOALIASEDRDNS;
	ptr->cr_name = dn_cpy (name);
	ptr->cr_rdn_resolved = CR_RDNRESOLVED_NOTDEFINED;
	ptr->cr_reftype = rt;
	ptr->cr_accesspoints.ap_name = dn_cpy (ap->ap_name);
	psap_dup (&ptr->cr_accesspoints.ap_address, &ap->ap_address);
	ptr->cr_accesspoints.ap_next = NULLACCESSPOINT;
	ptr->cr_next = NULLCONTINUATIONREF;

	trail = &ptr->cr_accesspoints;
	for (aptr=ap->ap_next; aptr!=NULLACCESSPOINT; aptr=aptr->ap_next) {
		trail->ap_next = ap_new(aptr->ap_name,&aptr->ap_address);
		trail = trail->ap_next;
	}

	return (ptr);
}

static struct access_point * ap_append (a,b)
struct access_point * a;
struct access_point * b;
{
struct access_point * trail;
struct access_point * top;

	if (a == NULLACCESSPOINT)
		return (b);
	if ( b == NULLACCESSPOINT)
		return (a);

	for (top = a ; a != NULLACCESSPOINT; a = a->ap_next)
		trail = a;

	trail->ap_next = b;
	return (top);
}

ContinuationRef cont_ref_new (name,entry_ptr)
DN name;
Entry entry_ptr;
{
ContinuationRef top;
AV_Sequence avs;
struct PSAPaddr * psap , *get_dsa_psap();
struct access_point * ap = NULLACCESSPOINT;
struct access_point * aptr;


	LLOG (log_dsap,LLOG_TRACE,("in cont_ref_new"));
	dn_decode (name);

	for (avs = entry_ptr->e_master; avs != NULLAV; avs=avs->avseq_next) {
		if (avs->avseq_av == NULLAttrV)
			continue;
		if ((psap = get_dsa_psap (avs->avseq_av->av_un.av_dn)) == NULLPA)
			continue;

		dn_decode (avs->avseq_av->av_un.av_dn);
		aptr = ap_new (avs->avseq_av->av_un.av_dn,psap);
		ap = ap_append (ap,aptr);
		remote_lookup = FALSE;
	}

	/* repeat for slaves */
	for (avs = entry_ptr->e_slave; avs != NULLAV; avs=avs->avseq_next) {
		if (avs->avseq_av == NULLAttrV)
			continue;
		if ((psap = get_dsa_psap (avs->avseq_av->av_un.av_dn)) == NULLPA)
			continue;
		dn_decode (avs->avseq_av->av_un.av_dn);
		aptr = ap_new (avs->avseq_av->av_un.av_dn,psap);
		ap = ap_append (ap,aptr);
		remote_lookup = FALSE;
	}


	top = new_ref(name,RT_NONSPECIFICSUBORDINATE,ap);
	aps_free (ap);

	remote_lookup = TRUE;

	return (top);
}



ContinuationRef cont_ref_parent (name)
DN name;
{
	dn_decode (name);
	return (new_ref(name,RT_SUPERIOR,top_ap));
}

add_str_parent (sdn,spsap)
char * sdn, *spsap;
{
DN dn,str2dn();
struct PSAPaddr *psap, * str2paddr();
struct access_point * next_ap;

/* add string DN and string PSAP to list of parents */

	if ((psap = str2paddr (spsap)) == NULLPA) {
		LLOG (log_dsap,LLOG_EXCEPTIONS,("Invalid parent address %s",spsap));
		return;
	}
	if (( dn = str2dn (sdn)) == NULLDN ) {
		LLOG (log_dsap,LLOG_EXCEPTIONS,("Invalid parent dn %s",sdn));
		return;
	}

	next_ap = (struct access_point *) smalloc (sizeof(struct access_point));
	next_ap->ap_name = dn;
	psap_dup(&next_ap->ap_address,psap);
	next_ap->ap_next = NULLACCESSPOINT;
	top_ap = ap_append (top_ap,next_ap);

}

struct PSAPaddr *parent_psap()
{
	if (top_ap == NULLACCESSPOINT)
		return (NULLPA);
	return (&top_ap->ap_address);
}