mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-07 05:21:42 -07:00
add VirtualNetworkStatus.fromInt
This commit is contained in:
parent
ed3918b508
commit
85bd773c55
4 changed files with 47 additions and 56 deletions
|
@ -27,40 +27,73 @@
|
|||
|
||||
package com.zerotier.sdk;
|
||||
|
||||
/**
|
||||
* Virtual network status codes
|
||||
*
|
||||
* Defined in ZeroTierOne.h as ZT_VirtualNetworkStatus
|
||||
*/
|
||||
public enum VirtualNetworkStatus {
|
||||
|
||||
/**
|
||||
* Waiting for network configuration (also means revision == 0)
|
||||
*/
|
||||
NETWORK_STATUS_REQUESTING_CONFIGURATION,
|
||||
NETWORK_STATUS_REQUESTING_CONFIGURATION(0),
|
||||
|
||||
/**
|
||||
* Configuration received and we are authorized
|
||||
*/
|
||||
NETWORK_STATUS_OK,
|
||||
NETWORK_STATUS_OK(1),
|
||||
|
||||
/**
|
||||
* Netconf master said SSO auth required.
|
||||
*/
|
||||
NETWORK_STATUS_AUTHENTICATION_REQUIRED,
|
||||
NETWORK_STATUS_AUTHENTICATION_REQUIRED(2),
|
||||
|
||||
/**
|
||||
* Netconf master told us 'nope'
|
||||
*/
|
||||
NETWORK_STATUS_ACCESS_DENIED,
|
||||
NETWORK_STATUS_ACCESS_DENIED(3),
|
||||
|
||||
/**
|
||||
* Netconf master exists, but this virtual network does not
|
||||
*/
|
||||
NETWORK_STATUS_NOT_FOUND,
|
||||
NETWORK_STATUS_NOT_FOUND(4),
|
||||
|
||||
/**
|
||||
* Initialization of network failed or other internal error
|
||||
*/
|
||||
NETWORK_STATUS_PORT_ERROR,
|
||||
NETWORK_STATUS_PORT_ERROR(5),
|
||||
|
||||
/**
|
||||
* ZeroTier One version too old
|
||||
*/
|
||||
NETWORK_STATUS_CLIENT_TOO_OLD
|
||||
NETWORK_STATUS_CLIENT_TOO_OLD(6);
|
||||
|
||||
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
||||
private final int id;
|
||||
|
||||
VirtualNetworkStatus(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static VirtualNetworkStatus fromInt(int id) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
return NETWORK_STATUS_REQUESTING_CONFIGURATION;
|
||||
case 1:
|
||||
return NETWORK_STATUS_OK;
|
||||
case 2:
|
||||
return NETWORK_STATUS_AUTHENTICATION_REQUIRED;
|
||||
case 3:
|
||||
return NETWORK_STATUS_ACCESS_DENIED;
|
||||
case 4:
|
||||
return NETWORK_STATUS_NOT_FOUND;
|
||||
case 5:
|
||||
return NETWORK_STATUS_PORT_ERROR;
|
||||
case 6:
|
||||
return NETWORK_STATUS_CLIENT_TOO_OLD;
|
||||
default:
|
||||
throw new RuntimeException("Unhandled value: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue