2015-04-24 04:36:33 +00:00
|
|
|
#ifndef ZT1_jniutils_h_
|
|
|
|
#define ZT1_jniutils_h_
|
2015-05-01 04:50:28 +00:00
|
|
|
#include <stdio.h>
|
2015-04-24 04:36:33 +00:00
|
|
|
#include <jni.h>
|
|
|
|
#include <ZeroTierOne.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-04-26 03:46:56 +00:00
|
|
|
#define LOG_TAG "ZeroTierOneJNI"
|
|
|
|
|
|
|
|
#if __ANDROID__
|
|
|
|
#include <android/log.h>
|
2015-05-27 04:31:34 +00:00
|
|
|
#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
2015-04-26 03:46:56 +00:00
|
|
|
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
|
|
|
|
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
|
|
|
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
|
|
|
#else
|
2015-05-27 04:31:34 +00:00
|
|
|
#define LOGV(...) fprintf(stdout, __VA_ARGS__)
|
2015-05-01 04:50:28 +00:00
|
|
|
#define LOGI(...) fprintf(stdout, __VA_ARGS__)
|
|
|
|
#define LOGD(...) fprintf(stdout, __VA_ARGS__)
|
|
|
|
#define LOGE(...) fprintf(stdout, __VA_ARGS__)
|
2015-04-26 03:46:56 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-24 04:39:07 +00:00
|
|
|
jobject createResultObject(JNIEnv *env, ZT1_ResultCode code);
|
|
|
|
jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status);
|
2015-04-24 05:48:56 +00:00
|
|
|
jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type);
|
2015-04-24 04:39:07 +00:00
|
|
|
jobject createEvent(JNIEnv *env, ZT1_Event event);
|
2015-04-25 00:58:59 +00:00
|
|
|
jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role);
|
2015-04-25 01:39:17 +00:00
|
|
|
jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT1_VirtualNetworkConfigOperation op);
|
2015-04-24 04:39:07 +00:00
|
|
|
|
2015-04-28 00:48:37 +00:00
|
|
|
jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr);
|
2015-04-24 05:48:56 +00:00
|
|
|
jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr);
|
2015-04-24 04:36:33 +00:00
|
|
|
|
|
|
|
jobject newMulticastGroup(JNIEnv *env, const ZT1_MulticastGroup &mc);
|
2015-04-25 00:58:59 +00:00
|
|
|
|
|
|
|
jobject newPeer(JNIEnv *env, const ZT1_Peer &peer);
|
|
|
|
jobject newPeerPhysicalPath(JNIEnv *env, const ZT1_PeerPhysicalPath &ppp);
|
|
|
|
|
2015-04-25 01:20:10 +00:00
|
|
|
jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &config);
|
|
|
|
|
2015-04-25 03:13:21 +00:00
|
|
|
jobject newVersion(JNIEnv *env, int major, int minor, int rev, long featureFlags);
|
|
|
|
|
2015-04-24 04:36:33 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|