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 24 DECLARE_HC_VECTOR(SubTaskVec, void *) 25 26 typedef struct TaskT { 27 int taskId; 28 VersionInfo versionInfo; 29 void(*destroyTask)(struct TaskT *); 30 int(*processTask)(struct TaskT *, const CJson *in, CJson *out, int32_t *status); 31 SubTaskVec vec; 32 } Task; 33 34 Task *CreateTaskT(int32_t *taskId, const CJson *in, CJson *out); 35 36 int32_t InitDasProtocolEntities(void); 37 void DestroyDasProtocolEntities(void); 38 39 int32_t RegisterLocalIdentityInTask(const char *pkgName, const char *serviceType, Uint8Buff *authId, int userType); 40 int32_t UnregisterLocalIdentityInTask(const char *pkgName, const char *serviceType, Uint8Buff *authId, int userType); 41 int32_t DeletePeerAuthInfoInTask(const char *pkgName, const char *serviceType, Uint8Buff *authIdPeer, int userTypePeer); 42 int32_t GetPublicKeyInTask(const char *pkgName, const char *serviceType, Uint8Buff *authIdPeer, int userTypePeer, 43 Uint8Buff *returnPk); 44 45 #endif 46