#include #include #include #include #include #include #include #include #include #include #include #ifdef STANDALONE_ZAPATA #include "zaptel.h" #else #include #endif #define BLOCK_SIZE 2039 void print_packet(unsigned char *buf, int len) { int x; printf("{ "); for (x=0;x 3 ) { fprintf(stderr, "Usage: %s \n",argv[0]); 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); } if(argc==3){ timeout=atoi(argv[2]); start_time=time(NULL); printf("Using Timeout of %d Seconds\n",timeout); } 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;xtimeout){ printf("Timeout achieved Ending Program\n"); return errors; } } }