|
|
|
|
@ -78,6 +78,21 @@ extern "C" {
|
|
|
|
|
*/ |
|
|
|
|
#define ZT1_MAX_MTU 2800 |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum length of network short name |
|
|
|
|
*/ |
|
|
|
|
#define ZT1_MAX_NETWORK_SHORT_NAME_LENGTH 255 |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum number of statically assigned IP addresses per network endpoint using ZT address management (not DHCP) |
|
|
|
|
*/ |
|
|
|
|
#define ZT1_MAX_ZT_ASSIGNED_ADDRESSES 16 |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum number of multicast group subscriptions per network |
|
|
|
|
*/ |
|
|
|
|
#define ZT1_MAX_NETWORK_MULTICAST_SUBSCRIPTIONS 8194 |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Feature flag: this is an official ZeroTier, Inc. binary build (built with ZT_OFFICIAL_RELEASE) |
|
|
|
|
*/ |
|
|
|
|
@ -272,7 +287,7 @@ enum ZT1_VirtualNetworkStatus
|
|
|
|
|
/**
|
|
|
|
|
* Initialization of network failed or other internal error |
|
|
|
|
*/ |
|
|
|
|
ZT1_NETWORK_STATUS_INITIALIZATION_FAILED = 4 |
|
|
|
|
ZT1_NETWORK_STATUS_PORT_ERROR = 4 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -322,6 +337,11 @@ typedef struct
|
|
|
|
|
*/ |
|
|
|
|
uint64_t mac; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Network name (from network configuration master) |
|
|
|
|
*/ |
|
|
|
|
char name[ZT1_MAX_NETWORK_SHORT_NAME_LENGTH + 1]; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Network configuration request status |
|
|
|
|
*/ |
|
|
|
|
@ -360,43 +380,43 @@ typedef struct
|
|
|
|
|
int broadcastEnabled; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Network config revision as reported by netconf master |
|
|
|
|
* |
|
|
|
|
* If this is zero, it means we're still waiting for our netconf. |
|
|
|
|
* If the network is in PORT_ERROR state, this is the error most recently returned by the port config callback |
|
|
|
|
*/ |
|
|
|
|
unsigned long netconfRevision; |
|
|
|
|
int portError; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ZeroTier-assigned addresses (in sockaddr_storage structures) |
|
|
|
|
* |
|
|
|
|
* For IP, the port number of the sockaddr_XX structure contains the number |
|
|
|
|
* of bits in the address netmask. Only the IP address and port are used. |
|
|
|
|
* Other fields like interface number can be ignored. |
|
|
|
|
* Network config revision as reported by netconf master |
|
|
|
|
* |
|
|
|
|
* This is only used for ZeroTier-managed address assignments sent by the |
|
|
|
|
* virtual network's configuration master. |
|
|
|
|
* If this is zero, it means we're still waiting for our netconf. |
|
|
|
|
*/ |
|
|
|
|
const struct sockaddr_storage *assignedAddresses; |
|
|
|
|
unsigned long netconfRevision; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Number of assigned addresses |
|
|
|
|
* Number of multicast group subscriptions |
|
|
|
|
*/ |
|
|
|
|
unsigned int assignedAddressCount; |
|
|
|
|
unsigned int multicastSubscriptionCount; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Multicast group subscriptions |
|
|
|
|
*/ |
|
|
|
|
ZT1_MulticastGroup *multicastSubscriptions; |
|
|
|
|
ZT1_MulticastGroup multicastSubscriptions[ZT1_MAX_NETWORK_MULTICAST_SUBSCRIPTIONS]; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Number of multicast group subscriptions |
|
|
|
|
* Number of assigned addresses |
|
|
|
|
*/ |
|
|
|
|
unsigned int multicastSubscriptionCount; |
|
|
|
|
unsigned int assignedAddressCount; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Network name (from network configuration master) |
|
|
|
|
* ZeroTier-assigned addresses (in sockaddr_storage structures) |
|
|
|
|
* |
|
|
|
|
* For IP, the port number of the sockaddr_XX structure contains the number |
|
|
|
|
* of bits in the address netmask. Only the IP address and port are used. |
|
|
|
|
* Other fields like interface number can be ignored. |
|
|
|
|
* |
|
|
|
|
* This is only used for ZeroTier-managed address assignments sent by the |
|
|
|
|
* virtual network's configuration master. |
|
|
|
|
*/ |
|
|
|
|
const char *networkName; |
|
|
|
|
struct sockaddr_storage assignedAddresses[ZT1_MAX_ZT_ASSIGNED_ADDRESSES]; |
|
|
|
|
} ZT1_VirtualNetworkConfig; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -539,8 +559,12 @@ typedef void ZT1_Node;
|
|
|
|
|
* |
|
|
|
|
* The supplied config pointer is not guaranteed to remain valid, so make |
|
|
|
|
* a copy if you want one. |
|
|
|
|
* |
|
|
|
|
* This must return 0 on success. It can return any OS-dependent error code |
|
|
|
|
* on failure, and this results in the network being placed into the |
|
|
|
|
* PORT_ERROR state. |
|
|
|
|
*/ |
|
|
|
|
typedef void (*ZT1_VirtualNetworkConfigCallback)(ZT1_Node *,uint64_t,const ZT1_VirtualNetworkConfig *); |
|
|
|
|
typedef int (*ZT1_VirtualNetworkConfigFunction)(ZT1_Node *,uint64_t,const ZT1_VirtualNetworkConfig *); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Callback for status messages |
|
|
|
|
@ -622,7 +646,7 @@ typedef void (*ZT1_VirtualNetworkFrameFunction)(ZT1_Node *,uint64_t,uint64_t,uin
|
|
|
|
|
* @param now Current clock in milliseconds |
|
|
|
|
* @param dataStoreGetFunction Function called to get objects from persistent storage |
|
|
|
|
* @param dataStorePutFunction Function called to put objects in persistent storage |
|
|
|
|
* @param virtualNetworkConfigCallback Function to be called when virtual LANs are created, deleted, or their config parameters change |
|
|
|
|
* @param virtualNetworkConfigFunction Function to be called when virtual LANs are created, deleted, or their config parameters change |
|
|
|
|
* @param statusCallback Function to receive status updates and non-fatal error notices |
|
|
|
|
* @return OK (0) or error code if a fatal error condition has occurred |
|
|
|
|
*/ |
|
|
|
|
@ -633,7 +657,7 @@ enum ZT1_ResultCode ZT1_Node_new(
|
|
|
|
|
ZT1_DataStorePutFunction dataStorePutFunction, |
|
|
|
|
ZT1_WirePacketSendFunction wirePacketSendFunction, |
|
|
|
|
ZT1_VirtualNetworkFrameFunction virtualNetworkFrameFunction, |
|
|
|
|
ZT1_VirtualNetworkConfigCallback virtualNetworkConfigCallback, |
|
|
|
|
ZT1_VirtualNetworkConfigFunction virtualNetworkConfigFunction, |
|
|
|
|
ZT1_StatusCallback statusCallback); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|