-static struct packetbuf {
- uint8_t data[MTU];
- length_t len;
-} *bufs;
-
-static int nbufs = 64;
-
-DWORD WINAPI tapreader(void *bla) {
- int sock, err, status;
- struct addrinfo *ai;
- struct addrinfo hint = {
- .ai_family = AF_UNSPEC,
- .ai_socktype = SOCK_STREAM,
- .ai_protocol = IPPROTO_TCP,
- .ai_flags = 0,
- };
- unsigned char bufno = 0;
- long len;
- OVERLAPPED overlapped;
-
- /* Open a socket to the parent process */
-
- err = getaddrinfo(NULL, myport, &hint, &ai);
-
- if(err || !ai) {
- logger(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo", gai_strerror(errno));
- return -1;
- }
-
- sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP);
-
- freeaddrinfo(ai);
-
- if(sock < 0) {
- logger(LOG_ERR, _("System call `%s' failed: %s"), "socket", strerror(errno));
- return -1;
- }
-
- if(connect(sock, ai->ai_addr, ai->ai_addrlen)) {
- logger(LOG_ERR, _("System call `%s' failed: %s"), "connect", strerror(errno));
- return -1;
- }