Home
last modified time | relevance | path

Searched refs:hSession (Results 1 – 25 of 29) sorted by relevance

12

/developtools/hdc/src/common/
Dsession.cpp139 void HdcSessionBase::ClearOwnTasks(HSession hSession, const uint32_t channelIDInput) in ClearOwnTasks() argument
145 hSession->mapTaskMutex.lock(); in ClearOwnTasks()
147 for (iter = hSession->mapTask->begin(); iter != hSession->mapTask->end();) { in ClearOwnTasks()
156 … WRITE_LOG(LOG_DEBUG, "ClearOwnTasks OP_CLEAR finish, session:%p channelIDInput:%u", hSession, in ClearOwnTasks()
158 iter = hSession->mapTask->erase(iter); in ClearOwnTasks()
163 iter = hSession->mapTask->erase(iter); in ClearOwnTasks()
165 hSession->mapTaskMutex.unlock(); in ClearOwnTasks()
173 HSession hSession = (HSession)v.second; in ClearSessions() local
174 if (!hSession->isDead) { in ClearSessions()
175 FreeSession(hSession->sessionId); in ClearSessions()
[all …]
Dusb.cpp32 HSession hSession = (HSession)stream->data; in ReadUSB() local
33 HdcSessionBase *hSessionBase = (HdcSessionBase *)hSession->classInstance; in ReadUSB()
34 if (hSessionBase->FetchIOBuf(hSession, hSession->ioBuf, nread) < 0) { in ReadUSB()
35 hSessionBase->FreeSession(hSession->sessionId); in ReadUSB()
39 bool HdcUSBBase::ReadyForWorkThread(HSession hSession) in ReadyForWorkThread() argument
43 if (uv_tcp_init(&hSession->childLoop, &hSession->dataPipe[STREAM_WORK]) || in ReadyForWorkThread()
44 uv_tcp_open(&hSession->dataPipe[STREAM_WORK], hSession->dataFd[STREAM_WORK])) { in ReadyForWorkThread()
48 hSession->dataPipe[STREAM_WORK].data = hSession; in ReadyForWorkThread()
49 HdcSessionBase *pSession = (HdcSessionBase *)hSession->classInstance; in ReadyForWorkThread()
50 Base::SetTcpOptions(&hSession->dataPipe[STREAM_WORK]); in ReadyForWorkThread()
[all …]
Dsession.h62 virtual void AttachChannel(HSession hSession, const uint32_t channelId) in AttachChannel() argument
65 virtual void DeatchChannel(HSession hSession, const uint32_t channelId) in DeatchChannel() argument
68 virtual void NotifyInstanceSessionFree(HSession hSession, bool freeOrClear) in NotifyInstanceSessionFree() argument
71 virtual bool RedirectToTask(HTaskInfo hTaskInfo, HSession hSession, const uint32_t channelId, in RedirectToTask() argument
91 int OnRead(HSession hSession, uint8_t *bufPtr, const int bufLen);
94 int SendByProtocol(HSession hSession, uint8_t *bufPtr, const int bufLen, bool echo = false);
96 virtual int FetchIOBuf(HSession hSession, uint8_t *ioBuf, int read);
98 …HTaskInfo AdminTask(const uint8_t op, HSession hSession, const uint32_t channelId, HTaskInfo hInpu…
99 …bool DispatchTaskData(HSession hSession, const uint32_t channelId, const uint16_t command, uint8_t…
101 void EnumUSBDeviceRegister(void (*pCallBack)(HSession hSession));
[all …]
Duart.cpp395 HSession hSession = (HSession)stream->data; in UartToHdcProtocol() local
396 unsigned int fd = hSession->dataFd[STREAM_MAIN]; in UartToHdcProtocol()
439 RetErrCode HdcUARTBase::DispatchToWorkThread(HSession hSession, uint8_t *readBuf, int readBytes) in DispatchToWorkThread() argument
441 if (hSession == nullptr) { in DispatchToWorkThread()
444 if (!UartSendToHdcStream(hSession, readBuf, readBytes)) { in DispatchToWorkThread()
450 size_t HdcUARTBase::PackageProcess(vector<uint8_t> &data, HSession hSession) in PackageProcess() argument
471 if (hSession == nullptr) { in PackageProcess()
473 hSession = GetSession(sessionId); in PackageProcess()
476 hSession = GetSession(sessionId, true); in PackageProcess()
479 if (hSession == nullptr) { in PackageProcess()
[all …]
Dusb.h24 virtual bool ReadyForWorkThread(HSession hSession);
25 virtual void CancelUsbIo(HSession hSession) {}; in CancelUsbIo() argument
26 int SendUSBBlock(HSession hSession, uint8_t *data, const int length);
29 virtual int SendUSBRaw(HSession hSession, uint8_t *data, const int length) in SendUSBRaw() argument
37 int SendToHdcStream(HSession hSession, uv_stream_t *stream, uint8_t *appendData, int dataSize);
49 int CheckPacketOption(HSession hSession, uint8_t *appendData, int dataSize);
50 void PreSendUsbSoftReset(HSession hSession, uint32_t sessionIdOld);
Dtask.cpp101 HdcSessionBase *hSession = (HdcSessionBase *)taskInfo->ownerSessionClass; in ServerCommand() local
102 return hSession->ServerCommand(taskInfo->sessionId, taskInfo->channelId, command, bufPtr, size); in ServerCommand()
109 HSession hSession = sessionBase->AdminSession(OP_QUERY, taskInfo->sessionId, nullptr); in ThreadCtrlCommunicate() local
110 if (!hSession) { in ThreadCtrlCommunicate()
114 if (uv_thread_self() == hSession->hWorkThread) { in ThreadCtrlCommunicate()
115 fd = hSession->ctrlFd[STREAM_MAIN]; in ThreadCtrlCommunicate()
116 } else if (uv_thread_self() == hSession->hWorkChildThread) { in ThreadCtrlCommunicate()
117 fd = hSession->ctrlFd[STREAM_WORK]; in ThreadCtrlCommunicate()
Dtcp.cpp72 HSession hSession = (HSession)tcp->data; in ReadStream() local
73 HdcTCPBase *thisClass = (HdcTCPBase *)hSession->classModule; in ReadStream()
89 if (hSessionBase->FetchIOBuf(hSession, hSession->ioBuf, nread) < 0) { in ReadStream()
98 hSessionBase->FreeSession(hSession->sessionId); in ReadStream()
Ddebug.cpp81 void DetermineThread(HSession hSession) in DetermineThread() argument
83 if (uv_thread_self() == hSession->hWorkThread) { in DetermineThread()
85 } else if (uv_thread_self() == hSession->hWorkChildThread) { in DetermineThread()
Duart.h164 bool ReadyForWorkThread(HSession hSession);
165 int SendUARTData(HSession hSession, uint8_t *data, const size_t length);
168 virtual void StopSession(HSession hSession);
181 virtual bool SendUARTRaw(HSession hSession, uint8_t *data, const size_t length);
195 virtual bool UartSendToHdcStream(HSession hSession, uint8_t *data, size_t size);
207 virtual size_t PackageProcess(vector<uint8_t> &data, HSession hSession = nullptr);
208 virtual RetErrCode DispatchToWorkThread(HSession hSession, uint8_t *readBuf, int readBytes);
Ddebug.h23 void DetermineThread(HSession hSession);
/developtools/hdc/src/host/
Dhost_tcp.cpp98 HSession hSession = (HSession)connection->data; in Connect() local
100 HdcSessionBase *ptrConnect = (HdcSessionBase *)hSession->classInstance; in Connect()
105 if ((hSession->fdChildWorkTCP = Base::DuplicateUvSocket(&hSession->hWorkTCP)) < 0) { in Connect()
108 uv_read_stop((uv_stream_t *)&hSession->hWorkTCP); in Connect()
109 Base::SetTcpOptions((uv_tcp_t *)&hSession->hWorkTCP); in Connect()
111 …WorkThread(&ptrConnect->loopMain, ptrConnect->SessionWorkThread, Base::FinishWorkThread, hSession); in Connect()
113 while (hSession->childLoop.active_handles == 0) { in Connect()
116 Base::SendToPollFd(hSession->ctrlFd[STREAM_MAIN], ctrl.data(), ctrl.size()); in Connect()
120 ptrConnect->FreeSession(hSession->sessionId); in Connect()
132 HSession hSession = ptrConnect->MallocSession(true, CONN_TCP, this); in ConnectDaemon() local
[all …]
Dhost_uart.cpp44 bool HdcHostUART::NeedStop(const HSession hSession) in NeedStop() argument
46 return (!uartOpened or (hSession->isDead and hSession->ref == 0)); in NeedStop()
75 void HdcHostUART::UartReadThread(HSession hSession) in UartReadThread() argument
77 HUART hUART = hSession->hUART; in UartReadThread()
83 if (NeedStop(hSession)) { in UartReadThread()
90 OnTransferError(hSession); in UartReadThread()
108 expectedSize = PackageProcess(dataReadBuf, hSession); in UartReadThread()
412 void HdcHostUART::UpdateUARTDaemonInfo(const std::string &connectKey, HSession hSession, in EnumSerialPort() argument
421 diNew.hSession = hSession; in EnumSerialPort()
424 hSession == nullptr ? "<null>" : hSession->ToDebugString().c_str(), connStatus); in EnumSerialPort()
[all …]
Dserver.cpp396 void HdcServer::NotifyInstanceSessionFree(HSession hSession, bool freeOrClear) in NotifyInstanceSessionFree() argument
399 AdminDaemonMap(OP_QUERY, hSession->connectKey, hdiOld); in NotifyInstanceSessionFree()
408 AdminDaemonMap(OP_UPDATE, hSession->connectKey, hdiNew); in NotifyInstanceSessionFree()
409 CleanForwardMap(hSession->sessionId); in NotifyInstanceSessionFree()
427 bool HdcServer::HandServerAuth(HSession hSession, SessionHandShake &handshake) in HandServerAuth() argument
435 …bool retChildForToken = HdcAuth::KeylistIncrement(hSession->listKey, hSession->authKeyIndex, &ptr); in HandServerAuth()
440 ret = HandServerAuth(hSession, handshake); in HandServerAuth()
452 Send(hSession->sessionId, 0, CMD_KERNEL_HANDSHAKE, in HandServerAuth()
467 Send(hSession->sessionId, 0, CMD_KERNEL_HANDSHAKE, in HandServerAuth()
478 bool HdcServer::ServerSessionHandshake(HSession hSession, uint8_t *payload, int payloadSize) in ServerSessionHandshake() argument
[all …]
Dhost_usb.cpp160 HSession hSession = hdcServer->MallocSession(true, CONN_USB, this); in DetectMyNeed() local
161 hSession->connectKey = hUSB->serialNumber; in DetectMyNeed()
169 waitTimeDoCmd->data = hSession; in DetectMyNeed()
176 void HdcHostUSB::KickoutZombie(HSession hSession) in KickoutZombie() argument
178 HdcServer *ptrConnect = (HdcServer *)hSession->classInstance; in KickoutZombie()
179 HUSB hUSB = hSession->hUSB; in KickoutZombie()
181 … WRITE_LOG(LOG_WARN, "KickoutZombie devHandle:%p isDead:%d", hUSB->devHandle, hSession->isDead); in KickoutZombie()
188 ptrConnect->FreeSession(hSession->sessionId); in KickoutZombie()
316 void HdcHostUSB::UpdateUSBDaemonInfo(HUSB hUSB, HSession hSession, uint8_t connStatus) in UpdateUSBDaemonInfo() argument
324 di.hSession = hSession; in UpdateUSBDaemonInfo()
[all …]
Dhost_usb.h26 int SendUSBRaw(HSession hSession, uint8_t *data, const int length) override;
27 HSession ConnectDetectDaemon(const HSession hSession, const HDaemonInfo pdi);
41 static void KickoutZombie(HSession hSession);
50 bool ReadyForWorkThread(HSession hSession) override;
54 void UpdateUSBDaemonInfo(HUSB hUSB, HSession hSession, uint8_t connStatus);
55 void BeginUsbRead(HSession hSession);
57 void CancelUsbIo(HSession hSession) override;
59 int SubmitUsbBio(HSession hSession, bool sendOrRecv, uint8_t *buf, int bufSize);
Dserver.h24 …bool FetchCommand(HSession hSession, const uint32_t channelId, const uint16_t command, uint8_t *pa…
31 void AttachChannel(HSession hSession, const uint32_t channelId) override;
32 void DeatchChannel(HSession hSession, const uint32_t channelId) override;
36 void NotifyInstanceSessionFree(HSession hSession, bool freeOrClear) override;
41 void CreatConnectUart(HSession hSession);
54 …bool RedirectToTask(HTaskInfo hTaskInfo, HSession hSession, const uint32_t channelId, const uint16…
58 bool HandServerAuth(HSession hSession, SessionHandShake &handshake);
60 bool ServerSessionHandshake(HSession hSession, uint8_t *payload, int payloadSize);
Dhost_uart.h39 HSession ConnectDaemonByUart(const HSession hSession,
44 void StopSession(HSession hSession) override;
62 virtual bool StartUartReadThread(HSession hSession);
64 size_t SendUARTDev(HSession hSession, uint8_t *data, const size_t length);
77 void KickoutZombie(HSession hSession);
78 …virtual void UpdateUARTDaemonInfo(const std::string &connectKey, HSession hSession, ConnStatus con…
89 virtual void SendUartSoftReset(HSession hSession, uint32_t sessionId) override;
93 virtual bool NeedStop(const HSession hSession);
94 virtual void UartReadThread(HSession hSession);
Dserver_for_client.cpp211 if (!hdi->hSession) { in SendToDaemon()
214 …if (ptrServer->Send(hdi->hSession->sessionId, hChannel->channelId, commandFlag, bufPtr, bufSize) <… in SendToDaemon()
342 (reinterpret_cast<HdcServer *>(ptrServer))->FreeSession(hdiOld->hSession->sessionId); in CommandRemoveSession()
354 HSession hSession = ptrServer->AdminSession(OP_QUERY, hfi->sessionId, nullptr); in CommandRemoveForward() local
355 if (!hSession) { in CommandRemoveForward()
359 ptrServer->ClearOwnTasks(hSession, hfi->channelId); in CommandRemoveForward()
569 HSession hSession = FindAliveSession(hChannel->targetSessionId); in TaskCommand() local
570 if (!hSession) { in TaskCommand()
582 ptrServer->DispatchTaskData(hSession, hChannel->channelId, formatCommand->cmdFlag, in TaskCommand()
684 HSession hSession = nullptr; in FindAliveSessionFromDaemonMap() local
[all …]
/developtools/hdc/src/daemon/
Ddaemon.cpp146 bool HdcDaemon::RedirectToTask(HTaskInfo hTaskInfo, HSession hSession, const uint32_t channelId, in RedirectToTask() argument
201 bool HdcDaemon::HandDaemonAuth(HSession hSession, const uint32_t channelId, SessionHandShake &hands… in HandDaemonAuth() argument
206 hSession->tokenRSA = Base::GetRandomString(SHA_DIGEST_LENGTH); in HandDaemonAuth()
208 handshake.buf = hSession->tokenRSA; in HandDaemonAuth()
210 Send(hSession->sessionId, channelId, CMD_KERNEL_HANDSHAKE, in HandDaemonAuth()
224 …if (!HdcAuth::AuthVerify(reinterpret_cast<uint8_t *>(const_cast<char *>(hSession->tokenRSA.c_str()… in HandDaemonAuth()
228 handshake.buf = hSession->tokenRSA; in HandDaemonAuth()
230 Send(hSession->sessionId, channelId, CMD_KERNEL_HANDSHAKE, in HandDaemonAuth()
248 bool HdcDaemon::DaemonSessionHandshake(HSession hSession, const uint32_t channelId, uint8_t *payloa… in DaemonSessionHandshake() argument
257 WRITE_LOG(LOG_DEBUG, "session %s try to handshake", hSession->ToDebugString().c_str()); in DaemonSessionHandshake()
[all …]
Ddaemon_uart.cpp167 HSession hSession = daemon.AdminSession(OP_QUERY, sessionId, nullptr); in ResetOldSession() local
168 if (hSession == nullptr) { in ResetOldSession()
171 if (hSession->hUART != nullptr) { in ResetOldSession()
172 hSession->hUART->resetIO = true; in ResetOldSession()
176 OnTransferError(hSession); in ResetOldSession()
181 HSession hSession = daemon.AdminSession(OP_QUERY, sessionId, nullptr); in GetSession() local
182 if (hSession == nullptr and create) { in GetSession()
183 hSession = PrepareNewSession(sessionId); in GetSession()
185 return hSession; in GetSession()
206 HSession hSession = daemon.MallocSession(false, CONN_SERIAL, this, sessionId); in PrepareNewSession() local
[all …]
Ddaemon_tcp.cpp78 HSession hSession = ptrConnect->MallocSession(false, CONN_TCP, thisClass); in AcceptClient() local
79 if (!hSession) { in AcceptClient()
82 if (uv_accept(server, (uv_stream_t *)&hSession->hWorkTCP) < 0) { in AcceptClient()
85 if ((hSession->fdChildWorkTCP = Base::DuplicateUvSocket(&hSession->hWorkTCP)) < 0) { in AcceptClient()
88 Base::TryCloseHandle((uv_handle_t *)&hSession->hWorkTCP); in AcceptClient()
89 Base::StartWorkThread(ptrLoop, ptrConnect->SessionWorkThread, Base::FinishWorkThread, hSession); in AcceptClient()
91 while (hSession->childLoop.active_handles == 0) { in AcceptClient()
94 Base::SendToPollFd(hSession->ctrlFd[STREAM_MAIN], ctrl.data(), ctrl.size()); in AcceptClient()
97 ptrConnect->FreeSession(hSession->sessionId); in AcceptClient()
Ddaemon.h33 …bool FetchCommand(HSession hSession, const uint32_t channelId, const uint16_t command, uint8_t *pa…
46 …bool RedirectToTask(HTaskInfo hTaskInfo, HSession hSession, const uint32_t channelId, const uint16…
51 bool HandDaemonAuth(HSession hSession, const uint32_t channelId, SessionHandShake &handshake);
53 …bool DaemonSessionHandshake(HSession hSession, const uint32_t channelId, uint8_t *payload, int pay…
59 void NotifyInstanceSessionFree(HSession hSession, bool freeOrClear) override;
Ddaemon_usb.h26 int SendUSBRaw(HSession hSession, uint8_t *data, const int length) override;
28 void OnSessionFreeFinally(const HSession hSession);
48 bool ReadyForWorkThread(HSession hSession) override;
52 int SendUSBIOSync(HSession hSession, HUSB hMainUSB, const uint8_t *data, const int length);
Ddaemon_usb.cpp220 HSession hSession = daemon->AdminSession(OP_QUERY, sessionId, nullptr); in ResetOldSession() local
221 if (hSession == nullptr) { in ResetOldSession()
252 bool HdcDaemonUSB::ReadyForWorkThread(HSession hSession) in ReadyForWorkThread() argument
254 HdcUSBBase::ReadyForWorkThread(hSession); in ReadyForWorkThread()
290 int HdcDaemonUSB::SendUSBIOSync(HSession hSession, HUSB hMainUSB, const uint8_t *data, const int le… in SendUSBIOSync() argument
297 while (modRunning && isAlive && !hSession->isDead) { in SendUSBIOSync()
320 length, offset, modRunning, isAlive, hSession->isDead); in SendUSBIOSync()
325 int HdcDaemonUSB::SendUSBRaw(HSession hSession, uint8_t *data, const int length) in SendUSBRaw() argument
328 HdcDaemon *daemon = (HdcDaemon *)hSession->classInstance; in SendUSBRaw()
330 ++hSession->ref; in SendUSBRaw()
[all …]
/developtools/hdc/test/unittest/common/
Dhost_uart_test.cpp89 MOCK_METHOD2(PackageProcess, size_t(vector<uint8_t> &, HSession hSession));
376 [&](const std::string &connectKey, HSession hSession, ConnStatus connStatus) { in __anon41276a340702() argument
377 mockHostUART.HdcHostUART::UpdateUARTDaemonInfo(connectKey, hSession, connStatus); in __anon41276a340702()
412 EXPECT_CALL(mockHostUART, StartUartReadThread).WillOnce(Invoke([&](HSession hSession) { in __anon41276a340802() argument
413 return mockHostUART.HdcHostUART::StartUartReadThread(hSession); in __anon41276a340802()
567 EXPECT_CALL(mockHostUART, NeedStop).WillRepeatedly([&](const HSession hSession) { in __anon41276a340b02() argument
568 return mockHostUART.HdcHostUART::NeedStop(hSession); in __anon41276a340b02()
648 EXPECT_CALL(mockHostUART, UartReadThread).WillRepeatedly(Invoke([&](HSession hSession) { in __anon41276a340e02() argument
649 return mockHostUART.HdcHostUART::UartReadThread(hSession); in __anon41276a340e02()

12