Browse Source

- fixed branch parsed bug (parse_via)
- added module dependecy to master Makefile (modules/*/Makefile)

Andrei Pelinescu-Onciul 24 years ago
parent
commit
eaf48c3f7f
4 changed files with 17 additions and 10 deletions
  1. 4 2
      Makefile
  2. 2 0
      modules/tm/Makefile
  3. 10 7
      parse_via.c
  4. 1 1
      ut.h

+ 4 - 2
Makefile

@@ -33,8 +33,10 @@ NAME=ser
 # PKG_MALLOC uses a faster malloc (exclusive w/ USE_SHM_MEM)
 # PKG_MALLOC uses a faster malloc (exclusive w/ USE_SHM_MEM)
 # USE_SHM_MEM all pkg_malloc => shm_malloc (most mallocs use a common sh. mem.
 # USE_SHM_MEM all pkg_malloc => shm_malloc (most mallocs use a common sh. mem.
 #           segment); don't define PKG_MALLOC if you want this!
 #           segment); don't define PKG_MALLOC if you want this!
-DEFS=-DTHREAD -DNOCR -DMACROEATER -DDNS_IP_HACK  -DSHM_MEM -DUSE_SHM_MEM \
-	 -DPKG_MALLOC  -DNO_DEBUG
+DEFS=-DTHREAD -DNOCR -DMACROEATER -DDNS_IP_HACK  -DSHM_MEM \
+	 -DPKG_MALLOC #-DNO_DEBUG
+# -DUSE_SHM_MEM
+#-DNO_DEBUG 
 #-DPKG_MALLOC
 #-DPKG_MALLOC
 #-DNO_DEBUG#-DSTATS -DNO_DEBUG 
 #-DNO_DEBUG#-DSTATS -DNO_DEBUG 
 #-DNO_LOG
 #-DNO_LOG

+ 2 - 0
modules/tm/Makefile

@@ -15,6 +15,8 @@ NAME=tm.so
 SHLIB_LD_FLAGS= -shared
 SHLIB_LD_FLAGS= -shared
 LIBS= -lpthread
 LIBS= -lpthread
 
 
+ALLDEP=Makefile ../../Makefile
+
 ifeq ($(ARCH), SunOS)
 ifeq ($(ARCH), SunOS)
 LDFLAGS=-O2 -G
 LDFLAGS=-O2 -G
 endif
 endif

+ 10 - 7
parse_via.c

@@ -263,6 +263,9 @@ __inline char* parse_via_param(	char* p, char* end, int* pstate,
 						state=HIDDEN1;
 						state=HIDDEN1;
 						param->name.s=tmp;
 						param->name.s=tmp;
 						break;
 						break;
+					case BRANCH5:
+						state=FIN_BRANCH;
+						break;
 					case GEN_PARAM:
 					case GEN_PARAM:
 						break;
 						break;
 					case F_CR:
 					case F_CR:
@@ -809,7 +812,6 @@ char* parse_via(char* buffer, char* end, struct via_body *vb)
 	char* tmp_param;
 	char* tmp_param;
 	struct via_param* param;
 	struct via_param* param;
 
 
-
 parse_again:
 parse_again:
 	vb->error=VIA_PARSE_ERROR;
 	vb->error=VIA_PARSE_ERROR;
 	/* parse start of via ( SIP/2.0/UDP    )*/
 	/* parse start of via ( SIP/2.0/UDP    )*/
@@ -1586,12 +1588,6 @@ main_via:
 						memset(param,0, sizeof(struct via_param));
 						memset(param,0, sizeof(struct via_param));
 						tmp=parse_via_param(tmp, end, &state, &saved_state,
 						tmp=parse_via_param(tmp, end, &state, &saved_state,
 											param);
 											param);
-						/*add param to the list*/
-						if (vb->last_param)	vb->last_param->next=param;
-						else				vb->param_lst=param;
-						vb->last_param=param;
-						if (param->type==PARAM_BRANCH)
-							vb->branch=param;
 						
 						
 						switch(state){
 						switch(state){
 							case L_PARAM:
 							case L_PARAM:
@@ -1616,6 +1612,12 @@ main_via:
 										*tmp, state);
 										*tmp, state);
 								goto error;
 								goto error;
 						}
 						}
+						/*add param to the list*/
+						if (vb->last_param)	vb->last_param->next=param;
+						else				vb->param_lst=param;
+						vb->last_param=param;
+						if (param->type==PARAM_BRANCH)
+							vb->branch=param;
 						break;
 						break;
 					case P_PARAM:
 					case P_PARAM:
 						break;
 						break;
@@ -1706,6 +1708,7 @@ endofpacket:
 	}
 	}
 	return tmp;
 	return tmp;
 nextvia:
 nextvia:
+	DBG("parse_via: next_via\n");
 	vb->error=VIA_PARSE_OK;
 	vb->error=VIA_PARSE_OK;
 	vb->bsize=tmp-buffer;
 	vb->bsize=tmp-buffer;
 	if (vb->port_str.s){
 	if (vb->port_str.s){

+ 1 - 1
ut.h

@@ -86,7 +86,7 @@ error_dots:
 	if (err) *err=1;
 	if (err) *err=1;
 	return 0;
 	return 0;
 error_char:
 error_char:
-	DBG("str2ip: ERROR: unexpected char %c in %s\n", *str, init);
+	DBG("str2ip: WARNING: unexpected char %c in %s\n", *str, init);
 	if (err) *err=1;
 	if (err) *err=1;
 	return 0;
 	return 0;
 }
 }