| 614 | |
| 615 | |
| 616 | int main (int argc, char *argv[]) { |
| 617 | int i; |
| 618 | unsigned int res; |
| 619 | uint32_t maxsize; |
| 620 | int opt; |
| 621 | int bs; |
| 622 | int write_size = 4096; |
| 623 | int delay_time = 1000; |
| 624 | int repetitions = 100; |
| 625 | int print_time = 10; |
| 626 | int have_size = 0; |
| 627 | int listen_only = 0; |
| 628 | int flood = 0; |
| 629 | int model = 1; |
| 630 | int option_index = 0; |
| 631 | struct option long_options[] = { |
| 632 | {"flood-start", required_argument, 0, 0 }, |
| 633 | {"flood-mult", required_argument, 0, 0 }, |
| 634 | {"flood-max", required_argument, 0, 0 }, |
| 635 | {"size-kb", required_argument, 0, 'w' }, |
| 636 | {"size-bytes", required_argument, 0, 'W' }, |
| 637 | {"name", required_argument, 0, 'n' }, |
| 638 | {"rtt", no_argument, 0, 't' }, |
| 639 | {"flood", no_argument, 0, 'f' }, |
| 640 | {"quiet", no_argument, 0, 'q' }, |
| 641 | {"listen", no_argument, 0, 'l' }, |
| 642 | {"help", no_argument, 0, '?' }, |
| 643 | {0, 0, 0, 0 } |
| 644 | }; |
| 645 | |
| 646 | while ( (opt = getopt_long(argc, argv, "qlstafMEn:d:r:p:m:w:W:D:", |
| 647 | long_options, &option_index)) != -1 ) { |
| 648 | switch (opt) { |
| 649 | case 0: // Long-only options |
| 650 | if (strcmp(long_options[option_index].name, "flood-start") == 0) { |
| 651 | flood_start = parse_bytes(optarg); |
| 652 | if (flood_start == 0) { |
| 653 | fprintf(stderr, "flood-start value invalid\n"); |
| 654 | exit(1); |
| 655 | } |
| 656 | } |
| 657 | if (strcmp(long_options[option_index].name, "flood-mult") == 0) { |
| 658 | flood_multiplier = parse_bytes(optarg); |
| 659 | if (flood_multiplier == 0) { |
| 660 | fprintf(stderr, "flood-mult value invalid\n"); |
| 661 | exit(1); |
| 662 | } |
| 663 | } |
| 664 | if (strcmp(long_options[option_index].name, "flood-max") == 0) { |
| 665 | flood_max = parse_bytes(optarg); |
| 666 | if (flood_max == 0) { |
| 667 | fprintf(stderr, "flood-max value invalid\n"); |
| 668 | exit(1); |
| 669 | } |
| 670 | } |
| 671 | break; |
| 672 | case 'w': // Write size in K |
| 673 | bs = atoi(optarg); |
nothing calls this directly
no test coverage detected