TInt TCmdUNSAFTimers::FindIapKeyL( CRepository& aRepository, TInt aIapId, TUint32& aKey ) const { RArray<TUint32> keys; CleanupClosePushL( keys ); TInt err = aRepository.FindL( KUNSAFProtocolsIAPIdMask, KUNSAFProtocolsFieldTypeMask, keys ); TInt ret = KErrNotFound; if ( err == KErrNone && keys.Count() > 0 ) { for ( TInt i = 0; i < keys.Count() && ret == KErrNotFound; i++ ) { TUint32 key = ( KUNSAFProtocolsIAPIdMask ^ ( keys[ i ] ) ); key |= KUNSAFProtocolsIAPTableMask; TInt iapId( 0 ); Read( aRepository, KUNSAFProtocolsIAPIdMask | key, iapId ); if ( iapId == aIapId ) { aKey = key; ret = KErrNone; } } } CleanupStack::PopAndDestroy( &keys ); return ret; }
TUint32 XQAccessPointManagerPrivate::makeIapL(const TDesC& aIapName, const XQWLAN& aWlan) { TUint32 iapId(0); CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); apItem->SetBearerTypeL(EApBearerTypeWLAN); if (aIapName.Length()) { apItem->SetNamesL(aIapName); apItem->WriteTextL(EApWlanNetworkName, aIapName); } else { TPtrC16 ssidDesc(reinterpret_cast<const TUint16*>(aWlan.name().utf16())); apItem->SetNamesL(ssidDesc); apItem->WriteTextL(EApWlanNetworkName, ssidDesc); } // set the wlan security mode apItem->WriteUint(EApWlanSecurityMode, fromQtSecurityModeToS60SecurityMode(aWlan.securityMode())); // set the wlan network structure... apItem->WriteUint(EApWlanNetworkMode, fromQtNetworkModeToS60NetworkMode(aWlan.networkMode())) ; apItem->WriteBool(EApWlanScanSSID, !aWlan.isVisible()) ; CApDataHandler* dataHandler = CApDataHandler::NewLC(*ipCommsDB); if (apItem->SanityCheckOk()) { iapId = dataHandler->CreateFromDataL(*apItem); } CleanupStack::PopAndDestroy( dataHandler ); CleanupStack::PopAndDestroy( apItem ); return iapId; }
// ----------------------------------------------------------------------------- // CSIPExSIPIdleState::InviteReceivedL() // (other items were commented in a header). // ----------------------------------------------------------------------------- void CSIPExSIPIdleState::InviteReceivedL( CSIPExSIPEngine& aEngine, CSIPServerTransaction* aTransaction ) { _LIT8( KLogEntry, "180 Ringing sent" ); // Get dialog association, save for future use CSIPInviteDialogAssoc* dialogAssoc = CSIPInviteDialogAssoc::NewL( *aTransaction ); aEngine.SetDialogAssoc( *dialogAssoc ); // Create the necessary response elements and send CSIPResponseElements* elem = CSIPResponseElements::NewLC( 180, SIPStrings::StringF( SipStrConsts::EPhraseRinging ) ); aTransaction->SendResponseL( elem ); CleanupStack::Pop( elem ); aEngine.Observer()->WriteLog( KLogEntry ); // Get the From header from the request const CSIPRequestElements* reqElem = aTransaction->RequestElements(); const CSIPFromHeader* fromHeader = reqElem->FromHeader(); // Change machine state aEngine.SetCurrentState( iServerOfferingState ); TUint32 iapId( 0 ); User::LeaveIfError( aEngine.Profile().GetParameter( KSIPAccessPointId, iapId ) ); // Send user name from the From header to the Engine Observer // as a parameter. Send also id of used IAP. aEngine.Observer()->InviteReceived( fromHeader->SIPAddress().Uri8().Uri().Extract( EUriUserinfo ), iapId ); }
// ----------------------------------------------------------------------------- // COMASuplSettings::IapIdFromWapIdL // // ----------------------------------------------------------------------------- // TUint32 COMASuplSettings::IapIdFromWapIdL( TUint32 aWapId ) const { /*CApUtils* apUtils = CApUtils::NewLC( *iCommsDb ); TUint32 iapId = NULL; iapId = apUtils->IapIdFromWapIdL( aWapId ); __ASSERT_ALWAYS( iapId, Panic( SuplAdapterInvalidId ) ); CleanupStack::PopAndDestroy( apUtils ); return iapId; return ;*/ RCmManagerExt cmManager; cmManager.OpenLC(); // CS:1 RArray<TUint32> iapIds; TUint32 iapId( 0 ); // First get all free IAP ID's. cmManager.ConnectionMethodL( iapIds ); CleanupClosePushL( iapIds ); // CS:2 // Then get IAP ID's from all destinations. RArray<TUint32> destIds; cmManager.AllDestinationsL( destIds ); CleanupClosePushL( destIds ); // CS:3 TInt destCount = destIds.Count(); for ( TInt destIndex = 0; destIndex < destCount; destIndex++ ) { RCmDestinationExt dest = cmManager.DestinationL( destIds[destIndex] ); CleanupClosePushL( dest ); // CS:4 TInt cmCount = dest.ConnectionMethodCount(); for ( TInt cmIndex = 0; cmIndex < cmCount; cmIndex++ ) { TUint32 apId = dest.ConnectionMethodL( cmIndex ).GetIntAttributeL( CMManager::ECmIapId ); iapIds.AppendL( apId ); } CleanupStack::PopAndDestroy( &dest ); // CS:3 } // Finally, go through all connection methods and find correct IAP ID. const TInt cmCount = iapIds.Count(); for ( TInt counter = 0; counter < cmCount; counter++ ) { TUint32 id = cmManager.GetConnectionMethodInfoIntL( iapIds[counter], CMManager::ECmWapId ); if ( id == aWapId ) { iapId = iapIds[counter]; // No need to go through rest of IAPs. break; } } // PopAndDestroy destIds, iapIds, cmManager. CleanupStack::PopAndDestroy( 3, &cmManager ); // CS:0 return iapId; }
// --------------------------------------------------------------------------- // CNATFWTraversalAdapter::IapIdFromWapIdL // Returns IAP ID from WAP ID. // --------------------------------------------------------------------------- // TUint32 CNATFWTraversalAdapter::IapIdFromWapIdL( TUint32 aWapId ) { DBG_PRINT( "CNATFWTraversalAdapter::IapIdFromWapIdL - begin" ); RCmManagerExt cmManager; cmManager.OpenLC(); // CS:1 RArray<TUint32> iapIds; TUint32 iapId( 0 ); // First get all free IAP ID's. cmManager.ConnectionMethodL( iapIds ); CleanupClosePushL( iapIds ); // CS:2 // Then get IAP ID's from all destinations. RArray<TUint32> destIds; cmManager.AllDestinationsL( destIds ); CleanupClosePushL( destIds ); // CS:3 TInt destCount = destIds.Count(); for ( TInt destIndex = 0; destIndex < destCount; destIndex++ ) { RCmDestinationExt dest = cmManager.DestinationL( destIds[destIndex] ); CleanupClosePushL( dest ); // CS:4 TInt cmCount = dest.ConnectionMethodCount(); for ( TInt cmIndex = 0; cmIndex < cmCount; cmIndex++ ) { TUint32 apId = dest.ConnectionMethodL( cmIndex ).GetIntAttributeL( CMManager::ECmIapId ); iapIds.AppendL( apId ); } CleanupStack::PopAndDestroy( &dest ); // CS:3 } // Finally, go through all connection methods and find correct IAP ID. const TInt cmCount = iapIds.Count(); for ( TInt counter = 0; counter < cmCount; counter++ ) { TUint32 id = cmManager.GetConnectionMethodInfoIntL( iapIds[counter], CMManager::ECmWapId ); if ( id == aWapId ) { iapId = iapIds[counter]; // No need to go through rest of IAPs. break; } } // PopAndDestroy destIds, iapIds, cmManager. CleanupStack::PopAndDestroy( 3, &cmManager ); // CS:0 DBG_PRINT( "CNATFWTraversalAdapter::IapIdFromWapIdL - end" ); return iapId; }
// ----------------------------------------------------------------------------- // CSIPExSIPClientEstablishingState::ResponseReceivedL() // (other items were commented in a header). // ----------------------------------------------------------------------------- void CSIPExSIPClientEstablishingState::ResponseReceivedL( CSIPExSIPEngine& aEngine, CSIPClientTransaction& aTransaction ) { const CSIPResponseElements* respElem = aTransaction.ResponseElements(); TUint statusCode = respElem->StatusCode(); if ( statusCode >= 200 && statusCode < 300 ) { // Final Response received from network. // Get the IP Address of the remote party from the Response Elements const TInetAddr addr = aEngine.IPAddressFromResponseElementsL( *respElem ); // Get used iap's id TUint32 iapId( 0 ); CSIPConnection* conn = aEngine.DialogAssoc().Dialog().Connection(); if ( conn ) { iapId = conn->IapId(); } // Then, send ACK to remote party CSIPInviteDialogAssoc& dialogAssoc = aEngine.DialogAssoc(); dialogAssoc.SendAckL( aTransaction ); // After ACKing, notify observer, giving IP Address and IAP id // as parameter aEngine.Observer()->InviteAcceptedByRemote( addr, iapId ); // Finally, change engine state aEngine.SetCurrentState( iEstablishedState ); } else if ( statusCode >= 100 && statusCode < 200 ) { // Provisional Response received from network. aEngine.Observer()->InviteReceivedByRemote( statusCode ); aEngine.SetCurrentState( iClientOfferingState ); } else { aEngine.Observer()->InviteDeclinedByRemote( statusCode ); aEngine.SetCurrentState( iIdleState ); } }
void conn_settings_notify_func (ConnSettingsType type, const char *id, const char *key, ConnSettingsValue *value, void *user_data) { if (type != CONN_SETTINGS_CONNECTION) return; IAPMonitorPrivate *priv = (IAPMonitorPrivate *)user_data; QString iapId(key); iapId = iapId.split("/")[0]; if (value != 0) { priv->iapAdded(iapId); } else if (iapId == QString(key)) { // IAP is removed only when the directory gets removed priv->iapRemoved(iapId); } }
// --------------------------------------------------------- // ProcessRegister // --------------------------------------------------------- // void CHotSpotSession::ProcessRegisterL( const RMessage2& aMessage ) { DEBUG("CHotSpotSession::ProcessRegisterL"); iAllowNotifications = EFalse; TBufC< KIapNameLength > iapName; TPckgBuf< TIapName > iapPckg; TUid clientUid; TPckgBuf< TClientUid > uidPckg; TPckgBuf<TInt> iapPackage( iIapId ); // Read message aMessage.ReadL( 0, uidPckg ); clientUid = uidPckg().ClientUid(); aMessage.ReadL( 1, iapPckg ); iapName = iapPckg().IapName(); TBuf<KIapNameLength> bufUid; bufUid.Copy( clientUid.Name() ); ModifyClientUid( bufUid ); TUint32 iapId( 0 ); TInt ret( KErrNone ); TRAP( ret, iIapSettingsHandler->CreateClientIapL( iapName, iapId, bufUid )); DEBUG1( "CHotSpotSession::EHssRegister iapId: %d", iapId ); DEBUG1( "CHotSpotSession::EHssRegister ret: %d", ret ); if ( KErrNone == ret ) { iServer.SetClientIapL( iapId, bufUid ); aMessage.Complete( iapId ); } else { // Error, we are returning 0 to client // and no IAP is created aMessage.Complete( KErrNone ); } }
// --------------------------------------------------------- // CActiveDisconnectDlgPlugin::IsConnectionL // --------------------------------------------------------- // TBool CActiveDisconnectDlgPlugin::IsConnectionL( CConnectionInfo* aConnectionInfo ) { CLOG_ENTERFN( "CActiveDisconnectDlgPlugin::IsConnectionL" ); TBool result( EFalse ); TUint i( 0 ); TUint connectionCount( 0 ); TUint connNum( 0 ); TUint subConnectionCount( 0 ); TUint connId( 0 ); TInt bearer( 0 ); TInt connStatus( 0 ); //TRequestStatus status; TName apName; RConnectionMonitor connMon; result = connMon.ConnectL(); CLOG_WRITEF( _L( "result: %d" ), result ); CDisconnectDlgActiveWaiter* waiter = CDisconnectDlgActiveWaiter::NewL(); CleanupStack::PushL( waiter ); connMon.GetConnectionCount( connNum, waiter->iStatus ); waiter->WaitForRequest(); //User::WaitForRequest( status ); CLOG_WRITEF( _L( "status: %d" ), waiter->iStatus.Int() ); CLOG_WRITEF( _L( "connNum: %d" ), connNum ); for( i = 1; i < ( connNum + 1 ) && !connectionCount; ++i ) { connMon.GetConnectionInfo( i, connId, subConnectionCount ); connMon.GetStringAttribute( connId, 0, KIAPName, apName, waiter->iStatus ); waiter->WaitForRequest(); //User::WaitForRequest( status ); CLOG_WRITEF( _L( "KIAPName status: %d" ), waiter->iStatus.Int() ); connMon.GetIntAttribute( connId, 0, KBearer, bearer, waiter->iStatus ); waiter->WaitForRequest(); //User::WaitForRequest( status ); CLOG_WRITEF( _L( "KBearer status: %d" ), waiter->iStatus.Int() ); connMon.GetIntAttribute( connId, 0, KConnectionStatus, connStatus, waiter->iStatus ); waiter->WaitForRequest(); //User::WaitForRequest( status ); CLOG_WRITEF( _L( "KConnectionStatus status: %d" ), waiter->iStatus.Int() ); TUint iapId( 0 ); connMon.GetUintAttribute( connId, 0, KIAPId, iapId, waiter->iStatus ); waiter->WaitForRequest(); //User::WaitForRequest( status ); CLOG_WRITEF(_L( "KIAPId status: %d" ), waiter->iStatus.Int() ); CLOG_WRITEF(_L( "iapId: %d" ), iapId ); TConnMonTimeBuf timeBuf; connMon.GetPckgAttribute( connId, 0, KStartTime, timeBuf, waiter->iStatus ); waiter->WaitForRequest(); CLOG_WRITEF(_L( "KStartTime status: %d" ), waiter->iStatus.Int() ); switch( bearer ) { case EBearerGPRS : case EBearerEdgeGPRS : case EBearerExternalGPRS : case EBearerExternalEdgeGPRS : case EBearerWCDMA : case EBearerExternalWCDMA : #ifdef __WINS__ case EBearerLAN : #endif // WINS { if ( ( connStatus == KLinkLayerOpen ) || ( connStatus == KConnectionOpen && bearer >= EBearerExternalCSD ) ) { apName.Trim(); if( apName.Left( KMrouterName().Length() ). CompareF( KMrouterName ) ) { ++connectionCount; aConnectionInfo->SetIapNameL( apName ); aConnectionInfo->SetBearerType( bearer ); aConnectionInfo->SetConnId( connId ); aConnectionInfo->SetIAPId( iapId ); aConnectionInfo->SetStartTime( timeBuf() ); TConnMonClientEnumBuf clientEnum; connMon.GetPckgAttribute( connId, 0, KClientInfo, clientEnum, waiter->iStatus ); waiter->WaitForRequest(); //User::WaitForRequest( status ); aConnectionInfo->SetClientInfo( clientEnum() ); CLOG_WRITEF( _L( "KClientInfo status: %d" ), waiter->iStatus.Int() ); } } break; } default : { break; } } } CleanupStack::PopAndDestroy( waiter ); connMon.Close(); result = connectionCount ? ETrue : EFalse; CLOG_WRITEF( _L( "connectionCount: %d" ), connectionCount ); CLOG_WRITEF( _L( "result: %d" ), result ); CLOG_LEAVEFN( "CActiveDisconnectDlgPlugin::IsConnectionL" ); return result; }
// ----------------------------------------------------------------------------- // ProfileUtil::CopyProfileL // Copies profile attributes from one profile to another // ----------------------------------------------------------------------------- // void ProfileUtil::CopyProfileL( CSIPManagedProfile* aOrigProfile, CSIPManagedProfile* aCopiedProfile ) { // Copy profile settings TInt err(KErrNone); aCopiedProfile->SetType( aOrigProfile->Type() ); TUint32 iapId(0); err= aOrigProfile->GetParameter(KSIPAccessPointId,iapId); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPAccessPointId,iapId); User::LeaveIfError(err); const MDesC8Array * aors = 0; err= aOrigProfile->GetParameter(KSIPRegisteredAors,aors); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPRegisteredAors,*aors); User::LeaveIfError(err); const TDesC8 * pIdentiy = 0; err= aOrigProfile->GetParameter(KSIPPrivateIdentity,pIdentiy); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPPrivateIdentity,*pIdentiy); User::LeaveIfError(err); const TDesC8 * providerName = 0; err= aOrigProfile->GetParameter(KSIPProviderName,providerName); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPProviderName,*providerName); User::LeaveIfError(err); TBool bSigcomp(EFalse); err= aOrigProfile->GetParameter(KSIPSigComp,bSigcomp); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPSigComp,bSigcomp); User::LeaveIfError(err); TBool bAutoReg(EFalse); err= aOrigProfile->GetParameter(KSIPAutoRegistration,bAutoReg); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPAutoRegistration,bAutoReg); User::LeaveIfError(err); TBool bSecurityNeg(EFalse); err= aOrigProfile->GetParameter(KSIPNegotiatedSecurityMechanism ,bSecurityNeg); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPNegotiatedSecurityMechanism ,bSecurityNeg); User::LeaveIfError(err); TBool bDefault(EFalse); err= aOrigProfile->GetParameter(KSIPDefaultProfile ,bDefault); User::LeaveIfError(err); if(bDefault) { err=aCopiedProfile->SetParameter(KSIPDefaultProfile,bDefault); User::LeaveIfError(err); } const TDesC8 * outboundProxy = 0; err= aOrigProfile->GetParameter(KSIPOutboundProxy,KSIPServerAddress,outboundProxy ); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPOutboundProxy ,KSIPServerAddress,*outboundProxy); User::LeaveIfError(err); const TDesC8 * realm = 0; err= aOrigProfile->GetParameter(KSIPOutboundProxy,KSIPDigestRealm,realm ); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPOutboundProxy ,KSIPDigestRealm ,*realm); User::LeaveIfError(err); const TDesC8 * uName = 0; err= aOrigProfile->GetParameter(KSIPOutboundProxy,KSIPDigestUserName,uName ); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPOutboundProxy,KSIPDigestUserName,*uName); User::LeaveIfError(err); err= aOrigProfile->GetParameter(KSIPRegistrar,KSIPDigestRealm,realm ); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPRegistrar ,KSIPDigestRealm,*realm); User::LeaveIfError(err); err= aOrigProfile->GetParameter(KSIPRegistrar,KSIPDigestUserName,uName ); User::LeaveIfError(err); err=aCopiedProfile->SetParameter(KSIPRegistrar,KSIPDigestUserName,*uName); User::LeaveIfError(err); // TODO : This can't be done according to new API . /* aCopiedProfile->SetServerExtensionParameterL( CSIPProfile::ERegistrar, KLabelPassword, aOrigProfile->ServerExtensionParameter( CSIPProfile::ERegistrar, KLabelPassword ) ); */ }
// ----------------------------------------------------------------------------- // ProfileUtil::ProfileModificationsL // Compares profile attributes with the ones on the temporary structure // ----------------------------------------------------------------------------- // TBool ProfileUtil::ProfileModificationsL( CSIPManagedProfile* aProfile, const TSIPProfileData& aProfileData ) { TBool modifs = EFalse; // Service provider name HBufC8* providerName = HBufC8::NewLC( KMaxProviderNameLength ); providerName->Des().Copy( aProfileData.iProviderName ); HBufC8* userName = HBufC8::NewLC( KMaxUsernameLength ); userName->Des().Copy( aProfileData.iUsername ); const TDesC8 * tmpProviderName = 0; TInt err(KErrNone); err= aProfile->GetParameter(KSIPProviderName,tmpProviderName); User::LeaveIfError(err); TBool nameComp = providerName->Des().Compare( *tmpProviderName ) != 0; TUint32 iapId(0); err= aProfile->GetParameter(KSIPAccessPointId,iapId); User::LeaveIfError(err); TBool iapComp = TUint( aProfileData.iAPIndex ) != iapId; // error 514: (Warning -- Unusual use of a Boolean expression) // PC-Lint refuses to understand XOR operation TBool bSigComp(EFalse); err= aProfile->GetParameter(KSIPSigComp,bSigComp); User::LeaveIfError(err) ; TBool comprComp = ( aProfileData.iCompression == EComprYes ) ^ bSigComp; //lint !e514 // error 514: (Warning -- Unusual use of a Boolean expression) // PC-Lint refuses to understand XOR operation TBool bAutoReg(EFalse); err= aProfile->GetParameter(KSIPAutoRegistration,bAutoReg); User::LeaveIfError(err); TBool registrationComp = ( aProfileData.iRegistrationMode == EAlwaysOn ) ^ bAutoReg; //lint !e514 // error 514: (Warning -- Unusual use of a Boolean expression) // PC-Lint refuses to understand XOR operation TBool bSecurityNeg(EFalse); err= aProfile->GetParameter(KSIPSecurityNegotiation,bSecurityNeg); User::LeaveIfError(err); TBool securityComp = ( aProfileData.iSecurity == ESecurityOn ) ^ bSecurityNeg; //lint !e514 const TDesC8 * aor = 0; err= aProfile->GetParameter(KSIPUserAor,aor); User::LeaveIfError(err); TPtrC8 ptr(*aor); // Username comparison TBool uNameComp = userName->Des().Compare( ptr.Right( ptr.Length() - KSIPProtocolHeader().Length() ) ) != 0; TBool serviceComp = ( aProfileData.iServiceProfile.iSIPProfileName != aProfile->Type().iSIPProfileName ) || ( aProfileData.iServiceProfile.iSIPProfileClass != aProfile->Type().iSIPProfileClass ); if ( nameComp || iapComp || comprComp || registrationComp || securityComp || uNameComp || serviceComp ) { modifs = ETrue; } CleanupStack::PopAndDestroy( 2 ); // providerName, userName return modifs; }