소스 검색

- removed -DTHREAD from the Makefile
- sync'ed the version flags w/ the new compile options
- fixed get_hdr_field/TO, Call-ID a.s.o parsing
- removed -lpthread from tm's Makefile

Andrei Pelinescu-Onciul 24 년 전
부모
커밋
25b49bb46c
8개의 변경된 파일119개의 추가작업 그리고 11개의 파일을 삭제
  1. 5 4
      Makefile
  2. 17 2
      main.c
  3. 1 1
      modules/tm/Makefile
  4. 4 4
      msg_parser.c
  5. 23 0
      test/invite3-callid.sip
  6. 23 0
      test/invite4-cseq.sip
  7. 23 0
      test/invite5-callid.sip
  8. 23 0
      test/invite6-badbranch-via.sip

+ 5 - 4
Makefile

@@ -21,21 +21,22 @@ NAME=ser
 # implementation still nasty and reports per-process
 # implementation still nasty and reports per-process
 # NO_DEBUG turns off some of the debug messages (DBG(...)).
 # NO_DEBUG turns off some of the debug messages (DBG(...)).
 # NO_LOG completely turns of all the logging (and DBG(...))
 # NO_LOG completely turns of all the logging (and DBG(...))
-# DEBUG compiles in some extra debugging code
+# EXTRA_DEBUG compiles in some extra debugging code
 # DNS_IP_HACK faster ip address resolver for ip strings (e.g "127.0.0.1")
 # DNS_IP_HACK faster ip address resolver for ip strings (e.g "127.0.0.1")
 # SHM_MEM    compiles in shared mem. support, needed by some modules and
 # SHM_MEM    compiles in shared mem. support, needed by some modules and
 #            by USE_SHM_MEM
 #            by USE_SHM_MEM
 # 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!
-#  DBG_QM_MALLOC - qm_malloc debug code, will cause pkg_malloc and shm_malloc
+# DBG_QM_MALLOC - qm_malloc debug code, will cause pkg_malloc and shm_malloc
 #                  to keep and display lot of debuging information: file name,
 #                  to keep and display lot of debuging information: file name,
 #                  function, line number of malloc/free call for each block,
 #                  function, line number of malloc/free call for each block,
 #                  extra error checking (trying to free the same pointer
 #                  extra error checking (trying to free the same pointer
 #                  twice, trying to free a pointer alloc'ed with a different
 #                  twice, trying to free a pointer alloc'ed with a different
 #                  malloc etc.)
 #                  malloc etc.)
-DEFS=-DTHREAD -DNOCR -DMACROEATER -DDNS_IP_HACK  -DSHM_MEM \
-	 -DPKG_MALLOC -DDBG_QM_MALLOC #-DNO_DEBUG
+DEFS=-DNOCR -DMACROEATER -DDNS_IP_HACK  -DSHM_MEM \
+	 -DPKG_MALLOC -DDBG_QM_MALLOC 
+#-DEXTRA_DEBUG
 # -DUSE_SHM_MEM
 # -DUSE_SHM_MEM
 #-DNO_DEBUG 
 #-DNO_DEBUG 
 #-DPKG_MALLOC
 #-DPKG_MALLOC

+ 17 - 2
main.c

@@ -57,12 +57,27 @@ static char flags[]=
 #ifdef NO_LOG
 #ifdef NO_LOG
 ", NO_LOG"
 ", NO_LOG"
 #endif
 #endif
-#ifdef DEBUG
-", DEBUG"
+#ifdef EXTRA_DEBUG
+", EXTRA_DEBUG"
 #endif
 #endif
 #ifdef DNS_IP_HACK
 #ifdef DNS_IP_HACK
 ", DNS_IP_HACK"
 ", DNS_IP_HACK"
 #endif
 #endif
+#ifdef SHM_MEM
+", SHM_MEM"
+#endif
+#ifdef PKG_MALLOC
+", PKG_MALLOC"
+#endif
+#ifdef USE_SHM_MEM
+", USE_SHM_MEM"
+#endif
+#ifdef DBG_QM_MALLOC
+", DBG_QM_MALLOC"
+#endif
+#ifdef DEBUG_DMALLOC
+", DEBUG_DMALLOC"
+#endif
 ;
 ;
 
 
 static char help_msg[]= "\
 static char help_msg[]= "\

+ 1 - 1
modules/tm/Makefile

@@ -13,7 +13,7 @@ depends= $(sources:.c=.d)
 NAME=tm.so
 NAME=tm.so
 
 
 SHLIB_LD_FLAGS= -shared
 SHLIB_LD_FLAGS= -shared
-LIBS= -lpthread
+LIBS= #-lpthread
 CFLAGS+= -fPIC -DPIC
 CFLAGS+= -fPIC -DPIC
 
 
 ALLDEP=Makefile ../../Makefile
 ALLDEP=Makefile ../../Makefile

+ 4 - 4
msg_parser.c

@@ -267,10 +267,10 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 							hdr->name.s, hdr->type);
 							hdr->name.s, hdr->type);
 					goto error;
 					goto error;
 				}
 				}
+				tmp=match;
 			}while( match<end &&( (*match==' ')||(*match=='\t') ) );
 			}while( match<end &&( (*match==' ')||(*match=='\t') ) );
 			*(match-1)=0; /*null terminate*/
 			*(match-1)=0; /*null terminate*/
 			hdr->body.len=match-hdr->body.s;
 			hdr->body.len=match-hdr->body.s;
-			tmp=match;
 			break;
 			break;
 		default:
 		default:
 			LOG(L_CRIT, "BUG: get_hdr_field: unknown header type %d\n",
 			LOG(L_CRIT, "BUG: get_hdr_field: unknown header type %d\n",
@@ -618,7 +618,7 @@ int parse_headers(struct sip_msg* msg, int flags)
 			msg->last_header->next=hf;
 			msg->last_header->next=hf;
 			msg->last_header=hf;
 			msg->last_header=hf;
 		}
 		}
-	#ifdef DEBUG
+	#ifdef EXTRA_DEBUG
 		DBG("header field type %d, name=<%s>, body=<%s>\n",
 		DBG("header field type %d, name=<%s>, body=<%s>\n",
 			hf->type, hf->name.s, hf->body.s);
 			hf->type, hf->name.s, hf->body.s);
 	#endif
 	#endif
@@ -688,7 +688,7 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
 	second_via=0;
 	second_via=0;
 	if (parse_headers(msg, flags)==-1) goto error;
 	if (parse_headers(msg, flags)==-1) goto error;
 
 
-#ifdef DEBUG
+#ifdef EXTRA_DEBUG
 	/* dump parsed data */
 	/* dump parsed data */
 	if (msg->via1){
 	if (msg->via1){
 		DBG(" first  via: <%s/%s/%s> <%s:%s(%d)>",
 		DBG(" first  via: <%s/%s/%s> <%s:%s(%d)>",
@@ -711,7 +711,7 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
 #endif
 #endif
 	
 	
 
 
-#ifdef DEBUG
+#ifdef EXTRA_DEBUG
 	DBG("exiting parse_msg\n");
 	DBG("exiting parse_msg\n");
 #endif
 #endif
 
 

+ 23 - 0
test/invite3-callid.sip

@@ -0,0 +1,23 @@
+INVITE sip:[email protected] SIP/2.0
+Via: SIP/2.0/UDP 193.175.133.193
+From: "GMD FOKUS iptlab" <sip:[email protected]>;tag=b96b0300ed30f1286-2f5d
+To: <sip:[email protected]>
+ Call-ID: [email protected]
+CSeq: 101 INVITE
+Expires: 180
+User-Agent: Cisco-SIP-IP-Phone/2
+Accept: application/sdp
+Contact: sip:[email protected]:5060
+Content-Type: application/sdp
+Content-Length: 225
+
+
+v=0
+o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
+s=SIP Call
+c=IN IP4 195.37.78.190
+t=0 0
+m=audio 18456 RTP/AVP 0 8 18 101
+a=rtpmap:0 pcmu/8000
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-11 

+ 23 - 0
test/invite4-cseq.sip

@@ -0,0 +1,23 @@
+INVITE sip:[email protected] SIP/2.0
+Via: SIP/2.0/UDP 193.175.133.193
+From: "GMD FOKUS iptlab" <sip:[email protected]>;tag=b96b0300ed30f1286-2f5d
+To: <sip:[email protected]>
+Call-ID: [email protected]
+CSeq:101
+Expires: 180
+User-Agent: Cisco-SIP-IP-Phone/2
+Accept: application/sdp
+Contact: sip:[email protected]:5060
+Content-Type: application/sdp
+Content-Length: 225
+
+
+v=0
+o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
+s=SIP Call
+c=IN IP4 195.37.78.190
+t=0 0
+m=audio 18456 RTP/AVP 0 8 18 101
+a=rtpmap:0 pcmu/8000
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-11 

+ 23 - 0
test/invite5-callid.sip

@@ -0,0 +1,23 @@
+INVITE sip:[email protected] SIP/2.0
+Via: SIP/2.0/UDP 193.175.133.193
+From: "GMD FOKUS iptlab" <sip:[email protected]>;tag=b96b0300ed30f1286-2f5d
+To: <sip:[email protected]>
+Call-ID; [email protected]
+CSeq: 101 INVITE
+Expires: 180
+User-Agent: Cisco-SIP-IP-Phone/2
+Accept: application/sdp
+Contact: sip:[email protected]:5060
+Content-Type: application/sdp
+Content-Length: 225
+
+
+v=0
+o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
+s=SIP Call
+c=IN IP4 195.37.78.190
+t=0 0
+m=audio 18456 RTP/AVP 0 8 18 101
+a=rtpmap:0 pcmu/8000
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-11 

+ 23 - 0
test/invite6-badbranch-via.sip

@@ -0,0 +1,23 @@
+INVITE sip:[email protected] SIP/2.0
+Via: SIP/2.0/UDP 193.175.133.193;branch=
+From: "GMD FOKUS iptlab" <sip:[email protected]>;tag=b96b0300ed30f1286-2f5d
+To: <sip:[email protected]>
+Call-ID: [email protected]
+CSeq: 101 INVITE
+Expires: 180
+User-Agent: Cisco-SIP-IP-Phone/2
+Accept: application/sdp
+Contact: sip:[email protected]:5060
+Content-Type: application/sdp
+Content-Length: 225
+
+
+v=0
+o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
+s=SIP Call
+c=IN IP4 195.37.78.190
+t=0 0
+m=audio 18456 RTP/AVP 0 8 18 101
+a=rtpmap:0 pcmu/8000
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-11