updated flags

This commit is contained in:
Joseph Henry
2016-06-27 14:15:58 -07:00
parent f2a0a1b579
commit aa9b514c0b
10 changed files with 30 additions and 27 deletions

View File

@@ -50,14 +50,14 @@
#define MSG_DEBUG 4 // Information which is only useful to someone debugging
#define MSG_DEBUG_EXTRA 5 // If nothing in your world makes sense
#define DEBUG_TO_FILE 1
#define DEBUG_LOGFILE_PATH "/Users/Joseph/code/ztnc_logfile.txt"
void dwr(int level, const char *fmt, ... );
void dwr(int level, const char *fmt, ... )
{
#if defined(ZT_SDK_DEBUG)
fprintf(stderr, "Hello from debug!\n");
#if defined(SDK_DEBUG)
if(level > DEBUG_LEVEL)
return;
int saveerr;
@@ -75,10 +75,10 @@ void dwr(int level, const char *fmt, ... )
#elif defined(__APPLE__)
pid_t tid = pthread_mach_thread_np(pthread_self());
#endif
if(DEBUG_TO_FILE) {
#if defined(SDK_DEBUG_WRITE_LOGFILE)
FILE *file = fopen(DEBUG_LOGFILE_PATH,"a");
vfprintf(file, fmt, ap);
}
#endif
fprintf(stderr, "%s [tid=%7d] ", timestring, tid);
vfprintf(stderr, fmt, ap);
fflush(stderr);

View File

@@ -132,7 +132,7 @@ NetconEthernetTap::NetconEthernetTap(
char sockPath[4096],lwipPath[4096];
rpcCounter = -1;
Utils::snprintf(sockPath,sizeof(sockPath),"%s%snc_%.16llx",homePath,ZT_PATH_SEPARATOR_S,_nwid,ZT_PATH_SEPARATOR_S,(unsigned long long)nwid);
_dev = sockPath; // in netcon mode, set device to be just the network ID
_dev = sockPath; // in SDK mode, set device to be just the network ID
// Start SOCKS5 Proxy server
// For use when traditional syscall hooking isn't available (ex. some APIs on iOS and Android)

View File

@@ -103,7 +103,7 @@ int get_retval(int rpc_sock)
int load_symbols_rpc()
{
#if defined(NETCON_INTERCEPT) || defined(__IOS__) || defined(__UNITY_3D__)
#if defined(SDK_INTERCEPT) || defined(__IOS__) || defined(__UNITY_3D__)
realsocket = dlsym(RTLD_NEXT, "socket");
realconnect = dlsym(RTLD_NEXT, "connect");
if(!realconnect || !realsocket)

View File

@@ -94,6 +94,7 @@ const char *get_netpath() {
void zt_init_rpc(char *nwid)
{
dwr(MSG_DEBUG, "zt_init_rpc\n");
#if defined(__UNITY_3D__)
//char *nw = "565799d8f6e1c11a";
//char *path = "/Users/Joseph/utest2/nc_";
@@ -133,6 +134,8 @@ const char *get_netpath() {
if (!api_netpath) {
api_netpath = getenv("ZT_NC_NETWORK");
set_netpath(api_netpath);
dwr(MSG_DEBUG, "netpath = %s\n", api_netpath);
if(!api_netpath) {
// return 0;
}