Browse Source

delete android define and log code

pull/315/head
switch_st 4 years ago
parent
commit
21122df969
  1. 8
      include/n2n.h
  2. 24
      src/n2n.c

8
include/n2n.h

@ -115,11 +115,6 @@ typedef struct ether_hdr ether_hdr_t;
#endif
#ifdef __ANDROID_NDK__
#undef N2N_HAVE_DAEMON
#undef N2N_HAVE_SETUID
#undef N2N_CAN_NAME_IFACE
#include <tun2tap/tun2tap.h>
#include <edge_jni/edge_jni.h>
#define ARP_PERIOD_INTERVAL (10) /* sec */
#endif /* #ifdef __ANDROID_NDK__ */
@ -377,9 +372,6 @@ typedef struct n2n_sn
#include "header_encryption.h"
#include "twofish.h"
#ifdef __ANDROID_NDK__
#include <android/log.h>
#endif /* #ifdef __ANDROID_NDK__ */
#ifndef TRACE_ERROR
#define TRACE_ERROR 0, __FILE__, __LINE__
#define TRACE_WARNING 1, __FILE__, __LINE__

24
src/n2n.c

@ -129,32 +129,8 @@ void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) {
} else {
for(i=strlen(file)-1; i>0; i--) if(file[i] == '/') { i++; break; };
snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf);
#ifdef __ANDROID_NDK__
switch (eventTraceLevel) {
case 0: // ERROR
eventTraceLevel = ANDROID_LOG_ERROR;
break;
case 1: // WARNING
eventTraceLevel = ANDROID_LOG_WARN;
break;
case 2: // NORMAL
eventTraceLevel = ANDROID_LOG_INFO;
break;
case 3: // INFO
eventTraceLevel = ANDROID_LOG_DEBUG;
break;
case 4: // DEBUG
eventTraceLevel = ANDROID_LOG_VERBOSE;
break;
default: // NORMAL
eventTraceLevel = ANDROID_LOG_INFO;
break;
}
__android_log_write(eventTraceLevel, "n2n", out_buf);
#else
fprintf(traceFile, "%s\n", out_buf);
fflush(traceFile);
#endif /* #ifdef __ANDROID_NDK__ */
}
#else
/* this is the WIN32 code */

Loading…
Cancel
Save