• Home
  • Raw
  • Download

Lines Matching refs:reqNode

38 static inline int CheckMsg(const AppSpawnReqMsgNode *reqNode, const AppSpawnTlv *tlv, const char *n…  in CheckMsg()  argument
40 if ((reqNode->msg->msgLen + tlv->tlvLen) > MAX_MSG_TOTAL_LENGTH) { in CheckMsg()
44 if (reqNode->msg->msgType == MSG_GET_RENDER_TERMINATION_STATUS) { in CheckMsg()
62 static AppSpawnMsgBlock *CreateAppSpawnMsgBlock(AppSpawnReqMsgNode *reqNode) in CreateAppSpawnMsgBlock() argument
69 OH_ListAddTail(&reqNode->msgBlocks, &block->node); in CreateAppSpawnMsgBlock()
73 static AppSpawnMsgBlock *GetValidMsgBlock(const AppSpawnReqMsgNode *reqNode, uint32_t realLen) in GetValidMsgBlock() argument
76 struct ListNode *node = reqNode->msgBlocks.next; in GetValidMsgBlock()
77 while (node != &reqNode->msgBlocks) { in GetValidMsgBlock()
87 static AppSpawnMsgBlock *GetTailMsgBlock(const AppSpawnReqMsgNode *reqNode) in GetTailMsgBlock() argument
90 struct ListNode *node = reqNode->msgBlocks.prev; in GetTailMsgBlock()
91 if (node != &reqNode->msgBlocks) { in GetTailMsgBlock()
121 static int AddAppDataToTail(AppSpawnReqMsgNode *reqNode, const uint8_t *data, uint32_t dataLen, int… in AddAppDataToTail() argument
124 AppSpawnMsgBlock *block = GetTailMsgBlock(reqNode); in AddAppDataToTail()
144 block = CreateAppSpawnMsgBlock(reqNode); in AddAppDataToTail()
150 static int AddAppDataEx(AppSpawnReqMsgNode *reqNode, const char *name, const AppSpawnAppData *data) in AddAppDataEx() argument
163 ret = CheckMsg(reqNode, (AppSpawnTlv *)&tlv, name); in AddAppDataEx()
167 name, tlv.tlvLen, data->dataLen, reqNode->msg->msgLen); in AddAppDataEx()
169 AppSpawnMsgBlock *block = GetValidMsgBlock(reqNode, tlv.tlvLen); in AddAppDataEx()
177 ret = AddAppDataToTail(reqNode, (uint8_t *)&tlv, sizeof(tlv), 0); in AddAppDataEx()
179 ret = AddAppDataToTail(reqNode, data->data, data->dataLen, data->dataType); in AddAppDataEx()
182 reqNode->msg->tlvCount++; in AddAppDataEx()
183 reqNode->msg->msgLen += tlv.tlvLen; in AddAppDataEx()
184 …APPSPAWN_LOGV("AddAppDataEx success name '%{public}s' end: %{public}u", name, reqNode->msg->msgLen… in AddAppDataEx()
188 static int AddAppData(AppSpawnReqMsgNode *reqNode, in AddAppData() argument
202 int ret = CheckMsg(reqNode, &tlv, name); in AddAppData()
206 name, tlv.tlvLen, dataLen, reqNode->msg->msgLen); in AddAppData()
208 AppSpawnMsgBlock *block = GetValidMsgBlock(reqNode, tlv.tlvLen); in AddAppData()
219 ret = AddAppDataToTail(reqNode, (uint8_t *)&tlv, sizeof(tlv), 0); in AddAppData()
223 …ret = AddAppDataToTail(reqNode, (uint8_t *)data[index].data, data[index].dataLen, data[index].data… in AddAppData()
227 reqNode->msg->msgLen += tlv.tlvLen; in AddAppData()
228 …APPSPAWN_LOGV("AddAppData success tlvType %{public}s end: %{public}u", name, reqNode->msg->msgLen); in AddAppData()
232 static int SetFlagsTlv(AppSpawnReqMsgNode *reqNode, in SetFlagsTlv() argument
247 reqNode->msg->msgLen += flagsLen; in SetFlagsTlv()
248 reqNode->msg->tlvCount++; in SetFlagsTlv()
252 static int CreateBaseMsg(AppSpawnReqMsgNode *reqNode, uint32_t msgType, const char *processName) in CreateBaseMsg() argument
254 AppSpawnMsgBlock *block = CreateAppSpawnMsgBlock(reqNode); in CreateBaseMsg()
258 reqNode->msg = (AppSpawnMsg *)(block->buffer + block->currentIndex); in CreateBaseMsg()
259 reqNode->msg->magic = APPSPAWN_MSG_MAGIC; in CreateBaseMsg()
260 reqNode->msg->msgId = 0; in CreateBaseMsg()
261 reqNode->msg->msgType = msgType; in CreateBaseMsg()
262 reqNode->msg->msgLen = sizeof(AppSpawnMsg); in CreateBaseMsg()
263 reqNode->msg->tlvCount = 0; in CreateBaseMsg()
264 int ret = strcpy_s(reqNode->msg->processName, sizeof(reqNode->msg->processName), processName); in CreateBaseMsg()
267 ret = SetFlagsTlv(reqNode, block, &reqNode->msgFlags, TLV_MSG_FLAGS, MAX_FLAGS_INDEX); in CreateBaseMsg()
272 ret = SetFlagsTlv(reqNode, block, &reqNode->permissionFlags, TLV_PERMISSION, maxCount); in CreateBaseMsg()
274 …APPSPAWN_LOGV("CreateBaseMsg msgLen: %{public}u %{public}u", reqNode->msg->msgLen, block->currentI… in CreateBaseMsg()
278 static void DeleteAppSpawnReqMsg(AppSpawnReqMsgNode *reqNode) in DeleteAppSpawnReqMsg() argument
280 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return); in DeleteAppSpawnReqMsg()
281 APPSPAWN_LOGV("DeleteAppSpawnReqMsg reqId: %{public}u", reqNode->reqId); in DeleteAppSpawnReqMsg()
282 reqNode->msgFlags = NULL; in DeleteAppSpawnReqMsg()
283 reqNode->permissionFlags = NULL; in DeleteAppSpawnReqMsg()
284 reqNode->msg = NULL; in DeleteAppSpawnReqMsg()
286 OH_ListRemoveAll(&reqNode->msgBlocks, FreeMsgBlock); in DeleteAppSpawnReqMsg()
287 free(reqNode); in DeleteAppSpawnReqMsg()
293 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)malloc(sizeof(AppSpawnReqMsgNode)); in CreateAppSpawnReqMsg() local
294 …APPSPAWN_CHECK(reqNode != NULL, return NULL, "Failed to create msg node for %{public}s", processNa… in CreateAppSpawnReqMsg()
296 OH_ListInit(&reqNode->node); in CreateAppSpawnReqMsg()
297 OH_ListInit(&reqNode->msgBlocks); in CreateAppSpawnReqMsg()
298 reqNode->reqId = ++reqId; in CreateAppSpawnReqMsg()
299 reqNode->msg = NULL; in CreateAppSpawnReqMsg()
300 reqNode->msgFlags = NULL; in CreateAppSpawnReqMsg()
301 reqNode->permissionFlags = NULL; in CreateAppSpawnReqMsg()
302 int ret = CreateBaseMsg(reqNode, msgType, processName); in CreateAppSpawnReqMsg()
303 APPSPAWN_CHECK(ret == 0, DeleteAppSpawnReqMsg(reqNode); in CreateAppSpawnReqMsg()
306 reqNode->reqId, msgType, processName); in CreateAppSpawnReqMsg()
307 return reqNode; in CreateAppSpawnReqMsg()
335 AppSpawnReqMsgNode *reqNode = CreateAppSpawnReqMsg(msgType, processName); in AppSpawnReqMsgCreate() local
336 APPSPAWN_CHECK(reqNode != NULL, return APPSPAWN_SYSTEM_ERROR, in AppSpawnReqMsgCreate()
338 *reqHandle = (AppSpawnReqMsgHandle)(reqNode); in AppSpawnReqMsgCreate()
344 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgFree() local
345 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return); in AppSpawnReqMsgFree()
346 DeleteAppSpawnReqMsg(reqNode); in AppSpawnReqMsgFree()
351 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetAppDacInfo() local
352 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetAppDacInfo()
357 GetSpecialGid(reqNode->msg->processName, tmpDacInfo.gidTable, &tmpDacInfo.gidCount); in AppSpawnReqMsgSetAppDacInfo()
362 return AddAppData(reqNode, TLV_DAC_INFO, data, 1, "TLV_DAC_INFO"); in AppSpawnReqMsgSetAppDacInfo()
367 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetBundleInfo() local
368 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetBundleInfo()
380 return AddAppData(reqNode, TLV_BUNDLE_INFO, data, MAX_DATA_IN_TLV, "TLV_BUNDLE_INFO"); in AppSpawnReqMsgSetBundleInfo()
385 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetAppFlag() local
386 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetAppFlag()
387 APPSPAWN_CHECK(reqNode->msgFlags != NULL, return APPSPAWN_ARG_INVALID, "No msg flags tlv "); in AppSpawnReqMsgSetAppFlag()
390 return SetAppSpawnMsgFlags(reqNode->msgFlags, flagIndex); in AppSpawnReqMsgSetAppFlag()
395 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgAddExtInfo() local
396 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgAddExtInfo()
406 return AddAppDataEx(reqNode, name, data); // 2 max count in AppSpawnReqMsgAddExtInfo()
411 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgAddStringInfo() local
412 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgAddStringInfo()
423 return AddAppDataEx(reqNode, name, data); // 2 max count in AppSpawnReqMsgAddStringInfo()
428 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgAddPermission() local
429 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgAddPermission()
431 …APPSPAWN_CHECK(reqNode->permissionFlags != NULL, return APPSPAWN_ARG_INVALID, "No permission tlv "… in AppSpawnReqMsgAddPermission()
438 int ret = SetAppSpawnMsgFlags(reqNode->permissionFlags, index); in AppSpawnReqMsgAddPermission()
445 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetAppDomainInfo() local
446 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetAppDomainInfo()
458 return AddAppData(reqNode, TLV_DOMAIN_INFO, data, MAX_DATA_IN_TLV, "TLV_DOMAIN_INFO"); in AppSpawnReqMsgSetAppDomainInfo()
463 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetAppInternetPermissionInfo() local
464 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetAppInternetPermissionInfo()
472 return AddAppData(reqNode, TLV_INTERNET_INFO, data, 1, "TLV_INTERNET_INFO"); in AppSpawnReqMsgSetAppInternetPermissionInfo()
477 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetAppOwnerId() local
478 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetAppOwnerId()
486 return AddAppData(reqNode, TLV_OWNER_INFO, data, 1, "TLV_OWNER_INFO"); in AppSpawnReqMsgSetAppOwnerId()
491 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnReqMsgSetAppAccessToken() local
492 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnReqMsgSetAppAccessToken()
497 return AddAppData(reqNode, TLV_ACCESS_TOKEN_INFO, data, 1, "TLV_ACCESS_TOKEN_INFO"); in AppSpawnReqMsgSetAppAccessToken()
503 …AppSpawnReqMsgNode *reqNode = CreateAppSpawnReqMsg(MSG_GET_RENDER_TERMINATION_STATUS, "terminate-p… in AppSpawnTerminateMsgCreate() local
504 APPSPAWN_CHECK(reqNode != NULL, return APPSPAWN_SYSTEM_ERROR, "Failed to create msg node"); in AppSpawnTerminateMsgCreate()
509 …int ret = AddAppData(reqNode, TLV_RENDER_TERMINATION_INFO, data, 1, "TLV_RENDER_TERMINATION_INFO"); in AppSpawnTerminateMsgCreate()
510 APPSPAWN_CHECK_ONLY_EXPER(ret == 0, DeleteAppSpawnReqMsg(reqNode); in AppSpawnTerminateMsgCreate()
512 *reqHandle = (AppSpawnReqMsgHandle)(reqNode); in AppSpawnTerminateMsgCreate()
520 AppSpawnReqMsgNode *reqNode = (AppSpawnReqMsgNode *)reqHandle; in AppSpawnClientAddPermission() local
521 APPSPAWN_CHECK_ONLY_EXPER(reqNode != NULL, return APPSPAWN_ARG_INVALID); in AppSpawnClientAddPermission()
523 …APPSPAWN_CHECK(reqNode->permissionFlags != NULL, return APPSPAWN_ARG_INVALID, "No permission tlv "… in AppSpawnClientAddPermission()
530 int ret = SetAppSpawnMsgFlags(reqNode->permissionFlags, index); in AppSpawnClientAddPermission()