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 o

⟦9215c93da⟧ TextFile

    Length: 8171 (0x1feb)
    Types: TextFile
    Names: »oper_act.c«

Derivation

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

TextFile

/* oper_act.c - routines to handle operation activity blocks */

#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/oper_act.c,v 7.0 89/11/23 22:17:50 mrose Rel $";
#endif

/*
 * $Header: /f/osi/quipu/RCS/oper_act.c,v 7.0 89/11/23 22:17:50 mrose Rel $
 *
 *
 * $Log:	oper_act.c,v $
 * Revision 7.0  89/11/23  22:17:50  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.
 *
 */


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

extern LLog * log_dsap;

struct oper_act *oper_alloc()
{
    struct oper_act	* on_ret;

    on_ret = (struct oper_act *) calloc(1,sizeof(struct oper_act));

    on_ret->on_arg = &(on_ret->on_req);
    on_ret->on_cha = &(on_ret->on_req.dca_charg);
    on_ret->on_result = &(on_ret->on_resp.resp_res);
    on_ret->on_error = &(on_ret->on_resp.resp_err);

    return(on_ret);
}

oper_free(on)
struct oper_act *on;
{
	DLOG(log_dsap, LLOG_TRACE, ("oper_free()"));
	on->on_state = -1;

	response_free (&(on->on_resp));

	if (on->on_req.dca_charg.cha_trace != (struct trace_info *)NULL)
		op_arg_free (&on->on_req);

	free((char *)on);
}

oper_extract(on)
struct oper_act	* on;
{
	DLOG(log_dsap, LLOG_TRACE, ("oper_extract()"));

    if(on->on_conn != NULLCONN)
	oper_conn_extract(on);

    if(on->on_task != NULLTASK)
	oper_task_extract(on);

    oper_free(on);
}

oper_conn_extract(on)
struct oper_act	* on;
{
    /*
    * Extract the operation activity block from the list held by its
    * connection.
    */
    struct oper_act	* on_tmp;
    struct oper_act	**on_p;

	DLOG(log_dsap, LLOG_TRACE, ("oper_conn_extract()"));

    if(on == NULLOPER)
    {
	LLOG (log_dsap,LLOG_FATAL, ("oper_conn_extract: Cannot extract NULLOPER"));
	return;
	/* This is an implementation error */
    }

    if(on->on_conn == NULLCONN)
    {
	LLOG (log_dsap,LLOG_EXCEPTIONS, ("oper_conn_extract: already extracted"));
	/* This operation must have already been extracted for some reason. */
	return;
    }

    on_p = &(on->on_conn->cn_operlist);
    for(on_tmp=(*on_p); on_tmp!=NULLOPER; on_tmp=on_tmp->on_next_conn)
    {
	if(on_tmp == on)
	    break;

	on_p = &(on_tmp->on_next_conn);
    }
    if(on_tmp == NULLOPER)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("oper_conn_extract: oper not on connections list!"));
    }
    else
    {
	(*on_p) = on_tmp->on_next_conn;
    }

    on->on_conn = NULLCONN; /* Shows that this has been conn_extracted */
}

oper_task_extract(on)
struct oper_act	* on;
{
    /*
    * Extract this operation from the list held by its task.
    */
    struct oper_act	* on_tmp;
    struct oper_act	**on_p;

	DLOG(log_dsap, LLOG_TRACE, ("oper_task_extract()"));

    if(on == NULLOPER)
    {
	LLOG (log_dsap,LLOG_FATAL, ("oper_task_extract: Cannot extract NULLOPER"));
	return;
	/* This is an implementation error */
    }

    if(on->on_task == NULLTASK)
    {
	/* Must have been extracted previously. */
	if (on->on_state != ON_ABANDONED)
		LLOG (log_dsap,LLOG_EXCEPTIONS, ("oper_task_extract: oper has no task"));
	return;
    }

    on_p = &(on->on_task->tk_operlist);
    for(on_tmp=(*on_p); on_tmp!=NULLOPER; on_tmp=on_tmp->on_next_task)
    {
	if(on_tmp == on)
	    break;

	on_p = &(on_tmp->on_next_task);
    }
    if(on_tmp == NULLOPER)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("Oper not on tasks list"));
    }
    else
    {
	(*on_p) = on_tmp->on_next_task;
    }

    if (on->on_dsas != NULL_DI_BLOCK)
	di_desist (on->on_dsas);

    on->on_dsas = NULL_DI_BLOCK;

    on->on_task = NULLTASK; /* Shows that this has been task_extracted */
}

oper_log(on)
struct oper_act	* on;
{
    DLOG (log_dsap,LLOG_DEBUG, ("Oper id = %d, state = %d, type = %d",
	on->on_id, on->on_state, on->on_type));
}

op_arg_free (arg)
struct ds_op_arg * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("op_arg_free()"));

	if (arg->dca_dsarg.arg_type == -1 )
		return;
	else 
		/* indicate as freed */
		arg->dca_dsarg.arg_type = -1;

	/* free chain bits */
	dn_free (arg->dca_charg.cha_originator);
	dn_free (arg->dca_charg.cha_target);
	if (arg->dca_charg.cha_domaininfo != NULLPE)
		pe_free (arg->dca_charg.cha_domaininfo);

	if(arg->dca_charg.cha_trace != NULLTRACEINFO)
		trace_info_free (arg->dca_charg.cha_trace);

	if (arg->dca_charg.cha_timelimit != NULLCP)
		free (arg->dca_charg.cha_timelimit);
	
	/* free argument structure */
	switch (arg->dca_dsarg.arg_type) {
	case OP_READ:
		ca_free (&arg->dca_dsarg.arg_rd.rda_common);
		dn_free (arg->dca_dsarg.arg_rd.rda_object);
		as_free (arg->dca_dsarg.arg_rd.rda_eis.eis_select);
		break;
	case OP_COMPARE:
		ca_free (&arg->dca_dsarg.arg_cm.cma_common);
		dn_free (arg->dca_dsarg.arg_cm.cma_object);
		AttrT_free (arg->dca_dsarg.arg_cm.cma_purported.ava_type);
		AttrV_free (arg->dca_dsarg.arg_cm.cma_purported.ava_value);
		break;
	case OP_ABANDON:
		break;
	case OP_LIST:
		ca_free (&arg->dca_dsarg.arg_ls.lsa_common);
		dn_free (arg->dca_dsarg.arg_ls.lsa_object);
		break;
	case OP_SEARCH:
		ca_free (&arg->dca_dsarg.arg_sr.sra_common);
		dn_free (arg->dca_dsarg.arg_sr.sra_baseobject);
		as_free (arg->dca_dsarg.arg_sr.sra_eis.eis_select);
		filter_free (arg->dca_dsarg.arg_sr.sra_filter);
		break;
	case OP_ADDENTRY:
		ca_free (&arg->dca_dsarg.arg_ad.ada_common);
		dn_free (arg->dca_dsarg.arg_ad.ada_object);
		as_free (arg->dca_dsarg.arg_ad.ada_entry);
		break;
	case OP_REMOVEENTRY:		
		ca_free (&arg->dca_dsarg.arg_rm.rma_common);
		dn_free (arg->dca_dsarg.arg_rm.rma_object);
		break;
	case OP_MODIFYENTRY:
		ca_free (&arg->dca_dsarg.arg_me.mea_common);
		dn_free (arg->dca_dsarg.arg_me.mea_object);
		ems_free (arg->dca_dsarg.arg_me.mea_changes);
		break;
	case OP_MODIFYRDN:
		ca_free (&arg->dca_dsarg.arg_mr.mra_common);
		dn_free (arg->dca_dsarg.arg_mr.mra_object);
		rdn_free (arg->dca_dsarg.arg_mr.mra_newrdn);
		break;
	case OP_GETEDB:
		dn_free (arg->dca_dsarg.arg_ge.ga_entry);
		break;
	default:
		break;
	}

}

trace_info_free (arg)
struct trace_info * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("trace_info_free()"));

	if (arg == NULLTRACEINFO)
		return;
	dn_free (arg->ti_target);
	dn_free (arg->ti_dsa);
	trace_info_free (arg->ti_next);
	free( (char *) arg);

}

ca_free (arg)
CommonArgs * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("ca_free()"));

	dn_free (arg->ca_requestor);
	extension_free (arg->ca_extensions);
}

extension_free (arg)
struct extension * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("extension_free()"));

	for (; arg != NULLEXT; arg=arg->ext_next) {
		if (arg->ext_item != NULLPE)
			pe_free (arg->ext_item);
		free ((char *) arg);
	}
}

response_free (arg)
struct response * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("response_free()"));

	ds_error_free (&arg->resp_err);
	if (arg->ret_type != RET_TYPE_ERR)
		op_res_free (&arg->resp_res);

	crefs_free (arg->resp_ref);
}


op_res_free (arg)
struct ds_op_res * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("op_res_free()"));

	/* free chain bits */
	if (arg->dcr_chres.chr_domaininfo != NULLPE)
		pe_free (arg->dcr_chres.chr_domaininfo);

	cross_refs_free (arg->dcr_chres.chr_crossrefs);

	/* free argument structure */
	switch (arg->dcr_dsres.result_type) {
	case OP_READ:
/*
		dn_free (&arg->dcr_dsres.res_rd.rdr_common.cr_requestor);
*/
		entryinfo_comp_free (&arg->dcr_dsres.res_rd.rdr_entry,1);
		break;
	case OP_COMPARE:
/*
		dn_free (&arg->dcr_dsres.res_cm.cmr_common.cr_requestor);
*/
		dn_free (arg->dcr_dsres.res_cm.cmr_object);
		break;
	case OP_LIST:
/*
		dn_free (&arg->dcr_dsres.res_ls.lsr_common.cr_requestor);
*/
		dn_free (arg->dcr_dsres.res_ls.lsr_object);
		subords_free (arg->dcr_dsres.res_ls.lsr_subordinates);
		crefs_free (arg->dcr_dsres.res_ls.lsr_cr);
		break;
	case OP_SEARCH:
		search_result_free(&(arg->dcr_dsres.res_sr));
		break;
	case OP_GETEDB:
		break;	/* don't free EDB */
	default:
		break;
	}
	
}

cross_refs_free (arg)
struct cross_ref * arg;
{
	DLOG(log_dsap, LLOG_TRACE, ("cross_refs_free()"));

	if (arg == NULLXREF)
		return;
	dn_free (arg->xref_dn);
	aps_free (arg->xref_ap);
	cross_refs_free (arg->xref_next);
	free ((char *)arg);
}