From 74be0e96626f2d29d20cb4c8ae5a652d1bf013bb Mon Sep 17 00:00:00 2001 From: markster Date: Fri, 18 Oct 2002 17:39:21 +0000 Subject: Version 0.3.2 from FTP git-svn-id: http://svn.digium.com/svn/zaptel/trunk@118 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- patlooptest.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 patlooptest.c (limited to 'patlooptest.c') diff --git a/patlooptest.c b/patlooptest.c new file mode 100755 index 0000000..605f254 --- /dev/null +++ b/patlooptest.c @@ -0,0 +1,110 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BLOCK_SIZE 2039 + +void print_packet(unsigned char *buf, int len) +{ + int x; + printf("{ "); + for (x=0;x\n"); + exit(1); + } + fd = open(argv[1], O_RDWR, 0600); + if (fd < 0) { + fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); + exit(1); + } + if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs)) { + fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); + exit(1); + } + if (ioctl(fd, ZT_GET_PARAMS, &tp)) { + fprintf(stderr, "Unable to get channel parameters\n"); + exit(1); + } + ioctl(fd, ZT_GETEVENT); + + i = ZT_FLUSH_ALL; + if (ioctl(fd,ZT_FLUSH,&i) == -1) + { + perror("tor_flush"); + exit(255); + } + + for(;;) { + res = bs; + for (x=0;x 1) read(fd,inbuf,bs); + skipcount--; + if (!skipcount) puts("Going for it..."); + continue; + } + + res = read(fd, inbuf, bs); + if (res < bs) { + printf("Res is %d\n", res); + exit(1); + } + if (!setup) { + c = inbuf[0]; + setup++; + } + for (x=0;x