[libss7-commits] mattf: trunk r100 - in /trunk: Makefile parser_debug.c

SVN commits to the libss7 project libss7-commits at lists.digium.com
Tue Oct 2 16:28:36 CDT 2007


Author: mattf
Date: Tue Oct  2 16:28:35 2007
New Revision: 100

URL: http://svn.digium.com/view/libss7?view=rev&rev=100
Log:
Add a parser debug utility

Added:
    trunk/parser_debug.c
Modified:
    trunk/Makefile

Modified: trunk/Makefile
URL: http://svn.digium.com/view/libss7/trunk/Makefile?view=diff&rev=100&r1=99&r2=100
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Tue Oct  2 16:28:35 2007
@@ -14,7 +14,7 @@
 SOFLAGS=-Wl,-hlibss7.so.1
 LDCONFIG=/sbin/ldconfig
 
-all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) ss7test ss7linktest
+all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) ss7test ss7linktest parser_debug
 
 %.lo : %.c
 	$(CC) -g -fPIC $(CFLAGS) -o $@ -c $<
@@ -51,6 +51,9 @@
 ss7linktest: ss7linktest.c $(STATIC_LIBRARY)
 	gcc -g -o ss7linktest ss7linktest.c libss7.a -lpthread
 
+parser_debug: parser_debug.c $(STATIC_LIBRARY)
+	gcc -g -o parser_debug parser_debug.c libss7.a
+
 libss7: ss7_mtp.o mtp.o ss7.o ss7_sched.o
 
 depend: .depend

Added: trunk/parser_debug.c
URL: http://svn.digium.com/view/libss7/trunk/parser_debug.c?view=auto&rev=100
==============================================================================
--- trunk/parser_debug.c (added)
+++ trunk/parser_debug.c Tue Oct  2 16:28:35 2007
@@ -1,0 +1,40 @@
+#include <stdio.h>
+#include "libss7.h"
+#include "ss7_internal.h"
+#include "mtp2.h"
+#include "isup.h"
+#include "mtp3.h"
+
+int main(int argc, char **argv)
+{
+	FILE *fp;
+	struct ss7 *ss7 = ss7_new(SS7_ANSI);
+	unsigned char mybuf[512];
+	int res = 0, i = 0, size;
+
+	if (argc != 2)
+		return -1;
+
+	fp = fopen(argv[1], "r");
+
+	while (res != EOF) {
+		res = fscanf(fp, "%x ", &mybuf[i++]);
+	}
+
+	size = i - 1;
+
+	for (i = 0; i < size; i++) {
+		printf("%.2x ", mybuf[i]);
+	}
+
+	printf("\n");
+
+	ss7_add_link(ss7, 10);
+
+	ss7->debug = SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP;
+	ss7->links[0]->state = MTP_INSERVICE;
+
+	mtp2_receive(ss7->links[0], mybuf, size);
+
+	return 0;
+}




More information about the libss7-commits mailing list