1 /* 2 * Copyright (C) 2025 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 #ifndef SA_LOAD_ON_DEMAND_H 17 #define SA_LOAD_ON_DEMAND_H 18 19 #include <stdint.h> 20 #include "device_auth.h" 21 #include "ipc_sdk_defines.h" 22 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 typedef int32_t (*RegCallbackFunc)(const char *appId, const DeviceAuthCallback *callback, bool needCache); 29 typedef int32_t (*RegDataChangeListenerFunc)(const char *appId, const DataChangeListener *listener, bool needCache); 30 typedef int32_t (*RegCredChangeListenerFunc)(const char *appId, CredChangeListener *listener, bool needCache); 31 32 int32_t AddCallbackInfoToList(const char *appId, const DeviceAuthCallback *callback, 33 const DataChangeListener *dataChangeListener, CredChangeListener *listener, int32_t callbackType); 34 int32_t RemoveCallbackInfoFromList(const char *appId, int32_t callbackType); 35 36 void SetRegCallbackFunc(RegCallbackFunc regCallbackFunc); 37 void SetRegDataChangeListenerFunc(RegDataChangeListenerFunc regDataChangeListenerFunc); 38 void SetRegCredChangeListenerFunc(RegCredChangeListenerFunc regCredChangeListenerFunc); 39 void RegisterDevAuthCallbackIfNeed(void); 40 41 int32_t LoadDeviceAuthSaIfNotLoad(void); 42 void SubscribeDeviceAuthSa(void); 43 void UnSubscribeDeviceAuthSa(void); 44 45 int32_t InitLoadOnDemand(void); 46 void DeInitLoadOnDemand(void); 47 48 #ifdef __cplusplus 49 } 50 #endif 51 #endif 52