1 /* 2 * Copyright (C) 2021 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 TASK_MAIN_H 17 #define TASK_MAIN_H 18 19 #include "common_defs.h" 20 #include "hc_vector.h" 21 #include "json_utils.h" 22 #include "das_version_util.h" 23 #include "das_token_manager.h" 24 25 DECLARE_HC_VECTOR(SubTaskVec, void *) 26 27 typedef struct TaskT { 28 int taskId; 29 VersionInfo versionInfo; 30 void(*destroyTask)(struct TaskT *); 31 int(*processTask)(struct TaskT *, const CJson *in, CJson *out, int32_t *status); 32 SubTaskVec vec; 33 } Task; 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 Task *CreateTaskT(int32_t *taskId, const CJson *in, CJson *out); 40 41 int32_t InitDasProtocolEntities(void); 42 void DestroyDasProtocolEntities(void); 43 44 int32_t RegisterLocalIdentityInTask(const TokenManagerParams *params); 45 int32_t UnregisterLocalIdentityInTask(const TokenManagerParams *params); 46 int32_t DeletePeerAuthInfoInTask(const TokenManagerParams *params); 47 int32_t GetPublicKeyInTask(const TokenManagerParams *params, Uint8Buff *returnPk); 48 49 #ifdef __cplusplus 50 } 51 #endif 52 #endif 53