int AbstractSshChannel::handleChannelOrExtendedChannelData(const QByteArray &data) { checkChannelActive(); const int bytesToDeliver = qMin<quint32>(data.size(), maxDataSize()); if (bytesToDeliver != data.size()) qWarning("Misbehaving server does not respect local window, clipping."); m_localWindowSize -= bytesToDeliver; if (m_localWindowSize < maxPacketSize()) { m_localWindowSize += maxPacketSize(); m_sendFacility.sendWindowAdjustPacket(m_remoteChannel, maxPacketSize()); } return bytesToDeliver; }
void SshForwardedTcpIpTunnelPrivate::handleOpenSuccessInternal() { QSSH_ASSERT_AND_RETURN(channelState() == AbstractSshChannel::SessionEstablished); try { m_sendFacility.sendChannelOpenConfirmationPacket(remoteChannel(), localChannelId(), initialWindowSize(), maxPacketSize()); } catch (const std::exception &e) { // Won't happen, but let's play it safe. qCWarning(sshLog, "Botan error: %s", e.what()); closeChannel(); } }
void AbstractSshChannel::requestSessionStart() { // Note: We are just being paranoid here about the Botan exceptions, // which are extremely unlikely to happen, because if there was a problem // with our cryptography stuff, it would have hit us before, on // establishing the connection. try { m_sendFacility.sendSessionPacket(m_localChannel, initialWindowSize(), maxPacketSize()); setChannelState(SessionRequested); m_timeoutTimer.start(ReplyTimeout); } catch (const Botan::Exception &e) { qDebug("Botan error: %s", e.what()); closeChannel(); } }
quint32 AbstractSshChannel::initialWindowSize() { return maxPacketSize(); }
quint32 AbstractSshChannel::maxDataSize() const { return qMin(m_localWindowSize, maxPacketSize()); }
void CUT_PBASE_T_USBDI_0480::DeviceInsertedL(TUint aDeviceHandle) { OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_ENTRY, this ); Cancel(); TInt err(KErrNone); // Validate that device is as expected CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle); if(testDevice.SerialNumber().Compare(TestCaseId()) != 0) { // Incorrect device for this test case OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)", KErrNotFound,testDevice.SerialNumber(),TestCaseId()); // Start the connection timeout again TimeoutIn(30); OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_EXIT, this ); return; } TUint32 token0,token1; err = testDevice.Device().GetTokenForInterface(0,token0); if(err != KErrNone) { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_DUP01, "<Error %d> Token for interface 0 could not be retrieved",err); return TestFailed(err); } err = iUsbInterface0.Open(token0); // Default interface setting 0 if(err != KErrNone) { OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_DUP02, "<Error %d> Unable to open interface 0 using token %d",err,token0); return TestFailed(err); } err = testDevice.Device().GetTokenForInterface(1,token1); if(err != KErrNone) { TBuf<64> msg; msg.Format(_L("<Error %d> Token for interface 1 could not be retrieved"),err); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_DUP03, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); iControlEp0->SendRequest(request,this); OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_EXIT_DUP01, this ); return; } err = iUsbInterface1.Open(token1); if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Unable to open interface 1 using token %d"),err,token1); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_DUP04, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); iControlEp0->SendRequest(request,this); OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_EXIT_DUP02, this ); return; } // Get the endpoint descriptor TUsbEndpointDescriptor endpointDescriptor; err = iUsbInterface1.GetEndpointDescriptor(0,1,endpointDescriptor); if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Descriptor for endpoint 0 cannot be obtained"),err); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_DUP05, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); iControlEp0->SendRequest(request,this); OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_EXIT_DUP03, this ); return; } TUint16 maxPacketSize(endpointDescriptor.MaxPacketSize()); OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_DUP06, "Maximum packet size for endpoint 1 on interface 1 setting 0 is: %d",maxPacketSize); // Perform a device directed control transfer User::After(1000000); iCaseStep = EEmptyDeviceXfer; TEmptyDeviceRequest request; iControlEp0->SendRequest(request,this); OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_DEVICEINSERTEDL_EXIT_DUP04, this ); }