1 /*
2  * Copyright (c) 2022 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 DEVICE_SECURITY_INFO_H
17 #define DEVICE_SECURITY_INFO_H
18 
19 #include <stdint.h>
20 
21 #include "device_security_defines.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef struct DeviceSecurityInfo DeviceSecurityInfo;
28 
29 /**
30  * Callback for requesting device security level information.
31  */
32 typedef void DeviceSecurityInfoCallback(const DeviceIdentify *identify, struct DeviceSecurityInfo *info);
33 
34 /**
35  * Synchronously requests for the device security level of the local/neighbor devices.
36  *
37  * @param [in] identify Device identifier.
38  * @param [in] option Option value.
39  * @param [out] info Information containing the device security level.
40  * @return
41  */
42 int32_t RequestDeviceSecurityInfo(const DeviceIdentify *identify, const RequestOption *option,
43     DeviceSecurityInfo **info);
44 
45 /**
46  * Asynchronously requests for the device security level of the local/neighbor devices.
47  *
48  * @param [in] identify Identify Device identifier.
49  * @param [in] option Option value.
50  * @param [in] info Callback used to return the device security level information.
51  * @return
52  */
53 int32_t RequestDeviceSecurityInfoAsync(const DeviceIdentify *identify, const RequestOption *option,
54     DeviceSecurityInfoCallback callback);
55 
56 /**
57  * Releases device security level information.
58  * @param info Device security level information in RequestDeviceSecurityInfo.
59  */
60 void FreeDeviceSecurityInfo(DeviceSecurityInfo *info);
61 
62 /**
63  * Gets the device security level from DeviceSecurityInfo.
64  * @param [in] info Device security level information.
65  * @param [out] level Device security level.
66  * @return
67  */
68 int32_t GetDeviceSecurityLevelValue(const DeviceSecurityInfo *info, int32_t *level);
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif // DEVICE_SECURITY_INFO_H
75