summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-10-26 18:10:27 -0700
committerGrant Limberg <glimberg@gmail.com>2015-10-26 18:10:27 -0700
commit352b83252fb2617a15cde0927cc30110b729e46d (patch)
tree38569e4f6c1c162cdaabf7ac8c9d6b7917d71ffd /include
parenta0c3083af0821db0303c62dfae9ebc560c3c147a (diff)
parent6625d7929654803f99b7a69f56a400046314acac (diff)
downloadinfinitytier-352b83252fb2617a15cde0927cc30110b729e46d.tar.gz
infinitytier-352b83252fb2617a15cde0927cc30110b729e46d.zip
Merge branch 'adamierymenko-dev' into windows-ui
Diffstat (limited to 'include')
-rw-r--r--include/ZeroTierOne.h92
1 files changed, 90 insertions, 2 deletions
diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h
index 135c8e11..7af4f760 100644
--- a/include/ZeroTierOne.h
+++ b/include/ZeroTierOne.h
@@ -131,12 +131,17 @@ extern "C" {
/**
* Maximum number of cluster members (and max member ID plus one)
*/
-#define ZT_CLUSTER_MAX_MEMBERS 256
+#define ZT_CLUSTER_MAX_MEMBERS 128
+
+/**
+ * Maximum number of physical ZeroTier addresses a cluster member can report
+ */
+#define ZT_CLUSTER_MAX_ZT_PHYSICAL_ADDRESSES 16
/**
* Maximum allowed cluster message length in bytes
*/
-#define ZT_CLUSTER_MAX_MESSAGE_LENGTH 65535
+#define ZT_CLUSTER_MAX_MESSAGE_LENGTH (1444 * 6)
/**
* A null/empty sockaddr (all zero) to signify an unspecified socket address
@@ -880,6 +885,78 @@ typedef struct {
} ZT_CircuitTestReport;
/**
+ * A cluster member's status
+ */
+typedef struct {
+ /**
+ * This cluster member's ID (from 0 to 1-ZT_CLUSTER_MAX_MEMBERS)
+ */
+ unsigned int id;
+
+ /**
+ * Number of milliseconds since last 'alive' heartbeat message received via cluster backplane address
+ */
+ unsigned int msSinceLastHeartbeat;
+
+ /**
+ * Non-zero if cluster member is alive
+ */
+ int alive;
+
+ /**
+ * X, Y, and Z coordinates of this member (if specified, otherwise zero)
+ *
+ * What these mean depends on the location scheme being used for
+ * location-aware clustering. At present this is GeoIP and these
+ * will be the X, Y, and Z coordinates of the location on a spherical
+ * approximation of Earth where Earth's core is the origin (in km).
+ * They don't have to be perfect and need only be comparable with others
+ * to find shortest path via the standard vector distance formula.
+ */
+ int x,y,z;
+
+ /**
+ * Cluster member's last reported load
+ */
+ uint64_t load;
+
+ /**
+ * Number of peers this cluster member "has"
+ */
+ uint64_t peers;
+
+ /**
+ * Physical ZeroTier endpoints for this member (where peers are sent when directed here)
+ */
+ struct sockaddr_storage zeroTierPhysicalEndpoints[ZT_CLUSTER_MAX_ZT_PHYSICAL_ADDRESSES];
+
+ /**
+ * Number of physical ZeroTier endpoints this member is announcing
+ */
+ unsigned int numZeroTierPhysicalEndpoints;
+} ZT_ClusterMemberStatus;
+
+/**
+ * ZeroTier cluster status
+ */
+typedef struct {
+ /**
+ * My cluster member ID (a record for 'self' is included in member[])
+ */
+ unsigned int myId;
+
+ /**
+ * Number of cluster members
+ */
+ unsigned int clusterSize;
+
+ /**
+ * Cluster member statuses
+ */
+ ZT_ClusterMemberStatus members[ZT_CLUSTER_MAX_MEMBERS];
+} ZT_ClusterStatus;
+
+/**
* An instance of a ZeroTier One node (opaque)
*/
typedef void ZT_Node;
@@ -1440,6 +1517,17 @@ void ZT_Node_clusterRemoveMember(ZT_Node *node,unsigned int memberId);
void ZT_Node_clusterHandleIncomingMessage(ZT_Node *node,const void *msg,unsigned int len);
/**
+ * Get the current status of the cluster from this node's point of view
+ *
+ * Calling this without clusterInit() or without cluster support will just
+ * zero out the structure and show a cluster size of zero.
+ *
+ * @param node Node instance
+ * @param cs Cluster status structure to fill with data
+ */
+void ZT_Node_clusterStatus(ZT_Node *node,ZT_ClusterStatus *cs);
+
+/**
* Get ZeroTier One version
*
* @param major Result: major version