Lines Matching refs:hSession
394 void HdcServer::NotifyInstanceSessionFree(HSession hSession, bool freeOrClear)
397 AdminDaemonMap(OP_QUERY, hSession->connectKey, hdiOld);
407 AdminDaemonMap(OP_UPDATE, hSession->connectKey, hdiNew);
408 CleanForwardMap(hSession->sessionId);
426 void HdcServer::GetDaemonAuthType(HSession hSession, SessionHandShake &handshake)
431 * Notice, If deamon is old version 'handshake.buf' will be 'hSession->tokenRSA',
432 * the length of hSession->tokenRSA less than min len(TLV_MIN_LEN), so there no
436 hSession->verifyType = AuthVerifyType::RSA_ENCRYPT;
438 WRITE_LOG(LOG_INFO, "the deamon maybe old version for %u session, so use rsa encrypt", hSession->sessionId);
443 WRITE_LOG(LOG_FATAL, "the buf is invalid for %u session, so use rsa encrypt", hSession->sessionId);
446 hSession->verifyType = AuthVerifyType::RSA_3072_SHA512;
447 WRITE_LOG(LOG_INFO, "daemon auth type is rsa_3072_sha512 for %u session", hSession->sessionId);
450 bool HdcServer::HandServerAuth(HSession hSession, SessionHandShake &handshake)
456 GetDaemonAuthType(hSession, handshake);
463 Send(hSession->sessionId, 0, CMD_KERNEL_HANDSHAKE,
471 if (!HdcAuth::RsaSignAndBase64(handshake.buf, hSession->verifyType)) {
477 Send(hSession->sessionId, 0, CMD_KERNEL_HANDSHAKE,
528 bool HdcServer::ServerSessionHandshake(HSession hSession, uint8_t *payload, int payloadSize)
548 if (!HandServerAuth(hSession, handshake)) {
555 UpdateHdiInfo(handshake, hSession->connectKey);
556 hSession->handshakeOK = true;
561 bool HdcServer::FetchCommand(HSession hSession, const uint32_t channelId, const uint16_t command, uint8_t *payload,
567 ret = ServerSessionHandshake(hSession, payload, payloadSize);
569 hSession->connType);
584 Send(hSession->sessionId, channelId, CMD_KERNEL_CHANNEL_CLOSE, &flag, 1);
607 ClearOwnTasks(hSession, channelId);
612 Send(hSession->sessionId, channelId, CMD_KERNEL_CHANNEL_CLOSE, payload, 1);
621 pdiNew->sessionId = hSession->sessionId;
622 pdiNew->connectKey = hSession->connectKey;
746 HSession hSession = (HSession)handle->data;
748 HdcServer *hdcServer = (HdcServer *)hSession->classInstance;
752 if (hSession->connectKey == "any") {
753 hdcServer->AdminDaemonMap(OP_GET_ANY, hSession->connectKey, pDi);
755 hdcServer->AdminDaemonMap(OP_QUERY, hSession->connectKey, pDi);
760 HdcHostUSB *hdcHostUSB = (HdcHostUSB *)hSession->classModule;
761 hdcHostUSB->ConnectDetectDaemon(hSession, pDi);
773 HSession hSession = (HSession)handle->data;
775 HdcServer *hdcServer = (HdcServer *)hSession->classInstance;
778 if (hSession->hUART->retryCount > uartConnectRetryMax) {
780 hSession->hUART->retryCount);
781 hdcServer->FreeSession(hSession->sessionId);
785 hSession->hUART->retryCount++;
788 WRITE_LOG(LOG_DEBUG, "%s query %s", __FUNCTION__, hSession->ToDebugString().c_str());
789 hdcServer->AdminDaemonMap(OP_QUERY, hSession->connectKey, pDi);
794 HdcHostUART *hdcHostUART = (HdcHostUART *)hSession->classModule;
795 hdcHostUART->ConnectDaemonByUart(hSession, pDi);
806 void HdcServer::CreatConnectUart(HSession hSession)
814 waitTimeDoCmd->data = hSession;
853 HSession hSession = nullptr;
855 hSession = clsTCPClt->ConnectDaemon(connectKey, isCheck);
859 hSession = clsUARTClt->ConnectDaemon(connectKey);
862 hSession = MallocSession(true, CONN_USB, clsUSBClt);
863 if (!hSession) {
867 hSession->connectKey = connectKey;
871 FreeSession(hSession->sessionId);
875 waitTimeDoCmd->data = hSession;
878 if (!hSession) {
879 WRITE_LOG(LOG_FATAL, "CreateConnect hSession nullptr");
886 diNew.hSession = hSession;
893 void HdcServer::AttachChannel(HSession hSession, const uint32_t channelId)
902 uv_tcp_init(&hSession->childLoop, &hChannel->hChildWorkTCP);
904 hChannel->targetSessionId = hSession->sessionId;
920 void HdcServer::DeatchChannel(HSession hSession, const uint32_t channelId)
926 ClearOwnTasks(hSession, channelId);
928 Send(hSession->sessionId, channelId, CMD_KERNEL_CHANNEL_CLOSE, &count, 1);
937 ClearOwnTasks(hSession, channelId);
939 Send(hSession->sessionId, hChannel->channelId, CMD_KERNEL_CHANNEL_CLOSE, &count, 1);
940 WRITE_LOG(LOG_DEBUG, "Childchannel begin close, cid:%u, sid:%u", hChannel->channelId, hSession->sessionId);
942 Base::DoNextLoop(&hSession->childLoop, hChannel, [](const uint8_t flag, string &msg, const void *data) {
964 HSession hSession = AdminSession(OP_QUERY, sessionId, nullptr);
965 if (!hChannel || !hSession) {
968 return FetchCommand(hSession, channelId, command, bufPtr, size);
972 bool HdcServer::RedirectToTask(HTaskInfo hTaskInfo, HSession hSession, const uint32_t channelId,