本文整理汇总了C++中run_top_route函数的典型用法代码示例。如果您正苦于以下问题:C++ run_top_route函数的具体用法?C++ run_top_route怎么用?C++ run_top_route使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_top_route函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ht_expired_run_event_route
void ht_expired_run_event_route(int routeid)
{
int backup_rt;
sip_msg_t *fmsg;
if (routeid < 0 || event_rt.rlist[routeid] == NULL)
{
LM_DBG("route does not exist\n");
return;
}
if (faked_msg_init() < 0)
{
LM_ERR("faked_msg_init() failed\n");
return;
}
fmsg = faked_msg_next();
fmsg->parsed_orig_ruri_ok = 0;
backup_rt = get_route_type();
set_route_type(EVENT_ROUTE);
run_top_route(event_rt.rlist[routeid], fmsg, 0);
set_route_type(backup_rt);
}
示例2: evapi_run_cfg_route
int evapi_run_cfg_route(evapi_env_t *evenv, int rt)
{
int backup_rt;
struct run_act_ctx ctx;
sip_msg_t *fmsg;
sip_msg_t tmsg;
if(evenv==0 || evenv->eset==0) {
LM_ERR("evapi env not set\n");
return -1;
}
if(rt<0)
return 0;
fmsg = faked_msg_next();
memcpy(&tmsg, fmsg, sizeof(sip_msg_t));
fmsg = &tmsg;
evapi_set_msg_env(fmsg, evenv);
backup_rt = get_route_type();
set_route_type(EVENT_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(event_rt.rlist[rt], fmsg, 0);
set_route_type(backup_rt);
evapi_set_msg_env(fmsg, NULL);
return 0;
}
示例3: tcpops_tcp_closed_run_route
static void tcpops_tcp_closed_run_route(struct tcp_connection *con)
{
int rt, backup_rt;
struct run_act_ctx ctx;
sip_msg_t *fmsg;
LM_DBG("tcp_closed_run_route event_route[tcp:closed]\n");
rt = route_get(&event_rt, "tcp:closed");
if (rt < 0 || event_rt.rlist[rt] == NULL)
{
LM_DBG("route does not exist");
return;
}
if (faked_msg_init() < 0)
{
LM_ERR("faked_msg_init() failed\n");
return;
}
fmsg = faked_msg_next();
fmsg->rcv = con->rcv;
backup_rt = get_route_type();
set_route_type(EVENT_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(event_rt.rlist[rt], fmsg, 0);
set_route_type(backup_rt);
}
示例4: nsq_consumer_fire_event
int nsq_consumer_fire_event(char *routename)
{
struct sip_msg *fmsg;
struct run_act_ctx ctx;
int rtb, rt;
LM_DBG("searching event_route[%s]\n", routename);
rt = route_get(&event_rt, routename);
if (rt < 0 || event_rt.rlist[rt] == NULL) {
LM_DBG("route %s does not exist\n", routename);
return -2;
}
LM_DBG("executing event_route[%s] (%d)\n", routename, rt);
if (faked_msg_init()<0) {
return -2;
}
fmsg = faked_msg_next();
rtb = get_route_type();
set_route_type(REQUEST_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(event_rt.rlist[rt], fmsg, 0);
set_route_type(rtb);
return 0;
}
示例5: run_resume_route
static inline void run_resume_route( int resume_route, struct sip_msg *msg)
{
/* run the resume route and if it ends the msg handling (no other aysnc
* started), run the post script callbacks. */
if ( (run_top_route(rlist[resume_route].a, msg) & ACT_FL_TBCONT) == 0 )
exec_post_req_cb(msg);
}
示例6: uac_req_run_event_route
void uac_req_run_event_route(sip_msg_t *msg, uac_send_info_t *tp, int rcode)
{
char *evrtname = "uac:reply";
int rt, backup_rt;
struct run_act_ctx ctx;
sip_msg_t *fmsg;
rt = route_get(&event_rt, evrtname);
if (rt < 0 || event_rt.rlist[rt] == NULL)
{
LM_DBG("event_route[uac:reply] does not exist\n");
return;
}
uac_send_info_copy(tp, &_uac_req);
_uac_req.evcode = rcode;
if(msg==NULL)
{
_uac_req.evtype = 2;
fmsg = faked_msg_get_next();
} else {
_uac_req.evtype = 1;
fmsg = msg;
}
backup_rt = get_route_type();
set_route_type(REQUEST_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(event_rt.rlist[rt], fmsg, 0);
set_route_type(backup_rt);
}
示例7: ht_expired_run_event_route
void ht_expired_run_event_route(char *route)
{
int rt, backup_rt;
sip_msg_t *fmsg;
if (route == NULL)
{
LM_ERR("bad route\n");
}
LM_DBG("ht_expired_run_event_route event_route[%s]\n", route);
rt = route_get(&event_rt, route);
if (rt < 0 || event_rt.rlist[rt] == NULL)
{
LM_DBG("route does not exist");
return;
}
if (faked_msg_init() < 0)
{
LM_ERR("faked_msg_init() failed\n");
return;
}
fmsg = faked_msg_next();
fmsg->parsed_orig_ruri_ok = 0;
backup_rt = get_route_type();
set_route_type(EVENT_ROUTE);
run_top_route(event_rt.rlist[rt], fmsg, 0);
set_route_type(backup_rt);
}
示例8: fire_init_event
static int fire_init_event(int rank)
{
struct sip_msg *fmsg;
struct run_act_ctx ctx;
int rtb, rt;
LM_DBG("rank is (%d)\n", rank);
if (rank!=PROC_INIT)
return 0;
rt = route_get(&event_rt, "kazoo:mod-init");
if(rt>=0 && event_rt.rlist[rt]!=NULL) {
LM_DBG("executing event_route[kazoo:mod-init] (%d)\n", rt);
if(faked_msg_init()<0)
return -1;
fmsg = faked_msg_next();
rtb = get_route_type();
set_route_type(REQUEST_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(event_rt.rlist[rt], fmsg, &ctx);
if(ctx.run_flags&DROP_R_F)
{
LM_ERR("exit due to 'drop' in event route\n");
return -1;
}
set_route_type(rtb);
}
return 0;
}
示例9: wsconn_run_route
static void wsconn_run_route(ws_connection_t *wsc)
{
int rt, backup_rt;
struct run_act_ctx ctx;
sip_msg_t *fmsg;
LM_DBG("wsconn_run_route event_route[websocket:closed]\n");
rt = route_get(&event_rt, "websocket:closed");
if (rt < 0 || event_rt.rlist[rt] == NULL)
{
LM_DBG("route does not exist");
return;
}
if (faked_msg_init() < 0)
{
LM_ERR("faked_msg_init() failed\n");
return;
}
fmsg = faked_msg_next();
wsc->rcv.proto_reserved1 = wsc->id;
fmsg->rcv = wsc->rcv;
backup_rt = get_route_type();
set_route_type(REQUEST_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(event_rt.rlist[rt], fmsg, 0);
set_route_type(backup_rt);
}
示例10: scriptroute_raise
static int scriptroute_raise(struct sip_msg *msg, str* ev_name,
evi_reply_sock *sock, evi_params_t *params)
{
evi_params_t * backup_params;
str * backup_name;
if (!sock || !(sock->flags & EVI_PARAMS)) {
LM_ERR("no socket found\n");
return -1;
}
/* check the socket type */
if (!(sock->flags & SCRIPTROUTE_FLAG)) {
LM_ERR("invalid socket type\n");
return -1;
}
/* save the previous parameters */
backup_params = parameters;
backup_name = event_name;
parameters = params;
event_name = ev_name;
run_top_route(event_rlist[SR_SOCK_ROUTE(sock)].a, msg);
/* restore previous parameters */
parameters = backup_params;
event_name = backup_name;
return 0;
}
示例11: route_timer_f
void route_timer_f(unsigned int ticks, void* param)
{
struct action* a = (struct action*)param;
static struct sip_msg* req= NULL;
if(req == NULL)
{
req = (struct sip_msg*)pkg_malloc(sizeof(struct sip_msg));
if(req == NULL)
{
LM_ERR("No more memory\n");
return;
}
memset(req, 0, sizeof(struct sip_msg));
req->first_line.type = SIP_REQUEST;
req->first_line.u.request.method.s= "DUMMY";
req->first_line.u.request.method.len= 5;
req->first_line.u.request.uri.s= "sip:[email protected]";
req->first_line.u.request.uri.len= 19;
}
if(a == NULL) {
LM_ERR("NULL action\n");
return;
}
run_top_route(a, req);
/* clean whatever extra structures were added by script functions */
free_sip_msg(req);
/* remove all added AVP - here we use all the time the default AVP list */
reset_avps( );
}
示例12: evrexec_process
void evrexec_process(evrexec_task_t *it, int idx)
{
sip_msg_t *fmsg;
sr_kemi_eng_t *keng = NULL;
str sidx = STR_NULL;
if(it!=NULL) {
fmsg = faked_msg_next();
set_route_type(LOCAL_ROUTE);
if(it->wait>0) sleep_us(it->wait);
keng = sr_kemi_eng_get();
if(keng==NULL) {
if(it->rtid>=0 && event_rt.rlist[it->rtid]!=NULL) {
run_top_route(event_rt.rlist[it->rtid], fmsg, 0);
} else {
LM_WARN("empty event route block [%.*s]\n",
it->ename.len, it->ename.s);
}
} else {
sidx.s = int2str(idx, &sidx.len);
if(sr_kemi_route(keng, fmsg, EVENT_ROUTE,
&it->ename, &sidx)<0) {
LM_ERR("error running event route kemi callback\n");
}
}
}
/* avoid exiting the process */
while(1) { sleep(3600); }
}
示例13: rpc_evr_run
void rpc_evr_run(rpc_t *rpc, void *c)
{
str evr_name = STR_NULL;
str evr_data = STR_NULL;
int ret = 0;
int evr_id = -1;
sr_kemi_eng_t *keng = NULL;
sip_msg_t *fmsg = NULL;
int rtbk = 0;
char evr_buf[2];
ret = rpc->scan(c, "s*s", &evr_name.s, &evr_data.s);
if(ret<1) {
LM_ERR("failed getting the parameters");
rpc->fault(c, 500, "Invalid parameters");
return;
}
evr_name.len = strlen(evr_name.s);
if(ret<2) {
evr_buf[0] = '\0';
evr_data.s = evr_buf;
evr_data.len = 0;
} else {
evr_data.len = strlen(evr_data.s);
}
pv_evr_data = &evr_data;
keng = sr_kemi_eng_get();
if(keng==NULL) {
evr_id = route_lookup(&event_rt, evr_name.s);
if(evr_id == -1) {
pv_evr_data = NULL;
LM_ERR("event route not found: %.*s\n", evr_name.len, evr_name.s);
rpc->fault(c, 500, "Event route not found");
return;
}
} else {
evr_id = -1;
}
fmsg = faked_msg_next();
rtbk = get_route_type();
set_route_type(LOCAL_ROUTE);
if(evr_id>=0) {
if(event_rt.rlist[evr_id]!=NULL) {
run_top_route(event_rt.rlist[evr_id], fmsg, 0);
} else {
LM_WARN("empty event route block [%.*s]\n",
evr_name.len, evr_name.s);
}
} else {
if(sr_kemi_route(keng, fmsg, EVENT_ROUTE, &evr_name, &evr_data)<0) {
LM_ERR("error running event route kemi callback\n");
}
}
set_route_type(rtbk);
pv_evr_data = NULL;
}
示例14: run_failure_handlers
/* return 1 if a failure_route processes */
static inline int run_failure_handlers(struct cell *t)
{
static struct sip_msg faked_req;
struct sip_msg *shmem_msg;
struct ua_client *uac;
int on_failure;
shmem_msg = t->uas.request;
uac = &t->uac[picked_branch];
/* failure_route for a local UAC? */
if (!shmem_msg || REQ_LINE(shmem_msg).method_value==METHOD_CANCEL ) {
LM_WARN("no UAC or CANCEL support (%d, %d) \n",
t->on_negative, t->tmcb_hl.reg_types);
return 0;
}
/* don't start faking anything if we don't have to */
if ( !has_tran_tmcbs( t, TMCB_ON_FAILURE) && !t->on_negative ) {
LM_WARN("no negative handler (%d, %d)\n",t->on_negative,
t->tmcb_hl.reg_types);
return 1;
}
if (!fake_req(&faked_req, shmem_msg, &t->uas, uac)) {
LM_ERR("fake_req failed\n");
return 0;
}
/* fake also the env. conforming to the fake msg */
faked_env( t, &faked_req);
/* DONE with faking ;-) -> run the failure handlers */
if ( has_tran_tmcbs( t, TMCB_ON_FAILURE) ) {
run_trans_callbacks( TMCB_ON_FAILURE, t, &faked_req,
uac->reply, uac->last_received);
}
if (t->on_negative) {
/* update flags in transaction if changed by callbacks */
shmem_msg->flags = faked_req.flags;
/* avoid recursion -- if failure_route forwards, and does not
* set next failure route, failure_route will not be reentered
* on failure */
on_failure = t->on_negative;
t->on_negative=0;
/* run a reply_route action if some was marked */
run_top_route(failure_rlist[on_failure].a, &faked_req);
}
/* restore original environment and free the fake msg */
faked_env( t, 0);
free_faked_req(&faked_req,t);
/* if failure handler changed flag, update transaction context */
shmem_msg->flags = faked_req.flags;
/* branch flags do not need to be updated as this branch will be never
* used again */
return 1;
}
示例15: run_pike_route
int run_pike_route( struct sip_msg *msg, void *rt ) {
/* the check was dropped */
if ( run_top_route( rlist[(int)(long)rt].a, msg)&ACT_FL_DROP)
return SCB_RUN_ALL;
/* run the check */
if (pike_check_req(msg)<0)
return SCB_DROP_MSG;
return SCB_RUN_ALL;
}