2015-09-24 23:21:36 +00:00
|
|
|
#ifndef ZT_jniutils_h_
|
|
|
|
#define ZT_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-09-24 23:21:36 +00:00
|
|
|
jobject createResultObject(JNIEnv *env, ZT_ResultCode code);
|
|
|
|
jobject createVirtualNetworkStatus(JNIEnv *env, ZT_VirtualNetworkStatus status);
|
|
|
|
jobject createVirtualNetworkType(JNIEnv *env, ZT_VirtualNetworkType type);
|
|
|
|
jobject createEvent(JNIEnv *env, ZT_Event event);
|
|
|
|
jobject createPeerRole(JNIEnv *env, ZT_PeerRole role);
|
|
|
|
jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT_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
|
|
|
|
2015-09-24 23:21:36 +00:00
|
|
|
jobject newMulticastGroup(JNIEnv *env, const ZT_MulticastGroup &mc);
|
2015-04-25 00:58:59 +00:00
|
|
|
|
2015-09-24 23:21:36 +00:00
|
|
|
jobject newPeer(JNIEnv *env, const ZT_Peer &peer);
|
|
|
|
jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp);
|
2015-04-25 00:58:59 +00:00
|
|
|
|
2015-09-24 23:21:36 +00:00
|
|
|
jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &config);
|
2015-04-25 01:20:10 +00:00
|
|
|
|
2016-07-08 03:07:07 +00:00
|
|
|
jobject newVersion(JNIEnv *env, int major, int minor, int rev);
|
2015-04-25 03:13:21 +00:00
|
|
|
|
2016-09-05 20:52:29 +00:00
|
|
|
jobject newVirtualNetworkRoute(JNIEnv *env, const ZT_VirtualNetworkRoute &route);
|
|
|
|
|
2015-04-24 04:36:33 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|