NetTunnelWindows/NetTunnelSDK/sdk/common.h

110 lines
2.7 KiB
C
Raw Normal View History

#pragma once
/**
* @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)
/**
* @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>
*
*/
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;