本文整理汇总了C++中dlg_release函数的典型用法代码示例。如果您正苦于以下问题:C++ dlg_release函数的具体用法?C++ dlg_release怎么用?C++ dlg_release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dlg_release函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dlg_cfg_cb
int dlg_cfg_cb(sip_msg_t *msg, unsigned int flags, void *cbp)
{
dlg_cell_t *dlg;
if(flags&POST_SCRIPT_CB) {
dlg = dlg_get_ctx_dialog();
if(dlg!=NULL) {
if(_dlg_ctx.t==0 && (dlg->state==DLG_STATE_UNCONFIRMED
|| _dlg_ctx.expect_t==1)) {
if(_dlg_ctx.cpid!=0 && _dlg_ctx.cpid==my_pid()) {
/* release to destroy dialog if created by this process
* and request was not forwarded */
if(dlg->state==DLG_STATE_UNCONFIRMED) {
LM_DBG("new dialog with no transaction after config"
" execution\n");
} else {
LM_DBG("dialog with no expected transaction after"
" config execution\n");
}
dlg_release(dlg);
}
}
/* get ctx dlg increased ref count - release now */
dlg_release(dlg);
}
}
memset(&_dlg_ctx, 0, sizeof(dlg_ctx_t));
return 1;
}
示例2: w_dlg_bye
static int w_dlg_bye(struct sip_msg *msg, char *side, char *s2)
{
dlg_cell_t *dlg = NULL;
int n;
dlg = dlg_get_ctx_dialog();
if(dlg==NULL)
return -1;
n = (int)(long)side;
if(n==1)
{
if(dlg_bye(dlg, NULL, DLG_CALLER_LEG)!=0)
goto error;
goto done;
} else if(n==2) {
if(dlg_bye(dlg, NULL, DLG_CALLEE_LEG)!=0)
goto error;
goto done;
} else {
if(dlg_bye_all(dlg, NULL)!=0)
goto error;
goto done;
}
done:
dlg_release(dlg);
return 1;
error:
dlg_release(dlg);
return -1;
}
示例3: unset_dlg_profile
/*!
* \brief Unset a dialog profile
* \param msg SIP message
* \param value value
* \param profile dialog profile table
* \return 1 on success, -1 on failure
*/
int unset_dlg_profile(sip_msg_t *msg, str *value,
dlg_profile_table_t *profile)
{
dlg_cell_t *dlg;
dlg_profile_link_t *linker;
dlg_profile_link_t *linker_prev;
dlg_entry_t *d_entry;
if (is_route_type(REQUEST_ROUTE)) {
LM_ERR("dialog delete profile cannot be used in request route\n");
return -1;
}
/* get current dialog */
dlg = dlg_get_msg_dialog(msg);
if (dlg==NULL) {
LM_WARN("dialog is NULL for delete profile\n");
return -1;
}
/* check the dialog linkers */
d_entry = &d_table->entries[dlg->h_entry];
dlg_lock( d_table, d_entry);
linker = dlg->profile_links;
linker_prev = NULL;
for( ; linker ; linker_prev=linker,linker=linker->next) {
if (linker->profile==profile) {
if (profile->has_value==0) {
goto found;
} else if (value && value->len==linker->hash_linker.value.len &&
memcmp(value->s,linker->hash_linker.value.s,value->len)==0){
goto found;
}
/* allow further search - maybe the dialog is inserted twice in
* the same profile, but with different values -bogdan
*/
}
}
atomic_or_int((volatile int*)&dlg->dflags, DLG_FLAG_CHANGED_PROF);
dlg_unlock( d_table, d_entry);
dlg_release(dlg);
return -1;
found:
/* table still locked */
/* remove the linker element from dialog */
if (linker_prev==NULL) {
dlg->profile_links = linker->next;
} else {
linker_prev->next = linker->next;
}
linker->next = NULL;
dlg_unlock( d_table, d_entry);
/* remove linker from profile table and free it */
destroy_linkers(linker);
dlg_release(dlg);
return 1;
}
示例4: update_dlg_timeout
int update_dlg_timeout(dlg_cell_t *dlg, int timeout)
{
if(update_dlg_timer(&dlg->tl, timeout) < 0) {
LM_ERR("failed to update dialog lifetime\n");
dlg_release(dlg);
return -1;
}
dlg->lifetime = timeout;
dlg->dflags |= DLG_FLAG_CHANGED;
dlg_release(dlg);
return 0;
}
示例5: dlg_onreq
/*!
* \brief Function that is registered as TM callback and called on requests
* \see dlg_new_dialog
* \param t transaction, used to created the dialog
* \param type type of the entered callback
* \param param saved dialog structure in the callback
*/
void dlg_onreq(struct cell* t, int type, struct tmcb_params *param)
{
sip_msg_t *req = param->req;
dlg_cell_t *dlg = NULL;
if(req->first_line.u.request.method_value != METHOD_INVITE)
return;
dlg = dlg_get_ctx_dialog();
if (dlg!=NULL) {
if (!initial_cbs_inscript) {
if (spiral_detected == 1)
run_dlg_callbacks( DLGCB_SPIRALED, dlg,
req, NULL, DLG_DIR_DOWNSTREAM, 0);
else if (spiral_detected == 0)
run_create_callbacks(dlg, req);
}
}
if (dlg==NULL) {
if((req->flags&dlg_flag)!=dlg_flag)
return;
dlg_new_dialog(req, t, 1);
dlg = dlg_get_ctx_dialog();
}
if (dlg!=NULL) {
dlg_set_tm_callbacks(t, req, dlg, spiral_detected);
dlg_release(dlg);
}
}
示例6: w_dlg_isflagset
static int w_dlg_isflagset(struct sip_msg *msg, char *flag, str *s2)
{
dlg_ctx_t *dctx;
dlg_cell_t *d;
int val;
int ret;
if(fixup_get_ivalue(msg, (gparam_p)flag, &val)!=0)
{
LM_ERR("no flag value\n");
return -1;
}
if(val<0 || val>31)
return -1;
if ( (dctx=dlg_get_dlg_ctx())==NULL )
return -1;
d = dlg_get_by_iuid(&dctx->iuid);
if(d!=NULL) {
ret = (d->sflags&(1<<val))?1:-1;
dlg_release(d);
return ret;
}
return (dctx->flags&(1<<val))?1:-1;
}
示例7: dlg_ka_run
/**
* run keep-alive list
*
*/
int dlg_ka_run(ticks_t ti)
{
dlg_ka_t *dka;
dlg_cell_t *dlg;
if(dlg_ka_interval<=0)
return 0;
while(1) {
/* get head item */
lock_get(dlg_ka_list_lock);
if(*dlg_ka_list_head==NULL) {
lock_release(dlg_ka_list_lock);
return 0;
}
dka = *dlg_ka_list_head;
#if 0
LM_DBG("dlg ka timer at %lu for"
" dlg[%u,%u] on %lu\n", (unsigned long)ti,
dka->iuid.h_entry, dka->iuid.h_id,
(unsigned long)dka->katime);
#endif
if(dka->katime>ti) {
lock_release(dlg_ka_list_lock);
return 0;
}
if(*dlg_ka_list_head == *dlg_ka_list_tail) {
*dlg_ka_list_head = NULL;
*dlg_ka_list_tail = NULL;
}
*dlg_ka_list_head = dka->next;
lock_release(dlg_ka_list_lock);
/* send keep-alive for dka */
dlg = dlg_get_by_iuid(&dka->iuid);
if(dlg==NULL) {
shm_free(dka);
dka = NULL;
} else {
if(dka->iflags & DLG_IFLAG_KA_SRC)
dlg_send_ka(dlg, DLG_CALLER_LEG, 0);
if(dka->iflags & DLG_IFLAG_KA_DST)
dlg_send_ka(dlg, DLG_CALLEE_LEG, 0);
dlg_release(dlg);
}
/* append to tail */
if(dka!=NULL)
{
lock_get(dlg_ka_list_lock);
if(*dlg_ka_list_tail!=NULL)
(*dlg_ka_list_tail)->next = dka;
if(*dlg_ka_list_head==NULL)
*dlg_ka_list_head = dka;
*dlg_ka_list_tail = dka;
lock_release(dlg_ka_list_lock);
}
}
return 0;
}
示例8: dlg_seq_onreply_helper
/*!
* \brief Helper function that run dialog callbacks on forwarded requests
* \see dlg_seq_up_onreply
* \see dlg_seq_down_onreply
* \param t transaction, unused
* \param type type of the callback, should be TMCB_RESPONSE_FWDED
* \param param saved dialog structure inside the callback
* \param direction direction of the request
*/
static void dlg_seq_onreply_helper(struct cell* t, int type,
struct tmcb_params *param, const int direction)
{
dlg_cell_t *dlg = NULL;
dlg_iuid_t *iuid = NULL;
if (shutdown_done)
return;
iuid = (dlg_iuid_t*)(*param->param);
dlg = dlg_get_by_iuid(iuid);
if (dlg==0)
return;
if (type==TMCB_RESPONSE_FWDED)
{
run_dlg_callbacks( DLGCB_RESPONSE_WITHIN,
dlg,
param->req,
param->rpl,
direction,
0);
}
dlg_release(dlg);
return;
}
示例9: dlg_manage
int dlg_manage(sip_msg_t *msg)
{
str tag;
int backup_mode;
dlg_cell_t *dlg = NULL;
tm_cell_t *t = NULL;
if( (msg->to==NULL && parse_headers(msg, HDR_TO_F,0)<0) || msg->to==NULL )
{
LM_ERR("bad TO header\n");
return -1;
}
tag = get_to(msg)->tag_value;
if(tag.s!=0 && tag.len!=0)
{
backup_mode = seq_match_mode;
seq_match_mode = SEQ_MATCH_NO_ID;
dlg_onroute(msg, NULL, NULL);
seq_match_mode = backup_mode;
} else {
t = d_tmb.t_gett();
if(t==T_UNDEFINED)
t = NULL;
if(dlg_new_dialog(msg, t, initial_cbs_inscript)!=0)
return -1;
dlg = dlg_get_ctx_dialog();
if(dlg==NULL)
return -1;
if(t!=NULL)
dlg_set_tm_callbacks(t, msg, dlg, spiral_detected);
dlg_release(dlg);
}
return 1;
}
示例10: dlg_terminated_confirmed
/*!
* \brief Function that executes BYE reply callbacks
* \param t transaction, unused
* \param type type of the callback, should be TMCB_RESPONSE_FWDED
* \param params saved dialog structure inside the callback
*/
static void dlg_terminated_confirmed(tm_cell_t *t, int type,
struct tmcb_params* params)
{
dlg_cell_t *dlg = NULL;
dlg_iuid_t *iuid = NULL;
if(!params || !params->req || !params->param)
{
LM_ERR("invalid parameters!\n");
return;
}
iuid = (dlg_iuid_t*)*params->param;
if(iuid==NULL)
return;
dlg = dlg_get_by_iuid(iuid);
if(dlg==NULL)
{
LM_ERR("failed to get dialog from params!\n");
return;
}
/* dialog termination confirmed (BYE reply) */
run_dlg_callbacks(DLGCB_TERMINATED_CONFIRMED,
dlg,
params->req,
params->rpl,
DLG_DIR_UPSTREAM,
0);
dlg_release(dlg);
}
示例11: rpc_end_dlg_entry_id
static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
unsigned int h_entry, h_id;
dlg_cell_t * dlg = NULL;
str rpc_extra_hdrs = {NULL,0};
int n;
n = rpc->scan(c, "dd", &h_entry, &h_id);
if (n < 2) {
LM_ERR("unable to read the parameters (%d)\n", n);
rpc->fault(c, 500, "Invalid parameters");
return;
}
if(rpc->scan(c, "*S", &rpc_extra_hdrs)<1)
{
rpc_extra_hdrs.s = NULL;
rpc_extra_hdrs.len = 0;
}
dlg = dlg_lookup(h_entry, h_id);
if(dlg==NULL) {
rpc->fault(c, 404, "Dialog not found");
return;
}
dlg_bye_all(dlg, (rpc_extra_hdrs.len>0)?&rpc_extra_hdrs:NULL);
dlg_release(dlg);
}
示例12: w_dlg_set_property
static int w_dlg_set_property(struct sip_msg *msg, char *prop, char *s2)
{
dlg_ctx_t *dctx;
dlg_cell_t *d;
str val;
if(fixup_get_svalue(msg, (gparam_t*)prop, &val)!=0)
{
LM_ERR("no property value\n");
return -1;
}
if(val.len<=0)
{
LM_ERR("empty property value\n");
return -1;
}
if ( (dctx=dlg_get_dlg_ctx())==NULL )
return -1;
if(val.len==6 && strncmp(val.s, "ka-src", 6)==0) {
dctx->iflags |= DLG_IFLAG_KA_SRC;
d = dlg_get_by_iuid(&dctx->iuid);
if(d!=NULL) {
d->iflags |= DLG_IFLAG_KA_SRC;
dlg_release(d);
}
} else if(val.len==6 && strncmp(val.s, "ka-dst", 6)==0) {
dctx->iflags |= DLG_IFLAG_KA_DST;
d = dlg_get_by_iuid(&dctx->iuid);
if(d!=NULL) {
d->iflags |= DLG_IFLAG_KA_DST;
dlg_release(d);
}
} else if(val.len==15 && strncmp(val.s, "timeout-noreset", 15)==0) {
dctx->iflags |= DLG_IFLAG_TIMER_NORESET;
d = dlg_get_by_iuid(&dctx->iuid);
if(d!=NULL) {
d->iflags |= DLG_IFLAG_TIMER_NORESET;
dlg_release(d);
}
} else {
LM_ERR("unknown property value [%.*s]\n", val.len, val.s);
return -1;
}
return 1;
}
示例13: pv_get_dlg_variable
int pv_get_dlg_variable(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
{
dlg_cell_t *dlg;
str * value;
str spv;
if (param==NULL || param->pvn.type!=PV_NAME_INTSTR
|| param->pvn.u.isname.type!=AVP_NAME_STR
|| param->pvn.u.isname.name.s.s==NULL) {
LM_CRIT("BUG - bad parameters\n");
return -1;
}
/* Retrieve the dialog for current message */
dlg=dlg_get_msg_dialog( msg);
if (dlg) {
/* Lock the dialog */
dlg_lock(d_table, &(d_table->entries[dlg->h_entry]));
} else {
/* Verify the local list */
get_local_varlist_pointer(msg, 0);
}
/* dcm: todo - the value should be cloned for safe usage */
value = get_dlg_variable_unsafe(dlg, ¶m->pvn.u.isname.name.s);
spv.s = NULL;
if(value) {
spv.len = pv_get_buffer_size();
if(spv.len<value->len+1) {
LM_ERR("pv buffer too small (%d) - needed %d\n", spv.len, value->len);
} else {
spv.s = pv_get_buffer();
strncpy(spv.s, value->s, value->len);
spv.len = value->len;
spv.s[spv.len] = '\0';
}
}
print_lists(dlg);
/* unlock dialog */
if (dlg) {
dlg_unlock(d_table, &(d_table->entries[dlg->h_entry]));
dlg_release(dlg);
}
if (spv.s)
return pv_get_strval(msg, param, res, &spv);
return pv_get_null(msg, param, res);
}
示例14: w_dlg_get
static int w_dlg_get(struct sip_msg *msg, char *ci, char *ft, char *tt)
{
dlg_cell_t *dlg = NULL;
str sc = {0,0};
str sf = {0,0};
str st = {0,0};
unsigned int dir = 0;
if(ci==0 || ft==0 || tt==0)
{
LM_ERR("invalid parameters\n");
return -1;
}
if(fixup_get_svalue(msg, (gparam_p)ci, &sc)!=0)
{
LM_ERR("unable to get Call-ID\n");
return -1;
}
if(sc.s==NULL || sc.len == 0)
{
LM_ERR("invalid Call-ID parameter\n");
return -1;
}
if(fixup_get_svalue(msg, (gparam_p)ft, &sf)!=0)
{
LM_ERR("unable to get From tag\n");
return -1;
}
if(sf.s==NULL || sf.len == 0)
{
LM_ERR("invalid From tag parameter\n");
return -1;
}
if(fixup_get_svalue(msg, (gparam_p)tt, &st)!=0)
{
LM_ERR("unable to get To Tag\n");
return -1;
}
if(st.s==NULL || st.len == 0)
{
LM_ERR("invalid To tag parameter\n");
return -1;
}
dlg = get_dlg(&sc, &sf, &st, &dir);
if(dlg==NULL)
return -1;
/* set shorcut to dialog internal unique id */
_dlg_ctx.iuid.h_entry = dlg->h_entry;
_dlg_ctx.iuid.h_id = dlg->h_id;
_dlg_ctx.dir = dir;
dlg_release(dlg);
return 1;
}
示例15: is_known_dlg
/*
* Determine if message is in a dialog currently being tracked
*/
int is_known_dlg(struct sip_msg *msg) {
dlg_cell_t *dlg;
dlg = dlg_get_msg_dialog(msg);
if(dlg == NULL)
return -1;
dlg_release(dlg);
return 1;
}