# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1265061957 -7200 # Node ID 7b872347d83b010ca466b4a859159775952baa0e # Parent bfb1de3eac8ed686e27038a28fee7e943020ca86 Revision: 201003 Kit: 201005 diff -r bfb1de3eac8e -r 7b872347d83b callcontinuity/vcchotrigger/src/vcchotrigger.cpp --- a/callcontinuity/vcchotrigger/src/vcchotrigger.cpp Tue Jan 26 11:50:49 2010 +0200 +++ b/callcontinuity/vcchotrigger/src/vcchotrigger.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -306,10 +306,16 @@ if ( iPreviousWlanClass == iWlanClass ) { - RUBY_DEBUG0( "No change in WLAN signal class -> return" ); - - return; - } + if (iWlanClass == ESignalClassWeak) + { + RUBY_DEBUG0( "Signal is still weak try again to do HO" ); + } + else + { + RUBY_DEBUG0( "No change in WLAN signal class -> return" ); + return; + } + } else { iPreviousWlanClass = iWlanClass; @@ -360,7 +366,7 @@ // If the previous class is the same as the new one // - do nothing. - if ( iPreviousGsmClass == iGsmClass ) + if ( iPreviousGsmClass == iGsmClass && iWlanClass != ESignalClassWeak ) { RUBY_DEBUG0( "No change in GSM signal class -> return" ); @@ -570,8 +576,8 @@ RUBY_DEBUG0( "VccHoTrigger::TriggerHo - no immediate HO" ); } - if ( iWlanClass == ESignalClassWeak && - iGsmClass == ESignalClassNormal && + if ( ( iWlanClass == ESignalClassWeak || iCchServiceStatus == EServiceUnavailable )&& + iGsmClass == ESignalClassNormal && ( iPolicy.AllowedDirection() & EPsToCsAllowed )) { RUBY_DEBUG0( "VccHoTrigger::WlanSignalChanged - NotifySubscriberL" ); @@ -657,7 +663,7 @@ } else if ( (iPolicy.PreferredDomain() == EPsPreferred) && - iWlanClass == ESignalClassNormal && + iWlanClass == ESignalClassNormal && iCchServiceStatus != EServiceUnavailable && ( iPolicy.AllowedDirection() & ECsToPsAllowed ) ) { // Current call is CS, PS signal is ok, preferred domain is PS and diff -r bfb1de3eac8e -r 7b872347d83b convergedconnectionhandler/cchclientapi/src/cchuiapiimpl.cpp --- a/convergedconnectionhandler/cchclientapi/src/cchuiapiimpl.cpp Tue Jan 26 11:50:49 2010 +0200 +++ b/convergedconnectionhandler/cchclientapi/src/cchuiapiimpl.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -711,6 +711,12 @@ MCchUiObserver::ECchUiClientOperationResultGeneralFailure; } + if ( iLastOperationResult != + MCchUiObserver::ECchUiClientOperationResultNotSet ) + { + InformObserversL( aResultParams.iServiceId ); + } + switch ( iLastOperationResult ) { case MCchUiObserver::ECchUiClientOperationResultAccessPointAdded: diff -r bfb1de3eac8e -r 7b872347d83b convergedconnectionhandler/cchserver/inc/cchsubserviceinfo.h --- a/convergedconnectionhandler/cchserver/inc/cchsubserviceinfo.h Tue Jan 26 11:50:49 2010 +0200 +++ b/convergedconnectionhandler/cchserver/inc/cchsubserviceinfo.h Tue Feb 02 00:05:57 2010 +0200 @@ -262,7 +262,11 @@ * Enable at start-up */ TBool iEnableAtStartUp; - + + /** + * Previous state of subservice + */ + TCCHSubserviceState iPreviousState; }; #endif // C_CCHSUBSERVICEINFO_H diff -r bfb1de3eac8e -r 7b872347d83b convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp --- a/convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp Tue Jan 26 11:50:49 2010 +0200 +++ b/convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -161,6 +161,13 @@ // void CCCHSubserviceInfo::SetState( const TCCHSubserviceState aState ) { + CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: iPreviousState = %d", + iState ); + CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", + aState ); + CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", + Type() ); + iPreviousState = iState; iState = aState; } @@ -235,20 +242,34 @@ iType ); CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iState %d", iState ); + CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iPreviousState %d", + iPreviousState ); CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iError %d", iError ); + + if( iPreviousState == ECCHUninitialized && iState == ECCHDisabled ) + { + CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Status not notified" ); + } + else + { + if ( iPreviousState == ECCHDisconnecting && iState == ECCHDisabled ) + { + iPreviousState = ECCHUninitialized; + } + CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Notify new status" ); + TServiceStatus serviceStatus; + serviceStatus.iConnectionInfo.iServiceSelection.iServiceId = iServiceId; + serviceStatus.iConnectionInfo.iServiceSelection.iType = iType; + serviceStatus.iConnectionInfo.iIapId = iIapId; + serviceStatus.iConnectionInfo.iSNAPId = iSNAPId; + serviceStatus.iConnectionInfo.iSNAPLocked = iSNAPLocked; + serviceStatus.iState = iState; + serviceStatus.iError = iError; - TServiceStatus serviceStatus; - serviceStatus.iConnectionInfo.iServiceSelection.iServiceId = iServiceId; - serviceStatus.iConnectionInfo.iServiceSelection.iType = iType; - serviceStatus.iConnectionInfo.iIapId = iIapId; - serviceStatus.iConnectionInfo.iSNAPId = iSNAPId; - serviceStatus.iConnectionInfo.iSNAPLocked = iSNAPLocked; - serviceStatus.iState = iState; - serviceStatus.iError = iError; - - // Send notify to clients - iServer.RequestStorage().NotifyServiceStatesChange( serviceStatus ); + // Send notify to clients + iServer.RequestStorage().NotifyServiceStatesChange( serviceStatus ); + } CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: OUT" ); } diff -r bfb1de3eac8e -r 7b872347d83b sipvoipprovider/inc/svpconsts.h --- a/sipvoipprovider/inc/svpconsts.h Tue Jan 26 11:50:49 2010 +0200 +++ b/sipvoipprovider/inc/svpconsts.h Tue Feb 02 00:05:57 2010 +0200 @@ -205,6 +205,9 @@ const TUint KSVPMaxLangCodeLength = 4; +//Logging +const TInt KSvpMaxDebugBufferSize = 256; + // ipapputils const TUint KSVPWlanMacAddressLength = 50; _LIT8 ( KSVPWlanMacAddressFrmt, "-" ); diff -r bfb1de3eac8e -r 7b872347d83b sipvoipprovider/inc/svpemergencyconnection.h --- a/sipvoipprovider/inc/svpemergencyconnection.h Tue Jan 26 11:50:49 2010 +0200 +++ b/sipvoipprovider/inc/svpemergencyconnection.h Tue Feb 02 00:05:57 2010 +0200 @@ -46,7 +46,8 @@ ESVPNone, ESVPSnapConnect, ESVPConnect, - ESVPSipProxyAddress + ESVPSipProxyAddress, + ESVPSipDomainAddress }; /** @@ -111,6 +112,10 @@ void RunL(); + TInt RunError( TInt aError ); + + void RequestSipServerDomainL(); + private: // data /** @@ -137,6 +142,11 @@ * SIP server address buffer */ TSipServerAddrBuf iSipServerAddrBuf; + + /** + * SIP server domain name buffer + */ + TSipServerDomainBuf iSipServerDomainBuf; /** * Connection diff -r bfb1de3eac8e -r 7b872347d83b sipvoipprovider/inc/svplogger.h --- a/sipvoipprovider/inc/svplogger.h Tue Jan 26 11:50:49 2010 +0200 +++ b/sipvoipprovider/inc/svplogger.h Tue Feb 02 00:05:57 2010 +0200 @@ -27,6 +27,7 @@ #include #include +#include "svpconsts.h" /***************************************************** * Format string for adding component to prints. @@ -41,7 +42,7 @@ */ static inline void PrintL( const TDesC& aStr ) { - HBufC* line = HBufC::NewLC( 256 ); + HBufC* line = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr( line->Des() ); ptr.Format( KSVPPrintFormatString(), &KComponent(), &aStr ); RDebug::Print( line->Des() ); @@ -57,11 +58,11 @@ */ static inline void PrintL( const TDesC& aStr, const TInt& aTInt ) { - HBufC* line1 = HBufC::NewLC( 256 ); + HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr1( line1->Des() ); ptr1.Format( aStr, aTInt ); - HBufC* line2 = HBufC::NewLC( 256 ); + HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr2( line2->Des() ); ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 ); RDebug::Print( line2->Des() ); @@ -77,11 +78,11 @@ */ static inline void PrintL( const TDesC& aStr, const TAny* aPtr ) { - HBufC* line1 = HBufC::NewLC( 256 ); + HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr1( line1->Des() ); ptr1.Format( aStr, aPtr ); - HBufC* line2 = HBufC::NewLC( 256 ); + HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr2( line2->Des() ); ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 ); RDebug::Print( line2->Des() ); @@ -99,11 +100,11 @@ const TInt& aTInt1, const TInt& aTInt2 ) { - HBufC* line1 = HBufC::NewLC( 256 ); + HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr1( line1->Des() ); ptr1.Format( aStr, aTInt1, aTInt2 ); - HBufC* line2 = HBufC::NewLC( 256 ); + HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr2( line2->Des() ); ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 ); RDebug::Print( line2->Des() ); @@ -123,11 +124,11 @@ const TInt& aTInt, const TDesC* aStr2 ) { - HBufC* line1 = HBufC::NewLC( 256 ); + HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr1( line1->Des() ); ptr1.Format( aStr1, aTInt, aStr2 ); - HBufC* line2 = HBufC::NewLC( 256 ); + HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize ); TPtr ptr2( line2->Des() ); ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 ); RDebug::Print( line2->Des() ); diff -r bfb1de3eac8e -r 7b872347d83b sipvoipprovider/src/svpemergencyconnection.cpp --- a/sipvoipprovider/src/svpemergencyconnection.cpp Tue Jan 26 11:50:49 2010 +0200 +++ b/sipvoipprovider/src/svpemergencyconnection.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -195,45 +195,117 @@ void CSVPEmergencyConnection::RunL() { TInt error = iStatus.Int(); - SVPDEBUG2("CSVPEmergencyConnection::RunL(), error: %d", error) + SVPDEBUG2( "CSVPEmergencyConnection::RunL(), error: %d", error ) + SVPDEBUG2( "CSVPEmergencyConnection::RunL(), Request type: %d", iRequestType ) - if ( error ) - { - iRequestType = ESVPNone; - iObserver.ConnectionError( error ); - return; - } - + // execution goes to RunError() if error occured + User::LeaveIfError( iStatus.Int() ); switch ( iRequestType ) { case ESVPSnapConnect: + SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSnapConnect" ) iRequestType = ESVPNone; iObserver.SnapConnected(); break; case ESVPConnect: + SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPConnect" ) iRequestType = ESVPNone; iObserver.Connected(); break; case ESVPSipProxyAddress: { + SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSipProxyAddress" ) iRequestType = ESVPNone; // Copy SIP proxy address in dotted-decimal notation HBufC16* sipProxyAddrBuf = HBufC16::NewLC( 39 ); // CS:1 TPtr16 sipProxyAddrPtr = sipProxyAddrBuf->Des(); iSipServerAddrBuf().address.Output( sipProxyAddrPtr ); - + SVPDEBUG2( + "CSVPEmergencyConnection::RunL(), iSipServerAddrBuf: %S", + sipProxyAddrBuf ) // Call observer iObserver.SipProxyAddressReady( *sipProxyAddrBuf ); CleanupStack::PopAndDestroy( sipProxyAddrBuf ); // CS:0 break; } + case ESVPSipDomainAddress: + { + SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSipDomainAddress" ) + iRequestType = ESVPNone; + + // Copy SIP proxy domain in dotted-decimal notation + HBufC16* sipDomainAddrBuf = HBufC16::NewLC( iSipServerDomainBuf().domainName.Length() ); // CS:1 + TPtr16 sipDomainAddrPtr = sipDomainAddrBuf->Des(); + sipDomainAddrPtr.Copy( iSipServerDomainBuf().domainName ); + SVPDEBUG2( + "CSVPEmergencyConnection::RunL(), iSipDomainAddrBuf: %S", + sipDomainAddrBuf ) + // Call observer + iObserver.SipProxyAddressReady( *sipDomainAddrBuf ); + CleanupStack::PopAndDestroy( sipDomainAddrBuf ); // CS:0 + break; + } default: + SVPDEBUG1( "CSVPEmergencyConnection::RunL() - Default" ) iRequestType = ESVPNone; iObserver.ConnectionError( KErrGeneral ); break; } } + +// --------------------------------------------------------------------------- +// CSVPEmergencyConnection::RunError +// +// --------------------------------------------------------------------------- +// +TInt CSVPEmergencyConnection::RunError( TInt aError ) + { + SVPDEBUG2( "CSVPEmergencyConnection::RunError() %d", aError ) + if ( iRequestType == ESVPSipProxyAddress ) + { + /* + * sip proxy address might be NULL if requested with KConnGetSipServerAddr + * and dhcp returns domain name to sip, instead of ipv4 or ipv6 type address. + * So try once again with KConnGetSipServerDomain. + */ + SVPDEBUG1( "CSVPEmergencyConnection::RunError() - RequestDomain" ) + RequestSipServerDomainL(); + return KErrNone; + } + else + { + iRequestType = ESVPNone; + SVPDEBUG2( "CSVPEmergencyConnection::RunError() - Notify Observer ConnectionError( %d )", aError ) + iObserver.ConnectionError( aError ); + return KErrNone; + } + } + +// --------------------------------------------------------------------------- +// Requests for SIP proxy address +// --------------------------------------------------------------------------- +// +void CSVPEmergencyConnection::RequestSipServerDomainL() + { + SVPDEBUG1( + "CSVPEmergencyConnection::RequestSipServerDomainL() - Try to get Sip server domain" ) + + if ( IsActive() ) + { + User::Leave( KErrInUse ); + } + + iRequestType = ESVPSipDomainAddress; + iSipServerDomainBuf().index = 0; + // Request SIP server domain + iConnection.Ioctl( + KCOLConfiguration, + KConnGetSipServerDomain, // domain in textual format + iStatus, + &iSipServerDomainBuf ); + SetActive(); + } diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/ipapputils/src/cipappphoneutils.cpp --- a/voipplugins/ipapputils/src/cipappphoneutils.cpp Tue Jan 26 11:50:49 2010 +0200 +++ b/voipplugins/ipapputils/src/cipappphoneutils.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/group/bld.inf --- a/voipplugins/voipadapters/group/bld.inf Tue Jan 26 11:50:49 2010 +0200 +++ b/voipplugins/voipadapters/group/bld.inf Tue Feb 02 00:05:57 2010 +0200 @@ -28,6 +28,7 @@ #include "../dmvoipadapter/group/bld.inf" #include "../cpvoipadapter/group/bld.inf" #include "../provisioningfile/group/bld.inf" +#include "../voipxmlprovisioning/group/bld.inf" PRJ_TESTMMPFILES // End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/group/bld.inf Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Common build definition file for S60 Skype +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +#include "../voipxmlprocessor/group/bld.inf" +#include "../provisioningappui/group/bld.inf" +#include "../provisioningrecognizer/group/bld.inf" + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd-key.pem --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd-key.pem Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4 +6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh +7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB +gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX +pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB +yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j +KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003 +iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3 +2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+ +9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0 +aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO +TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8 +mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ= +-----END RSA PRIVATE KEY----- diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd.cer --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd.cer Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD +ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z +NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl +cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT +rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa +gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI +f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL +BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud +IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD +ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd +IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE +IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G +CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9 +Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT +7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR +-----END CERTIFICATE----- diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/install/create_sis_udeb.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/install/create_sis_udeb.bat Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,17 @@ +rem +rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +call createsis create -key .\RD_RootCA\rd-key.pem -cert .\RD_RootCA\rd.cer settings.pkg diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/install/settings.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/install/settings.pkg Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,47 @@ +; +; Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + +;Languages +&EN + +;Header +#{"S60 settings provision"},(0x20021999),1,0,0, TYPE=SA + + +;Series 60 v5.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files to install + + + +;PROVISIONRECONIZER +"\epoc32\release\armv5\udeb\VoIPProvRec.dll"-"!:\sys\bin\VoIPProvRec.dll" +"\epoc32\data\Z\Resource\Plugins\VoIPProvRec.rsc" -"!:\resource\plugins\VoIPProvRec.rsc" + +;PROVISIONINGAPPUI +"\epoc32\release\armv5\udeb\VoIPProvisioningApp.exe"-"!:\sys\bin\VoIPProvisioningApp.exe" +"\epoc32\data\z\resource\apps\VoIPProvisioningApp.rsc"-"!:\resource\apps\VoIPProvisioningApp.rsc" +"\epoc32\data\z\private\10003a3f\apps\VoIPProvisioningApp_reg.rsc"-"!:\private\10003a3f\import\apps\VoIPProvisioningApp_reg.rsc" + +;VOIPXMLPROCESSOR +"\epoc32\release\armv5\udeb\voipxmlprocessor.dll"-"!:\sys\bin\voipxmlprocessor.dll" diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/install/settings_for_MCL.SIS Binary file voipplugins/voipadapters/voipxmlprovisioning/install/settings_for_MCL.SIS has changed diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningAppAif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningAppAif.rss Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include + +RESOURCE AIF_DATA + { + app_uid = 0x10281F1A; + hidden = KAppIsHidden; + num_icons = 0; + embeddability = KAppNotEmbeddable; + newfile = KAppDoesNotSupportNewFile; + datatype_list= + { + DATATYPE { priority=EDataTypePriorityHigh; type="vnd.nokia.iptv.config+xml"; }, + DATATYPE { priority=EDataTypePriorityHigh; type="application/vnd.nokia.iptv.config+xml"; } + }; + } diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningApp_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningApp_caption.rss Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include + +RESOURCE CAPTION_DATA + { + caption = " "; + shortcaption = " "; + } + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp.rss Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UI resource file. +* +*/ + + +// RESOURCE IDENTIFIER +NAME VPRA + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +RESOURCE EIK_APP_INFO + { + status_pane=R_AVKON_STATUS_PANE_LAYOUT_EMPTY; + } + +//---------------------------------------------------- +// r_voip_provisioning_query_install_service +// Query dialog for VoIP service installation. +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_voip_provisioning_query_install_service + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + label = qtn_voip_settings_title; + layout = EConfirmationQueryLayout; + }; + } + }; + } + +// --------------------------------------------------------------------------- +// r_voip_default_save_query +// Text to be shown in installation query if no text is retreived from XML. +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_voip_default_save_query + { + buf = qtn_form_litxt_save; + } + +// --------------------------------------------------------------------------- +// r_voip_invalid_data +// Text to be shown after failed installation. +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_voip_invalid_data + { + buf = qtn_voip_csc_error_note_unable_to_configure; + } + +// --------------------------------------------------------------------------- +// r_voip_installed +// Text to show after successful installation. +// +// --------------------------------------------------------------------------- +// +RESOURCE TBUF r_voip_installed + { + buf = qtn_form_conf_saved; + } + +// --------------------------------------------------------------------------- +// r_waitnote_configure +// Wait note to be shown +// --------------------------------------------------------------------------- +// +RESOURCE DIALOG r_waitnote_configure + { + flags = EAknWaitNoteFlags|EEikDialogFlagNotifyEsc; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_gen_note_saving; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp_reg.rss Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application registration resource file. +* +*/ + + +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x20026FE3 // application UID + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "VoIPProvisioningApp"; + hidden = KAppIsHidden; + + datatype_list = + { + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "vnd.nokia.voip.config+xml"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type="application/vnd.nokia.voip.config+xml"; + } + }; + } diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/tempbranddatapackage.zip Binary file voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/tempbranddatapackage.zip has changed diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningApp.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application definition. +* +*/ + + +#ifndef CVOIPPROVISIONINGAPP_H +#define CVOIPPROVISIONINGAPP_H + +#ifdef _DEBUG +#define EUNIT_FRIEND_CLASS( x ) friend class x; +#else +#define EUNIT_FRIEND_CLASS( x ) +#endif + +// INCLUDES +#include + +// CONSTANTS +const TUid KUidVoIPProvisioningAppUid = { 0x20026FE3 }; + +// CLASS DECLARATION +/** +* Application class definition +*/ +class CVoIPProvisioningApp : public CAknApplication + { + private: // from CApaApplication + /** + * Create CVoIPProvisioningDocument document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * Return CVoIPProvisioningApp uid. + */ + TUid AppDllUid() const; + + EUNIT_FRIEND_CLASS( UT_CVoIPProvisioningApp ) + }; + +#endif // CVOIPPROVISIONINGAPP_H + +// End of File + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningAppUi.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application UI definition. +* +*/ + + +#ifndef VOIPPROVISIONINGAPPUI_H +#define VOIPPROVISIONINGAPPUI_H + +#ifdef _DEBUG +#define EUNIT_FRIEND_CLASS( x ) friend class x; +#else +#define EUNIT_FRIEND_CLASS( x ) +#endif + +// INCLUDES +#include +#include + +class CAknWaitDialog; + +/** +* CVoIPProvisioningAppUi class. +* This class handles the operation betweed provisioning processor, +* notifier framework (asks if user want to install parsed service) +* and service api (used to add service to the database if user has +* decided so) +*/ +class CVoIPProvisioningAppUi : public CAknAppUi, + public MHttpDownloadMgrObserver + { +public: + + CVoIPProvisioningAppUi(); + virtual ~CVoIPProvisioningAppUi(); + + /** + * Method to be called for CVoIPProvisioningDocument when + * that classes OpenFileL method has been called and file + * containing the data to be parsed is received. + * + * @since S60 v5.0 + * @param aFile File handle to XML file. + */ + void HandleFileL( RFile& aFile ); + + /** + * Overwritten method from CEikAppUi. This method gets called + * when application is started by framework when file, which has + * mime type this applicaion knows, has been selected to be + * opened. + * + * @since S60 v5.0 + * @param aCommand Type of the command + * @param aDocumentName Name of the document to be opened + * When starting up application this value + * is empty + * @param aTail Command line's tail. Not used in this implementation. + * @return ETrue if aDocument represents an existing file, otherwise + * EFalse. + */ + TBool ProcessCommandParametersL( TApaCommand aCommand, + TFileName& aDocumentName, const TDesC8& aTail ); + +protected: + + /** + * Indicates an event. + * + * @since S60 v5.0 + * @param aDownload The download with which the event occured. + * @param aEvent Event type. + */ + void HandleDMgrEventL( RHttpDownload& aDownload, + THttpDownloadEvent aEvent ); + +private: + + /** + * Show invalid data note. + * + * @since S60 v5.0 + */ + void ShowFailNoteL() const; + + /** + * Show done note. + * + * @since S60 v5.0 + */ + void ShowDoneNoteL() const; + + /** + * Fetches, i.e. downloads branding data from given URL. + * + * @since S60 v5.0 + * @param aUrl URL from which branding data is downloaded. + */ + TInt FetchBrandingDataL( const TDesC8& aUrl ); + + /** + * Uncompresses (unzips) files from GZip file. + * + * @since S60 v5.0 + */ + void UncompressFilesL(); + +private: + void ConstructL(); +private: + /** + * Download manager. + */ + RHttpDownloadMgr iDownloadMgr; + + /** + * File name of branding zip. + */ + TFileName iBrandPackageName; + + /** + * Wait dialog. + * Own. + */ + CAknWaitDialog* iWaitDialog; + + EUNIT_FRIEND_CLASS( UT_CVoIPProvisioningAppUi ) + }; + +#endif // VOIPPROVISIONINGAPPUI_H + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningDocument.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Document definition. +* +*/ + + +#ifndef VoIPPROVISIONINGDOCUMENT_H +#define VoIPPROVISIONINGDOCUMENT_H + +#ifdef _DEBUG +#define EUNIT_FRIEND_CLASS( x ) friend class x; +#else +#define EUNIT_FRIEND_CLASS( x ) +#endif + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CEikAppUi; +class CVoIPProvisioningAppUi; + +// CLASS DECLARATION +/** +* CVoIPProvisioningDocument application class. +*/ +class CVoIPProvisioningDocument : public CAknDocument + { + public: + /** + * C++ constructor. + * @param CEikApplication& aApp + * @return void + */ + CVoIPProvisioningDocument( CEikApplication& aApp ) : + CAknDocument(aApp) { } + + /** + * Destructor. + * @param None + * @return void + */ + virtual ~CVoIPProvisioningDocument(); + + + // From CEikDocument. + CFileStore* OpenFileL( TBool aDoOpen, const TDesC& aFilename, RFs& aFs ); + void OpenFileL( CFileStore*& aFileStore, RFile& aFile ); + + private: + /** + * C++ default constructor. + * @param None + * @return void + */ + CVoIPProvisioningDocument(); + + /** + * This method makes an application hidden so that it is not visible + * for example in Applications list and FastSwap window. + * @param CApaWindowGroupName* aWgName + * @return void + */ + void UpdateTaskNameL( CApaWindowGroupName* aWgName ); + + private:// from CAknDocument + /** + * Create CVoIPProvisioningDocument "App UI" object. + * @param None + * @return CEikAppUi* + */ + CEikAppUi* CreateAppUiL(); + + EUNIT_FRIEND_CLASS( UT_CVoIPProvisioningDocument ) + }; + +#endif // VoIPPROVISIONINGDOCUMENT_H + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/voipprovisioningapp.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/voipprovisioningapp.loc Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Localisation file. +* +*/ + + +// LOCALISATION STRINGS + +// Installation query string. +#define qtn_voip_prov_installation_query_string "Install VoIP service?" + +// Note for successful installation. +#define qtn_voip_prov_installation_success "VoIP service installed" + +// Note for failed installation. +#define qtn_voip_prov_installation_failed "Installation failed" + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningApp.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application implementation. +* +*/ + + +// INCLUDE FILES +#include +#include "VoIPProvisioningApp.h" +#include "VoIPProvisioningDocument.h" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CVoIPProvisioningApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------------------------- + +TUid CVoIPProvisioningApp::AppDllUid() const + { + return KUidVoIPProvisioningAppUid; + } + +// --------------------------------------------------------------------------- +// CVoIPProvisioningApp::CreateDocumentL() +// Creates CVoIPProvisioningDocument object +// --------------------------------------------------------------------------- + +CApaDocument* CVoIPProvisioningApp::CreateDocumentL() + { + return new (ELeave) CVoIPProvisioningDocument( *this ); + } + +// ===================== OTHER EXPORTED FUNCTIONS ============================ + +LOCAL_C CApaApplication* NewApplication() + { + return new CVoIPProvisioningApp; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + + +// End of File + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningAppUi.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application UI implementation. +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include // RApaLsSession +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voipxmlparser.h" +#include "VoIPProvisioningAppUi.h" +#include "VoIPProvisioningApp.h" +#include "VoIPProvisioningDocument.h" + +const TInt KOneSecond( 1000000 ); +const TUid KMecoServiceTabUid = {0x20012423}; +const TInt KFiveTimes( 5 ); +_LIT( KDownloadFileName, "tempbranddatapackage.zip" ); +_LIT( KBrandMifPath, ":\\private\\102828DD\\import\\" ); +_LIT( KBrandInstallPath, ":\\private\\102828DD\\import\\install\\" ); +_LIT( KBrandXmlPath, ":\\private\\102828E1\\import\\" ); +_LIT( KXmlExtension, ".xml" ); +_LIT( KMifExtension, ".mif" ); +_LIT( KInstallExtension, ".install" ); +_LIT8( KZipExtension, ".zip" ); + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::CVoIPProvisioningAppUi +// ---------------------------------------------------------------------------- +// +CVoIPProvisioningAppUi::CVoIPProvisioningAppUi() + { + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::ConstructL +// ---------------------------------------------------------------------------- + +void CVoIPProvisioningAppUi::ConstructL() + { + // Call base classes ConstructL method. + BaseConstructL( ENoScreenFurniture | EAknEnableMSK ); + + StatusPane()->MakeVisible( EFalse ); + HideApplicationFromFSW( ETrue ); + + iBrandPackageName.Copy( PathInfo::PhoneMemoryRootPath() ); + iBrandPackageName.Append( PathInfo::OthersPath() ); + iBrandPackageName.Append( KDownloadFileName ); + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::~CVoIPProvisioningAppUi +// ---------------------------------------------------------------------------- +// +CVoIPProvisioningAppUi::~CVoIPProvisioningAppUi() + { + iDownloadMgr.Close(); + if ( iWaitDialog ) + { + TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); + iWaitDialog = NULL; + } + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::ProcessCommandParametersL +// ---------------------------------------------------------------------------- +// +TBool CVoIPProvisioningAppUi::ProcessCommandParametersL( + TApaCommand /*aCommand*/, TFileName& /*aDocumentName*/, + const TDesC8& /*aTail*/ ) + { + // Always return ETrue to make CVoIPProvisioningDocument's + // OpenFileL to be called. + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::HandleFileL +// ---------------------------------------------------------------------------- +// +void CVoIPProvisioningAppUi::HandleFileL( RFile& aFile ) + { + RFile file; + User::LeaveIfError( file.Duplicate( aFile ) ); + CVoipXmlParser* parser = CVoipXmlParser::NewLC(); // CS:1 + TBuf8 brandUrl( KNullDesC8 ); + HBufC* queryText = parser->ReadDescriptionLC( aFile, brandUrl ); // CS:2 + if ( !queryText->Des().Length() ) + { + CleanupStack::PopAndDestroy( queryText ); + queryText = NULL; + queryText = StringLoader::LoadLC( R_VOIP_DEFAULT_SAVE_QUERY ); + } + CAknQueryDialog* query = CAknQueryDialog::NewL(); + CleanupStack::PushL( query ); // CS:3 + query->SetPromptL( queryText->Des() ); + TBool launchTab( EFalse ); + TUint32 serviceTabId; + if ( query->ExecuteLD( R_VOIP_PROVISIONING_QUERY_INSTALL_SERVICE ) ) + { + iWaitDialog = new( ELeave ) CAknWaitDialog( + REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ); + iWaitDialog->SetTone( CAknNoteDialog::ENoTone ); + iWaitDialog->ExecuteLD( R_WAITNOTE_CONFIGURE ); + + FetchBrandingDataL( brandUrl ); + + // Start phonebook into backgound. + RxSPViewServices viewServices; + CleanupClosePushL( viewServices ); // CS:4 + TInt viewSrvErr = viewServices.Open(); + if ( KErrServerTerminated == viewSrvErr || KErrNotFound == viewSrvErr ) + { + viewServices.Close(); + viewSrvErr = viewServices.Open(); + } + if ( KErrNone == viewSrvErr ) + { + viewServices.Close(); + } + + // Ownership of file is trasferred. + TInt error = parser->ImportDocument( file, serviceTabId ); + if ( KErrNone == error ) + { + iWaitDialog->ProcessFinishedL(); + iWaitDialog = NULL; + ShowDoneNoteL(); + launchTab = ETrue; + } + else + { + iWaitDialog->ProcessFinishedL(); + iWaitDialog = NULL; + ShowFailNoteL(); + } + CleanupStack::PopAndDestroy( &viewServices ); // CS:3 + } + CleanupStack::Pop( query ); // CS:2 + // queryText, parser + CleanupStack::PopAndDestroy( 2, parser ); // CS:0 + + // Launch service tab. + if ( launchTab ) + { + TInt err = KErrNotFound; + TInt counter( 0 ); + RxSPViewServices viewServices; + CleanupClosePushL( viewServices ); // CS:1 + while ( KErrNone != err && KFiveTimes > counter ) + { + err = viewServices.Activate( + KMecoServiceTabUid.iUid, (TInt32)serviceTabId ); + if ( KErrServerTerminated == err || KErrNotFound == err ) + { + err = viewServices.Activate( + KMecoServiceTabUid.iUid, (TInt32)serviceTabId ); + } + // Wait... + User::After( KOneSecond ); + counter++; + } + + CleanupStack::PopAndDestroy( &viewServices ); // CS:0 + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + TApaTask browserTask = taskList.FindApp( KCRUidBrowser ); + if ( browserTask.Exists() ) + { + browserTask.EndTask(); + } + } + + if ( iWaitDialog ) + { + iWaitDialog->ProcessFinishedL(); + iWaitDialog = NULL; + } + + iDownloadMgr.Close(); +#ifndef __EUNIT_TESTING + User::Exit( KErrNone ); +#endif + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::ShowFailNoteL +// ---------------------------------------------------------------------------- +// +void CVoIPProvisioningAppUi::ShowFailNoteL() const + { + HBufC* text = StringLoader::LoadLC( R_VOIP_INVALID_DATA ); + CAknErrorNote* note = new (ELeave) CAknErrorNote( R_AKN_ERROR_NOTE ); + note->ExecuteLD( *text ); + CleanupStack::PopAndDestroy( text ); + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningAppUi::ShowDoneNoteL +// ---------------------------------------------------------------------------- +// +void CVoIPProvisioningAppUi::ShowDoneNoteL() const + { + HBufC* text = StringLoader::LoadLC( R_VOIP_INSTALLED ); + CAknInformationNote* note = + new (ELeave) CAknInformationNote( R_AKN_INFORMATION_NOTE ); + note->ExecuteLD( *text ); + CleanupStack::PopAndDestroy( text ); + } + +// --------------------------------------------------------------------------- +// From base class MHttpDownloadMgrObserver. +// Handles download manager events. +// --------------------------------------------------------------------------- +// +void CVoIPProvisioningAppUi::HandleDMgrEventL( RHttpDownload& aDownload, + THttpDownloadEvent aEvent ) + { + if ( EHttpDlPaused == aEvent.iDownloadState && + EHttpContentTypeReceived == aEvent.iProgressState ) + { + TInt32 length; + TInt err = aDownload.GetIntAttribute( EDlAttrLength, length ); + if ( KDefaultContentLength != length && 0 < length ) + { + // Continue. + aDownload.Start(); + } + else + { + CActiveScheduler::Stop(); + aDownload.Delete(); + } + } + else if ( EHttpDlCompleted == aEvent.iDownloadState ) + { + CActiveScheduler::Stop(); + // We don't need the leave code; un-branded service is OK. + TRAP_IGNORE( UncompressFilesL() ); + aDownload.Delete(); + } + else if ( EHttpDlFailed == aEvent.iDownloadState ) + { + CActiveScheduler::Stop(); + aDownload.Delete(); + } + else if ( EHttpDlInprogress == aEvent.iDownloadState && + EHttpProgDisconnected == aEvent.iProgressState ) + { + CActiveScheduler::Stop(); + aDownload.Delete(); + } + } + +// --------------------------------------------------------------------------- +// Starts branding data download. +// --------------------------------------------------------------------------- +// +TInt CVoIPProvisioningAppUi::FetchBrandingDataL( const TDesC8& aUrl ) + { + if ( !aUrl.Length() || KErrNotFound == aUrl.Find( KZipExtension ) ) + { + return KErrNotFound; + } + iDownloadMgr.ConnectL( KUidVoIPProvisioningAppUid, *this, EFalse ); + RHttpDownload& download = iDownloadMgr.CreateDownloadL( aUrl ); + download.SetStringAttribute( EDlAttrDestFilename, iBrandPackageName ); + TInt err = download.Start(); + CActiveScheduler::Start(); + return err; + } + +// --------------------------------------------------------------------------- +// Uncompresses files from a zip file. +// --------------------------------------------------------------------------- +// +void CVoIPProvisioningAppUi::UncompressFilesL() + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); // CS:1 + CZipFile* zipfile = CZipFile::NewL( fs, iBrandPackageName ); + CleanupStack::PushL( zipfile ); // CS:2 + CZipFileMemberIterator* iterator = zipfile->GetMembersL(); + CleanupStack::PushL( iterator ); // CS:3 + CZipFileMember* fileMember = iterator->NextL(); + TChar drive; + DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ); + + RFile output; + CleanupClosePushL( output ); // CS:4 + + while ( fileMember ) + { + TFileName memberFileName = *fileMember->Name(); + TFileName outputPath; + outputPath.Append( drive ); + if ( KErrNotFound != memberFileName.Find( KXmlExtension ) ) + { + outputPath.Append( KBrandXmlPath ); + outputPath.Append( memberFileName ); + } + else if ( KErrNotFound != memberFileName.Find( KInstallExtension )) + { + outputPath.Append( KBrandInstallPath ); + outputPath.Append( memberFileName ); + } + else if ( KErrNotFound != memberFileName.Find( KMifExtension )) + { + outputPath.Append( KBrandMifPath ); + outputPath.Append( memberFileName ); + } + else + { + // Ignore this file and get next file from zip. + fileMember = iterator->NextL(); + break; + } + + TInt err = fs.MkDirAll( outputPath ); + err = output.Replace( fs, outputPath, EFileShareAny|EFileWrite ); + + TUint32 size = fileMember->UncompressedSize(); + RBuf8 outputData; + outputData.CreateL( size ); + CleanupClosePushL( outputData ); // CS:5 + RZipFileMemberReaderStream* stream; + zipfile->GetInputStreamL( fileMember, stream ); + CleanupStack::PushL( stream ); // CS:6 + + err = stream->Read( outputData, size ); + err = output.Write( outputData ); + + output.Flush(); + + // stream, &outputData + CleanupStack::PopAndDestroy( 2, &outputData ); // CS:4 + + fileMember = iterator->NextL(); + } + // &output, iterator, zipfile, &fs + CleanupStack::PopAndDestroy( 3, zipfile ); // CS:1 + + // Finally, delete temp zip file. + fs.Delete( iBrandPackageName ); + CleanupStack::PopAndDestroy( &fs ); // CS:0 + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningDocument.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Document implementation. +* +*/ + + +// INCLUDE FILES +#include +#include "VoIPProvisioningDocument.h" +#include "VoIPProvisioningAppUi.h" + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningDocument::~CVoIPProvisioningDocument() +// ---------------------------------------------------------------------------- + +CVoIPProvisioningDocument::~CVoIPProvisioningDocument() + { + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningDocument::CreateAppUiL() +// Creates CVoIPProvisioningAppUi +// ---------------------------------------------------------------------------- +CEikAppUi* CVoIPProvisioningDocument::CreateAppUiL() + { + // Create new instance of appui class + return new (ELeave) CVoIPProvisioningAppUi(); + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) +// ---------------------------------------------------------------------------- +void CVoIPProvisioningDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) + { + // Set task name to be hidden from the tasklist + CAknDocument::UpdateTaskNameL( aWgName ); + aWgName->SetHidden( ETrue ); + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningDocument::OpenFileL +// ---------------------------------------------------------------------------- +CFileStore* CVoIPProvisioningDocument::OpenFileL( TBool aDoOpen, + const TDesC& aFilename, RFs& aFs ) + { + if ( aDoOpen ) + { + RFile file; + TInt error( file.Open( aFs, aFilename, EFileShareAny | EFileRead ) ); + if ( error == KErrNone ) + { + static_cast(iAppUi)->HandleFileL( file ); + } + } + + return NULL; + } + +// ---------------------------------------------------------------------------- +// CVoIPProvisioningDocument::OpenFileL +// ---------------------------------------------------------------------------- +void CVoIPProvisioningDocument::OpenFileL( CFileStore*& /*aFileStore*/, + RFile& aFile ) + { + // Request appui to handle this file + static_cast( iAppUi )->HandleFileL( aFile ); + } + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/VoIPProvisioningApp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/VoIPProvisioningApp.mmp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project description file. +* +*/ + + +#include +#include +#include + +ALWAYS_BUILD_AS_ARM + +TARGET voipprovisioningapp.exe +TARGETTYPE exe +UID 0x0 0x20026FE3 +TARGETPATH PROGRAMS_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_APPLICATION PowerMgmt AllFiles -DRM + +SOURCEPATH ../Src +SOURCE VoIPProvisioningApp.cpp +SOURCE VoIPProvisioningAppUi.cpp +SOURCE VoIPProvisioningDocument.cpp + +START RESOURCE ../Data/VoIPProvisioningApp.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END // RESOURCE + +START RESOURCE ../Data/VoIPProvisioningApp_reg.rss +HEADER +TARGETPATH /private/10003a3f/apps +END + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../voipxmlprocessor/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY eiksrv.lib +LIBRARY ws32.lib +LIBRARY apgrfx.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY voipxmlprocessor.lib +LIBRARY CommonEngine.lib // For StringLoader. +LIBRARY ecom.lib // For REComSession. +LIBRARY flogger.lib +LIBRARY xspviewservices.lib // For launching service tab. +LIBRARY DownloadMgr.lib +LIBRARY PlatformEnv.lib +LIBRARY ezip.lib + +// End of File + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/bld.inf Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build description file. +* +*/ + + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_EXPORTS + +PRJ_MMPFILES +VoIPProvisioningApp.mmp + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/data/20026FE1.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/data/20026FE1.rss Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom resource file. +* +*/ + + +#include + +RESOURCE REGISTRY_INFO r_registry +{ + dll_uid = 0x20026FE1; // dll uid + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101F7D87; // Const for all data recognizers + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x20026FE2; // implementation uid + version_no = 1; + display_name = "VoIP provisioning recognizer"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; +} diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/VoIPProvisioningRecognizer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/VoIPProvisioningRecognizer.mmp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project description file. +* +*/ + + + + +#include + +//OPTION ARMCC --asm --interleave +ALWAYS_BUILD_AS_ARM + +TARGET voipprovrec.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20026FE1 + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../data + +START RESOURCE 20026FE1.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET VoIPProvRec.rsc +#endif +END + +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE VoIPProvisioningRecognizer.cpp + +USERINCLUDE ../inc +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUSER.LIB +LIBRARY APMIME.LIB + +// END OF FILE + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/bld.inf Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build description file. +* +*/ + + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_MMPFILES +VoIPProvisioningRecognizer.mmp diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/inc/VoIPProvisioningRecognizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/inc/VoIPProvisioningRecognizer.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CVoIPProvisioningRecognizer definition. +* +*/ + + +#ifndef VOIPPROVISIONINGRECOGNIZER_H +#define VOIPPROVISIONINGRECOGNIZER_H + +// INCLUDES +#include + +// DEFINITIONS + +// Uid of this dll (defined in .mmp file) +const TUid KUidMimeVoIPProvisioningRecognizer = { 0x20026FE1 }; + +// Implementation uid for this recognizer +const TInt KVoIPProvRecImplUIDValue = 0x20026FE2; +const TUid KUidVoIPProvRecImpl = { KVoIPProvRecImplUIDValue }; + +// Amount of mime types this recognizer can handle +const TInt KVoIPSupportedMimeTypes( 2 ); + +// Exported mime types +_LIT8( KVoIPConfMimetypeSimple, "vnd.nokia.voip.config+xml" ); +_LIT8( KVoIPConfMimetypeApplication, "application/vnd.nokia.voip.config+xml" ); + +// Strings to be searched to recognize content +_LIT8( KVoIPXMLTag, "nokia-confdoc" ); + +#ifdef _DEBUG +#define EUNIT_TEST_FRIEND( x ) friend class x; +#else +#define EUNIT_TEST_FRIEND( x ) +#endif + +/** + * Class to make recognisation for VoIP configuration XML file. + * + * @since S60 v5.0 + * @lib voipprovrec.lib + */ +class CVoIPProvisioningRecognizer : public CApaDataRecognizerType + { +public: + + /** + * Default constructor. Calls CApaDataRecognizerType in it's + * initializer list to complete construction. + */ + CVoIPProvisioningRecognizer(); + + /** + * Static method to create instance of this recognizer. + * This method is called by the framework. + * Method pointer is delivered to the framework by ImplementationTable + * table returned by ImplementationGroupProxy. + * + * @since S60 v5.0 + * @return Pointer to newly created instance of the recognizer. + */ + static CApaDataRecognizerType* CreateRecognizerL(); + + /** + * Method called by the framework. + * This method returns the desired amount of data for recognition. + * + * @since S60 v5.0 + * @return Preferred buffer size for recognition. + */ + virtual TUint PreferredBufSize(); + + /** + * Method to deliver supported data types by this recognizer. + * + * @since S60 v5.0 + * @param aIndex Index pointing out which data type of the supported + * ones is returned. + * @return Corresponding data type of the requested index. + */ + virtual TDataType SupportedDataTypeL( TInt aIndex ) const; + +private: // From CApaDataRecognizerType + + /** + * Overwritten method to handle recognisation. + * + * @since S60 v5.0 + * @param aName The name of the data; typically this is a file name + * containing the data to be recognized. + * @param aBuffer Buffer containing PreferredBufSize() from + * the beginning of the file to be recognized. + */ + virtual void DoRecognizeL( const TDesC& /*aName*/, const TDesC8& aBuffer ); + + EUNIT_TEST_FRIEND( UT_CVoIPProvisioningRecognizer ) + }; + +#endif // VOIPPROVISIONINGRECOGNIZER_H diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/src/VoIPProvisioningRecognizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/src/VoIPProvisioningRecognizer.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CVoIPProvisioningRecognizer implementation. +* +*/ + + +#include "VoIPProvisioningRecognizer.h" +#include "ecom/implementationproxy.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------- +// CVoIPProvisioningRecognizer::CVoIPProvisioningRecognizer +// Default constructor +// --------------------------------------------------------- +// +CVoIPProvisioningRecognizer::CVoIPProvisioningRecognizer() : + CApaDataRecognizerType( KUidMimeVoIPProvisioningRecognizer, + CApaDataRecognizerType::EHigh ) + { + iCountDataTypes = KVoIPSupportedMimeTypes; + } + +// --------------------------------------------------------- +// CVoIPProvisioningRecognizer::PreferredBufSize +// Overwritten method from CApaDataRecognizerType +// --------------------------------------------------------- +// +TUint CVoIPProvisioningRecognizer::PreferredBufSize() + { + return 0x200; + } + +// --------------------------------------------------------- +// CVoIPProvisioningRecognizer::SupportedDataTypeL +// Overwritten method from CApaDataRecognizerType +// --------------------------------------------------------- +// +TDataType CVoIPProvisioningRecognizer::SupportedDataTypeL( TInt aIndex ) const + { + __ASSERT_DEBUG( aIndex >= 0 && + aIndex < KVoIPSupportedMimeTypes, User::Leave( KErrArgument ) ); + + switch( aIndex ) + { + case 0: + { + TDataType type( KVoIPConfMimetypeSimple ); + return type; + } + case 1: + { + TDataType type( KVoIPConfMimetypeApplication ); + return type; + } + default: + break; + } + + return TDataType(); + } + +// --------------------------------------------------------------------------- +// CVoIPProvisioningRecognizer::DoRecognizeL +// Overwritten method from CApaDataRecognizerType +// --------------------------------------------------------------------------- +// +void CVoIPProvisioningRecognizer::DoRecognizeL( const TDesC& /*aName*/, + const TDesC8& aBuffer ) + { + iConfidence = ENotRecognized; + iDataType = TDataType(); + if ( aBuffer.FindF( KVoIPXMLTag ) != KErrNotFound ) + { + iConfidence = ECertain; + iDataType = TDataType( KVoIPConfMimetypeApplication ); + } + } + +// --------------------------------------------------------- +// CVoIPProvisioningRecognizer::CreateRecognizerL +// Static method to create instance of CVoIPProvisioningRecognizer +// --------------------------------------------------------- +// +CApaDataRecognizerType* CVoIPProvisioningRecognizer::CreateRecognizerL() + { + return new (ELeave) CVoIPProvisioningRecognizer(); + } + +// --------------------------------------------------------- +// ImplementationTable +// Table containing the data concerning CVoIPProvisioningRecognizer +// --------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KVoIPProvRecImplUIDValue, + CVoIPProvisioningRecognizer::CreateRecognizerL ) + }; + +// --------------------------------------------------------- +// ImplementationGroupProxy +// Function called by framework to return data about this recognizer +// --------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = + sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/EABI/voipxmlprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/EABI/voipxmlprocessoru.def Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,18 @@ +EXPORTS + _ZN14CVoipXmlParser14ImportDocumentER5RFileRm @ 1 NONAME + _ZN14CVoipXmlParser17ReadDescriptionLCER5RFileR5TDes8 @ 2 NONAME + _ZN14CVoipXmlParser4NewLEv @ 3 NONAME + _ZN14CVoipXmlParser5NewLCEv @ 4 NONAME + _ZTI18CVoipXmlIapHandler @ 5 NONAME ; ## + _ZTI18CVoipXmlSipHandler @ 6 NONAME ; ## + _ZTI18CVoipXmlXdmHandler @ 7 NONAME ; ## + _ZTI19CVoipXmlVoipHandler @ 8 NONAME ; ## + _ZTI20CVoipXmlNatFwHandler @ 9 NONAME ; ## + _ZTI23CVoipXmlPresenceHandler @ 10 NONAME ; ## + _ZTV18CVoipXmlIapHandler @ 11 NONAME ; ## + _ZTV18CVoipXmlSipHandler @ 12 NONAME ; ## + _ZTV18CVoipXmlXdmHandler @ 13 NONAME ; ## + _ZTV19CVoipXmlVoipHandler @ 14 NONAME ; ## + _ZTV20CVoipXmlNatFwHandler @ 15 NONAME ; ## + _ZTV23CVoipXmlPresenceHandler @ 16 NONAME ; ## + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/bwins/voipxmlprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/bwins/voipxmlprocessoru.def Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,8 @@ +EXPORTS + ?GetBrandingData@CVoipXmlParser@@QAEXAAVTDes8@@0@Z @ 1 NONAME ABSENT ; void CVoipXmlParser::GetBrandingData(class TDes8 &, class TDes8 &) + ?ImportDocument@CVoipXmlParser@@QAEHAAVRFile@@AAK@Z @ 2 NONAME ; int CVoipXmlParser::ImportDocument(class RFile &, unsigned long &) + ?NewL@CVoipXmlParser@@SAPAV1@XZ @ 3 NONAME ; class CVoipXmlParser * CVoipXmlParser::NewL(void) + ?NewLC@CVoipXmlParser@@SAPAV1@XZ @ 4 NONAME ; class CVoipXmlParser * CVoipXmlParser::NewLC(void) + ?ReadDescriptionLC@CVoipXmlParser@@QAEPAVHBufC16@@AAVRFile@@@Z @ 5 NONAME ABSENT ; class HBufC16 * CVoipXmlParser::ReadDescriptionLC(class RFile &) + ?ReadDescriptionLC@CVoipXmlParser@@QAEPAVHBufC16@@AAVRFile@@AAVTDes8@@@Z @ 6 NONAME ; class HBufC16 * CVoipXmlParser::ReadDescriptionLC(class RFile &, class TDes8 &) + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/bld.inf Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build info file for VoIP XML processor +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES + ./voipxmlprocessor.mmp + +PRJ_TESTMMPFILES +// ../internal/test/group/UT_voipxmlprocessor.mmp diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/voipxmlprocessor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/voipxmlprocessor.mmp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project VoIP XML processor. +* +*/ + + +#include +#include + +ALWAYS_BUILD_AS_ARM + +TARGET voipxmlprocessor.dll +TARGETTYPE dll +UID 0x1000008d 0x20026FE4 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +LANGUAGE_IDS + +SOURCEPATH ../src +SOURCE voipxmlutils.cpp +SOURCE voipxmlparser.cpp +SOURCE voipxmlparamhandler.cpp +SOURCE voipxmlsiphandler.cpp +SOURCE voipxmlvoiphandler.cpp +SOURCE voipxmlxdmhandler.cpp +SOURCE voipxmlpresencehandler.cpp +SOURCE voipxmlnatfwhandler.cpp +SOURCE voipxmliaphandler.cpp + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /sf/app/iptelephony/inc + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY xmlparser.lib +LIBRARY xmldom.lib +LIBRARY sipprofilecli.lib +LIBRARY inetprotutil.lib +LIBRARY rcse.lib +LIBRARY serviceprovidersettings.lib +LIBRARY ipapputils.lib +LIBRARY bafl.lib +LIBRARY vimpstsettings.lib // For setting IM tone. +LIBRARY PlatformEnv.lib // For getting rom digital tone path. +LIBRARY XdmSettingsApi.lib +LIBRARY presencesettingsapi.lib +LIBRARY centralrepository.lib +LIBRARY cmmanager.lib +LIBRARY WEPSecuritySettingsUi.lib +LIBRARY WPASecuritySettingsUi.lib +LIBRARY commsdat.lib + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmliaphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmliaphandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IAP handler for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLIAPHANDLER_H +#define VOIPXMLIAPHANDLER_H + +#include "voipxmlprocessordefaults.h" + +class RCmManagerExt; + +class TWepKey + { +public: + /** + * ETrue if hexadecimal, EFalse if ASCII. + */ + TBool iHex; + /** + * WEP key length. + */ + TInt iLength; + /** + * WEP key data. + */ + TBuf iData; + }; + +struct TTemporaryIap + { + /** + * Name of the IAP. + */ + HBufC* iName; + /** + * SSID of the IAP. + */ + HBufC* iSsid; + /** + * Tells if the SSID is hidden or not. + */ + TBool iHidden; + /** + * Network mode. + */ + TInt iNetworkMode; + /** + * Network type. + */ + TInt iSecurityType; + /** + * Pre-shared key. + */ + HBufC* iPreSharedKey; + /** + * WEP authentication mode. + */ + TInt iWepAuthMode; + /** + * Current WEP key. + */ + TWepKey iCurrentWepKey; + /** + * Array of WEP keys. + */ + RArray iWepKeys; + }; + +/** +* VoipXmlIapHandler +* IAP handler class. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +class CVoipXmlIapHandler : public CBase + { +#ifdef _DEBUG + friend class UT_CVoipXmlIapHandler; + friend class UT_CVoipXmlParamHandler; +#endif + +public: + + static CVoipXmlIapHandler* NewL(); + ~CVoipXmlIapHandler(); + +public: + + /** + * Sets IAP setting. + * + * @since S60 v5.0 + * @param aType Type of settings. + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSetting( TInt aType, TInt aParam, const TDesC& aValue ); + + /** + * Stores settings to 'XDM registry', i.e. creates an XDM collection. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no settings to be stored, + * KErrCompletion if settings could not be stored. + */ + TInt StoreSettings(); + + /** + * Returns destination ID. + * + * @since S60 v5.0 + * @return Destination ID. + */ + TUint32 SettingsId(); + + /** + * Method to inform the handler that currently deployed settings + * have ended. This way we will know when an IAP is ready to be + * appended to iIaps array, or when a WEP key is ready to appended + * to iWepKeys array. + * + * @since S60 v5.0 + * @param aType Type of settings. + */ + void SettingsEnd( TInt aType ); + +private: + + /** + * Resets iCurrentIap settings, i.e. deletes its member data. + * + * @since S60 v5.0 + * @param aCloseArray Tells if array inside iCurrentIap is to be closed. + */ + void ResetCurrentIap( TBool aCloseArray = EFalse ); + + /** + * Resets iIaps array, i.e. deletes its items member data. + * + * @since S60 v5.0 + * @param aCloseArray Tells if arrays inside iIaps' + * members are to be closed. + */ + void ResetTempIapArray( TBool aCloseArray = EFalse ); + + /** + * Adds current IAP settings to iIaps array. + * + * @since S60 v5.0 + */ + void AddCurrentIapL(); + + /** + * Stores settings. + * + * @since S60 v5.0 + */ + void StoreSettingsL(); + + /** + * Creates an access point. + * + * @since S60 v5.0 + * @param aCmManager CMManager reference. + * @param aTempIap TTemporaryIap from which actual IAP will be created. + * @return IAP ID. + */ + TUint32 CreateIapL( RCmManagerExt& aCmManager, TTemporaryIap aTempIap ); +private: + + CVoipXmlIapHandler(); + void ConstructL(); + +private: + + /** + * Tells if any settings have been set to temporary profile. + */ + TBool iSettingsSet; + + /** + * Name of destination. If this is empty when saving settings, + * destination will not be created. + * Own. + */ + HBufC* iDestinationName; + + /** + * ID of destination. + */ + TUint32 iDestinationId; + + /** + * Access point that is being currently handled. + */ + TTemporaryIap iCurrentIap; + + /** + * Array for temporary IAP's. + */ + RPointerArray iIaps; + }; + +#endif // VOIPXMLIAPHANDLER_H + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlnatfwhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlnatfwhandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: NAT/Firewall handler for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLNATFWHANDLER_H +#define VOIPXMLNATFWHANDLER_H + +#include "voipxmlprocessordefaults.h" + +struct TAdditionalStun + { +//public: + + /** + * STUN server address. + */ + TBuf8 iStunSrvAddr; + + /** + * STUN server port. + */ + TInt iStunSrvPort; + + /** + * STUN server username. + */ + TBuf8 iStunSrvUsername; + + /** + * STUN server password. + */ + TBuf8 iStunSrvPassword; + }; + +/** +* VoipXmlNatFwHandler +* NAT/Framwrork handler class. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +class CVoipXmlNatFwHandler : public CBase + { +#ifdef _DEBUG + friend class UT_CVoipXmlNatFwHandler; + friend class UT_CVoipXmlParamHandler; +#endif + +public: + + static CVoipXmlNatFwHandler* NewL(); + ~CVoipXmlNatFwHandler(); + +public: + + /** + * Sets NAT/Firewall setting. + * + * @since S60 v5.0 + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSetting( TInt aType, TInt aParam, const TDesC8& aValue ); + + /** + * Stores settings to Central Repository (actually calls StoreSettingsL). + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no settings to be stored, + * KErrCompletion if settings could not be stored. + */ + TInt StoreSettings(); + + /** + * Method to inform the handler that currently deployed settings + * have ended. This way we will know when iCurrentAdditionalStunServer + * server should be appended to iAdditionalStunServers array. + * + * @since S60 v5.0 + * @param aType Type of settings. + */ + void SettingsEnd( TInt aType ); + +private: + + /** + * Commits actual Central Repository storage. + * + * @since S60 v5.0 + */ + void StoreSettingsL(); + +private: + + CVoipXmlNatFwHandler(); + void ConstructL(); + +private: + + /** + * Tells if any settings have been set to internal members. + */ + TBool iSettingsSet; + + /** + * Domain name. + * Own. + */ + HBufC8* iDomain; + + /** + * STUN server address. + * Own. + */ + HBufC8* iStunSrvAddr; + + /** + * STUN server port. + */ + TInt iStunSrvPort; + + /** + * TCP refresh interval. + */ + TInt iTcpRefreshInterval; + + /** + * UDP refresh interval. + */ + TInt iUdpRefreshInterval; + + /** + * CRLF refresh. + */ + TInt iCrlfRefresh; + + /** + * STUN server username. + * Own. + */ + HBufC8* iStunSrvUsername; + + /** + * STUN server password. + * Own. + */ + HBufC8* iStunSrvPassword; + + /** + * STUN shared secret. + */ + TInt iStunSharedSecret; + + /** + * Start port of STUN port range. + */ + TInt iStartPortRange; + + /** + * End port of STUN port range. + */ + TInt iEndPortRange; + + /** + * NAT protocol + * Own. + */ + HBufC8* iNatProtocol; + + /** + * Additional STUN server data that is being currently modified. + * After modifications are done, it is appended to iAdditionalStunServers. + */ + TAdditionalStun iCurrentAdditionalStunServer; + + /** + * Array for holding additional STUN server data. + */ + RPointerArray iAdditionalStunServers; + }; + +#endif // VOIPXMLNATFWHANDLER_H + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparamhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparamhandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class definition of VoIP XML parameter handler. +* +*/ + + +#ifndef VOIPXMLPARAMHANDLER_H +#define VOIPXMLPARAMHANDLER_H + +#include + +class CVoipXmlSipHandler; +class CVoipXmlVoipHandler; +class CVoipXmlXdmHandler; +class CVoipXmlPresenceHandler; +class CVoipXmlNatFwHandler; +class CVoipXmlIapHandler; + +/** +* CVoipXmlParamHandler +* Handles parameters and passes them to settings handlers. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +NONSHARABLE_CLASS( CVoipXmlParamHandler ) : public CBase + { +#ifdef _DEBUG + friend class UT_CVoipXmlParamHandler; + friend class UT_CVoipXmlParser; +#endif + +public: + + static CVoipXmlParamHandler* NewL(); + + static CVoipXmlParamHandler* NewLC(); + + virtual ~CVoipXmlParamHandler(); + + /** + * Marks what type of settings are to be deployed. + * + * @since S60 v5.0 + * @param aType Type of settings that are to be deployed. + */ + void SettingsStart( const TDesC& aType ); + + /** + * Tells that settings are deployed and previous type should be used. + */ + void SettingsEnd(); + + /** + * Handles XML parameters and passes the handled + * ones to settings handlers. + * + * @since S60 v5.0 + * @param aParam Parameter name. + * @param avalue Parameter value. + */ + void HandleParameter( const TDesC& aParam, const TDesC& aValue ); + + /** + * Stores transiently saved settings. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no SIP or VoIP settings to be stored, + * KErrCompletion if error occurred in storing settings. + */ + TInt StoreSettings(); + + /** + * Returns the service tab ID. + * + * @since S60 v5.0 + * @return Service tab ID. + */ + TUint32 ServiceTabId(); + +private: + + /** + * Converts parameter name to enumerated one. + * + * @since S60 v5.0 + * @param aParam Parameter name. + * @return Enumerated parameter value. + */ + TInt ConvertParameter( const TDesC& aParam ); + +private: + + CVoipXmlParamHandler(); + + void ConstructL(); + + +private: // data + + /** + * Type of settings that are currently being deployed. + */ + TInt iSettingsType; + + /** + * Type of previously deployed settings. + */ + TInt iPreviousSettingsType; + + /** + * SIP settings handler. + * Own. + */ + CVoipXmlSipHandler* iSipHandler; + + /** + * VoIP settings handler. + * Own. + */ + CVoipXmlVoipHandler* iVoipHandler; + + /** + * XDM settings handler. + * Own. + */ + CVoipXmlXdmHandler* iXdmHandler; + + /** + * Presence settings handler. + * Own. + */ + CVoipXmlPresenceHandler* iPresenceHandler; + + /** + * NAT/Firewall settings handler. + * Own. + */ + CVoipXmlNatFwHandler* iNatFwHandler; + + /** + * Internet Access Point settings handler. + * Own. + */ + CVoipXmlIapHandler* iIapHandler; + }; + +#endif // VOIPXMLPARAMHANDLER_H + +// End of File + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparser.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VoIP settings XML parser +* +*/ + + +#ifndef VOIPXMLPARSER_H +#define VOIPXMLPARSER_H + +#include +#include +#include + +#include "voipxmlparamhandler.h" + +class CVoipXmlParamHandler; + +/** + * VoIP settings XML parser. + * Parses an XML file and passes the parameters to XML parameter handler. + * + * @code + * CVoIPXmlParser* parser = CVoIPXmlParser::NewLC(); + * TFileName myfile( PathInfo::PhoneMemoryRootPath() ); + * _LIT( KXmlFilePath, "testsettings.xml" ); + * myfile.Append( KXmlFilePath ); + * TUint32 serviceTabId; + * TInt err = parser->ImportDocument( myfile, serviceTabId ); + * CleanupStack::PopAndDestroy( parser ); + * @endcode + * + * @lib voipxmlprocessor.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CVoipXmlParser ) : public CBase, + public MMDXMLParserObserver + { +#ifdef _DEBUG + friend class UT_CVoipXmlParser; +#endif + +public: + + IMPORT_C static CVoipXmlParser* NewL(); + IMPORT_C static CVoipXmlParser* NewLC(); + virtual ~CVoipXmlParser(); + + /** + * Method for importing XML and saving settings. + * + * @since S60 v5.0 + * @param aFile File handle to XML file. Ownsership is taken and moved + * to CMDXMLParser object. + * @param aServiceTabId Service tab ID of the created service. + * @return KErrEof if no found in XML file, + * KErrCorrupt if XML file is corrupted, + * KErrAbort if no found in XML file, + * KErrBadHandle if unrecognized node types found in XML file, + * KErrNotSupported if no SIP or VoIP settings found, + * KErrCompletion if error in storing the settings. + */ + IMPORT_C TInt ImportDocument( RFile& aFile, TUint32& aServiceTabId ); + + /** + * Reads description from inside tags + * and returns it in HBufC object which has been pushed into cleanup + * stack. Also reads branding URL from XML file and sets it into argument. + * + * @since S60 v5.0 + * @param aFile File handle to XML file. Ownsership is taken and moved + * to CMDXMLParser object. + * @param aBrandUrl Branding URL. + * @return Descriptor object containing the description. + */ + IMPORT_C HBufC* ReadDescriptionLC( RFile& aFile, TDes8& aBrandUrl ); + +private: + + /** + * For parsing nokia-provdescription node. + * + * @since S60 v5.0 + * @param aXmlElement XML element to be parsed. + */ + void ParseDescription( CMDXMLElement& aXmlElement ); + + /** + * For parsing root node. + * + * @since S60 v5.0 + * @param aXmlElement XML element to be parsed. + */ + void ParseRoot( CMDXMLElement& aXmlElement ); + + /** + * For parsing settings node. + * + * @since S60 v5.0 + * @param aXmlElement XML element to be parsed. + */ + void ParseSettings( CMDXMLNode* aXmlNode ); + +protected: + +// From base class MMDXMLParserObserver. + + /** + * From base class MMDXMLParserObserver. + * Call back function used to inform a client of the Parser when a + * parsing operation completes. + * @since S60 v5.0 + */ + void ParseFileCompleteL(); + +private: + + CVoipXmlParser(); + + void ConstructL(); + +private: // data + + /** + * XML parser object. + * Own. + */ + CMDXMLParser* iParser; + + /** + * XML document. + * Own. + */ + CMDXMLDocument* iXmlDoc; + + /** + * XML parameter handler. + * Own. + */ + CVoipXmlParamHandler* iParamHandler; + + /** + * Error code to be returned in ImportDocument. + */ + TInt iError; + + /** + * Flag for telling if we are to only read + * contents from the XML document. + */ + TBool iParseDescription; + + /** + * Object for holding description read from . + * Own. + */ + HBufC* iDescription; + + /** + * Object for holding branding URL read from . + * Own. + */ + HBufC* iBrandUrl; + }; + +#endif // VOIPXMLPARSER_H + +// End of file. + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlpresencehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlpresencehandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence handler for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLPRESENCEHANDLER_H +#define VOIPXMLPRESENCEHANDLER_H + +#include + +class TPresSettingsSet; + +/** +* VoipXmlPresenceHandler +* Presence handler class. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +class CVoipXmlPresenceHandler : public CBase + { +#ifdef _DEBUG + friend class UT_CVoipXmlPresenceHandler; + friend class UT_CVoipXmlParamHandler; +#endif + +public: + + static CVoipXmlPresenceHandler* NewL(); + ~CVoipXmlPresenceHandler(); + +public: + + /** + * Sets XDM setting. + * + * @since S60 v5.0 + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSetting( TInt aParam, const TDesC& aValue ); + + /** + * Stores settings to 'XDM registry', i.e. creates an XDM collection. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no settings to be stored, + * KErrCompletion if settings could not be stored. + */ + TInt StoreSettings(); + + /** + * Returns the settings ID. + * + * @since S60 v5.0 + * @return XDM settings ID. + */ + TUint32 SettingsId(); + + /** + * Gives linkage information. + * + * @since S60 v5.0 + * @param aType Type of settings. + * @param aSettingsId Settings ID. + */ + void LinkSettings( TInt aType, TUint32 aSettingsId ); + + /** + * Finalizes settings, i.e. stores the profile with linkage information. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrGeneral if settings could not be finalized. + */ + TInt FinalizeSettings(); + +private: + + /** + * Creates a provider name for Presence profile. aName is used + * and replaced with a parenthised ordered number if the name is + * already found in Presence storage. + * + * @since S60 v5.0 + * @param aName Provider name to be set. + */ + void CreateProviderNameL( TDes& aName ); + +private: + + CVoipXmlPresenceHandler(); + void ConstructL(); + +private: + + /** + * XDM settings collection object. + * Own. + */ + TPresSettingsSet iProfile; + + /** + * Tells if any settings have been set to temporary profile. + */ + TBool iSettingsSet; + + /** + * XDM collection ID. + */ + TUint32 iProfileId; + }; + +#endif // VOIPXMLPRESENCEHANDLER_H + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessordefaults.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessordefaults.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Holds default values for VoIP XML Processor. +* +*/ + + +#ifndef VOIPXMLPROCESSORDEFAULTS_H +#define VOIPXMLPROCESSORDEFAULTS_H + +#include + +// ============================== +// XML constants +// ============================== +// +// Node names. +_LIT( KNodeNokiaConfDoc, "nokia-confdoc" ); +_LIT( KNodeConfDescription, "confdescription" ); +_LIT( KNodeConfBrandUrl, "confbrandurl" ); +_LIT( KNodeSettings, "settings" ); +_LIT( KNodeParam, "param" ); +// Node attributes. +_LIT( KAttributeType, "type" ); +_LIT( KAttributeName, "name" ); +_LIT( KAttributeValue, "value" ); +// Setting types (i.e. supported values for 'type' attribute). +_LIT( KSettingsTypeVoip, "voip" ); +_LIT( KSettingsTypeSip, "sip" ); +_LIT( KSettingsTypePresence, "presence" ); +_LIT( KSettingsTypeXdm, "xdm" ); +_LIT( KSettingsTypeNatFw, "natfw" ); +_LIT( KSettingsTypeWlan, "wlan" ); +_LIT( KSettingsTypeCodec, "codec" ); +_LIT( KSettingsTypeVmbx, "voicemailbox" ); +_LIT( KSettingsTypeProxy, "proxy" ); +_LIT( KSettingsTypeRegistrar, "registrar" ); +_LIT( KSettingsTypeAdditionalStun, "additionalstun" ); +_LIT( KSettingsTypeWepKey, "wepkey" ); +_LIT( KSettingsTypeDestination, "destination" ); +// Parameter names (i.e. supported values for 'value' attribute). +// Generic. +_LIT( KParamValueName, "name" ); +_LIT( KParamValueUri, "uri" ); +_LIT( KParamValueTransport, "transport" ); +_LIT( KParamValuePort, "port" ); +_LIT( KParamValueUsername, "username" ); +_LIT( KParamValuePassword, "password" ); +_LIT( KParamValueType, "type" ); +_LIT( KParamValueDomain, "domain" ); +_LIT( KParamValueStartPort, "startport" ); +_LIT( KParamValueEndPort, "endport" ); +// VoIP specific. +_LIT( KParamValueMediaQos, "mediaqos" ); +_LIT( KParamValueDtmfInband, "dtmfinband" ); +_LIT( KParamValueDtmfOutband, "dtmfoutband" ); +_LIT( KParamValueSecureCallPref, "securecallpreference" ); +_LIT( KParamValueVoipOverWcdma, "allowvoipoverwcdma" ); +_LIT( KParamValueRtcp, "rtcp" ); +_LIT( KParamValueUserAgentTerminalType, "useragentterminaltype" ); +_LIT( KParamValueUserAgentWlanMac, "useragentwlanmac" ); +_LIT( KParamValueUserAgentFreeString, "useragentfreestring" ); +_LIT( KParamValueCallerIdDigits, "calleriddigits" ); +_LIT( KParamValueIgnoreDomainPart, "ignoredomainpart" ); +_LIT( KParamValueAutoAcceptBuddyRequests, "autoacceptbuddyrequests" ); +_LIT( KParamValueAddUserPhone, "adduserphone" ); +_LIT( KParamValueProviderUrl, "providerurl" ); +_LIT( KParamValueMinSessionInterval, "minsessioninterval" ); +_LIT( KParamValueSessionInterval, "sessioninterval" ); +_LIT( KParamValueBrandingUri, "brandinguri" ); +_LIT( KParamValueAutoEnable, "autoenable" ); +_LIT( KParamValueEnableSipIm, "enablesipim" ); +_LIT( KParamValueBrandId, "brandid" ); +// Voice mailbox specific. +_LIT( KParamValueMwiUri, "mwiuri" ); +_LIT( KParamValueListeningUri, "listeninguri" ); +_LIT( KParamValueReSubscribeInterval, "resubscribeinterval" ); +// Codec specific +_LIT( KParamValueJitterBuffer, "jitterbuffer" ); +_LIT( KParamValueOctetAlign, "octetalign" ); +_LIT( KParamValuePTime, "ptime" ); +_LIT( KParamValueMaxPTime, "maxptime" ); +_LIT( KParamValueModeSet, "modeset" ); +_LIT( KParamValueModeChangePeriod, "modechangeperiod" ); +_LIT( KParamValueModeChangeNeighbor, "modechangeneighbor" ); +_LIT( KParamValueMaxRed, "maxred" ); +_LIT( KParamValueVad, "vad" ); +_LIT( KParamValueAnnexB, "annexb" ); +// SIP specific +_LIT( KParamValueSignalingQos, "signalingqos" ); +_LIT( KParamValuePublicUserId, "publicuserid" ); +_LIT( KParamValueSignalCompression, "signalcompression" ); +_LIT( KParamValueSecurityNegotiation, "securitynegotiation" ); +_LIT( KParamValueProfileLock, "profilelock" ); +_LIT( KParamValueAutoRegistration, "autoregistration" ); +// Proxy +_LIT( KParamValueLooseRouting, "looserouting" ); +// Presence specific +_LIT( KParamValueMaxObjectSize, "maxobjectsize" ); +_LIT( KParamValuePublishInterval, "publishinterval" ); +_LIT( KParamValueMaxSubscriptions, "maxsubscriptions" ); +_LIT( KParamValueMaxContacts, "maxcontacts" ); +_LIT( KParamValueDomainSyntax, "domainsyntax" ); +// NAT/FW sepcific +_LIT( KParamValueTcpRefreshInterval, "tcprefreshinterval" ); +_LIT( KParamValueUdpRefreshInterval, "udprefreshinterval" ); +_LIT( KParamValueCrlfRefresh, "crlfrefresh" ); +_LIT( KParamValueStunSharedSecret, "stunsharedsecret" ); +// Access point specific +_LIT( KParamSsid, "ssid" ); +_LIT( KParamHidden, "hidden" ); +_LIT( KParamNetworkMode, "networkmode" ); +_LIT( KParamPreSharedKey, "presharedkey" ); +_LIT( KParamWepAuthMode, "wepauthmode" ); +// WEP +_LIT( KParamLength, "length" ); +_LIT( KParamData, "data" ); + +// Other. +const TInt KMaxNodeNameLength = 32; +const TInt KMaxNodeValueLength = 256; +const TInt KMaxProfileNameAppendLength = 4; // e.g. (10) as in Provider(10) +const TInt KMaxProfileNames = 99; +_LIT( KOpenParenthesis, "(" ); +_LIT( KClosedParenthesis, ")" ); +const TUint KComma = ','; + +// ============================== +// VoIP constants +// ============================== +// +_LIT( KILbc, "ILBC" ); + +// ============================== +// SIP constants +// ============================== +// +_LIT8( KIetf, "IETF" ); +_LIT8( KIms, "IMS" ); +_LIT8( KOpenParenthesis8, "(" ); +_LIT8( KClosedParenthesis8, ")" ); +_LIT8( KSip, "sip:" ); +_LIT8( KSips, "sips:" ); +_LIT8( KTransport, ";transport=" ); +_LIT8( KLr, ";lr" ); +_LIT8( KEscaped, "%" ); +_LIT8( KColon, ":" ); +_LIT8( KTcp, "TCP" ); +_LIT8( KUdp, "UDP" ); +_LIT8( KUserAgent, "User-Agent" ); +_LIT8( KSpace, " " ); +const TInt KMaxTerminalTypeLength = 64; +const TInt KMaxWlanMacAddressLength = 20; +const TInt KMaxUserAgentHeaderLength = 200; +const TInt KUserAgentHeaderDataArrayInitSize = 4; +const TInt KDefaultSigQos = 40; + +// ============================== +// XDM and Presence constants +// ============================== +// +const TInt KMaxObjectSize = 5120; +const TInt KPublishInterval = 60; +_LIT( KDefaultXdmUri, "http://localhost" ); +_LIT( KDefaultXdmAuthType, "HTTP-DIGEST" ); + +// ============================== +// NAT/Firewall constants +// ============================== +// +const TInt KDefaultStunServerPort = 3478; +const TInt KDefaultTcpRefreshInterval = 1200; +const TInt KDefaultUdpRefreshInterval = 28; +const TInt KDefaultStartPortRange = 49152; +const TInt KDefaultEndPortRange = 49200; +_LIT( KDefaultNatProtocol, "nokia.stun" ); + +// ============================== +// WLAN access point constants. +// ============================== +// +const TInt KMaxWepKeyDataLength = 26; +const TInt KMaxWepKeyCount = 4; +// Enumeration for WEP key lengths. +enum TWepKeyLengths + { + // Length of WEP encryption + EWepEncryption64 = 64, + EWepEncryption128 = 128, + // Length of WEP key data + EWepKey64Hex = 10, + EWepKey64Ascii = 5, + EWepKey128Hex = KMaxWepKeyDataLength, + EWepKey128Ascii = 13 + }; +_LIT( KNetworkModeInfra, "infra" ); +_LIT( KNetworkModeAdhoc, "adhoc" ); +_LIT( KSecurityTypeWep, "WEP" ); +_LIT( KSecurityTypeWpa, "WPA" ); +_LIT( KSecurityTypeWpa2, "WPA2" ); +_LIT( KSecurityType8021x, "801X" ); +_LIT( KWepAuthModeOpen, "open" ); +_LIT( KWepAuthModeShared, "shared" ); + +// ============================== +// General constants +// ============================== +// +// Enumeration for type of settings being deployed. +enum TSettingsType + { + EUnknown = KErrNotSupported, + EVoip = 0, + ESip, + EPresence, + EXdm, + ENatFw, + EDestination, + EWlan, + ECodec, + EVmbx, + EProxy, + ERegistrar, + EAdditionalStun, + EWepKey + }; + +// Enumeration for parameters. +enum TParameters + { + EUnSupported = KErrNotSupported, + // Generic parameters + EName = 0, + EUri, + ETransport, + EPort, + EUsername, + EPassword, + EType, + EDomain, + EStartPort, + EEndPort, + // VoIP parameters + EMediaQos, + EDtmfInband, + EDtmfOutband, + ESecureCallPreference, + EAllowVoipOverWcdma, + ERtcp, + EUserAgentHeaderTerminalType, + EUserAgentHeaderWlanMac, + EUserAgentHeaderFreeString, + ECallerIdDigits, + EIgnoreDomainPart, + EAutoAcceptBuddyRequests, + EAddUserPhone, + EProviderUrl, + EMinSessionInterval, + ESessionInterval, + EBrandingUri, + EAutoEnable, + EEnableSipIm, + EBrandId, + // Voice mailbox parameters + EMwiUri, + EListeningUri, + EReSubscribeInterval, + // Codec parameters + EJitterBuffer, + EOctetAlign, + EPTime, + EMaxPTime, + EModeSet, + EModeChangePeriod, + EModeChangeNeighbor, + EMaxRed, + EVad, + EAnnexb, + // SIP parameters + ESignalingQos, + EPublicUserId, + ESignalCompression, + ESecurityNegotiation, + EProfileLock, + EAutoRegistration, + // Proxy parameters + ELooseRouting, + // Presence parameters + EMaxObjectSize, + EPublishInterval, + EMaxSubscriptions, + EMaxContacts, + EDomainSyntax, + // NAT/Firewall parameters + ETcpRefreshInterval, + EUdpRefreshInterval, + ECrlfRefresh, + EStunSharedSecret, + // WLAN access point parameters + ESsid, + EHidden, + ENetworkMode, + EPreSharedKey, + EWepAuthMode, + // WEP key parameters + ELength, + EData + }; + +#endif // VOIPXMLPROCESSORDEFAULTS_H + +// End of file diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessorlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessorlogger.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VoIP XML processor logger +* +*/ + + + +#ifndef VOIPXMLPROCESSORLOGGER_H +#define VOIPXMLPROCESSORLOGGER_H + +// INCLUDES +#include +#include + +//---------------------------------------------------------------------------- +// USER LOGGING SETTINGS +//---------------------------------------------------------------------------- + +#ifndef _DEBUG + +/*************************** +* Logging method variants: +* 0 = No logging +* 1 = RDebug +***************************/ + +#define VOIPXMLPROCESSOR_DEBUG 0 // UREL BUILD + +#else + +#define VOIPXMLPROCESSOR_DEBUG 1 // UDEB BUILD + +#endif // _DEBUG + +//---------------------------------------------------------------------------- +// LOGGING MACROs (DO NOT EDIT) +// +// USE THESE MACROS IN YOUR CODE +//---------------------------------------------------------------------------- + +#if VOIPXMLPROCESSOR_DEBUG == 1 // RDebug + +#define DBG_PRINT( AA ) { RDebug::Print( _L( AA ) ); } +#define DBG_PRINT2( AA, BB ) { RDebug::Print( _L( AA ), BB ); } +#define DBG_PRINT3( AA, BB, CC ) { RDebug::Print( _L( AA ), BB, CC ); } + +#else // VOIPXMLPROCESSOR_DEBUG == 0 or invalid -> Disable loggings + +#define DBG_PRINT( AA ) +#define DBG_PRINT2( AA, BB ) +#define DBG_PRINT3( AA, BB, CC ) + +#endif // IAS_DEBUG + +#endif // VOIPXMLPROCESSORLOGGER_H diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlsiphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlsiphandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,236 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: SIP handler for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLSIPHANDLER_H +#define VOIPXMLSIPHANDLER_H + +#include +#include + +class CSIPManagedProfile; +class CSIPManagedProfileRegistry; +class CSIPProfile; +class TSIPProfileTypeInfo; + +/** +* VoipXmlSipHandler +* SIP handler class. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +class CVoipXmlSipHandler : public CBase, + public MSIPProfileRegistryObserver + { +#ifdef _DEBUG + friend class UT_CVoipXmlSipHandler; + friend class UT_CVoipXmlParser; + friend class UT_CVoipXmlParamHandler; +#endif + +public: + enum TTransportType + { + EAutomatic = 0, + EUdp, + ETcp + }; +public: + + static CVoipXmlSipHandler* NewL(); + ~CVoipXmlSipHandler(); + +public: + + /** + * Sets SIP setting. + * + * @since S60 v5.0 + * @param aType Type of setting (SIP 'core', proxy or registrar) + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSetting( TInt aType, TInt aParam, const TDesC8& aValue ); + + /** + * Stores settings to SIP managed profile registry. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no settings to be stored, + * KErrCompletion if settings could not be stored. + */ + TInt StoreSettings(); + + /** + * Returns the profile ID. + * + * @since S60 v5.0 + * @return SIP profile ID. + */ + TUint32 SettingsId(); + + /** + * Gives linkage information. + * + * @since S60 v5.0 + * @param aType Type of settings. + * @param aSettingsId Settings ID. + */ + void LinkSettings( TInt aType, TUint32 aSettingsId ); + + /** + * Finalizes settings, i.e. sets Destination ID to SIP profile. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrCompletion if settings could not be finalized. + */ + TInt FinalizeSettings(); + +protected: + +// from base class MSIPProfileRegistryObserver + + /** + * From MSIPProfileRegistryObserver + * SIP profile information event. + * + * @since S60 v5.0 + * @param aSIPProfileId SIP profile ID. + * @param aEvent Type of SIP event + */ + void ProfileRegistryEventOccurred( TUint32 /*aSIPProfileId*/, + TEvent /*aEvent*/ ); + + /** + * From MSIPProfileRegistryObserver + * An asynchronous error has occurred related to SIP profile. + * + * @since S60 v5.0 + * @param aSIPProfileId SIP profile ID. + * @param aError Error code. + */ + void ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/, + TInt /*aError*/ ); + +private: + + /** + * Creates a provider name for SIP profile. aName is used + * and replaced with a parenthised ordered number if the name is + * already found in SIP stack. + * + * @since S60 v5.0 + * @param aName Provider name to be set. + */ + void CreateProviderNameL( const TDesC8& aName ); + + /** + * Handles public User ID modification if needed. + * Possible modifications are escaping and adding sip: prefix. + * + * @since S60 v5.0 + * @param aValue Value to be checked and modified if needed. + */ + void ModifyPuidL( TDes8& aValue ); + + /** + * Validates transport type. + * + * @since S60 v5.0 + * @param aValue Value to be validated. + * @return Validated transport type. + */ + TTransportType ValidateTransport( const TDesC8& aValue ); + +private: + + CVoipXmlSipHandler(); + void ConstructL(); + +private: + + /** + * SIP profile object. + * Own. + */ + CSIPManagedProfile* iProfile; + + /** + * SIP managed profile registry object. + * Own. + */ + CSIPManagedProfileRegistry* iRegistry; + + /** + * Profile type. + */ + TSIPProfileTypeInfo iProfileType; + + /** + * Proxy URI. + * Own. + */ + HBufC8* iProxyUri; + + /** + * Proxy transport type. + */ + TTransportType iProxyTransport; + + /** + * Proxy port number. + */ + TInt iProxyPort; + + /** + * Loose routing. + */ + TBool iLr; + + /** + * Registrar URI. + * Own. + */ + HBufC8* iRegistrarUri; + + /** + * Registrar transport type. + */ + TTransportType iRegistrarTransport; + + /** + * Registrar server port number. + */ + TInt iRegistrarPort; + + /** + * Tells if any settings have been set to temporary profile. + */ + TBool iSettingsSet; + + /** + * SIP profile ID. + */ + TUint32 iProfileId; + }; + +#endif // VOIPXMLSIPHANDLER_H + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utilities class for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLUTILS_H +#define VOIPXMLUTILS_H + +#include + +/** + * Cleanup item for deleting contents of RPointerArray. + * + * @lib voipxmlprocessor.lib + * @since S60 v5.0 + */ +template +class CleanupResetAndDestroy + { +public: + + /** + * Pushes aRef to cleanup stack using TCleanupItem (and ResetAndDestroy). + * + * @since S60 v5.0 + * @param aRef Reference to object to be pushed to cleanup stack. + */ + inline static void PushL( T& aRef ); + +private: + + /** + * Method for TCleanupItem used in PushL. + * + * @since S60 v5.0 + * @param aPtr Pointer to be cleaned up. + */ + inline static void ResetAndDestroy( TAny *aPtr ); + }; + +template +inline void CleanupResetAndDestroyL( T& aRef ); + + +/** + * Utilities class for VoIP XML processor. + * Provides common methods for VoIP XML processor classes. + * + * @lib voipxmlprocessor.lib + * @since S60 v5.0 + */ +class VoipXmlUtils + { +#ifdef _DEBUG + friend class UT_VoipXmlUtils; +#endif + +public: + + /** + * Converts a descriptor to integer. + * + * @since S60 v5.0 + * @param aDesValue Descriptor value. + * @param aIntValue Interger value (this will hold the converted value). + * @return Error code. + */ + static TInt DesToInt( const TDesC& aDesValue, TInt& aIntValue ); + + /** + * Converts an 8 bit descriptor to integer. + * + * @since S60 v5.0 + * @param aDesValue Descriptor value. + * @param aIntValue Interger value (this will hold the converted value). + * @return Error code. + */ + static TInt Des8ToInt( const TDesC8& aDesValue, TInt& aIntValue ); + }; + +#include "voipxmlutils.inl" + +#endif // VOIPXMLUTILS_H + +// End of file. + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.inl Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utilities methods for VoIP XML processor +* +*/ + + +#include "voipxmlutils.h" + +// --------------------------------------------------------------------------- +// Pushes an item to CleanupStack. +// --------------------------------------------------------------------------- +// +template +inline void CleanupResetAndDestroy::PushL( T& aRef ) + { + CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); + } + +// --------------------------------------------------------------------------- +// Cleans up an item. +// --------------------------------------------------------------------------- +// +template +inline void CleanupResetAndDestroy::ResetAndDestroy( TAny *aPtr ) + { + ( STATIC_CAST( T*, aPtr ) )->ResetAndDestroy(); + ( STATIC_CAST( T*, aPtr ) )->Close(); + } + +// --------------------------------------------------------------------------- +// Calls CleanupResetAndDestroy::PushL +// --------------------------------------------------------------------------- +// +template +inline void CleanupResetAndDestroyL( T& aRef ) + { + CleanupResetAndDestroy::PushL( aRef ); + } + +// End of file. + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlvoiphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlvoiphandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,385 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VoIP handler for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLVOIPHANDLER_H +#define VOIPXMLVOIPHANDLER_H + +#include +#include +#include +#include + +class CSPSettings; +class CRCSEProfileRegistry; +class CRCSEAudioCodecRegistry; +class CRCSEProfileEntry; +class CSPProperty; + +typedef CRCSEAudioCodecEntry::TOnOff TCodecOnOff; +typedef CRCSEProfileEntry::TOnOff TEntryOnOff; + +struct TTemporaryCodec + { + /** + * Codec name. + */ + HBufC* iName; + /** + * Jitter buffer size. + */ + TInt iJitterBuffer; + /** + * Octet-align. + */ + TCodecOnOff iOctetAlign; + /** + * PTime value. + */ + TInt iPtime; + /** + * MaxPtime value. + */ + TInt iMaxPtime; + /** + * Mode-set values. + */ + RArray iModeSet; + /** + * Mode-change-period value. + */ + TInt iModeChangePeriod; + /** + * Mode-change-neighbor value. + */ + TCodecOnOff iModeChangeNeighbor; + /** + * Max-red value. + */ + TInt iMaxRed; + /** + * VAD value. + */ + TCodecOnOff iVad; + /** + * Annexb value. + */ + TCodecOnOff iAnnexb; + }; + +struct TSpSettings + { + /** + * Tells if buddy requests are automatically accepted. + */ + TBool iAutoAcceptBuddies; + /** + * Provider bookmark URL. + */ + HBufC* iProviderUrl; + /** + * Branding URI. + */ + HBufC* iBrandingUri; + /** + * Tells if the service will be automatically enabled. + */ + TBool iAutoEnable; + /** + * Message Waiting Indicator URI for voice mailbox. + */ + HBufC* iMwiUri; + /** + * Listening URI for voice mailbox. + */ + HBufC* iListeningUri; + /** + * Re-subscribe interval for voice mailbox. + */ + TInt iResubrcribe; + /** + * Tells if SIP IM is enabled. IM will be set as enabled only if + * a presence ID is received via LinkSettings() method. + */ + TBool iEnableSipIm; + /** + * Brand ID. + */ + HBufC* iBrandId; + }; + +/** +* VoIP handler class. +* Handles VoIP related settings. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +class CVoipXmlVoipHandler : public CBase, public MSIPProfileRegistryObserver + { +#ifdef _DEBUG + friend class UT_CVoipXmlVoipHandler; + friend class UT_CVoipXmlParser; + friend class UT_CVoipXmlParamHandler; +#endif + +public: + + /** + * Two-phased constructor. + */ + static CVoipXmlVoipHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CVoipXmlVoipHandler(); + + /** + * Sets VoIP setting. + * + * @since S60 v5.0 + * @param aType Type of setting (VoIP 'core', vmbx or codec) + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSetting( TInt aType, TInt aParam, const TDesC& aValue ); + + /** + * Stores settings to RCSE. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no settings to be stored, + * KErrCompletion if settings could not be stored. + */ + TInt StoreSettings(); + + /** + * Returns the service ID. + * + * @since S60 v5.0 + * @return VoIP service ID. + */ + TUint32 SettingsId(); + + /** + * Method to inform the handler that currently deployed settings + * have ended. This way we will know when a codec is ready to be + * put to RCSE. + * + * @since S60 v5.0 + * @param aType Type of settings. + */ + void SettingsEnd( TInt aType ); + + /** + * Gives linkage information. + * + * @since S60 v5.0 + * @param aType Type of settings. + * @param aSettingsId Settings ID. + */ + void LinkSettings( TInt aType, TUint32 aSettingsId ); + + /** + * Finalizes settings, i.e. sets all the settings that are bound to + * settings linkage (e.g. SIP User-Agent header and + * settings stored in SPSettings). + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrCompletion if settings could not be finalized. + */ + TInt FinalizeSettings(); + + /** + * Returns the service tab ID. + * + * @since S60 v5.0 + * @return Service tab ID. + */ + TUint32 ServiceTabIdL(); + +protected: + +// from base class MSIPProfileRegistryObserver + + /** + * From MSIPProfileRegistryObserver + * SIP profile information event. + * + * @since S60 v5.0 + * @param aSIPProfileId SIP profile ID. + * @param aEvent Type of SIP event + */ + void ProfileRegistryEventOccurred( TUint32 /*aSIPProfileId*/, + TEvent /*aEvent*/ ); + + /** + * From MSIPProfileRegistryObserver + * An asynchronous error has occurred related to SIP profile. + * + * @since S60 v5.0 + * @param aSIPProfileId SIP profile ID. + * @param aError Error code. + */ + void ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/, + TInt /*aError*/ ); + +private: + + /** + * Sets VoIP core setting to temporary storage. + * + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + * @since S60 v5.0 + */ + void SetCoreSettingL( TInt aParam, const TDesC& aValue ); + + /** + * Sets codec setting to temporary storage. + * + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + * @since S60 v5.0 + */ + void SetCodecSettingL( TInt aParam, const TDesC& aValue ); + + /** + * Sets voice mailbox setting to temporary storage. + * + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + * @since S60 v5.0 + */ + void SetVmbxSettingL( TInt aParam, const TDesC& aValue ); + + /** + * Validates profile name and modifies it if necessary. + * + * @since S60 v5.0 + * @param aName Name to be validated. + */ + void ValidateProfileNameL( TDes& aName ); + + /** + * Sets temporary codec to RCSE. + * + * @since S60 v5.0 + */ + void SetCodecToRcseL(); + + /** + * Reset temporary codec settings (iCurrentCodec) + * + * @since S60 v5.0 + */ + void ResetTempCodec( TBool aCloseArray = EFalse ); + + /** + * Resets temporary service provider settings (iSpSettings) + * + * @since S60 v5.0 + */ + void ResetTempSpSettings(); + + /** + * Sets SIP related VoIP settings (links VoIP profile to SIP and sets + * SIP User-Agent header). + * + * @since S60 v5.0 + * @param aSipId SIP settings ID. + */ + void SetSipInfoL( TUint32 aSipId ); + + /** + * Sets SPSettings to service table. + * + * @since S60 v5.0 + */ + void SetSpSettingsL(); + + /** + * Adds default codec set to iEntry. + * + * @since S60 v5.0 + */ + void AddDefaultCodecsL(); + +private: + + CVoipXmlVoipHandler(); + void ConstructL(); + +private: + + /** + * RCSE profile registry. + * Own. + */ + CRCSEProfileRegistry* iRegistry; + + /** + * RCSE audio codec registry + * Own. + */ + CRCSEAudioCodecRegistry* iCodecRegistry; + + /** + * RCSE profile entry. + * Own. + */ + CRCSEProfileEntry* iEntry; + + /** + * Tells if any settings have been set to temporary profile. + */ + TBool iSettingsSet; + + /** + * VoIP service ID. + */ + TUint32 iServiceId; + + /** + * Current codec that is being modified. + */ + TTemporaryCodec iCurrentCodec; + + /** + * SPSettings that are temporarily stored and . + */ + TSpSettings iSpSettings; + + /** + * Presence settings ID. This is received in LinkSettings method and + * will be stored to SPSettings in FinalizeSettings method. + */ + TUint32 iPresenceId; + + /** + * Destination (SNAP) ID. This is received in LinkSettings method and + * will be stored to SPSettings in FinalizedSettings method. + */ + TUint32 iDestinationId; + }; + +#endif // VOIPXMLVOIPHANDLER_H + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlxdmhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlxdmhandler.h Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XDM handler for VoIP XML processor +* +*/ + + +#ifndef VOIPXMLXDMHANDLER_H +#define VOIPXMLXDMHANDLER_H + + +class CXdmSettingsCollection; + +/** +* VoipXmlXdmHandler +* XDM handler class. +* +* @lib voipxmlprocessor.lib +* @since S60 v5.0 +*/ +class CVoipXmlXdmHandler : public CBase + { +#ifdef _DEBUG + friend class UT_CVoipXmlXdmHandler; + friend class UT_CVoipXmlParamHandler; +#endif + +public: + + static CVoipXmlXdmHandler* NewL(); + ~CVoipXmlXdmHandler(); + +public: + + /** + * Sets XDM setting. + * + * @since S60 v5.0 + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSetting( TInt aParam, const TDesC& aValue ); + + /** + * Stores settings to 'XDM registry', i.e. creates an XDM collection. + * + * @since S60 v5.0 + * @return KErrNone if successful, + * KErrNotSupported if no settings to be stored, + * KErrCompletion if settings could not be stored. + */ + TInt StoreSettings(); + + /** + * Returns the settings ID. + * + * @since S60 v5.0 + * @return XDM settings ID. + */ + TUint32 SettingsId(); + +private: + + /** + * Sets XDM setting. + * + * @since S60 v5.0 + * @param aParam Parameter to be set. + * @param aValue Value of the setting. + */ + void SetSettingL( TInt aParam, const TDesC& aValue ); + + /** + * Creates a provider name for XDM profile. aName is used + * and replaced with a parenthised ordered number if the name is + * already found in XDM storage. + * + * @since S60 v5.0 + * @param aName Provider name to be set. + */ + void CreateProviderNameL( TDes& aName ); + +private: + + CVoipXmlXdmHandler(); + void ConstructL(); + +private: + + /** + * XDM settings collection object. + * Own. + */ + CXdmSettingsCollection* iProfile; + + /** + * Tells if any settings have been set to temporary profile. + */ + TBool iSettingsSet; + + /** + * XDM collection ID. + */ + TUint32 iProfileId; + }; + +#endif // VOIPXMLXDMHANDLER_H + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rd-key.pem --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rd-key.pem Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4 +6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh +7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB +gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX +pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB +yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j +KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003 +iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3 +2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+ +9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0 +aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO +TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8 +mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ= +-----END RSA PRIVATE KEY----- diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rd.cer --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rd.cer Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD +ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z +NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl +cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT +rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa +gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI +f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL +BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud +IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD +ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd +IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE +IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G +CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9 +Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT +7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR +-----END CERTIFICATE----- diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rom/provisioningapi.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rom/provisioningapi.iby Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: provisioningapi iby file +* +*/ + +#ifndef PROVISIONINGAPI_IBY +#define PROVISIONINGAPI_IBY + +#include + +#ifdef __VOIP + file=ABI_DIR\BUILD_DIR\provisioningapi.dll SHARED_LIB_DIR\provisioningapi.dll +#endif // __VOIP + +#endif // PROVISIONINGAPI_IBY diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,587 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IAP handler for VoIP XML processor +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voipxmlutils.h" +#include "voipxmliaphandler.h" +#include "voipxmlprocessorlogger.h" + +// --------------------------------------------------------------------------- +// CVoipXmlIapHandler::CVoipXmlIapHandler +// --------------------------------------------------------------------------- +// +CVoipXmlIapHandler::CVoipXmlIapHandler() + { + } + +// --------------------------------------------------------------------------- +// CVoipXmlIapHandler::NewL +// --------------------------------------------------------------------------- +// +CVoipXmlIapHandler* CVoipXmlIapHandler::NewL() + { + CVoipXmlIapHandler* self = new ( ELeave ) CVoipXmlIapHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CVoipXmlIapHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::ConstructL() + { + iDestinationName = HBufC::NewL( 0 ); + iDestinationId = 0; + iCurrentIap.iSsid = NULL; + iCurrentIap.iName = NULL; + iCurrentIap.iPreSharedKey = NULL; + iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen; + iCurrentIap.iNetworkMode = CMManager::EInfra; + iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen; + } + +// --------------------------------------------------------------------------- +// CVoipXmlIapHandler::~CVoipXmlIapHandler +// --------------------------------------------------------------------------- +// +CVoipXmlIapHandler::~CVoipXmlIapHandler() + { + if ( iDestinationName ) + { + delete iDestinationName; + } + ResetCurrentIap( ETrue ); + ResetTempIapArray( ETrue ); + } + +// --------------------------------------------------------------------------- +// Sets SIP setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::SetSetting( TInt aType, TInt aParam, + const TDesC& aValue ) + { + // Ignore too long descriptors. + if ( KMaxNodeValueLength < aValue.Length() ) + { + return; + } + TInt intValue; + + switch ( aParam ) + { + case EName: + { + TInt err( KErrNotFound ); + if ( EDestination == aType ) + { + delete iDestinationName; + iDestinationName = NULL; + TRAP( err, iDestinationName = aValue.AllocL() ); + } + else if ( EWlan == aType && !iCurrentIap.iName ) + { + TRAP( err, iCurrentIap.iName = aValue.AllocL() ); + } + if ( KErrNone == err ) + { + iSettingsSet = ETrue; + } + break; + } + case EType: + { + if ( EWlan != aType ) + { + break; + } + TBuf value; + value.Copy( aValue ); + value.UpperCase(); + if ( 0 == value.Compare( KSecurityTypeWep ) ) + { + iCurrentIap.iSecurityType = CMManager::EWlanSecModeWep; + iSettingsSet = ETrue; + } + else if ( 0 == value.Compare( KSecurityTypeWpa ) ) + { + iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa; + iSettingsSet = ETrue; + } + else if ( 0 == value.Compare( KSecurityTypeWpa2 ) ) + { + iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa2; + iSettingsSet = ETrue; + } + else if ( 0 == value.Compare( KSecurityType8021x ) ) + { + iCurrentIap.iSecurityType = CMManager::EWlanSecMode802_1x; + iSettingsSet = ETrue; + } + break; + } + case ESsid: + { + if ( EWlan == aType && !iCurrentIap.iSsid ) + { + TRAPD( err, iCurrentIap.iSsid = aValue.AllocL() ); + if ( KErrNone == err ) + { + iSettingsSet = ETrue; + } + } + break; + } + case EHidden: + { + if ( EWlan == aType && + KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iCurrentIap.iHidden = intValue; + iSettingsSet = ETrue; + } + break; + } + case ENetworkMode: + { + if ( EWlan != aType ) + { + break; + } + TBuf value; + value.Copy( aValue ); + value.LowerCase(); + if ( 0 == value.Compare( KNetworkModeInfra ) ) + { + iCurrentIap.iNetworkMode = CMManager::EInfra; + iSettingsSet = ETrue; + } + else if ( 0 == value.Compare( KNetworkModeAdhoc ) ) + { + iCurrentIap.iNetworkMode = CMManager::EAdhoc; + iSettingsSet = ETrue; + } + break; + } + case EPreSharedKey: + { + if ( EWlan == aType && !iCurrentIap.iPreSharedKey ) + { + TRAPD( err, iCurrentIap.iPreSharedKey = aValue.AllocL() ); + if ( KErrNone == err ) + { + iSettingsSet = ETrue; + } + } + break; + } + case EWepAuthMode: + { + if ( EWlan != aType ) + { + break; + } + TBuf value; + value.Copy( aValue ); + value.LowerCase(); + if ( 0 == value.Compare( KWepAuthModeOpen ) ) + { + iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen; + iSettingsSet = ETrue; + } + else if ( 0 == value.Compare( KWepAuthModeShared ) ) + { + iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthShared; + iSettingsSet = ETrue; + } + break; + } + case ELength: + { + if ( EWepKey == aType && + KErrNone == VoipXmlUtils::DesToInt( aValue, intValue )) + { + iCurrentIap.iCurrentWepKey.iLength = intValue; + iSettingsSet = ETrue; + } + break; + } + case EData: + { + if ( EWepKey == aType && KMaxWepKeyDataLength >= aValue.Length() ) + { + iCurrentIap.iCurrentWepKey.iData.Copy( aValue ); + iSettingsSet = ETrue; + } + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Stores settings. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlIapHandler::StoreSettings() + { + if ( !iSettingsSet ) + { + // No settings to be stored => method not supported. + return KErrNotSupported; + } + TRAPD( err, StoreSettingsL() ); + if ( KErrNone != err ) + { + err = KErrCompletion; + } + return err; + } + +// --------------------------------------------------------------------------- +// Returns Destination ID. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlIapHandler::SettingsId() + { + return iDestinationId; + } + +// --------------------------------------------------------------------------- +// Informs that currently deployed settings have ended. +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::SettingsEnd( TInt aType ) + { + if ( EWepKey == aType && iCurrentIap.iWepKeys.Count() < KMaxWepKeyCount ) + { + TInt keyDataLength = iCurrentIap.iCurrentWepKey.iData.Length(); + TBool okToAdd( EFalse ); + switch ( keyDataLength ) + { + case EWepKey64Hex: + { + iCurrentIap.iCurrentWepKey.iHex = ETrue; + okToAdd = ETrue; + break; + } + case EWepKey64Ascii: + { + iCurrentIap.iCurrentWepKey.iHex = EFalse; + okToAdd = ETrue; + break; + } + case EWepKey128Hex: + { + iCurrentIap.iCurrentWepKey.iHex = ETrue; + okToAdd = ETrue; + break; + } + case EWepKey128Ascii: + { + iCurrentIap.iCurrentWepKey.iHex = EFalse; + okToAdd = ETrue; + break; + } + default: + break; + } + if ( okToAdd ) + { + iCurrentIap.iWepKeys.Append( iCurrentIap.iCurrentWepKey ); + } + iCurrentIap.iCurrentWepKey.iLength = 0; + iCurrentIap.iCurrentWepKey.iData.Zero(); + } + else if ( EWlan == aType ) + { + TRAP_IGNORE( AddCurrentIapL() ); + ResetCurrentIap(); + } + } + +// --------------------------------------------------------------------------- +// Resets iCurrentIap members. +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::ResetCurrentIap( TBool aCloseArray ) + { + if ( iCurrentIap.iName ) + { + delete iCurrentIap.iName; + iCurrentIap.iName = NULL; + } + if ( iCurrentIap.iPreSharedKey ) + { + delete iCurrentIap.iPreSharedKey; + iCurrentIap.iPreSharedKey = NULL; + } + if ( iCurrentIap.iSsid ) + { + delete iCurrentIap.iSsid; + iCurrentIap.iSsid = NULL; + } + iCurrentIap.iWepKeys.Reset(); + if ( aCloseArray ) + { + iCurrentIap.iWepKeys.Close(); + } + iCurrentIap.iHidden = EFalse; + iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen; + iCurrentIap.iNetworkMode = CMManager::EInfra; + iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen; + } + +// --------------------------------------------------------------------------- +// Resets iIaps members. +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::ResetTempIapArray( TBool aCloseArray ) + { + const TInt count = iIaps.Count(); + for ( TInt counter = 0; counter < count; counter++ ) + { + if ( iIaps[counter]->iName ) + { + delete iIaps[counter]->iName; + iIaps[counter]->iName = NULL; + } + if ( iIaps[counter]->iPreSharedKey ) + { + delete iIaps[counter]->iPreSharedKey; + iIaps[counter]->iPreSharedKey = NULL; + } + if ( iIaps[counter]->iSsid ) + { + delete iIaps[counter]->iSsid; + iIaps[counter]->iSsid = NULL; + } + iIaps[counter]->iWepKeys.Reset(); + if ( aCloseArray ) + { + iIaps[counter]->iWepKeys.Close(); + } + } + iIaps.ResetAndDestroy(); + if ( aCloseArray ) + { + iIaps.Close(); + } + } + +// --------------------------------------------------------------------------- +// Adds iCurrentIap into iIaps array, i.e. copies its values to a pointer +// and appends that one into the array. +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::AddCurrentIapL() + { + if ( !iCurrentIap.iSsid ) + { + // If there is no SSID, we won't add the IAP to array. + return; + } + TTemporaryIap* iap = new TTemporaryIap; + iap->iSsid = HBufC::NewLC( KMaxNodeValueLength ); // CS:1 + iap->iName = HBufC::NewLC( KMaxNodeValueLength ); // CS:2 + iap->iPreSharedKey = HBufC::NewLC( KMaxNodeValueLength ); // CS:3 + + iap->iSsid->Des().Copy( iCurrentIap.iSsid->Des() ); + if ( iCurrentIap.iName ) + { + iap->iName->Des().Copy( iCurrentIap.iName->Des() ); + } + else + { + iap->iName->Des().Copy( iCurrentIap.iSsid->Des() ); + } + if ( iCurrentIap.iPreSharedKey ) + { + iap->iPreSharedKey->Des().Copy( iCurrentIap.iPreSharedKey->Des() ); + } + iap->iHidden = iCurrentIap.iHidden; + iap->iNetworkMode = iCurrentIap.iNetworkMode; + iap->iSecurityType = iCurrentIap.iSecurityType; + iap->iWepAuthMode = iCurrentIap.iWepAuthMode; + const TInt count = iCurrentIap.iWepKeys.Count(); + for ( TInt counter = 0; counter < count; counter++ ) + { + iap->iWepKeys.Append( iCurrentIap.iWepKeys[counter] ); + } + iIaps.AppendL( iap ); + CleanupStack::Pop( 3, iap->iSsid ); + } + +// --------------------------------------------------------------------------- +// Stores settings. +// --------------------------------------------------------------------------- +// +void CVoipXmlIapHandler::StoreSettingsL() + { + RCmManagerExt cmm; + cmm.OpenLC(); // CS:1 + + // First create all access points and store their ID's. + const TInt iapCount = iIaps.Count(); + RArray iapIds; + CleanupClosePushL( iapIds ); // CS:2 + for ( TInt counter = 0; counter < iapCount; counter++ ) + { + TUint32 id = CreateIapL( cmm, *iIaps[counter] ); + iapIds.AppendL( id ); + } + + // Create a destination if one was configured. + if ( iDestinationName->Des().Length() ) + { + RArray destinationIds; + // Get destination ID's for checking if name to be set is reserved. + CleanupClosePushL( destinationIds ); // CS:3 + cmm.AllDestinationsL( destinationIds ); + HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:4 + newName->Des().Copy( iDestinationName->Des() ); + + // Check that name is unique. + const TInt destinationCount = destinationIds.Count(); + for ( TInt counter = 0; counter < destinationCount; counter++ ) + { + RCmDestinationExt destination = cmm.DestinationL( + destinationIds[counter] ); + CleanupClosePushL( destination ); // CS:5 + HBufC* settingsName = destination.NameLC(); // CS:6 + TUint i( 1 ); // Add number to the name if name already in use. + if ( 0 == newName->Des().Compare( settingsName->Des() ) ) + { + // If the name is changed we need to begin the comparison + // again from the first profile. + newName->Des().Copy( iDestinationName->Des() ); + newName->Des().Append( KOpenParenthesis() ); + newName->Des().AppendNum( i ); + newName->Des().Append( KClosedParenthesis() ); + counter = 0; + i++; + if ( KMaxProfileNames < i ) + { + User::Leave( KErrBadName ); + } + } + // settingsName, &destination + CleanupStack::PopAndDestroy( 2, &destination ); // CS:4 + } + RCmDestinationExt newDestination = cmm.CreateDestinationL( *newName ); + CleanupClosePushL( newDestination ); // CS:5 + // We need to run UpdateL in order to get destination ID. + newDestination.UpdateL(); + iDestinationId = newDestination.Id(); + const TInt cmCount = iapIds.Count(); + for ( TInt counter = 0; counter < cmCount; counter++ ) + { + RCmConnectionMethodExt connection = cmm.ConnectionMethodL( + iapIds[counter] ); + CleanupClosePushL( connection ); + newDestination.AddConnectionMethodL( connection ); + CleanupStack::PopAndDestroy( &connection ); + } + newDestination.UpdateL(); + + // &newDestination, newName, &destinationIds + CleanupStack::PopAndDestroy( 3, &destinationIds ); // CS:2 + } + // &iapIds, &cmm + CleanupStack::PopAndDestroy( 2, &cmm ); // CS:0 + } + +// --------------------------------------------------------------------------- +// Creates an actual IAP. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlIapHandler::CreateIapL( RCmManagerExt& aCmManager, + TTemporaryIap aTempIap ) + { + RCmConnectionMethodExt newConnMethod = + aCmManager.CreateConnectionMethodL( KUidWlanBearerType ); + CleanupClosePushL( newConnMethod ); // CS:1 + newConnMethod.SetStringAttributeL( CMManager::ECmName, + aTempIap.iName->Des() ); + newConnMethod.SetStringAttributeL( CMManager::EWlanSSID, + aTempIap.iSsid->Des() ); + newConnMethod.SetIntAttributeL( CMManager::EWlanConnectionMode, + aTempIap.iNetworkMode ); + if ( aTempIap.iHidden ) + { + newConnMethod.SetBoolAttributeL( CMManager::EWlanScanSSID, ETrue ); + } + newConnMethod.SetIntAttributeL( CMManager::EWlanSecurityMode, + aTempIap.iSecurityType ); + newConnMethod.UpdateL(); + TUint32 wlanId = newConnMethod.GetIntAttributeL( + CMManager::EWlanServiceId ); + TUint32 iapId = newConnMethod.GetIntAttributeL( CMManager::ECmIapId ); + + CleanupStack::PopAndDestroy( &newConnMethod ); // CS:0 + + if ( aTempIap.iSecurityType == CMManager::EWlanSecModeWep ) + { + CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() ); + // CS:1 + CWEPSecuritySettings* wepSecSettings = + CWEPSecuritySettings::NewL(); + CleanupStack::PushL( wepSecSettings ); // CS:2 + const TInt wepKeyCount = aTempIap.iWepKeys.Count(); + for ( TInt counter = 0; counter < wepKeyCount; counter++ ) + { + User::LeaveIfError( wepSecSettings->SetKeyDataL( + counter, aTempIap.iWepKeys[counter].iData, + aTempIap.iWepKeys[counter].iHex ) ); + } + wepSecSettings->SaveL( wlanId, *db ); + // wepSecSettings, db + CleanupStack::PopAndDestroy( 2, db ); // CS:0 + } + else if ( aTempIap.iSecurityType == CMManager::EWlanSecMode802_1x || + aTempIap.iSecurityType == CMManager::EWlanSecModeWpa || + aTempIap.iSecurityType == CMManager::EWlanSecModeWpa2 ) + { + CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() ); + // CS:1 + CWPASecuritySettings* wpaSecSettings = + CWPASecuritySettings::NewL( ESecurityModeWpa ); + CleanupStack::PushL( wpaSecSettings ); // CS:2 + User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( + aTempIap.iPreSharedKey->Des() )); + wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 ); + // wpaSecSettings, db + CleanupStack::PopAndDestroy( 2, db ); // CS:0 + } + return iapId; + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlnatfwhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlnatfwhandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,436 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: NAT/Firewall handler for VoIP XML processor +* +*/ + + +#include +#include + +#include "voipxmlutils.h" +#include "voipxmlnatfwhandler.h" +#include "voipxmlprocessorlogger.h" +//#include "voipxmlprocessordefaults.h" + +// --------------------------------------------------------------------------- +// CVoipXmlNatFwHandler::CVoipXmlNatFwHandler +// --------------------------------------------------------------------------- +// +CVoipXmlNatFwHandler::CVoipXmlNatFwHandler() + { + } + +// --------------------------------------------------------------------------- +// CVoipXmlNatFwHandler::NewL +// --------------------------------------------------------------------------- +// +CVoipXmlNatFwHandler* CVoipXmlNatFwHandler::NewL() + { + CVoipXmlNatFwHandler* self = new ( ELeave ) CVoipXmlNatFwHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CVoipXmlNatFwHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlNatFwHandler::ConstructL() + { + iDomain = HBufC8::NewL( KMaxNodeValueLength ); + iStunSrvAddr = HBufC8::NewL( KMaxNodeValueLength ); + iStunSrvUsername = HBufC8::NewL( KMaxNodeValueLength ); + iStunSrvPassword = HBufC8::NewL( KMaxNodeValueLength ); + iNatProtocol = HBufC8::NewL( KMaxNodeValueLength ); + iNatProtocol->Des().Copy( KDefaultNatProtocol ); + iStunSrvPort = KDefaultStunServerPort; + iTcpRefreshInterval = KDefaultTcpRefreshInterval; + iUdpRefreshInterval = KDefaultUdpRefreshInterval; + iStartPortRange = KDefaultStartPortRange; + iEndPortRange = KDefaultEndPortRange; + iCurrentAdditionalStunServer.iStunSrvPort = KDefaultStunServerPort; + } + +// --------------------------------------------------------------------------- +// CVoipXmlNatFwHandler::~CVoipXmlNatFwHandler +// --------------------------------------------------------------------------- +// +CVoipXmlNatFwHandler::~CVoipXmlNatFwHandler() + { + delete iDomain; + delete iStunSrvAddr; + delete iStunSrvUsername; + delete iStunSrvPassword; + delete iNatProtocol; + iAdditionalStunServers.ResetAndDestroy(); + iAdditionalStunServers.Close(); + } + +// --------------------------------------------------------------------------- +// Sets a NAT/Firewall setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlNatFwHandler::SetSetting( TInt aType, TInt aParam, + const TDesC8& aValue ) + { + // Ignore too long descriptors. + if ( KMaxNodeValueLength < aValue.Length() ) + { + return; + } + + TInt intVal( KErrNotFound ); + switch ( aParam ) + { + case EDomain: + { + iDomain->Des().Copy( aValue ); + iSettingsSet = ETrue; + break; + } + case EUri: + { + if ( ENatFw == aType ) + { + iStunSrvAddr->Des().Copy( aValue ); + iSettingsSet = ETrue; + } + else if ( EAdditionalStun == aType ) + { + iCurrentAdditionalStunServer.iStunSrvAddr.Copy( aValue ); + iSettingsSet = ETrue; + } + break; + } + case EPort: + { + if ( ENatFw == aType && KErrNone == VoipXmlUtils::Des8ToInt( + aValue, intVal ) ) + { + iStunSrvPort = intVal; + iSettingsSet = ETrue; + } + else if ( EAdditionalStun == aType && + KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iCurrentAdditionalStunServer.iStunSrvPort = intVal; + iSettingsSet = ETrue; + } + break; + } + case ETcpRefreshInterval: + { + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iTcpRefreshInterval = intVal; + iSettingsSet = ETrue; + } + break; + } + case EUdpRefreshInterval: + { + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iUdpRefreshInterval = intVal; + iSettingsSet = ETrue; + } + break; + } + case ECrlfRefresh: + { + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iCrlfRefresh = intVal; + iSettingsSet = ETrue; + } + break; + } + case EUsername: + { + if ( ENatFw == aType ) + { + iStunSrvUsername->Des().Copy( aValue ); + iSettingsSet = ETrue; + } + else if ( EAdditionalStun == aType ) + { + iCurrentAdditionalStunServer.iStunSrvUsername.Copy( aValue ); + iSettingsSet = ETrue; + } + break; + } + case EPassword: + { + if ( ENatFw == aType ) + { + iStunSrvPassword->Des().Copy( aValue ); + iSettingsSet = ETrue; + } + else if ( EAdditionalStun == aType ) + { + iCurrentAdditionalStunServer.iStunSrvPassword.Copy( aValue ); + iSettingsSet = ETrue; + } + break; + } + case EStunSharedSecret: + { + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iStunSharedSecret = intVal; + iSettingsSet = ETrue; + } + break; + } + case EStartPort: + { + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iStartPortRange = intVal; + iSettingsSet = ETrue; + } + break; + } + case EEndPort: + { + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) ) + { + iEndPortRange = intVal; + iSettingsSet = ETrue; + } + break; + } + case EType: + { + iNatProtocol->Des().Copy( aValue ); + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Stores settings to Central Repository. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlNatFwHandler::StoreSettings() + { + if ( !iSettingsSet ) + { + // No settings to be stored => method not supported. + return KErrNotSupported; + } + TRAPD( err, StoreSettingsL() ); + if ( KErrNone != err ) + { + err = KErrCompletion; + } + return err; + } + +// --------------------------------------------------------------------------- +// Appends currently modified additional STUN server to internal array. +// --------------------------------------------------------------------------- +// +void CVoipXmlNatFwHandler::SettingsEnd( TInt aType ) + { + if ( EAdditionalStun == aType ) + { + TAdditionalStun* temp = new TAdditionalStun; + temp->iStunSrvAddr.Copy( iCurrentAdditionalStunServer.iStunSrvAddr ); + temp->iStunSrvPort = iCurrentAdditionalStunServer.iStunSrvPort; + temp->iStunSrvUsername.Copy( + iCurrentAdditionalStunServer.iStunSrvUsername ); + temp->iStunSrvPassword.Copy( + iCurrentAdditionalStunServer.iStunSrvPassword ); + iAdditionalStunServers.Append( temp ); + iCurrentAdditionalStunServer.iStunSrvAddr.Copy( KNullDesC8 ); + iCurrentAdditionalStunServer.iStunSrvPort = KDefaultStunServerPort; + iCurrentAdditionalStunServer.iStunSrvUsername.Copy( KNullDesC8 ); + iCurrentAdditionalStunServer.iStunSrvPassword.Copy( KNullDesC8 ); + } + } + +// --------------------------------------------------------------------------- +// Commits Central Repository storage. +// --------------------------------------------------------------------------- +// +void CVoipXmlNatFwHandler::StoreSettingsL() + { + CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols ); // CS:1 + + RArray keys; + CleanupClosePushL( keys ); // CS:2 + + // Get next free Domain key. + rep->FindL( KUNSAFProtocolsDomainMask, + KUNSAFProtocolsFieldTypeMask, keys ); + TInt keyCount = keys.Count(); + TInt tmp = 0; + if ( !keyCount ) + { + tmp = KUNSAFProtocolsDomainTableMask; + } + else + { + tmp = keys[keyCount - 1] + 1; + } + + rep->FindEqL( KUNSAFProtocolsDomainMask, KUNSAFProtocolsFieldTypeMask, + iDomain->Des(), keys ); + if ( keys.Count() ) + { + tmp = keys[0]; + } + + TUint32 currentKey = tmp|KUNSAFProtocolsDomainMask; + currentKey &= KUNSAFProtocolsKeyMask; + + TUint32 currentDomainKey = tmp|KUNSAFProtocolsFieldTypeMask; + currentDomainKey ^= KUNSAFProtocolsFieldTypeMask; + + TUint32 stunKey = KUNSAFProtocolsSubTableFieldTypeMask; + stunKey ^= KUNSAFProtocolsSubTableFieldTypeMask; + stunKey |= currentDomainKey; + + // Delete all existing additional STUN servers if there are any. + RArray stunKeys; + CleanupClosePushL( stunKeys ); // CS:3 + TInt err = rep->FindL( + currentDomainKey|KUNSAFProtocolsSTUNAddressMask, + KUNSAFProtocolsSubTableFieldTypeMask, stunKeys ); + const TInt stunKeyCount = stunKeys.Count(); + for ( TInt counter = 0 ; counter < stunKeyCount; counter++ ) + { + TUint32 key = KUNSAFProtocolsSTUNAddressMask^ + stunKeys[counter]; + rep->Delete( key|KUNSAFProtocolsSTUNAddressMask ); + rep->Delete( key|KUNSAFProtocolsSTUNPortMask ); + rep->Delete( key|KUNSAFProtocolsSTUNUsernameMask ); + rep->Delete( key|KUNSAFProtocolsSTUNPasswordMask ); + } + CleanupStack::PopAndDestroy( &stunKeys ); // CS:2 + + // Set new keys. + + // Domain + User::LeaveIfError( rep->Set( currentKey|KUNSAFProtocolsDomainMask, + iDomain->Des() )); + + // STUN server address. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsSTUNServerMask|currentDomainKey, + iStunSrvAddr->Des() ) ); + // Set the same value into STUN server table. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsSTUNAddressMask|stunKey, + iStunSrvAddr->Des() ) ); + + // STUN server port. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsSTUNServerPortMask|currentDomainKey, + iStunSrvPort ) ); + // Set the same value into STUN server table. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsSTUNPortMask|stunKey, + iStunSrvPort ) ); + + // TCP refresh interval. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsDomainIntervalTCPMask|currentDomainKey, + iTcpRefreshInterval ) ); + + // UDP refresh interval. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsDomainIntervalUDPMask|currentDomainKey, + iUdpRefreshInterval ) ); + + // CRLF refresh. + User::LeaveIfError( rep->Set( + KUNSAFProtocolsDomainEnableCRLFRefresh|currentDomainKey, + iCrlfRefresh ) ); + + // STUN server username + User::LeaveIfError( rep->Set( + KUNSAFProtocolsSTUNUsernameMask|stunKey, + iStunSrvUsername->Des() ) ); + + // STUN server password + User::LeaveIfError( rep->Set( + KUNSAFProtocolsSTUNPasswordMask|stunKey, + iStunSrvPassword->Des() ) ); + + // STUN shared secret + User::LeaveIfError( rep->Set( currentDomainKey| + KUNSAFProtocolsDomainSharedSecretNotSupported, + !iStunSharedSecret ) ); + + // Start port range + User::LeaveIfError( rep->Set( + currentDomainKey|KUNSAFProtocolsPortPoolStartPortMask, + iStartPortRange ) ); + + // End port range. + User::LeaveIfError( rep->Set( + currentDomainKey|KUNSAFProtocolsPortPoolEndPortMask, + iEndPortRange ) ); + + // Used NAT protocol. + User::LeaveIfError( rep->Set( + currentDomainKey|KUNSAFProtocolsUsedNATProtocolMask, + iNatProtocol->Des() ) ); + + // ============================== + // Additional STUN servers + // ============================== + // + const TInt count = iAdditionalStunServers.Count(); + for ( TInt counter = 0; counter < count; counter++ ) + { + stunKey |= KUNSAFProtocolsSubTableFieldTypeMask; + stunKey++; + stunKey |= KUNSAFProtocolsSubTableFieldTypeMask; + stunKey ^= KUNSAFProtocolsSubTableFieldTypeMask; + stunKey |= currentDomainKey; + + // STUNServerAddress + User::LeaveIfError( rep->Create( + KUNSAFProtocolsSTUNAddressMask|stunKey, + iAdditionalStunServers[counter]->iStunSrvAddr ) ); + + // STUNServerPort + User::LeaveIfError( rep->Create( + KUNSAFProtocolsSTUNPortMask|stunKey, + iAdditionalStunServers[counter]->iStunSrvPort ) ); + + // STUNServerUsername + User::LeaveIfError( rep->Create( + KUNSAFProtocolsSTUNUsernameMask|stunKey, + iAdditionalStunServers[counter]->iStunSrvUsername ) ); + + // STUNServerPassword + User::LeaveIfError( rep->Create( + KUNSAFProtocolsSTUNPasswordMask|stunKey, + iAdditionalStunServers[counter]->iStunSrvPassword ) ); + } + + // &keys, rep + CleanupStack::PopAndDestroy( 2, rep ); // CS:0 + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparamhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparamhandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,619 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VoIP settings XML parameter handler. +* +*/ + + +#include "voipxmlparamhandler.h" +#include "voipxmlsiphandler.h" +#include "voipxmlvoiphandler.h" +#include "voipxmlxdmhandler.h" +#include "voipxmlpresencehandler.h" +#include "voipxmlnatfwhandler.h" +#include "voipxmliaphandler.h" +#include "voipxmlprocessordefaults.h" + +// --------------------------------------------------------------------------- +// Default constructor. +// --------------------------------------------------------------------------- +// +CVoipXmlParamHandler::CVoipXmlParamHandler() + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlParamHandler::ConstructL() + { + iSettingsType = EUnknown; + iPreviousSettingsType = EUnknown; + iSipHandler = CVoipXmlSipHandler::NewL(); + iVoipHandler = CVoipXmlVoipHandler::NewL(); + iXdmHandler = CVoipXmlXdmHandler::NewL(); + iPresenceHandler = CVoipXmlPresenceHandler::NewL(); + iNatFwHandler = CVoipXmlNatFwHandler::NewL(); + iIapHandler = CVoipXmlIapHandler::NewL(); + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CVoipXmlParamHandler* CVoipXmlParamHandler::NewL() + { + CVoipXmlParamHandler* self = CVoipXmlParamHandler::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// NewLC +// --------------------------------------------------------------------------- +// +CVoipXmlParamHandler* CVoipXmlParamHandler::NewLC() + { + CVoipXmlParamHandler* self = new( ELeave ) CVoipXmlParamHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CVoipXmlParamHandler::~CVoipXmlParamHandler() + { + delete iSipHandler; + delete iVoipHandler; + delete iXdmHandler; + delete iPresenceHandler; + delete iNatFwHandler; + delete iIapHandler; + } + +// --------------------------------------------------------------------------- +// Marks the currently deployed settings. +// --------------------------------------------------------------------------- +// +void CVoipXmlParamHandler::SettingsStart( const TDesC& aType ) + { + TBuf type( KNullDesC ); + type.Copy( aType ); + type.LowerCase(); + iPreviousSettingsType = iSettingsType; + if ( KSettingsTypeVoip() == type ) + { + iSettingsType = EVoip; + } + else if ( KSettingsTypeSip() == type ) + { + iSettingsType = ESip; + } + else if ( KSettingsTypePresence() == type ) + { + iSettingsType = EPresence; + } + else if ( KSettingsTypeXdm() == type ) + { + iSettingsType = EXdm; + } + else if ( KSettingsTypeNatFw() == type ) + { + iSettingsType = ENatFw; + } + else if ( KSettingsTypeCodec() == type ) + { + iSettingsType = ECodec; + } + else if ( KSettingsTypeVmbx() == type ) + { + iSettingsType = EVmbx; + } + else if ( KSettingsTypeProxy() == type ) + { + iSettingsType = EProxy; + } + else if ( KSettingsTypeRegistrar() == type ) + { + iSettingsType = ERegistrar; + } + else if ( KSettingsTypeAdditionalStun() == type ) + { + iSettingsType = EAdditionalStun; + } + else if ( KSettingsTypeWlan() == type ) + { + iSettingsType = EWlan; + } + else if ( KSettingsTypeWepKey() == type ) + { + iSettingsType = EWepKey; + } + else if ( KSettingsTypeDestination() == type ) + { + iSettingsType = EDestination; + } + else + { + iSettingsType = EUnknown; + } + } + +// --------------------------------------------------------------------------- +// Marks the currently deployed settings as 'ready', i.e. sets current +// settings type to previous one and informs settings handlers. +// --------------------------------------------------------------------------- +// +void CVoipXmlParamHandler::SettingsEnd() + { + iVoipHandler->SettingsEnd( iSettingsType ); + iNatFwHandler->SettingsEnd( iSettingsType ); + iIapHandler->SettingsEnd( iSettingsType ); + iSettingsType = iPreviousSettingsType; + iPreviousSettingsType = EUnknown; + } + +// --------------------------------------------------------------------------- +// Handles XML parameters, i.e. converts parameter names to enum and sets +// the values to setting handlers. +// --------------------------------------------------------------------------- +// +void CVoipXmlParamHandler::HandleParameter( const TDesC& aParam, + const TDesC& aValue ) + { + switch ( iSettingsType ) + { + case EVoip: + case EVmbx: + case ECodec: + { + TInt param = ConvertParameter( aParam ); + iVoipHandler->SetSetting( iSettingsType, param, aValue ); + } + break; + case ESip: + case EProxy: + case ERegistrar: + { + TInt param = ConvertParameter( aParam ); + TBuf8 value; + value.Copy( aValue ); + iSipHandler->SetSetting( iSettingsType, param, value ); + } + break; + case EPresence: + { + TInt param = ConvertParameter( aParam ); + iPresenceHandler->SetSetting( param, aValue ); + } + break; + case EXdm: + { + TInt param = ConvertParameter( aParam ); + iXdmHandler->SetSetting( param, aValue ); + } + break; + case ENatFw: + case EAdditionalStun: + { + TInt param = ConvertParameter( aParam ); + TBuf8 value; + value.Copy( aValue ); + iNatFwHandler->SetSetting( iSettingsType, param, value ); + } + break; + case EWlan: + case EWepKey: + case EDestination: + { + TInt param = ConvertParameter( aParam ); + iIapHandler->SetSetting( iSettingsType, param, aValue ); + } + break; + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Stores settings, i.e. sends store commands to settings handlers. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlParamHandler::StoreSettings() + { + // First send 'basic' store commands. + TInt err( KErrNone ); + err = iSipHandler->StoreSettings(); + if ( KErrNone != err ) + { + return err; + } + err = iVoipHandler->StoreSettings(); + if ( KErrNone != err ) + { + return err; + } + err = iXdmHandler->StoreSettings(); + // If there were no settings, ignore error code. + if ( KErrNotSupported == err ) + { + err = KErrNone; + } + err = iPresenceHandler->StoreSettings(); + // If there were no settings, ignore error code. + if ( KErrNotSupported == err ) + { + err = KErrNone; + } + + err = iNatFwHandler->StoreSettings(); + // If there were no settings, ignore error code. + if ( KErrNotSupported == err ) + { + err = KErrNone; + } + + err = iIapHandler->StoreSettings(); + // If there were no settings, ignore error code. + if ( KErrNotSupported == err ) + { + err = KErrNone; + } + + // Send linkage information. + iSipHandler->LinkSettings( EDestination, iIapHandler->SettingsId() ); + iVoipHandler->LinkSettings( ESip, iSipHandler->SettingsId() ); + iVoipHandler->LinkSettings( EPresence, iPresenceHandler->SettingsId() ); + iVoipHandler->LinkSettings( EDestination, iIapHandler->SettingsId() ); + iPresenceHandler->LinkSettings( ESip, iSipHandler->SettingsId() ); + iPresenceHandler->LinkSettings( EXdm, iXdmHandler->SettingsId() ); + + // Send finalizing commands. + iSipHandler->FinalizeSettings(); // Ignore error code. + err = iVoipHandler->FinalizeSettings(); + iPresenceHandler->FinalizeSettings(); // Ignore error code. + return err; + } + +// --------------------------------------------------------------------------- +// Returns the VoIP service ID. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlParamHandler::ServiceTabId() + { + TUint32 tabId( KErrNone ); + TRAP_IGNORE( tabId = iVoipHandler->ServiceTabIdL() ); + return tabId; + } + +// --------------------------------------------------------------------------- +// Converts parameter name to enumerated parameter. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlParamHandler::ConvertParameter( const TDesC& aParam ) + { + TBuf name( KNullDesC ); + name.Copy( aParam ); + name.LowerCase(); + // ============================== + // Generic parameters. + // ============================== + // + if ( KParamValueName() == name ) + { + return EName; + } + else if ( KParamValueUri() == name ) + { + return EUri; + } + else if ( KParamValueTransport() == name ) + { + return ETransport; + } + else if ( KParamValuePort() == name ) + { + return EPort; + } + else if ( KParamValueUsername() == name ) + { + return EUsername; + } + else if ( KParamValuePassword() == name ) + { + return EPassword; + } + else if ( KParamValueType() == name ) + { + return EType; + } + else if ( KParamValueDomain() == name ) + { + return EDomain; + } + else if ( KParamValueStartPort() == name ) + { + return EStartPort; + } + else if ( KParamValueEndPort() == name ) + { + return EEndPort; + } + // ============================== + // VoIP 'core' parametes. + // ============================== + // + else if ( KParamValueMediaQos() == name ) + { + return EMediaQos; + } + else if ( KParamValueDtmfInband() == name ) + { + return EDtmfInband; + } + else if ( KParamValueDtmfOutband() == name ) + { + return EDtmfOutband; + } + else if ( KParamValueSecureCallPref() == name ) + { + return ESecureCallPreference; + } + else if ( KParamValueVoipOverWcdma() == name ) + { + return EAllowVoipOverWcdma; + } + else if ( KParamValueRtcp() == name ) + { + return ERtcp; + } + else if ( KParamValueUserAgentTerminalType() == name ) + { + return EUserAgentHeaderTerminalType; + } + else if ( KParamValueUserAgentWlanMac() == name ) + { + return EUserAgentHeaderWlanMac; + } + else if ( KParamValueUserAgentFreeString() == name ) + { + return EUserAgentHeaderFreeString; + } + else if ( KParamValueCallerIdDigits() == name ) + { + return ECallerIdDigits; + } + else if ( KParamValueIgnoreDomainPart() == name ) + { + return EIgnoreDomainPart; + } + else if ( KParamValueAutoAcceptBuddyRequests() == name ) + { + return EAutoAcceptBuddyRequests; + } + else if ( KParamValueAddUserPhone() == name ) + { + return EAddUserPhone; + } + else if ( KParamValueProviderUrl() == name ) + { + return EProviderUrl; + } + else if ( KParamValueMinSessionInterval() == name ) + { + return EMinSessionInterval; + } + else if ( KParamValueSessionInterval() == name ) + { + return ESessionInterval; + } + else if ( KParamValueBrandingUri() == name ) + { + return EBrandingUri; + } + else if ( KParamValueAutoEnable() == name ) + { + return EAutoEnable; + } + else if ( KParamValueEnableSipIm() == name ) + { + return EEnableSipIm; + } + else if ( KParamValueBrandId() == name ) + { + return EBrandId; + } + // ============================== + // VoIP voicemailbox parameters. + // ============================== + // + else if ( KParamValueMwiUri() == name ) + { + return EMwiUri; + } + else if ( KParamValueListeningUri() == name ) + { + return EListeningUri; + } + else if ( KParamValueReSubscribeInterval() == name ) + { + return EReSubscribeInterval; + } + // ============================== + // VoIP codec parameters. + // ============================== + // + else if ( KParamValueJitterBuffer() == name ) + { + return EJitterBuffer; + } + else if ( KParamValueOctetAlign() == name ) + { + return EOctetAlign; + } + else if ( KParamValuePTime() == name ) + { + return EPTime; + } + else if ( KParamValueMaxPTime() == name ) + { + return EMaxPTime; + } + else if ( KParamValueModeSet() == name ) + { + return EModeSet; + } + else if ( KParamValueModeChangePeriod() == name ) + { + return EModeChangePeriod; + } + else if ( KParamValueModeChangeNeighbor() == name ) + { + return EModeChangeNeighbor; + } + else if ( KParamValueMaxRed() == name ) + { + return EMaxRed; + } + else if ( KParamValueVad() == name ) + { + return EVad; + } + else if ( KParamValueAnnexB() == name ) + { + return EAnnexb; + } + // ============================== + // SIP parameters. + // ============================== + // + else if ( KParamValueSignalingQos() == name ) + { + return ESignalingQos; + } + else if ( KParamValuePublicUserId() == name ) + { + return EPublicUserId; + } + else if ( KParamValueSignalCompression() == name ) + { + return ESignalCompression; + } + else if ( KParamValueSecurityNegotiation() == name ) + { + return ESecurityNegotiation; + } + else if ( KParamValueProfileLock() == name ) + { + return EProfileLock; + } + else if ( KParamValueAutoRegistration() == name ) + { + return EAutoRegistration; + } + else if ( KParamValueLooseRouting() == name ) + { + return ELooseRouting; + } + // ============================== + // Presence parameters. + // ============================== + // + else if ( KParamValueMaxObjectSize() == name ) + { + return EMaxObjectSize; + } + else if ( KParamValuePublishInterval() == name ) + { + return EPublishInterval; + } + else if ( KParamValueMaxSubscriptions() == name ) + { + return EMaxSubscriptions; + } + else if ( KParamValueMaxContacts() == name ) + { + return EMaxContacts; + } + else if ( KParamValueDomainSyntax() == name ) + { + return EDomainSyntax; + } + // ============================== + // NAT/Firewall parameters. + // ============================== + // + else if ( KParamValueTcpRefreshInterval() == name ) + { + return ETcpRefreshInterval; + } + else if ( KParamValueUdpRefreshInterval() == name ) + { + return EUdpRefreshInterval; + } + else if ( KParamValueCrlfRefresh() == name ) + { + return ECrlfRefresh; + } + else if ( KParamValueStunSharedSecret() == name ) + { + return EStunSharedSecret; + } + // ============================== + // WLAN IAP parameters. + // ============================== + // + else if ( KParamSsid() == name ) + { + return ESsid; + } + else if ( KParamHidden() == name ) + { + return EHidden; + } + else if ( KParamNetworkMode() == name ) + { + return ENetworkMode; + } + else if ( KParamPreSharedKey() == name ) + { + return EPreSharedKey; + } + else if ( KParamWepAuthMode() == name ) + { + return EWepAuthMode; + } + else if ( KParamLength() == name ) + { + return ELength; + } + else if ( KParamData() == name ) + { + return EData; + } + // ============================== + // Not supported. + // ============================== + // + else + { + return EUnSupported; + } + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparser.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,389 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VoIP settings XML handler +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voipxmlparser.h" +#include "voipxmlparamhandler.h" +#include "voipxmlprocessordefaults.h" +#include "voipxmlprocessorlogger.h" + + +// --------------------------------------------------------------------------- +// CVoipXmlParser::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CVoipXmlParser* CVoipXmlParser::NewL() + { + CVoipXmlParser* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::NewLC +// --------------------------------------------------------------------------- +// +EXPORT_C CVoipXmlParser* CVoipXmlParser::NewLC() + { + CVoipXmlParser* self = new ( ELeave ) CVoipXmlParser(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlParser::ConstructL() + { +DBG_PRINT( "CVoipXmlParser::ConstructL begin" ); + + iParser = CMDXMLParser::NewL( this ); + iParamHandler = CVoipXmlParamHandler::NewL(); + iDescription = HBufC::NewL( 0 ); + iBrandUrl = HBufC::NewL( 0 ); + +DBG_PRINT( "CVoipXmlParser::ConstructL end" ); + } + +// --------------------------------------------------------------------------- +// CVoIPXmlHandler::~CVoIPXmlHandler() +// Destructor +// --------------------------------------------------------------------------- +// +CVoipXmlParser::~CVoipXmlParser() + { + delete iParser; + delete iParamHandler; + if ( iXmlDoc ) + { + delete iXmlDoc; + } + if ( iDescription ) + { + delete iDescription; + } + if( iBrandUrl ) + { + delete iBrandUrl; + } + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::CVoipXmlParser +// --------------------------------------------------------------------------- +// +CVoipXmlParser::CVoipXmlParser() + { + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::ImportDocumentL +// Reads document. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CVoipXmlParser::ImportDocument( RFile& aFile, + TUint32& aServiceTabId ) + { + DBG_PRINT( "CVoipXmlParser::ImportDocumentL - begin" ); + iParseDescription = EFalse; + iParser->ParseFile( aFile ); + CActiveScheduler::Start(); + if ( KErrNone == iError ) + { + iError = iParamHandler->StoreSettings(); + } + if ( KErrNone == iError ) + { + // Give other applications 2 seconds to react + // to the newly created service. + const TInt KTwoSeconds( 2000000 ); + User::After( KTwoSeconds ); + aServiceTabId = iParamHandler->ServiceTabId(); + } + DBG_PRINT2( "CVoipXmlParser::ImportDocumentL - end (%d)", iError ); + return iError; + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::ReadDescription +// Reads document description. +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC* CVoipXmlParser::ReadDescriptionLC( RFile& aFile, + TDes8& aBrandUrl ) + { + DBG_PRINT( "CVoipXmlParser::ReadDescriptionLC begin" ); + iParseDescription = ETrue; + iParser->ParseFile( aFile ); + CActiveScheduler::Start(); + if ( !iDescription ) + { + iDescription = HBufC::NewL( 0 ); + } + HBufC* buf = HBufC::NewLC( iDescription->Des().Length() ); + buf->Des().Copy( iDescription->Des() ); + if ( !iBrandUrl ) + { + iBrandUrl = HBufC::NewL( 0 ); + } + aBrandUrl.Copy( iBrandUrl->Des() ); + DBG_PRINT( "CVoipXmlParser::ReadDescriptionLC end" ); + return buf; + } + +// --------------------------------------------------------------------------- +// From base class MMDXMLParserObserver. +// CVoipXmlParser::ParseFileCompleteL +// --------------------------------------------------------------------------- +// +void CVoipXmlParser::ParseFileCompleteL() + { + DBG_PRINT( "CVoipXmlParser::ParseFileCompleteL - begin" ); + // We may have already received XML document from iParser since we + // commit two parsing operations (first the description and then the + // settings). Thus we need to delete iXmlDoc because iParser has given + // its responsibility here. + if ( iXmlDoc ) + { + delete iXmlDoc; + iXmlDoc = NULL; + } + iXmlDoc = iParser->DetachXMLDoc(); + CActiveScheduler::Stop(); + if ( !iXmlDoc ) + { + iError = KErrCorrupt; + return; + } + CMDXMLElement* xmlElement = iXmlDoc->DocumentElement(); + if ( !xmlElement ) + { + iError = KErrCorrupt; + DBG_PRINT( "CVoipXmlParser::ParseFileCompleteL - end KErrCorrupt" ); + return; + } + + if ( iParseDescription ) + { + ParseDescription( *xmlElement ); + } + else + { + ParseRoot( *xmlElement ); + } + DBG_PRINT( "CVoipXmlParser::ParseFileCompleteL - end" ); + } + +// --------------------------------------------------------------------------- +// Parses description node. +// --------------------------------------------------------------------------- +// +void CVoipXmlParser::ParseDescription( CMDXMLElement& aXmlElement ) + { + CMDXMLNode* node = aXmlElement.FirstChild(); + if ( !node ) + { + iError = KErrCorrupt; + return; + } + TBuf nodeName; + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + + // is the root node; thus parse it first. + while ( nodeName != KNodeNokiaConfDoc && node ) + { + node = node->NextSibling(); + if ( !node ) + { + DBG_PRINT( "CVoipXmlParser::ParseRoot - end KErrEof" ); + iError = KErrEof; + return; + } + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + } + // After has been found, search for + // and from its children. + node = node->FirstChild(); + while ( node ) + { + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + CMDXMLNode* child = node->FirstChild(); + if ( KNodeConfDescription() == nodeName && child && + CMDXMLNode::ETextNode == child->NodeType() ) + { + CMDXMLText* text = NULL; + text = static_cast( child ); + delete iDescription; + iDescription = NULL; + TRAP_IGNORE( iDescription = text->Data().AllocL() ); + } + else if ( KNodeConfBrandUrl() == nodeName && child && + CMDXMLNode::ETextNode == child->NodeType() ) + { + CMDXMLText* text = NULL; + text = static_cast( child ); + delete iBrandUrl; + iBrandUrl = NULL; + TRAP_IGNORE( iBrandUrl = text->Data().AllocL() ); + } + node = node->NextSibling(); + } + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::ParseRoot +// Parses root node. +// --------------------------------------------------------------------------- +// +void CVoipXmlParser::ParseRoot( CMDXMLElement& aXmlElement ) + { + DBG_PRINT( "CVoipXmlParser::ParseRoot - begin" ); + + CMDXMLNode* node = aXmlElement.FirstChild(); + if ( !node ) + { + iError = KErrCorrupt; + return; + } + TBuf nodeName; + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + + while ( nodeName != KNodeNokiaConfDoc ) + { + node = node->NextSibling(); + if ( !node ) + { + DBG_PRINT( "CVoipXmlParser::ParseRoot - end KErrEof" ); + iError = KErrEof; + return; + } + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + } + + node = node->FirstChild(); + + TInt settingsCount( 0 ); + while ( node ) + { + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + // At this level in XML tree only 'settings' nodes are allowed. + if ( nodeName == KNodeSettings ) + { + ParseSettings( node ); + settingsCount++; + } + node = node->NextSibling(); + } + if ( !settingsCount ) + { + iError = KErrAbort; + } + DBG_PRINT( "CVoipXmlParser::ParseRoot - end" ); + + } + +// --------------------------------------------------------------------------- +// CVoipXmlParser::ParseSettingsL +// Parses 'settings' nodes. +// --------------------------------------------------------------------------- +// +void CVoipXmlParser::ParseSettings( CMDXMLNode* aXmlNode ) + { + DBG_PRINT( "CVoipXmlParser::ParseSettings - begin" ); + if ( CMDXMLNode::EElementNode != aXmlNode->NodeType() ) + { + DBG_PRINT( + "CVoipXmlParser::ParseSettings - node type not element, end" ); + iError = KErrBadHandle; + return; + } + + CMDXMLElement* element = NULL; + element = static_cast( aXmlNode ); + TPtrC attributeValue; + element->GetAttribute( KAttributeType(), attributeValue ); + if ( !attributeValue.Length() ) + { + DBG_PRINT( + "CVoipXmlParser::ParseSettings - attribute type not ok, end" ); + iError = KErrBadName; + } + + iParamHandler->SettingsStart( attributeValue ); + + + CMDXMLNode* node = element->FirstChild(); + + while ( node ) + { + if ( node->NodeType() == CMDXMLNode::EElementNode ) + { + + TBuf nodeName; + nodeName.Copy( node->NodeName() ); + nodeName.LowerCase(); + element = NULL; + element = static_cast( node ); + + if ( KNodeParam() == nodeName ) + { + TPtrC nameVal; + element->GetAttribute( KAttributeName(), nameVal ); + if ( nameVal.Length() ) + { + TPtrC attVal; + element->GetAttribute( KAttributeValue(), attVal ); + { + if ( attVal.Length() ) + { + iParamHandler->HandleParameter( + nameVal, attVal ); + } + } + } + } + else if ( KNodeSettings() == nodeName ) + { + ParseSettings( element ); + } + } + node = node->NextSibling(); + } + + iParamHandler->SettingsEnd(); + + DBG_PRINT( "CVoipXmlParser::ParseSettings - end" ); + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlpresencehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlpresencehandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,257 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Presence handler for VoIP XML processor +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voipxmlutils.h" +#include "voipxmlpresencehandler.h" +#include "voipxmlprocessorlogger.h" +#include "voipxmlprocessordefaults.h" + +// --------------------------------------------------------------------------- +// Default constructor. +// --------------------------------------------------------------------------- +// +CVoipXmlPresenceHandler::CVoipXmlPresenceHandler() + { + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CVoipXmlPresenceHandler* CVoipXmlPresenceHandler::NewL() + { + CVoipXmlPresenceHandler* self = new ( ELeave ) CVoipXmlPresenceHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +void CVoipXmlPresenceHandler::ConstructL() + { + iProfile.iObjectSize = KMaxObjectSize; + iProfile.iPublicationInt = KPublishInterval; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CVoipXmlPresenceHandler::~CVoipXmlPresenceHandler() + { + } + +// --------------------------------------------------------------------------- +// Sets Presence setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlPresenceHandler::SetSetting( TInt aParam, const TDesC& aValue ) + { + // Ignore too long descriptors. + if ( KMaxNodeValueLength < aValue.Length() ) + { + return; + } + + TInt intVal( KErrNotFound ); + switch ( aParam ) + { + case EName: + { + TBuf name( KNullDesC ); + name.Copy( aValue ); + TRAPD( err, CreateProviderNameL( name ) ); + if ( KErrNone == err ) + { + iProfile.iSetName.Copy( name ); + iSettingsSet = ETrue; + } + break; + } + case EMaxObjectSize: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal )) + { + iProfile.iObjectSize = intVal; + iSettingsSet = ETrue; + } + break; + } + case EPublishInterval: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal )) + { + iProfile.iPublicationInt = intVal; + iSettingsSet = ETrue; + } + break; + } + case EMaxSubscriptions: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal )) + { + iProfile.iMaxSubscriptions = intVal; + iSettingsSet = ETrue; + } + break; + } + case EMaxContacts: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal )) + { + iProfile.iMaxContactsInList = intVal; + iSettingsSet = ETrue; + } + break; + } + case EDomainSyntax: + { + iProfile.iDomainSyntax.Copy( aValue ); + iSettingsSet = ETrue; + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Stores settings to 'Presence registry', i.e. creates a new Presence set. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlPresenceHandler::StoreSettings() + { + if ( !iSettingsSet ) + { + // No settings to be stored => method not supported. + return KErrNotSupported; + } + iProfile.iStatusOfProps = EPresSettingOpened; + TRAPD( err, iProfileId = PresSettingsApi::CreateSetL( iProfile )); + if ( KErrNone != err ) + { + err = KErrCompletion; + } + return err; + } + +// --------------------------------------------------------------------------- +// Returns the profile ID if the profile saved in StoreSettings. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlPresenceHandler::SettingsId() + { + return iProfileId; + } + +// --------------------------------------------------------------------------- +// Links other settings to presence profile. +// --------------------------------------------------------------------------- +// +void CVoipXmlPresenceHandler::LinkSettings( TInt aType, TUint32 aSettingsId ) + { + switch ( aType ) + { + case ESip: + iProfile.iSipProfile = aSettingsId; + break; + case EXdm: + iProfile.iXDMSetting = aSettingsId; + break; + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Finalizes profile, i.e. stores the profile with linkage information. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlPresenceHandler::FinalizeSettings() + { + TInt err1( KErrNone ); + TRAPD( err2, err1 = PresSettingsApi::UpdateSetL( iProfile, iProfileId )); + if ( KErrNone != err1 || KErrNone != err2 ) + { + err1 = KErrGeneral; + } + return err1; + } + +// --------------------------------------------------------------------------- +// Checks for duplicate named Presence profiles. Renames if same. +// --------------------------------------------------------------------------- +// +void CVoipXmlPresenceHandler::CreateProviderNameL( TDes& aName ) + { + DBG_PRINT( "CVoipXmlPresenceHandler::CreateProviderNameL begin" ); + + RArray settingIds; + CleanupClosePushL( settingIds ); // CS:1 + // CS:2 + CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC( settingIds ); + + HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3 + newName->Des().Copy( aName ); + const TInt count( names->MdcaCount() ); + TUint i( 1 ); // Add number to the name if name already in use. + + // Go through each profile and see if the name of the new profile + // matches one of the existing names. If it does change it and + // check the new name again. + for ( TInt counter = 0; counter < count; counter++ ) + { + TBuf loadedName; + loadedName.Copy( names->MdcaPoint( counter )); + if ( 0 == newName->Des().Compare( loadedName ) ) + { + // If the name is changed we need to begin the comparison + // again from the first profile. + newName->Des().Copy( aName ); + newName->Des().Append( KOpenParenthesis() ); + newName->Des().AppendNum( i ); + newName->Des().Append( KClosedParenthesis() ); + counter = 0; + i++; + if ( KMaxProfileNames < i ) + { + User::Leave( KErrBadName ); + } + } + } + aName.Copy( newName->Des() ); + // newName, names, &settingIds + CleanupStack::PopAndDestroy( 3, &settingIds ); + DBG_PRINT( "CVoipXmlPresenceHandler::CreateProviderNameL end" ); + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlsiphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlsiphandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,584 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: SIP handler for VoIP XML processor +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voipxmlutils.h" +#include "voipxmlsiphandler.h" +#include "voipxmlprocessorlogger.h" +#include "voipxmlprocessordefaults.h" + +// --------------------------------------------------------------------------- +// CVoipXmlSipHandler::CVoipXmlSipHandler +// --------------------------------------------------------------------------- +// +CVoipXmlSipHandler::CVoipXmlSipHandler() + { + } + +// --------------------------------------------------------------------------- +// CVoipXmlSipHandler::NewL +// --------------------------------------------------------------------------- +// +CVoipXmlSipHandler* CVoipXmlSipHandler::NewL() + { + CVoipXmlSipHandler* self = new ( ELeave ) CVoipXmlSipHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CVoipXmlSipHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::ConstructL() + { + DBG_PRINT( "CVoipXmlSipHandler::ConstructL begin" ); + + // SIP Managed Profile Registry. + iRegistry = CSIPManagedProfileRegistry::NewL( *this ); + + // Create an empty SIP profile in which all settings will be set. + iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EInternet; + iProfileType.iSIPProfileName.Copy( KIetf() ); + iProfile = iRegistry->CreateL( iProfileType ); + + iProxyUri = HBufC8::NewL( KMaxNodeValueLength ); + iProxyTransport = EAutomatic; + iProxyPort = KErrNotFound; + iLr = EFalse; + iRegistrarUri = HBufC8::NewL( KMaxNodeValueLength ); + iRegistrarTransport = EAutomatic; + iRegistrarPort = KErrNotFound; + + const TInt ipTosShift( 2 ); + const TUint32 tosBits( KDefaultSigQos << ipTosShift ); + iProfile->SetParameter( KSIPSoIpTOS, tosBits ); + + DBG_PRINT( "CVoipXmlSipHandler::ConstructL end" ); + } + +// --------------------------------------------------------------------------- +// CVoipXmlSipHandler::~CVoipXmlSipHandler +// --------------------------------------------------------------------------- +// +CVoipXmlSipHandler::~CVoipXmlSipHandler() + { + delete iProfile; + delete iRegistry; + delete iProxyUri; + delete iRegistrarUri; + } + +// --------------------------------------------------------------------------- +// Sets SIP setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::SetSetting( TInt aType, TInt aParam, + const TDesC8& aValue ) + { + // Ignore too long descriptors. + if ( KMaxNodeValueLength < aValue.Length() ) + { + return; + } + + switch ( aParam ) + { + case EName: + { + TRAPD( err, CreateProviderNameL( aValue ) ); + if ( KErrNone == err ) + { + iSettingsSet = ETrue; + } + break; + } + case ESignalingQos: + { + // We need to do bitshifting on the IP TOS, because it's the + // upper 6 bits that are set and settings provide us the IP TOS + // as the lower 6 bits. + // The lower 2 bits are reserver for explicit congestion + // notification. + // See also more from: + // Symbian Developer Library + // => in_sock.h Global variables + // => KSoIpTOS + const TInt ipTosShift( 2 ); + TInt value( KErrNotFound ); + VoipXmlUtils::Des8ToInt( aValue, value ); + if ( 0 <= value ) + { + const TUint32 tosBits( value << ipTosShift ); + iProfile->SetParameter( KSIPSoIpTOS, tosBits ); + iSettingsSet = ETrue; + } + break; + } + case EType: + { + TBuf8 value; + value.Copy( aValue ); + value.UpperCase(); + if ( 0 == value.Compare( KIms() ) ) + { + iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EIms; + value.LowerCase(); + iProfileType.iSIPProfileName.Copy( value ); + iProfile->SetType( iProfileType ); + iSettingsSet = ETrue; + } + else if ( 0 == value.Compare( KIetf() ) ) + { + iProfileType.iSIPProfileClass = + TSIPProfileTypeInfo::EInternet; + iProfileType.iSIPProfileName.Copy( value ); + iProfile->SetType( iProfileType ); + iSettingsSet = ETrue; + } + else + { + iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EOther; + iProfileType.iSIPProfileName.Copy( aValue ); + iProfile->SetType( iProfileType ); + iSettingsSet = ETrue; + } + break; + } + case EPublicUserId: + { + TBuf8 value; + value.Copy( aValue ); + TRAPD( err, ModifyPuidL( value ) ); + if ( KErrNone == err ) + { + iProfile->SetParameter( KSIPUserAor, value ); + iSettingsSet = ETrue; + } + break; + } + case ESignalCompression: + { + TInt value; + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) ) + { + iProfile->SetParameter( KSIPSigComp, (TBool)value ); + iSettingsSet = ETrue; + } + break; + } + case ESecurityNegotiation: + { + TInt value; + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) ) + { + iProfile->SetParameter( + KSIPSecurityNegotiation, (TBool)value ); + iSettingsSet = ETrue; + } + break; + } + case EProfileLock: + { + TInt value; + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) ) + { + iProfile->SetParameter( KSIPProfileLocked, (TBool)value ); + iSettingsSet = ETrue; + } + break; + } + case EAutoRegistration: + { + TInt value; + if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) ) + { + iProfile->SetParameter( KSIPAutoRegistration, (TBool)value ); + iSettingsSet = ETrue; + } + break; + } + case EUri: + { + TBuf8 tempBuf( KNullDesC8 ); + if ( 0 != aValue.Find( KSip() ) && + 0 != aValue.Find( KSips() ) ) + { + tempBuf.Copy( KSip() ); + } + tempBuf.Append( aValue ); + if ( EProxy == aType ) + { + iProxyUri->Des().Copy( tempBuf ); + iSettingsSet = ETrue; + } + else if ( ERegistrar == aType ) + { + iRegistrarUri->Des().Copy( tempBuf ); + iSettingsSet = ETrue; + } + break; + } + case ETransport: + { + if ( EProxy == aType ) + { + iProxyTransport = ValidateTransport( aValue ); + iSettingsSet = ETrue; + } + else if ( ERegistrar == aType ) + { + iRegistrarTransport = ValidateTransport( aValue ); + iSettingsSet = ETrue; + } + break; + } + case EPort: + { + TInt value; + TInt err = VoipXmlUtils::Des8ToInt( aValue, value ); + if ( EProxy == aType && KErrNone == err ) + { + iProxyPort = value; + iSettingsSet = ETrue; + } + else if ( ERegistrar == aType && KErrNone == err ) + { + iRegistrarPort = value; + iSettingsSet = ETrue; + } + break; + } + case ELooseRouting: + { + TInt value; + if ( EProxy == aType && + KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) ) + { + iLr = (TBool)value; + iSettingsSet = ETrue; + } + break; + } + case EUsername: + { + if ( EProxy == aType ) + { + if ( TSIPProfileTypeInfo::EInternet == + iProfileType.iSIPProfileClass ) + { + iProfile->SetParameter( KSIPOutboundProxy, + KSIPDigestUserName, aValue ); + iSettingsSet = ETrue; + } + else + { + iProfile->SetParameter( KSIPPrivateIdentity, aValue ); + iSettingsSet = ETrue; + } + } + else if ( ERegistrar == aType ) + { + if ( TSIPProfileTypeInfo::EInternet == + iProfileType.iSIPProfileClass ) + { + iProfile->SetParameter( KSIPRegistrar, KSIPDigestUserName, + aValue ); + iSettingsSet = ETrue; + } + else + { + iProfile->SetParameter( KSIPPrivateIdentity, aValue ); + iSettingsSet = ETrue; + } + } + break; + } + case EPassword: + { + if ( EProxy == aType ) + { + iProfile->SetParameter( KSIPOutboundProxy, KSIPDigestPassword, + aValue ); + iSettingsSet = ETrue; + } + else if ( ERegistrar == aType ) + { + iProfile->SetParameter( KSIPRegistrar, KSIPDigestPassword, + aValue ); + iSettingsSet = ETrue; + } + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Stores settings to SIP managed profile registry. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlSipHandler::StoreSettings() + { + if ( !iSettingsSet ) + { + // No settings to be stored => method not supported. + return KErrNotSupported; + } + + TBuf8 tempBuf( KNullDesC8 ); + + // ============================== + // Set components to proxy URI. + // ============================== + // + if ( KErrNotFound != iProxyPort ) + { + tempBuf.Copy( KColon() ); + tempBuf.AppendNum( iProxyPort ); + } + if ( EUdp == iProxyTransport ) + { + tempBuf.Append( KTransport() ); + tempBuf.Append( KUdp() ); + } + else if ( ETcp == iProxyTransport ) + { + tempBuf.Append( KTransport() ); + tempBuf.Append( KTcp() ); + } + if ( iLr ) + { + tempBuf.Append( KLr() ); + } + + if ( iProxyUri->Des().MaxLength() >= + ( iProxyUri->Des().Length() + tempBuf.Length() ) ) + { + iProxyUri->Des().Append( tempBuf ); + } + iProfile->SetParameter( KSIPOutboundProxy, KSIPServerAddress, + iProxyUri->Des() ); + + // ============================== + // Set components to registrar URI. + // ============================== + // + tempBuf.Zero(); + if ( KErrNotFound != iRegistrarPort ) + { + tempBuf.Copy( KColon() ); + tempBuf.AppendNum( iRegistrarPort ); + } + if ( EUdp == iRegistrarTransport ) + { + tempBuf.Append( KTransport() ); + tempBuf.Append( KUdp() ); + } + else if ( ETcp == iRegistrarTransport ) + { + tempBuf.Append( KTransport() ); + tempBuf.Append( KTcp() ); + } + if ( iRegistrarUri->Des().MaxLength() >= + ( iRegistrarUri->Des().Length() + tempBuf.Length() ) ) + { + iRegistrarUri->Des().Append( tempBuf ); + } + iProfile->SetParameter( KSIPRegistrar, KSIPServerAddress, + iRegistrarUri->Des() ); + + TRAPD( err, iRegistry->SaveL( *iProfile ) ); + if ( KErrNone != err ) + { + // No need for specifying what went wrong because paramhandler + // is only intrested in KErrNotSupported, KErrCompletion and KErrNone. + err = KErrCompletion; + } + // Store SIP settings ID for later use. + iProfile->GetParameter( KSIPProfileId, iProfileId ); + return err; + } + +// --------------------------------------------------------------------------- +// Returns the profile ID if the profile saved in StoreSettings. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlSipHandler::SettingsId() + { + return iProfileId; + } + +// --------------------------------------------------------------------------- +// Saves linkage information. +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::LinkSettings( TInt aType, TUint32 aSettingsId ) + { + if ( EDestination == aType && aSettingsId ) + { + iProfile->SetParameter( KSIPSnapId, aSettingsId ); + } + } + +// --------------------------------------------------------------------------- +// Finalizes settings saving. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlSipHandler::FinalizeSettings() + { + TRAPD( err, iRegistry->SaveL( *iProfile ) ); + if ( KErrNone != err ) + { + // ParamHandler is only intrested in KErrNone and KErrCompletion. + err = KErrCompletion; + } + return err; + } + +// --------------------------------------------------------------------------- +// From class MSIPProfileRegistryObserver. +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::ProfileRegistryEventOccurred( + TUint32 /*aSIPProfileId*/, TEvent /*aEvent*/ ) + { + } + +// --------------------------------------------------------------------------- +// From class MSIPProfileRegistryObserver. +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::ProfileRegistryErrorOccurred( + TUint32 /*aSIPProfileId*/, TInt /*aError*/ ) + { + } + +// --------------------------------------------------------------------------- +// CVoipXmlSipHandler::CreateProviderNameL +// Checks if duplicate named SIP profiles. Renames if same. +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::CreateProviderNameL( const TDesC8& aName ) + { + DBG_PRINT( "CVoipXmlSipHandler::CreateProviderNameL begin" ); + + RPointerArray profiles; + CleanupResetAndDestroyL( profiles ); // CS:1 + + // Get all profiles based on profile types. + iRegistry->ProfilesL( profiles ); + const TInt profileCount = profiles.Count(); + + // Go through loaded profiles and check for name duplicates. + HBufC8* name = HBufC8::NewLC( KMaxNodeNameLength ); // CS:2 + name->Des().Copy( aName ); + TUint i( 1 ); // Add number to the name if name already in use. + const TInt count( profiles.Count() ); + for ( TInt counter = 0; counter < count; counter++ ) + { + CSIPManagedProfile* profile = + static_cast( profiles[counter] ); + const TDesC8* existingName; + profile->GetParameter( KSIPProviderName, existingName ); + if ( 0 == existingName->Compare( *name ) ) + { + name->Des().Copy( aName ); + name->Des().Append( KOpenParenthesis8() ); + name->Des().AppendNum( i ); + name->Des().Append( KClosedParenthesis8() ); + counter = 0; + i++; + if ( KMaxProfileNames < i ) + { + User::Leave( KErrBadName ); + } + } + } + iProfile->SetParameter( KSIPProviderName, name->Des() ); + + // name, &profiles + CleanupStack::PopAndDestroy( 2, &profiles ); // CS:0 + DBG_PRINT( "CVoipXmlSipHandler::CreateProviderNameL end" ); + } + +// --------------------------------------------------------------------------- +// Modifies public user ID, i.e. escapes and adds sip: prefix if necessary. +// --------------------------------------------------------------------------- +// +void CVoipXmlSipHandler::ModifyPuidL( TDes8& aValue ) + { + if ( KErrNotFound == aValue.Find( KEscaped() ) ) + { + HBufC8* tempPuid = EscapeUtils::EscapeEncodeL( aValue, + EscapeUtils::EEscapeNormal ); + aValue.Copy( tempPuid->Des() ); + delete tempPuid; + tempPuid = NULL; + } + if ( 0 != aValue.Find( KSip() ) && 0 != aValue.Find( KSips() ) ) + { + if ( aValue.MaxLength() >= ( aValue.Length() + KSip().Length() ) ) + { + aValue.Insert( 0, KSip() ); + } + else + { + User::Leave( KErrTooBig ); + } + } + } + +// --------------------------------------------------------------------------- +// Validates transport type. +// --------------------------------------------------------------------------- +// +CVoipXmlSipHandler::TTransportType CVoipXmlSipHandler::ValidateTransport( + const TDesC8& aValue ) + { + TBuf8 value; + value.Copy( aValue ); + value.UpperCase(); + if ( 0 == value.Compare( KUdp() ) ) + { + return EUdp; + } + else if ( 0 == value.Compare( KTcp() ) ) + { + return ETcp; + } + else + { + return EAutomatic; + } + } + +// End of file. diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlutils.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utilities class for VoIP XML processor +* +*/ + + +//#include +#include "voipxmlutils.h" + + +// --------------------------------------------------------------------------- +// VoipXmlUtils::DesToInt() +// --------------------------------------------------------------------------- +// +TInt VoipXmlUtils::DesToInt( const TDesC& aDesValue, TInt& aIntValue ) + { + TLex lex( aDesValue ); + return lex.Val( aIntValue ); + } + +// --------------------------------------------------------------------------- +// VoipXmlUtils::DesToInt() +// --------------------------------------------------------------------------- +// +TInt VoipXmlUtils::Des8ToInt( const TDesC8& aDesValue, TInt& aIntValue ) + { + TLex8 lex( aDesValue ); + return lex.Val( aIntValue ); + } + +// End of file. + diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlvoiphandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlvoiphandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,1289 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VoIP settings handler +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include // SIP User-Agent header info. +#include // SIP User-Agent header info. +#include // For getting phone rom root path. +#include // For IM tone path + +#include "voipxmlvoiphandler.h" +#include "voipxmlprocessorlogger.h" +#include "voipxmlprocessordefaults.h" +#include "voipxmlutils.h" + +const TInt32 KCCHPresenceSubServicePlugId = 0x1027545A; +// IM related constants. +const TUint32 KIMSubServicePluginId = 0x1027545A; +const TUint32 KIMLaunchUid = 0x200255D0; +const TInt KIMSettingsId = 1; +// Default IM message tone +_LIT( KDefaultTone, "Message 2.aac" ); +// Brand related constants. +const TInt KBrandVersion = 1; + +// --------------------------------------------------------------------------- +// Default constructor. +// --------------------------------------------------------------------------- +// +CVoipXmlVoipHandler::CVoipXmlVoipHandler() + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::ConstructL() + { + DBG_PRINT( "CVoipXmlVoipHandler::ConstructL begin" ); + iRegistry = CRCSEProfileRegistry::NewL(); + iCodecRegistry = CRCSEAudioCodecRegistry::NewL(); + iEntry = CRCSEProfileEntry::NewL(); + ResetTempCodec(); + ResetTempSpSettings(); + iSettingsSet = EFalse; + DBG_PRINT( "CVoipXmlVoipHandler::ConstructL end" ); + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CVoipXmlVoipHandler* CVoipXmlVoipHandler::NewL() + { + DBG_PRINT( "CVoipXmlVoipHandler::NewL begin" ); + CVoipXmlVoipHandler* self = new ( ELeave ) CVoipXmlVoipHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + DBG_PRINT( "CVoipXmlVoipHandler::NewL end" ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CVoipXmlVoipHandler::~CVoipXmlVoipHandler() + { + DBG_PRINT( "CVoipXmlVoipHandler::~CVoipXmlVoipHandler begin" ); + delete iRegistry; + delete iCodecRegistry; + delete iEntry; + ResetTempCodec( ETrue ); + ResetTempSpSettings(); + DBG_PRINT( "CVoipXmlVoipHandler::~CVoipXmlVoipHandler end" ); + } + +// --------------------------------------------------------------------------- +// Sets VoIP setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetSetting( TInt aType, TInt aParam, + const TDesC& aValue ) + { + // Ignore too long descriptors. + if ( KMaxNodeValueLength < aValue.Length() ) + { + return; + } + + switch ( aType ) + { + case EVoip: + TRAP_IGNORE( SetCoreSettingL( aParam, aValue ) ); + break; + case ECodec: + TRAP_IGNORE( SetCodecSettingL( aParam, aValue ) ); + break; + case EVmbx: + TRAP_IGNORE( SetVmbxSettingL( aParam, aValue ) ); + break; + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Stores settings to RCSE. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlVoipHandler::StoreSettings() + { + TInt err( KErrNone ); + TBool ok( ETrue ); + + if ( !iSettingsSet ) + { + // No settings to be stored => method not supported. + err = KErrNotSupported; + ok = EFalse; + } + else + { + TUint32 profileId( KErrNone ); + // Add default codec set if no codecs defined. + if ( 0 == iEntry->iPreferredCodecs.Count() ) + { + TRAP_IGNORE( AddDefaultCodecsL() ); + } + TRAP( err, profileId = iRegistry->AddL( *iEntry ) ); + if ( KErrNone == err ) + { + // Adding profile entry to registry OK. Let's load the profile + // from registry so that we'll get all the values registry has + // added to the entry (AddL takes entry as const reference). + TRAP_IGNORE( iRegistry->FindL( profileId, *iEntry ) ); + } + else + { + err = KErrCompletion; + ok = EFalse; + } + } + if ( !ok ) + { + const TInt count = iEntry->iPreferredCodecs.Count(); + for ( TInt counter = 0; counter < count; counter++ ) + { + TRAP_IGNORE( iCodecRegistry->DeleteL( + iEntry->iPreferredCodecs[counter] ) ); + } + } + return err; + } + +// --------------------------------------------------------------------------- +// Returns the service ID. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlVoipHandler::SettingsId() + { + return iServiceId; + } + +// --------------------------------------------------------------------------- +// Sets a codec to RCSE and resets the temp codec. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SettingsEnd( TInt aType ) + { + if ( ECodec == aType ) + { + TRAP_IGNORE( SetCodecToRcseL() ); + } + } + +// --------------------------------------------------------------------------- +// Saves linkage information. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::LinkSettings( TInt aType, TUint32 aSettingsId ) + { + switch ( aType ) + { + case ESip: + { + TRAP_IGNORE( SetSipInfoL( aSettingsId ) ); + break; + } + case EPresence: + { + iPresenceId = aSettingsId; + break; + } + case EDestination: + { + iDestinationId = aSettingsId; + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Finalizes settings saving. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlVoipHandler::FinalizeSettings() + { + TInt err( KErrNone ); + TRAP( err, SetSpSettingsL() ); + if ( KErrNone != err ) + { + // ParamHandler is only intrested in KErrNone and KErrCompletion. + err = KErrCompletion; + } + return err; + } + +// --------------------------------------------------------------------------- +// Returns the service tab ID of this VoIP service. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlVoipHandler::ServiceTabIdL() + { + DBG_PRINT( "CVoipXmlVoipHandler::ServiceTabIdL begin" ); + TInt tabId( KErrNone ); + CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1 + CSPProperty* property = CSPProperty::NewLC(); // CS:2 + TInt err = spSettings->FindPropertyL( + iServiceId, EPropertyContactViewId, *property ); + User::LeaveIfError( property->GetValue( tabId ) ); + CleanupStack::PopAndDestroy( 2, spSettings ); // CS:0 + DBG_PRINT2( "CVoipXmlVoipHandler::ServiceTabIdL end (return %d)", tabId ); + return (TUint32)tabId; + } + +// --------------------------------------------------------------------------- +// From class MSIPProfileRegistryObserver. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::ProfileRegistryEventOccurred( + TUint32 /*aSIPProfileId*/, TEvent /*aEvent*/ ) + { + } + +// --------------------------------------------------------------------------- +// From class MSIPProfileRegistryObserver. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::ProfileRegistryErrorOccurred( + TUint32 /*aSIPProfileId*/, TInt /*aError*/ ) + { + } + +// --------------------------------------------------------------------------- +// Sets VoIP core setting to temporary storage. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetCoreSettingL( TInt aParam, const TDesC& aValue ) + { + TInt intValue( KErrNotFound ); + switch ( aParam ) + { + case EName: + { + TBuf name( KNullDesC ); + name.Copy( aValue ); + TRAP_IGNORE( ValidateProfileNameL( name ) ); + iEntry->iProviderName.Copy( name ); + iEntry->iSettingsName.Copy( name ); + iSettingsSet = ETrue; + break; + } + case EStartPort: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iStartMediaPort = intValue; + iSettingsSet = ETrue; + } + break; + } + case EEndPort: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iEndMediaPort = intValue; + iSettingsSet = ETrue; + } + break; + } + case EMediaQos: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iMediaQOS = intValue; + iSettingsSet = ETrue; + } + break; + } + case EDtmfInband: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + TEntryOnOff value; + if ( !intValue ) + { + value = CRCSEProfileEntry::EOff; + } + else if ( KNotSet == intValue ) + { + value = CRCSEProfileEntry::EOONotSet; + } + else + { + value = CRCSEProfileEntry::EOn; + } + iEntry->iInbandDTMF = value; + iSettingsSet = ETrue; + } + break; + } + case EDtmfOutband: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + TEntryOnOff value; + if ( !intValue ) + { + value = CRCSEProfileEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + value = CRCSEProfileEntry::EOONotSet; + } + else + { + value = CRCSEProfileEntry::EOn; + } + iEntry->iOutbandDTMF = value; + iSettingsSet = ETrue; + } + break; + } + case ESecureCallPreference: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iSecureCallPreference = intValue; + iSettingsSet = ETrue; + } + break; + } + case EAllowVoipOverWcdma: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + TEntryOnOff value; + if ( !intValue ) + { + value = CRCSEProfileEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + value = CRCSEProfileEntry::EOONotSet; + } + else + { + value = CRCSEProfileEntry::EOn; + } + iEntry->iAllowVoIPoverWCDMA = value; + iSettingsSet = ETrue; + } + break; + } + case ERtcp: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iRTCP = intValue; + iSettingsSet = ETrue; + } + break; + } + case EUserAgentHeaderTerminalType: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iSIPVoIPUAHTerminalType = intValue; + iSettingsSet = ETrue; + } + break; + } + case EUserAgentHeaderWlanMac: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iSIPVoIPUAHeaderWLANMAC = intValue; + iSettingsSet = ETrue; + } + break; + } + case EUserAgentHeaderFreeString: + { + if ( KMaxSettingsLength32 >= aValue.Length() ) + { + iEntry->iSIPVoIPUAHeaderString.Copy( aValue ); + iSettingsSet = ETrue; + } + break; + } + case ECallerIdDigits: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iMeanCountOfVoIPDigits = intValue; + iSettingsSet = ETrue; + } + break; + } + case EIgnoreDomainPart: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iIgnoreAddrDomainPart = intValue; + iSettingsSet = ETrue; + } + break; + } + case EAutoAcceptBuddyRequests: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iSpSettings.iAutoAcceptBuddies = (TBool)intValue; + iSettingsSet = ETrue; + } + break; + } + case EAddUserPhone: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + TEntryOnOff value; + if ( !intValue ) + { + value = CRCSEProfileEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + value = CRCSEProfileEntry::EOONotSet; + } + else + { + value = CRCSEProfileEntry::EOn; + } + iEntry->iUserPhoneUriParameter = value; + iSettingsSet = ETrue; + } + break; + } + case EProviderUrl: + { + if ( !iSpSettings.iProviderUrl ) + { + iSpSettings.iProviderUrl = aValue.AllocL(); + iSettingsSet = ETrue; + } + break; + } + case EMinSessionInterval: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iSIPMinSE = intValue; + iSettingsSet = ETrue; + } + break; + } + case ESessionInterval: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iEntry->iSIPSessionExpires = intValue; + iSettingsSet = ETrue; + } + break; + } + case EBrandingUri: + { + if ( !iSpSettings.iBrandingUri ) + { + iSpSettings.iBrandingUri = aValue.AllocL(); + iSettingsSet = ETrue; + } + break; + } + case EAutoEnable: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iSpSettings.iAutoEnable = (TBool)intValue; + iSettingsSet = ETrue; + } + break; + } + case EEnableSipIm: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iSpSettings.iEnableSipIm = (TBool)intValue; + iSettingsSet = ETrue; + } + break; + } + case EBrandId: + { + if ( !iSpSettings.iBrandId ) + { + iSpSettings.iBrandId = aValue.AllocL(); + iSettingsSet = ETrue; + } + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Sets codec setting to temporary storage. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetCodecSettingL( TInt aParam, const TDesC& aValue ) + { + TInt intValue; + switch ( aParam ) + { + // Codec parameters + case EName: + { + if ( iCurrentCodec.iName ) + { + break; + } + TBuf value; + value.Copy( aValue ); + value.UpperCase(); + if ( 0 == value.Compare( KILbc ) ) + { + value.Copy( KAudioCodeciLBC ); + } + iCurrentCodec.iName = value.AllocL(); + break; + } + case EJitterBuffer: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iCurrentCodec.iJitterBuffer = intValue; + } + break; + } + case EOctetAlign: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + if ( !intValue ) + { + iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + iCurrentCodec.iOctetAlign = + CRCSEAudioCodecEntry::EOONotSet; + } + else + { + iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOn; + } + } + break; + } + case EPTime: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iCurrentCodec.iPtime = intValue; + } + break; + } + case EMaxPTime: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iCurrentCodec.iMaxPtime = intValue; + } + break; + } + case EModeSet: + { + TBuf string; + string.Copy( aValue ); + while ( string.Length() ) + { + TInt offset = string.Locate( KComma ); + TBuf helpString( KNullDesC ); + if ( KErrNotFound == offset ) + { + if ( KErrNone == VoipXmlUtils::DesToInt( + string, intValue ) ) + { + iCurrentCodec.iModeSet.AppendL( intValue ); + } + string.Zero(); + } + else if ( !offset ) + { + string.Delete( 0, 1 ); + } + else + { + helpString.Copy( string.Left( offset ) ); + if ( KErrNone == VoipXmlUtils::DesToInt( helpString, + intValue ) ) + { + iCurrentCodec.iModeSet.AppendL( intValue ); + } + offset++; + string.Delete( 0, offset ); + } + } + break; + } + case EModeChangePeriod: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iCurrentCodec.iModeChangePeriod = intValue; + } + break; + } + case EModeChangeNeighbor: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + if ( !intValue ) + { + iCurrentCodec.iModeChangeNeighbor = + CRCSEAudioCodecEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + iCurrentCodec.iModeChangeNeighbor = + CRCSEAudioCodecEntry::EOONotSet; + } + else + { + iCurrentCodec.iModeChangeNeighbor = + CRCSEAudioCodecEntry::EOn; + } + } + break; + } + case EMaxRed: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iCurrentCodec.iMaxRed = intValue; + } + break; + } + case EVad: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + if ( !intValue ) + { + iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOONotSet; + } + else + { + iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOn; + } + } + break; + } + case EAnnexb: + { + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + if ( !intValue ) + { + iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOff; + } + else if ( KErrNotFound == intValue ) + { + iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOONotSet; + } + else + { + iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOn; + } + } + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Sets voice mailbox setting to temporary storage. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetVmbxSettingL( TInt aParam, const TDesC& aValue ) + { + switch ( aParam ) + { + case EMwiUri: + { + if ( !iSpSettings.iMwiUri ) + { + iSpSettings.iMwiUri = aValue.AllocL(); + } + break; + } + case EListeningUri: + { + if ( !iSpSettings.iListeningUri ) + { + iSpSettings.iListeningUri = aValue.AllocL(); + } + break; + } + case EReSubscribeInterval: + { + TInt intValue; + if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) + { + iSpSettings.iResubrcribe = intValue; + } + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Checks if name is unique and modifies if needed. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::ValidateProfileNameL( TDes& aName ) + { + const TInt maxModifyLength = + KMaxSettingsNameLength - KMaxProfileNameAppendLength; + + RArray voipIds; + CleanupClosePushL( voipIds ); // CS:1 + iRegistry->GetAllIdsL( voipIds ); + + const TInt count( voipIds.Count() ); + + HBufC* newName = HBufC::NewLC( KMaxSettingsNameLength ); // CS:2 + newName->Des().Copy( aName.Left( maxModifyLength ) ); + + TUint i( 1 ); // Add number to the name if name already in use. + TBool changed( EFalse ); + + // Go through each profile and see if the name of the new profile + // matches one of the existing names. If it does change it and + // check the new name again. + for ( TInt index = 0; index < count; index++ ) + { + CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC(); // CS:3 + TBuf loadedName; + iRegistry->FindL( voipIds[index], *profile ); + loadedName.Copy( profile->iSettingsName ); + if ( 0 == newName->Des().Compare( loadedName ) ) + { + // If the name is changed we need to begin the comparison + // again from the first profile. + newName->Des().Copy( aName.Left( maxModifyLength ) ); + newName->Des().Append( KOpenParenthesis() ); + newName->Des().AppendNum( i ); + newName->Des().Append( KClosedParenthesis() ); + index = 0; + i++; + if ( KMaxProfileNames < i ) + { + User::Leave( KErrBadName ); + } + changed = ETrue; + } + CleanupStack::PopAndDestroy( profile ); // CS:2 + } + + // Change setting only if it was changed. + if ( changed ) + { + aName.Copy( newName->Des() ); + } + + // newName, &voipIds + CleanupStack::PopAndDestroy( 2, &voipIds ); // CS:0 + } + +// --------------------------------------------------------------------------- +// Sets temporary codec to RCSE. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetCodecToRcseL() + { + // Nameless codecs are not supported. + if ( !iCurrentCodec.iName ) + { + ResetTempCodec(); + return; + } + + CRCSEAudioCodecEntry* entry = CRCSEAudioCodecEntry::NewLC(); + // First set default values... + entry->SetDefaultCodecValueSet( iCurrentCodec.iName->Des() ); + // ...and then replace them with the ones defined in settings XML. + if ( KErrNotFound != iCurrentCodec.iJitterBuffer ) + { + entry->iJitterBufferSize = iCurrentCodec.iJitterBuffer; + } + if ( KErrNotFound != iCurrentCodec.iPtime ) + { + entry->iPtime = iCurrentCodec.iPtime; + } + if ( KErrNotFound != iCurrentCodec.iMaxPtime ) + { + entry->iMaxptime = iCurrentCodec.iMaxPtime; + } + if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iOctetAlign ) + { + entry->iOctetAlign = iCurrentCodec.iOctetAlign; + } + if ( CRCSEAudioCodecEntry::EOONotSet != + iCurrentCodec.iModeChangeNeighbor ) + { + entry->iModeChangeNeighbor = iCurrentCodec.iModeChangeNeighbor; + } + if ( KErrNotFound != iCurrentCodec.iModeChangePeriod ) + { + entry->iModeChangePeriod = iCurrentCodec.iModeChangePeriod; + } + if ( KErrNotFound != iCurrentCodec.iMaxRed ) + { + entry->iMaxRed = iCurrentCodec.iMaxRed; + } + if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iVad ) + { + entry->iVAD = iCurrentCodec.iVad; + } + if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iAnnexb ) + { + entry->iAnnexb = iCurrentCodec.iAnnexb; + } + if ( iCurrentCodec.iModeSet.Count() ) + { + entry->iModeSet.Reset(); + const TInt count = iCurrentCodec.iModeSet.Count(); + for ( TInt counter = 0; counter < count; counter++ ) + { + entry->iModeSet.AppendL( iCurrentCodec.iModeSet[counter] ); + } + } + + TUint32 codecId = iCodecRegistry->AddL( *entry ); + CleanupStack::PopAndDestroy( entry ); + iEntry->iPreferredCodecs.AppendL( codecId ); + ResetTempCodec(); + } + +// --------------------------------------------------------------------------- +// Resets temporary codec settings. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::ResetTempCodec( TBool aCloseArray ) + { + if ( iCurrentCodec.iName ) + { + delete iCurrentCodec.iName; + iCurrentCodec.iName = NULL; + } + iCurrentCodec.iJitterBuffer = KErrNotFound; + iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOONotSet; + iCurrentCodec.iPtime = KErrNotFound; + iCurrentCodec.iMaxPtime = KErrNotFound; + iCurrentCodec.iModeChangePeriod = KErrNotFound; + iCurrentCodec.iModeChangeNeighbor = CRCSEAudioCodecEntry::EOONotSet; + iCurrentCodec.iMaxRed = KErrNotFound; + iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOONotSet; + iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOONotSet; + iCurrentCodec.iModeSet.Reset(); + if ( aCloseArray ) + { + iCurrentCodec.iModeSet.Close(); + } + } + +// --------------------------------------------------------------------------- +// Resets temporary service provider settings. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::ResetTempSpSettings() + { + iSpSettings.iAutoAcceptBuddies = EFalse; + iSpSettings.iAutoEnable = EFalse; + iSpSettings.iResubrcribe = KErrNotFound; + if ( iSpSettings.iBrandingUri ) + { + delete iSpSettings.iBrandingUri; + iSpSettings.iBrandingUri = NULL; + } + if ( iSpSettings.iListeningUri ) + { + delete iSpSettings.iListeningUri; + iSpSettings.iListeningUri = NULL; + } + if ( iSpSettings.iMwiUri ) + { + delete iSpSettings.iMwiUri; + iSpSettings.iMwiUri = NULL; + } + if ( iSpSettings.iProviderUrl ) + { + delete iSpSettings.iProviderUrl; + iSpSettings.iProviderUrl = NULL; + } + if ( iSpSettings.iBrandId ) + { + delete iSpSettings.iBrandId; + iSpSettings.iBrandId = NULL; + } + } + +// --------------------------------------------------------------------------- +// Sets SIP related VoIP settings. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetSipInfoL( TUint32 aSipId ) + { + // First set SIP information to RCSE so that + // an entry in service table will be created. + TSettingIds settingIds; + settingIds.iProfileType = CRCSEProfileEntry::EProtocolSIP; // SIP. + settingIds.iProfileId = aSipId; + // Never reference to profile specific settings. + settingIds.iProfileSpecificSettingId = KNotSet; + iEntry->iIds.AppendL( settingIds ); + iRegistry->UpdateL( iEntry->iId, *iEntry ); + + // After update, we'll need to load the profile again from registry + // so that we'll get all the values registry has added to the entry + // (UpdateL takes entry as const reference). + TUint32 profileId = iEntry->iId; + iRegistry->FindL( profileId, *iEntry ); + iServiceId = iEntry->iServiceProviderId; + + // Compile and set User-Agent header. + CSIPManagedProfileRegistry* sipReg = CSIPManagedProfileRegistry::NewLC( + *this ); // CS:1 + CSIPManagedProfile* sipProf = static_cast( + sipReg->ProfileL( aSipId ) ); + + if ( sipProf ) + { + CleanupStack::PushL( sipProf ); // CS:2 + + TBuf8 userAgentString( KNullDesC8 ); + + if ( iEntry->iSIPVoIPUAHTerminalType || + iEntry->iSIPVoIPUAHeaderWLANMAC || + iEntry->iSIPVoIPUAHeaderString.Length() != 0 ) + { + // Set this to be an user-agent param. + userAgentString.Append( KUserAgent ); + userAgentString.Append( KColon ); + userAgentString.Append( KSpace ); + + // Set terminal type if eanbled. + if ( iEntry->iSIPVoIPUAHTerminalType ) + { + CIpAppPhoneUtils* util = CIpAppPhoneUtils::NewLC(); // CS:3 + TBuf terminalType( KNullDesC ); + util->GetTerminalTypeL( terminalType ); + userAgentString.Append( terminalType ); + userAgentString.Append( KSpace ); + CleanupStack::PopAndDestroy( util ); // CS:2 + } + + // Set WLAN MAC address if enabled. + if ( iEntry->iSIPVoIPUAHeaderWLANMAC ) + { + CIPAppUtilsAddressResolver* resolver = + CIPAppUtilsAddressResolver::NewLC(); // CS:3 + _LIT8( KFormatType, "-" ); + TBuf8 wlanMACAddress( KNullDesC8 ); + resolver->GetWlanMACAddress( wlanMACAddress, KFormatType ); + userAgentString.Append( wlanMACAddress ); + userAgentString.Append( KSpace ); + CleanupStack::PopAndDestroy( resolver ); // CS:2 + } + + // Set free string if enabled. + if ( iEntry->iSIPVoIPUAHeaderString.Length() ) + { + userAgentString.Append( iEntry->iSIPVoIPUAHeaderString ); + } + } + + // Set new user agent header data to profile. + CDesC8ArrayFlat* array = new ( ELeave ) + CDesC8ArrayFlat( KUserAgentHeaderDataArrayInitSize ); + CleanupStack::PushL( array ); // CS:3 + array->AppendL( userAgentString ); + sipProf->SetParameter( KSIPHeaders, *array ); + sipReg->SaveL( *sipProf ); + // array, profile + CleanupStack::PopAndDestroy( 2, sipProf ); // CS:1 + } + CleanupStack::PopAndDestroy( sipReg ); // CS:0 + } + +// --------------------------------------------------------------------------- +// Sets SPSettings to service table. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::SetSpSettingsL() + { + TInt serviceId = iEntry->iServiceProviderId; + if ( 0 == serviceId || !iEntry->iIds.Count() ) + { + return; + } + CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1 + CSPProperty* property = CSPProperty::NewLC(); // CS:2 + + // ============================== + // Voice mailbox settings. + // ============================== + // + + TBool vmbx( EFalse ); + + // Set MWI URI if present. + if ( iSpSettings.iMwiUri ) + { + property->SetName( ESubPropertyVMBXMWIAddress ); + property->SetValue( iSpSettings.iMwiUri->Des() ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Set the same value to Listening URI if it has no value. + if ( !iSpSettings.iListeningUri ) + { + iSpSettings.iListeningUri = iSpSettings.iMwiUri->Des().AllocL(); + } + vmbx = ETrue; + } + // If there is no MWI URI but listening URI is present, set it as MWI URI. + else if ( iSpSettings.iListeningUri ) + { + property->SetName( ESubPropertyVMBXMWIAddress ); + property->SetValue( iSpSettings.iListeningUri->Des() ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + vmbx = ETrue; + } + + // Set Listening URI if present. This is a separate statement since + // the Listening URI may have been configured when setting MWI URI. + if ( iSpSettings.iListeningUri ) + { + property->SetName( ESubPropertyVMBXListenAddress ); + property->SetValue( iSpSettings.iListeningUri->Des() ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + vmbx = ETrue; + } + + if ( KErrNotFound != iSpSettings.iResubrcribe ) + { + property->SetName( ESubPropertyVMBXMWISubscribeInterval ); + property->SetValue( iSpSettings.iResubrcribe ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + if ( vmbx ) + { + property->SetName( ESubPropertyVMBXSettingsId ); + property->SetValue( iEntry->iIds[0].iProfileId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + + // ============================== + // "Core" Service Provider Settings. + // ============================== + // + + if ( iSpSettings.iProviderUrl ) + { + property->SetName( EPropertyServiceBookmarkUri ); + property->SetValue( iSpSettings.iProviderUrl->Des() ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + + if ( iSpSettings.iBrandingUri ) + { + property->SetName( ESubPropertyVoIPBrandDataUri ); + property->SetValue( iSpSettings.iBrandingUri->Des() ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + + if ( iPresenceId ) + { + property->SetName( ESubPropertyPresenceSettingsId ); + property->SetValue( iPresenceId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + + // Converged Connection Handler (CCH) Presence Subservice plug-in UID + property->SetName( EPropertyPresenceSubServicePluginId ); + property->SetValue( KCCHPresenceSubServicePlugId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + + // SIP IM enabled + if ( iSpSettings.iEnableSipIm ) + { + // Set IM as enabled. + property->SetName( ESubPropertyIMEnabled ); + property->SetValue( EOn ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Set IM launch UID. + property->SetName( ESubPropertyIMLaunchUid ); + property->SetValue( KIMLaunchUid ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // The value only needs to be different from 0, + // no-one actually uses it. + property->SetName( ESubPropertyIMSettingsId ); + property->SetValue( KIMSettingsId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Set IM plugin UID. + property->SetName( EPropertyIMSubServicePluginId ); + property->SetValue( KIMSubServicePluginId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Set default IM tone. + TFileName toneFile; + toneFile.Copy( PathInfo::RomRootPath() ); + toneFile.Append( PathInfo::DigitalSoundsPath() ); + toneFile.Append( KDefaultTone ); + MVIMPSTSettingsStore* vimpStSettings = + CVIMPSTSettingsStore::NewLC(); // CS:3 + vimpStSettings->SetL( serviceId, + EServiceToneFileName, toneFile ); + // Pop vimpStSettings (can't use M object as argument). + CleanupStack::PopAndDestroy(); // CS:2 + } + } + + if ( iSpSettings.iAutoAcceptBuddies ) + { + property->SetName( ESubPropertyPresenceRequestPreference ); + property->SetValue( EOn ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + + if ( iDestinationId ) + { + property->SetName( ESubPropertyVoIPPreferredSNAPId ); + property->SetValue( iDestinationId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + if ( iSpSettings.iEnableSipIm ) + { + property->SetName( ESubPropertyIMPreferredSNAPId ); + property->SetValue( iDestinationId ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + } + + if ( iSpSettings.iBrandId ) + { + // Brand version. + property->SetName( EPropertyBrandVersion ); + property->SetValue( KBrandVersion ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Brand language. + property->SetName( EPropertyBrandLanguage ); + property->SetValue( ELangInternationalEnglish ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Brand ID. + property->SetName( EPropertyBrandId ); + property->SetValue( iSpSettings.iBrandId->Des() ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + + if ( iSpSettings.iAutoEnable ) + { + property->SetName( ESubPropertyVoIPEnabled ); + property->SetValue( EOn ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + // Also set voicemailbox on if it's defined. + if ( vmbx ) + { + property->SetName( ESubPropertyVMBXEnabled ); + property->SetValue( EOn ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + // Also set presence on if there is a presence link. + if ( iPresenceId ) + { + property->SetName( ESubPropertyPresenceEnabled ); + property->SetValue( EOn ); + spSettings->AddOrUpdatePropertyL( serviceId, *property ); + } + } + + // property, spSettings + CleanupStack::PopAndDestroy( 2, spSettings ); // CS:0 + } + +// --------------------------------------------------------------------------- +// Creates default codecs. +// --------------------------------------------------------------------------- +// +void CVoipXmlVoipHandler::AddDefaultCodecsL() + { + CRCSEAudioCodecEntry* codec = CRCSEAudioCodecEntry::NewLC(); + + TUint32 codecId( KErrNone ); + + codec->SetDefaultCodecValueSet( KAudioCodecAMRWB() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + codec->SetDefaultCodecValueSet( KAudioCodecAMR() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + codec->SetDefaultCodecValueSet( KAudioCodecPCMU() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + codec->SetDefaultCodecValueSet( KAudioCodecPCMA() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + codec->SetDefaultCodecValueSet( KAudioCodeciLBC() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + codec->SetDefaultCodecValueSet( KAudioCodecG729() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + codec->SetDefaultCodecValueSet( KAudioCodecCN() ); + codecId = iCodecRegistry->AddL( *codec ); + iEntry->iPreferredCodecs.AppendL( codecId ); + + CleanupStack::PopAndDestroy( codec ); + } + +// End of File diff -r bfb1de3eac8e -r 7b872347d83b voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlxdmhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlxdmhandler.cpp Tue Feb 02 00:05:57 2010 +0200 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XDM handler for VoIP XML processor +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voipxmlutils.h" +#include "voipxmlxdmhandler.h" +#include "voipxmlprocessorlogger.h" +#include "voipxmlprocessordefaults.h" + +// --------------------------------------------------------------------------- +// CVoipXmlXdmHandler::CVoipXmlXdmHandler +// --------------------------------------------------------------------------- +// +CVoipXmlXdmHandler::CVoipXmlXdmHandler() + { + } + +// --------------------------------------------------------------------------- +// CVoipXmlXdmHandler::NewL +// --------------------------------------------------------------------------- +// +CVoipXmlXdmHandler* CVoipXmlXdmHandler::NewL() + { + CVoipXmlXdmHandler* self = new ( ELeave ) CVoipXmlXdmHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CVoipXmlXdmHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CVoipXmlXdmHandler::ConstructL() + { + DBG_PRINT( "CVoipXmlXdmHandler::ConstructL begin" ); + iProfile = new (ELeave) CXdmSettingsCollection(); + iProfile->AppendL( KDefaultXdmAuthType, EXdmPropAuthType ); + iProfile->AppendL( KDefaultXdmUri, EXdmPropUri ); + DBG_PRINT( "CVoipXmlXdmHandler::ConstructL end" ); + } + +// --------------------------------------------------------------------------- +// CVoipXmlXdmHandler::~CVoipXmlXdmHandler +// --------------------------------------------------------------------------- +// +CVoipXmlXdmHandler::~CVoipXmlXdmHandler() + { + delete iProfile; + } + +// --------------------------------------------------------------------------- +// Sets XDM setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlXdmHandler::SetSetting( TInt aParam, const TDesC& aValue ) + { + // Ignore too long descriptors. + if ( KMaxNodeValueLength < aValue.Length() ) + { + return; + } + + TRAP_IGNORE( SetSettingL( aParam, aValue ) ); + } + +// --------------------------------------------------------------------------- +// Stores settings through XDM settings API. +// --------------------------------------------------------------------------- +// +TInt CVoipXmlXdmHandler::StoreSettings() + { + if ( !iSettingsSet ) + { + // No settings to be stored => method not supported. + return KErrNotSupported; + } + TRAPD( err, iProfileId = TXdmSettingsApi::CreateCollectionL( *iProfile )); + if ( KErrNone != err ) + { + err = KErrCompletion; + } + return err; + } + +// --------------------------------------------------------------------------- +// Returns the profile ID if the profile saved in StoreSettings. +// --------------------------------------------------------------------------- +// +TUint32 CVoipXmlXdmHandler::SettingsId() + { + return iProfileId; + } + +// --------------------------------------------------------------------------- +// Sets XDM setting. +// --------------------------------------------------------------------------- +// +void CVoipXmlXdmHandler::SetSettingL( TInt aParam, const TDesC& aValue ) + { + switch ( aParam ) + { + case EName: + { + TBuf name( KNullDesC ); + name.Copy( aValue ); + CreateProviderNameL( name ); + iProfile->AppendL( name, EXdmPropName ); + iSettingsSet = ETrue; + break; + } + case EType: + { + // First remove default value. + iProfile->RemoveL( EXdmPropAuthType ); + iProfile->AppendL( aValue, EXdmPropAuthType ); + iSettingsSet = ETrue; + break; + } + case EUri: + { + // First remove default value. + iProfile->RemoveL( EXdmPropUri ); + iProfile->AppendL( aValue, EXdmPropUri ); + iSettingsSet = ETrue; + break; + } + case EUsername: + { + iProfile->AppendL( aValue, EXdmPropAuthName ); + iSettingsSet = ETrue; + break; + } + case EPassword: + { + iProfile->AppendL( aValue, EXdmPropAuthSecret ); + iSettingsSet = ETrue; + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Checks for duplicate named XDM sets. Renames if same. +// --------------------------------------------------------------------------- +// +void CVoipXmlXdmHandler::CreateProviderNameL( TDes& aName ) + { + DBG_PRINT( "CVoipXmlXdmHandler::CreateProviderNameL begin" ); + + RArray settingIds; + CleanupClosePushL( settingIds ); // CS:1 + // CS:2 + CDesCArray* names = TXdmSettingsApi::CollectionNamesLC( settingIds ); + + HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3 + newName->Des().Copy( aName ); + const TInt count( names->MdcaCount() ); + TUint i( 1 ); // Add number to the name if name already in use. + + // Go through each profile and see if the name of the new profile + // matches one of the existing names. If it does change it and + // check the new name again. + for ( TInt counter = 0; counter < count; counter++ ) + { + TBuf loadedName; + loadedName.Copy( names->MdcaPoint( counter )); + if ( 0 == newName->Des().Compare( loadedName ) ) + { + // If the name is changed we need to begin the comparison + // again from the first profile. + newName->Des().Copy( aName ); + newName->Des().Append( KOpenParenthesis() ); + newName->Des().AppendNum( i ); + newName->Des().Append( KClosedParenthesis() ); + counter = 0; + i++; + if ( KMaxProfileNames < i ) + { + User::Leave( KErrBadName ); + } + } + } + aName.Copy( newName->Des() ); + + // newName, names, &settingIds + CleanupStack::PopAndDestroy( 3, &settingIds ); + DBG_PRINT( "CVoipXmlXdmHandler::CreateProviderNameL end" ); + } + +// End of file.