diff options
| author | Grant Limberg <glimberg@gmail.com> | 2015-09-26 13:47:55 -0700 |
|---|---|---|
| committer | Grant Limberg <glimberg@gmail.com> | 2015-09-26 13:47:55 -0700 |
| commit | e8cdff3eafd8096da22122eabddf57a09fe2bb90 (patch) | |
| tree | d231aa6d9ccccc8ced6e1ead606ce16ff551cab9 /java/jni/ZT_jniutils.h | |
| parent | 53d98343b7b444508259f6f1643e8d6724fb11e9 (diff) | |
| parent | f69454ec9879a0b0a424f743ca144d1123ef7e99 (diff) | |
| download | infinitytier-e8cdff3eafd8096da22122eabddf57a09fe2bb90.tar.gz infinitytier-e8cdff3eafd8096da22122eabddf57a09fe2bb90.zip | |
Merge branch 'adamierymenko-dev' into android-jni-dev
also update for changed function calls that now accept a local address
# Conflicts:
# include/ZeroTierOne.h
# java/CMakeLists.txt
# java/jni/Android.mk
# java/jni/ZT1_jnicache.cpp
# java/jni/ZT1_jnilookup.h
# java/jni/ZT1_jniutils.cpp
# java/jni/com_zerotierone_sdk_Node.cpp
Diffstat (limited to 'java/jni/ZT_jniutils.h')
| -rw-r--r-- | java/jni/ZT_jniutils.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/java/jni/ZT_jniutils.h b/java/jni/ZT_jniutils.h new file mode 100644 index 00000000..b76a28c2 --- /dev/null +++ b/java/jni/ZT_jniutils.h @@ -0,0 +1,49 @@ +#ifndef ZT_jniutils_h_ +#define ZT_jniutils_h_ +#include <stdio.h> +#include <jni.h> +#include <ZeroTierOne.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define LOG_TAG "ZeroTierOneJNI" + +#if __ANDROID__ +#include <android/log.h> +#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) +#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 +#define LOGV(...) fprintf(stdout, __VA_ARGS__) +#define LOGI(...) fprintf(stdout, __VA_ARGS__) +#define LOGD(...) fprintf(stdout, __VA_ARGS__) +#define LOGE(...) fprintf(stdout, __VA_ARGS__) +#endif + +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); + +jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr); +jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr); + +jobject newMulticastGroup(JNIEnv *env, const ZT_MulticastGroup &mc); + +jobject newPeer(JNIEnv *env, const ZT_Peer &peer); +jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp); + +jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &config); + +jobject newVersion(JNIEnv *env, int major, int minor, int rev, long featureFlags); + +#ifdef __cplusplus +} +#endif + +#endif
\ No newline at end of file |
