NetTunnelWindows/NetTunnelSDK/sdk/common.h

143 lines
4.0 KiB
C
Raw Normal View History

#pragma once
#define USED_PORTMAP_TUNNEL (0)
/**
* @brief WireGuard key <EFBFBD><EFBFBD><EFBFBD>󳤶<EFBFBD>
*/
#define WG_KEY_MAX (64)
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
#define NET_CARD_MAX (32)
/**
* @brief IP <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󳤶<EFBFBD>(֧<EFBFBD><EFBFBD>IPv6)
*/
#define MAX_IP_LEN (48)
/**
* @brief IP <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
#define MIN_IP_LEN (7)
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󳤶<EFBFBD>(֧<EFBFBD><EFBFBD>IPv6)
*/
#define MAX_NETCARD_NAME (64)
2023-08-15 03:01:31 +00:00
/**
* @brief SCG <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID
*
*/
typedef enum {
WG_TUNNEL_SCG_ID = 3, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WG_CTRL_SCG_ID = 4 ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>
} SCG_SVR_ID;
/**
* @brief Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
*/
typedef enum {
CRYPTO_NONE = 0, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CRYPTO_BASE64 = 1, ///< BASE64 <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CRYPTO_AES128 = 2, ///< AES 128λ<38><CEBB>Կ <20><><EFBFBD><EFBFBD>
CRYPTO_3DES = 3, ///< 3DES <20><><EFBFBD><EFBFBD>
CRYPTO_AES256 = 4, ///< AES 256 λ<><CEBB>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>
CRYPTO_MAX,
} PROTO_CRYPTO_TYPE;
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
*
*/
typedef enum {
STATUS_DISCONNECTED = 0, ///< <20><><EFBFBD><EFBFBD><EFBFBD>ѶϿ<D1B6><CFBF><EFBFBD><EFBFBD><EFBFBD>
STATUS_CONNECTING, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
STATUS_CONNECTED, ///< <20><><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
STATUS_DISCONNECTING, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶϿ<DAB6><CFBF><EFBFBD><EFBFBD><EFBFBD>
STATUS_HARDWARE_NOT_PRESENT, ///< <20><><EFBFBD>ӵ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿڿ<D3BF> (NIC) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
STATUS_HARDWARE_DISABLED, ///< <20><><EFBFBD>ӵ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
STATUS_HARDWARE_MALFUNCTION, ///< <20><><EFBFBD>ӵ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>
STATUS_MEDIA_DISCONNECTED, ///< ý<><EFBFBD><E5A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD>
STATUS_AUTHENTICATING, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵȴ<DAB5><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
STATUS_AUTHENTICATION_SUCCEEDED, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϳɹ<CFB3>
STATUS_AUTHENTICATION_FAILED, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤ʧ<D6A4><CAA7>
STATUS_INVALID_ADDRESS, ///< <20><>ַ<EFBFBD><D6B7>Ч
STATUS_CREDENTIALS_REQUIRED, ///< <20><>Ҫ<EFBFBD><D2AA>ȫƾ<C8AB><C6BE>
STATUS_ACTION_REQUIRED, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
STATUS_ACTION_REQUIRED_RETRY, ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
STATUS_CONNECT_FAILED, ///< <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
} NET_CONNECT_STATUS;
/**
* @brief <EFBFBD><EFBFBD>־<EFBFBD>ȼ<EFBFBD>
*
*/
enum LOG_LEVEL {
LOG_TRACE = 0, ///< TRACE <20><>־<EFBFBD>ȼ<EFBFBD>
LOG_DEBUG, ///< DEBUG <20><>־<EFBFBD>ȼ<EFBFBD>
LOG_INFO, ///< INFO <20><>־<EFBFBD>ȼ<EFBFBD>
LOG_WARN, ///< WARN <20><>־<EFBFBD>ȼ<EFBFBD>
LOG_ERROR, ///< ERROR <20><>־<EFBFBD>ȼ<EFBFBD>
LOG_CRITICAL, ///< CRITICAL <20><>־<EFBFBD>ȼ<EFBFBD>
LOG_OFF ///< <20>ر<EFBFBD><D8B1><EFBFBD>־
};
/**
* @brief Hash <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
*/
typedef enum {
HASH_MD2 = 0, ///< MD2 HASH <20>
HASH_MD4, ///< MD4 HASH <20>
HASH_MD5, ///< MD5 HASH <20>
HASH_SHA1, ///< SHA1 HASH <20>
HASH_SHA256, ///< SHA256 HASH <20>
HASH_SHA384, ///< SHA384 HASH <20>
HASH_SHA512 ///< SHA512 HASH <20>
} HASH_TYPE;
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
*
*/
typedef enum {
ICS_SHARE_MODE = 0, ///< Internet Share Mode(ICS) ģʽ
NAT_SHARE_MODE = 1 ///< Net Address Translation(NAT) ģʽ
} NET_SHARE_MODE;
/**
*
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
*/
typedef struct {
int vmId; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID
CHAR vmName[MAX_PATH]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CHAR svrPublicKey[64]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD>Կ
CHAR vmNetwork[MAX_IP_LEN]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
CHAR scgGateWay[MAX_PATH]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CHAR scgTunnelGw[MAX_PATH]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
} VM_CFG, *PVM_CFG;
/**
*
* @brief <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
*/
typedef struct {
int scgCtrlAppId; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD> ID
int scgTunnelAppId; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID
CHAR cliPrivateKey[64]; ///< <20>û<EFBFBD><C3BB>ͻ<EFBFBD><CDBB><EFBFBD>˽Կ
CHAR cliPublicKey[64]; ///< <20>û<EFBFBD><C3BB>ͻ<EFBFBD><CDBB>˹<EFBFBD>Կ
CHAR cliAddress[MAX_IP_LEN]; ///< <20>û<EFBFBD><C3BB>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ
PVM_CFG pVMConfig; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
int tolVM; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
} USER_CLIENT_CONFIG, *PUSER_CLIENT_CONFIG;
typedef struct {
int svrListenPort; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD>˿<EFBFBD>
CHAR svrPrivateKey[64]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD>Կ
CHAR svrAddress[MAX_IP_LEN]; ///< <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP <20><>ַ
} USER_SERVER_CONFIG, *PUSER_SERVER_CONFIG;