void tap_read() { unsigned char *tosend; int read=0; tosend = malloc(10006); //printf("TAP_READ\n"); read = tapcfg_read(tapcfg, tosend + 6, 10006); tosend[0] = 0x57; tosend[1] = 0x44; tosend[2] = (read+2) & 0xff; tosend[3] = (read +2) >> 8; tosend[4] = tosend[12]; tosend[5] = tosend[13]; //memcpy(tosend + 6, tosend, read); lte_send_ctrl( tosend, read + 6); free(tosend); }
int tnt_tun_read(struct tnt_tun *tun, char *buf, int n) { tapcfg_wait_readable(tun->handle, 0); // windows reads while waiting return tapcfg_read(tun->handle, (void *) buf, n); }