rem: t->cseq_n.s=w; t->cseq_n.len=CSEQ_LEN+UAC_CSEQNR_LEN; memapp( w, CSEQ UAC_CSEQNR " ", CSEQ_LEN + UAC_CSEQNR_LEN+ 1 );
add: t->cseq_n.s=w; t->cseq_n.len=CSEQ_LEN+cseq_str_len; memapp(w, CSEQ, CSEQ_LEN ); memapp(w, cseq_str, cseq_str_len ); memapp(w, " ", 1 );
context: char *build_uac_request(  str msg_type, str dst, str from,    	str headers, str body, int branch, 		struct cell *t, unsigned int *len){	char *via;	unsigned int via_len;	char content_len[10];	int content_len_len;	char *buf;	char *w;	int dummy;	char branch_buf[MAX_BRANCH_PARAM_LEN];	int branch_len;	int from_len;	char *from_str;	buf=0;	if (from.len) {		from_len=from.len;		from_str=from.s;	} else {		from_len=strlen(uac_from);		from_str=uac_from;	}		*len=SIP_VERSION_LEN+msg_type.len+2/*spaces*/+CRLF_LEN+		dst.len;	if (!t_calc_branch(t, branch, branch_buf, &branch_len )) {		LOG(L_ERR, "ERROR: build_uac_request: branch calculation failed\n");		goto error;	}	via=via_builder(&via_len, t->uac[branch].request.send_sock,		branch_buf, branch_len );		if (!via) {		LOG(L_ERR, "ERROR: build_uac_request: via building failed\n");		goto error;	}	*len+=via_len;	/* content length */	content_len_len=snprintf(		content_len, sizeof(content_len), "%d", body.len );	/* header names and separators */	*len+=		+CSEQ_LEN+CRLF_LEN		+TO_LEN+CRLF_LEN		+CALLID_LEN+CRLF_LEN		+CONTENT_LENGTH_LEN+CRLF_LEN		+ (server_signature ? USER_AGENT_LEN + CRLF_LEN : 0 )		+FROM_LEN+CRLF_LEN		+CRLF_LEN; /* EoM */	/* header field value and body length */	*len+= msg_type.len+1+UAC_CSEQNR_LEN /* CSeq: method, delimitor, number  */		+ dst.len /* To */		+ RAND_DIGITS+1+MAX_PID_LEN+1+MAX_SEQ_LEN /* call-id */		+ from_len+FROMTAG_LEN+MD5_LEN+		+ content_len_len		+ headers.len		+ body.len;		buf=shm_malloc( *len+1 );	if (!buf) {		LOG(L_ERR, "ERROR: t_uac: no shmem\n");		goto error1;	}	w=buf;	memapp( w, msg_type.s, msg_type.len ); 	memapp( w, " ", 1); 	t->uac[branch].uri.s=w; t->uac[branch].uri.len=dst.len;	memapp( w, dst.s, dst.len ); 	memapp( w, " " SIP_VERSION CRLF, 1+SIP_VERSION_LEN+CRLF_LEN );	memapp( w, via, via_len );	t->cseq_n.s=w; t->cseq_n.len=CSEQ_LEN+UAC_CSEQNR_LEN;	memapp( w, CSEQ UAC_CSEQNR " ", CSEQ_LEN + UAC_CSEQNR_LEN+ 1 );	memapp( w, msg_type.s, msg_type.len );	t->to.s=w+CRLF_LEN; t->to.len=TO_LEN+dst.len;	memapp( w, CRLF TO, CRLF_LEN + TO_LEN  );	memapp( w, dst.s, dst.len );	t->callid.s=w+CRLF_LEN; t->callid.len=CALLID_LEN+RAND_DIGITS+1+		MAX_PID_LEN+1+MAX_SEQ_LEN;	memapp( w, CRLF CALLID, CRLF_LEN + CALLID_LEN  );	memapp( w, call_id, RAND_DIGITS+1+MAX_PID_LEN+1+MAX_SEQ_LEN );	memapp( w, CRLF CONTENT_LEN, CRLF_LEN + CONTENT_LEN_LEN);	memapp( w, content_len, content_len_len );	if (server_signature) {		memapp( w, CRLF USER_AGENT CRLF FROM, 			CRLF_LEN+USER_AGENT_LEN+CRLF_LEN+FROM_LEN);	} else {		memapp( w, CRLF  FROM, 			CRLF_LEN+FROM_LEN);	}	t->from.s=w-FROM_LEN; t->from.len=FROM_LEN+from_len+FROMTAG_LEN+MD5_LEN;	memapp( w, from_str, from_len );	memapp( w, FROMTAG, FROMTAG_LEN );	memapp( w, from_tag, MD5_LEN );	memapp( w, CRLF, CRLF_LEN );	memapp( w, headers.s, headers.len );	/* EoH */	memapp( w, CRLF, CRLF_LEN );	if ( body.s ) {		memapp( w, body.s, body.len );	}	/* ugly HACK -- debugging has shown len shorter by one */	dummy=*len+1;	*len=dummy;#	ifdef EXTRA_DEBUG	if (w-buf != *len ) abort();#	endif		error1:	pkg_free(via);	error:	return buf;	}