// Entry point int main(int argc, char **argv) { GTH_api api; int data_socket = -1; int result; int monitoring = 0; int verbose = 0; Channel_t channels[MAX_MTP2_CHANNELS]; int i; int n_channels = 0; int n_sus_per_file = 0; int duration_per_file = 0; int stop_after_interval = 0; int output_filename_format = 0; int drop_fisus = 0; int esnf = 0; int listen_port = 0; int listen_socket = -1; enum PCap_format format = PCAP_NG; char *hostname; char *base_filename; // Check a couple of assumptions about type size. assert(sizeof(u32) == 4); assert(sizeof(u16) == 2); win32_specific_startup(); process_arguments(argv, argc, &monitoring, &verbose, &n_sus_per_file, &duration_per_file, &stop_after_interval, &output_filename_format, &drop_fisus, &esnf, &hostname, channels, &n_channels, &base_filename, &format); result = gth_connect(&api, hostname, verbose); if (result != 0) { die("Unable to connect to the GTH. Giving up."); } read_hw_description(&api, hostname); enable_l1(&api, channels, n_channels, monitoring); listen_socket = gth_make_listen_socket(&listen_port); for (i = 0; i < n_channels; i++){ monitor_mtp2(&api, channels + i, i, drop_fisus, esnf, listen_port, listen_socket); if (i == 0) { data_socket = gth_wait_for_accept(listen_socket); } } fprintf(stderr, "capturing packets, press ^C to abort\n"); convert_to_pcap(&api, data_socket, base_filename, n_sus_per_file, duration_per_file, stop_after_interval, output_filename_format, channels, n_channels, format); return 0; // not reached }
// Entry point int main(int argc, char** argv) { GTH_api api; int data_socket; int result; char *end = "user"; int verbose = 0; while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'v': verbose = 1; break; default: usage(); } argc--; argv++; } if (argc != 4 && argc != 5) { usage(); } if (argc == 5) { if (strcmp(argv[4], "user") && strcmp(argv[4], "network")) { usage(); } else { end = argv[4]; } } printf("end is %s\n", end); win32_specific_startup(); // Check a couple of assumptions about type size. assert(sizeof(unsigned int) == 4); assert(sizeof(unsigned short) == 2); result = gth_connect(&api, argv[1], verbose); if (result != 0) { die("Unable to connect to the GTH. Giving up."); } enable_l1(&api, argv[2]); data_socket = setup_lapd(&api, argv[2], atoi(argv[3]), end); fprintf(stderr, "lapd started, press ^C to abort\n"); dump_incoming_lapd(data_socket); return 0; // not reached }