|
@@ -89,6 +89,7 @@ public class Node {
|
|
|
* @param eventListener User written instance of the {@link EventListener} interface to receive status updates and non-fatal error notices. This instance must be unique per Node object.
|
|
|
* @param frameListener
|
|
|
* @param configListener User written instance of the {@link VirtualNetworkConfigListener} interface to be called when virtual LANs are created, deleted, or their config parameters change. This instance must be unique per Node object.
|
|
|
+ * @param pathChecker User written instance of the {@link PathChecker} interface. Not required and can be null.
|
|
|
*/
|
|
|
public Node(long now,
|
|
|
DataStoreGetListener getListener,
|
|
@@ -321,6 +322,34 @@ public class Node {
|
|
|
return multicastUnsubscribe(nodeId, nwid, multicastGroup, multicastAdi);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Add or update a moon
|
|
|
+ *
|
|
|
+ * Moons are persisted in the data store in moons.d/, so this can persist
|
|
|
+ * across invocations if the contents of moon.d are scanned and orbit is
|
|
|
+ * called for each on startup.
|
|
|
+ *
|
|
|
+ * @param moonWorldId Moon's world ID
|
|
|
+ * @param moonSeed If non-zero, the ZeroTier address of any member of the moon to query for moon definition
|
|
|
+ * @return Error if moon was invalid or failed to be added
|
|
|
+ */
|
|
|
+ public ResultCode orbit(
|
|
|
+ long moonWorldId,
|
|
|
+ long moonSeed) {
|
|
|
+ return orbit(nodeId, moonWorldId, moonSeed);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Remove a moon (does nothing if not present)
|
|
|
+ *
|
|
|
+ * @param moonWorldId World ID of moon to remove
|
|
|
+ * @return Error if anything bad happened
|
|
|
+ */
|
|
|
+ public ResultCode deorbit(
|
|
|
+ long moonWorldId) {
|
|
|
+ return deorbit(nodeId, moonWorldId);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Get this node's 40-bit ZeroTier address
|
|
|
*
|
|
@@ -423,6 +452,15 @@ public class Node {
|
|
|
long multicastGroup,
|
|
|
long multicastAdi);
|
|
|
|
|
|
+ private native ResultCode orbit(
|
|
|
+ long nodeId,
|
|
|
+ long moonWorldId,
|
|
|
+ long moonSeed);
|
|
|
+
|
|
|
+ private native ResultCode deorbit(
|
|
|
+ long nodeId,
|
|
|
+ long moonWorldId);
|
|
|
+
|
|
|
private native long address(long nodeId);
|
|
|
|
|
|
private native NodeStatus status(long nodeId);
|