Ejemplo n.º 1
0
// -----------------------------------------------------------------------------
// TMSCallServer::StartThreadL
//
// -----------------------------------------------------------------------------
//
void TMSCallServer::StartThreadL(TMSCallServerStartParam& aStart)
    {
    TRACE_PRN_FN_ENT;

    CActiveScheduler* sched = new (ELeave) CActiveScheduler;
    CleanupStack::PushL(sched);

    CActiveScheduler::Install(sched);
    TMSCallServer* server = TMSCallServer::NewL(aStart.iTMSServer);
    CleanupStack::PushL(server);

    //Rename tmscall server name
    RThread tmscallServerThread;
    TThreadId threadId;
    TName name;
    name.Append(KTMSCallServerName);
    threadId = tmscallServerThread.Id();
    name.AppendNum(threadId.Id(), EHex);
    //We are ignoring the error code returned from User::RenameThread
    //as it is not important here, may be for profiling
    User::RenameThread(name);

    aStart.iTMSCallServerHandle = server->Server();
    // Sync with the client and enter the active scheduler
    RThread::Rendezvous(KErrNone);
    sched->Start();

    CleanupStack::PopAndDestroy(server); // server
    CleanupStack::PopAndDestroy(sched); // sched

    TRACE_PRN_FN_EXT;
    }
Ejemplo n.º 2
0
/**
Wait for message completion by the helper process

@param  aProcessLog if ETrue, log messages from the helper process will be logged by TEF
@return             error code, result of the message processing.
*/
TInt CSyncMessageSender::WaitForMsgComplete(TBool aProcessLog/*=ETrue*/)
{
    if( !aProcessLog )
    {   //-- don't need to process messages from the helper process
        User::WaitForRequest(iMsgRqStat);
        return iMsgRqStat.Int();
    }

    //-- wait for message completion processing logs from the helper process
    TName logBuf;

    for(;;)
    {
        iLogMsgQueue.NotifyDataAvailable(iLogRqStat);
        User::WaitForRequest(iMsgRqStat, iLogRqStat);

        if(iLogRqStat.Int() == KRequestPending)
        {   //-- iMsgRqStat has been completed, the pessage has been processed
            //-- cancel waiting for the log messages.
            iLogMsgQueue.CancelDataAvailable();
            User::WaitForRequest(iLogRqStat);
            break;
        }
        else
        {   //-- log message has been posted to the queue, pull all log messages up and process them
            TIPLogMsg   logMsg;
            TInt        nRes;

            for(;;)
            {
                nRes = iLogMsgQueue.Receive(logMsg);
                if(nRes != KErrNone)
                    break;

                if(ipLogger)
                {   //-- logger is available, log the message.
                    logBuf.Copy(_L("\t~helper: "));
                    logBuf.Append(logMsg.iLogMsg);
                    ipLogger->Write(logBuf);
                }
            }//for(;;)
        }
    }//for(;;)


    return iMsgRqStat.Int();
}
void CMMFAudioPolicyServer::StartThreadL(TServerStart& aStart)
{
    CActiveScheduler* sched = new(ELeave) CActiveScheduler;
    CleanupStack::PushL(sched);

    CActiveScheduler::Install(sched);
    //Rename Audio Policy server name
    RThread audioPolicyThread;
    TName name;
    name.Append(KMMFAudioPolicyServerName);
    //We are ignoring the error code returned from User::RenameThread
    //as it is not important here, may be for profiling
    User::RenameThread(name);
    CMMFAudioPolicyServer* server = CMMFAudioPolicyServer::NewL();
    CleanupStack::PushL(server);

    aStart.iPolicyServerHandle = server->Server();
    // Sync with the client and enter the active scheduler
    RThread::Rendezvous(KErrNone);
    sched->Start();

    CleanupStack::PopAndDestroy(2, sched); // sched, server
}
Ejemplo n.º 4
0
static QList<QNetworkInterfacePrivate *> interfaceListing()
{
    TInt err(KErrNone);
    QList<QNetworkInterfacePrivate *> interfaces;
    QList<QHostAddress> addressesWithEstimatedNetmasks;

    // Open dummy socket for interface queries
    RSocket socket;
    err = socket.Open(qt_symbianGetSocketServer(), _L("udp"));
    if (err) {
        return interfaces;
    }

    // Ask socket to start enumerating interfaces
    err =  socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
    if (err) {
        socket.Close();
        return interfaces;
    }

    int ifindex = 0;
    TPckgBuf<TSoInetInterfaceInfo> infoPckg;
    TSoInetInterfaceInfo &info = infoPckg();
    while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone) {
        if (info.iName != KNullDesC) {
            TName address;
            QNetworkAddressEntry entry;
            QNetworkInterfacePrivate *iface = 0;

            iface = new QNetworkInterfacePrivate;
            iface->index = ifindex++;
            interfaces << iface;
            iface->name = qt_TDesC2QString(info.iName);
            iface->flags = convertFlags(info);

            if (/*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec) {
                for (TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++) {
                    address.AppendNumFixedWidth(info.iHwAddr[i], EHex, 2);
                    if ((i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen())
                        address.Append(_L(":"));
                }
                address.UpperCase();
                iface->hardwareAddress = qt_TDesC2QString(address);
            }

            // Get the address of the interface
            entry.setIp(qt_QHostAddressFromTInetAddr(info.iAddress));

#if defined(QNETWORKINTERFACE_DEBUG)
            qDebug() << "address is" << info.iAddress.Family() << entry.ip();
            qDebug() << "netmask is" << info.iNetMask.Family() << qt_QHostAddressFromTInetAddr( info.iNetMask );
#endif

            // Get the interface netmask
            if (info.iNetMask.IsUnspecified()) {
                // For some reason netmask is always 0.0.0.0 for IPv4 interfaces
                // and loopback interfaces (which we statically know)
                if (info.iAddress.IsV4Mapped()) {
                    if (info.iFeatures & KIfIsLoopback) {
                        entry.setPrefixLength(32);
                    } else {
                        // Workaround: Let Symbian determine netmask based on IP address class (IPv4 only API)
                        TInetAddr netmask;
                        netmask.NetMask(info.iAddress);
                        entry.setNetmask(QHostAddress(netmask.Address())); //binary convert v4 address
                        addressesWithEstimatedNetmasks << entry.ip();
#if defined(QNETWORKINTERFACE_DEBUG)
                        qDebug() << "address class determined netmask" << entry.netmask();
#endif
                    }
                } else {
                    // For IPv6 interfaces
                    if (info.iFeatures & KIfIsLoopback) {
                        entry.setPrefixLength(128);
                    } else if (info.iNetMask.IsUnspecified()) {
                        //Don't see this error for IPv6, but try to handle it if it happens
                        entry.setPrefixLength(64); //most common
#if defined(QNETWORKINTERFACE_DEBUG)
                        qDebug() << "total guess netmask" << entry.netmask();
#endif
                        addressesWithEstimatedNetmasks << entry.ip();
                    }
                }
            } else {
                //Expected code path for IPv6 non loopback interfaces (IPv4 could come here if symbian is fixed)
                entry.setNetmask(qt_QHostAddressFromTInetAddr(info.iNetMask));
#if defined(QNETWORKINTERFACE_DEBUG)
                qDebug() << "reported netmask" << entry.netmask();
#endif
            }

            // broadcast address is determined from the netmask in postProcess()

            // Add new entry to interface address entries
            iface->addressEntries << entry;

#if defined(QNETWORKINTERFACE_DEBUG)
            qDebug("\n       Found network interface %s, interface flags:\n\
                IsUp = %d, IsRunning = %d, CanBroadcast = %d,\n\
                IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\
                ip = %s, netmask = %s, broadcast = %s,\n\
                hwaddress = %s",
                   iface->name.toLatin1().constData(),
                   iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast,
                   iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast,
                   entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(),
                   iface->hardwareAddress.toLatin1().constData());
#endif
        }
    }
Ejemplo n.º 5
0
TVerdict CTestStepLLMNR_Init::doTestStepL()
    {
    
    TInt        cntNode, nRes;
    TName       tmpBuf;
    TName       tmpBuf1;
    
    SetTestStepResult(EPass);
    
    TESTL(GetIntFromConfig(KNodesSection, _L("StartUpDelay"), nRes) && nRes > 0);
    const TInt startUpDelay = nRes*KOneSecond;  
    
    INFO_PRINTF1(KNewLine);
    INFO_PRINTF1(_L("Initializing LLMNR test engine..."));
    
    //-- wait some time for settling name conflict resolution within LLMNR mechanism 
    User::After(ipTestServer->RandomizeNum(startUpDelay, startUpDelay));
    
    RIPAddrArray&   localAddrs  = ipTestServer->iLocalAddrs;
    TNetworkInfo&   networkInfo = ipTestServer->iNetworkInfo;
    
    //-- reset network information and local IP addresses table
    networkInfo.Reset();
    localAddrs.Reset();
    
    //--------------------------------------------
    
    //-- load network configuration from ini file
    LoadNetworkConfigFromIniL(networkInfo);
    
    //-- start up network layer and LLMNR engine
    TESTL(StartUpLLMNR());
    
    //-- wait some time for settling name conflict resolution within LLMNR mechanism
    User::After(ipTestServer->RandomizeNum(startUpDelay));
    
    //-- list available network interfaces and their IP addresses
    ListInterfacesL();
    
    //-- try to resolve every host name and obtain its IP address
    ProbeNodes(networkInfo);
    
    //-----------------------------------------------------------
    
    //-- print out alive hosts names, IP addresses, etc and check the number of hosts
    INFO_PRINTF1(_L("--- available hosts list:\n"));
    
    
    TInt foreignNodeCnt = 0; //-- number of foreign hosts (IP addresses that not ours)
    TInt localNodeCnt = 0;   //-- number of local IP addresses
    
    for(cntNode=0; cntNode < networkInfo.NodesCount(); ++cntNode)
        {
        TNodeInfo& currNode = networkInfo[cntNode]; //-- current node info
        
        if(currNode.iAlive)
            {
            
            //-- print host name and its IP address
            tmpBuf.Copy(currNode.iHostName);
            tmpBuf.Append(_L(" "));
            
            currNode.iAddr.Output(tmpBuf1);
            tmpBuf.Append(tmpBuf1);
            
            //-- search IP address in the array of local host addresses.
            //-- if found, mark the appropriate hostInfo element as having local address.
            currNode.iLocal = (ipTestServer->iLocalAddrs.Find(currNode.iAddr, TIdentityRelation<TInetAddr>(IPAddrIsEqual)) != KErrNotFound);
            
            if(currNode.iLocal)
                {   
                tmpBuf.Append(_L(" [local address]"));
                localNodeCnt++;
                }
            
            if(currNode.iIpUnique)
                tmpBuf.Append(_L(" [U]"));
            
            if(! currNode.iLocal && currNode.iIpUnique)
                foreignNodeCnt++;
            
            INFO_PRINTF1(tmpBuf);
            }
        }
    
    INFO_PRINTF1(KNewLine);
    
    //-- check the number of nodes with local IP addresses to ensure that test config are correct
    if(localNodeCnt <1) 
        {
        INFO_PRINTF1(_L("??? Error! No nodes found with local IP. Check the test configuration.\n"));
        SetTestStepResult(EInconclusive);
        return TestStepResult();
        }
    
    //-- we need at least 1 other external host
    if(foreignNodeCnt < 1)
        {
        INFO_PRINTF1(_L("Error! For successfull testing you should have at least 1 external hosts available!\n"));
        SetTestStepResult(EInconclusive);
        return TestStepResult();
        }
    
    //-- check if all IP adresses are link-local
    INFO_PRINTF1(_L("check all hosts' IP adresses to be link-local"));
    for(cntNode=0; cntNode< networkInfo.NodesCount(); ++cntNode)
        {
        TNodeInfo& currNode = networkInfo[cntNode]; //-- current node info
        
        if(currNode.iAlive)
            if(! currNode.iAddr.IsLinkLocal())
                {
                tmpBuf.Copy(_L("host "));
                tmpBuf.Append(currNode.iHostName);
                tmpBuf.Append(_L(" "));
                currNode.iAddr.Output(tmpBuf1);
                tmpBuf.Append(tmpBuf1);
                tmpBuf.Copy(_L(" IP address isn't link local! "));
                
                INFO_PRINTF1(tmpBuf);
                SetTestStepResult(EInconclusive);
                return TestStepResult();
                }
        }
    
    //-----------------------------------------------------------
    //-- LLMNR has been initialized and information about network collected
    networkInfo.SetInitialized(ETrue); 
    
    SetTestStepResult(EPass);
    return TestStepResult();
}
Ejemplo n.º 6
0
/**
*   List existing network interfaces, IP addresses bound to them 
*   and fill up array of IP addresses for all interfaces.
*/
void CTestStepLLMNR_Init::ListInterfacesL()
    {
    
    RSocket socket;
    TInt    nRes;
    TInt    exceed;
    TInt    idx;
    TName   tmpBuf;
    TName   tmpBuf1;
    
    nRes = socket.Open(ipTestServer->iSocketServer, KAfInet, KSockStream, KProtocolInetTcp);
    TESTL(nRes == KErrNone);
    
    TUint   bufsize = 2048;
    
    HBufC8 *buffer =NULL;
    buffer = GetBuffer(buffer, bufsize);
    TESTL(buffer != NULL);
    
    TPtr8 bufdes = buffer->Des();
    
    //-- reset array of local addresses
    ipTestServer->iLocalAddrs.Reset();
    
    //-- list all available network interfaces
    INFO_PRINTF1(KNewLine);
    INFO_PRINTF1(_L("--- available network interfaces:"));
    
    do
        {//-- get list of network interfaces
        // if exceed>0, all interface could not fit into the buffer.
        // In that case allocate a bigger buffer and retry.
        // There should be no reason for this while loop to take more than 2 rounds.
        bufdes.Set(buffer->Des());
        exceed = socket.GetOpt(KSoInetInterfaceInfo, KSolInetIfQuery, bufdes);
        if(exceed > 0)
            {
            bufsize += exceed * sizeof(TInetInterfaceInfo);
            buffer = GetBuffer(buffer, bufsize);
            TESTL(buffer != NULL);
            }
        } while (exceed > 0);
        
        if (exceed < 0)
            {
            INFO_PRINTF1(_L("socket.GetOpt() error!"));
            TESTL(EFalse);
            }
        
        TOverlayArray<TInetInterfaceInfo> infoIface(bufdes);
        
        for(idx=0; idx < infoIface.Length(); ++idx)
            {
            TInetInterfaceInfo& iface = infoIface[idx];
            
            tmpBuf.Format(_L("index:%d, name: "),iface.iIndex);
            tmpBuf.Append(iface.iName );
            tmpBuf.AppendFormat(_L(" state:%d"), iface.iState);
            INFO_PRINTF1(tmpBuf);
            }
        
        //-- list all IP addresses, bound to the interfaces
        //-- and append this address to the array of host-local addresses
        INFO_PRINTF1(KNewLine);
        INFO_PRINTF1(_L("--- IP addresses bound to the interfaces:"));
        
        do
            {
            // if exceed>0, all interface could not fit into the buffer.
            // In that case allocate a bigger buffer and retry.
            // There should be no reason for this while loop to take more than 2 rounds.
	        bufdes.Set(buffer->Des());
            exceed = socket.GetOpt(KSoInetAddressInfo, KSolInetIfQuery, bufdes);
            if(exceed > 0)
                {
                bufsize += exceed * sizeof(TInetAddressInfo);
                buffer = GetBuffer(buffer, bufsize);
                }
            } while (exceed > 0);
            
            if (exceed < 0)
                {
                INFO_PRINTF1(_L("socket.GetOpt() error!"));
                TESTL(EFalse);
                }
            
            
            //-- print out IP addresses
            TOverlayArray<TInetAddressInfo> infoAddr(bufdes);
            TInetAddr inetAddr;
            
            for(idx=0; idx < infoAddr.Length(); ++idx)
                {
                TInetAddressInfo& addr = infoAddr[idx];
                
                tmpBuf.Format(_L("iface index: %d, scopeID: %d, state: %d, IP addr: "), addr.iInterface, addr.iScopeId, addr.iState);
                inetAddr.SetAddress(addr.iAddress);
                inetAddr.Output(tmpBuf1);
                tmpBuf.Append(tmpBuf1);
                INFO_PRINTF1(tmpBuf);
                
                //-- if obtained IP address is valid and not loopback, add it to the array.
                if(inetAddr.IsLoopback() || inetAddr.IsUnspecified())
                    {}
                else
                    ipTestServer->iLocalAddrs.Append(inetAddr);
                
                }
            
            
            delete buffer;
            socket.Close();
            
            INFO_PRINTF1(KNewLine);
}
Ejemplo n.º 7
0
/**
*   Tries to resolve each host name from the table loaded from ini file.
*   @param aNetworkInfo ref. to the TNetworkInfo structure, which will be populated
*/
void CTestStepLLMNR_Init::ProbeNodes(TNetworkInfo&  aNetworkInfo)
    {
    TName       tmpBuf;
    TInt        nRes;
    TNameEntry  nameEntry;
    
    //-- start name resolution for every entry in HostInfo
    GetIntFromConfig(KNodesSection, _L("ScanMaxDelay"), nRes);
    const TInt scanMaxDelay = nRes*KOneSecond;
    
    for(;;)
        {
        TInt cntFinishedHosts = 0;
        
        for(TInt cntNode=0; cntNode< aNetworkInfo.NodesCount(); ++cntNode)
            {
            
            TNodeInfo& currNode = aNetworkInfo[cntNode]; //-- current node info
            
            if( ! currNode.iAlive && currNode.iCntTrials >0) 
                {//-- the host is worth asking its IP address
                
                //-- a small random delay between sending queries
                User::After(ipTestServer->RandomizeNum(scanMaxDelay));
                
                INFO_PRINTF1(KNewLine);
                tmpBuf.Copy(_L("- Probing host: "));
                tmpBuf.Append(currNode.iHostName);
                INFO_PRINTF1(tmpBuf);
                
                nRes = ipTestServer->iHostResolver.GetByName(currNode.iHostName, nameEntry);
                
                if(nRes == KErrNone)
                    {//-- current host name has been resolver successfully, mark it alive and store its IP address
                    
                    //-- check if the obtained IP address is unique in TNetworkInfo
                    currNode.iIpUnique = (aNetworkInfo.FindIP(nameEntry().iAddr) < 0);
                    
                    currNode.iAddr = nameEntry().iAddr;   
                    currNode.iAlive = ETrue;
                    
                    currNode.iAddr.Output(nameEntry().iName);
                    tmpBuf.Copy(_L("name resolved: "));
                    tmpBuf.Append(nameEntry().iName);
                    INFO_PRINTF1(tmpBuf);
                    }
                else 
                    {//-- no response    
                    currNode.iCntTrials --; //-- decrease trials counter for this hostname
                    INFO_PRINTF2(_L("name resolution error: %d"), nRes);
                    }
                }
            else
                cntFinishedHosts++;
            
            }
        
        //-- check, whether we need to continue nodes scanning
        //-- if either host is alive or has trials counted down to 0, exit
        if(cntFinishedHosts == aNetworkInfo.NodesCount())
            break;
        } //for(;;)
    
    INFO_PRINTF1(KNewLine);
    
    }
Ejemplo n.º 8
0
void CAppStarter::StartL()
	{
	TFileName newname = iExeFileName;

	TThreadId threadId = 0;

	switch(iAppType)
		{
		case EApplicationType:
			{
			TApaAppInfo info;
			if(iSession.GetAppInfo(info,TUid::Uid(iAppUid)) != KErrNone)
				{
				After(KRetryWait);
				return;
				}
			
			if(iViewless)
				{
				TRAPD(err, TryStartViewlessAppL(info, threadId));
				if (err != KErrNone)
					{
					After(KRetryWait);
					return; //ignore error
					}
				}
			else if (info.iUid!=KNullUid)
				{
				if(iSession.StartDocument(newname, TUid::Uid(iAppUid), threadId) != KErrNone)
					{
					After(KRetryWait);
					return;
					}
				}
			else
				{
				iState = EAppFailed;
				Next();
				}
			}
			break;
		case EExecutableType:
			{
			newname.Append(KExtension);
			if(iSession.StartDocument(newname, TUid::Uid(0), threadId) != KErrNone)
				{
				After(KRetryWait);
				return;
				}
			}
			break;
		case ECmdLnArgExecutableType:
			{
			ASSERT( !iMonitoring); // Not imlpemented yet
#if defined(__WINS__) || defined(__WINSCW__)
			TName libName = iDllFileName;
			libName.Append(KExtension);
			RLibrary lib;
			TInt error = lib.Load(libName);
			if (error!=KErrNone)
				{
				After(KRetryWait);
				return;
				}
			TThreadFunction serverFunc=reinterpret_cast<TThreadFunction>(lib.Lookup(1));
			RThread server;
			error=server.Create(libName,serverFunc, iStackSize, iCmdLineArgs, &lib,NULL,
								iMinHeapSize,iMaxHeapSize,EOwnerProcess);
			lib.Close();	// if successful, server thread has handle to library now
#else
			RProcess server;
			TInt error = server.Create(newname, *iCmdLineArgs);
#endif
			if( error != KErrNone)
				{
				After(KRetryWait);
				return;
				}
			server.Resume();
			server.Close();
			}
			break;
		default:
			iState = EAppFailed;
			Next();
		}
	
	if (iMonitoring)
		{
		CThreadWatcher *threadWatcher=NULL;
		TRAPD(err, threadWatcher = CThreadWatcher::NewL(iAppType, threadId, newname, iStarter, iAppUid, iViewless));
		if (err == KErrNone) //ignore errors
			iQue->AddLast(*threadWatcher);
		}
	iState = EAppStarted;
	Next();
	}
TVerdict CSimPacketGPRSQOSTest::doTestStepL()
{
    INFO_PRINTF1(_L("BeginPacketGPRSQOSTest"));

    CreateConfigFileL(_L("c:\\config3.txt"));
    SetTestNumberL(6);

    TInt ret = iPhone.Open(iTelServer,KPhoneName);
    INFO_PRINTF2(_L("Result: %d"),ret);
    TESTL(ret == KErrNone);
    INFO_PRINTF1(_L("Opened phone object"));
    TESTL(iPacketService.Open(iPhone)==KErrNone);
    INFO_PRINTF1(_L("Opened Packet object"));
    TName contextName;
    TName contextNameCompare;
    TESTL(iFirstPrimaryPacketContext.OpenNewContext(iPacketService, contextName)==KErrNone);
    contextNameCompare.Append(KSimPrimaryPacketContextName);
    contextNameCompare.AppendNum(1);
    TESTL(contextName.Compare(contextNameCompare)==KErrNone);
    INFO_PRINTF1(_L("Opened Context object"));

    TRequestStatus reqStatus;
    TRequestStatus notifyStatus;
    TName gprsQosName;
    TESTL(iGPRSPacketqos.OpenNewQoS(iFirstPrimaryPacketContext, gprsQosName)==KErrNone);
    TName gprsQosNameCompare;
    gprsQosNameCompare.Append(KSimPacketQosName);
    gprsQosNameCompare.AppendNum(1);
    TESTL(gprsQosName.Compare(gprsQosNameCompare)==KErrNone);
    INFO_PRINTF1(_L("Opened GPRS QoS object"));

    TName qosname;
    iFirstPrimaryPacketContext.GetProfileName(qosname);
    INFO_PRINTF1(_L("Retrieved GPRS QoS object reference name"));

    // Set QoS Profile Params
    RPacketQoS::TQoSGPRSRequested aGPRSQoSReqConfig;
    TPckg<RPacketQoS::TQoSGPRSRequested> aGPRSQoSReqPckg(aGPRSQoSReqConfig);

    // post a notification
    RPacketQoS::TQoSGPRSNegotiated aGPRSNotifyQoS;
    TPckg<RPacketQoS::TQoSGPRSNegotiated> aGPRSNotifyQoSPckg(aGPRSNotifyQoS);

    //Profile data
    aGPRSQoSReqConfig.iMinDelay = RPacketQoS::EDelayClass1;
    aGPRSQoSReqConfig.iMinMeanThroughput = RPacketQoS::EMeanThroughput200;
    aGPRSQoSReqConfig.iMinPeakThroughput = RPacketQoS::EPeakThroughput16000;
    aGPRSQoSReqConfig.iMinPrecedence = RPacketQoS::EPriorityLowPrecedence;
    aGPRSQoSReqConfig.iMinReliability = RPacketQoS::EReliabilityClass1;
    aGPRSQoSReqConfig.iReqDelay = RPacketQoS::EDelayClass2;
    aGPRSQoSReqConfig.iReqMeanThroughput = RPacketQoS::EMeanThroughput2000;
    aGPRSQoSReqConfig.iReqPeakThroughput = RPacketQoS::EPeakThroughput64000;
    aGPRSQoSReqConfig.iReqPrecedence = RPacketQoS::EPriorityMediumPrecedence;
    aGPRSQoSReqConfig.iReqReliability = RPacketQoS::EReliabilityClass2;

    //post the notification
    iGPRSPacketqos.NotifyProfileChanged(notifyStatus, aGPRSNotifyQoSPckg);
    //Set the config
    iGPRSPacketqos.SetProfileParameters(reqStatus, aGPRSQoSReqPckg);

    User::WaitForRequest(notifyStatus);
    User::WaitForRequest(reqStatus);

    TESTL(aGPRSNotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
    TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
    TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
    TESTL(aGPRSNotifyQoS.iMeanThroughput == RPacketQoS::EMeanThroughput2000);
    TESTL(aGPRSNotifyQoS.iPeakThroughput == RPacketQoS::EPeakThroughput64000);
    TESTL(aGPRSNotifyQoS.iPrecedence == RPacketQoS::EPriorityMediumPrecedence);
    TESTL(aGPRSNotifyQoS.iReliability == RPacketQoS::EReliabilityClass2);

    // post a notification
    TRequestStatus cancelStatus;
    iGPRSPacketqos.NotifyProfileChanged(cancelStatus, aGPRSNotifyQoSPckg);
    iGPRSPacketqos.CancelAsyncRequest(EPacketQoSNotifyProfileChanged);
    User::WaitForRequest(cancelStatus);

    TESTL(cancelStatus.Int()==KErrCancel);
    INFO_PRINTF1(_L("Set Profile Test passed"));

    // need to call Notify first to set pending to true after
    // cancel event which sets it to false
    iGPRSPacketqos.NotifyProfileChanged(notifyStatus, aGPRSNotifyQoSPckg);
    iGPRSPacketqos.SetProfileParameters(reqStatus, aGPRSQoSReqPckg);
    User::WaitForRequest(notifyStatus);
    TESTL(notifyStatus.Int()==KErrNone);
    User::WaitForRequest(reqStatus);
    TESTL(reqStatus.Int()==KErrNone);

    // test RPacketContext::Activate - before calling ModifyActiveContext
    StartNTRasSimulation();
    iFirstPrimaryPacketContext.Activate(reqStatus);
    User::WaitForRequest(reqStatus);
    TESTL(reqStatus.Int()==KErrNone);
    INFO_PRINTF1(_L("Activate test passed"));

    // test RPacketContext::ModifyActiveContext - it shouldn't work unless
    // a profile/tft has changed since activation
    TRequestStatus modifyStatus;
    iFirstPrimaryPacketContext.ModifyActiveContext(modifyStatus);
    User::WaitForRequest(modifyStatus);
    TESTL(modifyStatus.Int()==KErrNotReady);
    iGPRSPacketqos.SetProfileParameters(reqStatus, aGPRSQoSReqPckg);
    User::WaitForRequest(reqStatus);
    TESTL(reqStatus.Int()==KErrNone);
    iFirstPrimaryPacketContext.ModifyActiveContext(modifyStatus);
    User::WaitForRequest(modifyStatus);
    TESTL(modifyStatus.Int()==KErrNone);
    INFO_PRINTF1(_L("ModifyActiveContext Test Passed"));
    INFO_PRINTF1(_L("Notify GPRS QoS Profile Test passed"));

    // Get QoS GPRS Capabilities
    RPacketQoS::TQoSCapsGPRS aQoSCaps;
    TPckg<RPacketQoS::TQoSCapsGPRS> aQoSCapsPckg(aQoSCaps);

    iGPRSPacketqos.GetProfileCapabilities(reqStatus, aQoSCapsPckg);
    User::WaitForRequest(reqStatus);
    TESTL(reqStatus.Int()==KErrNone);
    TESTL(aQoSCaps.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
    TESTL(aQoSCaps.iDelay == RPacketQoS::EDelayClass2);
    TESTL(aQoSCaps.iMean == RPacketQoS::EMeanThroughput100);
    TESTL(aQoSCaps.iPeak == RPacketQoS::EPeakThroughput64000);
    TESTL(aQoSCaps.iPrecedence == RPacketQoS::EPriorityMediumPrecedence);
    TESTL(aQoSCaps.iReliability == RPacketQoS::EReliabilityClass2);
    INFO_PRINTF1(_L("Get QoS Profile  Capabilities Test passed"));

    //Get QoS Profile Params
    RPacketQoS::TQoSGPRSNegotiated aGPRSQoSNegConfig;
    TPckg<RPacketQoS::TQoSGPRSNegotiated> aGPRSQoSNegPckg(aGPRSQoSNegConfig);

    iGPRSPacketqos.GetProfileParameters(cancelStatus, aGPRSQoSNegPckg);
    iGPRSPacketqos.CancelAsyncRequest(EPacketQoSGetProfileParams);//no implementation-does nothing
    User::WaitForRequest(cancelStatus);
    TESTL(cancelStatus.Int()==KErrNone);

    TESTL(aGPRSQoSNegConfig.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
    TESTL(aGPRSQoSNegConfig.iDelay==RPacketQoS::EDelayClass2);
    TESTL(aGPRSQoSNegConfig.iMeanThroughput==RPacketQoS::EMeanThroughput100);
    TESTL(aGPRSQoSNegConfig.iPeakThroughput==RPacketQoS::EPeakThroughput64000);
    TESTL(aGPRSQoSNegConfig.iPrecedence==RPacketQoS::EPriorityMediumPrecedence);
    TESTL(aGPRSQoSNegConfig.iReliability==RPacketQoS::EReliabilityClass2);
    INFO_PRINTF1(_L("Get QoS Profile Test passed"));

    // End of RPacketQos tests
    iGPRSPacketqos.Close();
    iFirstPrimaryPacketContext.Close();
    iPacketService.Close();
    iPhone.Close();
    ASSERT(RThread().RequestCount()==0);

    return TestStepResult();
}
TVerdict CSimPacketGPRSRel99NotifyProfileChangeTest::doTestStepL()
	{
	INFO_PRINTF1(_L("BeginPacketGPRSRel99NotifyProfileChangeTest"));

 	CreateConfigFileL(_L("c:\\config3.txt"));
 	SetTestNumberL(6);

	TRequestStatus gprsReqStatus, rel99ReqStatus;
	TRequestStatus gprsNotifyStatus, rel99NotifyStatus;

	// Open phone
	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
	INFO_PRINTF2(_L("Result: %d"),ret);
	TESTL(ret == KErrNone); 
	INFO_PRINTF1(_L("Opened phone object"));

	// Open GPRS packet service
	TESTL(iGPRSPacketService.Open(iPhone)==KErrNone);
	INFO_PRINTF1(_L("Opened Packet object"));

	// Open GPRS context
	TName contextName;
	TName contextNameCompare;
	TESTL(iGPRSPacketContext.OpenNewContext(iGPRSPacketService, contextName)==KErrNone);
	contextNameCompare.Append(KSimPrimaryPacketContextName);
	contextNameCompare.AppendNum(1);
	TESTL(contextName.Compare(contextNameCompare)==KErrNone);
	INFO_PRINTF1(_L("Opened Context object"));

	// Open GPRS PacketQoS
	TName gprsQosName;
	TESTL(iGPRSPacketqos.OpenNewQoS(iGPRSPacketContext, gprsQosName)==KErrNone);

	TName gprsQosNameCompare;
	gprsQosNameCompare.Append(KSimPacketQosName);
	gprsQosNameCompare.AppendNum(1);
	TESTL(gprsQosName.Compare(gprsQosNameCompare)==KErrNone);
	INFO_PRINTF1(_L("Opened GPRS QoS object"));
	
	// Open UMTS Rel99 packet service - opened from same session RTelServer object as GPRS packet service
	TESTL(iRel99PacketService.Open(iPhone)==KErrNone);
	INFO_PRINTF1(_L("Opened Rel99 Packet object"));

	// Open UMTS Rel99 context
	TESTL(iRel99PacketContext.OpenExistingContext(iRel99PacketService, contextName) == KErrNone);

	// Open Rel99 PacketQoS
	TESTL(iRel99Packetqos.OpenExistingQoS(iRel99PacketContext, gprsQosName)==KErrNone);
	INFO_PRINTF1(_L("Opened Rel99 QoS object"));

	//Configure GPRS parameters
	//
	//
	// Set GPRS QoS Profile Params
	RPacketQoS::TQoSGPRSRequested aGPRSQoSReqConfig;
	TPckg<RPacketQoS::TQoSGPRSRequested> aGPRSQoSReqPckg(aGPRSQoSReqConfig);

	// post a GPRS notification
 	RPacketQoS::TQoSGPRSNegotiated aGPRSNotifyQoS;
	TPckg<RPacketQoS::TQoSGPRSNegotiated> aGPRSNotifyQoSPckg(aGPRSNotifyQoS);

	//GPRS Profile data
	aGPRSQoSReqConfig.iMinDelay = RPacketQoS::EDelayClass1;
	aGPRSQoSReqConfig.iMinMeanThroughput = RPacketQoS::EMeanThroughput200;
	aGPRSQoSReqConfig.iMinPeakThroughput = RPacketQoS::EPeakThroughput16000;
	aGPRSQoSReqConfig.iMinPrecedence = RPacketQoS::EPriorityLowPrecedence;
	aGPRSQoSReqConfig.iMinReliability = RPacketQoS::EReliabilityClass1;
	aGPRSQoSReqConfig.iReqDelay = RPacketQoS::EDelayClass2;
	aGPRSQoSReqConfig.iReqMeanThroughput = RPacketQoS::EMeanThroughput2000;
	aGPRSQoSReqConfig.iReqPeakThroughput = RPacketQoS::EPeakThroughput64000;
	aGPRSQoSReqConfig.iReqPrecedence = RPacketQoS::EPriorityMediumPrecedence;
	aGPRSQoSReqConfig.iReqReliability = RPacketQoS::EReliabilityClass2;
	//
	//


	//Configure Rel99 QoS Profile Params
	//
	//
	RPacketQoS::TQoSR99_R4Requested aR99QoSReqConfig;
	TESTL(aR99QoSReqConfig.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4);
	TPckg<RPacketQoS::TQoSR99_R4Requested> aR99QoSReqPckg(aR99QoSReqConfig);

	RPacketQoS::TQoSR99_R4Negotiated aR99NotifyQoS;
	TPckg<RPacketQoS::TQoSR99_R4Negotiated> aR99NotifyQoSPckg(aR99NotifyQoS);

	TInt req = 4;
	TInt min = 2; 

	//Profile data
	aR99QoSReqConfig.iReqTrafficClass = RPacketQoS::ETrafficClassStreaming; // 0x04
	aR99QoSReqConfig.iMinTrafficClass = RPacketQoS::ETrafficClassConversational; // 0x02
	aR99QoSReqConfig.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired; // 0x04
	aR99QoSReqConfig.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;	// 0x02
	aR99QoSReqConfig.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired; // 0x08
	aR99QoSReqConfig.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryRequired; // 0x04
	aR99QoSReqConfig.iReqMaxSDUSize = req; // 4	
	aR99QoSReqConfig.iMinAcceptableMaxSDUSize = min; // 2
	aR99QoSReqConfig.iReqMaxRate.iUplinkRate = min;	// between 0 - 1840
	aR99QoSReqConfig.iReqMaxRate.iDownlinkRate = min;
	aR99QoSReqConfig.iMinAcceptableMaxRate.iDownlinkRate = min-1; // between 0 - 1840
	aR99QoSReqConfig.iMinAcceptableMaxRate.iUplinkRate = req;
	aR99QoSReqConfig.iReqBER = RPacketQoS::EBEROnePerHundred;	// 0x04
	aR99QoSReqConfig.iMaxBER = RPacketQoS::EBERFivePerHundred;	// 0x02
	aR99QoSReqConfig.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioSevenPerThousand; // 0x08
	aR99QoSReqConfig.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerHundred;	// 0x04
	aR99QoSReqConfig.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriority2; // 0x04
	aR99QoSReqConfig.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriority1; // 0x02
	aR99QoSReqConfig.iReqTransferDelay = req;
	aR99QoSReqConfig.iMaxTransferDelay = min;
	aR99QoSReqConfig.iReqGuaranteedRate.iDownlinkRate = min;
	aR99QoSReqConfig.iReqGuaranteedRate.iUplinkRate = req;
	aR99QoSReqConfig.iMinGuaranteedRate.iDownlinkRate = min;
	aR99QoSReqConfig.iMinGuaranteedRate.iUplinkRate = req;
	//
	//

	//post the notifications
	iRel99Packetqos.NotifyProfileChanged(rel99NotifyStatus, aR99NotifyQoSPckg);
	iGPRSPacketqos.NotifyProfileChanged(gprsNotifyStatus, aGPRSNotifyQoSPckg);
	
	//Set the profile
	iRel99Packetqos.SetProfileParameters(rel99ReqStatus, aR99QoSReqPckg);
	iGPRSPacketqos.SetProfileParameters(gprsReqStatus, aGPRSQoSReqPckg);	

	User::WaitForRequest(rel99NotifyStatus);
	User::WaitForRequest(gprsNotifyStatus);
	

	//User::WaitForRequest(rel99ReqStatus);
	User::WaitForRequest(rel99ReqStatus);
	User::WaitForRequest(gprsReqStatus);
	
	//Test the notification packages are correct

	//Rel99
	TESTL(aR99NotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4);
	TESTL(aR99NotifyQoS.iTrafficClass==RPacketQoS::ETrafficClassConversational);
	TESTL(aR99NotifyQoS.iDeliveryOrderReqd==RPacketQoS::EDeliveryOrderNotRequired);
	TESTL(aR99NotifyQoS.iDeliverErroneousSDU==RPacketQoS::EErroneousSDUNoDetection);
	TESTL(aR99NotifyQoS.iMaxSDUSize==min);
	TESTL(aR99NotifyQoS.iMaxRate.iUplinkRate==min);
	TESTL(aR99NotifyQoS.iMaxRate.iDownlinkRate==req);
	TESTL(aR99NotifyQoS.iBER==RPacketQoS::EBEROnePerHundred);
	TESTL(aR99NotifyQoS.iSDUErrorRatio==RPacketQoS::ESDUErrorRatioOnePerTen);
	TESTL(aR99NotifyQoS.iTrafficHandlingPriority==RPacketQoS::ETrafficPriority2);
	TESTL(aR99NotifyQoS.iTransferDelay==min);
	TESTL(aR99NotifyQoS.iGuaranteedRate.iUplinkRate==min);
	TESTL(aR99NotifyQoS.iGuaranteedRate.iDownlinkRate==req);

	//Gprs
	TESTL(aGPRSNotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
	TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
	TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
	TESTL(aGPRSNotifyQoS.iMeanThroughput == RPacketQoS::EMeanThroughput2000);
	TESTL(aGPRSNotifyQoS.iPeakThroughput == RPacketQoS::EPeakThroughput64000);
	TESTL(aGPRSNotifyQoS.iPrecedence == RPacketQoS::EPriorityMediumPrecedence);
	TESTL(aGPRSNotifyQoS.iReliability == RPacketQoS::EReliabilityClass2);
	
	// Close
	iGPRSPacketqos.Close();
	iGPRSPacketContext.Close();
	iGPRSPacketService.Close();
	iRel99Packetqos.Close();
	iRel99PacketContext.Close();
	iRel99PacketService.Close();
	iPhone.Close();
	
	ASSERT(RThread().RequestCount()==0);

	return TestStepResult();
	}
void CCTsySessionManagementFU::AuxOpenExisting3L(const TDesC &aName)
	{
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

    TName lineName(aName);    
    RLine line;
    
    TInt ret  = line.Open(iPhone, lineName);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(line);  
    
    TName callname;
	RCall call;
	
    ret = OpenNewCall(line, call, lineName, callname);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call);    


	// test on bad call name

	_LIT(KBadCallName, "BadCallName");

	RCall call2;
	
	ret = call2.OpenExistingCall(line, KBadCallName);
    ASSERT_EQUALS(KErrNotFound, ret);
	
	AssertMockLtsyStatusL();


	// test on bad line name

	_LIT(KBadLineName, "BadLineName");

    TName name;
    name = KBadLineName;
    name.Append(KDoubleColon);
    name.Append(callname);

	ret = call2.OpenExistingCall(iPhone, name);
    ASSERT_EQUALS(KErrNotSupported, ret);
	
	AssertMockLtsyStatusL();


	// test on bad call name and correct line

    name = lineName;
    name.Append(KDoubleColon);
    name.Append(KBadCallName);

	ret = call2.OpenExistingCall(iPhone, name);
    ASSERT_EQUALS(KErrNotFound, ret);
	
	AssertMockLtsyStatusL();


	// test on bad phone name

	_LIT(KBadPhoneName, "BadPhoneName");

    name = KBadPhoneName;
    name.Append(KDoubleColon);
    name.Append(lineName);
    name.Append(KDoubleColon);
    name.Append(callname);
	
	ret = call2.OpenExistingCall(iTelServer, name);
    ASSERT_EQUALS(KErrNotFound, ret);

	AssertMockLtsyStatusL();


	// test on bad line name and correct phone

    name = KMmTsyPhoneName;
    name.Append(KDoubleColon);
    name.Append(KBadLineName);
    name.Append(KDoubleColon);
    name.Append(callname);
	
	ret = call2.OpenExistingCall(iTelServer, name);
    ASSERT_EQUALS(KErrNotSupported, ret);

	AssertMockLtsyStatusL();


	// test on bad call name with correct phone and line

    name = KMmTsyPhoneName;
    name.Append(KDoubleColon);
    name.Append(lineName);
    name.Append(KDoubleColon);
    name.Append(KBadCallName);
	
	ret = call2.OpenExistingCall(iTelServer, name);
    ASSERT_EQUALS(KErrNotFound, ret);


	// test on string analyze

	_LIT(KBad, "::::::::");

    name = KBad;
	
	ret = call2.OpenExistingCall(iTelServer, name);
    ASSERT_EQUALS(KErrNotFound, ret);

	AssertMockLtsyStatusL();
	
	CleanupStack::PopAndDestroy(3, this); 
	
	}
void CCTsySessionManagementFU::AuxOpenExisting1L(const TDesC &aName)
	{
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

    TName lineName(aName);   
    RLine line;
    
    TInt ret  = line.Open(iPhone, lineName);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(line);  
    
    TName callname;
	RCall call;
	
    ret = OpenNewCall(line, call, lineName, callname);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call);    


	// test on successful completion
	RCall call2;
	
	ret = call2.OpenExistingCall(line, callname);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call2);  
	
	AssertMockLtsyStatusL();

	// test on successful completion (another params set)
    TName name;
    name = lineName;
    name.Append(KDoubleColon);
    name.Append(callname);

	RCall call3;
	
	ret = call3.OpenExistingCall(iPhone, name);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call3);  
	
	AssertMockLtsyStatusL();

	// test on successful completion (another params set)
	RCall call4;

    name = KMmTsyPhoneName;
    name.Append(KDoubleColon);
    name.Append(lineName);
    name.Append(KDoubleColon);
    name.Append(callname);
	
	ret = call4.OpenExistingCall(iTelServer, name);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call4);  

	AssertMockLtsyStatusL();
	
	CleanupStack::PopAndDestroy(6, this); 
		
	}
Ejemplo n.º 13
0
/*
-------------------------------------------------------------------------------

    Class: CUnderTaker

    Method: RunL

    Description: Handles thread death.
    Function does:
    1 ) Stops monitoring thread
    1 ) Marks thread death
    2 ) Completes ongoing requests
    3 ) Cleans the memory

    Parameters: None

    Return Values: None

    Errors/Exceptions: None

    Status: Proposal

-------------------------------------------------------------------------------
*/
void CUnderTaker::RunL()
    {

    // Make sure that any of the test interference thread's won't stay to run.
    iModuleContainer->KillTestinterferenceThread();

    // Make sure that any of the test measurement's process won't stay to run.
    iModuleContainer->KillTestMeasurement();

    // Get the exit category
    TName exitCategory = _L( "Crash reason:" );
    exitCategory.Append( iModuleContainer->iThread.ExitCategory() );
    TInt exitReason = iModuleContainer->iThread.ExitReason();
    TFullTestResult::TCaseExecutionResult exitType = TFullTestResult::ECaseException;
    if( iModuleContainer->iThread.ExitType() == EExitPanic )
        {
        exitType = TFullTestResult::ECasePanic;
        }    

    // it is not running anymore..
    iModuleContainer->iUpAndRunning = EFalse;

    // Do not monitor anymore.
    iModuleContainer->iThread.LogonCancel( iStatus );
    iCancelNeeded = EFalse;

    __TRACE( KError,( CStifLogger::ERed, _L( "Execution thread crashed, exitReason = %d" ), exitReason ) );
    __TRACE( KError,( CStifLogger::ERed, exitCategory ) );    

    if ( iSynchronousMode )
        {        

        // Synchronous request was running. Complete that 
          // operation.
        __TRACE( KVerbose,( _L( "CUnderTaker::RunL Crash during synchronous operation" ) ) );
        iModuleContainer->iErrorResult = KErrDied;
        iModuleContainer->Cancel();
        iModuleContainer->iUpAndRunning = EFalse;

        // Print notification
        TName operationText = _L("Test module died when calling:");
        operationText.Append( iModuleContainer->iOperationText );

        // Print to log file        
        __TRACE( KError,( CStifLogger::ERed, operationText ) );
        // Print to UI
        iModuleContainer->iCTestModule->ErrorPrint ( 1, operationText );        

        // Stop active scheduler.
        CActiveScheduler::Stop();

        // Execution continues from CTestModuleContainer::StartAndWaitOperation.

        }
    else
        {// Test case was running, 

        __TRACE( KError,( _L( "Test case execution aborted" ) ) );
        __TRACE( KVerbose,( _L( "CUnderTaker::Run crash during test execution" ) ) );      

        TInt caseResult = KErrGeneral;
        
        // Check if case have any special panic or exception codes that are "passed"
        if ( iModuleContainer->iAllowedExitReason != 
             CTestModuleIf::ENormal )            
            {
                
            if ( iModuleContainer->iAllowedExitReason == 
                 CTestModuleIf::EPanic &&
                 exitType == TFullTestResult::ECasePanic &&
                 iModuleContainer->iAllowedExitCode == exitReason )
                {
                exitType = TFullTestResult::ECaseExecuted;
                caseResult = KErrNone;
                exitCategory = _L("Allowed case panic");
                
                __TRACE( KError,( _L( "Test case execution panic, setting to OK" ) ) );
                }

            if ( iModuleContainer->iAllowedExitReason == 
                 CTestModuleIf::EException &&
                 exitType == TFullTestResult::ECaseException &&
                 iModuleContainer->iAllowedExitCode == exitReason )
                {
                exitType = TFullTestResult::ECaseExecuted;
                caseResult = KErrNone;
                exitCategory = _L("Allowed case exception");

                __TRACE( KError,( _L( "Test case execution exception, setting to OK" ) ) );
                }
            
            
            }

        // This was asynchronous request, and nobody is waiting for it
        // completion in server, so all clean-up must be done here

        // Forget iTestThreadContainer pointer, memory is freed because test thread
        // is destroyed   
        // This is needed to prevent from accessing memory from thread that is destroyed.
        // Do this only if test is been executed.
        iModuleContainer->iThreadContainer = NULL;

        if (iModuleContainer->iCTestExecution != NULL)
        	{
			// Execution thread have been killed
			iModuleContainer->iCTestExecution->SetThreadState( CTestExecution::ECancelled );
	
			
			// Cancel the request
			iModuleContainer->iCTestExecution->CompleteTestExecution( KErrNone,
																	  exitType,
																	  exitReason,
																	  caseResult,
																	  exitCategory );
	
			// If the print queue is empty, and there is active print
			// request, then cancel that request. 
			// NOTE: Case queue not empty AND request waiting AND
			//       thread terminated can't happen due iPrintMutex
			iModuleContainer->iCTestExecution->CompletePrintRequestIfQueueEmpty();
        	}
        else
        	{
        	__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CUnderTaker::RunL." ) ) );
        	User::Leave(KErrGeneral);
        	}
        // Free the memory
        // Remove undertaker from module container to make sure that
        // it does not delete this.
        iModuleContainer->iUnderTaker = NULL;
        delete iModuleContainer;
        iModuleContainer = NULL;

        // Suicide. "Parent", i.e iModuleContainer has already died
        // and no-one have pointer to this active object, so die.
        delete this;

        }
       
    }
static QList<QNetworkInterfacePrivate *> interfaceListing()
{
    TInt err(KErrNone);
    QList<QNetworkInterfacePrivate *> interfaces;

    // Connect to Native socket server
    RSocketServ socketServ;
    err = socketServ.Connect();
    if (err)
        return interfaces;

    // Open dummy socket for interface queries
    RSocket socket;
    err = socket.Open(socketServ, _L("udp"));
    if (err) {
        socketServ.Close();
        return interfaces;
    }

    // Ask socket to start enumerating interfaces
    err =  socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
    if (err) {
        socket.Close();
        socketServ.Close();
        return interfaces;
    }

    int ifindex = 0;
    TPckgBuf<TSoInetInterfaceInfo> infoPckg;
    TSoInetInterfaceInfo &info = infoPckg();
    while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone) {
        // Do not include IPv6 addresses because netmask and broadcast address cannot be determined correctly
        if (info.iName != KNullDesC && info.iAddress.IsV4Mapped()) {
            TName address;
            QNetworkAddressEntry entry;
            QNetworkInterfacePrivate *iface = 0;

            iface = new QNetworkInterfacePrivate;
            iface->index = ifindex++;
            interfaces << iface;
            iface->name = qt_TDesC2QString(info.iName);
            iface->flags = convertFlags(info);

            if (/*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec) {
                for (TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++) {
                    address.AppendNumFixedWidth(info.iHwAddr[i], EHex, 2);
                    if ((i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen())
                        address.Append(_L(":"));
                }
                address.UpperCase();
                iface->hardwareAddress = qt_TDesC2QString(address);
            }

            // Get the address of the interface
            info.iAddress.Output(address);
            entry.setIp(QHostAddress(qt_TDesC2QString(address)));

            // Get the interface netmask
            // For some reason netmask is always 0.0.0.0
            // info.iNetMask.Output(address);
            // entry.setNetmask( QHostAddress( qt_TDesC2QString( address ) ) );

            // Workaround: Let Symbian determine netmask based on IP address class
            // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support
            TInetAddr netmask;
            netmask.NetMask(info.iAddress);
            netmask.Output(address);
            entry.setNetmask(QHostAddress(qt_TDesC2QString(address)));

            // Get the interface broadcast address
            if (iface->flags & QNetworkInterface::CanBroadcast) {
                // For some reason broadcast address is always 0.0.0.0
                // info.iBrdAddr.Output(address);
                // entry.setBroadcast( QHostAddress( qt_TDesC2QString( address ) ) );

                // Workaround: Let Symbian determine broadcast address based on IP address
                // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support
                TInetAddr broadcast;
                broadcast.NetBroadcast(info.iAddress);
                broadcast.Output(address);
                entry.setBroadcast(QHostAddress(qt_TDesC2QString(address)));
            }

            // Add new entry to interface address entries
            iface->addressEntries << entry;

#if defined(QNETWORKINTERFACE_DEBUG)
            printf("\n       Found network interface %s, interface flags:\n\
                IsUp = %d, IsRunning = %d, CanBroadcast = %d,\n\
                IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\
                ip = %s, netmask = %s, broadcast = %s,\n\
                hwaddress = %s",
                   iface->name.toLatin1().constData(),
                   iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast,
                   iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast,
                   entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(),
                   iface->hardwareAddress.toLatin1().constData());
#endif
        }
    }
Ejemplo n.º 15
0
void CTelServerProcessor::OpenNewCallL()
/**
Load the TSY and open a new call from the ETEL server
*/
	{
	__ASSERT_ALWAYS(!iCallOpen, NetDialPanic(EEtelCallAlreadyOpen));
	__ASSERT_ALWAYS(iCallType==EUnknown, NetDialPanic(EEtelCallAlreadyOpen));

	TBuf<KCommsDbSvrMaxFieldLength> newTsyName;
	iDb->GetTsyNameL(newTsyName);
	// Remove unnecessary .TSY extension, if found
	if (newTsyName.Right(4).CompareF(KTsyNameExtension) == 0)
		newTsyName = newTsyName.Left(newTsyName.Length() - 4);

	TBool loaded=EFalse;
	if (iTsyName.Length()!=0)
		{
		if (iTsyName.CompareF(newTsyName)==KErrNone)	// the one we want is already loaded
			loaded=ETrue;
		else											// unload the one we were using
			{
			User::LeaveIfError(iTelServer.UnloadPhoneModule(iTsyName));
			iTsyLoaded=EFalse;
			}
		}

	if (!loaded)
		{
		User::LeaveIfError(iTelServer.LoadPhoneModule(newTsyName));
		iTsyName=newTsyName;
		iTsyLoaded=ETrue;
		}
	
	if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone)
		{
		User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic));
		}

	RTelServer::TPhoneInfo info;
	GetPhoneInfoL(info);
	
	TName callName;
	callName.Zero();
	callName.Copy(info.iName);		// phone name
	callName.Append(KDoubleColon);

	RPhone::TLineInfo lineInfo;
	GetLineInfoL(lineInfo,info.iName,RLine::KCapsData);
	callName.Append(lineInfo.iName);
	
	callName.Append(KDoubleColon);
	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_OPENNEWCALLL_1, "NetDial:\tOpening Call");

	iDb->CopyIspInitStringToModemL();	// will not leave if the field is blank
	// Only MultimodeV1 and greater supported!
	if (info.iExtensions>=(TUint)KETelExtMultimodeV1)
		{
		User::LeaveIfError(iMmCall.OpenNewCall(iTelServer,callName));
		iCallOpen=ETrue;
		iCallType=EMmDataCall;
		SetMmParametersL();	// may change call type to EMmHscsdCall
		}
	else
		{
		User::LeaveIfError(iCall.OpenNewCall(iTelServer,callName));
		iCallOpen=ETrue;
		iCallType=ECoreCallOnly;
		}
	}