1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 17 #ifndef APPACCOUNT_FFI_H 18 #define APPACCOUNT_FFI_H 19 20 #include <stdint.h> 21 22 #include "cj_common_ffi.h" 23 #include "ffi_remote_data.h" 24 #include "appaccount_common.h" 25 #include "appaccount_defination.h" 26 #include "appaccount_error.h" 27 #include "appaccount_impl.h" 28 #include "appaccount_parameter_parse.h" 29 30 #ifndef FFI_EXPORT 31 #ifndef WINDOWS_PLATFORM 32 #define FFI_EXPORT __attribute__((visibility("default"))) 33 #else 34 #define FFI_EXPORT __declspec(dllexport) 35 #endif 36 #endif 37 38 #ifdef __cplusplus 39 #if __cplusplus 40 extern "C" { 41 #endif 42 #endif 43 44 FFI_EXPORT RetDataI64 FfiAppAccountCreateAppAccountManager(void); 45 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerCreateAccount(int id, char *name, CCreateAccountOptions options); 46 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerRemoveAccount(int id, char *name); 47 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetAppAccess(int id, char *name, char *bundleName, bool isAccessible); 48 FFI_EXPORT RetDataBool FfiAppAccountAppAccountManagerCheckAppAccess(int id, char *name, char *bundleName); 49 FFI_EXPORT RetDataBool FfiAppAccountAppAccountManagerCheckDataSyncEnabled(int id, char *name); 50 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetCredential( 51 int id, char *name, char *credentialType, char *credential); 52 FFI_EXPORT ErrCArrAppAccountInfo FfiAppAccountAppAccountManagerGetAccountsByOwner(int id, char *owner); 53 FFI_EXPORT RetDataCString FfiAppAccountAppAccountManagerGetCredential(int id, char *name, char *credentialType); 54 FFI_EXPORT RetDataCString FfiAppAccountAppAccountManagerGetCustomData(int id, char *name, char *key); 55 FFI_EXPORT RetDataCString FfiAppAccountAppAccountManagerGetAuthToken(int id, char *name, char *owner, char *authType); 56 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetAuthToken(int id, char *name, char *authType, char *token); 57 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerDeleteAuthToken( 58 int id, char *name, char *owner, char *authType, char *token); 59 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetAuthTokenVisibility( 60 int id, char *name, char *authType, char *bundleName, bool isVisible); 61 FFI_EXPORT RetDataBool FfiAppAccountAppAccountManagerCheckAuthTokenVisibility( 62 int id, char *name, char *authType, char *bundleName, bool isVisible); 63 FFI_EXPORT ErrCArrAuthTokenInfo FfiAppAccountAppAccountManagerGetAllAuthTokens(int id, char *name, char *owner); 64 FFI_EXPORT RetDataCArrString FfiAppAccountAppAccountManagerGetAuthList(int id, char *name, char *authType); 65 FFI_EXPORT ErrCAuthenticatorInfo FfiAppAccountAppAccountManagerQueryAuthenticatorInfo(int id, char *owner); 66 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerDeleteCredential(int id, char *name, char *credentialType); 67 FFI_EXPORT ErrCArrAppAccountInfo FfiAppAccountAppAccountManagerGetAllAccounts(int id); 68 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetCustomData(int id, char *name, char *key, char *value); 69 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetDataSyncEnabled(int id, char *name, bool isEnabled); 70 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerOn( 71 int id, char *type, CArrString owners, void (*callback)(CArrAppAccountInfo cArrAppAccountInfo)); 72 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerOff( 73 int id, char *type, void (*callback)(CArrAppAccountInfo cArrAppAccountInfo)); 74 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerCheckAccountLabels( 75 int id, char *name, char *owner, CArrString labels, void (*callback)(RetDataBool infoRef)); 76 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSelectAccountsByOptions( 77 int id, CSelectAccountsOptions cOptions, void (*callback)(ErrCArrAppAccountInfo infoRef)); 78 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerVerifyCredential( 79 int id, char *name, char *owner, CAuthCallback callbackId, CVerifyCredentialOptions cOptions); 80 FFI_EXPORT int32_t FfiAppAccountAppAccountManagerSetAuthenticatorProperties( 81 int id, char *owner, CAuthCallback callbackId, CSetPropertiesOptions cOptions); 82 } 83 #endif