Windows Support
This commit is contained in:
@@ -34,11 +34,14 @@
|
||||
#define LIBZT_DEBUG_HPP
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#define ZT_MSG_ERROR true // Errors
|
||||
@@ -53,7 +56,7 @@
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
#if defined(ZT_COLOR) && !defined(__ANDROID__) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_IPHONE_SIMULATOR) && !defined(__APP_FRAMEWORK__)
|
||||
#if defined(ZT_COLOR) && !defined(__MINGW32__) && !defined(__ANDROID__) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_IPHONE_SIMULATOR) && !defined(__APP_FRAMEWORK__)
|
||||
#define ZT_RED "\x1B[31m"
|
||||
#define ZT_GRN "\x1B[32m"
|
||||
#define ZT_YEL "\x1B[33m"
|
||||
@@ -88,6 +91,9 @@ extern unsigned int gettid(); // defined in libzt.cpp
|
||||
#elif __APPLE__
|
||||
#define ZT_THREAD_ID (long)0//(long)gettid()
|
||||
#endif
|
||||
#ifdef __MINGW32__
|
||||
#define ZT_THREAD_ID (long)0
|
||||
#endif
|
||||
|
||||
#if defined(__JNI_LIB__)
|
||||
#include <jni.h>
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
*/
|
||||
#define ZTO_ID_LEN 16
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
typedef uint32_t socklen_t;
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* For SOCK_RAW support, it will initially be modeled after linux's API, so */
|
||||
|
||||
@@ -35,6 +35,17 @@
|
||||
|
||||
#include "InetAddress.hpp"
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
|
||||
#define NS_INADDRSZ 4
|
||||
#define NS_IN6ADDRSZ 16
|
||||
#define NS_INT16SZ 2
|
||||
|
||||
int inet_pton4(const char *src, void *dst);
|
||||
int inet_pton6(const char *src, void *dst);
|
||||
int inet_pton(int af, const char *src, void *dst);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Returns masked address for subnet comparisons
|
||||
*
|
||||
@@ -62,7 +73,7 @@ char *beautify_eth_proto_nums(int proto);
|
||||
* @param inet
|
||||
* @return
|
||||
*/
|
||||
void sockaddr2inet(int socket_family, const struct sockaddr *addr, ZeroTier::InetAddress *inet);
|
||||
//void sockaddr2inet(int socket_family, const struct sockaddr *addr, ZeroTier::InetAddress *inet);
|
||||
|
||||
/**
|
||||
* @brief Convert a raw MAC address byte array into a human-readable string
|
||||
|
||||
@@ -33,11 +33,14 @@
|
||||
#ifndef LIBZT_H
|
||||
#define LIBZT_H
|
||||
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#include "Debug.hpp"
|
||||
#include "Defs.h"
|
||||
|
||||
@@ -440,7 +443,9 @@ int zts_close(int fd);
|
||||
* @param timeout
|
||||
* @return
|
||||
*/
|
||||
#if defined(__linux__)
|
||||
int zts_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready"
|
||||
|
||||
@@ -60,12 +60,12 @@ void lwip_dns_init();
|
||||
* @usage lwip_driver_init()
|
||||
* @return
|
||||
*/
|
||||
void lwip_start_dhcp(struct netif *interface);
|
||||
void lwip_start_dhcp(void *netif);
|
||||
|
||||
void general_lwip_init_interface(void *tapref, struct netif *interface, const char *name, const ZeroTier::MAC &mac,
|
||||
void general_lwip_init_interface(void *tapref, void *netif, const char *name, const ZeroTier::MAC &mac,
|
||||
const ZeroTier::InetAddress &addr, const ZeroTier::InetAddress &nm, const ZeroTier::InetAddress &gw);
|
||||
|
||||
void general_turn_on_interface(struct netif *interface);
|
||||
void general_turn_on_interface(void *netif);
|
||||
|
||||
/**
|
||||
* @brief Set up an interface in the network stack for the VirtualTap.
|
||||
|
||||
Reference in New Issue
Block a user