summaryrefslogtreecommitdiff
path: root/java/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/zerotier/sdk/Peer.java16
-rw-r--r--java/src/com/zerotier/sdk/PeerRole.java8
-rw-r--r--java/src/com/zerotier/sdk/VirtualNetworkRoute.java51
3 files changed, 53 insertions, 22 deletions
diff --git a/java/src/com/zerotier/sdk/Peer.java b/java/src/com/zerotier/sdk/Peer.java
index fb2d1065..eb3d7130 100644
--- a/java/src/com/zerotier/sdk/Peer.java
+++ b/java/src/com/zerotier/sdk/Peer.java
@@ -34,8 +34,6 @@ import java.util.ArrayList;
*/
public final class Peer {
private long address;
- private long lastUnicastFrame;
- private long lastMulticastFrame;
private int versionMajor;
private int versionMinor;
private int versionRev;
@@ -53,20 +51,6 @@ public final class Peer {
}
/**
- * Time we last received a unicast frame from this peer
- */
- public final long lastUnicastFrame() {
- return lastUnicastFrame;
- }
-
- /**
- * Time we last received a multicast rame from this peer
- */
- public final long lastMulticastFrame() {
- return lastMulticastFrame;
- }
-
- /**
* Remote major version or -1 if not known
*/
public final int versionMajor() {
diff --git a/java/src/com/zerotier/sdk/PeerRole.java b/java/src/com/zerotier/sdk/PeerRole.java
index f281c1b6..fce183d9 100644
--- a/java/src/com/zerotier/sdk/PeerRole.java
+++ b/java/src/com/zerotier/sdk/PeerRole.java
@@ -34,12 +34,12 @@ public enum PeerRole {
PEER_ROLE_LEAF,
/**
- * upstream node
+ * moon root
*/
- PEER_ROLE_UPSTREAM,
+ PEER_ROLE_MOON,
/**
- * root server
+ * planetary root
*/
- PEER_ROLE_ROOT
+ PEER_ROLE_PLANET
} \ No newline at end of file
diff --git a/java/src/com/zerotier/sdk/VirtualNetworkRoute.java b/java/src/com/zerotier/sdk/VirtualNetworkRoute.java
index 738c4158..b89dce7b 100644
--- a/java/src/com/zerotier/sdk/VirtualNetworkRoute.java
+++ b/java/src/com/zerotier/sdk/VirtualNetworkRoute.java
@@ -29,9 +29,14 @@ package com.zerotier.sdk;
import java.net.InetSocketAddress;
-public final class VirtualNetworkRoute
+public final class VirtualNetworkRoute implements Comparable<VirtualNetworkRoute>
{
- private VirtualNetworkRoute() {}
+ private VirtualNetworkRoute() {
+ target = null;
+ via = null;
+ flags = 0;
+ metric = 0;
+ }
/**
* Target network / netmask bits (in port field) or NULL or 0.0.0.0/0 for default
@@ -52,4 +57,46 @@ public final class VirtualNetworkRoute
* Route metric (not currently used)
*/
public int metric;
+
+
+ @Override
+ public int compareTo(VirtualNetworkRoute other) {
+ return target.toString().compareTo(other.target.toString());
+ }
+
+ public boolean equals(VirtualNetworkRoute other) {
+ boolean targetEquals;
+ if (target == null && other.target == null) {
+ targetEquals = true;
+ }
+ else if (target == null && other.target != null) {
+ targetEquals = false;
+ }
+ else if (target != null && other.target == null) {
+ targetEquals = false;
+ }
+ else {
+ targetEquals = target.equals(other.target);
+ }
+
+
+ boolean viaEquals;
+ if (via == null && other.via == null) {
+ viaEquals = true;
+ }
+ else if (via == null && other.via != null) {
+ viaEquals = false;
+ }
+ else if (via != null && other.via == null) {
+ viaEquals = false;
+ }
+ else {
+ viaEquals = via.equals(other.via);
+ }
+
+ return viaEquals &&
+ viaEquals &&
+ flags == other.flags &&
+ metric == other.metric;
+ }
}