/* apegobl.c */ /* Consume data from specified lc as fast as possible */ #include #include #include "atmdd.h" #include char buf[RB_SIZE]; int drops = 0; int dropcount = 0; int frames = 0; void sigint( int dummy) { printf("Frames recvd = %10d \n", frames); printf("Drops = %10d \n", drops); printf("Drop count = %10d \n", dropcount); printf("Total = %10d \n", frames + dropcount); exit(1); } main( int argc, char **argv) { int out; int fd; int len; int lc; int vci; int fc; int fctrue; signal(SIGINT, sigint); fd = open("/dev/ape25", O_RDWR); vci = 9; if (argc > 1) sscanf(argv[1], "%d", &vci); lc = ape_createlc(fd, vci); printf("Listening on vci %d lc %d \n", vci, lc); memset(buf, 0, sizeof(buf)); printf("Address of buffer is %x \n", buf); fc = 0; while (len = ape_recv(fd, vci, buf, RB_SIZE)) { fctrue = *(long *)buf; /* printf("%d %d \n", fctrue, len); */ #if 1 if (fctrue != fc) { drops += 1; dropcount += fctrue - fc; } #endif frames += 1; fc = fctrue + 1; /* write(1, buf, len); */ } }