updates for origin/edge

This commit is contained in:
Grant Limberg 2015-11-02 19:18:55 -08:00
parent 179b064b05
commit b7df177f33
6 changed files with 15 additions and 111 deletions

View File

@ -15,7 +15,6 @@ LOCAL_SRC_FILES := \
$(ZT1)/ext/http-parser/http_parser.c \
$(ZT1)/node/C25519.cpp \
$(ZT1)/node/CertificateOfMembership.cpp \
$(ZT1)/node/Defaults.cpp \
$(ZT1)/node/Dictionary.cpp \
$(ZT1)/node/Identity.cpp \
$(ZT1)/node/IncomingPacket.cpp \
@ -26,6 +25,7 @@ LOCAL_SRC_FILES := \
$(ZT1)/node/Node.cpp \
$(ZT1)/node/OutboundMulticast.cpp \
$(ZT1)/node/Packet.cpp \
$(ZT1)/node/Path.cpp \
$(ZT1)/node/Peer.cpp \
$(ZT1)/node/Poly1305.cpp \
$(ZT1)/node/Salsa20.cpp \

View File

@ -1,5 +1,5 @@
NDK_TOOLCHAIN_VERSION := clang
APP_STL := c++_static
APP_CPPFLAGS := -O3 -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -DZT_NO_TYPE_PUNNING=1
APP_CPPFLAGS := -O3 -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
APP_PLATFORM := android-14
APP_ABI := all

View File

@ -133,15 +133,6 @@ jobject createEvent(JNIEnv *env, ZT_Event event)
case ZT_EVENT_FATAL_ERROR_IDENTITY_COLLISION:
fieldName = "EVENT_FATAL_ERROR_IDENTITY_COLLISION";
break;
case ZT_EVENT_SAW_MORE_RECENT_VERSION:
fieldName = "EVENT_SAW_MORE_RECENT_VERSION";
break;
case ZT_EVENT_AUTHENTICATION_FAILURE:
fieldName = "EVENT_AUTHENTICATION_FAILURE";
break;
case ZT_EVENT_INVALID_PACKET:
fieldName = "EVENT_INVALID_PACKET";
break;
case ZT_EVENT_TRACE:
fieldName = "EVENT_TRACE";
break;
@ -425,7 +416,6 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp)
jfieldID addressField = NULL;
jfieldID lastSendField = NULL;
jfieldID lastReceiveField = NULL;
jfieldID fixedField = NULL;
jfieldID activeField = NULL;
jfieldID preferredField = NULL;
@ -459,13 +449,6 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp)
return NULL;
}
fixedField = lookup.findField(pppClass, "fixed", "Z");
if(env->ExceptionCheck() || fixedField == NULL)
{
LOGE("Error finding fixed field");
return NULL;
}
activeField = lookup.findField(pppClass, "active", "Z");
if(env->ExceptionCheck() || activeField == NULL)
{
@ -503,7 +486,6 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp)
env->SetObjectField(pppObject, addressField, addressObject);
env->SetLongField(pppObject, lastSendField, ppp.lastSend);
env->SetLongField(pppObject, lastReceiveField, ppp.lastReceive);
env->SetBooleanField(pppObject, fixedField, ppp.fixed);
env->SetBooleanField(pppObject, activeField, ppp.active);
env->SetBooleanField(pppObject, preferredField, ppp.preferred);

View File

@ -134,7 +134,8 @@ namespace {
(jlong)nwid, operationObject, networkConfigObject);
}
void VirtualNetworkFrameFunctionCallback(ZT_Node *node,void *userData,
void VirtualNetworkFrameFunctionCallback(ZT_Node *node,
void *userData,
uint64_t nwid,
uint64_t sourceMac,
uint64_t destMac,
@ -189,7 +190,10 @@ namespace {
}
void EventCallback(ZT_Node *node,void *userData,enum ZT_Event event, const void *data)
void EventCallback(ZT_Node *node,
void *userData,
enum ZT_Event event,
const void *data)
{
LOGV("EventCallback");
JniRef *ref = (JniRef*)userData;
@ -217,25 +221,6 @@ namespace {
return;
}
jmethodID onOutOfDateMethod = lookup.findMethod(eventListenerClass,
"onOutOfDate", "(Lcom/zerotier/sdk/Version;)V");
if(onOutOfDateMethod == NULL)
{
LOGE("Couldn't find onOutOfDate method");
return;
}
jmethodID onNetworkErrorMethod = lookup.findMethod(eventListenerClass,
"onNetworkError", "(Lcom/zerotier/sdk/Event;Ljava/net/InetSocketAddress;)V");
if(onNetworkErrorMethod == NULL)
{
LOGE("Couldn't find onNetworkError method");
return;
}
jmethodID onTraceMethod = lookup.findMethod(eventListenerClass,
"onTrace", "(Ljava/lang/String;)V");
if(onTraceMethod == NULL)
@ -263,31 +248,6 @@ namespace {
env->CallVoidMethod(ref->eventListener, onEventMethod, eventObject);
}
break;
case ZT_EVENT_SAW_MORE_RECENT_VERSION:
{
LOGV("Version Event");
// call onOutOfDate()
if(data != NULL)
{
int *version = (int*)data;
jobject verisonObj = newVersion(env, version[0], version[1], version[2], 0);
env->CallVoidMethod(ref->eventListener, onOutOfDateMethod, verisonObj);
}
}
break;
case ZT_EVENT_AUTHENTICATION_FAILURE:
case ZT_EVENT_INVALID_PACKET:
{
LOGV("Network Error Event");
// call onNetworkError()
if(data != NULL)
{
sockaddr_storage *addr = (sockaddr_storage*)data;
jobject addressObj = newInetSocketAddress(env, *addr);
env->CallVoidMethod(ref->eventListener, onNetworkErrorMethod, addressObj);
}
}
break;
case ZT_EVENT_TRACE:
{
LOGV("Trace Event");
@ -303,7 +263,8 @@ namespace {
}
}
long DataStoreGetFunction(ZT_Node *node,void *userData,
long DataStoreGetFunction(ZT_Node *node,
void *userData,
const char *objectName,
void *buffer,
unsigned long bufferSize,
@ -375,7 +336,8 @@ namespace {
return retval;
}
int DataStorePutFunction(ZT_Node *node,void *userData,
int DataStorePutFunction(ZT_Node *node,
void *userData,
const char *objectName,
const void *buffer,
unsigned long bufferSize,
@ -440,7 +402,8 @@ namespace {
}
}
int WirePacketSendFunction(ZT_Node *node,void *userData,\
int WirePacketSendFunction(ZT_Node *node,
void *userData,
const struct sockaddr_storage *localAddress,
const struct sockaddr_storage *remoteAddress,
const void *buffer,
@ -625,8 +588,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
&WirePacketSendFunction,
&VirtualNetworkFrameFunctionCallback,
&VirtualNetworkConfigFunctionCallback,
&EventCallback,
NULL);
&EventCallback);
if(rc != ZT_RESULT_OK)
{

View File

@ -86,31 +86,6 @@ public enum Event {
* umbrellas prevent rain and smoke detectors prevent fires. They do, right?</p>
*/
EVENT_FATAL_ERROR_IDENTITY_COLLISION,
/**
* A more recent version was observed on the network
*
* <p>Right now this is only triggered if a hub or rootserver reports a
* more recent version, and only once. It can be used to trigger a
* software update check.</p>
*
* <p>Meta-data: {@link Version}, more recent version number</p>
*/
EVENT_SAW_MORE_RECENT_VERSION,
/**
* A packet failed authentication
*
* <p>Meta-data: {@link InetSocketAddress} containing origin address of packet</p>
*/
EVENT_AUTHENTICATION_FAILURE,
/**
* A received packet was not valid
*
* <p>Meta-data: {@link InetSocketAddress} containing origin address of packet</p>
*/
EVENT_INVALID_PACKET,
/**
* Trace (debugging) message

View File

@ -41,21 +41,6 @@ public interface EventListener {
*/
public void onEvent(Event event);
/**
* Callback for network error events: {@link Event.EVENT_AUTHENTICATION_FAILURE}, {link Event.EVENT_INVALID_PACKET}
*
* @param event {@link Event} enum
* @param source {@link InetSocketAddress} containing the origin address of the packet
*/
public void onNetworkError(Event event, InetSocketAddress source);
/**
* Callback when the node detects that it's out of date.
*
* @param newVersion {@link Version} object with the latest version of ZeroTier One
*/
public void onOutOfDate(Version newVersion);
/**
* Trace messages
*