/* This file is part of the YAZ toolkit. * Copyright (C) Index Data * See the file LICENSE for details. */ #if HAVE_CONFIG_H #include #endif #include #if HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_STAT_H #include #endif #include #if HAVE_UNISTD_H #include #endif #include #include #include #include #include #define PACKET_SIZE 64 static int stop = 0; /* static int send_packet(const char *host) { char buf[PACKET_SIZE]; int i; void *add; COMSTACK cs = cs_create_host(host, 1, &add); if (!cs) return -1; if (cs_connect(cs, add) < 0) return -1; for (i = 0; i 0) { ssize_t wrote; wrote = write(fd, buf+off+j, sizeof(buf)-j-off); if (wrote <= 0) { yaz_log(YLOG_ERRNO|YLOG_FATAL, "write %s", fname); exit (1); } off += wrote; } if (close(fd) == -1) { yaz_log(YLOG_ERRNO|YLOG_FATAL, "close %s", fname); exit (1); } } mbuf = malloc(sizeof(buf)-j); memcpy(mbuf, buf+j, sizeof(buf)-j); odr_setbuf(odr, mbuf, sizeof(buf)-j, 0); if (z_GDU(odr, &req, 0, 0)) estat[99]++; else { int ex; odr_geterrorx(odr, &ex); estat[ex]++; } if (dumpfile) odr_dumpBER(dumpfile, buf+j, sizeof(buf)-j); free(mbuf); odr_reset(odr); odr_destroy(odr); } if (dumpfile && dumpfile != stdout) fclose(dumpfile); } void sigint_handler(int x) { stop = 1; } int main(int argc, char **argv) { int start = 0, end = 10000000, ret, i, estat[100]; char *arg; char *ber_fname = 0; char *packet_fname = 0; signal(SIGINT, sigint_handler); signal(SIGTERM, sigint_handler); for (i = 0; i