DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BackendApi.c
См. документацию.
1
3
4
7 {
8 EBERR_OK, // all OK
9 EBERR_UNKNOWN, // unknown error
10 EBERR_DISABLED, // backend is disabled
11 EBERR_INVALID_STATE, // called request from state where it is not possible (ie. reading data before logon and such)
12 EBERR_BUSY, // no request can be called - login/ auth in process
13 EBERR_ALREADY_OFFLINE, // state is already active
14 EBERR_ALREADY_ONLINE, // state is already active
15 EBERR_ALREADY_REQUESTED, // state already requested once!
16 EBERR_LOGIN_FAILED, // failed to logon
17 EBERR_AUTH_FAILED, // failed to authenticate
18 EBERR_LOGIN_SUCCESS, // logon successfull
19 EBERR_AUTH_SUCCESS, // authenticate successfull
20 EBERR_CONFIGURATION_GET, // configuration received
21 EBERR_CEPROFILE_GET, // CE profile configuration received
22 EBERR_CHARACTER_GET, // character data receieved
23 EBERR_CHARACTER_UPDATE, // character update done
24 };
25
28 {
29/* // game api
30 EBREQ_GAME_Test, // environment test - dummy data read
31 EBREQ_GAME_World, // static world configuration read
32 EBREQ_GAME_CEProfile,
33 EBREQ_GAME_CharacterGet, // character data read
34 EBREQ_GAME_CharacterUpdate, // character data update
35// #if BACKENDAPI_DEV_CHARACTER
36 EBREQ_GAME_DevCharacterGet, // dev character data read
37 EBREQ_GAME_DevCharacterUpdate, // dev character data update
38// #endif
39 EBREQ_GAME_Heartbeat,*/
40 // user api request <> response
43/* // lobby api request <> response
44 EBREQ_LOBBY_RoomsRegister,
45 EBREQ_LOBBY_RoomsJoin,
46 EBREQ_LOBBY_RoomsAcceptPlayer,
47 EBREQ_LOBBY_RoomsHeartBeat,
48 EBREQ_LOBBY_RoomsUpdate,
49 EBREQ_LOBBY_RoomsRemovePlayer,
50 EBREQ_LOBBY_RoomsSearch,
51 EBREQ_LOBBY_RoomsGetByIds,
52 EBREQ_LOBBY_RoomsGetByHostIds,
53 EBREQ_LOBBY_GetActiveScenarios,
54 // storage api request <> response
55 EBREQ_STORAGE_GetFileTempURL,
56 EBREQ_STORAGE_GetFileTempURLS2S,
57 EBREQ_STORAGE_GetFile,
58 EBREQ_STORAGE_DeleteFile,
59 EBREQ_STORAGE_GetFileS2S,
60 EBREQ_STORAGE_DeleteFileS2S,
61 EBREQ_STORAGE_PatchFileS2S,
62 EBREQ_STORAGE_Upload,
63 EBREQ_STORAGE_UploadS2S,
64 EBREQ_STORAGE_UploadZip,
65 EBREQ_STORAGE_UploadZipS2S,
66 EBREQ_STORAGE_Limits,
67 EBREQ_STORAGE_LimitsS2S,
68 // feedback request <> response
69// #if ONLINE_SLACKAPI
70 EBREQ_SLACKAPI_PostMessage,
71// #endif*/
72 };
73
81
82
83// -------------------------------------------------------------------------
84// Callback interface for backend - must exist for the duration of request!
86{
92 void OnDataReceive( string data, int size )
93 {
94 Print("[BackendCallback] Data received, size=" + size);
95 Print(data);
96 }
97
102 void OnError( int code )
103 {
104 Print("[BackendCallback] OnError: " + GetBackendApi().GetErrorCode(code));
105 }
106
111 void OnSuccess( int code )
112 {
113 Print("[BackendCallback] OnSuccess()");
114 }
115
120 {
121 Print("[BackendCallback] OnTimeout");
122 }
123
124};
125
126
127// -------------------------------------------------------------------------
128// Backend API access
130{
131 private void BackendApi() {}
132 private void ~BackendApi() {}
133
137 proto native bool Initiate();
141 proto native bool Shutdown();
142
143
147 proto native bool IsDisconnected();
151 proto native bool IsRuntime();
155 proto native bool IsBusy();
156
157
159 string GetErrorCode( int code )
160 {
161 string result;
162
163 if ( code == EBackendError.EBERR_OK )
164 result = "OK";
165 else if ( code == EBackendError.EBERR_UNKNOWN )
166 result = "Offline";
167 else if ( code == EBackendError.EBERR_DISABLED )
168 result = "Communication Disabled";
169 else if ( code == EBackendError.EBERR_INVALID_STATE )
170 result = "Cannot be called from current state";
171 else if ( code == EBackendError.EBERR_BUSY )
172 result = "Busy processing requests";
173 else if ( code == EBackendError.EBERR_ALREADY_OFFLINE )
174 result = "Already disconnected";
175 else if ( code == EBackendError.EBERR_ALREADY_ONLINE )
176 result = "Already connected";
177 else if ( code == EBackendError.EBERR_LOGIN_FAILED )
178 result = "Failed to logon";
179 else if ( code == EBackendError.EBERR_AUTH_FAILED )
180 result = "Failed to Authenticate";
181 else
182 result = "*";
183
184 return result;
185 }
186
190 void OnCannotInitiate( int code )
191 {
192 Print("!!! [Backend] Cannot Initiate: "+ GetErrorCode(code));
193 }
194
198 void OnCannotShutdown( int code )
199 {
200 Print("!!! [Backend] Cannot Shutdown: "+ GetErrorCode(code));
201 }
202
206 void OnSuccess( string step )
207 {
208 Print( "[Backend] Successfully Solicited: " + step );
209 }
210
214 void OnFail( string step )
215 {
216 Print( "[Backend] Failed to Proceed: " + step );
217 }
218
225 proto native void Request( int request, BackendCallback cb, JsonApiStruct dataObject );
226
234 proto native void PlayerRequest( int request, BackendCallback cb, JsonApiStruct dataObject, int iPlayerId );
235
242 proto native void FeedbackMessage( BackendCallback cb, JsonApiStruct dataObject, string message );
243
249 proto native void SetCredentialsItem( EBackendCredentials item, string str );
250
255 proto native string GetCredentialsItem( EBackendCredentials item );
256
260 proto native void VerifyCredentials();
261
262};
263
264
266
267// -------------------------------------------------------------------------
EBackendRequest
Backend request.
Определения BackendApi.c:28
@ EBREQ_USER_Login
Определения BackendApi.c:41
@ EBREQ_USER_Auth
Определения BackendApi.c:42
EBackendCredentials
Credential parameters.
Определения BackendApi.c:76
@ EBCRED_PWD
Определения BackendApi.c:78
@ EBCRED_NAME
Определения BackendApi.c:77
@ EBCRED_BASEURI
Определения BackendApi.c:79
EBackendError
Backend error.
Определения BackendApi.c:7
@ EBERR_LOGIN_SUCCESS
Определения BackendApi.c:18
@ EBERR_INVALID_STATE
Определения BackendApi.c:11
@ EBERR_CHARACTER_UPDATE
Определения BackendApi.c:23
@ EBERR_ALREADY_ONLINE
Определения BackendApi.c:14
@ EBERR_DISABLED
Определения BackendApi.c:10
@ EBERR_OK
Определения BackendApi.c:8
@ EBERR_CHARACTER_GET
Определения BackendApi.c:22
@ EBERR_AUTH_FAILED
Определения BackendApi.c:17
@ EBERR_CEPROFILE_GET
Определения BackendApi.c:21
@ EBERR_ALREADY_REQUESTED
Определения BackendApi.c:15
@ EBERR_ALREADY_OFFLINE
Определения BackendApi.c:13
@ EBERR_BUSY
Определения BackendApi.c:12
@ EBERR_AUTH_SUCCESS
Определения BackendApi.c:19
@ EBERR_UNKNOWN
Определения BackendApi.c:9
@ EBERR_LOGIN_FAILED
Определения BackendApi.c:16
@ EBERR_CONFIGURATION_GET
Определения BackendApi.c:20
proto native BackendApi GetBackendApi()
proto native string GetCredentialsItem(EBackendCredentials item)
Get credentials value per item.
proto native void PlayerRequest(int request, BackendCallback cb, JsonApiStruct dataObject, int iPlayerId)
Ask player request with callback result from controller (Lobby)
void OnCannotInitiate(int code)
Called when initiate cannot be called.
Определения BackendApi.c:190
void ~BackendApi()
Определения BackendApi.c:132
void OnSuccess(string step)
Called when step was successfully proceeded.
Определения BackendApi.c:206
proto native void VerifyCredentials()
Invoke credentials update (authenticate with new name+password)
proto native bool IsDisconnected()
Backend offline - authentication may be initiated.
proto native bool Initiate()
Initiate backend - request processing.
proto native void Request(int request, BackendCallback cb, JsonApiStruct dataObject)
Ask specific request with callback result.
void OnCannotShutdown(int code)
Called when shutdown cannot be proceeded.
Определения BackendApi.c:198
proto native bool Shutdown()
Shutdown backend - request processing.
proto native void FeedbackMessage(BackendCallback cb, JsonApiStruct dataObject, string message)
Send feedback message and/ or script object with whatever data on it (additionally it is possible to ...
proto native bool IsBusy()
Backend is busy - authentication in process.
void OnFail(string step)
Called when step failed.
Определения BackendApi.c:214
proto native void SetCredentialsItem(EBackendCredentials item, string str)
Set credentials value per item.
void BackendApi()
Определения BackendApi.c:131
proto native bool IsRuntime()
Backend fully working and initialized.
string GetErrorCode(int code)
Error code to string.
Определения BackendApi.c:159
Определения BackendApi.c:130
void OnTimeout()
Request not finished due to timeout.
Определения BackendApi.c:119
void OnDataReceive(string data, int size)
Called when data were recieved, you can ignore it when using callback to JsonStruct object with expan...
Определения BackendApi.c:92
void OnSuccess(int code)
Request finished with success result.
Определения BackendApi.c:111
void OnError(int code)
Request finished with error result.
Определения BackendApi.c:102
Определения BackendApi.c:86
Определения JsonApiStruct.c:9
TODO doc.
Определения EnScript.c:118
proto void Print(void var)
Prints content of variable to console/log.