[sr-dev] git:master: core: deleted test.c.bak

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Jul 13 15:32:22 CEST 2009


Module: sip-router
Branch: master
Commit: e12cf4810aa16da679bdad77359d7a29ed4225eb
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e12cf4810aa16da679bdad77359d7a29ed4225eb

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon Jul 13 15:29:55 2009 +0200

core: deleted test.c.bak

test.c.bak was one of the first files in the ser repository.
test.c was used to test the first version of the sip parser and
test.c.bak made it by mistake into the first cvs repository.

---

 test.c.bak |  134 ------------------------------------------------------------
 1 files changed, 0 insertions(+), 134 deletions(-)

diff --git a/test.c.bak b/test.c.bak
deleted file mode 100644
index d395060..0000000
--- a/test.c.bak
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * tst  
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include "msg_parser.h"
-#include "dprint.h"
-
-#define BSIZE 1024
-char buf[BSIZE+1];
-
-void main()
-{
-	char* rest;
-	char* tmp;
-	char* first_via;
-	char* second_via;
-	struct msg_start fl;
-	struct hdr_field hf;
-	struct via_body vb1, vb2;
-
-	int len;
-	int offset;
-	int r;
-
-	while(!feof(stdin)){
-		len=fread(buf,1,BSIZE,stdin);
-		buf[len+1]=0;
-		printf("read <%s>(%d)\n",buf,strlen(buf));
-		fflush(stdin);
-	
-		/* eat crlf from the beginning */
-		for (tmp=buf; (*tmp=='\n' || *tmp=='\r')&&
-				tmp-buf < len ; tmp++);
-		offset=tmp-buf;
-		rest=parse_first_line(tmp, len-offset, &fl);
-		offset+=rest-tmp;
-		tmp=rest;
-		switch(fl.type){
-			case SIP_INVALID:
-				printf("invalid message\n");
-				break;
-			case SIP_REQUEST:
-				printf("SIP Request:\n");
-				printf(" method:  <%s>\n",fl.u.request.method);
-				printf(" uri:     <%s>\n",fl.u.request.uri);
-				printf(" version: <%s>\n",fl.u.request.version);
-				break;
-			case SIP_REPLY:
-				printf("SIP Reply  (status):\n");
-				printf(" version: <%s>\n",fl.u.reply.version);
-				printf(" status:  <%s>\n",fl.u.reply.status);
-				printf(" reason:  <%s>\n",fl.u.reply.reason);
-				break;
-			default:
-				printf("unknown type %d\n",fl.type);
-		}
-		
-		/*find first Via: */
-		hf.type=HDR_ERROR;
-		first_via=0;
-		second_via=0;
-		do{
-			rest=get_hdr_field(tmp, len-offset, &hf);
-			offset+=rest-tmp;
-			tmp=rest;
-			switch (hf.type){
-				case HDR_ERROR:
-					DPrint("ERROR: bad header  field\n");
-					goto  error;
-				case HDR_EOH: 
-					goto eoh;
-				case HDR_VIA:
-					if (first_via==0) first_via=hf.body;
-					else if (second_via==0) second_via=hf.body;
-					break;
-			}
-			printf("header field type %d, name=<%s>, body=<%s>\n",
-				hf.type, hf.name, hf.body);
-
-		
-		}while(hf.type!=HDR_EOH && rest-buf < len);
-
-	eoh:
-		/* replace cr/lf with space in first via */
-		for (tmp=first_via;(first_via) && (*tmp);tmp++)
-			if ((*tmp=='\r')||(*tmp=='\n'))	*tmp=' ';
-
-		printf("first via: <%s>\n", first_via);
-		tmp=parse_via_body(first_via, strlen(first_via), &vb1);
-		if (vb1.error!=VIA_PARSE_OK){
-			DPrint("ERROR: parsing via body: %s\n", first_via);
-			goto error;
-		}
-		/* compact via */
-		if (vb1.next) second_via=vb1.next;
-		if (second_via) {
-			tmp=parse_via_body(second_via, strlen(second_via), &vb2);
-			if (vb2.error!=VIA_PARSE_OK){
-				DPrint("ERROR: parsing via body: %s\n", second_via);
-				goto error;
-			}
-		}
-		
-		/* dump parsed data */
-		printf(" first  via: <%s/%s/%s> <%s:%d>",
-				vb1.name, vb1.version, vb1.transport, vb1.host, vb1.port);
-		if (vb1.params) printf(";<%s>", vb1.params);
-		if (vb1.comment) printf(" <%s>", vb1.comment);
-		printf ("\n");
-		if (second_via){
-			printf(" second via: <%s/%s/%s> <%s:%d>",
-					vb2.name, vb2.version, vb2.transport, vb2.host, vb2.port);
-			if (vb2.params) printf(";<%s>", vb2.params);
-			if (vb2.comment) printf(" <%s>", vb2.comment);
-			printf ("\n");
-		}
-
-		
-
-	error:
-		/* find endof msg */
-		printf("rest:(buffer=%x, rest=%x)\n%s\n.\n",buf,rest,rest);
-
-		for (r=0; r<len+1;r++)
-			printf("%02x ", buf[r]);
-		printf("\n*rest=%02x\n",*rest);
-		
-	}
-}
-				
-			




More information about the sr-dev mailing list