/*---------------------------------------------------------------------------*/ void enc28j60_pollhandler(void) { int len = enc28j60_read(ethernet_tmp_buf, ETHERNET_TMP_BUF_SIZE); if(len > 0) { eth_drv_input(ethernet_tmp_buf, len); } }
static void handle_fd(fd_set * rset, fd_set * wset) { /* Optional delay between outgoing packets */ /* Base delay times number of 6lowpan fragments to be sent */ /* delaymsec = 10; */ if(delaymsec) { struct timeval tv; int dmsec; gettimeofday(&tv, NULL); dmsec = (tv.tv_sec - delaystartsec) * 1000 + tv.tv_usec / 1000 - delaystartmsec; if(dmsec < 0) delaymsec = 0; if(dmsec > delaymsec) delaymsec = 0; } if(delaymsec == 0) { int size; if(FD_ISSET(tunfd, rset)) { size = tun_input(tmp_tap_buf, sizeof(tmp_tap_buf)); if(ethernet_has_fcs) { //Remove extra data from packet capture uip_len = size - ETHERNET_LLH_LEN - 4; } else { uip_len = size - ETHERNET_LLH_LEN; } memcpy(ll_header, tmp_tap_buf, ETHERNET_LLH_LEN); memcpy(uip_buf, tmp_tap_buf + ETHERNET_LLH_LEN, uip_len); eth_drv_input(); if(slip_config_basedelay) { struct timeval tv; gettimeofday(&tv, NULL); delaymsec = slip_config_basedelay; delaystartsec = tv.tv_sec; delaystartmsec = tv.tv_usec / 1000; } } } }
/*---------------------------------------------------------------------------*/ static void handle_fd(fd_set * rset, fd_set * wset) { /* Optional delay between outgoing packets */ /* Base delay times number of 6lowpan fragments to be sent */ /* delaymsec = 10; */ if(delaymsec) { struct timeval tv; int dmsec; gettimeofday(&tv, NULL); dmsec = (tv.tv_sec - delaystartsec) * 1000 + tv.tv_usec / 1000 - delaystartmsec; if(dmsec < 0) delaymsec = 0; if(dmsec > delaymsec) delaymsec = 0; } if(delaymsec == 0) { int size; if(FD_ISSET(eth_fd, rset)) { size = eth_dev_input(ethernet_tmp_buf, ETHERNET_TMP_BUF_SIZE); eth_drv_input(ethernet_tmp_buf, size); if(sixlbr_config_eth_basedelay) { struct timeval tv; gettimeofday(&tv, NULL); delaymsec = sixlbr_config_eth_basedelay; delaystartsec = tv.tv_sec; delaystartmsec = tv.tv_usec / 1000; } } } }