1 /* 2 * Copyright (c) 2023 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 MOCK_DLP_CREDENTIAL_CLIENT_DEFINES_H 17 #define MOCK_DLP_CREDENTIAL_CLIENT_DEFINES_H 18 19 #include <stdint.h> 20 21 #define RESERVED_LEN 64 22 23 typedef enum { 24 CLOUD_ACCOUNT = 1, 25 DOMAIN_ACCOUNT, 26 APPLICATION_ACCOUNT, 27 } AccountType; 28 29 typedef enum { 30 RECEIVER_DECRYPT_MUST_USE_CLOUD_AND_RETURN_ENCRYPTION_VALUE = 0, 31 RECEIVER_DECRYPT_MUST_USE_CLOUD = 1, 32 ALLOW_RECEIVER_DECRYPT_WITHOUT_USE_CLOUD = 2, 33 } CloudEncOption; 34 35 typedef struct { 36 CloudEncOption opt; 37 uint8_t *extraInfo; 38 uint32_t extraInfoLen; 39 } EncAndDecOptions; 40 41 typedef struct { 42 uint8_t *accountId; 43 uint32_t accountIdLen; 44 } AccountInfo; 45 46 typedef struct { 47 char *featureName; 48 uint8_t *data; 49 uint32_t dataLen; 50 EncAndDecOptions options; 51 AccountType accountType; 52 AccountInfo senderAccountInfo; 53 uint8_t reserved[RESERVED_LEN]; 54 } DLP_PackPolicyParams; 55 56 typedef struct { 57 char *featureName; 58 uint8_t *data; 59 uint32_t dataLen; 60 EncAndDecOptions options; 61 AccountType accountType; 62 AccountInfo receiverAccountInfo; 63 uint8_t reserved[RESERVED_LEN]; 64 } DLP_EncPolicyData; 65 66 typedef struct { 67 uint8_t *data; 68 uint32_t dataLen; 69 uint8_t reserved[RESERVED_LEN]; 70 } DLP_RestorePolicyData; 71 72 typedef enum { 73 DLP_SUCCESS = 0x00000000, 74 DLP_ERROR = 0x00000001, 75 DLP_ERR_INVALID_PARAMS = 0x00000002, 76 DLP_ERR_GENERATE_KEY_FAILED = 0x00001001, 77 DLP_ERR_IPC_INTERNAL_FAILED = 0x00002001, 78 DLP_ERR_CONNECTION_TIME_OUT = 0x00003001, 79 DLP_ERR_FILE_PATH = 0x00004001, 80 DLP_ERR_CONNECTION_VIP_RIGHT_EXPIRED = 0x00003009, 81 DLP_ERR_CONNECTION_POLICY_PERMISSION_EXPIRED = 0x0000300B, 82 DLP_ERR_CONNECTION_NO_PERMISSION = 0x0000300C, 83 DLP_ERR_CREDENTIAL_NOT_EXIST = 0x00005001, 84 DLP_ERR_ACCOUNT_NOT_LOG_IN = 0x00006001, 85 DLP_ERR_TOKEN_CONNECTION_FAIL = 0x00006006, 86 DLP_ERR_TOKEN_CONNECTION_TIME_OUT = 0x00006007, 87 DLP_ERR_APPID_NOT_AUTHORIZED = 0x00007005, 88 DLP_ERR_CALLBACK_TIME_OUT = 0x0000200A, 89 } DLP_ErrorCode; 90 91 typedef void (*DLP_PackPolicyCallback)(uint64_t requestId, int errorCode, DLP_EncPolicyData *outParams); 92 93 typedef void (*DLP_RestorePolicyCallback)(uint64_t requestId, int errorCode, DLP_RestorePolicyData *outParams); 94 95 #endif 96