浏览代码

elderly (un)defs junked (hopefuly the right ones)

Jiri Kuthan 22 年之前
父节点
当前提交
18dbc018c0

+ 1 - 8
action.c

@@ -26,6 +26,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-29 removed scratchpad (jiri)
  */
 
@@ -184,11 +185,7 @@ int do_action(struct action* a, struct sip_msg* msg)
 					/*udp*/
 					send_sock=get_send_socket(to, PROTO_UDP);
 					if (send_sock!=0){
-#ifdef SCRATCH
-						ret=udp_send(send_sock, msg->orig, msg->len, to);
-#else
 						ret=udp_send(send_sock, msg->buf, msg->len, to);
-#endif
 					}else{
 						ret=-1;
 					}
@@ -196,11 +193,7 @@ int do_action(struct action* a, struct sip_msg* msg)
 #ifdef USE_TCP
 					else{
 					/*tcp*/
-#ifdef SCRATCH
-					ret=tcp_send(msg->orig, msg->len, to, 0);
-#else
 					ret=tcp_send(msg->buf, msg->len, to, 0);
-#endif
 				}
 #endif
 			}

+ 0 - 30
comp_defs.h

@@ -37,35 +37,5 @@
 #ifndef _COMP_DEFS_H
 #define _COMP_DEFS_H
 
-/* preserve "old" parser which delimited header fields by zeros,
- * and included deliminitors in body (which was the only way to
- * learn length of the whole header field 
- */
-#undef PRESERVE_ZT
-
-/* go one step further and remove ZT from first line too */
-#undef DONT_REMOVE_ZT
-
-/* make it all -- move ZT away (Via) */
-#define REMOVE_ALL_ZT
-
-/* don't use scratchpad  anymore */
-#undef SCRATCH
-
-
-/* ------------------------------------------------------ */
-/* don't touch this -- that's helper macros depending on
- * the backwards compatibility macros above */
-#ifdef PRESERVE_ZT
-#	define SET_ZT(_ch) (_ch)='\0'
-#else
-#	define SET_ZT(_ch)
-#endif
-
-#ifdef REMOVE_ALL_ZT
-#	define VIA_ZT(_ch)
-#else
-#	define VIA_ZT(ch) (_ch)='\0'
-#endif
 
 #endif

+ 0 - 12
fifo_server.c

@@ -185,18 +185,6 @@ static void consume_request( FILE *stream )
 
 	while(!read_line(buffer, MAX_CONSUME_BUFFER, stream, &len));
 
-#ifdef _OBSOLETED
-	int eol_count;
-
-	eol_count=0;
-
-	/* each request must be terminated by two EoLs */
-	while(eol_count!=2) {
-		/* read until EoL is encountered */
-		while(!read_line(buffer, MAX_CONSUME_BUFFER, stream, &len));
-		eol_count=len==0?eol_count+1:1;
-	}
-#endif
 }
 
 int read_eol( FILE *stream )

+ 0 - 50
mem/shm_mem.c

@@ -112,56 +112,6 @@ void* _shm_resize( void* p , unsigned int s)
 	return sh_realloc( p, s ); 
 }
 
-#ifdef _OBSOLETED
-#ifdef DBG_QM_MALLOC
-void* _shm_resize( void* p, unsigned int s, char* file, char* func,
-					unsigned int line)
-#else
-void* _shm_resize( void* p , unsigned int s)
-#endif
-{
-	
-#ifdef VQ_MALLOC
-	struct vqm_frag *f;
-#else
-	#ifdef __SUNPRO_C
-		/*no warning support on Sun cc */
-	#else
-		#ifdef _NO_NO_NO
-			#warning shm_resize performs suboptimally without VQ_MALLOC!
-		#endif
-	#endif
-#endif
-
-	if (p==0) {
-		DBG("WARNING:vqm_resize: resize(0) called\n");
-		return shm_malloc( s );
-	}
-
-#	ifdef VQ_MALLOC
-	f=(struct  vqm_frag*) ((char*)p-sizeof(struct vqm_frag));
-#	ifdef DBG_QM_MALLOC
-	DBG("_shm_resize(%p, %d), called from %s: %s(%d)\n",  
-		p, s, file, func, line);
-	VQM_DEBUG_FRAG(shm_block, f);
-	if (p>(void *)shm_block->core_end || p<(void*)shm_block->init_core){
-		LOG(L_CRIT, "BUG: vqm_free: bad pointer %p (out of memory block!) - "
-				"aborting\n", p);
-		abort();
-	}
-#	endif
-	if (s <= f->size-VQM_OVERHEAD) {
-#		ifdef DBG_QM_MALLOC
-		DBG("DEBUG: happy guy -- you reused a memory fragment!\n");
-#		endif
-		return p;
-	};
-#endif
-	/* we can't make the request happy with current size */
-	return sh_realloc( p, s ); 
-}
-#endif
-
 
 
 int shm_mem_init()

+ 0 - 7
modules/tm/config.h

@@ -32,13 +32,6 @@
 
 #include "defs.h"
 
-#ifdef _OBSOLETED
-/* moved to hash.h */
-/* always use a power of 2 for hash table size */
-#define T_TABLE_POWER    12
-#define TABLE_ENTRIES    (1 << (T_TABLE_POWER))
-#endif
-
 /* this is where table size is defined now -- sort of
    ugly, core should not be bothered by TM table size,
    but on the other, core's stateless forwarding should 

+ 0 - 1
modules/tm/defs.h

@@ -34,6 +34,5 @@
 #ifndef _TM_DEFS_H
 #define _TM_DEFS_H
 
-#define DEPRECATE_OLD_STUFF
 
 #endif

+ 0 - 14
modules/tm/h_table.c

@@ -107,12 +107,6 @@ void free_cell( struct cell* dead_cell )
 		/* retransmission buffer */
 		if ( (b=dead_cell->uac[i].request.buffer) )
 			shm_free_unsafe( b );
-#ifdef OLD_CANCEL
-		if ( (b=dead_cell->uac[i].request.ack) )
-			shm_free_unsafe( b );
-		if ( (b=dead_cell->uac[i].request.cancel) )
-			shm_free_unsafe( b );
-#endif
 		b=dead_cell->uac[i].local_cancel.buffer;
 		if (b!=0 && b!=BUSY_BUFFER)
 			shm_free_unsafe( b );
@@ -120,10 +114,6 @@ void free_cell( struct cell* dead_cell )
 		if (rpl && rpl!=FAKED_REPLY) {
 			sip_msg_free_unsafe( rpl );
 		}
-#ifdef _OBSOLETED
-		if ( (b=dead_cell->uac[i].rpl_buffer.s) )
-			shm_free_unsafe( b );
-#endif
 	}
 
 	/* the cell's body */
@@ -296,10 +286,6 @@ struct s_table* init_hash_table()
 
 	return  tm_table;
 
-#ifdef _OBSO
-error2:
-	lock_cleanup();
-#endif
 error1:
 	free_hash_table( );
 error0:

+ 0 - 4
modules/tm/h_table.h

@@ -249,10 +249,6 @@ struct s_table
 {
 	/* table of hash entries; each of them is a list of synonyms  */
 	struct entry   entrys[ TABLE_ENTRIES ];
-#ifdef _OBSOLETED
-	/* table of timer lists */
-	struct timer   timers[ NR_OF_TIMER_LISTS ];
-#endif
 };
 
 

+ 1 - 81
modules/tm/lock.c

@@ -76,12 +76,6 @@ static int
 	entry_semaphore=0, 
 	timer_semaphore=0, 
 	reply_semaphore=0;
-#ifdef _OBSOLETED
-	ack_semaphore=0;
-#endif
-#ifdef _XWAIT
-static int  wait_semaphore=0;
-#endif
 /* and the maximum number of semaphores in the entry_semaphore set */
 static int sem_nr;
 /* timer group locks */
@@ -199,14 +193,6 @@ again:
 			semctl( entry_semaphore, 0 , IPC_RMID , 0 );
 		if (reply_semaphore>0)
 			semctl(reply_semaphore, 0 , IPC_RMID , 0 );
-#ifdef _OBSOLETED
-		if (ack_semaphore>0)
-			semctl(reply_semaphore, 0 , IPC_RMID , 0 );
-#endif
-#ifdef _XWAIT
-		if (wait_semaphore>0)
-			semctl(wait_semaphore, 0 , IPC_RMID , 0 );
-#endif
 
 
 		if (i==0){
@@ -263,40 +249,6 @@ again:
 			goto error;
 		}
 	}
-#ifdef _OBSOLETED	
-	if ((ack_semaphore=init_semaphore_set(sem_nr))<0){
-		if (errno==EINVAL || errno==ENOSPC ) {
-			DBG( "DEBUG:lock_initialize: ack semaphore initialization"
-				" failure: %s\n", strerror(errno));
-			probe_run==1;
-			i--;
-			goto again;
-		}else{
-			LOG(L_CRIT, "ERROR:lock_initialize: ack semaphore initialization"
-				" failure: %s\n", strerror(errno));
-			goto error;
-		}
-	}
-#endif
-
-#ifdef _XWAIT
-	if ((wait_semaphore=init_semaphore_set(sem_nr))<0){
-		if (errno==EINVAL || errno==ENOSPC ) {
-			DBG( "DEBUG:lock_initialize: wait semaphore initialization"
-				" failure: %s\n", strerror(errno));
-			probe_run==1;
-			i--;
-			goto again;
-		}else{
-			LOG(L_CRIT, "ERROR:lock_initialize: wait semaphore initialization"
-				" failure: %s\n", strerror(errno));
-			goto error;
-		}
-	}
-#endif
-
-
-
 
 	/* return success */
 	LOG(L_INFO, "INFO: semaphore arrays of size %d allocated\n", sem_nr );
@@ -336,26 +288,8 @@ void lock_cleanup()
 	if (reply_semaphore > 0 &&
 	    semctl( reply_semaphore, 0 , IPC_RMID , 0 )==-1)
 		LOG(L_ERR, "ERROR: lock_cleanup, reply_semaphore cleanup failed\n");
-#ifdef _OBSOLETED
-	if (ack_semaphore > 0 &&
-	    semctl( ack_semaphore, 0 , IPC_RMID , 0 )==-1)
-		LOG(L_ERR, "ERROR: lock_cleanup, ack_semaphore cleanup failed\n");
-#endif
-#ifdef _XWAIT
-	if (wait_semaphore > 0 &&
-		semctl( wait_semaphore, 0 , IPC_RMID , 0 )==-1)
-		LOG(L_ERR, "ERROR: lock_cleanup, wait_semaphore cleanup failed\n");
-#endif
 
-
-	entry_semaphore = timer_semaphore = reply_semaphore 
-#ifdef _OBSOLETED
-		= ack_semaphore 
-#endif
-		= 0;
-#ifdef _XWAIT
-	wait_semaphore = 0;
-#endif
+	entry_semaphore = timer_semaphore = reply_semaphore = 0;
 
 	if (timer_group_lock) shm_free(timer_group_lock);
 
@@ -370,24 +304,10 @@ int init_cell_lock( struct cell *cell )
 {
 #ifdef FAST_LOCK
 	init_lock(cell->reply_mutex);
-#ifdef _OBSOLETED
-	init_lock(cell->ack_mutex);
-#endif
-#ifdef _XWAIT
-	init_lock(cell->wait_mutex);
-#endif
 	return 0;
 #else
 	cell->reply_mutex.semaphore_set=reply_semaphore;
 	cell->reply_mutex.semaphore_index = cell->hash_index % sem_nr;
-#ifdef _OBSOLETED
-	cell->ack_mutex.semaphore_set=ack_semaphore;
-	cell->ack_mutex.semaphore_index = cell->hash_index % sem_nr;
-#endif
-#ifdef _XWAIT
-	cell->wait_mutex.semaphore_set=wait_semaphore;
-	cell->wait_mutex.semaphore_index = cell->hash_index % sem_nr;
-#endif /* WAIT */
 #endif /* FAST_LOCK */
 	return 0;
 }

+ 1 - 7
modules/tm/sip_msg.c

@@ -37,6 +37,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-25 - auth_body cloner added (janakj)
  * 2003-01-29 - scratchpad removed (jiri)
  * 2003-01-23 - msg_cloner clones msg->from->parsed too (janakj)
@@ -344,17 +345,10 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
 		p += ROUND4(org_msg->new_uri.len);
 	}
 	/* message buffers(org and scratch pad) */
-#ifdef SCRATCH
-	memcpy( p , org_msg->orig , org_msg->len);
-	/* ZT to be safer */
-	*(p+org_msg->len)=0;
-	new_msg->orig = new_msg->buf = p;
-#else
 	memcpy( p , org_msg->buf, org_msg->len);
 	/* ZT to be safer */
 	*(p+org_msg->len)=0;
 	new_msg->buf = p;
-#endif
 	p += ROUND4(new_msg->len+1);
 	/* unparsed and eoh pointer */
 	new_msg->unparsed = translate_pointer(new_msg->buf ,org_msg->buf,

+ 0 - 5
modules/tm/t_cancel.c

@@ -96,11 +96,6 @@ void cancel_branch( struct cell *t, int branch )
 	crb->buffer_len=len;
 	crb->dst=irb->dst;
 	crb->branch=branch;
-#ifdef _OBSOLETED
-	crb->fr_timer.tg=TG_FR;
-	crb->retr_timer.tg=TG_RT;
-	crb->my_T=t;
-#endif
 	crb->retr_timer.payload=crb->fr_timer.payload=crb;
 	/* label it as cancel so that FR timer can better now how to
 	   deal with it */

+ 0 - 23
modules/tm/t_fwd.c

@@ -55,17 +55,6 @@
 #include "config.h"
 
 
-#ifdef _OBSOLETED
-#define shm_free_lump( _lmp) \
-	do{\
-		if ((_lmp)) {\
-			if ((_lmp)->op==LUMP_ADD && (_lmp)->u.value )\
-				shm_free((_lmp)->u.value);\
-			shm_free((_lmp));\
-		}\
-	}while(0);
-#endif
-
 char *print_uac_request( struct cell *t, struct sip_msg *i_req,
 	int branch, str *uri, unsigned int *len, struct socket_info *send_sock )
 {
@@ -104,18 +93,6 @@ char *print_uac_request( struct cell *t, struct sip_msg *i_req,
 		other branches  and for  shmem i_req they would mix up
 	 	shmem with pkg_mem
 	*/
-#ifdef OBSOLETED
-	if (branch) for(b=i_req->add_rm,b1=0;b;b1=b,b=b->next)
-		if (b->type==HDR_VIA) {
-			for(a=b->before;a;)
-				{c=a->before;free_lump(a);pkg_free(a);a=c;}
-			for(a=b->after;a;)
-				{c=a->after;free_lump(a);pkg_free(a);a=c;}
-			if (b1) b1->next = b->next;
-			else i_req->add_rm = b->next;
-			free_lump(b);pkg_free(b);
-		}
-#endif
 	free_via_lump(&i_req->add_rm);
 
 	shbuf=(char *)shm_malloc(*len);

+ 1 - 28
modules/tm/t_lookup.c

@@ -51,6 +51,7 @@
  *
  * History:
  * ----------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-27  3261 ACK/200 consumption bug removed (jiri)
  * 2003-01-28  scratchpad removed (jiri)
  * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
@@ -90,20 +91,6 @@
 #define EQ_REQ_URI_LEN\
 	(p_msg->first_line.u.request.uri.len==t_msg->first_line.u.request.uri.len)
 
-#ifdef SCRATCH
-#define EQ_STR(_hf) (memcmp(t_msg->_hf->body.s,\
-	translate_pointer(p_msg->orig,p_msg->buf,p_msg->_hf->body.s), \
-	p_msg->_hf->body.len)==0)
-#define EQ_REQ_URI_STR\
-	( memcmp( t_msg->first_line.u.request.uri.s,\
-	translate_pointer(p_msg->orig,p_msg->buf,p_msg->first_line.u.request.uri.s),\
-	p_msg->first_line.u.request.uri.len)==0)
-#define EQ_VIA_STR(_via)\
-	( memcmp( t_msg->_via->name.s,\
-	 translate_pointer(p_msg->orig,p_msg->buf,p_msg->_via->name.s),\
-	 (t_msg->via1->bsize-(t_msg->_via->name.s-(t_msg->_via->hdr.s+t_msg->_via->hdr.len)))\
-	)==0 )
-#else /* SCRATCH */
 #define EQ_STR(_hf) (memcmp(t_msg->_hf->body.s,\
 	p_msg->_hf->body.s, \
 	p_msg->_hf->body.len)==0)
@@ -116,15 +103,10 @@
 	 p_msg->_via->name.s,\
 	 (t_msg->via1->bsize-(t_msg->_via->name.s-(t_msg->_via->hdr.s+t_msg->_via->hdr.len)))\
 	)==0 )
-#endif /* SCRATCH */
 
 
 
-#ifdef PRESERVE_ZT
-#define HF_LEN(_hf) ((_hf)->body.s+(_hf)->body.len-(_hf)->name.s)
-#else
 #define HF_LEN(_hf) ((_hf)->len)
-#endif
 
 /* should be request-uri matching used as a part of pre-3261 
  * transaction matching, as the standard wants us to do so
@@ -145,10 +127,6 @@ static struct cell *t_ack;
    break ref_counting
 */
 
-#ifdef _OBSOLETED
-struct cell      *T;
-#endif
-
 static struct cell *T;
 
 /* number of currently processed message; good to know
@@ -577,11 +555,6 @@ int t_reply_matching( struct sip_msg *p_msg , int *p_branch )
 	p=p_msg->via1->branch->value.s+MCOOKIE_LEN;
 	scan_space=p_msg->via1->branch->value.len-MCOOKIE_LEN;
 
-#ifdef OBSOLETED
-	p=p_msg->via1->branch->value.s;
-	scan_space=p_msg->via1->branch->value.len;
-#endif
-
 
 	/* hash_id */
 	n=eat_token2_end( p, p+scan_space, BRANCH_SEPARATOR);

+ 0 - 4
modules/tm/t_lookup.h

@@ -45,10 +45,6 @@
 #define T_UNDEFINED  ( (struct cell*) -1 )
 #define T_NULL_CELL       ( (struct cell*) 0 )
 
-#ifdef _OBSOLETED
-extern struct cell      *T;
-#endif
-
 extern unsigned int     global_msg_id;
 extern int ruri_matching;
 

+ 2 - 183
modules/tm/t_msgbuilder.c

@@ -29,6 +29,7 @@
  *
  * History:
  * ----------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
  * 2003-02-13  build_uac_request uses proto (andrei)
  */
@@ -102,28 +103,15 @@ char *build_local(struct cell *Trans,unsigned int branch,
 	}
 	*len+= via_len;
 	/*headers*/
-#ifdef PRESERVE_ZT
-	*len+=Trans->from.len+CRLF_LEN
-		+Trans->callid.len+CRLF_LEN
-		+to->len+CRLF_LEN
-		/* CSeq: 101 CANCEL */
-		+Trans->cseq_n.len+1+method_len+CRLF_LEN; 
-#else
 	*len+=Trans->from.len+Trans->callid.len+to->len+
 		+Trans->cseq_n.len+1+method_len+CRLF_LEN; 
-#endif
 
 
 	/* copy'n'paste Route headers */
 	if (!Trans->local) {
 		for ( hdr=Trans->uas.request->headers ; hdr ; hdr=hdr->next )
 			 if (hdr->type==HDR_ROUTE)
-#ifdef PRESERVE_ZT
-				*len+=((hdr->body.s+hdr->body.len ) - hdr->name.s ) + 
-					CRLF_LEN ;
-#else
 				*len+=hdr->len;
-#endif
 	}
 
 	/* User Agent */
@@ -150,18 +138,10 @@ char *build_local(struct cell *Trans,unsigned int branch,
 	append_mem_block(p,via,via_len);
 
 	/*other headers*/
-#ifdef PRESERVE_ZT
 	append_str( p, Trans->from );
-	append_mem_block( p, CRLF, CRLF_LEN );
 	append_str( p, Trans->callid );
-	append_mem_block( p, CRLF, CRLF_LEN );
 	append_str( p, *to );
-	append_mem_block( p, CRLF, CRLF_LEN );
-#else
-	append_str( p, Trans->from );
-	append_str( p, Trans->callid );
-	append_str( p, *to );
-#endif
+
 	append_str( p, Trans->cseq_n );
 	append_mem_block( p, " ", 1 );
 	append_mem_block( p, method, method_len );
@@ -170,13 +150,7 @@ char *build_local(struct cell *Trans,unsigned int branch,
 	if (!Trans->local)  {
 		for ( hdr=Trans->uas.request->headers ; hdr ; hdr=hdr->next )
 			if(hdr->type==HDR_ROUTE) {
-#ifdef PRESERVE_ZT
-				append_mem_block(p, hdr->name.s,
-					hdr->body.s+hdr->body.len-hdr->name.s );
-				append_mem_block(p, CRLF, CRLF_LEN );
-#else
 				append_mem_block(p, hdr->name.s, hdr->len );
-#endif
 			}
 	}
 
@@ -198,161 +172,6 @@ error:
 }
 
 
-#ifndef DEPRECATE_OLD_STUFF
-char *build_uac_request(  str msg_type, str dst, str from,
-	str fromtag, int cseq, str callid, 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 cseq_str[10];
-	int cseq_str_len;
-	char *buf;
-	char *w;
-#ifdef _OBSOLETED
-	int dummy;
-#endif
-
-	char branch_buf[MAX_BRANCH_PARAM_LEN];
-	int branch_len;
-	str branch_str;
-
-	int from_len;
-	char *from_str;
-
-	buf=0;
-
-	/* print content length */
-	content_len_len=snprintf(
-		content_len, sizeof(content_len), 
-		"%d", body.len );
-	if (content_len_len==-1 || content_len_len>=sizeof(content_len)) {
-		LOG(L_ERR, "ERROR: uac: content_len too big\n");
-		return 0;
-	}
-	/* print cseq */
-	cseq_str_len=snprintf( 
-		cseq_str, sizeof(cseq_str),
-		"%d", cseq );
-	if (cseq_str_len==-1 || cseq_str_len>=sizeof(cseq_str)) {
-		LOG(L_ERR, "ERROR: uac: cseq too big\n");
-		return 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;
-	}
-	branch_str.s=branch_buf;
-	branch_str.len=branch_len;
-	
-	via=via_builder(&via_len, t->uac[branch].request.send_sock,
-		&branch_str, 0, t->uac[branch].request.dst.proto);
-	
-	if (!via) {
-		LOG(L_ERR, "ERROR: build_uac_request: via building failed\n");
-		goto error;
-	}
-	*len+=via_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+cseq_str_len /* CSeq: method, delimitor, number  */
-		+ dst.len /* To */
-		+ callid.len /* call-id */
-		+ from_len+FROMTAG_LEN+fromtag.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 );
-
-	/* CSeq */
-	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 );
-
-	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;
-	memapp( w, CRLF CALLID, CRLF_LEN + CALLID_LEN  );
-	memapp( w, callid.s, callid.len );
-	memapp( w, CRLF CONTENT_LENGTH, CRLF_LEN + CONTENT_LENGTH_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+fromtag.len;
-	memapp( w, from_str, from_len );
-	memapp( w, FROMTAG, FROMTAG_LEN );
-	memapp( w, fromtag.s, fromtag.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 );
-	}
-#ifdef _OBSOLETED
-	/* ugly HACK -- debugging has shown len shorter by one */
-	dummy=*len+1;
-	*len=dummy;
-#endif
-#	ifdef EXTRA_DEBUG
-	if (w-buf != *len ) abort();
-#	endif
-	
-	
-error1:
-	pkg_free(via);	
-error:
-	return buf;
-	
-}
-#endif
-
 
 char *build_uac_request_dlg(str* msg,           /* Method */
 			    str* ruri,          /* Request-URI */

+ 0 - 15
modules/tm/t_msgbuilder.h

@@ -48,13 +48,6 @@
 #define TOTAG ";tag="
 #define TOTAG_LEN (sizeof(TOTAG)-1)
 
-#ifdef _OBSOLETED
-#define UAC_CSEQNR "1"
-#define UAC_CSEQNR_LEN 1
-#define CONTENT_LENGTH "Content-Length: "
-#define CONTENT_LENGTH_LEN (sizeof(CONTENT_LENGTH)-1)
-#endif
-
 
 /* convenience macros */
 #define memapp(_d,_s,_len) \
@@ -69,14 +62,6 @@
 		(_d) += (_len);\
 	}while(0);
 
-#ifdef _OBSO
-#define append_str(_p,_str) \
-	do{ \
-		memcpy((_p), (_str).s, (_str).len); \
-		(_p)+=(_str).len); \
-	} while(0);
-#endif
-
 char *build_local(struct cell *Trans, unsigned int branch,
 	unsigned int *len, char *method, int method_len, str *to);
 

+ 1 - 44
modules/tm/t_reply.c

@@ -27,6 +27,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
  * 2003-01-19  faked lump list created in on_reply handlers
  * 2003-02-13  updated to use rb->dst (andrei)
@@ -111,13 +112,8 @@ static char *build_ack(struct sip_msg* rpl,struct cell *trans,int branch,
             "cannot generate a HBH ACK if key HFs in reply missing\n");
         return NULL;
     }
-#ifdef PRESERVE_ZT
-	to.len=rpl->to->body.s+rpl->to->body.len-rpl->to->name.s;
-	to.s=rpl->orig+(rpl->to->name.s-rpl->buf);
-#else
 	to.s=rpl->to->name.s;
 	to.len=rpl->to->len;
-#endif
     return build_local( trans, branch, ret_len,
         ACK, ACK_LEN, &to );
 }
@@ -218,40 +214,6 @@ restore:
 	return 0;
 }
 
-#ifdef _OBSOLETED
-void on_negative_reply( struct cell* t, struct sip_msg* msg, 
-	int code, void *param )
-{
-	int act_ret;
-	struct sip_msg faked_msg;
-
-	/* nobody cares about a negative transaction -- ok, return */
-	if (!t->on_negative) {
-		DBG("DBG: on_negative_reply: no on_negative\n");
-		return;
-	}
-
-	DBG("DBG: on_negative_reply processed for transaction %p\n", t);
-	if (!faked_env(&faked_msg, t, t->uas.request, 0 /* create fake */ )) {
-		LOG(L_ERR, "ERROR: on_negative_reply: faked_env failed\n");
-		goto restore;
-	}
-
-	/* run */
-	act_ret=run_actions(reply_rlist[t->on_negative], &faked_msg );
-	if (act_ret<0) {
-		LOG(L_ERR, "ERROR: on_negative_reply: Error in do_action\n");
-	}
-
-
-restore:
-	faked_env(&faked_msg, 0, 0 /* don't need t and shmem_rq */ , 
-					1 /* restore fake */ );
-
-}
-#endif
-
-
 
 
 /* the main code of stateful replying */
@@ -1074,11 +1036,6 @@ int t_on_reply( struct sip_msg  *p_msg )
 	} /* provisional replies */
 
 done:
-#ifdef _OBSOLETED
-	/* moved to  script callback */
-	UNREF( t );
-	T=T_UNDEFINED;
-#endif
 	/* don't try to relay statelessly neither on success
        (we forwarded statefuly) nor on error; on troubles, 
 	   simply do nothing; that will make the other party to 

+ 0 - 4
modules/tm/t_reply.h

@@ -109,10 +109,6 @@ int t_reply( struct cell *t, struct sip_msg * , unsigned int , char * );
 */
 int t_reply_unsafe( struct cell *t, struct sip_msg * , unsigned int , char * );
 
-#ifdef _OBSOLETED
-void cleanup_after_final( struct s_table *h_table, struct cell *t,
-	unsigned int status );
-#endif
 
 enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, 
 	unsigned int msg_status, branch_bm_t *cancel_bitmap );

+ 0 - 8
modules/tm/timer.c

@@ -684,14 +684,6 @@ void reset_timer( struct timer_link* tl )
 #ifdef EXTRA_DEBUG
 	DBG("DEBUG: reset_timer (group %d, tl=%p)\n", tl->tg, tl );
 #endif
-#ifdef _OBSOLETED
-	/* lock(timer_group_lock[ tl->tg ]); */
-	/* hack to work arround this timer group thing*/
-	lock(hash__XX_table->timers[timer_group[tl->tg]].mutex);
-	remove_timer_unsafe( tl );
-	unlock(hash_XX_table->timers[timer_group[tl->tg]].mutex);
-	/*unlock(timer_group_lock[ tl->tg ]);*/
-#endif
 }
 
 

+ 1 - 79
modules/tm/tm.c

@@ -90,9 +90,7 @@
 
 inline static int w_t_check(struct sip_msg* msg, char* str, char* str2);
 inline static int w_t_reply(struct sip_msg* msg, char* str, char* str2);
-#ifdef _OBSOLETED
-inline static int w_t_reply_unsafe(struct sip_msg* msg, char* str, char* str2);
-#endif
+
 inline static int w_t_release(struct sip_msg* msg, char* str, char* str2);
 inline static int fixup_t_send_reply(void** param, int param_no);
 inline static int fixup_str2int( void** param, int param_no);
@@ -139,9 +137,6 @@ struct module_exports exports= {
 				"t_newtran",
 				"t_lookup_request",
 				T_REPLY,
-#ifdef _OBSO
-				T_REPLY_UNSAFE,
-#endif
 				"t_retransmit_reply",
 				"t_release",
 				T_RELAY_TO,
@@ -161,9 +156,6 @@ struct module_exports exports= {
 				/* not applicable from script ... */
 
 				"register_tmcb",
-#ifndef DEPRECATE_OLD_STUFF
-				T_UAC,
-#endif
 				T_UAC_DLG,
 				"load_tm",
 #ifdef VOICE_MAIL
@@ -178,9 +170,6 @@ struct module_exports exports= {
 					w_t_newtran,
 					w_t_check,
 					w_t_reply,
-#ifdef _OBSO
-					w_t_reply_unsafe,
-#endif
 					w_t_retransmit_reply,
 					w_t_release,
 					w_t_relay_to,
@@ -198,9 +187,6 @@ struct module_exports exports= {
 					w_t_on_negative,
 
 					(cmd_function) register_tmcb,
-#ifndef DEPRECATE_OLD_STUFF
-					(cmd_function) t_uac,
-#endif
 					(cmd_function) t_uac_dlg,
 					(cmd_function) load_tm,
 #ifdef VOICE_MAIL
@@ -215,9 +201,6 @@ struct module_exports exports= {
 				0, /* t_newtran */
 				0, /* t_lookup_request */
 				2, /* t_reply */
-#ifdef _OBSO
-				2, /* t_reply_unsafe */
-#endif
 				0, /* t_retransmit_reply */
 				0, /* t_release */
 				2, /* t_relay_to */
@@ -234,9 +217,6 @@ struct module_exports exports= {
 				2, /* t_forward_nonack_tcp */
 				1, /* t_on_negative */
 				NO_SCRIPT /* register_tmcb */,
-#ifndef DEPRECATE_OLD_STUFF
-				NO_SCRIPT /* t_uac */,
-#endif
 				NO_SCRIPT /* t_uac_dlg */,
 				NO_SCRIPT /* load_tm */,
 #ifdef VOICE_MAIL
@@ -251,9 +231,6 @@ struct module_exports exports= {
 				0,						/* t_newtran */
 				0,						/* t_lookup_request */
 				fixup_t_send_reply,		/* t_reply */
-#ifdef _OBSO
-				fixup_t_send_reply,		/* t_reply_unsafe */
-#endif
 				0,						/* t_retransmit_reply */
 				0,						/* t_release */
 				fixup_hostport2proxy,	/* t_relay_to */
@@ -270,9 +247,6 @@ struct module_exports exports= {
 				fixup_hostport2proxy,	/* t_forward_nonack_tcp */
 				fixup_str2int,			/* t_on_negative */
 				0,						/* register_tmcb */
-#ifndef DEPRECATE_OLD_STUFF
-				0,						/* t_uac */
-#endif
 				0,                                              /* t_uac_dlg */
 				0,						/* load_tm */
 #ifdef VOICE_MAIL
@@ -284,12 +258,6 @@ struct module_exports exports= {
 				0						/* t_newdlg */
 	
 		},
-#ifndef DEPRECATE_OLD_STUFF
-	1+
-#endif
-#ifdef _OBSO
-	1+
-#endif
 #ifdef VOICE_MAIL
 	4+
 #endif
@@ -307,9 +275,6 @@ struct module_exports exports= {
 		"retr_timer1p3",
 		"retr_timer2",
 		"noisy_ctimer"
-#ifndef DEPRECATE_OLD_STUFF
-		,"uac_from"
-#endif
 	},
 	(modparam_t[]) { /* variable types */
 		INT_PARAM, /* ruri_matching */
@@ -322,9 +287,6 @@ struct module_exports exports= {
 		INT_PARAM, /* retr_timer1p3 */
 		INT_PARAM, /* retr_timer2 */
 		INT_PARAM /* noisy_ctimer */
-#ifndef DEPRECATE_OLD_STUFF
-		,STR_PARAM /* uac_from */
-#endif
 	},
 	(void *[]) { /* variable pointers */
 		&ruri_matching,
@@ -337,13 +299,7 @@ struct module_exports exports= {
 		&(timer_id2timeout[RT_T1_TO_3]),
 		&(timer_id2timeout[RT_T2]),
 		&noisy_ctimer
-#ifndef DEPRECATE_OLD_STUFF
-		,&uac_from
-#endif
 	},
-#ifndef DEPRECATE_OLD_STUFF
-	1+
-#endif
 	10,      /* Number of module paramers */
 
 	mod_init, /* module initialization function */
@@ -406,16 +362,6 @@ static int mod_init(void)
 	}
 
 
-#ifndef DEPRECATE_OLD_STUFF
-	if (register_fifo_cmd(fifo_uac, "t_uac", 0)<0) {
-		LOG(L_CRIT, "cannot register fifo uac\n");
-		return -1;
-	}
-	if (register_fifo_cmd(fifo_uac_from, "t_uac_from", 0)<0) {
-		LOG(L_CRIT, "cannot register fifo uac\n");
-		return -1;
-	}
-#endif
 	if (register_fifo_cmd(fifo_uac_dlg, "t_uac_dlg", 0)<0) {
 		LOG(L_CRIT, "cannot register fifo uac\n");
 		return -1;
@@ -459,10 +405,6 @@ static int mod_init(void)
 		LOG(L_ERR, "ERROR: mod_init: uac_init failed\n");
 		return -1;
 	}
-#ifdef _OBSO
-	register_tmcb( TMCB_ON_NEGATIVE, on_negative_reply, 
-			0 /* empty param */);
-#endif
 	/* register post-script clean-up function */
 	register_script_cb( w_t_unref, POST_SCRIPT_CB, 
 			0 /* empty param */ );
@@ -625,26 +567,6 @@ inline static int w_t_reply(struct sip_msg* msg, char* str, char* str2)
 	}
 }
 
-#ifdef _OBSOLETED
-inline static int w_t_reply_unsafe(struct sip_msg* msg, char* str, char* str2)
-{
-	struct cell *t;
-
-	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;
-	}
-	return t_reply_unsafe(t, msg, (unsigned int) str, str2);
-}
-#endif
-
 
 inline static int w_t_release(struct sip_msg* msg, char* str, char* str2)
 {

+ 0 - 12
modules/tm/tm_load.c

@@ -49,12 +49,6 @@ int load_tm( struct tm_binds *tmb)
 		LOG(L_ERR, LOAD_ERROR "'t_relay' not found\n");
 		return -1;
 	}
-#ifndef DEPRECATE_OLD_STUFF
-	if (!(tmb->t_uac=(tuac_f)find_export(T_UAC, NO_SCRIPT)) ) {
-		LOG( L_ERR, LOAD_ERROR "'t_uac' not found\n");
-		return -1;
-	}
-#endif
 	if (!(tmb->t_uac_dlg=(tuacdlg_f)find_export(T_UAC_DLG, NO_SCRIPT)) ) {
 		LOG( L_ERR, LOAD_ERROR "'t_uac_dlg' not found\n");
 		return -1;
@@ -80,12 +74,6 @@ int load_tm( struct tm_binds *tmb)
 	        LOG( L_ERR, LOAD_ERROR "'t_lookup_ident' not found\n");
 		return -1;
 	}
-#endif
-#ifdef _OBSO
-	if (!(tmb->t_reply_unsafe=(treply_f)find_export(T_REPLY_UNSAFE, 2)) ) {
-		LOG( L_ERR, LOAD_ERROR "'t_reply_unsafe' not found\n");
-		return -1;
-	}
 #endif
 	if (!(tmb->t_forward_nonack=(tfwd_f)find_export(T_FORWARD_NONACK , 2)) ) {
 		LOG( L_ERR, LOAD_ERROR "'t_forward_nonack' not found\n");

+ 0 - 6
modules/tm/tm_load.h

@@ -50,9 +50,6 @@
 #define T_RELAY "t_relay"
 #define T_RELAY_UDP "t_relay_udp"
 #define T_RELAY_TCP "t_relay_tcp"
-#ifndef DEPRECATE_OLD_STUFF
-#	define T_UAC "t_uac"
-#endif
 #define T_UAC_DLG "t_uac_dlg"
 #define T_REPLY "t_reply"
 #ifdef VOICE_MAIL
@@ -69,9 +66,6 @@ struct tm_binds {
 	register_tmcb_f	register_tmcb;
 	cmd_function	t_relay_to;
 	cmd_function 	t_relay;
-#ifndef DEPRECATE_OLD_STUFF
-	tuac_f			t_uac;
-#endif
 	tuacdlg_f               t_uac_dlg;
 	treply_f		t_reply;
 #ifdef VOICE_MAIL

+ 1 - 346
modules/tm/uac.c

@@ -44,6 +44,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-27 FIFO/UAC now dumps reply -- good for CTD (jiri)
  * 2003-02-13  t_uac, t _uac_dlg, gethfblock, uri2proxy changed to use 
  *              proto & rb->dst (andrei)
@@ -120,11 +121,6 @@ static int callid_suffix_len;
 static int rand_len;	/* number of chars to display max rand */
 static char callid[CALLID_NR_LEN+CALLID_SUFFIX_LEN];
 
-#ifndef DEPRECATE_OLD_STUFF
-char *uac_from="\"UAC Account\" <sip:[email protected]:9>";
-str uac_from_str;
-#endif
-
 static char from_tag[ FROM_TAG_LEN+1 ];
 
 
@@ -186,11 +182,6 @@ int uac_init() {
 	MDStringArray( from_tag, src, 3 );
 	from_tag[MD5_LEN]=CID_SEP;
 
-#ifndef DEPRECATE_OLD_STUFF
-	uac_from_str.s = uac_from;
-	uac_from_str.len = strlen(uac_from);
-#endif
-
 	return 1;
 }
 
@@ -209,146 +200,6 @@ int uac_child_init( int rank )
 	return 1;
 }
 
-#ifndef DEPRECATE_OLD_STUFF
-int t_uac( str *msg_type, str *dst, int proto, 
-	str *headers, str *body, str *from, 
-	transaction_cb completion_cb, void *cbp, 
-	dlg_t dlg)
-{
-
-	int r;
-	struct cell *new_cell;
-	struct proxy_l *proxy;
-	int branch;
-	int ret;
-	unsigned int req_len;
-	char *buf;
-	union sockaddr_union to;
-	struct socket_info* send_sock;
-	struct retr_buf *request;
-	str dummy_from;
-	str callid_s;
-	str fromtag;
-
-	/* make -Wall shut up */
-	ret=0;
-
-	proxy=uri2proxy( dst, proto );
-	if (proxy==0) {
-		ser_error=ret=E_BAD_ADDRESS;
-		LOG(L_ERR, "ERROR: t_uac: can't create a dst proxy\n");
-		goto done;
-	}
-	branch=0;
-	/* might go away -- we ignore it in send_pr_buffer anyway */
-	/* T->uac[branch].request.to_len=sizeof(union sockaddr_union); */
-	hostent2su(&to, &proxy->host, proxy->addr_idx, 
-		(proxy->port)?htons(proxy->port):htons(SIP_PORT));
-	/* send_sock=get_send_socket( &to, PROTO_UDP ); */
-	send_sock=get_out_socket( &to, proto );
-	if (send_sock==0) {
-		LOG(L_ERR, "ERROR: t_uac: no corresponding listening socket "
-			"for af %d\n", to.s.sa_family );
-		ret=E_NO_SOCKET;
-		goto error00;
-	}
-
-	/* update callid */
-	/* generate_callid(); */
-	callid_nr++;
-	r=snprintf(callid, rand_len+1, "%0*lx", rand_len, callid_nr );
-	if (r==-1 || r>=rand_len+1) {
-		LOG(L_CRIT, "BUG: SORRY, callid calculation failed\n");
-		goto error00;
-	}
-	/* fix the ZT 0 */
-	callid[rand_len]=CID_SEP;
-	callid_s.s=callid;
-	callid_s.len=rand_len+callid_suffix_len;
-	DBG("DEBUG: sufix_len = %d\n",callid_suffix_len);
-	DBG("DEBUG: NEW CALLID:%.*s[%d]:\n", callid_s.len, callid_s.s 
-		, callid_s.len);
-	new_cell = build_cell( NULL ) ; 
-	if (!new_cell) {
-		ret=E_OUT_OF_MEM;
-		LOG(L_ERR, "ERROR: t_uac: short of cell shmem\n");
-		goto error00;
-	}
-	new_cell->completion_cb=completion_cb;
-	new_cell->cbp=cbp;
-	/* cbp is installed -- tell error handling bellow not to free it */
-	cbp=0;
-	new_cell->is_invite=msg_type->len==INVITE_LEN 
-		&& memcmp(msg_type->s, INVITE, INVITE_LEN)==0;
-	new_cell->local=1;
-	new_cell->kr=REQ_FWDED;
-
-
-	request=&new_cell->uac[branch].request;
-	request->dst.to=to;
-	request->dst.send_sock=send_sock;
-	request->dst.proto=proto;
-	request->dst.proto_reserved1=0; /* no special connection required */
-
-	/* need to put in table to calculate label which is needed for printing */
-	LOCK_HASH(new_cell->hash_index);
-	insert_into_hash_table_unsafe(  new_cell );
-	UNLOCK_HASH(new_cell->hash_index);
-
-	if (from) dummy_from=*from; else { dummy_from.s=0; dummy_from.len=0; }
-	/* calculate from tag from callid */
-	crcitt_string_array(&from_tag[MD5_LEN+1], &callid_s, 1 );
-	fromtag.s=from_tag; fromtag.len=FROM_TAG_LEN;
-	buf=build_uac_request(  *msg_type, *dst, 
-			dummy_from, fromtag,
-			DEFAULT_CSEQ, callid_s, 
-			*headers, *body, branch,
-			new_cell, /* t carries hash_index, label, md5,
-				uac[].send_sock and other pieces of
-				information needed to print a message*/
-		&req_len );
-	if (!buf) {
-		ret=E_OUT_OF_MEM;
-		LOG(L_ERR, "ERROR: t_uac: short of req shmem\n");
-		goto error01;
-	}      
-	new_cell->method.s=buf;new_cell->method.len=msg_type->len;
-
-
-	request->buffer = buf;
-	request->buffer_len = req_len;
-	new_cell->nr_of_outgoings++;
-
-
-	proxy->tx++;
-	proxy->tx_bytes+=req_len;
-
-	if (SEND_BUFFER( request)==-1) {
-		LOG(L_ERR, "ERROR: t_uac: UAC sending to %.*s failed\n",
-			dst->len, dst->s );
-		proxy->errors++;
-		proxy->ok=0;
-	}
-	start_retr( request );
-
-	/* success */
-	return 1;
-
-error01:
-	LOCK_HASH(new_cell->hash_index);
-	remove_from_hash_table_unsafe( new_cell );
-	UNLOCK_HASH(new_cell->hash_index);
-	free_cell(new_cell);
-error00:
-	free_proxy( proxy );
-	free( proxy );
-done: 
-	/* if we did not install cbp, release it now */
-	if (cbp) shm_free(cbp);
-	return ser_error=ret;
-}
-#endif
-
 static struct socket_info *uri2sock( str *uri, union sockaddr_union *to_su,
 									 int proto )
 {
@@ -627,195 +478,6 @@ static void fifo_callback( struct cell *t, struct sip_msg *reply,
 	DBG("DEBUG: fifo_callback sucesssfuly completed\n");
 }	
 
-#ifndef DEPRECATE_OLD_STUFF
-
-/* to be obsoleted in favor of fifo_uac_from */
-int fifo_uac( FILE *stream, char *response_file ) 
-{
-	str sm, sh, sb, sd; /* method, header, body, dst(outbound) */
-	char method[MAX_METHOD]; /* read buffers for these ... */
-	char header[MAX_HEADER];
-	char body[MAX_BODY];
-	char dst[MAX_DST];
-	char *shmem_file;
-	int fn_len;
-	int ret;
-	int sip_error;
-	char err_buf[MAX_REASON_LEN];
-
-	sm.s=method; sh.s=header; sb.s=body; sd.s=dst;
-	if (!read_line(method, MAX_METHOD, stream,&sm.len)||sm.len==0) {
-		/* line breaking must have failed -- consume the rest
-		   and proceed to a new request
-		*/
-		LOG(L_ERR, "ERROR: fifo_uac: method expected\n");
-		fifo_reply(response_file, 
-			"400 fifo_uac: method expected");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac: method: %.*s\n", sm.len, method );
-	if (!read_line(dst, MAX_DST, stream, &sd.len)||sd.len==0) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: destination expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: destination expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac:  dst: %.*s\n", sd.len, dst );
-	/* now read header fields line by line */
-	if (!read_line_set(header, MAX_HEADER, stream, &sh.len)) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: HFs expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: header fields expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac: header: %.*s\n", sh.len, header );
-	/* and eventually body */
-	if (!read_body(body, MAX_BODY, stream, &sb.len)) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: body expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: body expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac: body: %.*s\n", sb.len, body );
-	DBG("DEBUG: fifo_uac: EoL -- proceeding to transaction creation\n");
-	/* we got it all, initiate transaction now! */
-	if (response_file) {
-		fn_len=strlen(response_file)+1;
-		shmem_file=shm_malloc(fn_len);
-		if (shmem_file==0) {
-			LOG(L_ERR, "ERROR: fifo_uac: no shmem\n");
-			fifo_reply(response_file, 
-				"500 fifo_uac: no shmem for shmem_file\n");
-			return 1;
-		}
-		memcpy(shmem_file, response_file, fn_len );
-	} else {
-		shmem_file=0;
-	}
-	ret=t_uac(&sm,&sd, PROTO_UDP,&sh,&sb, 0 /* default from */,
-		fifo_callback,shmem_file,0 /* no dialog */);
-	if (ret>0) {
-		if (err2reason_phrase(ret, &sip_error, err_buf,
-				sizeof(err_buf), "FIFO/UAC" ) > 0 ) 
-		{
-			fifo_reply(response_file, "500 FIFO/UAC error: %d\n",
-				ret );
-		} else {
-			fifo_reply(response_file, err_buf );
-		}
-	}
-	return 1;
-}
-
-
-/* syntax:
-
-	:t_uac_from:[file] EOL
-	method EOL
-	[from] EOL (if none, server's default from is taken)
-	dst EOL (put in r-uri and To)
-	[CR-LF separated HFs]* EOL
-	EOL
-	[body] EOL
-	EOL
-
-*/
-
-int fifo_uac_from( FILE *stream, char *response_file ) 
-{
-	char method[MAX_METHOD];
-	char header[MAX_HEADER];
-	char body[MAX_BODY];
-	char dst[MAX_DST];
-	char from[MAX_FROM];
-	str sm, sh, sb, sd, sf;
-	char *shmem_file;
-	int fn_len;
-	int ret;
-	int sip_error;
-	char err_buf[MAX_REASON_LEN];
-	int err_ret;
-
-	sm.s=method; sh.s=header; sb.s=body; sd.s=dst;sf.s=from;
-
-	if (!read_line(method, MAX_METHOD, stream,&sm.len)||sm.len==0) {
-		/* line breaking must have failed -- consume the rest
-		   and proceed to a new request
-		*/
-		LOG(L_ERR, "ERROR: fifo_uac: method expected\n");
-		fifo_reply(response_file, 
-			"400 fifo_uac: method expected");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac: method: %.*s\n", sm.len, method );
-	if (!read_line(from, MAX_FROM, stream, &sf.len)) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: from expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: from expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac:  from: %.*s\n", sf.len, from);
-	if (!read_line(dst, MAX_DST, stream, &sd.len)||sd.len==0) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: destination expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: destination expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac:  dst: %.*s\n", sd.len, dst );
-	/* now read header fields line by line */
-	if (!read_line_set(header, MAX_HEADER, stream, &sh.len)) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: HFs expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: header fields expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac: header: %.*s\n", sh.len, header );
-	/* and eventually body */
-	if (!read_body(body, MAX_BODY, stream, &sb.len)) {
-		fifo_reply(response_file, 
-			"400 fifo_uac: body expected\n");
-		LOG(L_ERR, "ERROR: fifo_uac: body expected\n");
-		return 1;
-	}
-	DBG("DEBUG: fifo_uac: body: %.*s\n", sb.len, body );
-	DBG("DEBUG: fifo_uac: EoL -- proceeding to transaction creation\n");
-	/* we got it all, initiate transaction now! */
-	if (response_file) {
-		fn_len=strlen(response_file)+1;
-		shmem_file=shm_malloc(fn_len);
-		if (shmem_file==0) {
-			LOG(L_ERR, "ERROR: fifo_uac: no shmem\n");
-			fifo_reply(response_file, 
-				"500 fifo_uac: no memory for shmem_file\n");
-			return 1;
-		}
-		memcpy(shmem_file, response_file, fn_len );
-	} else {
-		shmem_file=0;
-	}
-	/* HACK: there is yet a shortcoming -- if t_uac fails, callback
-	   will not be triggered and no feedback will be printed
-	   to shmem_file
-	*/
-	ret=t_uac(&sm,&sd, PROTO_UDP, &sh,&sb, sf.len==0 ? 0: &sf/*default from*/,
-		fifo_callback,shmem_file,0 /* no dialog */);
-	if (ret<=0) {
-		err_ret=err2reason_phrase(ret, &sip_error, err_buf,
-				sizeof(err_buf), "FIFO/UAC" ) ;
-		if (err_ret > 0 )
-		{
-			fifo_reply(response_file, "%d %s", sip_error, err_buf );
-		} else {
-			fifo_reply(response_file, "500 FIFO/UAC error: %d\n",
-				ret );
-		}
-	}
-	return 1;
-
-}
-
-#endif
-
 static struct str_list *new_str(char *s, int len, struct str_list **last, int *total)
 {
 	struct str_list *new;
@@ -1069,9 +731,6 @@ int fifo_uac_dlg( FILE *stream, char *response_file )
 	memset(&faked_msg, 0, sizeof(struct sip_msg));
 	faked_msg.len=header.len; 
 	faked_msg.buf=faked_msg.unparsed=header_buf;
-#ifdef SCRATCH
-	faked_msg.orig=faked_msg.buf;
-#endif
 	if (parse_headers(&faked_msg, HDR_EOH, 0)==-1 ) {
 			DBG("DEBUG: fifo_uac: parse_headers failed\n");
 			fifo_uac_error(response_file, 400, "HFs unparseable");
@@ -1185,10 +844,6 @@ int fifo_uac_dlg( FILE *stream, char *response_file )
 			fifo_uac_error(response_file, sip_error, err_buf);
 		} else {
 			fifo_uac_error(response_file, 500, "FIFO/UAC error" );
-#ifdef _OBSO
-			fifo_reply(response_file, "500 FIFO/UAC error: %d\n",
-				ret );
-#endif
 		}
 	}
 

+ 0 - 16
modules/tm/uac.h

@@ -39,17 +39,6 @@
 
 /* substitution character for FIFO UAC */
 #define SUBST_CHAR '!'
-#ifdef _DEPRECATED
-/* number of random digits in beginning of a string --
-   please multiples of 2 */
-#define RAND_DIGITS	6
-/* maximum seq size in hex chars */
-#define MAX_SEQ_LEN (T_TABLE_POWER*2)
-/* maximum size of pid in hex characters */
-#define MAX_PID_LEN	4
-extern char call_id[RAND_DIGITS+1+MAX_PID_LEN+1+MAX_SEQ_LEN+1];
-void generate_callid();
-#endif
 
 #define DEFAULT_CSEQ	10
 
@@ -120,11 +109,6 @@ int t_uac_dlg(str* msg,                     /* Type of the message - MESSAGE, OP
 	      void* cbp                     /* Callback pointer */
 	      );
 
-#ifndef DEPRECATE_OLD_STUFF
-int fifo_uac( FILE *stream, char *response_file );
-int fifo_uac_from( FILE *stream, char *response_file );
-#endif
-
 
 int fifo_uac_dlg( FILE *stream, char *response_file );
 

+ 1 - 168
msg_translator.c

@@ -28,6 +28,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-20 bug_fix: use of return value of snprintf aligned to C99 (jiri)
  * 2003-01-23 added rport patches, contributed by 
  *             Maxim Sobolev <[email protected]> and heavily modified by me
@@ -70,75 +71,14 @@
 		(_dest) += (_len) ;\
 	}while(0);
 
-#ifdef SCRATCH
-#define append_str_trans(_dest,_src,_len,_msg) \
-	append_str( (_dest), (_msg)->orig+((_src)-(_msg)->buf) , (_len) );
-#else
 #define append_str_trans(_dest,_src,_len,_msg) \
 	append_str( (_dest), (_src), (_len) );
-#endif
 
 extern char version[];
 extern int version_len;
 
 
 
-#ifndef REMOVE_ALL_ZT
-/* checks if ip is in host(name) and ?host(ip)=name?
- * ip must be in network byte order!
- *  resolver = DO_DNS | DO_REV_DNS; if 0 no dns check is made
- * return 0 if equal */
-static int check_address(struct ip_addr* ip, char *name, int resolver)
-{
-	struct hostent* he;
-	int i;
-	char* s;
-
-	/* maybe we are lucky and name it's an ip */
-	s=ip_addr2a(ip);
-	if (s){
-		DBG("check_address(%s, %.*s, %d)\n", 
-			s, name->len, name->s, resolver);
-
-	#ifdef USE_IPV6
-		if ((ip->af==AF_INET6) && (strcasecmp(name, s)==0))
-				return 0;
-		else
-	#endif
-
-			if (strcmp(name, s)==0) 
-				return 0;
-	}else{
-		LOG(L_CRIT, "check_address: BUG: could not convert ip address\n");
-		return -1;
-	}
-
-	if (resolver&DO_DNS){
-		DBG("check_address: doing dns lookup\n");
-		/* try all names ips */
-		he=resolvehost(name);
-		if (he && ip->af==he->h_addrtype){
-			for(i=0;he && he->h_addr_list[i];i++){
-				if ( memcmp(&he->h_addr_list[i], ip->u.addr, ip->len)==0)
-					return 0;
-			}
-		}
-	}
-	if (resolver&DO_REV_DNS){
-		DBG("check_address: doing rev. dns lookup\n");
-		/* try reverse dns */
-		he=rev_resolvehost(ip);
-		if (he && (strcmp(he->h_name, name)==0))
-			return 0;
-		for (i=0; he && he->h_aliases[i];i++){
-			if (strcmp(he->h_aliases[i],name)==0)
-				return 0;
-		}
-	}
-	return -1;
-}
-#endif
-
 
 
 /* checks if ip is in host(name) and ?host(ip)=name?
@@ -572,13 +512,7 @@ char * build_req_buf_from_sip_req( struct sip_msg* msg,
 	char* received_buf;
 	char* rport_buf;
 	char* new_buf;
-#ifdef SCRATCH
-	char* orig;
-#endif
 	char* buf;
-#ifndef REMOVE_ALL_ZT
-	char  backup;
-#endif
 	unsigned int offset, s_offset, size;
 	struct lump* anchor;
 	int r;
@@ -600,9 +534,6 @@ char * build_req_buf_from_sip_req( struct sip_msg* msg,
 	extra_params.len=0;
 	extra_params.s=0;
 	uri_len=0;
-#ifdef SCRATCH
-	orig=msg->orig;
-#endif
 	buf=msg->buf;
 	len=msg->len;
 	received_len=0;
@@ -652,15 +583,8 @@ skip_clen:
 		goto error00;
 	}
 	/* check if received needs to be added */
-#ifdef REMOVE_ALL_ZT
 	r=check_via_address(&msg->rcv.src_ip, &msg->via1->host, 
 		msg->via1->port, received_dns);
-#else
-	backup = msg->via1->host.s[msg->via1->host.len];
-	msg->via1->host.s[msg->via1->host.len] = 0;
-	r=check_address(&msg->rcv.src_ip, msg->via1->host.s, received_dns);
-	msg->via1->host.s[msg->via1->host.len] = backup;
-#endif
 	if (r!=0){
 		if ((received_buf=received_builder(msg,&received_len))==0){
 			LOG(L_ERR, "ERROR: build_req_buf_from_sip_req:"
@@ -746,11 +670,7 @@ skip_clen:
 	if (msg->new_uri.s){
 		/* copy message up to uri */
 		size=msg->first_line.u.request.uri.s-buf;
-#ifdef SCRATCH
-		memcpy(new_buf, orig, size);
-#else
 		memcpy(new_buf, buf, size);
-#endif
 		offset+=size;
 		s_offset+=size;
 		/* add our uri */
@@ -759,17 +679,10 @@ skip_clen:
 		s_offset+=msg->first_line.u.request.uri.len; /* skip original uri */
 	}
 	new_buf[new_len]=0;
-#ifdef SCRATCH
-	/* copy msg adding/removing lumps */
-	process_lumps(msg->add_rm, new_buf, &offset, orig, &s_offset);
-	/* copy the rest of the message */
-	memcpy(new_buf+offset, orig+s_offset, len-s_offset);
-#else
 	/* copy msg adding/removing lumps */
 	process_lumps(msg->add_rm, new_buf, &offset, buf, &s_offset);
 	/* copy the rest of the message */
 	memcpy(new_buf+offset, buf+s_offset, len-s_offset);
-#endif
 	new_buf[new_len]=0;
 
 #ifdef DBG_MSG_QA
@@ -808,9 +721,6 @@ char * build_res_buf_from_sip_res( struct sip_msg* msg,
 	unsigned int new_len, via_len;
 	char* new_buf;
 	unsigned offset, s_offset, via_offset;
-#ifdef SCRATCH
-	char* orig;
-#endif
 	char* buf;
 	unsigned int len;
 #ifdef USE_TCP
@@ -820,28 +730,11 @@ char * build_res_buf_from_sip_res( struct sip_msg* msg,
 	
 	clen_buf=0;
 	clen_len=0;
-#endif
-#ifdef SCRATCH
-	orig=msg->orig;
 #endif
 	buf=msg->buf;
 	len=msg->len;
 	new_buf=0;
 	/* we must remove the first via */
-#ifdef PRESERVE_ZT
-	via_len=msg->via1->bsize;
-	via_offset=msg->via1->hdr.s-buf;
-	DBG("via len: %d, initial via offset: %d\n", via_len, via_offset);
-	if (msg->via1->next){
-		/* add hdr size*/
-		via_offset+=msg->via1->hdr.len+1;
-	    DBG(" adjusted via len: %d, initial offset: %d\n",
-				via_len, via_offset);
-	}else{
-		/* add hdr size ("Via:")*/
-		via_len+=msg->via1->hdr.len+1;
-	}
-#else
 	if (msg->via1->next) {
 		via_len=msg->via1->bsize;
 		via_offset=msg->h_via1->body.s-buf;
@@ -849,7 +742,6 @@ char * build_res_buf_from_sip_res( struct sip_msg* msg,
 		via_len=msg->h_via1->len;
 		via_offset=msg->h_via1->name.s-buf;
 	}
-#endif
 
 #ifdef USE_TCP
 
@@ -909,19 +801,11 @@ skip_clen:
 	new_buf[new_len]=0; /* debug: print the message */
 	offset=s_offset=0;
 	process_lumps(msg->repl_add_rm, new_buf, &offset, 
-#ifdef SCRATCH
-		orig, 
-#else
 		buf,
-#endif
 		&s_offset);
 	/* copy the rest of the message */
 	memcpy(new_buf+offset,
-#ifdef SCRATCH
-		orig+s_offset, 
-#else
 		buf+s_offset, 
-#endif
 		len-s_offset);
 	 /* send it! */
 	DBG("build_res_from_sip_res: copied size: orig:%d, new: %d, rest: %d"
@@ -979,9 +863,7 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 	char content_len[27];
 	int content_len_len;
 #endif
-#ifndef PRESERVE_ZT
 	char *after_body;
-#endif
 	str to_tag;
 
 	received_buf=0;
@@ -1008,12 +890,8 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 	/* check if received needs to be added */
 	backup = msg->via1->host.s[msg->via1->host.len];
 	msg->via1->host.s[msg->via1->host.len] = 0;
-#ifdef REMOVE_ALL_ZT
 	r=check_via_address(&msg->rcv.src_ip, &msg->via1->host, 
 		msg->via1->port, received_dns);
-#else
-	r=check_address(&msg->rcv.src_ip, msg->via1->host.s, received_dns);
-#endif
 	msg->via1->host.s[msg->via1->host.len] = backup;
 	if (r!=0) {
 		if ((received_buf=received_builder(msg,&received_len))==0) {
@@ -1048,12 +926,10 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 				else
 					len+=new_tag_len+TOTAG_TOKEN_LEN/*";tag="*/;
 			}
-#ifndef PRESERVE_ZT
 			else {
 				len+=hdr->len;
 				continue;
 			}
-#endif
 		} else if (hdr->type==HDR_VIA) {
 				if (hdr==msg->h_via1) len += received_len+rport_len;
 		} else if (hdr->type==HDR_RECORDROUTE) {
@@ -1064,11 +940,7 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 					|| hdr->type==HDR_CSEQ)) {
 			continue;
 		}
-#ifdef PRESERVE_ZT
-		len += ((hdr->body.s+hdr->body.len )-hdr->name.s )+CRLF_LEN;
-#else
 		len += hdr->len;
-#endif
 	}
 	len-=delete_len;
 	/*lumps length*/
@@ -1162,18 +1034,6 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 			case HDR_TO:
 				if (new_tag){
 					if (to_tag.s ) { /* replacement */
-#ifdef PRESERVE_ZT
-						/* before to-tag */
-						append_str_trans( p, hdr->name.s ,
-							to_tag.s-hdr->name.s,msg);
-						/* to tag replacement */
-						append_str( p, new_tag,new_tag_len);
-						/* the rest after to-tag */
-						append_str_trans( p,to_tag.s+to_tag.len,
-							((hdr->body.s+hdr->body.len )-
-							(to_tag.s+to_tag.len)),msg);
-						append_str( p, CRLF,CRLF_LEN);
-#else
 						/* before to-tag */
 						append_str( p, hdr->name.s, to_tag.s-hdr->name.s);
 						/* to tag replacement */
@@ -1181,36 +1041,20 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 						/* the rest after to-tag */
 						append_str( p, to_tag.s+to_tag.len,
 							hdr->name.s+hdr->len-(to_tag.s+to_tag.len));
-#endif
 					}else{ /* adding a new to-tag */
-#ifdef PRESERVE_ZT
-						append_str_trans( p, hdr->name.s ,
-							((hdr->body.s+hdr->body.len )-hdr->name.s ),
-							msg);
-						append_str( p, TOTAG_TOKEN,TOTAG_TOKEN_LEN);
-						append_str( p, new_tag,new_tag_len);
-						append_str( p, CRLF,CRLF_LEN);
-#else
 						after_body=hdr->body.s+hdr->body.len;
 						append_str( p, hdr->name.s, after_body-hdr->name.s);
 						append_str(p, TOTAG_TOKEN, TOTAG_TOKEN_LEN);
 						append_str( p, new_tag,new_tag_len);
 						append_str( p, after_body, 
 										hdr->name.s+hdr->len-after_body);
-#endif
 					}
 					break;
 				} /* no new to-tag -- proceed to 1:1 copying  */
 			case HDR_FROM:
 			case HDR_CALLID:
 			case HDR_CSEQ:
-#ifdef PRESERVE_ZT
-					append_str_trans( p, hdr->name.s ,
-						((hdr->body.s+hdr->body.len )-hdr->name.s ),msg);
-					append_str( p, CRLF,CRLF_LEN);
-#else
 					append_str(p, hdr->name.s, hdr->len);
-#endif
 		} /* for switch */
 	/*lumps*/
 	for(lump=msg->reply_lump;lump;lump=lump->next)
@@ -1291,17 +1135,6 @@ int branch_builder( unsigned int hash_index,
 	char *begin;
 	int size;
 
-#ifdef _OBSOLETED
-	/* no hash_id --- whoever called me wants to have
-	   very simple branch_id
-	*/
-	if (hash_index==0) {
-		*branch_str='0';
-		*len=1;
-		return *len;
-	}
-#endif
-
 	/* hash id provided ... start with it */
 	size=MAX_BRANCH_PARAM_LEN;
 	begin=branch_str;

+ 1 - 1
parser/case_call.h

@@ -28,6 +28,7 @@
  *
  * History:
  * ----------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -42,7 +43,6 @@
      case __id1_:                    \
 	     hdr->type = HDR_CALLID; \
 	     hdr->name.len = 7;      \
-	     SET_ZT(*(p + 3));        \
 	     return (p + 4);         \
 	                             \
      case __id2_:                    \

+ 1 - 2
parser/case_cont.h

@@ -28,6 +28,7 @@
  *
  * History:
  * ----------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -42,7 +43,6 @@
         case _th12_:                                   \
                 hdr->type = HDR_CONTENTLENGTH;         \
                 hdr->name.len = 14;                    \
-                SET_ZT(*(p + 3));                       \
                 return (p + 4);                        \
         }                                              \
                                                        \
@@ -76,7 +76,6 @@
         case _act1_:                     \
 	        hdr->type = HDR_CONTACT; \
 	        hdr->name.len = 7;       \
-	        SET_ZT(*(p + 3));      \
 	        return (p + 4);          \
 	                                 \
         case _act2_:                     \

+ 1 - 1
parser/case_expi.h

@@ -28,6 +28,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -42,7 +43,6 @@
         case _res1_:                     \
 		hdr->type = HDR_EXPIRES; \
 		hdr->name.len = 7;       \
-		SET_ZT(*(p + 3));          \
 		return (p + 4);          \
                                          \
         case _res2_:                     \

+ 1 - 1
parser/case_prox.h

@@ -28,6 +28,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -42,7 +43,6 @@
         case _ion1_:                       \
 	        hdr->type = HDR_PROXYAUTH; \
 	        hdr->name.len = 19;        \
-            SET_ZT(*(p + 3));          \
 	        return (p + 4);            \
                                            \
         case _ion2_:                       \

+ 1 - 1
parser/case_requ.h

@@ -28,6 +28,7 @@
  *
  * History:
  * -------------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -43,7 +44,6 @@
         case _ire1_:                     \
                 hdr->type = HDR_REQUIRE; \
                 hdr->name.len = 7;       \
-                SET_ZT(*(p + 3));        \
                 return (p + 4);          \
                                          \
         case _ire2_:                     \

+ 1 - 1
parser/case_to.h

@@ -28,6 +28,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -40,7 +41,6 @@
 #define to12_CASE           \
         hdr->type = HDR_TO; \
         hdr->name.len = 2;  \
-        SET_ZT(*(p + 2));    \
         return (p + 4);
 
 

+ 2 - 1
parser/case_unsu.h

@@ -27,6 +27,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * History:
+ * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -41,7 +43,6 @@
         case _ted1_:                         \
                 hdr->type = HDR_UNSUPPORTED; \
                 hdr->name.len = 11;          \
-                SET_ZT(*(p + 3));            \
 	        return (p + 4);              \
                                              \
         case _ted2_:                         \

+ 4 - 1
parser/case_via.h

@@ -25,6 +25,10 @@
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * History:
+ * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  */
 
 
@@ -36,7 +40,6 @@
 #define via1_CASE            \
         hdr->type = HDR_VIA; \
         hdr->name.len = 3;   \
-        SET_ZT(*(p + 3));     \
         return (p + 4)        
 
 #define via2_CASE            \

+ 1 - 2
parser/hf.h

@@ -26,6 +26,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -73,9 +74,7 @@ struct hdr_field {
 	int type;                /* Header field type */
 	str name;                /* Header field name */
 	str body;                /* Header field body */
-#ifndef PRESERVE_ZT
 	int len;				 /* length from body until EoHF (incl. CRLF) */
-#endif
 	void* parsed;            /* Parsed data structures */
 	struct hdr_field* next;  /* Next header field in the list */
 };

+ 1 - 19
parser/msg_parser.c

@@ -29,6 +29,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-29 scrathcpad removed (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
@@ -86,16 +87,12 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 		goto error;
 	}
 
-#ifndef PRESERVE_ZT
 	/* eliminate leading whitespace */
 	tmp=eat_lws_end(tmp, end);
 	if (tmp>=end) {
 		LOG(L_ERR, "ERROR: get_hdr_field: HF empty\n");
 		goto error;
 	}
-#else
-	;
-#endif
 
 	/* if header-field well-known, parse it, find its end otherwise ;
 	 * after leaving the hdr->type switch, tmp should be set to the
@@ -214,11 +211,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 				}
 				tmp=match;
 			}while( match<end &&( (*match==' ')||(*match=='\t') ) );
-#ifdef PRESERVE_ZT
-			*(match-1)=0; /*null terminate*/
-#else
 			tmp=match;
-#endif
 			hdr->body.len=match-hdr->body.s;
 			break;
 		default:
@@ -228,16 +221,12 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 	}
 	/* jku: if \r covered by current length, shrink it */
 	trim_r( hdr->body );
-#ifndef PRESERVE_ZT
 	hdr->len=tmp-hdr->name.s;
-#endif
 	return tmp;
 error:
 	DBG("get_hdr_field: error exit\n");
 	hdr->type=HDR_ERROR;
-#ifndef PRESERVE_ZT
 	hdr->len=tmp-hdr->name.s;
-#endif
 	return tmp;
 }
 
@@ -540,11 +529,7 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
 	
 error:
 	/* more debugging, msg->orig is/should be null terminated*/
-#ifdef SCRATCH
-	LOG(L_ERR, "ERROR: parse_msg: message=<%.*s>\n", (int)msg->len, msg->orig);
-#else
 	LOG(L_ERR, "ERROR: parse_msg: message=<%.*s>\n", (int)msg->len, msg->buf);
-#endif
 	return -1;
 }
 
@@ -570,9 +555,6 @@ void free_sip_msg(struct sip_msg* msg)
 	if (msg->add_rm)      free_lump_list(msg->add_rm);
 	if (msg->repl_add_rm) free_lump_list(msg->repl_add_rm);
 	if (msg->reply_lump)   free_reply_lump(msg->reply_lump);
-#ifdef SCRATCH
-	pkg_free(msg->orig);
-#endif
 	/* don't free anymore -- now a pointer to a static buffer */
 #	ifdef DYN_BUF
 	pkg_free(msg->buf); 

+ 3 - 3
parser/msg_parser.h

@@ -24,6 +24,9 @@
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * History
+ * -------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-28 removed scratchpad (jiri)
  */
 
@@ -123,9 +126,6 @@ struct sip_msg {
 	
 	struct receive_info rcv; /* source & dest ip, ports, proto a.s.o*/
 
-#ifdef SCRATCH	
-	char* orig;       /* original message copy */
-#endif
 	char* buf;        /* scratch pad, holds a modfied message,
 					   *  via, etc. point into it */
 	unsigned int len; /* message len (orig) */

+ 2 - 31
parser/parse_cseq.c

@@ -26,6 +26,7 @@
  * 
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-22 zero-termination in CSeq eliminated (jiri)
  */
 
@@ -45,17 +46,9 @@
 char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
 {
 	char *t, *m, *m_end;
-#ifdef PRESERVE_ZT
-	char c;
-#endif
 	
 	cb->error=PARSE_ERROR;
-#ifdef PRESERVE_ZT /* already called in calling function */
-	t=eat_space_end(buf, end);
-	if (t>=end) goto error;
-#else
 	t=buf;
-#endif
 	
 	cb->number.s=t;
 	t=eat_token_end(t, end);
@@ -64,7 +57,6 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
 
 	m=eat_space_end(t, end);
 	m_end=eat_token_end(m, end);
-	SET_ZT(*t);
 
 	if (m_end>=end) {
 			LOG(L_ERR, "ERROR: parse_cseq: "
@@ -80,27 +72,6 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
 	t=m_end;
 	cb->method.len=t-cb->method.s;
 
-#ifdef PRESERVE_ZT
-	c=*t;
-	*t=0; /*null terminate it*/
-	t++;
-	/*check if the header ends here*/
-	if (c=='\n') goto check_continue;
-	do{
-		for (;(t<end)&&((*t==' ')||(*t=='\t')||(*t=='\r'));t++);
-		if (t>=end) goto error;
-		if (*t!='\n'){
-			LOG(L_ERR, "ERROR:parse_cseq: unexpected char <%c> at end of"
-					" cseq\n", *t);
-			goto error;
-		}
-		t++;
-check_continue:
-		;
-	}while( (t<end) && ((*t==' ')||(*t=='\t')) );
-	cb->error=PARSE_OK;
-	return t;
-#else
 	/* there may be trailing LWS 
 	 * (it was not my idea to put it in SIP; -jiri )
 	 */
@@ -119,7 +90,7 @@ check_continue:
 			return t+1;
 	}
 	LOG(L_ERR, "ERROR: CSeq EoL expected\n");
-#endif
+
 error:
 	LOG(L_ERR, "ERROR: parse_cseq: bad cseq\n");
 	return t;

+ 1 - 9
parser/parse_fline.c

@@ -29,6 +29,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-28: removed 0-terminators from first line (jiri)
  */
 
@@ -1218,9 +1219,6 @@ char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl)
 	   tmp points at space after; go ahead */
 
 	fl->u.request.method.s=buffer;  /* store ptr to first token */
-#ifdef DONT_REMOVE_ZT
-	(*tmp)=0;			/* mark the 1st token end */
-#endif
 	second=tmp+1;			/* jump to second token */
 	offset=second-buffer;
 
@@ -1237,9 +1235,6 @@ char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl)
 	if ((third==tmp)||(tmp>=end)){
 		goto error;
 	}
-#ifdef DONT_REMOVE_ZT
-	*tmp=0; /* mark the end of the token */
-#endif
 	fl->u.request.uri.s=second;
 	fl->u.request.uri.len=tmp-second;
 
@@ -1287,9 +1282,6 @@ char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl)
 	if (nl>=end){ /* no crlf in packet or only 1 line > invalid */
 		goto error;
 	}
-#ifdef DONT_REMOVE_ZT
-	*tmp=0;
-#endif
 	fl->u.request.version.s=third;
 	fl->u.request.version.len=tmp-third;
 	fl->len=nl-buffer;

+ 1 - 4
parser/parse_hname2.c

@@ -28,6 +28,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  */
 
@@ -114,7 +115,6 @@ static inline char* skip_ws(char* p, unsigned int size)
         case ':':                  \
 	        hdr->type = id;    \
 	        hdr->name.len = 1; \
-	        SET_ZT(*(p + 1));   \
 	        return (p + 2);    \
         }                            
 
@@ -150,7 +150,6 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 			case ':':                   
 				hdr->type = HDR_TO; 
 				hdr->name.len = 1;  
-				SET_ZT(*(p+1));
 				return (p + 2);     
 			}                           
 			break;
@@ -174,7 +173,6 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 	        goto other;
 	} else {
 		hdr->name.len = p - hdr->name.s;
-		SET_ZT(*p);
 		return (p + 1);
 	}
 
@@ -188,7 +186,6 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 		return 0;
 	} else {
 		hdr->type = HDR_OTHER;
-		SET_ZT(*p);
 		hdr->name.len = p - hdr->name.s;
 		return (p + 1);
 	}

+ 17 - 55
parser/parse_via.c

@@ -40,6 +40,7 @@
  *  2003-01-27  modified parse_via to set new via_param->start member and
  *               via->params.s (andrei)
  *  2003-01-28  zero-terminations replaced with VIA_ZT (jiri)
+ *  2003-02-28 scratchpad compatibility abandoned (jiri)
  */
 
 
@@ -129,7 +130,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 			case '\t':
 				switch(state){
 					case FIN_HIDDEN:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						state=L_PARAM;
@@ -140,7 +140,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 					case FIN_RECEIVED:
 					case FIN_RPORT:
 					case FIN_I:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						state=L_VALUE;
@@ -154,7 +153,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						break;
 					case GEN_PARAM:
 					default:
-						VIA_ZT(*tmp);
 						param->type=GEN_PARAM;
 						param->name.len=tmp-param->name.s;
 						state=L_VALUE;
@@ -165,7 +163,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 			case '\n':
 				switch(state){
 					case FIN_HIDDEN:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						param->size=tmp-param->start; 
@@ -178,7 +175,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 					case FIN_RECEIVED:
 					case FIN_I:
 					case FIN_RPORT:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						param->size=tmp-param->start; 
@@ -198,7 +194,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						break;
 					case GEN_PARAM:
 					default:
-						VIA_ZT(*tmp);
 						param->type=GEN_PARAM;
 						saved_state=L_VALUE;
 						param->name.len=tmp-param->name.s;
@@ -210,7 +205,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 			case '\r':
 				switch(state){
 					case FIN_HIDDEN:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						param->size=tmp-param->start; 
@@ -223,7 +217,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 					case FIN_RECEIVED:
 					case FIN_I:
 					case FIN_RPORT:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						param->size=tmp-param->start; 
@@ -240,7 +233,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						goto end_via;
 					case GEN_PARAM:
 					default:
-						VIA_ZT(*tmp);
 						param->type=GEN_PARAM;
 						param->name.len=tmp-param->name.s;
 						param->size=tmp-param->start; 
@@ -258,7 +250,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 					case FIN_RECEIVED:
 					case FIN_RPORT:
 					case FIN_I:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						state=F_VALUE;
@@ -275,7 +266,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						goto end_via;
 					case GEN_PARAM:
 					default:
-						VIA_ZT(*tmp);
 						param->type=GEN_PARAM;
 						param->name.len=tmp-param->name.s;
 						state=F_VALUE;
@@ -286,7 +276,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 				switch(state){
 					case FIN_HIDDEN:
 					case FIN_RPORT: /* rport can appear w/o a value */
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						state=F_PARAM;
@@ -306,7 +295,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						goto end_via;
 					case GEN_PARAM:
 					default:
-						VIA_ZT(*tmp);
 						param->type=GEN_PARAM;
 						param->name.len=tmp-param->name.s;
 						state=F_PARAM;
@@ -317,7 +305,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 				switch(state){
 					case FIN_HIDDEN:
 					case FIN_RPORT:
-						VIA_ZT(*tmp);
 						param->type=state;
 						param->name.len=tmp-param->name.s;
 						state=F_VIA;
@@ -338,7 +325,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						goto end_via;
 					case GEN_PARAM:
 					default:
-						VIA_ZT(*tmp);
 						param->type=GEN_PARAM;
 						param->name.len=tmp-param->name.s;
 						state=F_VIA;
@@ -721,7 +707,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 					case F_VALUE: /*eat space*/
 						break; 
 					case P_VALUE:
-						VIA_ZT(*tmp);
 						state=L_PARAM;
 						param->value.len=tmp-param->value.s;
 						goto endofvalue;
@@ -748,7 +733,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						state=F_LF;
 						break;
 					case P_VALUE:
-						VIA_ZT(*tmp);
 						saved_state=L_PARAM;
 						state=F_LF;
 						param->value.len=tmp-param->value.s;
@@ -776,7 +760,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						state=F_CR;
 						break;
 					case P_VALUE:
-						VIA_ZT(*tmp);
 						param->value.len=tmp-param->value.s;
 						saved_state=L_PARAM;
 						state=F_CR;
@@ -814,12 +797,10 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 			case ';':
 				switch(state){
 					case P_VALUE:
-						VIA_ZT(*tmp);
 						param->value.len=tmp-param->value.s;
 						state=F_PARAM;
 						goto endofvalue;
 					case F_VALUE:
-						VIA_ZT(*tmp);
 						param->value.len=0;
 						state=F_PARAM;
 						goto endofvalue;
@@ -847,7 +828,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 			case ',':
 				switch(state){
 					case P_VALUE:
-						VIA_ZT(*tmp);
 						param->value.len=tmp-param->value.s;
 						state=F_VIA;
 						goto endofvalue;
@@ -878,7 +858,6 @@ static /*inline*/ char* parse_via_param(char* p, char* end,
 						param->value.s=tmp+1;
 						break;
 					case P_STRING:
-						VIA_ZT(*tmp);
 						state=L_PARAM;
 						param->value.len=tmp-param->value.s;
 						goto endofvalue;
@@ -984,24 +963,21 @@ parse_again:
 					case F_PROTO:
 						break;
 					case FIN_UDP:
-						VIA_ZT(*tmp); /* finished proto parsing */
 						vb->transport.len=tmp-vb->transport.s;
 						vb->proto=PROTO_UDP;
 						state=F_HOST; /* start looking for host*/
 						goto main_via;
 					case FIN_TCP:
-						VIA_ZT(*tmp); /* finished proto parsing */
+						/* finished proto parsing */
 						vb->transport.len=tmp-vb->transport.s;
 						vb->proto=PROTO_TCP;
 						state=F_HOST; /* start looking for host*/
 						goto main_via;
 					case FIN_SIP:
-						VIA_ZT(*tmp);
 						vb->name.len=tmp-vb->name.s;
 						state=L_VER;
 						break;
 					case FIN_VER:
-						VIA_ZT(*tmp);
 						vb->version.len=tmp-vb->version.s;
 						state=L_PROTO;
 						break;
@@ -1027,27 +1003,23 @@ parse_again:
 						state=F_LF;
 						break;
 					case FIN_UDP:
-						VIA_ZT(*tmp);
 						vb->transport.len=tmp-vb->transport.s;
 						vb->proto=PROTO_UDP;
 						state=F_LF;
 						saved_state=F_HOST; /* start looking for host*/
 						goto main_via;
 					case FIN_TCP:
-						VIA_ZT(*tmp);
 						vb->transport.len=tmp-vb->transport.s;
 						vb->proto=PROTO_TCP;
 						state=F_LF;
 						saved_state=F_HOST; /* start looking for host*/
 						goto main_via;
 					case FIN_SIP:
-						VIA_ZT(*tmp);
 						vb->name.len=tmp-vb->name.s;
 						state=F_LF;
 						saved_state=L_VER;
 						break;
 					case FIN_VER:
-						VIA_ZT(*tmp);
 						vb->version.len=tmp-vb->version.s;
 						state=F_LF;
 						saved_state=L_PROTO;
@@ -1076,27 +1048,23 @@ parse_again:
 						state=F_CR;
 						break;
 					case FIN_UDP:
-						VIA_ZT(*tmp);
 						vb->transport.len=tmp-vb->transport.s;
 						vb->proto=PROTO_UDP;
 						state=F_CR;
 						saved_state=F_HOST;
 						goto main_via;
 					case FIN_TCP:
-						VIA_ZT(*tmp);
 						vb->transport.len=tmp-vb->transport.s;
 						vb->proto=PROTO_TCP;
 						state=F_CR;
 						saved_state=F_HOST;
 						goto main_via;
 					case FIN_SIP:
-						VIA_ZT(*tmp);
 						vb->name.len=tmp-vb->name.s;
 						state=F_CR;
 						saved_state=L_VER;
 						break;
 					case FIN_VER:
-						VIA_ZT(*tmp);
 						vb->version.len=tmp-vb->version.s;
 						state=F_CR;
 						saved_state=L_PROTO;
@@ -1116,12 +1084,10 @@ parse_again:
 			case '/':
 				switch(state){
 					case FIN_SIP:
-						VIA_ZT(*tmp);
 						vb->name.len=tmp-vb->name.s;
 						state=F_VER;
 						break;
 					case FIN_VER:
-						VIA_ZT(*tmp);
 						vb->version.len=tmp-vb->version.s;
 						state=F_PROTO;
 						break;
@@ -1294,7 +1260,7 @@ parse_again:
 					case F_HOST:/*eat the spaces*/
 						break;
 					case P_HOST:
-						 VIA_ZT(*tmp);/*mark end of host*/
+						 /*mark end of host*/
 						 vb->host.len=tmp-vb->host.s;
 						 state=L_PORT;
 						 break;
@@ -1302,7 +1268,7 @@ parse_again:
 					case F_PORT:
 						break;
 					case P_PORT:
-						VIA_ZT(*tmp); /*end of port */
+						/*end of port */
 						vb->port_str.len=tmp-vb->port_str.s;
 						state=L_PARAM;
 						break;
@@ -1322,7 +1288,7 @@ parse_again:
 					case F_IP6HOST: /*eat the spaces*/
 						break;
 					case P_IP6HOST:
-						VIA_ZT(*tmp); /*mark end of host*/
+						/*mark end of host*/
 						vb->host.len=tmp-vb->host.s;
 						state=L_PORT; 
 						break;
@@ -1355,13 +1321,13 @@ parse_again:
 						state=F_LF;
 						break;
 					case P_HOST:
-						 VIA_ZT(*tmp);/*mark end of host*/
+						 /*mark end of host*/
 						 vb->host.len=tmp-vb->host.s;
 						 saved_state=L_PORT;
 						 state=F_LF;
 						 break;
 					case P_PORT:
-						VIA_ZT(*tmp); /*end of port */
+						/*end of port */
 						vb->port_str.len=tmp-vb->port_str.s;
 						saved_state=L_PARAM;
 						state=F_LF;
@@ -1401,13 +1367,13 @@ parse_again:
 						state=F_CR;
 						break;
 					case P_HOST:
-						 VIA_ZT(*tmp);/*mark end of host*/
+						 /*mark end of host*/
 						 vb->host.len=tmp-vb->host.s;
 						 saved_state=L_PORT;
 						 state=F_CR;
 						 break;
 					case P_PORT:
-						VIA_ZT(*tmp); /*end of port */
+						/*end of port */
 						vb->port_str.len=tmp-vb->port_str.s;
 						saved_state=L_PARAM;
 						state=F_CR;
@@ -1439,7 +1405,7 @@ parse_again:
 					case P_IP6HOST:
 						break;
 					case P_HOST:
-						VIA_ZT(*tmp); /*mark  end of host*/
+						/*mark  end of host*/
 						vb->host.len=tmp-vb->host.s;
 						state=F_PORT;
 						break;
@@ -1491,13 +1457,12 @@ parse_again:
 						LOG(L_ERR, "ERROR:parse_via: bad ipv6 reference\n");
 						goto error;
 					case P_HOST:
-						VIA_ZT(*tmp);
 						vb->host.len=tmp-vb->host.s;
 						state=F_PARAM;
 						param_start=tmp+1;
 						break;
 					case P_PORT:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->port_str.len=tmp-vb->port_str.s;
 					case L_PORT:
 					case L_PARAM:
@@ -1554,12 +1519,12 @@ parse_again:
 						LOG(L_ERR, "ERROR:parse_via: bad ipv6 reference\n");
 						goto error;
 					case P_HOST:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->host.len=tmp-vb->host.s;
 						state=F_VIA;
 						break;
 					case P_PORT:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->port_str.len=tmp-vb->port_str.s;
 						state=F_VIA;
 						break;
@@ -1609,19 +1574,19 @@ parse_again:
 							*tmp, state);
 						goto  error;
 					case P_HOST:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->host.len=tmp-vb->host.s;
 						state=F_COMMENT;
 						c_nest++;
 						break;
 					case P_PORT:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->port_str.len=tmp-vb->port_str.s;
 						state=F_COMMENT;
 						c_nest++;
 						break;
 					case P_PARAM:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->params.len=tmp-vb->params.s;
 						state=F_COMMENT;
 						c_nest++;
@@ -1632,7 +1597,6 @@ parse_again:
 						state=F_COMMENT;
 						vb->params.len=tmp-vb->params.s;
 						c_nest++;
-						VIA_ZT(*tmp);
 						break;
 					case P_COMMENT:
 					case F_COMMENT:
@@ -1658,7 +1622,6 @@ parse_again:
 							c_nest--;
 							if(c_nest==0){
 								state=L_VIA;
-								VIA_ZT(*tmp);
 								vb->comment.len=tmp-vb->comment.s;
 								break;
 							}
@@ -1725,7 +1688,7 @@ parse_again:
 			case ']':
 				switch(state){
 					case P_IP6HOST:
-						VIA_ZT(*tmp); /*mark the end*/
+						/*mark the end*/
 						vb->host.len=tmp-vb->host.s;
 						state=L_PORT;
 						break;
@@ -1787,7 +1750,6 @@ parse_again:
 							case F_VIA:
 								vb->params.len=param->start+param->size
 												-vb->params.s;
-								VIA_ZT(*tmp);
 								break;
 							case END_OF_HEADER:
 								vb->params.len=param->start+param->size

+ 4 - 2
parser/parser_f.h

@@ -23,6 +23,10 @@
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * History
+ * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  */
 
 
@@ -40,7 +44,6 @@ inline static char* eat_space_end(char* p, char* pend)
 	for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
 	return p;
 }
-#ifndef PRESERVE_ZT
 #define SP(_c) ((_c)=='\t' || (_c)==' ')
 inline static char* eat_lws_end(char* p, char* pend)
 {
@@ -54,7 +57,6 @@ inline static char* eat_lws_end(char* p, char* pend)
 	}
 	return p;
 }
-#endif
 
 
 

+ 1 - 12
receive.c

@@ -26,6 +26,7 @@
  *
  * History:
  * ---------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-29 transport-independent message zero-termination in
  *            receive_msg (jiri)
  * 2003-02-07 undoed jiri's zero term. changes (they break tcp) (andrei)
@@ -90,15 +91,6 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
 	/* buf[len]=0; */ /* WARNING: zero term removed! */
 	msg->rcv=*rcv_info;
 	msg->id=msg_no;
-#ifdef SCRATCH
-	/* make a copy of the message */
-	msg->orig=(char*) pkg_malloc(len+1);
-	if (msg->orig==0){
-		LOG(L_ERR, "ERROR:receive_msg: memory allocation failure\n");
-		goto error01;
-	}
-	memcpy(msg->orig, buf, len);
-#endif
 	
 	if (parse_msg(buf,len, msg)!=0){
 		LOG(L_ERR, "ERROR: receive_msg: parse_msg failed\n");
@@ -196,9 +188,6 @@ error:
 	exec_post_cb(msg);
 error02:
 	free_sip_msg(msg);
-#ifdef SCRATCH
-error01:
-#endif
 	pkg_free(msg);
 error00:
 	STATS_RX_DROPS;

+ 1 - 15
route.c

@@ -29,6 +29,7 @@
  *
  * History:
  * --------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-01-28 scratchpad removed, src_port introduced (jiri)
  */
 
@@ -399,13 +400,8 @@ static int eval_elem(struct expr* e, struct sip_msg* msg)
 	}
 	switch(e->l.operand){
 		case METHOD_O:
-#ifdef DONT_REMOVE_ZT
-				ret=comp_str(msg->first_line.u.request.method.s, e->r.param,
-								e->op, e->subtype);
-#else
 				ret=comp_strstr(&msg->first_line.u.request.method, e->r.param,
 								e->op, e->subtype);
-#endif
 				break;
 		case URI_O:
 				if(msg->new_uri.s){
@@ -415,13 +411,8 @@ static int eval_elem(struct expr* e, struct sip_msg* msg)
 									msg->parsed_uri.port_no?
 									msg->parsed_uri.port_no:SIP_PORT);
 					}else{
-#ifdef DONT_REMOVE_ZT
-						ret=comp_str(msg->new_uri.s, e->r.param,
-										e->op, e->subtype);
-#else
 						ret=comp_strstr(&msg->new_uri, e->r.param,
 										e->op, e->subtype);
-#endif
 					}
 				}else{
 					if (e->subtype==MYSELF_ST){
@@ -430,13 +421,8 @@ static int eval_elem(struct expr* e, struct sip_msg* msg)
 									msg->parsed_uri.port_no?
 									msg->parsed_uri.port_no:SIP_PORT);
 					}else{
-#ifdef DONT_REMOVE_ZT
-						ret=comp_str(msg->first_line.u.request.uri.s,
-										 e->r.param, e->op, e->subtype);
-#else
 						ret=comp_strstr(&msg->first_line.u.request.uri,
 										 e->r.param, e->op, e->subtype);
-#endif
 					}
 				}
 				break;

+ 1 - 5
ut.h

@@ -28,6 +28,7 @@
  *
  * History
  * ------
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-13 strlower added (janakj)
  * 2003-01-29 pathmax added (jiri)
  * 2003-01-28 scratchpad removed (jiri)
@@ -84,11 +85,6 @@ struct sip_msg;
 	((_via)->bsize-((_via)->name.s-\
 		((_via)->hdr.s+(_via)->hdr.len)))
 
-#ifdef SCRATCH
-#define via_s(_via,_p_msg) \
-	translate_pointer((_p_msg)->orig,(_p_msg)->buf,(_via)->name.s)
-#endif
-
 
 /* char to hex conversion table */
 static char fourbits2char[16] = { '0', '1', '2', '3', '4', '5',