125 lines
3.7 KiB
C
125 lines
3.7 KiB
C
#ifndef __ACE_SDK_SERVER_H__
|
||
#define __ACE_SDK_SERVER_H__
|
||
|
||
#include "ace_sdk_common.h"
|
||
|
||
#pragma pack(push, 1)
|
||
|
||
#define ACE_SDK_MAX_LIBRARY_DIR_LENGTH 1024
|
||
#define ACE_SDK_MAX_TOKEN_LENGTH 128
|
||
|
||
/**
|
||
AceSdkServerLibraryInfo
|
||
*/
|
||
typedef struct __AceSdkServerLibraryInfo
|
||
{
|
||
/**
|
||
* Need to end with 0
|
||
* Directory of libace_sdk.so(linux) or ace_sdk.dll(windows)
|
||
*/
|
||
ACE_CHAR library_dir_[ACE_SDK_MAX_LIBRARY_DIR_LENGTH];
|
||
} AceSdkServerLibraryInfo;
|
||
|
||
/**
|
||
AceSdkServerAuthInfo
|
||
*/
|
||
typedef struct __AceSdkServerAuthInfo
|
||
{
|
||
uint32_t game_id_;
|
||
/**
|
||
* Need to end with 0
|
||
* Contact ACE to obtain your token
|
||
*/
|
||
char auth_token_[ACE_SDK_MAX_TOKEN_LENGTH];
|
||
} AceSdkServerAuthInfo;
|
||
|
||
/**
|
||
AceSdkServerRegion
|
||
*/
|
||
typedef enum __AceSdkServerRegion
|
||
{
|
||
/**
|
||
* Mainland, China, excluding Hong Kong, Macao and Taiwan..
|
||
*/
|
||
ACE_SDK_REGION_CHINA_MAINLAND = 101,
|
||
/**
|
||
* Hong Kong, China
|
||
*/
|
||
ACE_SDK_REGION_CHINA_HONGKONG = 102,
|
||
/**
|
||
* Macao, China
|
||
*/
|
||
ACE_SDK_REGION_CHINA_MACAO = 103,
|
||
/**
|
||
* Taiwan, China
|
||
*/
|
||
ACE_SDK_REGION_CHINA_TAIWAN = 104,
|
||
/**
|
||
* All regions of the Asia except for those defined accurately in this enumeration.
|
||
*/
|
||
ACE_SDK_REGION_ASIA = 200,
|
||
/**
|
||
* All regions of the Europe except for those defined accurately in this enumeration.
|
||
*/
|
||
ACE_SDK_REGION_EUROPE = 300,
|
||
/**
|
||
* All regions of the America except for those defined accurately in this enumeration.
|
||
*/
|
||
ACE_SDK_REGION_AMERICA = 400,
|
||
} AceSdkServerRegion;
|
||
|
||
/**
|
||
AceSdkGameDistributor
|
||
*/
|
||
typedef enum __AceSdkGameDistributor
|
||
{
|
||
/**
|
||
* This option usually means:
|
||
* 1. the game servers are deployed on Tencent’s intranet (mainland China), or
|
||
* 2. the game servers are deployed on Tencent Cloud (Oversea). In this case, you need remember to enable the server to access the public network through the TCP protocol.
|
||
*/
|
||
ACE_SDK_GAME_DISTRIBUTOR_TENCENT = 1,
|
||
/**
|
||
* If use this option, you need remember to enable the server to access the public network through the TCP protocol.
|
||
*/
|
||
ACE_SDK_GAME_DISTRIBUTOR_COMMON = 1000,
|
||
} AceSdkGameDistributor;
|
||
|
||
/**
|
||
AceSdkServerDeploymentInfo
|
||
*/
|
||
typedef struct __AceSdkServerDeploymentInfo
|
||
{
|
||
/**
|
||
It indicates where the game server reports data. So it is necessary to fill it with the most suitable value in the enumeration.
|
||
If the game server is deployed in mutiple regions,
|
||
case 1: Game servers in different regions are assigned different game ids(they generally are), it is necessary to fill it according to gameid.
|
||
case 2: Game servers in different regions are assigned same game id, it is necessary to fill it as ACE_SDK_REGION_ASIA and contact ACE to confirm it.
|
||
*/
|
||
AceSdkServerRegion region_;
|
||
/**
|
||
Game distributor
|
||
*/
|
||
AceSdkGameDistributor distributor_;
|
||
} AceSdkServerDeploymentInfo;
|
||
|
||
#pragma pack(pop)
|
||
|
||
/**
|
||
@brief Init ACE SDK of server side. It must be called before using any other interfaces.
|
||
@param library It indicates where the libace_sdk.so/ace_sdk.dll is located.
|
||
@param auth_info Authentication info which is provided by ACE.
|
||
@param deployment_info Deployment info of the game server.
|
||
*/
|
||
AceSdkResult ace_sdk_server_init(const AceSdkServerLibraryInfo* library_info, const AceSdkServerAuthInfo* auth_info, const AceSdkServerDeploymentInfo* deployment_info);
|
||
|
||
/**
|
||
@brief Deinit ACE SDK of server side. It could be called before process is ready to exist.
|
||
*/
|
||
AceSdkResult ace_sdk_server_deinit();
|
||
|
||
|
||
#include "ace_sdk_server_impl.h"
|
||
|
||
#endif // __ACE_SDK_SERVER_H__
|