|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 11066 (0x2b3a) Types: TextFile Names: »dsa_chain.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/quipu/dsa_chain.c«
/* dsa_chain.c - take referal and chain if allowed */ #ifndef lint static char *rcsid = "$Header: /f/osi/quipu/RCS/dsa_chain.c,v 6.0 89/03/18 23:41:28 mrose Rel $"; #endif /* * $Header: /f/osi/quipu/RCS/dsa_chain.c,v 6.0 89/03/18 23:41:28 mrose Rel $ * * * $Log: dsa_chain.c,v $ * Revision 6.0 89/03/18 23:41:28 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 "acsap.h" #include "quipu/util.h" #include "quipu/connection.h" extern LLog * log_dsap; #ifndef NO_STATS extern LLog * log_stat; #endif extern int dn_print (); extern char * mydsaname; extern DN mydsadn; extern int no_dsp_chain; Conn conn_alloc(); struct activity * oper_alloc(); dsa_chain(tk) struct activity * tk; { struct DSE_referral * ref = &(tk->act_resp.resp_err.ERR_REFERRAL); struct continuation_ref * cref; register struct chain_arg * cha = &(tk->act_req.dca_charg); struct trace_info * ti; struct activity * on; DLOG(log_dsap, LLOG_TRACE, ("Chain a task ...")); cref = ref->DSE_ref_candidates; if(cref != NULLCONTINUATIONREF) { cha->cha_target = NULLDN; /* Put new name (if any) in the request */ if(cref->cr_name != NULLDN) { cha->cha_target = dn_cpy(cref->cr_name); } cha->cha_progress = cref->cr_progress; cha->cha_aliasderef = ((cha->cha_aliasedrdns = cref->cr_aliasedRDNs) != CR_NOALIASEDRDNS); cha->cha_returnrefs = FALSE; cha->cha_domaininfo = NULLPE; if((cha->cha_reftype = cref->cr_reftype) == RT_UNDEFINED) cha->cha_reftype = RT_SUPERIOR; DLOG(log_dsap, LLOG_DEBUG, ("Checking history of op")); if(!(tk->act_conn->cn_dsa)) { DLOG(log_dsap, LLOG_DEBUG, ("... from a DUA ...")); if(tk->act_conn->cn_state == CN_STATE_INIT) { DLOG(log_dsap, LLOG_DEBUG, ("Bind compare: %s", mydsaname)); cha->cha_originator = dn_cpy(mydsadn); } else { DLOG(log_dsap, LLOG_DEBUG, ("... user originated ...")); cha->cha_originator = dn_cpy(tk->act_conn->cn_who); } cha->cha_timelimit = ((struct UTCTime *) 0); cha->cha_trace = NULLTRACEINFO; } DLOG(log_dsap, LLOG_DEBUG, ("Setting trace info")); ti = (struct trace_info *) malloc(sizeof(struct trace_info)); ti->ti_dsa = dn_cpy(mydsadn); ti->ti_target = dn_cpy(cref->cr_name); ti->ti_progress = cref->cr_progress; ti->ti_next = cha->cha_trace; cha->cha_trace = ti; DLOG(log_dsap, LLOG_DEBUG, ("Generating OPs")); on = oper_alloc(); on->refer_st = NULL_ST; on->on_arg = &(tk->act_req); on->on_cr_next = cref->cr_next; on->on_ap_next = &(cref->cr_accesspoints); if(task_chain(tk, on) != OK) { DLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to chain task!")); } } if(tk->act_class != ACTIVITY_COLLATE) tk->act_class = ACTIVITY_NET_WAIT; } dsa_rechain(on) struct activity * on; { struct DSE_referral * ref = &(on->act_resp.resp_err.ERR_REFERRAL); struct continuation_ref * cref; register struct chain_arg * cha = &(on->act_req.dca_charg); struct trace_info * ti; DLOG(log_dsap, LLOG_TRACE, ("Rechain an operation ...")); cref = ref->DSE_ref_candidates; if(cref == NULLCONTINUATIONREF) { LLOG(log_dsap, LLOG_FATAL, ("No continuation reference to rechain")); on->act_resp.resp_type = RESP_TYPE_REJ; on->on_task->act_class = ACTIVITY_COLLATE; return; } /* originator is left as before */ dn_decode(cref->cr_name); cha->cha_target = dn_cpy(cref->cr_name); cha->cha_progress = cref->cr_progress; cha->cha_aliasderef = ((cha->cha_aliasedrdns = cref->cr_aliasedRDNs) != CR_NOALIASEDRDNS); cha->cha_returnrefs = FALSE; cha->cha_domaininfo = NULLPE; if((cha->cha_reftype = cref->cr_reftype) == RT_UNDEFINED) cha->cha_reftype = RT_SUPERIOR; DLOG(log_dsap, LLOG_DEBUG, ("Setting trace info")); ti = (struct trace_info *) malloc(sizeof(struct trace_info)); ti->ti_dsa = dn_cpy(on->act_conn->cn_what); /* DSA last chained to */ ti->ti_target = dn_cpy(cref->cr_name); ti->ti_progress = cref->cr_progress; ti->ti_next = cha->cha_trace; cha->cha_trace = ti; on->refer_st = NULL_ST; on->on_cr_next = cref->cr_next; on->on_ap_next = &(cref->cr_accesspoints); oper_conn_extract(on); if(oper_chain(on) == NOTOK) { on->on_task->act_class = ACTIVITY_COLLATE; } } st_chain(tk) struct activity * tk; { struct ds_search_task **refer; struct activity * on; struct continuation_ref * cref; register struct chain_arg * tkcha = &(tk->act_req.dca_charg); register struct chain_arg * oncha; struct trace_info * ti; if(tk->refer_st == NULL_ST) return; LLOG(log_dsap, LLOG_TRACE, ("Chain search subtasks ...")); for(refer = &(tk->refer_st); *refer != NULL_ST; refer = &((*refer)->st_next)) { if((cref = (*refer)->st_cr) == NULLCONTINUATIONREF) { LLOG(log_dsap, LLOG_EXCEPTIONS, ("search referred without continuation reference")); continue; } on = oper_alloc(); on->refer_st = (*refer); oncha = &(on->act_req.dca_charg); if((*refer)->st_alias == NULLDN) { oncha->cha_target = dn_cpy((*refer)->st_baseobject); } else { oncha->cha_target = dn_cpy((*refer)->st_alias); } oncha->cha_progress = cref->cr_progress; oncha->cha_aliasderef = ((oncha->cha_aliasedrdns = cref->cr_aliasedRDNs) != CR_NOALIASEDRDNS); oncha->cha_returnrefs = FALSE; oncha->cha_domaininfo = NULLPE; if((oncha->cha_reftype = cref->cr_reftype) == RT_UNDEFINED) oncha->cha_reftype = RT_SUPERIOR; oncha->cha_timelimit = ((struct UTCTime *) 0); LLOG(log_dsap, LLOG_DEBUG, ("Checking history of op")); if(!(tk->act_conn->cn_dsa)) { LLOG(log_dsap, LLOG_DEBUG, ("... user originated ...")); oncha->cha_originator = dn_cpy(tk->act_conn->cn_who); oncha->cha_trace = NULLTRACEINFO; } else { oncha->cha_trace = ti_cpy(tkcha->cha_trace); } LLOG(log_dsap, LLOG_DEBUG, ("Setting trace info")); ti = (struct trace_info *) malloc(sizeof(struct trace_info)); ti->ti_dsa = dn_cpy(mydsadn); ti->ti_target = dn_cpy(cref->cr_name); ti->ti_progress = cref->cr_progress; ti->ti_next = oncha->cha_trace; oncha->cha_trace = ti; on->act_req.dca_dsarg = tk->act_req.dca_dsarg; on->act_req.dca_dsarg.arg_sr.sra_subset = (*refer)->st_subset; on->act_req.dca_dsarg.arg_sr.sra_baseobject = oncha->cha_target; on->on_arg = &(on->act_req); LLOG(log_dsap, LLOG_DEBUG, ("Generating search subtask OP")); on->on_ap_next = &(cref->cr_accesspoints); on->on_cr_next = cref->cr_next; if(task_chain(tk, on) != OK) { DLOG(log_dsap, LLOG_EXCEPTIONS, ("Failed to chain search sub-op")); } } (*refer) = tk->referred_st; tk->referred_st = tk->refer_st; tk->refer_st = NULL_ST; } Conn get_conn_by_ap(ap) struct access_point * ap; { Conn cn; /* * Does a connection to the DSA referred to exist ?? * If not create one! */ DLOG (log_dsap, LLOG_TRACE, ("do_dsa_chain")); dn_decode(ap->ap_name); #ifdef DEBUG pslog (log_dsap,LLOG_DEBUG,"ap_name ",dn_print,(caddr_t)ap->ap_name); #endif if(dn_cmp(ap->ap_name, mydsadn) == 0) { LLOG(log_dsap, LLOG_FATAL, ("Trying to connect to self :-)")); return(NULLCONN); } DLOG (log_dsap,LLOG_DEBUG,("Checking connection list..")); for(cn=id_st.connlist; cn!=NULLCONN; cn=cn->cn_next) { #ifdef DEBUG pslog (log_dsap,LLOG_DEBUG,"...",dn_print,(caddr_t)cn->cn_what); #endif if((cn->cn_what != NULLDN) && (dn_cmp(cn->cn_what, ap->ap_name) == 0)) break; } if(cn == NULLCONN) { /* * Set up a new connection block and its initial activity. */ cn = conn_alloc(); cn->cn_initiator = INITIATED_BY_THIS; cn->cn_state = CN_STATE_INIT; cn->cn_init_act.ia_class = ACTIVITY_NET_SEND; cn->cn_init_act.ia_type = ACT_TYPE_REQ; make_dsa_bind_arg(&(cn->cn_init_act.ia_req)); cn->cn_dsa = TRUE; /* WE HOPE !! */ cn->cn_what = dn_cpy(ap->ap_name); DLOG (log_dsap,LLOG_TRACE,( "Before psap_dup: %s", paddr2str(&(ap->ap_address),NULLNA))); psap_dup(&(cn->cn_addr), &(ap->ap_address)); DLOG (log_dsap,LLOG_TRACE,( "After psap_dup: %s", paddr2str(&(cn->cn_addr),NULLNA))); cn->cn_next = id_st.connlist; id_st.connlist = cn; } return(cn); } int oper_chain(on) struct activity * on; { Conn cn; if(on->on_ap_next == NULLACCESSPOINT) { if(on->on_cr_next == NULLCONTINUATIONREF) { DLOG(log_dsap, LLOG_EXCEPTIONS, ("Nowhere else to try!")); on->act_class = ACTIVITY_COLLATE; on->act_type = ACT_TYPE_RESP; on->act_resp.resp_type = RESP_TYPE_RET; on->act_resp.ret_type = RET_TYPE_ERR; on->act_resp.resp_err.dse_type = DSE_SERVICEERROR; on->act_resp.resp_err.ERR_SERVICE.DSE_sv_problem = DSE_SV_INVALIDREFERENCE; return(NOTOK); } else { DLOG(log_dsap, LLOG_EXCEPTIONS, ("Multiple continuation refs!")); on->on_ap_next = &(on->on_cr_next->cr_accesspoints); on->on_cr_next = on->on_cr_next->cr_next; } } if((cn = get_conn_by_ap(on->on_ap_next)) == NULLCONN) { LLOG(log_dsap,LLOG_EXCEPTIONS, ("Couldn't get a connection block")); on->act_class = ACTIVITY_COLLATE; on->act_type = ACT_TYPE_RESP; on->act_resp.resp_type = RESP_TYPE_RET; on->act_resp.ret_type = RET_TYPE_ERR; on->act_resp.resp_err.dse_type = DSE_SERVICEERROR; on->act_resp.resp_err.ERR_SERVICE.DSE_sv_problem = DSE_SV_INVALIDREFERENCE; return(NOTOK); } #ifndef NO_STATS pslog (log_stat,LLOG_NOTICE,"chain to ",dn_print,(caddr_t)on->on_ap_next->ap_name); #endif on->on_ap_next = on->on_ap_next->ap_next; on->act_class = ACTIVITY_NET_SEND; on->act_type = ACT_TYPE_REQ; on->on_next_conn = cn->cn_operlist; cn->cn_operlist = on; on->act_conn = cn; return(OK); } int task_chain(tk, on) register struct activity * tk; struct activity * on; { on->act_prio = tk->act_prio; on->on_next_task = tk->tk_operlist; tk->tk_operlist = on; on->on_task = tk; if(oper_chain(on) == NOTOK) { tk->act_class = ACTIVITY_COLLATE; return(NOTOK); } return(OK); } int chain_ok(act) struct activity * act; { DLOG (log_dsap,LLOG_TRACE,( "chain_ok: Checking if chaining is ok")); if(no_dsp_chain && act->act_conn->cn_dsa) { DLOG (log_dsap,LLOG_DEBUG,( "Not chaining because of NO_DSP_CHAIN")); return(FALSE); } if(act->act_ca->ca_servicecontrol.svc_options & SVC_OPT_CHAININGPROHIBIT) { DLOG (log_dsap,LLOG_DEBUG,( "Not chaining because of prohibition")); return(FALSE); } if(act->act_ca->ca_servicecontrol.svc_options & SVC_OPT_LOCALSCOPE) { DLOG (log_dsap,LLOG_DEBUG,( "Not chaining because of scope")); return(FALSE); /* Could try looking at PSAP address later on */ } DLOG (log_dsap,LLOG_DEBUG,( "Refer OK!")); return(TRUE); }