예제 #1
0
int main(int argc, char **argv)
{
    FILE    *file;
    Hubyte   mac[6];

    mac[0] = 0x00;    mac[1] = 0xE0;
    mac[2] = 0x18;    mac[3] = 0xE4;
    mac[4] = 0xB2;    mac[5] = 0x74;

    eth_init( mac );
    setup_ncurses();

    num_packets = 0;
    num_bytes   = 0;
    res_total   = 0;
    res_number  = 0;
    res_max     = 0;
    res_min     = 0;
    
    file = open_file( argv[1] );
    log_data( file );

    close_ncurses();
    eth_destroy();
    return 0;
}
예제 #2
0
int main( int argc, char *argv[] )
{
    Hubyte   src[6];

    src[0] = 0x00;
    src[1] = 0xE0;
    src[2] = 0x18;
    src[3] = 0xE4;
    src[4] = 0xB2;
    src[5] = 0x74;

    eth_init( src );
    run( argv[1], argv[2] );
    
    eth_destroy();
    return 0;
}
예제 #3
0
파일: phost.c 프로젝트: Milstein/trema
int phost_run()
{
    int count = 0;
    eth *eth;

    trx_rx();

    eth = trx_rxq_pop();

    while((eth != NULL) && (count < PHOST_RUN_LOOP_COUNT)){
        /*
        log_debug("new packet recived: %s", eth_dump(eth, pkt_dump));
        memset(pkt_dump, 0, sizeof(char)*PKT_BUF_SIZE*2);
        */

        /* note that multicast frame is not supported. */
        if(phost_promiscuous ||
           (memcmp(eth->dst, arp_host_mac_addr, ETH_ADDR_LEN) == 0) ||
           (memcmp(eth->dst, eth_mac_addr_bc, ETH_ADDR_LEN) == 0)){
            switch(eth->type){
            case ETH_TYPE_ARP:
                arp_handle_message(eth);
                break;
            case ETH_TYPE_IPV4:
                ipv4_handle_message(eth);
                break;
            default:
                log_debug("unsupported ether type.");
                break;
            }
        }
        eth_destroy(eth);
        count++;
        eth = trx_rxq_pop();
    }

    trx_all();

    return 0;
}