当前位置: 首页>>代码示例>>C++>>正文


C++ del_lump函数代码示例

本文整理汇总了C++中del_lump函数的典型用法代码示例。如果您正苦于以下问题:C++ del_lump函数的具体用法?C++ del_lump怎么用?C++ del_lump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了del_lump函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dlg_th_decode_callid

int dlg_th_decode_callid(struct sip_msg *msg)
{
	struct lump *del;
	str new_callid;
	int i,max_size;

	if (msg->callid == NULL) {
		LM_ERR("Message with no callid\n");
		return -1;
	}

	max_size = calc_max_base64_decode_len(msg->callid->body.len - topo_hiding_prefix.len);
	new_callid.s = pkg_malloc(max_size);
	if (new_callid.s==NULL) {
		LM_ERR("No more pkg\n");
		return -1;
	}
		
	new_callid.len = base64decode((unsigned char *)(new_callid.s),
			(unsigned char *)(msg->callid->body.s + topo_hiding_prefix.len),
			msg->callid->body.len - topo_hiding_prefix.len);
	for (i=0;i<new_callid.len;i++)
		new_callid.s[i] ^= topo_hiding_seed.s[i%topo_hiding_seed.len]; 

	del=del_lump(msg, msg->callid->body.s-msg->buf, msg->callid->body.len, HDR_CALLID_T);
	if (del==NULL) {               
		LM_ERR("Failed to delete old callid\n");
		pkg_free(new_callid.s);
		return -1;
	}

	if (insert_new_lump_after(del,new_callid.s,new_callid.len,HDR_CALLID_T)==NULL) {
		LM_ERR("Failed to insert new callid\n");
		pkg_free(new_callid.s);
		return -1;
	}

	return 0;

	return 0;
}
开发者ID:jalung,项目名称:opensips,代码行数:41,代码来源:dlg_tophiding.c

示例2: handle_sr

/*
 * Logic necessary to forward request to strict routers
 *
 * Returns 0 on success, negative number on an error
 */
static inline int handle_sr(struct sip_msg* _m, struct hdr_field* _hdr, rr_t* _r)
{
	str uri;
	char* rem_off;
	int rem_len;

	/* Next hop is strict router, save R-URI here */
	if (save_ruri(_m) < 0) {
		LM_ERR("failed to save Request-URI\n");
		return -1;
	}

	/* Put the first Route in Request-URI */

	uri = _r->nameaddr.uri;
	if(get_maddr_uri(&uri, 0)!=0) {
		LM_ERR("failed to check maddr\n");
		return RR_ERROR;
	}
	if (set_ruri(_m, &uri) < 0) {
		LM_ERR("failed to rewrite request URI\n");
		return -2;
	}

	if (!_r->next) {
		rem_off = _hdr->name.s;
		rem_len = _hdr->len;
	} else {
		rem_off = _hdr->body.s;
		rem_len = _r->next->nameaddr.name.s - _hdr->body.s;
	}

	if (!del_lump(_m, rem_off - _m->buf, rem_len, 0)) {
		LM_ERR("failed to remove Route HF\n");
		return -9;
	}

	_r->deleted = 1;

	return 0;
}
开发者ID:abh-gitcs1989,项目名称:opensips,代码行数:46,代码来源:loose.c

示例3: replace_body_f

static int replace_body_f(struct sip_msg* msg, char* key, char* str2)
{
	struct lump* l;
	regmatch_t pmatch;
	char* s;
	int len;
	char* begin;
	int off;
	str body;

	if ( get_body(msg,&body)!=0 || body.len==0) {
		LM_DBG("message body has zero length\n");
		return -1;
	}

	begin=body.s; /* msg->orig previously .. uri problems */

	if (regexec((regex_t*) key, begin, 1, &pmatch, 0)!=0) return -1;
	off=begin-msg->buf;

	if (pmatch.rm_so!=-1){
		if ((l=del_lump(msg, pmatch.rm_so+off,
						pmatch.rm_eo-pmatch.rm_so, 0))==0)
			return -1;
		len=strlen(str2);
		s=pkg_malloc(len);
		if (s==0){
			LM_ERR("memory allocation failure\n");
			return -1;
		}
		memcpy(s, str2, len);
		if (insert_new_lump_after(l, s, len, 0)==0){
			LM_ERR("could not insert new lump\n");
			pkg_free(s);
			return -1;
		}

		return 1;
	}
	return -1;
}
开发者ID:asitm9,项目名称:opensips,代码行数:41,代码来源:textops.c

示例4: tps_remove_name_headers

int tps_remove_name_headers(sip_msg_t *msg, str *hname)
{
	hdr_field_t *hf;
	struct lump* l;
	for (hf=msg->headers; hf; hf=hf->next)
	{
		if (hf->name.len==hname->len
				&& strncasecmp(hf->name.s, hname->s,
					hname->len)==0)
		{
			l=del_lump(msg, hf->name.s-msg->buf, hf->len, 0);
			if (l==0) {
				LM_ERR("unable to delete header [%.*s]\n",
						hname->len, hname->s);
				return -1;
			}
			return 0;
		}
	}
	return 0;
}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:21,代码来源:tps_msg.c

示例5: remove_minse_header

/**
 * Remove a header from a message if found.
 *
 * @param msg The message to look for the header to remove.
 * @param header The header name: text.
 *
 * @return 0 if the header was not found, >0 is successful, -1 on an
 *         error.
 */
static int remove_minse_header(struct sip_msg *msg)
{
	struct lump* anchor = NULL;
	struct hdr_field *hf = NULL;
	int cnt = 0;

	/* parse all headers as we want to get all MIN-SE headers*/
	if (parse_headers(msg, HDR_EOH_F, 0) == -1) {
		LM_ERR("failed to parse headers in message.\n");
		return(-1);
	}

	for (hf = msg->min_se; hf; hf = hf->sibling) {
		anchor = del_lump(msg, hf->name.s-msg->buf, hf->len, 0);
		if (anchor == 0) {
			LM_ERR("no more pkg memory\n");
			return -1;
		}
		cnt++;
	}
	return cnt;
}
开发者ID:AndreiPlesa,项目名称:opensips,代码行数:31,代码来源:sst_handlers.c

示例6: gzc_set_msg_body

int gzc_set_msg_body(sip_msg_t *msg, str *obody, str *nbody)
{
	struct lump *anchor;
	char* buf;

	/* none should be here - just for safety */
	del_nonshm_lump( &(msg->body_lumps) );
	msg->body_lumps = NULL;

	if(del_lump(msg, obody->s - msg->buf, obody->len, 0) == 0)
	{
		LM_ERR("cannot delete existing body");
		return -1;
	}

	anchor = anchor_lump(msg, obody->s - msg->buf, 0, 0);

	if (anchor == 0)
	{
		LM_ERR("failed to get body anchor\n");
		return -1;
	} 

	buf=pkg_malloc(nbody->len * sizeof(char));
	if (buf==0)
	{
		LM_ERR("out of pkg memory\n");
		return -1;
	}
	memcpy(buf, nbody->s, nbody->len);
	if (insert_new_lump_after(anchor, buf, nbody->len, 0) == 0)
	{
		LM_ERR("failed to insert body lump\n");
		pkg_free(buf);
		return -1;
	}
	return 0;
}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:38,代码来源:gzcompress_mod.c

示例7: lua_sr_hdr_remove

static int lua_sr_hdr_remove (lua_State *L)
{
	struct lump* anchor;
	struct hdr_field *hf;
	char *txt;
	str hname;
	sr_lua_env_t *env_L;

	env_L = sr_lua_env_get();

	txt = (char*)lua_tostring(L, -1);
	if(txt==NULL || env_L->msg==NULL)
		return 0;

	LM_DBG("remove hf: %s\n", txt);
	if (parse_headers(env_L->msg, HDR_EOH_F, 0) == -1) {
		LM_ERR("error while parsing message\n");
		return 0;
	}

	hname.s = txt;
	hname.len = strlen(txt);
	for (hf=env_L->msg->headers; hf; hf=hf->next)
	{
		if (cmp_hdrname_str(&hf->name, &hname)==0)
		{
			anchor=del_lump(env_L->msg,
					hf->name.s - env_L->msg->buf, hf->len, 0);
			if (anchor==0)
			{
				LM_ERR("cannot remove hdr %s\n", txt);
				return 0;
			}
		}
	}
	return 0;
}
开发者ID:aphistic,项目名称:kamailio,代码行数:37,代码来源:app_lua_sr.c

示例8: th_unmask_callid

int th_unmask_callid(sip_msg_t *msg)
{
	struct lump* l;
	str out;
	
	if(th_param_mask_callid==0)
		return 0;
	
	if(msg->callid==NULL)
	{
		LM_ERR("cannot get Call-Id header\n");
		return -1;
	}
				
	out.s = th_mask_decode(msg->callid->body.s, msg->callid->body.len,
					&th_callid_prefix, 0, &out.len);
	if(out.s==NULL)
	{
		LM_ERR("cannot decode callid\n");
		return -1;
	}
				
	l=del_lump(msg, msg->callid->body.s-msg->buf, msg->callid->body.len, 0);
	if (l==0)
	{
		LM_ERR("failed deleting callid\n");
		pkg_free(out.s);
		return -1;
	}
	if (insert_new_lump_after(l, out.s, out.len, 0)==0) {
		LM_ERR("could not insert new lump\n");
		pkg_free(out.s);
		return -1;
	}

	return 0;
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:37,代码来源:th_msg.c

示例9: w_remove_body_f

static int w_remove_body_f(struct sip_msg *msg, char *p1, char *p2)
{
	str body = {0,0};

	body.len = 0;
	body.s = get_body(msg);
	if (body.s==0)
	{
		LM_DBG("no body in the message\n");
		return 1;
	}
	body.len = msg->buf + msg->len - body.s;
	if (body.len<=0)
	{
		LM_DBG("empty body in the message\n");
		return 1;
	}
	if(del_lump(msg, body.s - msg->buf, body.len, 0) == 0)
	{
		LM_ERR("cannot remove body\n");
		return -1;
	}
	return 1;
}
开发者ID:gbour,项目名称:kamailio,代码行数:24,代码来源:textopsx.c

示例10: replace_body_segment

int replace_body_segment(struct sdp_mangler * mangler, int offset, int len, unsigned char * new_data, int new_len)
{
	
	struct lump * l;
	char *s;

	l = del_lump(mangler->msg, mangler->body_offset + offset, len, 0);

	if(l == NULL)
	{
		return -1;
	}

 	s = pkg_malloc(new_len);
	memcpy(s, new_data, new_len);

	if(insert_new_lump_after(l, s, new_len, 0) == 0)
	{
		pkg_free(s);
		return -2;
	}

	return 0;
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:24,代码来源:sdp_mangle.c

示例11: LM_DBG

/**
 * remove_sdp_stream_attrs - removes all attributes from the specified stream
 *
 * @return: struct lump * with the removed information
 */
static struct lump *remove_sdp_stream_attrs(struct sip_msg *msg,
                                      struct sdp_stream_cell *stream)
{
	struct lump *lump;
	char *attrs_end = NULL;

	LM_DBG("Removing all %d codecs from SDP stream: |%.*s|\n",
	       stream->payloads_num, stream->payloads.len, stream->payloads.s);

	/* find the last parsed structure of the last attribute */
	if (stream->payload_attr->fmtp_string.len > 0) {
		attrs_end = stream->payload_attr->fmtp_string.s +
		          stream->payload_attr->fmtp_string.len;
	} else if (stream->payload_attr->rtp_params.len > 0) {
		attrs_end = stream->payload_attr->rtp_params.s +
		          stream->payload_attr->rtp_params.len;
	} else if (stream->payload_attr->rtp_clock.len > 0) {
		attrs_end = stream->payload_attr->rtp_clock.s +
		          stream->payload_attr->rtp_clock.len;
	}

	if (!attrs_end) {
		LM_ERR("invalid SDP stream received\n");
		print_sdp_stream(stream, L_ERR);
		return NULL;
	}

	lump = del_lump(msg, stream->payloads.s - msg->buf,
	                attrs_end - stream->payloads.s, HDR_OTHER_T);
	if (!lump) {
		LM_ERR("failed to add del lump\n");
		return NULL;
	}

	return lump;
}
开发者ID:Distrotech,项目名称:opensips,代码行数:41,代码来源:sngtc.c

示例12: isc_appserver_forward

/**
 * Send the request back simulating an AS. 
 * - Inserts a Header with the contents of str2
 * - Tries to find the Route: appserver_uri, s-cscf_uri header and removes appserver_uri from it
 * - It forwards the message to s-scsf_uri, or if none found to str1
 *	@param msg - The sip message
 *	@param str1 - The uri of the SCSCF to default to if Route header is not found
 *	@param str2 - The Header to add to the message - if empty none will be added
 *	@returns	- 0 to cancel further script processing 
 */
int isc_appserver_forward(struct sip_msg *msg,char *str1,char *str2 )
{
	struct hdr_field *last,*hdr;
	struct lump* anchor;
	str header_mark;
	rr_t *rr;

	LOG(L_DBG,"DEBUG:"M_NAME":isc_appserver_forward: Forward-back request reached\n");
	parse_headers(msg,HDR_EOH_F,0);
	last = msg->headers;
	while(last->next)
		last = last->next;

	LOG(L_INFO,"INFO:"M_NAME":isc_appserver_forward: New header: [%s]\n%.*s",str2,msg->len,msg->buf);
	
    /* Put header marking */

	if (strlen(str2)){
	
		header_mark.s = pkg_malloc(256);//36 should be enough
		sprintf(header_mark.s,"%.*s\n",strlen(str2),str2);
		header_mark.len =strlen(header_mark.s);
	
		anchor = anchor_lump(msg, last->name.s + last->len - msg->buf, 0 , 0);
		if (anchor == NULL) {
				LOG(L_ERR, "ERROR:"M_NAME":isc_appserver_forward: anchor_lump failed\n");
		}
	
		if (!insert_new_lump_before(anchor, header_mark.s,header_mark.len,0)){
				LOG( L_ERR, "ERROR:"M_NAME":isc_appserver_forward: error creting lump for header_mark\n" );
		}
		//pkg_free(header_mark.s);
	}
	LOG(L_ERR, "INFO:"M_NAME":isc_appserver_forward: Searching Route header to rewrite\n");
	/* Search for the Route */
	hdr = msg->headers;
	while(hdr){
		if (hdr->type == HDR_ROUTE_T){
			if (!hdr->parsed){
				if (parse_rr(hdr) < 0) {
					LOG(L_ERR, "ERROR:"M_NAME":isc_appserver_forward: Error while parsing Route HF\n");
					continue;
				}
			}
			rr = (rr_t*)hdr->parsed;
			while(rr){
				if (rr->nameaddr.uri.len >= ISC_MARK_USERNAME_LEN &&
					strncasecmp(rr->nameaddr.uri.s,ISC_MARK_USERNAME,ISC_MARK_USERNAME_LEN)==0)	{
						LOG(L_INFO,"DEBUG:"M_NAME":isc_appserver_forward: Found S-CSCF marking <%.*s> \n",rr->nameaddr.uri.len,rr->nameaddr.uri.s);
						/* delete the header */					
						if (!del_lump(msg, hdr->name.s - msg->buf, hdr->len, 0)) {
							LOG(L_ERR, "ERROR:"M_NAME":isc_appserver_forward: Can't remove Route HF\n");
						}  
										
						/* add the new header */
						anchor = anchor_lump(msg, msg->headers->name.s - msg->buf, 0 , 0);
						header_mark.s = pkg_malloc(256);//36 should be enough
						sprintf(header_mark.s,"Route: <%.*s>\n",rr->nameaddr.uri.len,rr->nameaddr.uri.s);
						header_mark.len =strlen(header_mark.s);	
						if (!insert_new_lump_before(anchor, header_mark.s,header_mark.len,0)){
							LOG( L_ERR, "ERROR:"M_NAME":isc_appserver_forward: error creting lump for route header\n" );
						}	
					/* send the message */
					msg->dst_uri.s = pkg_malloc(rr->nameaddr.uri.len);
					memcpy(msg->dst_uri.s,rr->nameaddr.uri.s,rr->nameaddr.uri.len);
					msg->dst_uri.len=rr->nameaddr.uri.len;
					isc_tmb.t_relay(msg,0,0);
					return 0;
				}					
				rr = rr->next;
			}			
		}
		hdr = hdr->next;
	}
	
	/* In case no suitable route header found, just fwd to the given parameter */
	msg->dst_uri.len = strlen(str1);
	msg->dst_uri.s = str1;
	isc_tmb.t_relay(msg,0,0);
	LOG(L_DBG,"DEBUG:"M_NAME":isc_appserver_forward: Mirror request finished\n");
	return 0;
}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:92,代码来源:mod.c

示例13: assign_hf_do_lumping

static int assign_hf_do_lumping(struct sip_msg* msg,struct hdr_field* hf, struct hname_data* hname, str* value, int upd_del_fl, str* lump_upd, str* lump_del, char delim) {
	int len, i;
	char *s;
	struct lump* anchor;

	if (upd_del_fl) {
		len = value?lump_upd->len:lump_del->len;
		if (len > 0) {
			if (!del_lump(msg, (value?lump_upd->s:lump_del->s)-msg->buf, len, 0)) {
				LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: not enough memory\n");
				return -1;
			}
		}
		if (value && value->len) {
			anchor = anchor_lump(msg, lump_upd->s - msg->buf, 0, 0);
			if (anchor == 0) {
				LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: Can't get anchor\n");
				return -1;
			}

			len = 1+value->len;
			s = pkg_malloc(len);
			if (!s) {
				LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: not enough memory\n");
				return -1;
			}
			s[0]='=';
			memcpy(s+1, value->s, value->len);
			if ( (insert_new_lump_before(anchor, s, len, 0)) == 0) {
				LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: Can't insert lump\n");
				pkg_free(s);
				return -1;
			}
		}
	}
	else {
		if (!value) return -1;

		anchor = anchor_lump(msg, lump_del->s - msg->buf, 0, 0);
		if (anchor == 0) {
			LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: Can't get anchor\n");
			return -1;
		}

		len = 1+hname->param.len+(value->len?value->len+1:0);
		s = pkg_malloc(len);
		if (!s) {
			LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: not enough memory\n");
			return -1;
		}
		if (delim) {
			s[0] = delim;
			i = 1;
		}
		else {
			i = 0;
			len--;
		}
		memcpy(s+i, hname->param.s, hname->param.len);
		if (value->len) {
			s[hname->param.len+i]='=';
			memcpy(s+i+hname->param.len+1, value->s, value->len);
		}

		if ( (insert_new_lump_before(anchor, s, len, 0)) == 0) {
			LOG(L_ERR, "ERROR: textops: assign_hf_do_lumping: Can't insert lump\n");
			pkg_free(s);
			return -1;
		}
	}
	return 1;
}
开发者ID:gbour,项目名称:kamailio,代码行数:72,代码来源:textopsx.c

示例14: force_service_routes

/**
 * Force Service routes (upon request)
 */
int force_service_routes(struct sip_msg* _m, udomain_t* _d) {
	struct hdr_field *it;
	int i;
	str new_route_header;
	struct lump* lmp = NULL;
	char * buf;
	pcontact_t * c = getContactP(_m, _d, PCONTACT_REGISTERED,0 ,0);
//	char srcip[20];
//	str received_host;
        struct via_body* vb;
        unsigned short port;
        unsigned short proto;
	
	// Contact not found => not following service-routes
	if (c == NULL) return -1;

	/* we need to be sure we have seen all HFs */
	parse_headers(_m, HDR_EOH_F, 0);

        vb = cscf_get_ue_via(_m);
        port = vb->port?vb->port:5060;
        proto = vb->proto;
        
	/* Save current buffer */
	buf = _m->buf;

	// Delete old Route headers:
	if (_m->route) {
		for (it = _m->route; it; it = it->next) {
			if (it->type == HDR_ROUTE_T) {
				if ((lmp = del_lump(_m, it->name.s - buf, it->len, HDR_ROUTE_T)) == 0) {
					LM_ERR("del_lump failed \n");
					return -1;
				}
			}
		}
	}

	/* Reset dst_uri if previously set either by loose route or manually */
	if (_m->dst_uri.s && _m->dst_uri.len) {
		pkg_free(_m->dst_uri.s);
		_m->dst_uri.s = NULL;
		_m->dst_uri.len = 0;
	}
	
//	received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
//	received_host.s = srcip;

	/* Lock this record while working with the data: */
	ul.lock_udomain(_d, &vb->host, port, proto);

	if (c->num_service_routes > 0) {
		/* Create anchor for new Route-Header: */
		lmp = anchor_lump(_m, _m->headers->name.s - buf,0,0);
		if (lmp == 0) {
			LM_ERR("Failed to get anchor lump\n");
			goto error;
		}	
		/* Calculate the length: */
		new_route_header.len = route_start.len +
			route_end.len + (c->num_service_routes-1) * route_sep.len;

		for(i=0; i< c->num_service_routes; i++)
			new_route_header.len+=c->service_routes[i].len;		
		/* Allocate the memory for this new header: */
		new_route_header.s = pkg_malloc(new_route_header.len);
		if (!new_route_header.s) {
			LM_ERR("Error allocating %d bytes\n", new_route_header.len);
			goto error;
		}
		
		/* Construct new header */
		new_route_header.len = 0;
		STR_APPEND(new_route_header, route_start);
		for(i=0; i < c->num_service_routes; i++) {
			if (i) STR_APPEND(new_route_header, route_sep);
			STR_APPEND(new_route_header, c->service_routes[i]);
		}
		STR_APPEND(new_route_header, route_end);

		LM_DBG("Setting route header to <%.*s> \n", new_route_header.len, new_route_header.s);

		if ((lmp = insert_new_lump_after(lmp, new_route_header.s, new_route_header.len, HDR_ROUTE_T)) == 0) {
			LM_ERR("Error inserting new route set\n");
			pkg_free(new_route_header.s);
			goto error;
		}

		LM_DBG("Setting dst_uri to <%.*s> \n", c->service_routes[0].len,
			c->service_routes[0].s);

		if (set_dst_uri(_m, &c->service_routes[0]) !=0 ) {
			LM_ERR("Error setting new dst uri\n");
			goto error;
		}
	}
	/* Unlock domain */
//.........这里部分代码省略.........
开发者ID:TheGrandWazoo,项目名称:kamailio,代码行数:101,代码来源:service_routes.c

示例15: th_update_hdr_replaces

int th_update_hdr_replaces(sip_msg_t *msg)
{
	struct hdr_field *hf = NULL;
	str replaces;
	str rcallid;
	struct lump* l;
	str out;

	LM_DBG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
	if(th_param_mask_callid==0)
		return 0;

	if(!((get_cseq(msg)->method_id)&(METHOD_INVITE)))
		return 0;

	for (hf=msg->headers; hf; hf=hf->next)
	{
		if (hf->name.len==8 && strncasecmp(hf->name.s, "Replaces", 8)==0)
			break;
	}

	if(hf==NULL)
		return 0;

	replaces = hf->body;
	trim(&replaces);
	rcallid.s = replaces.s;
	for(rcallid.len=0; rcallid.len<replaces.len; rcallid.len++)
	{
		if(rcallid.s[rcallid.len]==';')
			break;
	}

	if(rcallid.len>th_callid_prefix.len
			&& strncmp(rcallid.s, th_callid_prefix.s, th_callid_prefix.len)==0)
	{
		/* value encoded - decode it */
		out.s = th_mask_decode(rcallid.s, rcallid.len,
					&th_callid_prefix, 0, &out.len);
	} else {
		/* value decoded - encode it */
		out.s = th_mask_encode(rcallid.s, rcallid.len,
				&th_callid_prefix, &out.len);
	}
	if(out.s==NULL)
	{
		LM_ERR("cannot update Replaces callid\n");
		return -1;
	}

	l=del_lump(msg, rcallid.s-msg->buf, rcallid.len, 0);
	if (l==0)
	{
		LM_ERR("failed deleting Replaces callid\n");
		pkg_free(out.s);
		return -1;
	}
	if (insert_new_lump_after(l, out.s, out.len, 0)==0) {
		LM_ERR("could not insert new lump\n");
		pkg_free(out.s);
		return -1;
	}

	return 0;
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:65,代码来源:th_msg.c


注:本文中的del_lump函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。