386BSD 0.1 development
[unix-history] / usr / othersrc / contrib / isode / dsap / common / ca.c
CommitLineData
04c6839a
WJ
1/* ca.c - General Directory Name routines */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/dsap/common/RCS/ca.c,v 7.3 91/02/22 09:18:43 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/dsap/common/RCS/ca.c,v 7.3 91/02/22 09:18:43 mrose Interim $
9 *
10 *
11 * $Log: ca.c,v $
12 * Revision 7.3 91/02/22 09:18:43 mrose
13 * Interim 6.8
14 *
15 * Revision 7.2 90/10/17 11:41:24 mrose
16 * sync
17 *
18 * Revision 7.1 89/12/19 16:19:13 mrose
19 * sync
20 *
21 * Revision 7.0 89/11/23 21:41:55 mrose
22 * Release 6.0
23 *
24 */
25
26/*
27 * NOTICE
28 *
29 * Acquisition, use, and distribution of this module and related
30 * materials are subject to the restrictions of a license agreement.
31 * Consult the Preface in the User's Manual for the full terms of
32 * this agreement.
33 *
34 */
35
36
37/* LINTLIBRARY */
38
39
40#include "quipu/util.h"
41#include "quipu/common.h"
42#include "quipu/dsargument.h"
43
44DN mydsadn = NULLDN;
45
46struct common_args * get_ca_ref(dsarg)
47struct ds_op_arg * dsarg;
48{
49 struct common_args * ca;
50
51 switch(dsarg->dca_dsarg.arg_type)
52 {
53 case OP_READ :
54 ca = &(dsarg->dca_dsarg.arg_rd.rda_common);
55 break;
56 case OP_COMPARE :
57 ca = &(dsarg->dca_dsarg.arg_cm.cma_common);
58 break;
59 case OP_ABANDON :
60 ca = NULL_COMMONARG;
61 break;
62 case OP_LIST :
63 ca = &(dsarg->dca_dsarg.arg_ls.lsa_common);
64 break;
65 case OP_SEARCH :
66 ca = &(dsarg->dca_dsarg.arg_sr.sra_common);
67 break;
68 case OP_ADDENTRY :
69 ca = &(dsarg->dca_dsarg.arg_ad.ada_common);
70 break;
71 case OP_REMOVEENTRY :
72 ca = &(dsarg->dca_dsarg.arg_rm.rma_common);
73 break;
74 case OP_MODIFYENTRY :
75 ca = &(dsarg->dca_dsarg.arg_me.mea_common);
76 break;
77 case OP_MODIFYRDN :
78 ca = &(dsarg->dca_dsarg.arg_mr.mra_common);
79 break;
80 case OP_GETEDB :
81 ca = NULL_COMMONARG;
82 break;
83 }
84 return(ca);
85}
86
87cha_loopdetected(cha)
88struct chain_arg * cha;
89{
90 struct trace_info ti_elem_s;
91 struct trace_info * ti_elem = &(ti_elem_s);
92
93 ti_elem->ti_dsa = mydsadn;
94 ti_elem->ti_target = cha->cha_target;
95 ti_elem->ti_progress.op_resolution_phase = cha->cha_progress.op_resolution_phase;
96 ti_elem->ti_progress.op_nextrdntoberesolved = cha->cha_progress.op_nextrdntoberesolved;
97
98 return(ti_is_elem(ti_elem, cha->cha_trace));
99}
100
101ti_is_elem(ti, ti_list)
102struct trace_info * ti;
103struct trace_info * ti_list;
104{
105 struct trace_info * tip;
106
107 for(tip = ti_list; tip!=NULLTRACEINFO; tip=tip->ti_next)
108 {
109 if(dn_cmp(ti->ti_dsa, tip->ti_dsa) != 0)
110 continue;
111
112 if(dn_cmp(ti->ti_target, tip->ti_target) != 0)
113 continue;
114
115 if(ti->ti_progress.op_resolution_phase == tip->ti_progress.op_resolution_phase)
116 return(1);
117
118 if(ti->ti_progress.op_nextrdntoberesolved == tip->ti_progress.op_nextrdntoberesolved)
119 return(1);
120 }
121
122 return(0);
123}
124
125struct trace_info * ti_cpy(ti)
126struct trace_info * ti;
127{
128 struct trace_info * ret_ti;
129
130 if(ti == NULLTRACEINFO)
131 return(NULLTRACEINFO);
132
133 ret_ti = (struct trace_info *) malloc(sizeof(struct trace_info));
134
135 ret_ti->ti_target = dn_cpy(ti->ti_target);
136 ret_ti->ti_dsa = dn_cpy(ti->ti_dsa);
137 ret_ti->ti_progress = ti->ti_progress;
138 ret_ti->ti_next = ti_cpy(ti->ti_next);
139
140 return(ret_ti);
141}
142