Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
    t38_core_state_t t38_core_a;
    t38_core_state_t t38_core_b;

    for (t38_version = 0;  t38_version < 2;  t38_version++)
    {
        printf("Using T.38 version %d\n", t38_version);

        if (t38_core_init(&t38_core_a,
                          rx_indicator_handler,
                          rx_data_handler,
                          rx_missing_handler,
                          &t38_core_b,
                          tx_packet_handler,
                          &t38_core_b) == NULL)
        {
            fprintf(stderr, "Cannot start the T.38 core\n");
            exit(2);
        }
        if (t38_core_init(&t38_core_b,
                          rx_indicator_handler,
                          rx_data_handler,
                          rx_missing_handler,
                          &t38_core_a,
                          tx_packet_handler,
                          &t38_core_a) == NULL)
        {
            fprintf(stderr, "Cannot start the T.38 core\n");
            exit(2);
        }

        t38_set_t38_version(&t38_core_a, t38_version);
        t38_set_t38_version(&t38_core_b, t38_version);

        span_log_set_level(&t38_core_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG);
        span_log_set_tag(&t38_core_a.logging, "T.38-A");
        span_log_set_level(&t38_core_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG);
        span_log_set_tag(&t38_core_b.logging, "T.38-B");

        if (encode_decode_tests(&t38_core_a, &t38_core_b))
        {
            printf("Encode/decode tests failed\n");
            exit(2);
        }
        if (attack_tests(&t38_core_a))
        {
            printf("Attack tests failed\n");
            exit(2);
        }
    }
    if (!succeeded)
    {
        printf("Tests failed\n");
        exit(2);
    }
    printf("Tests passed\n");
    return  0;
}
int main(int argc, char *argv[])
{
    int opt;
    const char *decode_test_file;

    decode_test_file = NULL;
    while ((opt = getopt(argc, argv, "d:")) != -1)
    {
        switch (opt)
        {
        case 'd':
            decode_test_file = optarg;
            break;
        default:
            //usage();
            exit(2);
            break;
        }
    }

    if (decode_test_file)
    {
        decode_file(decode_test_file);
        return 0;
    }

    if (encode_decode_tests())
    {
        printf("Tests failed\n");
        return 2;
    }

    if (mitel_cm7291_side_2_and_bellcore_tests())
    {
        printf("Tests failed\n");
        return 2;
    }

    if (end_to_end_tests())
    {
        printf("Tests failed\n");
        return 2;
    }

    printf("Tests passed\n");
    return 0;
}