Example #1
0
    else
    {
        printf("Please specify twarp <x.x.x.x> \n");
        exit(1);
    }
    user_app_main(NULL);
}

int user_app_main(__attribute__((unused)) void * app_params)
{
    tw_rx_t * server;
    tw_timer_t * timer_handle;
    int status;
    tw_loop_t * tw_loop = tw_default_loop(INFINITE_LOOP);

    server = tw_rx_init(tw_loop);
    if(server == NULL)
    {
        printf("Error in RX init\n");
        exit(1);
    }

    status = tw_rx_start(server, reply_payload);
    if(status)
    {
        printf("Error in receive start\n");
        exit(1);
    }
    timer_handle = tw_timer_init(tw_loop);
    tw_timer_start(timer_handle, check_arp, 1000);
Example #2
0
    parse_user_params("udp_traffic_data");
    tw_map_port_to_engine("tw0", "engine0");
    phy_port_id = tw_eth_name_to_id("tw0");
    tx_buf = tw_new_buffer(user_params.payload_size);
    global_stats_option.secs_passed=0;
    ppsdelay = tw_get_tsc_hz()/user_params.pps_limit;
    user_app_main(NULL);
    return 0;
}
int user_app_main(__attribute__((unused)) void * app_params) {
    tw_rx_t * rx_handle;
    tw_tx_t * tx_handle;
    tw_timer_t * timer_handle;
    int status;
    tw_loop_t * tw_loop = tw_default_loop(INFINITE_LOOP);
    rx_handle = tw_rx_init(tw_loop);
    if (rx_handle == NULL) {
        printf("Error in RX initn");
        exit(1);
    }
    status = tw_rx_start(rx_handle, pkt_rx);
    if (status) {
        printf("Error in receive startn");
        exit(1);
    }
    tx_handle = tw_tx_init(tw_loop);
    if (tx_handle == NULL) {
        printf("Error in TX initn");
        exit(1);
    }
    status = tw_tx_start(tx_handle, pkt_tx);