inline static int w_t_release(struct sip_msg* msg, char* str, char* str2) { struct cell *t; if (t_check( msg , 0 )==-1) return -1; t=get_t(); if ( t && t!=T_UNDEFINED ) return t_release_transaction( t ); return 1; }
/* register a callback function 'f' for 'types' mask of events; * will be called back whenever one of the events occurs in transaction module * (global or per transaction, depending of event type) * It _must_ be always called either with the REPLY_LOCK held, or before the * branches are created. * Special cases: TMCB_REQUEST_IN & TMCB_LOCAL_REQUEST_IN - must be called * from mod_init (before forking!). */ int register_tmcb( struct sip_msg* p_msg, struct cell *t, int types, transaction_cb f, void *param ) { //struct cell* t; struct tmcb_head_list *cb_list; /* are the callback types valid?... */ if ( types<0 || types>TMCB_MAX ) { LOG(L_CRIT, "BUG:tm:register_tmcb: invalid callback types: mask=%d\n", types); return E_BUG; } /* we don't register null functions */ if (f==0) { LOG(L_CRIT, "BUG:tm:register_tmcb: null callback function\n"); return E_BUG; } if (types&TMCB_REQUEST_IN) { if (types!=TMCB_REQUEST_IN) { LOG(L_CRIT, "BUG:tm:register_tmcb: callback type TMCB_REQUEST_IN " "can't be register along with types\n"); return E_BUG; } cb_list = req_in_tmcb_hl; }else if (types & TMCB_LOCAL_REQUEST_IN) { if (types!=TMCB_LOCAL_REQUEST_IN) { LOG(L_CRIT, "BUG:tm:register_tmcb: callback type" " TMCB_LOCAL_REQUEST_IN can't be register along with" " other types\n"); return E_BUG; } cb_list = local_req_in_tmcb_hl; } else { if (!t) { if (!p_msg) { LOG(L_CRIT,"BUG:tm:register_tmcb: no sip_msg, nor transaction" " given\n"); return E_BUG; } /* look for the transaction */ if ( t_check(p_msg,0)!=1 ){ LOG(L_CRIT,"BUG:tm:register_tmcb: no transaction found\n"); return E_BUG; } if ( (t=get_t())==0 ) { LOG(L_CRIT,"BUG:tm:register_tmcb: transaction found " "is NULL\n"); return E_BUG; } } cb_list = &(t->tmcb_hl); } return insert_tmcb( cb_list, types, f, param ); }
/* register a callback function 'f' for 'types' mask of events; * will be called back whenever one of the events occurs in transaction module * (global or per transaction, depending of event type) * It _must_ be always called either with the REPLY_LOCK held, or before the * branches are created. * Special cases: TMCB_REQUEST_IN & TMCB_LOCAL_REQUEST_IN - must be called * from mod_init (before forking!). */ int register_tmcb( struct sip_msg* p_msg, struct cell *t, int types, transaction_cb f, void *param, release_tmcb_param rel_func) { //struct cell* t; struct tmcb_head_list *cb_list; /* are the callback types valid?... */ if ( types<0 || types>TMCB_MAX ) { LOG(L_CRIT, "BUG:tm:register_tmcb: invalid callback types: mask=%d\n", types); return E_BUG; } /* we don't register null functions */ if (f==0) { LOG(L_CRIT, "BUG:tm:register_tmcb: null callback function\n"); return E_BUG; } if ((types!=TMCB_MAX) && (types&TMCB_REQUEST_IN)) { if (types!=TMCB_REQUEST_IN) { LOG(L_CRIT, "BUG:tm:register_tmcb: callback type TMCB_REQUEST_IN " "can't be register along with types\n"); return E_BUG; } cb_list = req_in_tmcb_hl; }else if ((types!=TMCB_MAX) && (types & TMCB_LOCAL_REQUEST_IN)) { if (types!=TMCB_LOCAL_REQUEST_IN) { LOG(L_CRIT, "BUG:tm:register_tmcb: callback type" " TMCB_LOCAL_REQUEST_IN can't be register along with" " other types\n"); return E_BUG; } cb_list = local_req_in_tmcb_hl; } else { if (!t) { if (!p_msg) { LOG(L_CRIT,"BUG:tm:register_tmcb: no sip_msg, nor transaction" " given\n"); return E_BUG; } /* look for the transaction */ t=get_t(); if ( t!=0 && t!=T_UNDEFINED) { cb_list = &(t->tmcb_hl); } else { cb_list = get_early_tmcb_list(p_msg); } } else { cb_list = &(t->tmcb_hl); } } return insert_tmcb( cb_list, types, f, param, rel_func ); }
LogProb transpair_model4::prob_of_target_and_alignment_given_source_1(const alignment&al,bool verb)const { LogProb total = 1.0 ; total *= pow(double(1-p1), m-2.0 * al.fert(0)) * pow(double(p1), double(al.fert(0))); if( verb) cerr << "IBM-4: (1-p1)^(m-2 f0)*p1^f0: " << total << endl; for (WordIndex i = 1 ; i <= al.fert(0) ; i++) total *= double(m - al.fert(0) - i + 1) / (double(DeficientDistortionForEmptyWord?(max(2,int(m))/DeficientDistortionForEmptyWord):i)) ; if( verb) cerr << "IBM-4: +NULL:binomial+distortion " << total << endl; for (WordIndex i = 1 ; i <= l ; i++) { total *= get_fertility(i, al.fert(i));// * (LogProb) factorial(al.fert(i)); if( verb) cerr << "IBM-4: fertility of " << i << " " << get_fertility(i, al.fert(i)) << " -> " << total << endl; } for (WordIndex j = 1 ; j <= m ; j++) { total*= get_t(al(j), j) ; if( verb) cerr << "IBM-4: t of j:" << j << " i:" << al(j) << ": " << get_t(al(j), j) << " -> " << total << endl; } return total; }
/* register a callback function 'f' for 'types' mask of events; * will be called back whenever one of the events occurs in transaction module * (global or per transaction, depending of event type) */ int register_tmcb( struct sip_msg* p_msg, struct cell *t, int types, transaction_cb f, void *param, release_tmcb_param release_func ) { struct tmcb_head_list *cb_list; /* are the callback types valid?... */ if ( types<0 || types>TMCB_MAX ) { LM_CRIT("invalid callback types: mask=%d\n", types); return E_BUG; } /* we don't register null functions */ if (f==0) { LM_CRIT("null callback function\n"); return E_BUG; } if (types&TMCB_REQUEST_IN) { if (types!=TMCB_REQUEST_IN) { LM_CRIT("callback type TMCB_REQUEST_IN " "can't be register along with types\n"); return E_BUG; } if (req_in_tmcb_hl==0) { LM_ERR("callback type TMCB_REQUEST_IN " "registration attempt before TM module initialization\n"); return E_CFG; } cb_list = req_in_tmcb_hl; } else { if (!t) { if (!p_msg) { LM_CRIT("no sip_msg, nor transaction given\n"); return E_BUG; } /* look for the transaction */ t = get_t(); if ( t!=NULL && t!=T_UNDEFINED ){ cb_list = &(t->tmcb_hl); } else { /* no transaction found -> link it to waitting list */ if (p_msg->id!=tmcb_pending_id) { empty_tmcb_list(&tmcb_pending_hl); tmcb_pending_id = p_msg->id; } cb_list = &(tmcb_pending_hl); } } else { cb_list = &(t->tmcb_hl); } } return insert_tmcb( cb_list, types, f, param, release_func ); }
inline static int t_check_trans(struct sip_msg* msg, char *foo, char *bar) { struct cell *trans; struct cell *bkup; int ret; if (msg->REQ_METHOD==METHOD_CANCEL) { /* parse needed hdrs*/ if (check_transaction_quadruple(msg)==0) { LOG(L_ERR, "ERROR:tm:t_check_trans: too few headers\n"); return 0; /*drop request!*/ } if (!msg->hash_index) msg->hash_index = hash(msg->callid->body,get_cseq(msg)->number); /* performe lookup */ trans = t_lookupOriginalT( msg ); if (trans) { UNREF( trans ); return 1; } else { return -1; } } else { bkup = get_t(); ret = t_lookup_request( msg , 0); if ( (trans=get_t())!=0 ) UNREF(trans); set_t( bkup ); switch (ret) { case 1: /* transaction found */ return 1; case -2: /* e2e ACK found */ return 1; default: /* notfound */ return -1; } } return ret; }
inline static int t_check_trans(struct sip_msg* msg) { struct cell *trans; if (msg->REQ_METHOD==METHOD_CANCEL) { /* parse needed hdrs*/ if (check_transaction_quadruple(msg)==0) { LM_ERR("too few headers\n"); return 0; /*drop request!*/ } if (!msg->hash_index) msg->hash_index = tm_hash(msg->callid->body,get_cseq(msg)->number); /* performe lookup */ trans = t_lookupOriginalT( msg ); return trans?1:-1; } else { trans = get_t(); if (trans==NULL) return -1; if (trans!=T_UNDEFINED) return 1; switch ( t_lookup_request( msg , 0) ) { case 1: /* transaction found -> is it local ACK? */ if (msg->REQ_METHOD==METHOD_ACK) return 1; /* .... else -> retransmission */ trans = get_t(); t_retransmit_reply(trans); UNREF(trans); set_t(0); return 0; case -2: /* e2e ACK found */ return 1; default: /* notfound */ return -1; } } }
void t_on_negative( unsigned int go_to ) { struct cell *t = get_t(); /* in MODE_REPLY and MODE_ONFAILURE T will be set to current transaction; * in MODE_REQUEST T will be set only if the transaction was already * created; if not -> use the static variable */ if (!t || t==T_UNDEFINED ) goto_on_negative=go_to; else t->on_negative = go_to; }
inline static int select_tm_get_cell(struct sip_msg* msg, int *branch, struct cell **t) { /* make sure we know the associated transaction ... */ if (t_check( msg , branch )==-1) /* it's not necessary whan calling from script because already done */ return -1; /*... if there is none, tell the core router to fwd statelessly */ *t = get_t(); if ( (*t==0)||(*t==T_UNDEFINED)) return -1; return 0; }
inline static int w_t_newtran( struct sip_msg* p_msg, char* foo, char* bar ) { /* t_newtran returns 0 on error (negative value means 'transaction exists' */ int ret; ret = t_newtran( p_msg ); if (ret==E_SCRIPT) { LOG(L_DBG, "ERROR: t_newtran: " "transaction already in process %p\n", get_t() ); } return ret; }
inline static int t_local_replied(struct sip_msg* msg, char *type) { struct cell *t; int branch; int i; t = get_t(); if (t==0 || t==T_UNDEFINED) { LM_ERR("no trasaction created\n"); return -1; } switch ( (int)(long)type ) { /* check all */ case 0: for( i=t->first_branch ; i<t->nr_of_outgoings ; i++ ) { if (t->uac[i].flags&T_UAC_HAS_RECV_REPLY) return -1; } return 1; /* check branch */ case 1: if (route_type==FAILURE_ROUTE) { /* use the winning reply */ if ( (branch=t_get_picked_branch())<0 ) { LM_CRIT("no picked branch (%d) for" " a final response in MODE_ONFAILURE\n", branch); return -1; } if (t->uac[branch].flags&T_UAC_HAS_RECV_REPLY) return -1; return 1; } return -1; /* check last */ case 2: if (route_type==FAILURE_ROUTE) { /* use the winning reply */ if ( (branch=t_get_picked_branch())<0 ) { LM_CRIT("no picked branch (%d) for" " a final response in MODE_ONFAILURE\n", branch); return -1; } if (t->uac[branch].reply==FAKED_REPLY) return 1; return -1; } return (t->relaied_reply_branch==-2)?1:-1; default: return -1; } }
/**************************** wrapper functions ***************************/ static int t_check_status(struct sip_msg* msg, char *regexp, char *foo) { regmatch_t pmatch; struct cell *t; char *status; char backup; int lowest_status; int n; /* first get the transaction */ if (t_check( msg , 0 )==-1) return -1; if ( (t=get_t())==0) { LOG(L_ERR, "ERROR: t_check_status: cannot check status for a reply " "which has no T-state established\n"); return -1; } backup = 0; switch (route_type) { case REQUEST_ROUTE: /* use the status of the last sent reply */ status = int2str( t->uas.status, 0); break; case ONREPLY_ROUTE: /* use the status of the current reply */ status = msg->first_line.u.reply.status.s; backup = status[msg->first_line.u.reply.status.len]; status[msg->first_line.u.reply.status.len] = 0; break; case FAILURE_ROUTE: /* use the status of the winning reply */ if (t_pick_branch( -1, 0, t, &lowest_status)<0 ) { LOG(L_CRIT,"BUG:t_check_status: t_pick_branch failed to get " " a final response in MODE_ONFAILURE\n"); return -1; } status = int2str( lowest_status , 0); break; default: LOG(L_ERR,"ERROR:t_check_status: unsupported route_type %d\n", route_type); return -1; } DBG("DEBUG:t_check_status: checked status is <%s>\n",status); /* do the checking */ n = regexec((regex_t*)regexp, status, 1, &pmatch, 0); if (backup) status[msg->first_line.u.reply.status.len] = backup; if (n!=0) return -1; return 1; }
struct sip_msg* tm_pv_context_request(struct sip_msg* msg) { struct cell* trans = get_t(); LM_DBG("in fct din tm\n"); if(trans == NULL || trans == T_UNDEFINED) { LM_ERR("No transaction found\n"); return NULL; } return trans->uas.request; }
inline static int w_t_reply(struct sip_msg* msg, char* code, char* text) { struct cell *t; int r; if (msg->REQ_METHOD==METHOD_ACK) { LM_DBG("ACKs are not replied\n"); return 0; } switch (route_type) { case FAILURE_ROUTE: /* if called from reply_route, make sure that unsafe version * is called; we are already in a mutex and another mutex in * the safe version would lead to a deadlock */ t=get_t(); if ( t==0 || t==T_UNDEFINED ) { LM_ERR("BUG - no transaction found in Failure Route\n"); return -1; } return t_reply_unsafe(t, msg, (unsigned int)(long)code,(str*)text); case REQUEST_ROUTE: t=get_t(); if ( t==0 || t==T_UNDEFINED ) { r = t_newtran( msg , 0/*no full UAS cloning*/ ); if (r==0) { /* retransmission -> break the script */ return 0; } else if (r<0) { LM_ERR("could not create a new transaction\n"); return -1; } t=get_t(); } return t_reply( t, msg, (unsigned int)(long)code, (str*)text); default: LM_CRIT("unsupported route_type (%d)\n", route_type); return -1; } }
static int t_was_cancelled(struct sip_msg* msg) { struct cell *t; /* first get the transaction */ t = get_t(); if ( t==0 || t==T_UNDEFINED ) { LM_ERR("failed to check cancel flag for a reply" " without a transaction\n"); return -1; } return was_cancelled(t)?1:-1; }
static int t_was_cancelled(struct sip_msg* msg, char *foo, char *bar) { struct cell *t; /* first get the transaction */ if (t_check( msg , 0 )==-1) return -1; if ( (t=get_t())==0) { LOG(L_ERR, "ERROR:tm:t_was_cancelled: cannot check cancel flag for " "a reply without a transaction\n"); return -1; } return (t->flags&T_WAS_CANCELLED_FLAG)?1:-1; }
void cai_tien() { get_t(); do { get_cd_ct(); get_c(); if (Tong > 5000) meo_vat(); get_d(); updatekt(); mumu(); } while (!Kt); }
/**************************** wrapper functions ***************************/ static int t_check_status(struct sip_msg* msg, char *regexp) { regmatch_t pmatch; struct cell *t; char *status; char backup; int branch; int n; /* first get the transaction */ t = get_t(); if ( t==0 || t==T_UNDEFINED ) { LM_ERR("cannot check status for a reply which" " has no transaction-state established\n"); return -1; } backup = 0; switch (route_type) { case REQUEST_ROUTE: /* use the status of the last sent reply */ status = int2str( t->uas.status, 0); break; case ONREPLY_ROUTE: /* use the status of the current reply */ status = msg->first_line.u.reply.status.s; backup = status[msg->first_line.u.reply.status.len]; status[msg->first_line.u.reply.status.len] = 0; break; case FAILURE_ROUTE: /* use the status of the winning reply */ if ( (branch=t_get_picked_branch())<0 ) { LM_CRIT("no picked branch (%d) for a final response" " in MODE_ONFAILURE\n", branch); return -1; } status = int2str( t->uac[branch].last_received , 0); break; default: LM_ERR("unsupported route_type %d\n", route_type); return -1; } LM_DBG("checked status is <%s>\n",status); /* do the checking */ n = regexec((regex_t*)regexp, status, 1, &pmatch, 0); if (backup) status[msg->first_line.u.reply.status.len] = backup; if (n!=0) return -1; return 1; }
inline static int w_t_cancel_branch(struct sip_msg *msg, char *sflags) { branch_bm_t cancel_bitmap = 0; struct cell *t; unsigned int flags = (unsigned long)sflags; t=get_t(); if (t==NULL || t==T_UNDEFINED) { /* no transaction */ LM_ERR("cannot cancel a reply with no transaction"); return -1; } if (!is_invite(t)) return -1; if (flags&TM_CANCEL_BRANCH_ALL) { /* lock and get the branches to cancel */ if (!onreply_avp_mode) { LOCK_REPLIES(t); which_cancel( t, &cancel_bitmap ); UNLOCK_REPLIES(t); } else { which_cancel( t, &cancel_bitmap ); } if (msg->first_line.u.reply.statuscode>=200) /* do not cancel the current branch as we got * a final response here */ cancel_bitmap &= ~(1<<_tm_branch_index); } else if (flags&TM_CANCEL_BRANCH_OTHERS) { /* lock and get the branches to cancel */ if (!onreply_avp_mode) { LOCK_REPLIES(t); which_cancel( t, &cancel_bitmap ); UNLOCK_REPLIES(t); } else { which_cancel( t, &cancel_bitmap ); } /* ignore current branch */ cancel_bitmap &= ~(1<<_tm_branch_index); } else { /* cancel only local branch (only if still ongoing) */ if (msg->first_line.u.reply.statuscode<200) cancel_bitmap = 1<<_tm_branch_index; } /* send cancels out */ cancel_uacs(t, cancel_bitmap); return 1; }
static int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { struct cell *t; int code; int branch; if(msg==NULL || res==NULL) return -1; /* first get the transaction */ if (t_check( msg , 0 )==-1) return -1; if ( (t=get_t())==0) { /* no T */ code = 0; } else { switch (route_type) { case REQUEST_ROUTE: /* use the status of the last sent reply */ code = t->uas.status; break; case ONREPLY_ROUTE: /* use the status of the current reply */ code = msg->first_line.u.reply.statuscode; break; case FAILURE_ROUTE: /* use the status of the winning reply */ if ( (branch=t_get_picked_branch())<0 ) { LM_CRIT("no picked branch (%d) for a final response" " in MODE_ONFAILURE\n", branch); code = 0; } else { code = t->uac[branch].last_received; } break; default: LM_ERR("unsupported route_type %d\n", route_type); code = 0; } } LM_DBG("reply code is <%d>\n",code); res->rs.s = int2str( code, &res->rs.len); res->ri = code; res->flags = PV_VAL_STR|PV_VAL_INT|PV_TYPE_INT; return 0; }
int pv_get_tm_fr_inv_timeout(struct sip_msg *msg, pv_param_t *param, pv_value_t *ret) { struct cell *t; if (!msg || !ret) return -1; t = get_t(); ret->flags = PV_VAL_INT; ret->ri = (t && t != T_UNDEFINED) ? t->fr_inv_timeout : fr_inv_timeout; return 0; }
int t_is_local(struct sip_msg* p_msg) { struct cell* t; if(t_check(p_msg,0) != 1){ LOG(L_ERR,"ERROR: t_is_local: no transaction found\n"); return -1; } t = get_t(); if(!t){ LOG(L_ERR,"ERROR: t_is_local: transaction found is NULL\n"); return -1; } return is_local(t); }
inline static int w_t_reply(struct sip_msg* msg, char* p1, char* p2) { struct cell *t; int code, ret = -1; str reason; char* r; if (msg->REQ_METHOD==METHOD_ACK) { LOG(L_WARN, "WARNING: t_reply: ACKs are not replied\n"); return -1; } if (t_check( msg , 0 )==-1) return -1; t=get_t(); if (!t) { LOG(L_ERR, "ERROR: t_reply: cannot send a t_reply to a message " "for which no T-state has been established\n"); return -1; } if (get_int_fparam(&code, msg, (fparam_t*)p1) < 0) { code = default_code; } if (get_str_fparam(&reason, msg, (fparam_t*)p2) < 0) { reason = default_reason; } r = as_asciiz(&reason); if (r == NULL) r = default_reason.s; /* if called from reply_route, make sure that unsafe version * is called; we are already in a mutex and another mutex in * the safe version would lead to a deadlock */ if (rmode==MODE_ONFAILURE) { DBG("DEBUG: t_reply_unsafe called from w_t_reply\n"); ret = t_reply_unsafe(t, msg, code, r); } else if (rmode==MODE_REQUEST) { ret = t_reply( t, msg, code, r); } else { LOG(L_CRIT, "BUG: w_t_reply entered in unsupported mode\n"); ret = -1; } if (r) pkg_free(r); return ret; }
static int t_flush_flags(struct sip_msg* msg, char *foo, char *bar) { struct cell *t; /* first get the transaction */ t = get_t(); if ( t==0 || t==T_UNDEFINED) { LOG(L_ERR, "ERROR: t_flush_flags: cannot flush flags for a message " "which has no T-state established\n"); return -1; } /* do the flush */ t->uas.request->flags = msg->flags&gflags_mask; return 1; }
static int t_flush_flags(struct sip_msg* msg) { struct cell *t; /* first get the transaction */ t = get_t(); if ( t==0 || t==T_UNDEFINED) { LM_ERR("failed to flush flags for a message which has" " no transaction-state established\n"); return -1; } /* do the flush */ t->uas.request->flags = msg->flags; return 1; }
inline static int w_t_relay( struct sip_msg *p_msg , char *proxy, char *flags) { struct cell *t; int ret; t=get_t(); if (!t || t==T_UNDEFINED) { /* no transaction yet */ if (route_type==FAILURE_ROUTE) { LM_CRIT(" BUG - undefined transaction in failure route\n"); return -1; } ret = t_relay_to( p_msg, (struct proxy_l *)proxy, (int)(long)flags ); if (ret<0) { ret = t_relay_inerr2scripterr(); } return ret?ret:1; } else { /* transaction already created */ if ( route_type!=REQUEST_ROUTE && route_type!=FAILURE_ROUTE ) goto route_err; if (p_msg->REQ_METHOD==METHOD_ACK) { /* local ACK*/ t_release_transaction(t); return 1; } if (((int)(long)flags)&TM_T_REPLY_nodnsfo_FLAG) t->flags|=T_NO_DNS_FAILOVER_FLAG; if (((int)(long)flags)&TM_T_REPLY_reason_FLAG) t->flags|=T_CANCEL_REASON_FLAG; ret = t_forward_nonack( t, p_msg, (struct proxy_l *)proxy); if (ret<=0 ) { LM_ERR("t_forward_nonack failed\n"); ret = t_relay_inerr2scripterr(); } return ret?ret:1; } route_err: LM_CRIT("unsupported route type: %d\n", route_type); return 0; }
void t_on_reply( unsigned int go_to ) { struct cell *t = get_t(); /* in MODE_REPLY and MODE_ONFAILURE T will be set to current transaction; * in MODE_REQUEST T will be set only if the transaction was already * created; if not -> use the static variable */ if (!t || t==T_UNDEFINED ) { goto_on_reply=go_to; } else { if (route_type==BRANCH_ROUTE) { t->uac[_tm_branch_index].on_reply = go_to; } else { t->on_reply = go_to; } } }
void transpair_model5::computeScores(const alignment&al,vector<double>&d)const { LogProb total1 = 1.0,total2=1.0,total3=1.0,total4=1.0 ; total1 *= pow(double(1-p1), m-2.0 * al.fert(0)) * pow(double(p1), double(al.fert(0))); for (WordIndex i = 1 ; i <= al.fert(0) ; i++) total1 *= double(m - al.fert(0) - i + 1) / i ; // IBM-5 is not deficient! for (WordIndex i = 1 ; i <= l ; i++) total2 *= get_fertility(i, al.fert(i)); for (WordIndex j = 1 ; j <= m ; j++) total3*= get_t(al(j), j) ; PositionIndex prev_cept=0; PositionIndex vac_all=m; Vector<char> vac(m+1,0); for(WordIndex i=1;i<=l;i++) { PositionIndex cur_j=al.als_i[i]; PositionIndex prev_j=0; PositionIndex k=0; if(cur_j) { // process first word of cept k++; total4*=d5m.getProb_first(vacancies(vac,cur_j),vacancies(vac,al.get_center(prev_cept)),d5m.fwordclasses->getClass(get_fs(cur_j)),l,m,vac_all-al.fert(i)+k); vac_all--; assert(vac[cur_j]==0); vac[cur_j]=1; prev_j=cur_j; cur_j=al.als_j[cur_j].next; } while(cur_j) { // process following words of cept k++; int vprev=vacancies(vac,prev_j); total4*=d5m.getProb_bigger(vacancies(vac,cur_j),vprev,d5m.fwordclasses->getClass(get_fs(cur_j)),l,m,vac_all-vprev/*war weg*/-al.fert(i)+k); vac_all--; vac[cur_j]=1; prev_j=cur_j; cur_j=al.als_j[cur_j].next; } assert(k==al.fert(i)); if( k ) prev_cept=i; } assert(vac_all==al.fert(0)); d.push_back(total1);//13 d.push_back(total2);//14 d.push_back(total3);//15 d.push_back(total4);//16 }
inline static int w_t_retransmit_reply( struct sip_msg* p_msg, char* foo, char* bar) { struct cell *t; if (t_check( p_msg , 0 )==-1) return 1; t=get_t(); if (t) { if (p_msg->REQ_METHOD==METHOD_ACK) { LOG(L_WARN, "WARNING: : ACKs transmit_replies not replied\n"); return -1; } return t_retransmit_reply( t ); } else return -1; }
/* script function, returns: 1 if the transaction was canceled, -1 if not */ int t_is_canceled(struct sip_msg* msg, char* foo, char* bar) { struct cell *t; int ret; if (t_check( msg , 0 )==-1) return -1; t=get_t(); if ((t==0) || (t==T_UNDEFINED)){ LOG(L_ERR, "ERROR: t_is_canceled: cannot check a message " "for which no T-state has been established\n"); ret=-1; }else{ ret=(t->flags & T_CANCELED)?1:-1; } return ret; }