# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274959966 -10800 # Node ID 8873e6835f7b9e88aaaee200bb227499558328a2 # Parent b23410e29e22d73fe1c743a6b9f45b04eb3d9c1c Revision: 201021 Kit: 2010121 diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/bld.inf --- a/contentmgmt/cafstreamingsupport/group/bld.inf Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/bld.inf Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -49,6 +49,7 @@ #ifndef TOOLS #ifndef TOOLS2 + // Common test stream agent implementation projects stashared.mmp staclient.mmp @@ -69,13 +70,8 @@ PRJ_TESTEXPORTS ../test/tscaf/scripts/tscaf.ini z:/tcaf/tscaf/tscaf.ini -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY ../test/tscaf/scripts/tscaf.script z:/tcaf/tscaf/tscaf.script ../test/tscaf/scripts/tscaf_oom.script z:/tcaf/tscaf/tscaf_oom.script -#else -../test/tscaf/scripts/tscaf_without_upward_dependent.script z:/tcaf/tscaf/tscaf.script -../test/tscaf/scripts/tscaf_oom_without_upward_dependent.script z:/tcaf/tscaf/tscaf_oom.script -#endif ../test/tscaf/scripts/tscafipsec.script z:/tcaf/tscaf/tscafipsec.script ../test/tscaf/scripts/tscafipsec_oom.script z:/tcaf/tscaf/tscafipsec_oom.script ../test/tscaf/scripts/tscafipsecmanual.script z:/tcaf/tscaf/tscafipsecmanual.script diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/staclient.mmp --- a/contentmgmt/cafstreamingsupport/group/staclient.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/staclient.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -25,9 +25,10 @@ USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../test/streamingtestagent/source/client SOURCE staclient.cpp @@ -36,9 +37,7 @@ LIBRARY scsclient.lib LIBRARY estor.lib LIBRARY cafutils.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY stashared.lib LIBRARY streamingcaf.lib efsrv.lib SMPSAFE diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/staserver.mmp --- a/contentmgmt/cafstreamingsupport/group/staserver.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/staserver.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -23,10 +23,12 @@ CAPABILITY DRM NetworkControl NetworkServices OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api + SOURCEPATH ../test/streamingtestagent/source/server SOURCE staserver.cpp @@ -38,9 +40,7 @@ LIBRARY efsrv.lib LIBRARY cafutils.lib LIBRARY estor.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY bafl.lib LIBRARY stashared.lib LIBRARY streamingcaf.lib diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/stashared.mmp --- a/contentmgmt/cafstreamingsupport/group/stashared.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/stashared.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -26,9 +26,11 @@ USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../test/streamingtestagent_singleprocess/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api + OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../test/streamingtestagent/source/shared SOURCE testprotstrdesc.cpp @@ -45,9 +47,7 @@ LIBRARY estor.lib LIBRARY staclient.lib LIBRARY srautils.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY efsrv.lib LIBRARY bafl.lib SMPSAFE diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/tscaf.mmp --- a/contentmgmt/cafstreamingsupport/group/tscaf.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/tscaf.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -46,9 +46,11 @@ USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../test/streamingtestagent_singleprocess/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api + OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib LIBRARY estlib.lib @@ -59,9 +61,7 @@ LIBRARY testexecutelogclient.lib LIBRARY rfileloggerclient.lib LIBRARY cafutils.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY bafl.lib LIBRARY streamingcaf.lib LIBRARY stashared.lib diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/tscaf_singleprocess_streamagent.mmp --- a/contentmgmt/cafstreamingsupport/group/tscaf_singleprocess_streamagent.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/tscaf_singleprocess_streamagent.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -35,15 +35,15 @@ USERINCLUDE ../test/streamingtestagent_singleprocess/inc USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api + OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib LIBRARY streamingcaf.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY stashared.lib LIBRARY srautils.lib diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/tscaf_streamagent01.mmp --- a/contentmgmt/cafstreamingsupport/group/tscaf_streamagent01.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/tscaf_streamagent01.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -34,15 +34,15 @@ USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api + OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib LIBRARY streamingcaf.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY stashared.lib LIBRARY srautils.lib diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/group/tscaf_streamagent02.mmp --- a/contentmgmt/cafstreamingsupport/group/tscaf_streamagent02.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/group/tscaf_streamagent02.mmp Thu May 27 14:32:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2009 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 the License "Eclipse Public License v1.0" @@ -34,15 +34,15 @@ USERINCLUDE ../test/streamingtestagent/inc USERINCLUDE ../../referencedrmagent/RefTestAgent/streamingrefagent/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/inc +USERINCLUDE ../../referencedrmagent/RefTestAgent/localsdp/api + OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib LIBRARY streamingcaf.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY stashared.lib LIBRARY srautils.lib diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/stacommon.h --- a/contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/stacommon.h Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/stacommon.h Thu May 27 14:32:46 2010 +0300 @@ -31,14 +31,14 @@ #include #include #include -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -#include -#include -#include -#include -#include -#include -#endif + +#include "sdpdocument.h" +#include "sdpmediafield.h" +#include "sdpattributefield.h" +#include "sdpcodecstringpool.h" +#include "sdpfmtattributefield.h" +#include "sdpcodecstringconstants.h" + #include #include #include diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/staserver.h --- a/contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/staserver.h Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/staserver.h Thu May 27 14:32:46 2010 +0300 @@ -74,10 +74,8 @@ private: HBufC8* iBuffer; CKeyStreamSink* iKeyStreamSink; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY CSdpMediaField* iSdp; CSdpDocument* iSdpDoc; -#endif CSraRightsObject* iRo; }; diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/streamingtestagent/source/client/staclient.cpp --- a/contentmgmt/cafstreamingsupport/test/streamingtestagent/source/client/staclient.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/streamingtestagent/source/client/staclient.cpp Thu May 27 14:32:46 2010 +0300 @@ -151,15 +151,10 @@ @param aKey An SDP object data. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY HBufC8* sdpBuf(0); TPtr8 ptr(EncodeLC(aSdp, sdpBuf)); User::LeaveIfError(CallSessionFunction(ESetSdpKeyStream, TIpcArgs(&ptr))); CleanupStack::PopAndDestroy(sdpBuf); -#else - (void) aSdp; -#endif - } EXPORT_C void RStaClient::SetSdpDocumentL(const CSdpDocument& aSdpDoc) const @@ -168,15 +163,10 @@ @param aKey An SDP object data. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY HBufC8* sdpDocBuf(0); TPtr8 ptr(EncodeLC(aSdpDoc, sdpDocBuf)); User::LeaveIfError(CallSessionFunction(ESetSdpDocument, TIpcArgs(&ptr))); CleanupStack::PopAndDestroy(sdpDocBuf); -#else - (void) aSdpDoc; -#endif - } EXPORT_C void RStaClient::SendIpSecAssociationL(TInt32 aSpi, HBufC8* aEncryptionKey, HBufC8* aAuthenticationKey) const diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/staserver.cpp --- a/contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/staserver.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/staserver.cpp Thu May 27 14:32:46 2010 +0300 @@ -66,9 +66,7 @@ */ { iFs.Close(); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY SdpCodecStringPool::Close(); -#endif } @@ -96,9 +94,7 @@ User::LeaveIfError(iFs.Connect()); User::LeaveIfError(iFs.ShareProtected()); User::LeaveIfError(iFs.CreatePrivatePath(iFs.GetSystemDrive())); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY SdpCodecStringPool::OpenL(); -#endif StartL(KStaName); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/stasession.cpp --- a/contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/stasession.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/streamingtestagent/source/server/stasession.cpp Thu May 27 14:32:46 2010 +0300 @@ -39,10 +39,8 @@ delete iBuffer; delete iKeyStreamSink; delete iRo; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY delete iSdp; delete iSdpDoc; -#endif } @@ -347,7 +345,6 @@ @param aMessage Standard server-side handle to message. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY TInt len = aMessage.GetDesMaxLengthL(0); HBufC8* des = HBufC8::NewLC(len); TPtr8 ptr(des->Des()); @@ -367,10 +364,6 @@ { User::Leave(KErrCANoRights); } -#else - (void) aMessage; - User::Leave(KErrCANoRights); -#endif } void CStaSession::SetSdpDocumentL(const RMessage2& aMessage) @@ -380,7 +373,6 @@ @param aMessage Standard server-side handle to message. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY TInt len = aMessage.GetDesMaxLengthL(0); HBufC8* des = HBufC8::NewLC(len); TPtr8 ptr(des->Des()); @@ -393,9 +385,6 @@ // Decode the SDP document object from the encoded data iSdpDoc = CSdpDocument::DecodeL(*des); CleanupStack::PopAndDestroy(des); -#else - (void) aMessage; -#endif } void CStaSession::VerifyRoL() diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/streamingtestagent_singleprocess/source/shared/testsingleprocesskeystreamdecoder.cpp --- a/contentmgmt/cafstreamingsupport/test/streamingtestagent_singleprocess/source/shared/testsingleprocesskeystreamdecoder.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/streamingtestagent_singleprocess/source/shared/testsingleprocesskeystreamdecoder.cpp Thu May 27 14:32:46 2010 +0300 @@ -41,10 +41,8 @@ iFs.Close(); delete iKeyStreamSink; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY delete iSdp; delete iSdpDoc; -#endif delete iRo; } @@ -93,13 +91,8 @@ iKeyStreamSink->SetEncryptionAlgorithmL(EAES_128_CBC); iKeyStreamSink->SetAuthenticationAlgorithmL(EHMAC_SHA1); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY iSdp = aSdpKeyStream.CloneL(); iSdpDoc = aSdpDoc.CloneL(); -#else - (void) aSdpKeyStream; - (void) aSdpDoc; -#endif SetRoL(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h --- a/contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/inc/tscafstep.h Thu May 27 14:32:46 2010 +0300 @@ -111,11 +111,9 @@ TVerdict doTestStepL(); TVerdict doTestStepPostambleL(); void CleanAgentsPrivateFolderL(const TDesC& aPrivatePath); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY CSdpDocument* CreateSdpDocumentLC(); CSdpMediaField* CreateSdpLC(TInt aSdpNum); void AddMediaFieldL(CSdpDocument& aSdpDoc, const CSdpMediaField* aSdpKeyStream); -#endif CKeyStreamSink* CreateKeyStreamSinkLC(const TDesC& aFilePath, const TDesC& aPrivPath); void CopyFile2AgentsPrivateFolderL(RFs& aFs, const TDesC& aFileName, const TDesC& aPrivPath); HBufC* GetFullPathLC(const TDesC& aPath, const TDesC& aFileName); @@ -139,9 +137,7 @@ const TDesC& aExpectedValue); private: -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY void AddAttributes2SdpL(CSdpMediaField& aSdp, TInt aSdpNum); -#endif void PrintErrorAndLeaveL(TDesC& aKey); static void DeleteSdpDocAndCloseCodecPool(TAny* aSdpDoc); diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/scripts/tscaf_oom_without_upward_dependent.script --- a/contentmgmt/cafstreamingsupport/test/tscaf/scripts/tscaf_oom_without_upward_dependent.script Fri May 14 17:39:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -// -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "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: -// -// Streaming CAF "Out of Memory" Tests - -PRINT Run PREQ782 Streaming CAF OOM Tests - -// Load Suite -LOAD_SUITE tscaf - - -//! @SYMTestCaseID SEC-SCAF-OOM-0001 -//! @SYMTestCaseDesc StartupComms - -START_TESTCASE SEC-SCAF-OOM-0001 -RUN_TEST_STEP 100 tscaf StartupCommsStep -END_TESTCASE SEC-SCAF-OOM-0001 - - -// Note: For test case descriptions, please refer to the corresponding tscaf.script file - - -//********************** SEC-SCAF-A : CONSUMER INTERFACE ********************** - - -//! @SYMTestCaseID SEC-SCAF-OOM-A001 -//! @SYMTestCaseDesc (keystreamdecoder_positiveconstruct_OOM) - -START_TESTCASE SEC-SCAF-OOM-A001 -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Program -RUN_TEST_STEP 100 tscaf SCAFKeyStreamDecoderConstruct z:\tcaf\tscaf\tscaf.ini keystreamdecoder_positiveconstruct_OOM -END_TESTCASE SEC-SCAF-OOM-A001 - - -//! @SYMTestCaseID SEC-SCAF-OOM-A004 -//! @SYMTestCaseDesc (keystreamdecoder_positivequery_OOM) - -START_TESTCASE SEC-SCAF-OOM-A004 - -// Copy the necessary 'Program' Protected rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Program -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_positivequery_programprotectedRO_OOM - -// Copy the necessary 'Service' Protected rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Service -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_positivequery_serviceprotectedRO_OOM - -END_TESTCASE SEC-SCAF-OOM-A004 - - - -//! @SYMTestCaseID SEC-SCAF-OOM-A008 -//! @SYMTestCaseDesc (multikeystreamdecoders_OOM) - -START_TESTCASE SEC-SCAF-OOM-A008 - -// Copy the necessary rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_ServiceProgram - -// 2 Key Stream Decoders, Invoking the same stream agent -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_singlethread_singleagent_OOM - -// 2 Key Stream Decoders, Invoking different stream agents -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_singlethread_multiagents_OOM - -END_TESTCASE SEC-SCAF-OOM-A008 - - - -//************ SEC-SCAF-C : INTEROPERABILITY WITH DECODING STACK *********** - - -//! @SYMTestCaseID SEC-SCAF-OOM-C001 -//! @SYMTestCaseDesc (keystreamsinks_OOM) - -START_TESTCASE SEC-SCAF-OOM-C001 -RUN_TEST_STEP 100 tscaf SCAFKeyStreamSink z:\tcaf\tscaf\tscaf.ini sdp_service_protected_OOM -END_TESTCASE SEC-SCAF-OOM-C001 - - - -//! @SYMTestCaseID SEC-SCAF-OOM-C002 -//! @SYMTestCaseDesc (concurrent_keystreamsinks_OOM) - -START_TESTCASE SEC-SCAF-OOM-C002 -RUN_TEST_STEP 150 tscaf SCAFConcurrentKeyStreamSinks z:\tcaf\tscaf\tscaf.ini concurrent_keystreamsinks_OOM -END_TESTCASE SEC-SCAF-OOM-C002 - - - -//********************** SEC-SCAF-D : POST-ACQUISITION ********************** - - -//! @SYMTestCaseID SEC-SCAF-OOM-D001 -//! @SYMTestCaseDesc (postacqusition_OOM) - -START_TESTCASE SEC-SCAF-OOM-D001 - -RUN_TEST_STEP 100 tscaf SCAFPostAcquisition z:\tcaf\tscaf\tscaf.ini post_acquisition_OOM - -RUN_TEST_STEP 100 tscaf SCAFPostAcquisition z:\tcaf\tscaf\tscaf.ini post_acquisition_create_outputs_OOM - -END_TESTCASE SEC-SCAF-OOM-D001 - - - -//********************** SEC-SCAF-E : INTEROPERABILITY WITH DECODING STACK - IPSEC *********** - -RUN_SCRIPT z:\tcaf\tscaf\tscafipsec_oom.script - - - -//********************** SEC-SCAF-H : REFERENCE AGENT TEST ********************** - -//! @SYMTestCaseID SEC-SCAF-OOM-H001 -//! @SYMTestCaseDesc (referenceagent_OOM) - -START_TESTCASE SEC-SCAF-OOM-H001 -RUN_TEST_STEP 100 tscaf SCAFRefAgent z:\tcaf\tscaf\tscaf.ini reference_agent_OOM -END_TESTCASE SEC-SCAF-OOM-H001 - - diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/scripts/tscaf_without_upward_dependent.script --- a/contentmgmt/cafstreamingsupport/test/tscaf/scripts/tscaf_without_upward_dependent.script Fri May 14 17:39:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,566 +0,0 @@ -// -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "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: -// -// Streaming CAF Integration Tests - -PRINT Run PREQ782 Streaming CAF Integration Tests - -// Load Suite -LOAD_SUITE tscaf - - -//! @SYMTestCaseID SEC-SCAF-MISC-0001 -//! @SYMTestCaseDesc StartupComms - -START_TESTCASE SEC-SCAF-MISC-0001 -RUN_TEST_STEP 100 tscaf StartupCommsStep -END_TESTCASE SEC-SCAF-MISC-0001 - - -//********************** SEC-SCAF-A : CONSUMER INTERFACE ********************** - -//! @SYMTestCaseID SEC-SCAF-A001 -//! @SYMTestCaseDesc Key stream decoder construction with a supported protected key stream description -//! (keystreamdecoder_positiveconstruct) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7772, REQ7776, REQ7781, REQ7784, REQ7954 -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • There are the necessary ROM based test stream agent plug-ins present that support -//! the SDP media description supplied during construction of the key stream decoder. -//! -//! Test Actions: -//! • Generate a protected key stream description. -//! • Generate an SDP media description for the key stream. -//! • Construct the key stream decoder using the protected stream description and SDP -//! media description objects previously generated. -//! • Destroy the key stream decoder object. -//! -//! @SYMTestExpectedResults • The key stream decoder is successfully created and destroyed. -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-A001 -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Program -RUN_TEST_STEP 100 tscaf SCAFKeyStreamDecoderConstruct z:\tcaf\tscaf\tscaf.ini keystreamdecoder_positiveconstruct -END_TESTCASE SEC-SCAF-A001 - - - -//! @SYMTestCaseID SEC-SCAF-A004 -//! @SYMTestCaseDesc Querying attributes related to a key stream decoder -//! (keystreamdecoder_positivequery) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7772, REQ7776, REQ7784, REQ7954 -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • The necessary ROM based test stream agent plug-in is present that supports the SDP -//! media description -//! supplied during construction of the key stream decoder. -//! • There are two Rights Objects files (serviceProtectedRO and programProtectedRO) in -//! the private folder of the supporting test stream agent. -//! • The Rights Issuer URI of the serviceProtectedRO is set to “IssuerUriServiceProtectedRO” -//! and programProtectedRO is set to “IssuerUriProgramProtectedRO” -//! -//! Test Actions: -//! • Generate a protected key stream description. -//! • Generate an SDP media description for the key stream with an attribute requiring -//! programProtectedRO -//! • Construct the key stream decoder using the protected stream description and SDP media -//! description objects previously generated. -//! • Query the stream agent to determine whether the program is protected. -//! • Query the stream agent to determine whether the whole service is protected. -//! • Query the stream agent to retrieve the Rights Issuer URI. -//! • Destroy the key stream decoder object. -//! -//! @SYMTestExpectedResults • The key stream decoder is successfully created. -//! • The program is protected but the whole service is not. -//! • The Rights Issuer URI retrieved is “IssuerUriProgramProtectedRO” -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-A004 - -// Copy the necessary 'Program' Protected rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Program -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_positivequery_programprotectedRO - -// Copy the necessary 'Service' Protected rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Service -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_positivequery_serviceprotectedRO - -END_TESTCASE SEC-SCAF-A004 - -//! @SYMTestCaseID SEC-SCAF-A007 -//! @SYMTestCaseDesc Concurrent key stream decoder construction and querying -//! (keystreamdecoder_concurrentquery) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7772, REQ7776, REQ7781, REQ7784, REQ7954 -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! The following test actions should be carried out concurrently in 3 separate threads: -//! • Generate a protected key stream description. -//! • Generate an SDP media description. Thread A should generate an SDP media description -//! supported by test stream agent plug-in A and Threads B & C should generate SDP media -//! description objects supported by test stream agent plug-in B. -//! • Construct a key stream decoder object using the generated protected key stream -//! description and SDP media description objects. -//! • When the key stream decoder has been constructed, query the attributes associated -//! with the stream agent. -//! • Destroy the key stream decoder object. -//! -//! @SYMTestExpectedResults • Each key stream decoder object should construct successfully. -//! • Checking the implementation attributes reveals that Thread A has invoked test stream -//! agent A and Thread B & C have invoked test stream agent B. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-A007 - -// Copy the necessary rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_ServiceProgram - -CONCURRENT -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_concurrentquery_threadA -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_concurrentquery_threadB -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini keystreamdecoder_concurrentquery_threadC -CONSECUTIVE - -END_TESTCASE SEC-SCAF-A007 - - - -//! @SYMTestCaseID SEC-SCAF-A008 -//! @SYMTestCaseDesc Concurrent multi-thread usage of multiple key stream decoders -//! (multikeystreamdecoders) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7772, REQ7775, REQ7776, REQ7781, REQ7784, REQ7954 -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! The following test actions should be carried out concurrently in 3 separate threads: -//! • Generate a protected key stream description. -//! • Generate an SDP media description (SDPa) for the key stream with an attribute -//! requiring serviceProtectedRO. -//! • Construct a key stream decoder object using the generated protected key stream -//! description and SDP media description object SDPa – decoderA. -//! • Generate another SDP media description (SDPb) for the key stream with an attribute -//! requiring programProtectedRO. -//! • Construct another key stream decoder object using the generated protected key stream -//! description and SDP media description object SDPb – decoderB. -//! • Query decoderA to retrieve the ‘Rights Issuer URI’ attribute from the invoked -//! stream agent. -//! • Query decoderB to retrieve the ‘Rights Issuer URI’ attribute from the invoked -//! stream agent. -//! • Destroy both key stream decoder objects. -//! -//! @SYMTestExpectedResults • Each key stream decoder object should construct successfully. -//! • The Rights Issuer URI attribute value retrieved from decoderA is -//! “IssuerUriServiceProtectedRO” -//! • The Rights Issuer URI attribute value retrieved from decoderB is -//! “IssuerUriProgramProtectedRO” -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-A008 - -// Copy the necessary rights objects into the stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_ServiceProgram - -// 2 Key Stream Decoders, Invoking the same stream agent -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_singlethread_singleagent - -// 2 Key Stream Decoders, Invoking different stream agents -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_singlethread_multiagents - -// 3 concurrent threads, 2 key stream decoders per thread invoking the same agent -CONCURRENT -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_singleagent_threadA -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_singleagent_threadB -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_singleagent_threadC -CONSECUTIVE - -// 3 concurrent threads, 2 key stream decoders per thread invoking different agents -CONCURRENT -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_multiagents_threadA -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_multiagents_threadB -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_multiagents_threadC -CONSECUTIVE - -END_TESTCASE SEC-SCAF-A008 - - - -//****************** TEST STREAM AGENT UNIT TESTING ******************* - -//! @SYMTestCaseID SEC-SCAF-S001 -//! @SYMTestCaseDesc A unit test step which tests the Test Streaming Agent -//! (StreamingTestAgent) -//! @SYMREQ Req-b -//! @SYMTestPriority Low -//! @SYMTestActions A connection is established with the Test Agent Server via its client side and the closed. -//! @SYMTestExpectedResults Successful connection and disconnectiom to/from the Test Streaming Agent Server. -//! @SYMDevelopedForRelease Oghma - -START_TESTCASE SEC-SCAF-S001 -RUN_TEST_STEP 100 tscaf SCAFTestAgentServer -END_TESTCASE SEC-SCAF-S001 - - - -//************ SEC-SCAF-C : INTEROPERABILITY WITH DECODING STACK *********** - - -//! @SYMTestCaseID SEC-SCAF-C001 -//! @SYMTestCaseDesc Usage of key stream sink -//! (keystreamsinks) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7774, REQ7778, REQ7786 -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • There are the necessary ROM based test stream agent plug-ins present that support -//! the SDP media description supplied during construction of each key stream decoder. -//! • There is a Right Object file in the private folder of the supporting test stream agent. -//! -//! Test Actions: -//! • Create a key stream sink -//! • Create a plain key and encrypt it with the key extracted from the RO -//! • Connect to the Test Agent -//! • Send the key stream sink -//! • Send the encrypted string (a simple key stream) -//! • The test agent server decrypts the key stream by using the key from the RO. -//! • The test agent server processes the decrypted key (the key is written into a file -//! defined in the key stream sink) -//! • Check whether the right plain key is written down -//! • Destroy the key stream decoder object. -//! -//! @SYMTestExpectedResults • The plain string is found in the predefined location. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-C001 -RUN_TEST_STEP 100 tscaf SCAFKeyStreamSink z:\tcaf\tscaf\tscaf.ini sdp_service_protected -END_TESTCASE SEC-SCAF-C001 - - - -//! @SYMTestCaseID SEC-SCAF-C002 -//! @SYMTestCaseDesc Usage of key stream sinks in concurrent sessions -//! (concurrent_keystreamsinks) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7774, REQ7778, REQ7786 -//! @SYMTestPriority Critical -//! @SYMTestStatus Preconditions: -//! • There are the necessary ROM based test stream agent plug-ins present that support -//! the SDP media description supplied during construction of each key stream decoder. -//! • There are two Rights Object files (serviceProtectedRO and programProtectedRO) in the -//! private folder of each test stream agent. -//! -//! Test Actions: -//! • Generate a protected key stream description. -//! • Generate an SDP media description (SDPa) for the key stream with an attribute requiring -//! serviceProtectedRO. -//! • Construct a key stream decoder object using the generated protected key stream -//! description and SDP media description object SDPa – decoderA. -//! • Generate another SDP media description (SDPb) for the key stream with an attribute requiring -//! programProtectedRO. -//! • Construct another key stream decoder object using the generated protected key stream -//! description and SDP media description object SDPb – decoderB. -//! • Create plain_keyA -//! • Encrypt plain_keyA with encryption_keyA extracted from serviceProtectedRO -//! • Send the encrypted plain_keyA using decoderA -//! • Create plain_keyB -//! • Encrypt plain_keyB with encryption_keyB extracted from programProtectedRO -//! • Send the encrypted plain_keyB using decoderB -//! • Check whether stringA is in pathA and stringB is in pathB -//! • Destroy both key stream decoder objects. -//! -//! @SYMTestExpectedResults • The plain strings are found in the predefined locations. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-C002 -RUN_TEST_STEP 100 tscaf SCAFConcurrentKeyStreamSinks z:\tcaf\tscaf\tscaf.ini concurrent_keystreamsinks -END_TESTCASE SEC-SCAF-C002 - - - -//********************** SEC-SCAF-D : POST-ACQUISITION ********************** - - -//! @SYMTestCaseID SEC-SCAF-D001 -//! @SYMTestCaseDesc Post-acquisition content protection -//! (postacqusition) -//! @SYMPREQ PREQ782 -//! @SYMREQ REQ7788 -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! The following test actions should be carried out: -//! • Copy rorecordable.dr (a rights object where ECanExport and EMustProtectIfRecording -//! flags shall be set) and its post-acquistion rights object (ropostacquisition.dr) into -//! the private directory of the test agent server. -//! • Generate a test key stream description -//! • Generate an SDP media description for the key stream with an attribute requiring -//! rorecordable.dr -//! • Construct the key stream decoder using the protected key stream description and SDP -//! media description objects previously generated. -//! • Query the stream agent to determine whether it is allowed to export and record the -//! content. -//! • Request and gets a handle to the postacqusition rights object file -//! • Import the postacqusition rights object file to the post-acquisition caf agent -//! • Open a session to import the content -//! • Import the content to the post-acquisition caf agent -//! -//! @SYMTestExpectedResults -//! • The protected stream is allowed to be recorded -//! • The test streaming agent returns a handle of the post-acquistion RO successfully -//! • The post-acquistion RO is successfully imported to the post-acquisition caf agent -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-D001 - -RUN_TEST_STEP 100 tscaf SCAFPostAcquisition z:\tcaf\tscaf\tscaf.ini post_acquisition - -RUN_TEST_STEP 100 tscaf SCAFPostAcquisition z:\tcaf\tscaf\tscaf.ini post_acquisition_create_outputs - -END_TESTCASE SEC-SCAF-D001 - - - -//********************** SEC-SCAF-E : INTEROPERABILITY WITH DECODING STACK - IPSEC *********** - -RUN_SCRIPT z:\tcaf\tscaf\tscafipsec.script - - - -//********************** SEC-SCAF-G : SINGLE PROCESS STREAM AGENT TESTING ********************** - -//! @SYMTestCaseID SEC-SCAF-G001 -//! @SYMTestCaseDesc SPSA - Key stream decoder construction with a supported protected key stream description -//! (spsa_keystreamdecoder_positiveconstruct) -//! @SYMPREQ PREQ782 -//! @SYMREQ -//! @SYMTestPriority High -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • The necessary ROM based ‘single process’ stream agent plug-in is present that supports -//! the SDP media description supplied during construction of the key stream decoder. -//! -//! Test Actions: -//! • Run the test step actions as described in test case SEC-SCAF-A001. -//! -//! @SYMTestExpectedResults • The key stream decoder constructed by the single process stream agent is successfully -//! created and destroyed. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-G001 -RUN_TEST_STEP 100 tscaf SCAFKeyStreamDecoderConstruct z:\tcaf\tscaf\tscaf.ini spsa_keystreamdecoder_positiveconstruct -END_TESTCASE SEC-SCAF-G001 - - - -//! @SYMTestCaseID SEC-SCAF-G002 -//! @SYMTestCaseDesc SPSA - Querying attributes related to a key stream decoder -//! (spsa_keystreamdecoder_positivequery) -//! @SYMPREQ PREQ782 -//! @SYMREQ -//! @SYMTestPriority High -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • The necessary ROM based ‘single process’ stream agent plug-in is present that supports -//! the SDP media description supplied during construction of the key stream decoder. -//! • The required Rights Object file is present in the private folder for the supporting -//! single process stream agent. -//! -//! Test Actions: -//! • Run the test step actions as described in test case SEC-SCAF-A004. -//! -//! @SYMTestExpectedResults • The key stream decoder constructed by the single process stream agent is successfully -//! created. -//! • All of the expected attribute values match their corresponding values retrieved from -//! the key stream decoder. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-G002 - -// Copy the necessary 'Program' Protected rights objects into the single process stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Program_SingleProcessAgent -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini spsa_keystreamdecoder_positivequery_programprotectedRO - -// Copy the necessary 'Service' Protected rights objects into the single process stream agent's private directory -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Service_SingleProcessAgent -RUN_TEST_STEP tscaf SCAFKeyStreamDecoderAttributes z:\tcaf\tscaf\tscaf.ini spsa_keystreamdecoder_positivequery_serviceprotectedRO - -END_TESTCASE SEC-SCAF-G002 - - - -//! @SYMTestCaseID SEC-SCAF-G003 -//! @SYMTestCaseDesc SPSA - Concurrent multi-thread usage of multiple key stream decoders -//! (spsa_multikeystreamdecoders) -//! @SYMPREQ PREQ782 -//! @SYMREQ -//! @SYMTestPriority High -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • The necessary ROM based ‘single process’ and ‘client-server’ stream agent plug-in -//! implementations are present that support the SDP media descriptions supplied during -//! construction of the key stream decoders. -//! • The required Rights Object files are present in the private folder of the supporting -//! stream agents. -//! -//! Test Actions: -//! The following test actions should be carried out concurrently in 3 separate threads -//! (1 of the threads should instantiate a ‘single process’ stream agent, whereas the others -//! should instantiate ‘client-server’ based stream agents) : -//! -//! • Run the test step actions as described in test case SEC-SCAF-A008 -//! -//! @SYMTestExpectedResults • Each of the key stream decoder objects that have been constructed by either a -//! client-server or single process stream agent plug-in are created successfully. -//! • All of the expected attribute values match their corresponding values retrieved from -//! the associated key stream decoder. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-G003 - -// Copy the necessary rights objects into the stream agent's private directory (Client/Server Architecture) -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_ServiceProgram - -// Copy the necessary rights objects into the stream agent's private directory (Single Process Stream Agent) -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_ServiceProgram_SingleProcessAgent - -// 2 Key Stream Decoders, Invoking the same single process stream agent -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini spsa_multikeystreamdecoders_singlethread_singleagent - -// 2 Key Stream Decoders, Invoking different stream agents (1 Single Process & 1 Client/Server) -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini spsa_multikeystreamdecoders_singlethread_multiagents - -// 3 concurrent threads, 2 key stream decoders per thread invoking the same agent -CONCURRENT -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini spsa_multikeystreamdecoders_concurrent_singleagent_threadA -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_singleagent_threadB -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini multikeystreamdecoders_concurrent_singleagent_threadC -CONSECUTIVE - -// 3 concurrent threads, 2 key stream decoders per thread invoking different agents (1 Single Process & 1 Client/Server) -CONCURRENT -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini spsa_multikeystreamdecoders_concurrent_multiagents_threadA -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini spsa_multikeystreamdecoders_concurrent_multiagents_threadB -RUN_TEST_STEP tscaf SCAFMultiKeyStreamDecoders z:\tcaf\tscaf\tscaf.ini spsa_multikeystreamdecoders_concurrent_multiagents_threadC -CONSECUTIVE - -END_TESTCASE SEC-SCAF-G003 - - - -//! @SYMTestCaseID SEC-SCAF-G004 -//! @SYMTestCaseDesc SPSA - Usage of key stream sink -//! (spsa_keystreamsinks) -//! @SYMPREQ PREQ782 -//! @SYMREQ -//! @SYMTestPriority High -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • The necessary ROM based ‘single process’ stream agent plug-in is present that supports -//! the SDP media description supplied during construction of the key stream decoder. -//! • The required Rights Object file is present in the private folder for the supporting single -//! process stream agent. -//! -//! Test Actions: -//! • Run the test step actions as described in test case SEC-SCAF-C001. -//! -//! @SYMTestExpectedResults • The expected plain text string is found in the predefined location. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-G004 - -// Single Process Stream Agent Invoked -RUN_TEST_STEP 100 tscaf SCAFKeyStreamSink z:\tcaf\tscaf\tscaf.ini spsa_keystreamink - -// 2 Single Process Stream Agents Invoked -RUN_TEST_STEP 100 tscaf SCAFConcurrentKeyStreamSinks z:\tcaf\tscaf\tscaf.ini spsa_concurrent_keystreamsinks - -// 1 Single Process Stream Agent and 1 Client/Server Stream Agent Invoked -RUN_TEST_STEP 100 tscaf SCAFConcurrentKeyStreamSinks z:\tcaf\tscaf\tscaf.ini spsa_cssa_concurrent_keystreamsinks - -END_TESTCASE SEC-SCAF-G004 - - - -//! @SYMTestCaseID SEC-SCAF-G006 -//! @SYMTestCaseDesc SPSA - Testing IPSec integration with key stream decoder -//! (spsa_ipsec_integration_decoder_automatic) -//! @SYMPREQ PREQ782 -//! @SYMREQ -//! @SYMTestPriority High -//! @SYMTestStatus Implemented -//! @SYMTestActions Preconditions: -//! • The necessary ROM based ‘single process’ stream agent plug-in is present that supports the -//! SDP media description supplied during construction of the key stream decoder. -//! -//! Test Actions: -//! • Run the test step actions as described in test case SEC-SCAF-E015. -//! -//! @SYMTestExpectedResults • Associations was added -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-G006 - -RUN_TEST_STEP tscaf SCAFSetupRightsObjects z:\tcaf\tscaf\tscaf.ini Rights_Program_SingleProcessAgent - -//The time limit is disabled since this test is manual -RUN_TEST_STEP -1 tscaf SCAFIpSecDecoderIntegration z:\tcaf\tscaf\tscaf.ini spsa_ipsec_integration_decoder_automatic - -END_TESTCASE SEC-SCAF-G006 - - - -//********************** SEC-SCAF-H : REFERENCE AGENT TEST ********************** - - -//! @SYMTestCaseID SEC-SCAF-H001 -//! @SYMTestCaseDesc Smoke testing for the Reference Agent -//! (referenceagent) -//! @SYMPREQ PREQ782 -//! @SYMREQ ------- -//! @SYMTestPriority Critical -//! @SYMTestStatus Implemented -//! @SYMTestActions -//! • Generate a IPSec protected key stream description. -//! • Create a key stream sink from the protected key stream description. -//! • Create a key stream decoder from an SDP message requiring the reference agent -//! and the key stream sink. -//! • Create a short term key message and write it to a predefined socket. -//! @SYMTestExpectedResults -//! • Interfaces are invoked without leaves and panics. -//! -//! @SYMTestType CIT - -START_TESTCASE SEC-SCAF-H001 - -RUN_TEST_STEP 100 tscaf SCAFRefAgent z:\tcaf\tscaf\tscaf.ini reference_agent - -END_TESTCASE SEC-SCAF-H001 diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tipsec.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tipsec.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tipsec.cpp Thu May 27 14:32:46 2010 +0300 @@ -360,7 +360,6 @@ TVerdict CScafIpSecDecoderIntegration::doTestL() { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY TBool integrationTest(ETrue); GetBoolFromConfig(ConfigSection(), _L("IntegrationTest"), integrationTest); @@ -417,7 +416,6 @@ } CleanupStack::PopAndDestroy(2, keyStreamSink); CleanupStack::PopAndDestroy(); // sdpDoc -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamdecoderattributes.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamdecoderattributes.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamdecoderattributes.cpp Thu May 27 14:32:46 2010 +0300 @@ -55,7 +55,6 @@ TVerdict CScafKeyStreamDecoderAttributes::doTestL() { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY // Assume faliure, unless all is successful SetTestStepResult(EFail); @@ -106,7 +105,6 @@ } CleanupStack::PopAndDestroy(3, sdpDoc); //< decoder, protectStreamDesc, sdpDoc -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamdecoderconstruct.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamdecoderconstruct.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamdecoderconstruct.cpp Thu May 27 14:32:46 2010 +0300 @@ -40,7 +40,6 @@ TVerdict CScafKeyStreamDecoderConstruct::doTestL() { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY // Assume the test has failed if the test step result hasn't been otherwise set to EPass SetTestStepResult(EFail); @@ -87,6 +86,5 @@ // Delete the protected stream descriptor CleanupStack::PopAndDestroy(2, sdpDoc); //< protectStreamDesc, sdpDoc -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamsink.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamsink.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tkeystreamsink.cpp Thu May 27 14:32:46 2010 +0300 @@ -67,7 +67,6 @@ encryptedStr.Append(*ro->Key()); CleanupStack::PopAndDestroy(ro); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY //Create an SDP document object and set the created key stream field object CSdpDocument* sdpDoc = CreateSdpDocumentLC(); //Create an SDP key stream field object with an attribute requiring the service protected RO @@ -113,9 +112,6 @@ } CleanupStack::PopAndDestroy(4, sdpDoc); // fOutputKey, decoder, sink, sdpDoc -#endif - - return TestStepResult(); } @@ -175,7 +171,6 @@ CopyFile2AgentsPrivateFolderL(iParent.Fs(), KProgramProtectedRo(), privatePathA); CopyFile2AgentsPrivateFolderL(iParent.Fs(), KProgramProtectedRo(), privatePathB); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY //Create an SDP document object and set the created key stream field object for each decoder CSdpDocument* sdpDoc = CreateSdpDocumentLC(); @@ -284,6 +279,5 @@ CleanupStack::PopAndDestroy(2, sinkB); //< decoderB, sink B CleanupStack::PopAndDestroy(2, sinkA); //< decoderA, sinkA CleanupStack::PopAndDestroy(sdpDoc); //< sdpDoc -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tmultikeystreamdecoders.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tmultikeystreamdecoders.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tmultikeystreamdecoders.cpp Thu May 27 14:32:46 2010 +0300 @@ -54,7 +54,6 @@ TVerdict CScafMultiKeyStreamDecoders::doTestL() { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY // Assume the test has failed if the test step result hasn't been otherwise set to EPass SetTestStepResult(EFail); @@ -163,7 +162,6 @@ } CleanupStack::PopAndDestroy(5, sdpDoc); //< decoderB, decoderA, protectStreamDescB, protectStreamDescA, sdpDoc -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tpostacquisition.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tpostacquisition.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tpostacquisition.cpp Thu May 27 14:32:46 2010 +0300 @@ -57,7 +57,6 @@ TVerdict CScafPostAcquisition::doTestL() { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY TBool createOutputFile = EFalse; if(!GetBoolFromConfig(ConfigSection(), KCreateOutputFiles, createOutputFile)) @@ -176,7 +175,6 @@ SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(3, content); -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/treferenceagent.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/treferenceagent.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/treferenceagent.cpp Thu May 27 14:32:46 2010 +0300 @@ -22,9 +22,7 @@ using namespace StreamAccess; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY const TUint32 KTestSpiBase = 667; -#endif CScafRefAgent::CScafRefAgent(CScafServer& aParent): CScafIpSec(aParent) { @@ -34,7 +32,6 @@ TVerdict CScafRefAgent::doTestL() { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY SetTestStepResult(EPass); CleanAgentsPrivateFolderL(KSraPrivateFolder()); CopyFile2AgentsPrivateFolderL(iParent.Fs(), KProgramProtectedRo(), KSraPrivateFolder()); @@ -95,6 +92,5 @@ // Release the allocated memories CleanupStack::PopAndDestroy(5, protectedStreamDesc); CleanupStack::PopAndDestroy(); // sdpDoc -#endif return TestStepResult(); } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/cafstreamingsupport/test/tscaf/source/tscafstep.cpp --- a/contentmgmt/cafstreamingsupport/test/tscaf/source/tscafstep.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/cafstreamingsupport/test/tscaf/source/tscafstep.cpp Thu May 27 14:32:46 2010 +0300 @@ -16,10 +16,8 @@ // #include "tscafstep.h" -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -#include -#include -#endif +#include "sdpconnectionfield.h" +#include "sdporiginfield.h" TSdpAttribute::TSdpAttribute() { @@ -121,7 +119,6 @@ return TestStepResult(); } -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY // We need this dummy function because TCleanupItem c'tor (see below) does not accept functions without parameters void CloseSdpCodecPool(TAny *) { @@ -274,7 +271,6 @@ return sdp; } -#endif CKeyStreamSink* CScafStep::CreateKeyStreamSinkLC(const TDesC& aFileName, const TDesC& aPrivPath) /** @@ -316,12 +312,8 @@ @param aSdp The SDP object which will be deleted. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY delete reinterpret_cast(aSdpDoc); SdpCodecStringPool::Close(); -#else - (void) aSdpDoc; -#endif } void CScafStep::CopyFile2AgentsPrivateFolderL(RFs& aFs, const TDesC& aFileName, const TDesC& aPrivPath) @@ -356,7 +348,6 @@ CleanupStack::PopAndDestroy(2, fTarget); } -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY void CScafStep::AddAttributes2SdpL(CSdpMediaField& aSdp, TInt aSdpNum) /** * Add attributes from the instance within the CSdpConfiguration array, where @@ -404,7 +395,6 @@ CleanupStack::PopAndDestroy(3); }//for }//End of function -#endif void CScafStep::PrintErrorAndLeaveL(TDesC& aKey) /** diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/group/bld.inf --- a/contentmgmt/referencedrmagent/RefTestAgent/group/bld.inf Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/group/bld.inf Thu May 27 14:32:46 2010 +0300 @@ -48,6 +48,8 @@ sraserver.mmp sraplugin.mmp srautils.mmp +// Local SDP codec library. Made this local to avoid the dependency on middleware layer. +../localsdp/group/localsdpcodec.mmp #endif // TOOLS2 #endif // TOOLS diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/group/sraclient.mmp --- a/contentmgmt/referencedrmagent/RefTestAgent/group/sraclient.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/group/sraclient.mmp Thu May 27 14:32:46 2010 +0300 @@ -26,7 +26,10 @@ CAPABILITY All -Tcb USERINCLUDE ../streamingrefagent/inc -MW_LAYER_SYSTEMINCLUDE_SYMBIAN +USERINCLUDE ../localsdp/inc +USERINCLUDE ../localsdp/api + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../streamingrefagent/source/client SOURCE sraclient.cpp @@ -36,9 +39,7 @@ LIBRARY euser.lib LIBRARY estor.lib LIBRARY cafutils.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY streamingcaf.lib LIBRARY efsrv.lib SMPSAFE diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/group/sraplugin.mmp --- a/contentmgmt/referencedrmagent/RefTestAgent/group/sraplugin.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/group/sraplugin.mmp Thu May 27 14:32:46 2010 +0300 @@ -34,14 +34,14 @@ SOURCE srakeystreamdecoder.cpp USERINCLUDE ../streamingrefagent/inc +USERINCLUDE ../localsdp/inc +USERINCLUDE ../localsdp/api -MW_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY euser.lib LIBRARY streamingcaf.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY sraclient.lib srautils.lib START RESOURCE 10285A34.rss diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/group/sraserver.mmp --- a/contentmgmt/referencedrmagent/RefTestAgent/group/sraserver.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/group/sraserver.mmp Thu May 27 14:32:46 2010 +0300 @@ -24,9 +24,11 @@ CAPABILITY DRM NetworkControl NetworkServices -MW_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_SYSTEMINCLUDE_SYMBIAN USERINCLUDE ../streamingrefagent/inc +USERINCLUDE ../localsdp/inc +USERINCLUDE ../localsdp/api SOURCEPATH ../streamingrefagent/source/server SOURCE sraserver.cpp @@ -40,9 +42,7 @@ LIBRARY efsrv.lib LIBRARY cafutils.lib LIBRARY estor.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY bafl.lib LIBRARY streamingcaf.lib LIBRARY srautils.lib diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/group/srautils.mmp --- a/contentmgmt/referencedrmagent/RefTestAgent/group/srautils.mmp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/group/srautils.mmp Thu May 27 14:32:46 2010 +0300 @@ -28,8 +28,10 @@ CAPABILITY All -Tcb USERINCLUDE ../streamingrefagent/inc -MW_LAYER_SYSTEMINCLUDE_SYMBIAN -APP_LAYER_SYSTEMINCLUDE_SYMBIAN +USERINCLUDE ../localsdp/inc +USERINCLUDE ../localsdp/api + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN SOURCEPATH ../streamingrefagent/source/utils SOURCE srautils.cpp @@ -41,9 +43,7 @@ LIBRARY euser.lib LIBRARY estor.lib LIBRARY streamingcaf.lib -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -LIBRARY sdpcodec.lib -#endif +LIBRARY localsdpcodec.lib LIBRARY efsrv.lib LIBRARY bafl.lib SMPSAFE diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/inc/rta.iby --- a/contentmgmt/referencedrmagent/RefTestAgent/inc/rta.iby Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/inc/rta.iby Thu May 27 14:32:46 2010 +0300 @@ -33,6 +33,8 @@ file=ABI_DIR\BUILD_DIR\sraserver.exe System\Libs\sraserver.exe file=ABI_DIR\BUILD_DIR\sraclient.dll System\Libs\sraclient.dll file=ABI_DIR\BUILD_DIR\srautils.dll System\Libs\srautils.dll +// Local SDP codec library. Added to avoid the dependency on middleware layer. +file=ABI_DIR\BUILD_DIR\localsdpcodec.dll System\Libs\localsdpcodec.dll ECOM_PLUGIN(sraplugin.dll,sraplugin.rsc) #endif // __RTA_IBY__ diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/_sdpdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/_sdpdefs.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 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: +* Name : _sdpdefs.h +* Part of : Local SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + +#ifndef _SDPDEFS_H +#define _SDPDEFS_H + +#ifdef CPPUNIT_TEST +#undef EXPORT_C +#define EXPORT_C +#endif + +#ifdef CPPUNIT_TEST +#undef IMPORT_C +#define IMPORT_C +#endif + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpattributefield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpattributefield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,392 @@ +/* +* Copyright (c) 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: +* Name : SdpAttributeField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPATTRIBUTEFIELD_H +#define CSDPATTRIBUTEFIELD_H + +// INCLUDES +#include +#include +#include "sdpcodecstringconstants.h" +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; +class CSdpFmtAttributeField; +class CSdpAttributeFieldPtrs; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the attribute field of Session Description Protocol + * for media and session level attributes. Media format/payload type level + * attributes are supported by the CSdpFmtAttributeField class. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpAttributeField : public CBase + { + public: // Constructors and destructor + + /** + * Constructs a new attribute field. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpAttributeField* DecodeL( const TDesC8& aText ); + + /** + * Constructs a new attribute field and adds the pointer to the + * cleanup stack. + * + * @param aTest A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpAttributeField* DecodeLC( const TDesC8& aText ); + + /** + * Constructs a new attribute field. + * + * @param aAttribute The attribute name. It can be a pre- + * defined name in the SDP string pool or defined by the + * client. + * @param aValue A valid attribute value or an empty + * descriptor to omit the value part. + * @return a new instance. + */ + IMPORT_C static CSdpAttributeField* NewL( + RStringF aAttribute, const TDesC8& aValue ); + + /** + * Constructs a new attribute field and adds the pointer to the + * cleanup stack. + * + * @param aAttribute The attribute name. It can be a pre-defined + * name in the SDP string pool or defined by the client. + * @param aValue A valid attribute value or an empty + * descriptor to omit the value part. + * @return a new instance. + */ + IMPORT_C static CSdpAttributeField* NewLC( + RStringF aAttribute, const TDesC8& aValue ); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpAttributeField(); + + public: // New functions + + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream Stream used for output. On return the + * stream includes correctly formatted attribute field. + */ + IMPORT_C void EncodeL( RWriteStream& aStream ) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpAttributeField* CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param aObj: The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == ( const CSdpAttributeField& aObj ) const; + + /** + * Gets the attribute name. + * + * @return The attribute name. The name can be pre-defined + * name in the SDP string table or defined by the client. + */ + IMPORT_C RStringF Attribute() const; + + /** + * Gets the attribute. + * + * @return The value or an empty descriptor if there is no value part. + */ + IMPORT_C const TDesC8& Value() const; + + /** + * Sets the attribute and attribute value. + * + * @param aAttribute A valid attribute name. It can be a + * pre-defined name in the SDP string pool or + * defined by the client. + * @param aValue A valid attribute value or an empty + * descriptor to omit the value part. + * @leave KErrSdpCodecAttributeField if the attribute part is not + * pre-defined EAttributeFmtp or EAttributeRtpmap. + */ + IMPORT_C void SetL( RStringF aAttribute, const TDesC8& aValue ); + + /** + * Assigns attribute to the format level attribute. + * In the final output the attribute will placed after format level + * attribute. + * + * @param aFmtAttribute A format level + * attribute this attribute is assigned to. + */ + IMPORT_C void AssignTo(const CSdpFmtAttributeField& aFmtAttribute); + + /** + * Test if the attribute belongs to the given format level attribute. + * Note, that the check can be true for the media level paremeter if + * it appears after the last format level attribute. + * + * @param aFmtAttribute: A format level + * attribute this attribute belongs to. + * @return ETrue if attribute belongs to the format level attribute, + * EFalse otherwise. + */ + IMPORT_C TBool BelongsTo(const CSdpFmtAttributeField& aFmtAttribute) const; + + public: // Internal to codec + + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpAttributeField* InternalizeL( RReadStream& aStream ); + + /** + * Informs if the attribute belongs to any format level attribute. + * + * @return ETrue if attribute belongs to any format level + * attribute, EFalse otherwise. + */ + TBool IsFmtAttribute(); + + private: // Constructors + + /** + * Constructor + */ + CSdpAttributeField(); + + /** + * Second phase constructor + * + * @param aText Text string ending to LF character + */ + void ConstructL( const TDesC8& aText ); + + /** + * Second phase constructor + * + * @param aAttribute Attribute identifier + * @param aValue Value of the attribute of KNullDesC8 + */ + void ConstructL( RStringF aAttribute, const TDesC8& aValue ); + + private: // Internal + + /** + * Verifies that attribute is valid property attribute and initializes + * the member variables of class accordingly + * + * @param aAttribute Attribute in descriptor + */ + void FormatProperyAttributeL( const TDesC8& aAttribute ); + + /** + * Verifies that attribute is valid value attribute and initializes + * the member variables of class accordingly + * + * @param aArray Array of the attributes + */ + void FormatValueAttributeL( const TDesC8& aAttribute, + const TDesC8& aValue ); + + /** + * Verifies that the value is valid for the attribute + * + * @param aAttribute The attribute + * @param aArray Array containing the values (and attribute) + */ + void VerifyValueAttributeL( SdpCodecStringConstants::TStrings aString, + const TDesC8& aValue ); + + /** + * Forms attribute and value strings out of the token array + * and pushes both (aAttribute & aValue) into cleanup stack + * + * @param aArray Token array + * @param aAttribute Attribute string (in cleanup stack) + * @param aValue Value string (in cleanup stack) + */ + void CreateAttributeAndValueStringsLC( RArray& aArray, + HBufC8*& aAttribute, + HBufC8*& aValue ); + + /** + * Checks if the value is among the valid orient attributes + * + * @param aValue Value string + */ + void CheckValidOrientL( const TDesC8& aValue ); + + /** + * Checks if the value is valid language attribute as + * specified in RFC 3066 + * + * @param aValue Value string + */ + void CheckValidLangStrL( const TDesC8& aValue ); + + /** + * Checks if the value is valid framerate attribute + * + * @param aValue Value string + */ + void CheckValidFrameRateL( const TDesC8& aValue ); + + /** + * Checks if the value is among valid uri value for control attribute + * + * @param aValue Value string + */ + void CheckValidControlL( const TDesC8& aValue ); + + /** + * Checks if the value is valid value for group attribute as + * specified in RFC 3388 + * + * @param aValue Value string + */ + void CheckValidGroupL( const TDesC8& aValue ); + + /** + * Checks if the value is valid value for des attribute as + * specified in RFC 3312 + * + * @param aValue Value string + */ + void CheckValidDesL( const TDesC8& aValue ); + + /** + * Checks if the value is valid value for curr and conf attribute as + * specified in RFC 3312 + * + * @param aValue Value string + */ + void CheckValidCurrAndConfL( const TDesC8& aValue ); + + /** + * Checks if value is included in the list of predefined values + * + * @param aItemsCount Predefined values count + * @param aValuesList List of predefined values + * @param aValue Value string + */ + void ValidValueInListL( TInt aItemsCount, + const TText8* const aValuesList[], + const TDesC8& aValue ); + + /** + * Checks if the value is valid value for range attribute as + * specified in RFC 2326 + * + * @param aValue Value string + */ + void CheckValidRangeL( const TDesC8& aValue ); + + + /** + * Checks if the value is valid rtpmap string + * + * @param aValue Value string + */ + void CheckValidRtpmapL( const TDesC8& aValue ); + + /** + * Checks if the value is valid fmtp string + * + * @param aValue Value string + */ + void CheckValidFmtpL( const TDesC8& aValue ); + + /** + * Set attribute and values. Attribute is not one of predefined ones. + * + * @param aAttribute Attribute string (in cleanup stack) + * @param aValue Value string + */ + void SetNotPredefinedAttributeL( const TDesC8& aAttribute, + const TDesC8& aValue ); + + void CreateAttributeFieldPtrsL(); + + inline CSdpAttributeFieldPtrs& AttributeFieldPtrs(); + + inline const CSdpAttributeFieldPtrs& AttributeFieldPtrs() const; + + void __DbgTestInvariant() const; + + + private: // Data + + // String pool + RStringPool iPool; + + // Attribute name + RStringF iAttribute; + + // Flag indicating if the attribute is a property attribute + TBool iPropertyAttribute; + + // Value field + HBufC8* iValue; + }; + +#endif // CSDPATTRIBUTEFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpbandwidthfield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpbandwidthfield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 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: +* Name : SdpBandwidthField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPBANDWIDTHFIELD_H +#define CSDPBANDWIDTHFIELD_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the bandwidth field of + * the Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpBandwidthField : public CBase + { + public:// Constructors and destructor + /** + * Constructs a new bandwidth field. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpBandwidthField* DecodeL(const TDesC8& aText); + + /** + * Constructs a new bandwidth field and adds the pointer to the + * cleanup stack. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpBandwidthField* DecodeLC(const TDesC8& aText); + + /** + * Constructs a new bandwidth field. + * + * @param aModifier Bandwidth modifier. + * @param aValue Bandwidth value. + * @return a new instance. + */ + IMPORT_C static CSdpBandwidthField* NewL(RStringF aModifier, + TUint32 aValue); + + /** + * Constructs a new bandwidth field and adds the pointer to the + * cleanup stack. + * + * @param aModifier Bandwidth modifier. + * @param aValue Bandwidth value. + * @return a new instance. + */ + IMPORT_C static CSdpBandwidthField* NewLC(RStringF aModifier, + TUint32 aValue); + + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpBandwidthField(); + + public: // New functions + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream Stream used for output. On return + * the stream includes correctly formatted bandwidth field. + */ + IMPORT_C void EncodeL(RWriteStream& aStream) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpBandwidthField * CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == (const CSdpBandwidthField& aObj) const; + + /** + * Gets the bandwidth modifier. + * + * @return The modifier that can be pre-defined in the + * SDP string table or defined by the user. + */ + IMPORT_C RStringF Modifier() const; + + /** + * Sets the bandwidth modifier. + * + * @param aModifier A valid bandwidth modifier name. + */ + IMPORT_C void SetModifier(RStringF aModifier); + + /** + * Gets the bandwidth value. + * + * @return The value. + */ + IMPORT_C TUint32 Value() const; + + /** + * Sets the bandwidth value. + * + * @param aValue The Value. + */ + IMPORT_C void SetValue(TUint32 aValue); + + public: + /** + * Externalize the instance in a memory optimized format. + * + * @param aStream The stream used for externalization. + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** + * Create a new instance from value created with ExternalizeL(). + * + * @param aStream The stream used for internalization. + * @return The new instance. + */ + static CSdpBandwidthField* InternalizeL(RReadStream& aStream); + + private: + CSdpBandwidthField(); + void ConstructL(const TDesC8& aText); + void ConstructL(RStringF aModifier, TUint32 aValue); + void ConstructL(const TDesC8& aModifier, TUint32 aValue); + + /** + * Copies given modifier to iModifier. If aModifier is none of + * predefined ones, new modifier is added to stringPool. + * + * @param aModifier Given modifier + */ + void CopyModifierL(const TDesC8& aModifier); + + private: // Data + RStringF iModifier; + TUint32 iValue; + RStringPool iStringPool; + }; + +#endif // CSDPBANDWIDTHFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpcodecconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpcodecconstants.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecConstants.h +* Part of : SDPCodec +* Constants defination file +* Version : 1.0 +* +*/ + + + + +#ifndef __SDPCODECCONSTANTS_H__ +#define __SDPCODECCONSTANTS_H__ + +/** +* @file +* @publishedAll +* @released +*/ + + +// Delimiter constants +const TText8 KDotChar = '.'; +const TText8 KColonChar = ':'; +const TText8 KSPChar = ' '; +const TText8 KEqualChar = '='; +const TText8 KSlashChar = '/'; +const TText8 KHyphenChar = '-'; +const TText8 KLFChar = '\n'; +const TText8 KCRChar = '\r'; +const TText8 KEofChar = '\0'; + +_LIT8(KDotStr, "."); +_LIT8(KColonStr, ":"); +_LIT8(KSPStr, " "); +_LIT8(KEqualStr, "="); +_LIT8(KSlashStr, "/"); +_LIT8(KHyphenStr, "-"); +_LIT8(KCRLFStr, "\r\n"); +_LIT8(KLFStr, "\n"); +_LIT8(KCRStr, "\r"); +_LIT8(KEofStr, "\0"); +_LIT8(KValidFQDNChars, + "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-"); + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpcodecerr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpcodecerr.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecErr.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef SDPCODECERR_H +#define SDPCODECERR_H + +/** +* @file +* @publishedAll +* @released +*/ + +/** + * Base value for the SdpCode error code range + */ +const TInt KSdpCodecErrorBase = -17875; +/** + * Codec encoding errors for SDP fields + */ +const TInt KErrSdpCodecVersionField = KSdpCodecErrorBase; +const TInt KErrSdpCodecOriginField = KSdpCodecErrorBase - 1; +const TInt KErrSdpCodecSessionField = KSdpCodecErrorBase - 2; +const TInt KErrSdpCodecInfoField = KSdpCodecErrorBase - 3; +const TInt KErrSdpCodecUriField = KSdpCodecErrorBase - 4; +const TInt KErrSdpCodecEmailField = KSdpCodecErrorBase - 5; +const TInt KErrSdpCodecPhoneField = KSdpCodecErrorBase - 6; +const TInt KErrSdpCodecConnectionField = KSdpCodecErrorBase - 7; +const TInt KErrSdpCodecBandwidthField = KSdpCodecErrorBase - 8; +const TInt KErrSdpCodecTimeField = KSdpCodecErrorBase - 9; +const TInt KErrSdpCodecRepeatField = KSdpCodecErrorBase - 10; +const TInt KErrSdpCodecZoneField = KSdpCodecErrorBase - 11; +const TInt KErrSdpCodecKeyField = KSdpCodecErrorBase - 12; +const TInt KErrSdpCodecAttributeField = KSdpCodecErrorBase - 13; +const TInt KErrSdpCodecMediaField = KSdpCodecErrorBase - 14; +const TInt KErrSdpCodecMediaInfoField = KSdpCodecErrorBase - 15; +const TInt KErrSdpCodecMediaConnectionField = KSdpCodecErrorBase - 16; +const TInt KErrSdpCodecMediaBandwidthField = KSdpCodecErrorBase - 17; +const TInt KErrSdpCodecMediaKeyField = KSdpCodecErrorBase - 18; +const TInt KErrSdpCodecMediaAttributeField = KSdpCodecErrorBase - 19; +const TInt KErrSdpCodecTypedTime = KSdpCodecErrorBase - 20; + +const TInt KErrSdpCodecStringPool = KSdpCodecErrorBase - 21; +const TInt KErrSdpCodecDecode = KSdpCodecErrorBase - 22; + +#endif //SDPCODECERR_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpcodecstringpool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpcodecstringpool.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecStringPool.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef SDPCODECSTRINGPOOL_H +#define SDPCODECSTRINGPOOL_H + +// INCLUDES +#include +#include "_sdpdefs.h" +#include + +class CSdpCodecStringPool; + +// CLASS DECLARATION +/** +* @publishedAll +* @released +* +* This class defines string pool for Local SDP Codec. +* The client of Local SDP Codec must call OpenL() before +* invoking any function of Local SDP Codec classes. +* The client must close the string pool when finished using +* Local SDP Codec classes. +* +* Note: the client must not close the string pool while +* using Local SDP Codec classes. +* +* @lib localsdpcodec.lib +*/ +class SdpCodecStringPool + { +public: // Constructors and destructor + + /** + * Opens Local SDP Codec string pool. + * + * @leave KErrAlreadyExists if pool already exists in TLS. + */ + IMPORT_C static void OpenL(); + + /** + * Closes Local SDP Codec string pool. + * + */ + IMPORT_C static void Close(); + +public: + + /** + * Gets the string pool used by Local SDP Codec. + * + * @return RStringPool: A handle to a string pool + * @leave KErrSdpCodecStringPool if the pool is not opened. + * + */ + IMPORT_C static RStringPool StringPoolL(); + + /** + * Gets the string table used by Local SDP Codec. + * + * @return TStringTable&: The string pool table + * @leave KErrSdpCodecStringPool if the pool is not opened. + * + */ + IMPORT_C static const TStringTable& StringTableL(); + }; + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpconnectionfield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpconnectionfield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,445 @@ +/* +* Copyright (c) 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: +* Name : SdpConnectionField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPCONNECTIONFIELD_H +#define CSDPCONNECTIONFIELD_H + +// INCLUDES +#include +#include +#include +#include "_sdpdefs.h" + +// CONSTANTS +const TUint KDefaultNumOfAddress = 1; + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the connection information field of + * the Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpConnectionField : public CBase + { + public: // Constructors and destructor + + /** + * Constructs a new connection field. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpConnectionField* DecodeL( const TDesC8& aText ); + + /** + * Constructs a new connection field and adds the pointer to the + * cleanup stack. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpConnectionField* DecodeLC( const TDesC8& aText ); + + /** + * Constructs a new connection field. + * Also sets the network type to "IN" and address type to "IP4" or + * "IP6" depending on the address family of aAddress. + * + * @param aAddress IP address from either KAfInet + * or KAfInet6 family + * @param aTTL Time-To-Live for IP4 multicasts, set it as + * KErrNotFound if IPv6 multicast or IPv4 unicast + * @param aNumOfAddress Number of addresses in multicast, + * if unicast, must be 1 + * @return a new instance. + */ + IMPORT_C static CSdpConnectionField* NewL( + const TInetAddr& aAddress, + TInt aTTL = KErrNotFound, + TUint aNumOfAddress = KDefaultNumOfAddress ); + + /** + * Constructs a new connection field. + * + * @param aNetType A valid network type name from the pre- + * defined SDP string table or defined by the user. + * @paramaAddressType A valid address type name from the + * pre-defined SDP string table or defined by the user. + * @param const TDesC8& aAddress: A valid address of the address type. + * Can contain TTL & number of addresses parameter as well. + * @return a new instance. + */ + IMPORT_C static CSdpConnectionField* NewL( + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ); + + /** + * Constructs a new connection field and adds the pointer to the + * cleanup stack. Also sets the network type to "IN" and address type + * to "IP4" or "IP6" depending on the address family of aAddress. + * + * @param aAddress IP address from either KAfInet + * or KAfInet6 family + * @param aTTL Time-To-Live for IP4 multicasts, set it as + * KErrNotFound if IPv6 multicast or IPv4 unicast + * @param aNumOfAddress Number of addresses in multicast, + * if unicast, must be 1 + * @return a new instance. + */ + IMPORT_C static CSdpConnectionField* NewLC( + const TInetAddr& aAddress, + TInt aTTL = KErrNotFound, + TUint aNumOfAddress = KDefaultNumOfAddress ); + + /** + * Construct a new connection field and adds the pointer to the + * cleanup stack. + * + * @param aNetType A valid network type name from the pre- + * defined SDP string table or defined by the user + * @paramaAddressType A valid address type name from the + * pre-defined SDP string table or defined by the user + * @param const TDesC8& aAddress: A valid address of the address type. + * Can contain TTL & number of addresses parameter as well. + * @return a new instance. + */ + IMPORT_C static CSdpConnectionField* NewLC( + RStringF aNetType, RStringF aAddressType, const TDesC8& aAddress ); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpConnectionField(); + + public: // New functions + + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream: Stream used for output. On return the + * stream includes correctly formatted connection field. + */ + IMPORT_C void EncodeL( RWriteStream& aStream ) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpConnectionField* CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param const CSdpConnectionField& aObj: The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator== ( const CSdpConnectionField& aObj ) const; + + /** + * Gets the network type that is from the pre-defined SDP string table + * or given by the user. + * + * @return The network type. + */ + IMPORT_C RStringF NetType() const; + + /** + * Gets the address type that is from the pre-defined SDP string table + * or given by the user. + * + * @return The address type. + */ + IMPORT_C RStringF AddressType() const; + + /** + * Gets the address. + * + * @return Address as an IP address or null if it is + * not an IP address. This may be e.g. when the address + * has been specified as a FQDN. In this case, the address + * can be accessed using the other getters. + */ + IMPORT_C const TInetAddr* InetAddress() const; + + /** + * Gets the address. + * + * @return Address as a string. + */ + IMPORT_C const TDesC8& Address() const; + + /** + * Sets the address, network and address type. Also sets the network + * type to "IN" and address type to "IP4" or "IP6" depending on the + * address family of aAddress. + * + * @param aValue The new address. + * @param aTTL Time-To-Live for IP4 multicasts, set it as + * KErrNotFound if IPv6 multicast or IPv4 unicast + * @param aNumOfAddress Number of addresses in multicast, + * if unicast, must be 1. + * @leave KErrSdpCodecConnectionField ifaddress to be set is wrongly + * formatted. + */ + IMPORT_C void SetInetAddressL( const TInetAddr& aValue, + TInt aTTL = KErrNotFound, + TUint aNumOfAddress = KDefaultNumOfAddress); + + /** + * Sets the address, network and address type. + * + * @param aNetType A valid network type name from the pre- + * defined SDP string table or defined by the user + * @param aAddressType A valid address type name from the + * pre-defined SDP string table or defined by the user + * @param aAddress A valid address of the address type. + */ + IMPORT_C void SetAddressL( RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ); + + /** + * Gets TTL attribute. + * + * @return TTL or KErrNotFound, if one is not available for the address + */ + IMPORT_C TInt TTLValue() const; + + /** + * Sets TTL attribute (only valid for IP4 multicasts). + * Leaves if trying to set TTL to address that doesn't support it. + * + * @param aTTL Time-To-Live for IP4 multicasts + * @leave KErrSdpCodecConnectionField if aTTL is invalid. + */ + IMPORT_C void SetTTLL( TInt aTTL ); + + /** + * Gets the number of addresses (can be more than 1 for multicasts). + * Multicast addresses are contiguously allocated above the base + * address. + * + * @return Number of addresses + */ + IMPORT_C TInt NumOfAddress() const; + + /** + * Sets the number of addreses allocated for multicast. + * + * @param aNumOfAddress Number of addresses in multicast + * @leave KErrSdpCodecConnectionField if the address is unicast. + */ + IMPORT_C void SetNumOfAddressL( TUint aNumOfAddress ); + + public: // Internal to codec + + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpConnectionField* InternalizeL( RReadStream& aStream ); + + private: // Internal + + /** + * Constructor + */ + CSdpConnectionField(); + + /** + * 2nd phase constructor + * + * @param aText A string containing a correctly formatted field value + * terminated by a CRLF. + */ + void ConstructL( const TDesC8& aText ); + + /** + * 2nd phase constructor + * + * @param aAddress IP address from either KAfInet or KAfInet6 family + * @param aTTL Time-To-Live for IP4 multicasts + * @param aNumOfAddress Nubmer of addresses in multicast + */ + void ConstructL( const TInetAddr& aAddress, + TInt aTTL, TUint aNumOfAddress ); + + /** + * 2nd phase constructor + * + * @param aNetType A valid network type name from the pre-defined + * SDP string table or defined by the user + * @param aAddressType A valid address type name from the pre-defined + * SDP string table or defined by the user + * @param aAddress A valid address of the address type + */ + void ConstructL( RStringF aNetType, RStringF aAddressType, + const TDesC8& aAddress ); + + /** + * Checks if the address is valid against given arguments + * + * @param aAddressTypeIP4 The given type of address (EFalse = IP6) + * @param aAddress Address with possibly TTL & number of addresses + * @return error code (KErrNone if valid) + */ + TInt IsValidAddress( TBool aAddressTypeIP4, + const TDesC8& aAddress ) const; + + /** + * Checks if the address is valid against given arguments + * + * @param aAddress Address in TInetAddr format + * @param aTTL TTL attribute + * @param aNumOfAddress Number off addresses + * @return error code (KErrNone if valid) + */ + TInt IsValidAddress( const TInetAddr& aAddress, + TInt aTTL, TUint aNumOfAddress ) const; + + /** + * Parses address field + * + * @param aAddressTypeIP4 The given type of address (EFalse = IP6) + * @param aAddress Address with possibly TTL & number of addresses + * @param aTTL TTL value is stored here (or KErrNotFound) + * @param aNumberOfAddresses Range of addreses + * @return The address + */ + HBufC8* ParseAddressFieldL( TBool aAddressTypeIP4, + const TDesC8& aAddress, + TInt& aTTL, + TUint& aNumberOfAddresses ) const; + + /** + * Parses IP4 address + * + * @param aPos Position of the (first) separation mark + * @param aTTL TTL value is stored here (or KErrNotFound) + * @param aAddr Addres in TInetAddr format + * @param aAddress The whole address field + * @param aNumberOfAddresses Range of addreses + * @return The address + */ + HBufC8* ParseIP4AddressL( TInt aPos, + TInetAddr& aAddr, + const TDesC8& aAddress, + TInt& aTTL, + TUint& aNumberOfAddresses ) const; + + /** + * Parses IP6 address + * + * @param aPos Position of the (first) separation mark + * @param aTTL TTL value is stored here (or KErrNotFound) + * @param aAddr Addres in TInetAddr format + * @param aAddress The whole address field + * @param aNumberOfAddresses Range of addreses + * @return The address + */ + HBufC8* ParseIP6AddressL( TInt aPos, + TInetAddr& aAddr, + const TDesC8& aAddress, + TInt& aTTL, + TUint& aNumberOfAddresses ) const; + + /** + * Copies given network type to iNetType and verifies aNetType to + * be valid + * + * @param aNetType Given network type + */ + void CopyNetTypeL( const TDesC8& aNetType ); + + /** + * Copies given address type to iAddressType and verifies aAddrType + * to be valid + * + * @param aAddrType Given address type + */ + void CopyAddressTypeL( const TDesC8& aAddrType ); + + /** + * Copies address to iAddress, and initalizes TTL & number of addresses, + * leaves on error + * + * @param aAddress Address string, which can also contain TTL + * and number of addresses attributes + */ + void CopyAddressL( const TDesC8& aAddress, RStringPool aPool ); + + private: // Data + + // + RStringF iNetType; + + //
+ RStringF iAddressType; + + // mutable TInetAddr for InetAddress() + mutable TInetAddr iInetAddress; + + // Address in text format + HBufC8* iAddress; + + // TTL for IP4 multicast addresses + TInt iTTL; + // Number of addresses + TUint iNumOfAddress; + + // String pool + RStringPool iPool; + + void __DbgTestInvariant() const; + + + }; + +#endif // CSDPCONNECTIONFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpdocument.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,446 @@ +/* +* Copyright (c) 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: +* Name : SdpDocument.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPDOCUMENT_H +#define CSDPDOCUMENT_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" +#include + +// FORWARD DECLARATIONS +class SdpUtil; +class RReadStream; +class RWriteStream; +class CUri8; +class CDesC8Array; +class CSdpOriginField; +class CSdpEmailField; +class CSdpPhoneField; +class CSdpConnectionField; +class CSdpBandwidthField; +class CSdpTimeField; +class CSdpAttributeField; +class CSdpMediaField; +class CSdpKeyField; +class CSdpCodecParseUtil; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the Session Description Protocol (SDP) document. + * The SDP document is a collection of SDP fields and related values + * describing a session. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpDocument : public CBase + { + public: // Constructors and destructor + /** + * Constructs a new SDP document. + * + * @param aText A string containing a correctly formatted SDP document. + * @return a new instance. + */ + IMPORT_C static CSdpDocument* DecodeL(const TDesC8& aText); + + /** + * Constructs a new SDP document and adds the pointer to the cleanup stack. + * + * @param aText A string containing a correctly formatted SDP document. + * @return a new instance. + */ + IMPORT_C static CSdpDocument* DecodeLC(const TDesC8& aText); + + /** + * Constructs a new, empty SDP document. + * The instance will have the following initial values: + * v=0 + * s=- + * t=0 0 + * + * @return a new instance. + */ + IMPORT_C static CSdpDocument* NewL(); + + /** + * Constructs a new, empty SDP document document and adds the pointer to + * the cleanup stack. + * The instance will have the following initial values: + * v=0 + * s=- + * t=0 0 + * + * @return a new instance. + */ + IMPORT_C static CSdpDocument* NewLC(); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpDocument(); + + public: + /** + * Externalizes the object state in an internal, memory optimized format. + * + * @param aStream The output stream. + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalizes the object state from an internal, memory optimized format. + * + * @param aStream The input stream. + * @return A new SDP document internalized from the input stream. + */ + IMPORT_C static CSdpDocument* InternalizeL(RReadStream& aStream); + + /** + * Outputs the SDP document formatted according to SDP syntax. + * It is possible to output the document even though it is + * incomplete in the sense that all mandatory SDP fields are + * not present.When creating an SDP document to be used e.g. + * as part of SIP signalling, caller should first ensure the + * validity of the document using the IsValid() function. + * + * @param aStream Stream used for output. On return the + * stream includes correctly formatted SDP description. + */ + IMPORT_C void EncodeL(RWriteStream& aStream) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpDocument* CloneL() const; + + /** + * Checks if the instance represents a valid SDP document. + * + * @return ETrue if SDP document is valid and EFalse if not. + */ + IMPORT_C TBool IsValid() const; + + /** + * Gets the SDP version used in the version field. + * Note, that the current implementation supports only version number 0. + * + * @return The SDP version number. + */ + IMPORT_C TUint SdpVersion() const; + + /** + * Gets a reference to the session origin field. + * Note, that the ownership is not transferred and + * the instance must not be deleted by the caller. + * + * @return The origin field or zero if not present. + */ + IMPORT_C CSdpOriginField* OriginField(); + + /** + * Gets a reference to the session origin field. + * + * @return The origin field or zero if not present. + */ + IMPORT_C const CSdpOriginField* OriginField() const; + + /** + * Sets or removes the session origin field. + * Note, that the ownership of the argument is + * transferred to the SDP document object. + * + * @param aObj New origin field or null to remove the field. + */ + IMPORT_C void SetOriginField(CSdpOriginField* aObj); + + /** + * Gets the session name field value. + * + * @return The session name or empty descriptor if not present. + */ + IMPORT_C const TDesC8& SessionName() const; + + /** + * Sets the session name field value. + * + * @param aValue Valid session name value. + * Note that an empty value is not accepted. + * @leave KErrSdpCodecSessionField if + * aValue is not empty or aValue includes invalid byte strings + * (´\0´, ´\n´, ´\r´). + */ + IMPORT_C void SetSessionNameL(const TDesC8& aValue); + + /** + * Gets the session information field value. + * + * @return Info field value or an empty descriptor if not present. + */ + IMPORT_C const TDesC8& Info() const; + + /** + * Sets or removes the session information field value. + * + * @param New field value or an empty descriptor to remove the field. + * @leave KErrSdpCodecInfoField if aValue is not empty or aValue includes + * invalid byte strings (´\0´, ´\n´, ´\r´). + */ + IMPORT_C void SetInfoL(const TDesC8& aValue); + + /** + * Gets the session URI field value. + * Note, that the ownership is not transferred and + * the instance must not be deleted by the caller. + * + * @return CUri8*: Session URI or zero if the field is not present. + */ + IMPORT_C CUri8* Uri(); + + /** + * Gets the session URI field value. + * + * @return Session URI or zero if the field is not present. + */ + IMPORT_C const CUri8* Uri() const; + + /** + * Sets or removes the session level URI field. + * Note, that the ownership of the argument is + * transferred to the SDP document object. + * + * @param New value of the field or zero to remove the field. + */ + IMPORT_C void SetUri(CUri8* aValue); + + /** + * Gets the set of session level email field values. This array is used to + * add and remove fields into the document. + * Note, that only correctly formatted email field values should be placed + * into the array. Empty values in the array will be ignored. + * + * @return Email fields in array or empty array if no email fields. + */ + IMPORT_C CDesC8Array& EmailFields(); + + /** + * Gets the set of session level phone field values. This array is used to + * add and remove fields into the document. + * Note, that only correctly formatted phone field values should be placed + * into the array. Empty values in the array will be ignored. + * + * @return Phone fields in array or empty array if no phone fields. + */ + IMPORT_C CDesC8Array& PhoneFields(); + + /** + * Gets the session level connection field. + * Note, that the ownership is not transferred and the instance must not be + * deleted by the caller. + * + * @return Connection field or zero if not present. + */ + IMPORT_C CSdpConnectionField* ConnectionField(); + + /** + * Gets the session level connection field. + * + * @return Connection field or zero if not present. + */ + IMPORT_C const CSdpConnectionField* ConnectionField() const; + + /** + * Sets or removes the session level connection field. + * Note, that the ownership of the argument is + * transferred to the SDP document object. + * + * @param New connection field or zero to remove the field. + */ + IMPORT_C void SetConnectionField(CSdpConnectionField* aObj); + + /** + * Gets the possibly empty set of session level bandwidth fields. + * This array is used directly for element insertion and removal. + * The array may contain zero references and these are ignored. + * + * The objects referenced from the array are owned by the document + * instance and must not be deleted. An object can be removed from + * the document by setting the corresponding element to zero. By + * doing so, the calling party receives ownership of the removed object. + * + * @return Set of bandwidth fields. + */ + IMPORT_C RPointerArray& BandwidthFields(); + + /** + * Gets the set of session level time description fields. + * This array is used directly for element insertion and removal. + * There must be at least one time description field in a valid SDP + * document.The array may contain zero references and these are ignored. + * + * The objects referenced from the array are owned by the document + * instance and must not be deleted. An object can be removed from the + * document by setting the corresponding element to zero. By doing so, + * the calling party receives ownership of the removed object. + * + * @return Set of time fields. + */ + IMPORT_C RPointerArray& TimeFields(); + + /** + * Gets the zone adjustments field value. + * + * @return The field value or an empty descriptor if the + * field is not present. + */ + IMPORT_C const TDesC8& ZoneAdjustments() const; + + /** + * Sets the zone adjustments field value. + * + * @param aValue A valid field value or an empty descriptor + * if field is not present. + */ + IMPORT_C void SetZoneAdjustmentsL(const TDesC8& aValue); + + /** + * Gets the session level encryption key field. + * Note, that the ownership is not transferred and + * the instance must not be deleted by the caller. + * + * @return The encryption key or zero if not present. + */ + IMPORT_C CSdpKeyField* Key(); + + /** + * Gets the session level encryption key field. + * + * @return The encryption key or zero if not present. + */ + IMPORT_C const CSdpKeyField* Key() const; + + /** + * Sets or removes the encryption key field. + * Note, that the ownership of the argument is + * transferred to the SDP document object. + * + * @param aObj New value of the field or zero to remove the field. + */ + IMPORT_C void SetKey(CSdpKeyField* aObj); + + /** + * Gets the possibly empty set of session level attribute fields. + * This array is used directly for element insertion and removal. + * The array may contain zero references and these are ignored. + * + * The objects referenced from the array are owned by the document + * instance and must not be deleted. An object can be removed from the + * document by setting the corresponding element to zero. By doing so, + * the calling party receives ownership of the removed object. + * + * @return Set of session level attributes. + */ + IMPORT_C RPointerArray& AttributeFields(); + + /** + * Gets the possibly empty set of media description fields. + * This array is used directly for element insertion and removal. + * Note, that media level attributes and fields are managed + * through the corresponding media field instance and not through + * the document instance. + * The array may contain zero references and these are ignored. + * + * The objects referenced from the array are owned by the document + * instance and must not be deleted. An object can be removed from the + * document by setting the corresponding element to zero. By doing so, + * the calling party receives ownership of the removed object. + * + * @return Set of media description fields. + */ + IMPORT_C RPointerArray& MediaFields(); + + private: + CSdpDocument(); + void ConstructL(); + void ConstructL(const CSdpDocument& aSdpDocument); + void DoInternalizeL(RReadStream& aStream); + + void ParseL (const TDesC8& aText); + void ParseSessionVersionL(); + void ParseSessionOwnerL(); + void ParseSessionNameL(); + void ParseSessionInformationL(); + void ParseUriL(); + void ParseEmailL(); + void ParsePhoneL(); + void ParseConnectionL(); + void ParseBandwidthL(); + void ParseTimeFieldL(); + void ParseZoneAdjustmentL(); + void ParseEncryptionKeyL(); + void ParseAttributeFieldL(); + void ParseMediaLevelL (); + void ExternalizeDesCArrayL(CDesC8ArraySeg& aArray, + RWriteStream& aStream) const; + void EncodeDesCArrayL(CDesC8ArraySeg& aArray,TInt aIndex, + RWriteStream& aStream) const; + + TDesC8& GetTokenFromStreamL(RReadStream& aStream); + + CSdpDocument(const CSdpDocument&); // Hidden. + CSdpDocument& operator = (const CSdpDocument&); // Hidden + + private: // Data + + HBufC8* iInfo; + HBufC8* iSessionName; + HBufC8* iZoneAdjustments; + CSdpKeyField* iSdpKeyField; + CSdpOriginField* iSdpOriginField; + CSdpConnectionField* iSdpConnectionField; + TUint iSdpVersion; + RPointerArray* iTimeFields; + RPointerArray* iBandwidthFields; + RPointerArray* iAttributeFields; + RPointerArray* iMediaFields; + CUri8* iUri; + CDesC8ArraySeg* iEmailFields; + CDesC8ArraySeg* iPhoneFields; + RStringPool iPool; + HBufC8* iToken; + CSdpCodecParseUtil* iSdpCodecParseUtil; + }; + +#endif // CSDPDOCUMENT_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpfmtattributefield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpfmtattributefield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 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: +* Name : SdpFmtAttributeField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPFMTATTRIBUTEFIELD_H +#define CSDPFMTATTRIBUTEFIELD_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; +class CSdpAttributeField; +class TSdpRtpmapValue; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the attribute field of the Session Description + * Protocol for media format/payload type level attributes. Media and session + * level attributes are supported by the CSdpAttributeField class. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpFmtAttributeField : public CBase + { + public: // Constructors and destructor + /** + * Constructs a new media format level attribute field. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpFmtAttributeField* DecodeL( const TDesC8& aText ); + + /** + * Constructs a new media format level attribute field and adds the + * pointer to the cleanup stack. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpFmtAttributeField* DecodeLC( const TDesC8& aText); + + /** + * Constructs a new media level format attribute field. + * + * @param aAttribute The attribute name. It can be a pre-defined + * name in the SDP string pool or defined by the client. + * @param aFormat A valid format/payload identifier + * used in the format list of the media description. + * @param aValue A valid attribute value or an empty + * descriptor to omit the value part. + * @return a new instance. + */ + IMPORT_C static CSdpFmtAttributeField* NewL( + RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue ); + + /** + * Constructs a new media format level attribute field and adds the + * pointer to the cleanup stack. + * + * @param aAttribute The attribute name. It can be a pre-defined + * name in the SDP string pool or defined by the client. + * @param aFormat A valid format/payload identifier + * used in the format list of the media description. + * @param aValue A valid attribute value or an empty + * descriptor to omit the value part. + * @return a new instance. + */ + IMPORT_C static CSdpFmtAttributeField* NewLC( + RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue ); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpFmtAttributeField(); + + public: // New functions + + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream Stream used for output. On return + * the stream includes correctly formatted attribute field. + */ + IMPORT_C void EncodeL( RWriteStream& aStream ) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpFmtAttributeField * CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator== ( const CSdpFmtAttributeField& aObj ) const; + + /** + * Gets the attribute. + * + * @return The attribute name. The name can be pre-defined + * name in the SDP string table or defined by the client. + */ + IMPORT_C RStringF Attribute() const; + + /** + * Gets the format. + * + * @return The format. + */ + IMPORT_C const TDesC8& Format() const; + + /** + * Gets the attribute value. + * + * @return The value or an empty descriptor if there is no value part. + */ + IMPORT_C const TDesC8& Value() const; + + /** + * Sets the attribute, format/payload type and attribute value. + * + * @param aAttribute A valid attribute name. It can be a + * pre-defined name in the SDP string pool or defined by + * the client. + * @param aFormat A valid format/payload identifier + * used in the formatlist of the media description. + * @param aValue A valid attribute value or an empty + * descriptor to omit the value part. + * @leave KErrSdpCodecMediaAttributeField if aAttribute is not rtpmap + * or fmtp attribute. + */ + IMPORT_C void SetL( + RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue ); + + public: // Internal to codec + + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpFmtAttributeField* InternalizeL( RReadStream& aStream ); + + /** + * Returns attribute field + * + * @return Attribute field + */ + const CSdpAttributeField* AttributeField() const; + + private: // New methods + + /** + * Creates object from the stream data. + * Does the "2nd phase construction" of internalization. + * + * @param aStream Stream where the object's state will be read + */ + void DoInternalizeL( RReadStream& aStream ); + + /** + * Formats value parameters + * + * @param aField Attribute field object + */ + void FormatValueParamsL( CSdpAttributeField* aField ); + + private: // Construction and destruction + + /** + * Constructor + */ + CSdpFmtAttributeField(); + + /** + * Second phase construction + * + * @param aText A string containing a correctly formatted field value + * terminated by a CRLF. + */ + void ConstructL( const TDesC8& aText ); + + /** + * Second phase construction + * + * @param aAttribute The attribute from the pre-defined SDP string + * table or defined by the user + * @param aFormat A valid format/payload identifier used in the format + * list of the media description. + * @param aValue A valid attribute value or an empty descriptor + * to omit the value part. + */ + void ConstructL( + RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue ); + + + /** + * Decode format parameter from string + * + * @param aText A text includeing format parameter. + */ + void DecodeFormatL(const TDesC8& aText); + + void __DbgTestInvariant() const; + + + private: + + RStringPool iPool; + CSdpAttributeField* iAttributeField; + /** Pointer to the format part*/ + TPtrC8 iFormat; + /** Pointer to the format parameters*/ + TPtrC8 iValuePart; + }; + +#endif // CSDPFMTATTRIBUTEFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpkeyfield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpkeyfield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 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: +* Name : SdpKeyField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPKEYFIELD_H +#define CSDPKEYFIELD_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the encryption key field of + * the Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpKeyField : public CBase + { + public: // Constructors and destructor + /** + * Constructs a new encryption key field. + * + * @param aFieldValue A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpKeyField* DecodeL(const TDesC8& aFieldValue); + + /** + * Constructs a new encryption key field and adds the pointer to + * the cleanup stack. + * + * @param aFieldValue A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + * @leave In error case function leaves. + */ + IMPORT_C static CSdpKeyField* DecodeLC(const TDesC8& aFieldValue); + + /** + * Constructs a new encryption key field. + * + * @param aMethod Encryption method from the pre-defined + * SDP string table. User defined values are not accepted. + * @param aEncryptionKey A valid encryption key value + * or an empty descriptor to omit the key part. + * @return a new instance. + */ + IMPORT_C static CSdpKeyField* NewL(RStringF aMethod, + const TDesC8& aEncryptionKey); + + /** + * Constructs a new encryption key field and adds the pointer to + * the cleanup stack. + * + * @param aMethod Encryption method from the pre-defined + * SDP string table. User defined values are not accepted. + * @param aEncryptionKey A valid encryption key value + * or an empty descriptor to omit the key part. + * @return a new instance. + */ + IMPORT_C static CSdpKeyField* NewLC(RStringF aMethod, + const TDesC8& aEncryptionKey); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpKeyField(); + + public: // New functions + /** + * Writes the instance as a complete SDP field encoded as UTF-8 + * and formatted as defined in draft-ietf-mmusic-sdp-new-14. + * + * @param aStream Stream used for output. On return + * the stream includes correctly formatted key field. + */ + IMPORT_C void EncodeL(RWriteStream& aStream) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpKeyField * CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == (const CSdpKeyField& aObj) const; + + /** + * Gets the encryption method. + * + * @return The method. + */ + IMPORT_C RStringF Method() const; + + /** + * Gets the encryption key. + * + * @return The key or an empty descriptor if there is no key part. + */ + IMPORT_C const TDesC8& EncryptionKey() const; + + /** + * Sets the encryption method and key. + * + * @param aMethod Encryption method from the pre-defined + * SDP string table. User defined values are not accepted. + * @param aEncryptionKey A valid encryption key value + * or an empty descriptor to omit the key part. + */ + IMPORT_C void SetL(RStringF aMethod, + const TDesC8& aEncryptionKey); + + public: + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpKeyField* InternalizeL(RReadStream& aStream); + + private: + CSdpKeyField(); + void ConstructL(const TDesC8& aText); + void ConstructL(RStringF aMethod, const TDesC8& aEncryptionKey); + void DoInternalizeL(RReadStream& aStream); + void SetMethodAndKeyL(RStringF aMethod, + const TDesC8& aEncryptionKey, + TBool aAllowEmptyKeyValue); + void SetMethodClearAndKeyL(RStringF aMethod, const TDesC8& aEncryptionKey); + void SetMethodBase64AndKeyL(RStringF aMethod, const TDesC8& aText); + void SetMethodUriAndKeyL(RStringF aMethod, const TDesC8& aText); + void SetMethodPromptL(RStringF aMethod, const TDesC8& aText); + RArray GetElementsFromLineL( TLex8& aLexer); + + private: // Data + RStringF iMethod; + TBool iMethodOpen; + HBufC8* iEncryptionKey; + RStringPool iStringPool; + + void __DbgTestInvariant() const; + + }; + +#endif // CSDPKEYFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpmediafield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdpmediafield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,445 @@ +/* +* Copyright (c) 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: +* Name : SdpMediaField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPMEDIAFIELD_H +#define CSDPMEDIAFIELD_H + +// INCLUDES +#include +#include "_sdpdefs.h" +#include + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; +class CSdpConnectionField; +class CSdpBandwidthField; +class CSdpAttributeField; +class CSdpKeyField; +class CSdpFmtAttributeField; +class CSdpCodecParseUtil; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the media description field and related media + * specific subfields of the Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpMediaField : public CBase + { + + public: + + + public: // Constructors and destructor + /** + * Constructs a new media description field. + * + * @param aText A correctly formatted media field + * terminated by a CRLF followed by zero or more media + * attribute fields separated by a CRLF. + * @param aRecurse If ETrue, attempts to construct also media + * attributes following the CRLF terminating the media field. + * @return a new instance. + */ + IMPORT_C static CSdpMediaField* DecodeL(const TDesC8& aText, + TBool aRecurse = ETrue); + + /** + * Constructs a new media description field and adds the pointer to + * the cleanup stack. + * + * @param aText A correctly formatted media field + * terminated by a CRLF followed by zero or more media + * attribute fields separated by a CRLF. + * @param aRecurse If ETrue, attempts to construct also media + * attributes following the CRLF terminating the media field. + * @return a new instance. + */ + IMPORT_C static CSdpMediaField* DecodeLC(const TDesC8& aText, + TBool aRecurse = ETrue); + + /** + * Constructs a new media description field. + * The optional portcount component of the field is initialized to 1. + * + * @param aMedia A valid media type name. + * @param aPort Port number. + * @param aProtocol A valid media protocol name. + * @param aFormatList A valid format list. + * @return a new instance. + */ + IMPORT_C static CSdpMediaField* NewL(RStringF aMedia, + TUint aPort, + RStringF aProtocol, + const TDesC8& aFormatList); + + /** + * Constructs a new media description field and adds the pointer to + * the cleanup stack. + * The optional portcount component of the field is initialized to 1. + * + * @param aMedia A valid media type name. + * @param aPort Port number. + * @param aProtocol A valid media protocol name. + * @param aFormatList A valid format list. + * @return a new instance. + */ + IMPORT_C static CSdpMediaField* NewLC(RStringF aMedia, + TUint aPort, + RStringF aProtocol, + const TDesC8& aFormatList); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpMediaField(); + + public: // New functions + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. Optionally output also the related media + * level fields. + * + * @param aStream Stream used for output. On return the + * stream includes correctly formatted media field with + * media part fields if aRecurse is defined to ETrue. + * @param aRecurse Flag to specify whether to output media + * attributes also (ETrue) or only the media field (EFalse). + */ + IMPORT_C void + EncodeL(RWriteStream& aStream, TBool aRecurse = ETrue) const; + + /** + * Creates a new instance that is equal to the target. + * Optionally also related subfields are cloned. + * + * @param aRecurse Flag to specify whether to clone subfields + * also (ETrue) or only the media field (EFalse). + * @return a new instance. + */ + IMPORT_C CSdpMediaField * CloneL(TBool aRecurse = ETrue) const; + + /** + * Compares this instance to another for equality. Subfields are + * included in the comparison if present. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == (const CSdpMediaField& aObj) const; + + /** + * Checks the consistency between the media field and it's subfields. + * In particular, this function checks that each format specific + * attribute is related to a format in the format list of the + * media field. + * + * @return ETrue if media description is consistent and EFalse if not. + */ + IMPORT_C TBool IsValid() const; + + /** + * Gets the media type. + * + * @return The media type. + */ + IMPORT_C RStringF Media() const; + + /** + * Sets the media type. + * + * @param aMedia The media type. + * @leave KErrSdpCodecMediaField if aMedia is not valid character + */ + IMPORT_C void SetMediaL(RStringF aMedia); + + /** + * Gets the media protocol. + * + * @return The media protocol. + */ + IMPORT_C RStringF Protocol() const; + + /** + * Sets the media protocol. + * + * @param aProtocol The media protocol. + * @leave KErrSdpCodecMediaField if + * aProtocol containing two elements divided by slash are not + * valid tokens. + */ + IMPORT_C void SetProtocolL(RStringF aProtocol); + + /** + * Gets the port number. + * + * @return The port number. + */ + IMPORT_C TUint Port() const; + + /** + * Sets the port number. + * + * @param aPort The port number. + * @leave KErrSdpCodecMediaField if port is not valid number as + * defined in draft-ietf-mmusic-sdp-new-14 + */ + IMPORT_C void SetPortL(TUint aPort); + + /** + * Gets the port count. + * + * @return The port count. + */ + IMPORT_C TUint PortCount() const; + + /** + * Sets the port count. + * + * @param aCount The port count that must be greater than zero. + * @leave KErrSdpCodecMediaField if aCount equals to zero. + */ + IMPORT_C void SetPortCountL(TUint aCount); + + /** + * Gets the format list. + * + * @return The format list. + */ + IMPORT_C const TDesC8& FormatList() const; + + /** + * Sets the format list. + * The format list should contain one or more format tokens separated + * by a single whitespace character. + * + * @param aValue A valid format list. + * @leave KErrSdpCodecMediaField if aValue contains invalid tokens + */ + IMPORT_C void SetFormatListL(const TDesC8& aValue); + + /** + * Return the media level info field value. + * + * @return The value or an empty descriptor if not present. + */ + IMPORT_C const TDesC8& Info() const; + + /** + * Sets the media level info field value. + * + * @param aValue A valid info field value. + * @leave KErrSdpCodecMediaInfoField if aValue is not KNullDesC8 or + * aValue includes invalid byte strings (´\0´, ´\n´, ´\r´). + */ + IMPORT_C void SetInfoL(const TDesC8& aValue); + + /** + * Gets the media level encryption key field. + * Note, that the ownership is not transferred and + * the instance must not be deleted by the caller. + * + * @return Encryption key field or null if not present. + */ + IMPORT_C CSdpKeyField* Key(); + + /** + * Gets the media level encryption key field. + * + * @return Encryption key field or null if not present. + */ + IMPORT_C const CSdpKeyField* Key() const; + + /** + * Sets or removes the media level encryption key field. + * + * @param aObj The new key field or null if field is + * to be removed. Ownership of the referenced object + * is transferred to the media field instance. + */ + IMPORT_C void SetKey(CSdpKeyField* aObj); + + /** + * Gets the set of media format level attributes. + * This array is used directly for element insertion and removal. + * + * The objects referenced from the array are owned by the media + * field instance and must not be deleted. An object can be + * removed from the media description by setting the corresponding + * element to zero. By doing so, the calling party receives ownership + * of the removed object. + * + * @return The set of media format level attributes. + */ + IMPORT_C RPointerArray& FormatAttributeFields(); + + /** + * Gets the set of media level, format independent attributes. + * This array is used directly for element insertion and removal. + * + * The objects referenced from the array are owned by the media + * field instance and must not be deleted. An object can be + * removed from the media description by setting the corresponding + * element to zero. By doing so, the calling party receives ownership + * of the removed object. + * + * @return The set of media level attributes. + */ + IMPORT_C RPointerArray& AttributeFields(); + + /** + * Gets the set of media level bandwidth fields. + * This array is used directly for element insertion and removal. + * + * The objects referenced from the array are owned by the media + * field instance and must not be deleted. An object can be + * removed from the media description by setting the corresponding + * element to zero. By doing so, the calling party receives ownership + * of the removed object. + * + * @return The set of media level bandwidth fields. + */ + IMPORT_C RPointerArray& BandwidthFields(); + + /** + * Gets the set of media level connection fields. + * This array is used directly for element insertion and removal. + * + * The objects referenced from the array are owned by the media + * field instance and must not be deleted. An object can be + * removed from the media description by setting the corresponding + * element to zero. By doing so, the calling party receives ownership + * of the removed object. + * + * @return The set of media level connection fields. + */ + IMPORT_C RPointerArray& ConnectionFields(); + + /** + * Removes a specific format from the media description. + * The function will remove the named format from the format list if + * found and then delete all format level attributes of type + * CSdpFmtAttributeField related to the removed format. + * + * @param aFormat The name of the format to remove. + */ + IMPORT_C void RemoveFormatL(const TDesC8& aFormat); + + /** + * Removes all formats except one from the media description. + * The function will set the format list to only contain the one + * format to keep and then delete all format level attributes that + * are related to the removed formats. If the format is not found + * from the format list, it is added there. If there are no format + * level attributes for the specified format, the format level + * attribute set will be empty. + * + * @param aFormat The name of the format to keep after + * removing all others. + */ + IMPORT_C void KeepFormatL(const TDesC8& aFormat); + + /** + * Sets this media description into rejected state. + * The rejected state is defined by the offer/answer model in + * RFC3264. The function sets the port number to 0 and removes + * all formats except one. The remaining format is determined + * by the implementation. + */ + IMPORT_C void RejectMedia(); + + public: + /** + * Shows if contact is present + * + * @return ETrue if contact present, otherwise EFalse + */ + TBool IsContactPresent() const; + + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpMediaField* InternalizeL(RReadStream& aStream); + + private: + CSdpMediaField(); + void ConstructL(); + void ConstructL(TBool aRecurse); + void ConstructL(RStringF aMedia, TUint aPort, RStringF aProtocol, + const TDesC8& aFormatList); + + void ConstructL(const CSdpMediaField& aSdpMediaField); + void DoInternalizeL(RReadStream& aStream); + void ParseL (const TDesC8& aText); + void ParseMediaL(); + void ParseInformationL(); + void ParseConnectionL(); + void ParseBandwithL(); + void ParseEncryptionKeyL(); + void ParseAttributeFieldsL(); + TDesC8& GetTokenFromStreamL(RReadStream& aStream); + + + CSdpMediaField(const CSdpMediaField&); // Hidden. + CSdpMediaField& operator = (const CSdpMediaField&); // Hidden + + private: // Data + HBufC8* iInfo; + CSdpKeyField* iSdpKeyField; + RArray iElementArray; + RStringPool iPool; + TBool iRecurse; + RStringF iMedia; + RStringF iProtocol; + TUint iPort; + TUint iPortCount; + HBufC8* iFormatList; + RPointerArray* iBandwidthFields; + RPointerArray* iAttributeFields; + RPointerArray* iConnectionFields; + RPointerArray* iFmtAttrFields; + HBufC8* iToken; + CSdpCodecParseUtil* iSdpCodecParseUtil; + }; + +#endif // CSDPMEDIAFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdporiginfield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdporiginfield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,461 @@ +/* +* Copyright (c) 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: +* Name : SdpOriginField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPORIGINFIELD_H +#define CSDPORIGINFIELD_H + +// INCLUDES +#include +#include +#include +#include "_sdpdefs.h" + +// CONSTANTS +const TInt KMaxAddressLength = 256; + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; +class CSdpOriginFieldPtrs; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the origin field of + * the Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpOriginField : public CBase + { + public: // Constructors and destructor + + /** + * Constructs a new origin field. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpOriginField* DecodeL( const TDesC8& aText ); + + /** + * Constructs a new origin field and adds the pointer to the cleanup + * stack. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpOriginField* DecodeLC( const TDesC8& aText ); + + /** + * Constructs a new origin field. + * + * @param aUserName A valid user name value. + * @param aSessionId A valid session id value. + * @param aSessionVersion A valid announcement version value. + * @param aAddress A unicast IP address from either + * KAfInet or KAfInet6 family. + * @return a new instance. + */ + IMPORT_C static CSdpOriginField* NewL( const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + TInetAddr& aAddress ); + + /** + * Constructs a new origin field and adds the pointer to the cleanup + * stack. + * + * @param aUserName A valid user name value. + * @param aSessionId A valid session id value. + * @param aSessionVersion A valid announcement version value. + * @param aAddress A unicast IP address from either + * KAfInet or KAfInet6 family. + * @return a new instance. + */ + IMPORT_C static CSdpOriginField* NewLC( const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + TInetAddr& aAddress ); + + /** + * Constructs a new origin field. + * + * @param aUserName A valid user name value. + * @param aSessionId A valid session id value. + * @param aSessionVersion A valid announcement version value. + * @param aNetType A valid network type value (typically "IN"). + * @param aAddressType A valid address type value + * (typically "IP4" or "IP6"). + * @param aAddress A unicast IP Address, Fully + * Qualified Domain Name (FQDN), or an other type of + * address allowed for the address type. + * @return a new instance. + */ + IMPORT_C static CSdpOriginField* NewL( const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ); + + /** + * Constructs a new origin field and adds the pointer to the cleanup + * stack. + * + * @param aUserName A valid user name value. + * @param aSessionId A valid session id value. + * @param aSessionVersion A valid announcement version value. + * @param aNetType A valid network type value (typically "IN"). + * @param aAddressType A valid address type value + * (typically "IP4" or "IP6"). + * @param aAddress A unicast IP Address, Fully Qualified Domain + * Name (FQDN), or an other type of address allowed + * for the address type. + * @return a new instance. + */ + IMPORT_C static CSdpOriginField* NewLC( const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpOriginField(); + + public: // New functions + + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream Stream used for output. On return + * the stream includes correctly formatted origin field. + */ + IMPORT_C void EncodeL( RWriteStream& aStream ) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpOriginField* CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == ( const CSdpOriginField& aObj ) const; + + /** + * Gets the user name. + * + * @return User name. + */ + IMPORT_C const TDesC8& UserName() const; + + /** + * Sets the user name. + * + * @param aValue A valid user name value. + * @leave KErrSdpCodecOriginField if aValue is not a valid user name. + */ + IMPORT_C void SetUserNameL( const TDesC8& aValue ); + + /** + * Gets the session id of the origin field. + * + * @return Session id. + */ + IMPORT_C TInt64 SessionId() const; + + /** + * Sets the session id. + * + * @param aValue A valid session id value. + */ + IMPORT_C void SetSessionId( TInt64 aValue ); + + /** + * Gets the announcement version. + * + * @return Version. + */ + IMPORT_C TInt64 Version() const; + + /** + * Sets the announcement version.. + * + * @param aValue A valid version value. + */ + IMPORT_C void SetVersion( TInt64 aValue ); + + /** + * Gets the network type. + * + * @return The network type from pre-defined SDP string + * table or given by the user. + */ + IMPORT_C RStringF NetType() const; + + /** + * Gets the address type. + * + * @return The address type from pre-defined SDP string + * table or given by the user. + */ + IMPORT_C RStringF AddressType() const; + + /** + * Gets the address. + * + * @return Address as an IP address or null if it is + * not an IP address. This may be e.g. when the address has + * been specified as a FQDN. In this case, the address can be + * accessed using the other getters. + */ + IMPORT_C const TInetAddr* InetAddress() const; + + /** + * Gets the address. + * + * @return Address as a string. + */ + IMPORT_C const TDesC8& Address() const; + + /** + * Sets the address, network and address type. + * Also sets the network type to "IN" and address type to "IP4" or + * "IP6" depending on the address family of aValue. + * + * @param aValue A unicast IP address from either KAfInet + * or KAfInet6 family. + */ + IMPORT_C void SetInetAddress( const TInetAddr& aValue ); + + /** + * Sets the address, network and address type. + * + * @param aAddress A unicast IP Address, Fully Qualified Domain + * Name (FQDN), or an other type of address allowed for the + * address type. + * @param aNetType A valid network type value (typically "IN"). + * @param aAddressType A valid address type value + * (typically "IP4" or "IP6"). + * @leave KErrSdpCodecOriginField if aNetType or aAddressType are not + * valid tokens, or aAddress is invalid, or aAddress type + * is not aligned with the address format + */ + IMPORT_C void SetAddressL( const TDesC8& aAddress, + RStringF aNetType, + RStringF aAddressType ); + + public: // Internal to codec + + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpOriginField* InternalizeL( RReadStream& aStream ); + + private: // Constructors + + /** + * Constructor + */ + CSdpOriginField(); + + /** + * Second phase constructor. Parses the text string and initializes + * the member variables + * + * @param aText Line of text that will be parsed (ends on the newline) + */ + void ConstructL( const TDesC8& aText ); + + /** + * Second phase constructor. Constructs the object. + * + * @param aUserName A valid user name value. + * @param aSessionId A valid session id value. + * @param aSessionVersion A valid announcement version value. + * @param aAddress A unicast IP address from either + * KAfInet or KAfInet6 family. + */ + void ConstructL( const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + TInetAddr& aUnicastAddress ); + + /** + * Second phase constructor. Constructs the object. + * + * @param aUserName A valid user name value. + * @param aSessionId A valid session id value. + * @param aSessionVersion A valid announcement version value. + * @param aNetType A valid network type value (typically "IN"). + * @param aAddressType A valid address type value + * (typically "IP4" or "IP6"). + * @param aAddress A unicast IP Address, Fully Qualified Domain + * Name (FQDN), or an other type of address allowed + * for the address type. + */ + void ConstructL( const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ); + + // These are unnecessary? Derived from CBase, prevents the use + CSdpOriginField( const CSdpOriginField& ); // Hidden. + CSdpOriginField& operator = ( const CSdpOriginField& ); // Hidden + + private: // New methods + + /** + * Checks if the given address is valid + * + * @param aAddress Address to be checked + * @return Valid address or not + */ + TBool IsValidAddress( const TDesC8& aAddress ) const; + + /** + * Checks if the given address is valid + * + * @param aAddr Address to be checked + * @return Valid address or not + */ + TBool IsValidAddress( const TInetAddr& addr ) const; + + /** + * Checks that address type matches with address format + * + * @param aAddress Address + * @param aType Address type + * @param aPool String pool + * @return Type Matches with format or not + */ + TBool TypeMatchesWithFormat( + const TDesC8& aAddress, const TDesC8& aType, + RStringPool aPool ) const; + + /** + * Checks if the given username is valid + * + * @param aUserName Username + * @return Validity of the given username + */ + TBool IsValidUserName( const TDesC8& aUserName ) const; + + /** + * Parses username, initializes iUserName + * + * @param aArray Array containing all the elements + */ + void ParseUserNameL( RArray& aArray ); + + /** + * Parses session ID and version, initializes iSessionId + * and iSessionVersion + * + * @param aArray Array containing all the elements + */ + void ParseSessionIDAndVersionL( RArray& aArray ); + + /** + * Parses network type and address type, initializes + * iNetType and iAddressType + * + * @param aArray Array containing all the elements + */ + void ParseNetTypeAndAddressTypeL( RArray& aArray ); + + /** + * Parses address, checks address against address type, + * initializes iAddress + * + * @param aArray Array containing all the elements + */ + void ParseAddressL( RArray& aArray ); + + inline CSdpOriginFieldPtrs& OriginFieldPtrs(); + + inline const CSdpOriginFieldPtrs& OriginFieldPtrs() const; + + TInt64 Get63Msbs( const TDesC8& aDecimalValue ) const; + void SetIPAddressType( const TInetAddr& aAddr ); + + private: // Data + + RStringPool iPool; + + // + HBufC8* iUserName; + // + TInt64 iSessionId; + // + TInt64 iSessionVersion; + // + RStringF iNetType; + //
+ RStringF iAddressType; + //
+ // Either one is used (this or iAddressType/iAddress combo) + // Can be defined as mutable because this variable does not affect + // to the state of the object, but it is needed as const pointer + // is returned on InetAddr() method + mutable TInetAddr iUnicastAddress; + TBuf8 iAddress; + // For configuring the address into TInetAddr + TBuf iAddress16; + + void __DbgTestInvariant() const; + + }; + +#endif // CSDPORIGINFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdprepeatfield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdprepeatfield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 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: +* Name : SdpRepeatField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPREPEATFIELD_H +#define CSDPREPEATFIELD_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" +#include "sdptypedtime.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the repeat times field of the + * Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpRepeatField : public CBase + { + public: // Constructors and destructor + /** + * Constructs a new repeat times field. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpRepeatField* DecodeL(const TDesC8& aText); + + /** + * Constructs a new repeat times field and adds the pointer to the + * cleanup stack. + * + * @param aText A string containing a correctly + * formatted field value terminated by a CRLF. + * @return a new instance. + */ + IMPORT_C static CSdpRepeatField* DecodeLC(const TDesC8& aText); + + /** + * Constructs a new repeat times field. + * + * @param aRepeatInterval Repeat interval value + * greater than zero. + * @param aActiveDuration Active duration. + * @param aOffsets At least one time offset. + * @return a new instance. + */ + IMPORT_C static CSdpRepeatField* NewL( + const TSdpTypedTime aRepeatInterval, + const TSdpTypedTime aActiveDuration, + const RArray& aOffsets); + + /** + * Constructs a new repeat times field and adds the pointer to the + * cleanup stack. + * + * @param aRepeatInterval Repeat interval value + * greater than zero. + * @param aActiveDuration Active duration. + * @param aOffsets At least one time offset. + * @return a new instance. + */ + IMPORT_C static CSdpRepeatField* NewLC( + const TSdpTypedTime aRepeatInterval, + const TSdpTypedTime aActiveDuration, + const RArray& aOffsets); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpRepeatField(); + + public: // New functions + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream Stream used for output. On return + * the stream includes correctly formatted repeat field. + */ + IMPORT_C void EncodeL(RWriteStream& aStream) const; + + /** + * Creates a new instance that is equal to the target. + * + * @return a new instance. + */ + IMPORT_C CSdpRepeatField * CloneL() const; + + /** + * Compares this instance to another for equality. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == (const CSdpRepeatField & aObj) const; + + /** + * Gets the repeat interval. + * + * @return The repeat interval. + */ + IMPORT_C const TSdpTypedTime RepeatInterval() const; + + /** + * Sets the repeat interval. + * + * @param aValue Repeat interval value greater than zero. + * @leave KErrSdpCodecRepeatField if aValue is not positive integer + * value. + */ + IMPORT_C void SetRepeatIntervalL(const TSdpTypedTime aValue); + + /** + * Gets the active duration.. + * + * @return The active duration. + */ + IMPORT_C const TSdpTypedTime ActiveDuration() const; + + /** + * Sets the active duration. + * + * @param Active duration. + */ + IMPORT_C void SetActiveDuration(const TSdpTypedTime aValue); + + /** + * Gets the array of time offsets. + * This array is used directly for element insertion and removal. + * + * @return The offsets. + */ + IMPORT_C const RArray& TimeOffsets() const; + + /** + * Sets the time offsets. + * + * @param aOffsets At least one time offset. + */ + IMPORT_C void SetTimeOffsetsL(const RArray& aValue); + + public: + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpRepeatField* InternalizeL(RReadStream& aStream); + + private: + CSdpRepeatField(const TSdpTypedTime aRepeatInterval, + const TSdpTypedTime aActiveDuration); + CSdpRepeatField(); + void ConstructL(const TDesC8& aText); + void ConstructL(const RArray& aOffsets); + + + private: // Data + RStringPool iPool; + TSdpTypedTime iRepeatInterval; + TSdpTypedTime iActiveDuration; + RArray iTimeOffsets; + + void __DbgTestInvariant() const; + + }; + +#endif // CSDPREPEATFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdprtpmapvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdprtpmapvalue.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 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: +* Name : SdpRtpmapValue.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef TSDPRTPMAPVALUE_H +#define TSDPRTPMAPVALUE_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RWriteStream; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * Utility class for manipulating the value of an rtpmap-attribute. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class TSdpRtpmapValue + { + public: // Constructors and destructor + + /** + * Initializes the instance to refer to the given rtpmap components. + * The parameters must stay in scope as long as this instance exists. + * Otherwise, the member variables of this class will point to + * a released memory. + * + * @param aEncodingName Valid rtpmap encoding name value. + * @param aClockrate Valid rtpmap clockrate value. + * @param aEncodingParameters Valid rtpmap encoding + * parameter list. + */ + IMPORT_C TSdpRtpmapValue( + const TPtrC8& aEncodingName, + const TPtrC8& aClockrate, + const TPtrC8& aEncodingParameters ); + + public: // New functions + + /** + * Tries to parse a string as an rtpmap attribute value up to the end + * of the string or CRLF, whichever comes first, and set pointers to + * the components found. The parameter must stay in scope as long as + * this instance exists. Otherwise, the member variables of this class + * will point to a released memory. + * + * @param aText String containing the value of an rtpmap attribute. + * @return a new instance + * @leave KErrArgument if parsing fails. + */ + IMPORT_C static TSdpRtpmapValue DecodeL( const TDesC8& aText ); + + /** + * Outputs the attribute value formatted according to SDP syntax. + * The field terminating CRLF is not included in the output. + * When constructing CSdpFmtAttributeField, return value of this + * function can be used as aValue in CSdpFmtAttributeField::NewL + * (RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue) + * function. + * + * @return Encoded value. Ovnership of buffer is changed to caller. + */ + IMPORT_C HBufC8* EncodeL() const; + + public: // Data + + /** + * Encoding name part of an rtpmap value + * @internalComponent + */ + TPtrC8 iEncName; + + /** + * Clockrate part of an rtpmap value. + * @internalComponent + */ + TPtrC8 iClockrate; + + /** + * Encoding parameters part of an rtpmap value. + * @internalComponent + */ + TPtrC8 iEncParams; + }; + +#endif // TSDPRTPMAPVALUE_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdptimefield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdptimefield.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,231 @@ +/* +* Copyright (c) 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: +* Name : SdpTimeField.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef CSDPTIMESFIELD_H +#define CSDPTIMESFIELD_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; +class CSdpRepeatField; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class encapsulates the time field and the related zero or + * more repeat times fields and an optional time zone adjustment + * field of the Session Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class CSdpTimeField : public CBase + { + public: // Constructors and destructor + /** + * Constructs a time field. + * + * @param aText A correctly formatted time field value + * terminated by a CRLF followed by zero or more repeat + * times and zero or one time zone adjustment fields + * separeted by a CRLF. + * @param aRecurse Flag to specify whether to decode subfields + * also (ETrue) or only the time field (EFalse). + * @return a new instance. + */ + IMPORT_C static CSdpTimeField * DecodeL(const TDesC8& aText, + TBool aRecurse = ETrue); + + /** + * Constructs a time field and adds the pointer to the cleanup stack. + * + * @param aText A correctly formatted time field value + * terminated by a CRLF followed by zero or more repeat + * times and zero or one time zone adjustment fields + * separeted by a CRLF. + * @param aRecurse Flag to specify whether to decode subfields + * also (ETrue) or only the time field (EFalse). + * @return a new instance. + */ + IMPORT_C static CSdpTimeField * DecodeLC(const TDesC8& aText, + TBool aRecurse = ETrue); + + /** + * Constructs a time field. + * + * @param aStartTime Session start time. + * @param aStopTime Session end time that must be + * greater than or equal to the start time. + * @return a new instance. + */ + IMPORT_C static CSdpTimeField * NewL(const TDesC8& aStartTime, + const TDesC8& aStopTime); + + /** + * Constructs a time field and adds the pointer to the cleanup stack. + * + * @param aStartTime Session start time. + * @param aStopTime Session end time that must be + * greater than or equal to the start time. + * @return a new instance. + */ + IMPORT_C static CSdpTimeField * NewLC(const TDesC8& aStartTime, + const TDesC8& aStopTime); + + /** + * Deletes the resources held by the instance. + */ + IMPORT_C ~CSdpTimeField(); + + public: // New functions + /** + * Outputs the field formatted according to SDP syntax and including + * the terminating CRLF. Optionally output also the related repeat + * times. + * + * @param aStream Stream used for output. On return + * the stream includes correctly formatted time field with + * repeat fields if aRecurse is ETrue. + * @param aRecurse Flag to specify whether to output subfields + * also (ETrue) or only the time field (EFalse). + */ + IMPORT_C void EncodeL(RWriteStream& aStream, TBool aRecurse = ETrue) const; + + /** + * Creates a new instance that is equal to the target. + * Optionally also related repeat times are cloned. + * + * @param aRecurse Flag to specify whether to clone subfields + * also (ETrue) or only the time field (EFalse). + * @return a new instance. + */ + IMPORT_C CSdpTimeField * CloneL(TBool aRecurse = ETrue) const; + + /** + * Compares this instance to another for equality. Subfields are + * included in comparison if present. + * + * @param aObj The instance to compare to. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == (const CSdpTimeField & aObj) const; + + /** + * Checks the consistency of the time description and it's subfields. + *. + * @return ETrue if time description is valid and EFalse if not. + */ + IMPORT_C TBool IsValid() const; + + /** + * Gets the session start time. + * + * @return The session start time. + */ + IMPORT_C const TDesC8& StartTime() const; + + /** + * Gets the session stop time. + * + * @return The session stop time. + */ + IMPORT_C const TDesC8& StopTime() const; + + /** + * Sets the session start and stop times. + * + * @param aStartTime Session start time.. + * @param aStopTime Session end time that must be + * greater than or equal to the start time. + * @leave KErrSdpCodecTimeField if start time and stop time are not + * correct as defined draft-ietf-mmusic-sdp-new-14. + */ + IMPORT_C void SetTimesL(const TDesC8& aStartTime, const TDesC8& aStopTime); + + /** + * Gets the set of repeat times fields related to this time field. + * This array is used directly for element insertion and removal. + * + * The objects referenced from the array are owned by the media field + * instance and must not be deleted. An object can be removed from the + * media description by setting the corresponding element to zero. By + * doing so, the calling party receives ownership of the removed object. + * + * @return The set of repeat fields. + */ + IMPORT_C RPointerArray& RepeatFields(); + + public: + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static CSdpTimeField* InternalizeL(RReadStream& aStream); + + /** + * Creates object from the stream data. + * Does the "2nd phase construction" of internalization. + * + * @param aStream Stream where the object's state will be read + */ + void DoInternalizeL(RReadStream& aStream); + + private: + CSdpTimeField(); + + void ConstructL(const TDesC8& aText, TBool aRecurse=ETrue); + void ConstructL(const TDesC8& aStartTime, const TDesC8& aStopTime); + + TBool RepeatFieldsCompare(const CSdpTimeField& aObj) const; + + private: // Data + HBufC8* iStartTime; + HBufC8* iStopTime; + RPointerArray iRFields; + RStringPool iStringPool; + + void __DbgTestInvariant() const; + + }; + +#endif // CSDPTIMESFIELD_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdptypedtime.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/api/sdptypedtime.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 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: +* Name : SdpTypedTime.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + +#ifndef TSDPTYPEDTIME_H +#define TSDPTYPEDTIME_H + +// INCLUDES +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; + +// CLASS DECLARATION +/** + * @publishedAll + * @released + * + * This class implements the typed time element of the Session + * Description Protocol. + * + * The normative reference for correct formatting and values is + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in + * member documentation. The implementation supports this normative + * reference, but does not enforce it fully. + * + * @lib localsdpcodec.lib + */ +class TSdpTypedTime + { + public: // enums + + /** Time units. */ + enum TUnit + { + ETimeUnitDays, /** d */ + ETimeUnitHours, /** h */ + ETimeUnitMinutes, /** m */ + ETimeUnitSeconds, /** s */ + ETimeUnitNone, + }; + + public: // Constructors and destructor + /** + * Constructs a typed time equal to zero and with no time unit set. + */ + IMPORT_C TSdpTypedTime(); + + /** + * Constructs a typed time equal to specified value and time unit. + * + * @param aValue Time value. + * @param aUnit Time unit. + */ + IMPORT_C TSdpTypedTime(TInt64 aValue, TUnit aUnit); + + public: // New functions + /** + * Compares this instance to another for equality. + * + * @param aObj Another instance to compare with. + * @return ETrue if equal, EFalse if not. + */ + IMPORT_C TBool operator == (const TSdpTypedTime& aObj) const; + + /** + * Sets the typed time value. + * + * @param aValue Time value. + * @param aUnit Time unit. + */ + IMPORT_C void SetValue(TInt64 aValue, TUnit aUnit); + + public: + + /** + * Externalizes the object to stream + * + * @param aStream Stream where the object's state will be stored + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** + * Creates object from the stream data + * + * @param aStream Stream where the object's state will be read + * @return Initialized object + */ + static TSdpTypedTime InternalizeL(RReadStream& aStream); + + /** + * Output the field formatted according to SDP syntax and including + * the terminating CRLF. + * + * @param aStream Stream used for output. + */ + void EncodeL(RWriteStream& aStream) const; + + /** + * Construct a new origin field. + * + * @param aText A string containing a correctly formatted field value + * terminated by a CRLF. + * @return The new instance. + */ + static TSdpTypedTime DecodeL(const TDesC8& aText); + + public: // Data + + /** + * @internalComponent + */ + TInt64 iValue; + + /** + * @internalComponent + */ + TInt iUnit; + + }; + +#endif // TSDPTYPEDTIME_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/bwins/localsdpcodecu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/bwins/localsdpcodecu.def Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,203 @@ +EXPORTS + ??0TSdpRtpmapValue@@QAE@ABVTPtrC8@@00@Z @ 1 NONAME ; TSdpRtpmapValue::TSdpRtpmapValue(class TPtrC8 const &, class TPtrC8 const &, class TPtrC8 const &) + ??0TSdpTypedTime@@QAE@XZ @ 2 NONAME ; TSdpTypedTime::TSdpTypedTime(void) + ??0TSdpTypedTime@@QAE@_JW4TUnit@0@@Z @ 3 NONAME ; TSdpTypedTime::TSdpTypedTime(long long, enum TSdpTypedTime::TUnit) + ??1CSdpAttributeField@@UAE@XZ @ 4 NONAME ; CSdpAttributeField::~CSdpAttributeField(void) + ??1CSdpBandwidthField@@UAE@XZ @ 5 NONAME ; CSdpBandwidthField::~CSdpBandwidthField(void) + ??1CSdpConnectionField@@UAE@XZ @ 6 NONAME ; CSdpConnectionField::~CSdpConnectionField(void) + ??1CSdpDocument@@UAE@XZ @ 7 NONAME ; CSdpDocument::~CSdpDocument(void) + ??1CSdpFmtAttributeField@@UAE@XZ @ 8 NONAME ; CSdpFmtAttributeField::~CSdpFmtAttributeField(void) + ??1CSdpKeyField@@UAE@XZ @ 9 NONAME ; CSdpKeyField::~CSdpKeyField(void) + ??1CSdpMediaField@@UAE@XZ @ 10 NONAME ; CSdpMediaField::~CSdpMediaField(void) + ??1CSdpOriginField@@UAE@XZ @ 11 NONAME ; CSdpOriginField::~CSdpOriginField(void) + ??1CSdpRepeatField@@UAE@XZ @ 12 NONAME ; CSdpRepeatField::~CSdpRepeatField(void) + ??1CSdpTimeField@@UAE@XZ @ 13 NONAME ; CSdpTimeField::~CSdpTimeField(void) + ??8CSdpAttributeField@@QBEHABV0@@Z @ 14 NONAME ; int CSdpAttributeField::operator==(class CSdpAttributeField const &) const + ??8CSdpBandwidthField@@QBEHABV0@@Z @ 15 NONAME ; int CSdpBandwidthField::operator==(class CSdpBandwidthField const &) const + ??8CSdpConnectionField@@QBEHABV0@@Z @ 16 NONAME ; int CSdpConnectionField::operator==(class CSdpConnectionField const &) const + ??8CSdpFmtAttributeField@@QBEHABV0@@Z @ 17 NONAME ; int CSdpFmtAttributeField::operator==(class CSdpFmtAttributeField const &) const + ??8CSdpKeyField@@QBEHABV0@@Z @ 18 NONAME ; int CSdpKeyField::operator==(class CSdpKeyField const &) const + ??8CSdpMediaField@@QBEHABV0@@Z @ 19 NONAME ; int CSdpMediaField::operator==(class CSdpMediaField const &) const + ??8CSdpOriginField@@QBEHABV0@@Z @ 20 NONAME ; int CSdpOriginField::operator==(class CSdpOriginField const &) const + ??8CSdpRepeatField@@QBEHABV0@@Z @ 21 NONAME ; int CSdpRepeatField::operator==(class CSdpRepeatField const &) const + ??8CSdpTimeField@@QBEHABV0@@Z @ 22 NONAME ; int CSdpTimeField::operator==(class CSdpTimeField const &) const + ??8TSdpTypedTime@@QBEHABV0@@Z @ 23 NONAME ; int TSdpTypedTime::operator==(class TSdpTypedTime const &) const + ?ActiveDuration@CSdpRepeatField@@QBE?BVTSdpTypedTime@@XZ @ 24 NONAME ; class TSdpTypedTime const CSdpRepeatField::ActiveDuration(void) const + ?Address@CSdpConnectionField@@QBEABVTDesC8@@XZ @ 25 NONAME ; class TDesC8 const & CSdpConnectionField::Address(void) const + ?Address@CSdpOriginField@@QBEABVTDesC8@@XZ @ 26 NONAME ; class TDesC8 const & CSdpOriginField::Address(void) const + ?AddressType@CSdpConnectionField@@QBE?AVRStringF@@XZ @ 27 NONAME ; class RStringF CSdpConnectionField::AddressType(void) const + ?AddressType@CSdpOriginField@@QBE?AVRStringF@@XZ @ 28 NONAME ; class RStringF CSdpOriginField::AddressType(void) const + ?Attribute@CSdpAttributeField@@QBE?AVRStringF@@XZ @ 29 NONAME ; class RStringF CSdpAttributeField::Attribute(void) const + ?Attribute@CSdpFmtAttributeField@@QBE?AVRStringF@@XZ @ 30 NONAME ; class RStringF CSdpFmtAttributeField::Attribute(void) const + ?AttributeFields@CSdpDocument@@QAEAAV?$RPointerArray@VCSdpAttributeField@@@@XZ @ 31 NONAME ; class RPointerArray & CSdpDocument::AttributeFields(void) + ?AttributeFields@CSdpMediaField@@QAEAAV?$RPointerArray@VCSdpAttributeField@@@@XZ @ 32 NONAME ; class RPointerArray & CSdpMediaField::AttributeFields(void) + ?BandwidthFields@CSdpDocument@@QAEAAV?$RPointerArray@VCSdpBandwidthField@@@@XZ @ 33 NONAME ; class RPointerArray & CSdpDocument::BandwidthFields(void) + ?BandwidthFields@CSdpMediaField@@QAEAAV?$RPointerArray@VCSdpBandwidthField@@@@XZ @ 34 NONAME ; class RPointerArray & CSdpMediaField::BandwidthFields(void) + ?CloneL@CSdpAttributeField@@QBEPAV1@XZ @ 35 NONAME ; class CSdpAttributeField * CSdpAttributeField::CloneL(void) const + ?CloneL@CSdpBandwidthField@@QBEPAV1@XZ @ 36 NONAME ; class CSdpBandwidthField * CSdpBandwidthField::CloneL(void) const + ?CloneL@CSdpConnectionField@@QBEPAV1@XZ @ 37 NONAME ; class CSdpConnectionField * CSdpConnectionField::CloneL(void) const + ?CloneL@CSdpDocument@@QBEPAV1@XZ @ 38 NONAME ; class CSdpDocument * CSdpDocument::CloneL(void) const + ?CloneL@CSdpFmtAttributeField@@QBEPAV1@XZ @ 39 NONAME ; class CSdpFmtAttributeField * CSdpFmtAttributeField::CloneL(void) const + ?CloneL@CSdpKeyField@@QBEPAV1@XZ @ 40 NONAME ; class CSdpKeyField * CSdpKeyField::CloneL(void) const + ?CloneL@CSdpMediaField@@QBEPAV1@H@Z @ 41 NONAME ; class CSdpMediaField * CSdpMediaField::CloneL(int) const + ?CloneL@CSdpOriginField@@QBEPAV1@XZ @ 42 NONAME ; class CSdpOriginField * CSdpOriginField::CloneL(void) const + ?CloneL@CSdpRepeatField@@QBEPAV1@XZ @ 43 NONAME ; class CSdpRepeatField * CSdpRepeatField::CloneL(void) const + ?CloneL@CSdpTimeField@@QBEPAV1@H@Z @ 44 NONAME ; class CSdpTimeField * CSdpTimeField::CloneL(int) const + ?Close@SdpCodecStringPool@@SAXXZ @ 45 NONAME ; void SdpCodecStringPool::Close(void) + ?ConnectionField@CSdpDocument@@QAEPAVCSdpConnectionField@@XZ @ 46 NONAME ; class CSdpConnectionField * CSdpDocument::ConnectionField(void) + ?ConnectionField@CSdpDocument@@QBEPBVCSdpConnectionField@@XZ @ 47 NONAME ; class CSdpConnectionField const * CSdpDocument::ConnectionField(void) const + ?ConnectionFields@CSdpMediaField@@QAEAAV?$RPointerArray@VCSdpConnectionField@@@@XZ @ 48 NONAME ; class RPointerArray & CSdpMediaField::ConnectionFields(void) + ?DecodeL@CSdpAttributeField@@SAPAV1@ABVTDesC8@@@Z @ 49 NONAME ; class CSdpAttributeField * CSdpAttributeField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpBandwidthField@@SAPAV1@ABVTDesC8@@@Z @ 50 NONAME ; class CSdpBandwidthField * CSdpBandwidthField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpConnectionField@@SAPAV1@ABVTDesC8@@@Z @ 51 NONAME ; class CSdpConnectionField * CSdpConnectionField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpDocument@@SAPAV1@ABVTDesC8@@@Z @ 52 NONAME ; class CSdpDocument * CSdpDocument::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpFmtAttributeField@@SAPAV1@ABVTDesC8@@@Z @ 53 NONAME ; class CSdpFmtAttributeField * CSdpFmtAttributeField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpKeyField@@SAPAV1@ABVTDesC8@@@Z @ 54 NONAME ; class CSdpKeyField * CSdpKeyField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpMediaField@@SAPAV1@ABVTDesC8@@H@Z @ 55 NONAME ; class CSdpMediaField * CSdpMediaField::DecodeL(class TDesC8 const &, int) + ?DecodeL@CSdpOriginField@@SAPAV1@ABVTDesC8@@@Z @ 56 NONAME ; class CSdpOriginField * CSdpOriginField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpRepeatField@@SAPAV1@ABVTDesC8@@@Z @ 57 NONAME ; class CSdpRepeatField * CSdpRepeatField::DecodeL(class TDesC8 const &) + ?DecodeL@CSdpTimeField@@SAPAV1@ABVTDesC8@@H@Z @ 58 NONAME ; class CSdpTimeField * CSdpTimeField::DecodeL(class TDesC8 const &, int) + ?DecodeL@TSdpRtpmapValue@@SA?AV1@ABVTDesC8@@@Z @ 59 NONAME ; class TSdpRtpmapValue TSdpRtpmapValue::DecodeL(class TDesC8 const &) + ?DecodeLC@CSdpAttributeField@@SAPAV1@ABVTDesC8@@@Z @ 60 NONAME ; class CSdpAttributeField * CSdpAttributeField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpBandwidthField@@SAPAV1@ABVTDesC8@@@Z @ 61 NONAME ; class CSdpBandwidthField * CSdpBandwidthField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpConnectionField@@SAPAV1@ABVTDesC8@@@Z @ 62 NONAME ; class CSdpConnectionField * CSdpConnectionField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpDocument@@SAPAV1@ABVTDesC8@@@Z @ 63 NONAME ; class CSdpDocument * CSdpDocument::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpFmtAttributeField@@SAPAV1@ABVTDesC8@@@Z @ 64 NONAME ; class CSdpFmtAttributeField * CSdpFmtAttributeField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpKeyField@@SAPAV1@ABVTDesC8@@@Z @ 65 NONAME ; class CSdpKeyField * CSdpKeyField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpMediaField@@SAPAV1@ABVTDesC8@@H@Z @ 66 NONAME ; class CSdpMediaField * CSdpMediaField::DecodeLC(class TDesC8 const &, int) + ?DecodeLC@CSdpOriginField@@SAPAV1@ABVTDesC8@@@Z @ 67 NONAME ; class CSdpOriginField * CSdpOriginField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpRepeatField@@SAPAV1@ABVTDesC8@@@Z @ 68 NONAME ; class CSdpRepeatField * CSdpRepeatField::DecodeLC(class TDesC8 const &) + ?DecodeLC@CSdpTimeField@@SAPAV1@ABVTDesC8@@H@Z @ 69 NONAME ; class CSdpTimeField * CSdpTimeField::DecodeLC(class TDesC8 const &, int) + ?EmailFields@CSdpDocument@@QAEAAVCDesC8Array@@XZ @ 70 NONAME ; class CDesC8Array & CSdpDocument::EmailFields(void) + ?EncodeL@CSdpAttributeField@@QBEXAAVRWriteStream@@@Z @ 71 NONAME ; void CSdpAttributeField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpBandwidthField@@QBEXAAVRWriteStream@@@Z @ 72 NONAME ; void CSdpBandwidthField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpConnectionField@@QBEXAAVRWriteStream@@@Z @ 73 NONAME ; void CSdpConnectionField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpDocument@@QBEXAAVRWriteStream@@@Z @ 74 NONAME ; void CSdpDocument::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpFmtAttributeField@@QBEXAAVRWriteStream@@@Z @ 75 NONAME ; void CSdpFmtAttributeField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpKeyField@@QBEXAAVRWriteStream@@@Z @ 76 NONAME ; void CSdpKeyField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpMediaField@@QBEXAAVRWriteStream@@H@Z @ 77 NONAME ; void CSdpMediaField::EncodeL(class RWriteStream &, int) const + ?EncodeL@CSdpOriginField@@QBEXAAVRWriteStream@@@Z @ 78 NONAME ; void CSdpOriginField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpRepeatField@@QBEXAAVRWriteStream@@@Z @ 79 NONAME ; void CSdpRepeatField::EncodeL(class RWriteStream &) const + ?EncodeL@CSdpTimeField@@QBEXAAVRWriteStream@@H@Z @ 80 NONAME ; void CSdpTimeField::EncodeL(class RWriteStream &, int) const + ?EncodeL@TSdpRtpmapValue@@QBEPAVHBufC8@@XZ @ 81 NONAME ; class HBufC8 * TSdpRtpmapValue::EncodeL(void) const + ?EncryptionKey@CSdpKeyField@@QBEABVTDesC8@@XZ @ 82 NONAME ; class TDesC8 const & CSdpKeyField::EncryptionKey(void) const + ?ExternalizeL@CSdpDocument@@QBEXAAVRWriteStream@@@Z @ 83 NONAME ; void CSdpDocument::ExternalizeL(class RWriteStream &) const + ?Format@CSdpFmtAttributeField@@QBEABVTDesC8@@XZ @ 84 NONAME ; class TDesC8 const & CSdpFmtAttributeField::Format(void) const + ?FormatAttributeFields@CSdpMediaField@@QAEAAV?$RPointerArray@VCSdpFmtAttributeField@@@@XZ @ 85 NONAME ; class RPointerArray & CSdpMediaField::FormatAttributeFields(void) + ?FormatList@CSdpMediaField@@QBEABVTDesC8@@XZ @ 86 NONAME ; class TDesC8 const & CSdpMediaField::FormatList(void) const + ?InetAddress@CSdpConnectionField@@QBEPBVTInetAddr@@XZ @ 87 NONAME ; class TInetAddr const * CSdpConnectionField::InetAddress(void) const + ?InetAddress@CSdpOriginField@@QBEPBVTInetAddr@@XZ @ 88 NONAME ; class TInetAddr const * CSdpOriginField::InetAddress(void) const + ?Info@CSdpDocument@@QBEABVTDesC8@@XZ @ 89 NONAME ; class TDesC8 const & CSdpDocument::Info(void) const + ?Info@CSdpMediaField@@QBEABVTDesC8@@XZ @ 90 NONAME ; class TDesC8 const & CSdpMediaField::Info(void) const + ?InternalizeL@CSdpDocument@@SAPAV1@AAVRReadStream@@@Z @ 91 NONAME ; class CSdpDocument * CSdpDocument::InternalizeL(class RReadStream &) + ?IsValid@CSdpDocument@@QBEHXZ @ 92 NONAME ; int CSdpDocument::IsValid(void) const + ?IsValid@CSdpMediaField@@QBEHXZ @ 93 NONAME ; int CSdpMediaField::IsValid(void) const + ?IsValid@CSdpTimeField@@QBEHXZ @ 94 NONAME ; int CSdpTimeField::IsValid(void) const + ?KeepFormatL@CSdpMediaField@@QAEXABVTDesC8@@@Z @ 95 NONAME ; void CSdpMediaField::KeepFormatL(class TDesC8 const &) + ?Key@CSdpDocument@@QAEPAVCSdpKeyField@@XZ @ 96 NONAME ; class CSdpKeyField * CSdpDocument::Key(void) + ?Key@CSdpDocument@@QBEPBVCSdpKeyField@@XZ @ 97 NONAME ; class CSdpKeyField const * CSdpDocument::Key(void) const + ?Key@CSdpMediaField@@QAEPAVCSdpKeyField@@XZ @ 98 NONAME ; class CSdpKeyField * CSdpMediaField::Key(void) + ?Key@CSdpMediaField@@QBEPBVCSdpKeyField@@XZ @ 99 NONAME ; class CSdpKeyField const * CSdpMediaField::Key(void) const + ?Media@CSdpMediaField@@QBE?AVRStringF@@XZ @ 100 NONAME ; class RStringF CSdpMediaField::Media(void) const + ?MediaFields@CSdpDocument@@QAEAAV?$RPointerArray@VCSdpMediaField@@@@XZ @ 101 NONAME ; class RPointerArray & CSdpDocument::MediaFields(void) + ?Method@CSdpKeyField@@QBE?AVRStringF@@XZ @ 102 NONAME ; class RStringF CSdpKeyField::Method(void) const + ?Modifier@CSdpBandwidthField@@QBE?AVRStringF@@XZ @ 103 NONAME ; class RStringF CSdpBandwidthField::Modifier(void) const + ?NetType@CSdpConnectionField@@QBE?AVRStringF@@XZ @ 104 NONAME ; class RStringF CSdpConnectionField::NetType(void) const + ?NetType@CSdpOriginField@@QBE?AVRStringF@@XZ @ 105 NONAME ; class RStringF CSdpOriginField::NetType(void) const + ?NewL@CSdpAttributeField@@SAPAV1@VRStringF@@ABVTDesC8@@@Z @ 106 NONAME ; class CSdpAttributeField * CSdpAttributeField::NewL(class RStringF, class TDesC8 const &) + ?NewL@CSdpBandwidthField@@SAPAV1@VRStringF@@K@Z @ 107 NONAME ; class CSdpBandwidthField * CSdpBandwidthField::NewL(class RStringF, unsigned long) + ?NewL@CSdpConnectionField@@SAPAV1@ABVTInetAddr@@HI@Z @ 108 NONAME ; class CSdpConnectionField * CSdpConnectionField::NewL(class TInetAddr const &, int, unsigned int) + ?NewL@CSdpConnectionField@@SAPAV1@VRStringF@@0ABVTDesC8@@@Z @ 109 NONAME ; class CSdpConnectionField * CSdpConnectionField::NewL(class RStringF, class RStringF, class TDesC8 const &) + ?NewL@CSdpDocument@@SAPAV1@XZ @ 110 NONAME ; class CSdpDocument * CSdpDocument::NewL(void) + ?NewL@CSdpFmtAttributeField@@SAPAV1@VRStringF@@ABVTDesC8@@1@Z @ 111 NONAME ; class CSdpFmtAttributeField * CSdpFmtAttributeField::NewL(class RStringF, class TDesC8 const &, class TDesC8 const &) + ?NewL@CSdpKeyField@@SAPAV1@VRStringF@@ABVTDesC8@@@Z @ 112 NONAME ; class CSdpKeyField * CSdpKeyField::NewL(class RStringF, class TDesC8 const &) + ?NewL@CSdpMediaField@@SAPAV1@VRStringF@@I0ABVTDesC8@@@Z @ 113 NONAME ; class CSdpMediaField * CSdpMediaField::NewL(class RStringF, unsigned int, class RStringF, class TDesC8 const &) + ?NewL@CSdpOriginField@@SAPAV1@ABVTDesC8@@_J1AAVTInetAddr@@@Z @ 114 NONAME ; class CSdpOriginField * CSdpOriginField::NewL(class TDesC8 const &, long long, long long, class TInetAddr &) + ?NewL@CSdpOriginField@@SAPAV1@ABVTDesC8@@_J1VRStringF@@20@Z @ 115 NONAME ; class CSdpOriginField * CSdpOriginField::NewL(class TDesC8 const &, long long, long long, class RStringF, class RStringF, class TDesC8 const &) + ?NewL@CSdpRepeatField@@SAPAV1@VTSdpTypedTime@@0ABV?$RArray@VTSdpTypedTime@@@@@Z @ 116 NONAME ; class CSdpRepeatField * CSdpRepeatField::NewL(class TSdpTypedTime, class TSdpTypedTime, class RArray const &) + ?NewL@CSdpTimeField@@SAPAV1@ABVTDesC8@@0@Z @ 117 NONAME ; class CSdpTimeField * CSdpTimeField::NewL(class TDesC8 const &, class TDesC8 const &) + ?NewLC@CSdpAttributeField@@SAPAV1@VRStringF@@ABVTDesC8@@@Z @ 118 NONAME ; class CSdpAttributeField * CSdpAttributeField::NewLC(class RStringF, class TDesC8 const &) + ?NewLC@CSdpBandwidthField@@SAPAV1@VRStringF@@K@Z @ 119 NONAME ; class CSdpBandwidthField * CSdpBandwidthField::NewLC(class RStringF, unsigned long) + ?NewLC@CSdpConnectionField@@SAPAV1@ABVTInetAddr@@HI@Z @ 120 NONAME ; class CSdpConnectionField * CSdpConnectionField::NewLC(class TInetAddr const &, int, unsigned int) + ?NewLC@CSdpConnectionField@@SAPAV1@VRStringF@@0ABVTDesC8@@@Z @ 121 NONAME ; class CSdpConnectionField * CSdpConnectionField::NewLC(class RStringF, class RStringF, class TDesC8 const &) + ?NewLC@CSdpDocument@@SAPAV1@XZ @ 122 NONAME ; class CSdpDocument * CSdpDocument::NewLC(void) + ?NewLC@CSdpFmtAttributeField@@SAPAV1@VRStringF@@ABVTDesC8@@1@Z @ 123 NONAME ; class CSdpFmtAttributeField * CSdpFmtAttributeField::NewLC(class RStringF, class TDesC8 const &, class TDesC8 const &) + ?NewLC@CSdpKeyField@@SAPAV1@VRStringF@@ABVTDesC8@@@Z @ 124 NONAME ; class CSdpKeyField * CSdpKeyField::NewLC(class RStringF, class TDesC8 const &) + ?NewLC@CSdpMediaField@@SAPAV1@VRStringF@@I0ABVTDesC8@@@Z @ 125 NONAME ; class CSdpMediaField * CSdpMediaField::NewLC(class RStringF, unsigned int, class RStringF, class TDesC8 const &) + ?NewLC@CSdpOriginField@@SAPAV1@ABVTDesC8@@_J1AAVTInetAddr@@@Z @ 126 NONAME ; class CSdpOriginField * CSdpOriginField::NewLC(class TDesC8 const &, long long, long long, class TInetAddr &) + ?NewLC@CSdpOriginField@@SAPAV1@ABVTDesC8@@_J1VRStringF@@20@Z @ 127 NONAME ; class CSdpOriginField * CSdpOriginField::NewLC(class TDesC8 const &, long long, long long, class RStringF, class RStringF, class TDesC8 const &) + ?NewLC@CSdpRepeatField@@SAPAV1@VTSdpTypedTime@@0ABV?$RArray@VTSdpTypedTime@@@@@Z @ 128 NONAME ; class CSdpRepeatField * CSdpRepeatField::NewLC(class TSdpTypedTime, class TSdpTypedTime, class RArray const &) + ?NewLC@CSdpTimeField@@SAPAV1@ABVTDesC8@@0@Z @ 129 NONAME ; class CSdpTimeField * CSdpTimeField::NewLC(class TDesC8 const &, class TDesC8 const &) + ?NumOfAddress@CSdpConnectionField@@QBEHXZ @ 130 NONAME ; int CSdpConnectionField::NumOfAddress(void) const + ?OpenL@SdpCodecStringPool@@SAXXZ @ 131 NONAME ; void SdpCodecStringPool::OpenL(void) + ?OriginField@CSdpDocument@@QAEPAVCSdpOriginField@@XZ @ 132 NONAME ; class CSdpOriginField * CSdpDocument::OriginField(void) + ?OriginField@CSdpDocument@@QBEPBVCSdpOriginField@@XZ @ 133 NONAME ; class CSdpOriginField const * CSdpDocument::OriginField(void) const + ?PhoneFields@CSdpDocument@@QAEAAVCDesC8Array@@XZ @ 134 NONAME ; class CDesC8Array & CSdpDocument::PhoneFields(void) + ?Port@CSdpMediaField@@QBEIXZ @ 135 NONAME ; unsigned int CSdpMediaField::Port(void) const + ?PortCount@CSdpMediaField@@QBEIXZ @ 136 NONAME ; unsigned int CSdpMediaField::PortCount(void) const + ?Protocol@CSdpMediaField@@QBE?AVRStringF@@XZ @ 137 NONAME ; class RStringF CSdpMediaField::Protocol(void) const + ?RejectMedia@CSdpMediaField@@QAEXXZ @ 138 NONAME ; void CSdpMediaField::RejectMedia(void) + ?RemoveFormatL@CSdpMediaField@@QAEXABVTDesC8@@@Z @ 139 NONAME ; void CSdpMediaField::RemoveFormatL(class TDesC8 const &) + ?RepeatFields@CSdpTimeField@@QAEAAV?$RPointerArray@VCSdpRepeatField@@@@XZ @ 140 NONAME ; class RPointerArray & CSdpTimeField::RepeatFields(void) + ?RepeatInterval@CSdpRepeatField@@QBE?BVTSdpTypedTime@@XZ @ 141 NONAME ; class TSdpTypedTime const CSdpRepeatField::RepeatInterval(void) const + ?SdpVersion@CSdpDocument@@QBEIXZ @ 142 NONAME ; unsigned int CSdpDocument::SdpVersion(void) const + ?SessionId@CSdpOriginField@@QBE_JXZ @ 143 NONAME ; long long CSdpOriginField::SessionId(void) const + ?SessionName@CSdpDocument@@QBEABVTDesC8@@XZ @ 144 NONAME ; class TDesC8 const & CSdpDocument::SessionName(void) const + ?SetActiveDuration@CSdpRepeatField@@QAEXVTSdpTypedTime@@@Z @ 145 NONAME ; void CSdpRepeatField::SetActiveDuration(class TSdpTypedTime) + ?SetAddressL@CSdpConnectionField@@QAEXVRStringF@@0ABVTDesC8@@@Z @ 146 NONAME ; void CSdpConnectionField::SetAddressL(class RStringF, class RStringF, class TDesC8 const &) + ?SetAddressL@CSdpOriginField@@QAEXABVTDesC8@@VRStringF@@1@Z @ 147 NONAME ; void CSdpOriginField::SetAddressL(class TDesC8 const &, class RStringF, class RStringF) + ?SetConnectionField@CSdpDocument@@QAEXPAVCSdpConnectionField@@@Z @ 148 NONAME ; void CSdpDocument::SetConnectionField(class CSdpConnectionField *) + ?SetFormatListL@CSdpMediaField@@QAEXABVTDesC8@@@Z @ 149 NONAME ; void CSdpMediaField::SetFormatListL(class TDesC8 const &) + ?SetInetAddress@CSdpOriginField@@QAEXABVTInetAddr@@@Z @ 150 NONAME ; void CSdpOriginField::SetInetAddress(class TInetAddr const &) + ?SetInetAddressL@CSdpConnectionField@@QAEXABVTInetAddr@@HI@Z @ 151 NONAME ; void CSdpConnectionField::SetInetAddressL(class TInetAddr const &, int, unsigned int) + ?SetInfoL@CSdpDocument@@QAEXABVTDesC8@@@Z @ 152 NONAME ; void CSdpDocument::SetInfoL(class TDesC8 const &) + ?SetInfoL@CSdpMediaField@@QAEXABVTDesC8@@@Z @ 153 NONAME ; void CSdpMediaField::SetInfoL(class TDesC8 const &) + ?SetKey@CSdpDocument@@QAEXPAVCSdpKeyField@@@Z @ 154 NONAME ; void CSdpDocument::SetKey(class CSdpKeyField *) + ?SetKey@CSdpMediaField@@QAEXPAVCSdpKeyField@@@Z @ 155 NONAME ; void CSdpMediaField::SetKey(class CSdpKeyField *) + ?SetL@CSdpAttributeField@@QAEXVRStringF@@ABVTDesC8@@@Z @ 156 NONAME ; void CSdpAttributeField::SetL(class RStringF, class TDesC8 const &) + ?SetL@CSdpFmtAttributeField@@QAEXVRStringF@@ABVTDesC8@@1@Z @ 157 NONAME ; void CSdpFmtAttributeField::SetL(class RStringF, class TDesC8 const &, class TDesC8 const &) + ?SetL@CSdpKeyField@@QAEXVRStringF@@ABVTDesC8@@@Z @ 158 NONAME ; void CSdpKeyField::SetL(class RStringF, class TDesC8 const &) + ?SetMediaL@CSdpMediaField@@QAEXVRStringF@@@Z @ 159 NONAME ; void CSdpMediaField::SetMediaL(class RStringF) + ?SetModifier@CSdpBandwidthField@@QAEXVRStringF@@@Z @ 160 NONAME ; void CSdpBandwidthField::SetModifier(class RStringF) + ?SetNumOfAddressL@CSdpConnectionField@@QAEXI@Z @ 161 NONAME ; void CSdpConnectionField::SetNumOfAddressL(unsigned int) + ?SetOriginField@CSdpDocument@@QAEXPAVCSdpOriginField@@@Z @ 162 NONAME ; void CSdpDocument::SetOriginField(class CSdpOriginField *) + ?SetPortCountL@CSdpMediaField@@QAEXI@Z @ 163 NONAME ; void CSdpMediaField::SetPortCountL(unsigned int) + ?SetPortL@CSdpMediaField@@QAEXI@Z @ 164 NONAME ; void CSdpMediaField::SetPortL(unsigned int) + ?SetProtocolL@CSdpMediaField@@QAEXVRStringF@@@Z @ 165 NONAME ; void CSdpMediaField::SetProtocolL(class RStringF) + ?SetRepeatIntervalL@CSdpRepeatField@@QAEXVTSdpTypedTime@@@Z @ 166 NONAME ; void CSdpRepeatField::SetRepeatIntervalL(class TSdpTypedTime) + ?SetSessionId@CSdpOriginField@@QAEX_J@Z @ 167 NONAME ; void CSdpOriginField::SetSessionId(long long) + ?SetSessionNameL@CSdpDocument@@QAEXABVTDesC8@@@Z @ 168 NONAME ; void CSdpDocument::SetSessionNameL(class TDesC8 const &) + ?SetTTLL@CSdpConnectionField@@QAEXH@Z @ 169 NONAME ; void CSdpConnectionField::SetTTLL(int) + ?SetTimeOffsetsL@CSdpRepeatField@@QAEXABV?$RArray@VTSdpTypedTime@@@@@Z @ 170 NONAME ; void CSdpRepeatField::SetTimeOffsetsL(class RArray const &) + ?SetTimesL@CSdpTimeField@@QAEXABVTDesC8@@0@Z @ 171 NONAME ; void CSdpTimeField::SetTimesL(class TDesC8 const &, class TDesC8 const &) + ?SetUri@CSdpDocument@@QAEXPAVCUri8@@@Z @ 172 NONAME ; void CSdpDocument::SetUri(class CUri8 *) + ?SetUserNameL@CSdpOriginField@@QAEXABVTDesC8@@@Z @ 173 NONAME ; void CSdpOriginField::SetUserNameL(class TDesC8 const &) + ?SetValue@CSdpBandwidthField@@QAEXK@Z @ 174 NONAME ; void CSdpBandwidthField::SetValue(unsigned long) + ?SetValue@TSdpTypedTime@@QAEX_JW4TUnit@1@@Z @ 175 NONAME ; void TSdpTypedTime::SetValue(long long, enum TSdpTypedTime::TUnit) + ?SetVersion@CSdpOriginField@@QAEX_J@Z @ 176 NONAME ; void CSdpOriginField::SetVersion(long long) + ?SetZoneAdjustmentsL@CSdpDocument@@QAEXABVTDesC8@@@Z @ 177 NONAME ; void CSdpDocument::SetZoneAdjustmentsL(class TDesC8 const &) + ?StartTime@CSdpTimeField@@QBEABVTDesC8@@XZ @ 178 NONAME ; class TDesC8 const & CSdpTimeField::StartTime(void) const + ?StopTime@CSdpTimeField@@QBEABVTDesC8@@XZ @ 179 NONAME ; class TDesC8 const & CSdpTimeField::StopTime(void) const + ?StringPoolL@SdpCodecStringPool@@SA?AVRStringPool@@XZ @ 180 NONAME ; class RStringPool SdpCodecStringPool::StringPoolL(void) + ?StringTableL@SdpCodecStringPool@@SAABUTStringTable@@XZ @ 181 NONAME ; struct TStringTable const & SdpCodecStringPool::StringTableL(void) + ?TTLValue@CSdpConnectionField@@QBEHXZ @ 182 NONAME ; int CSdpConnectionField::TTLValue(void) const + ?TimeFields@CSdpDocument@@QAEAAV?$RPointerArray@VCSdpTimeField@@@@XZ @ 183 NONAME ; class RPointerArray & CSdpDocument::TimeFields(void) + ?TimeOffsets@CSdpRepeatField@@QBEABV?$RArray@VTSdpTypedTime@@@@XZ @ 184 NONAME ; class RArray const & CSdpRepeatField::TimeOffsets(void) const + ?Uri@CSdpDocument@@QAEPAVCUri8@@XZ @ 185 NONAME ; class CUri8 * CSdpDocument::Uri(void) + ?Uri@CSdpDocument@@QBEPBVCUri8@@XZ @ 186 NONAME ; class CUri8 const * CSdpDocument::Uri(void) const + ?UserName@CSdpOriginField@@QBEABVTDesC8@@XZ @ 187 NONAME ; class TDesC8 const & CSdpOriginField::UserName(void) const + ?Value@CSdpAttributeField@@QBEABVTDesC8@@XZ @ 188 NONAME ; class TDesC8 const & CSdpAttributeField::Value(void) const + ?Value@CSdpBandwidthField@@QBEKXZ @ 189 NONAME ; unsigned long CSdpBandwidthField::Value(void) const + ?Value@CSdpFmtAttributeField@@QBEABVTDesC8@@XZ @ 190 NONAME ; class TDesC8 const & CSdpFmtAttributeField::Value(void) const + ?Version@CSdpOriginField@@QBE_JXZ @ 191 NONAME ; long long CSdpOriginField::Version(void) const + ?ZoneAdjustments@CSdpDocument@@QBEABVTDesC8@@XZ @ 192 NONAME ; class TDesC8 const & CSdpDocument::ZoneAdjustments(void) const + ?__DbgTestInvariant@CSdpAttributeField@@QBEXXZ @ 193 NONAME ABSENT; void CSdpAttributeField::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CSdpConnectionField@@QBEXXZ @ 194 NONAME ABSENT ; void CSdpConnectionField::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CSdpFmtAttributeField@@QBEXXZ @ 195 NONAME ABSENT ; void CSdpFmtAttributeField::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CSdpKeyField@@QBEXXZ @ 196 NONAME ABSENT ; void CSdpKeyField::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CSdpOriginField@@QBEXXZ @ 197 NONAME ABSENT ; void CSdpOriginField::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CSdpRepeatField@@QBEXXZ @ 198 NONAME ABSENT ; void CSdpRepeatField::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CSdpTimeField@@QBEXXZ @ 199 NONAME ABSENT ; void CSdpTimeField::__DbgTestInvariant(void) const + ?AssignTo@CSdpAttributeField@@QAEXABVCSdpFmtAttributeField@@@Z @ 200 NONAME ; void CSdpAttributeField::AssignTo(class CSdpFmtAttributeField const &) + ?BelongsTo@CSdpAttributeField@@QBEHABVCSdpFmtAttributeField@@@Z @ 201 NONAME ; int CSdpAttributeField::BelongsTo(class CSdpFmtAttributeField const &) const + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/eabi/localsdpcodecu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/eabi/localsdpcodecu.def Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,247 @@ +EXPORTS + _ZN12CSdpDocument10TimeFieldsEv @ 1 NONAME + _ZN12CSdpDocument11EmailFieldsEv @ 2 NONAME + _ZN12CSdpDocument11MediaFieldsEv @ 3 NONAME + _ZN12CSdpDocument11OriginFieldEv @ 4 NONAME + _ZN12CSdpDocument11PhoneFieldsEv @ 5 NONAME + _ZN12CSdpDocument12InternalizeLER11RReadStream @ 6 NONAME + _ZN12CSdpDocument14SetOriginFieldEP15CSdpOriginField @ 7 NONAME + _ZN12CSdpDocument15AttributeFieldsEv @ 8 NONAME + _ZN12CSdpDocument15BandwidthFieldsEv @ 9 NONAME + _ZN12CSdpDocument15ConnectionFieldEv @ 10 NONAME + _ZN12CSdpDocument15SetSessionNameLERK6TDesC8 @ 11 NONAME + _ZN12CSdpDocument18SetConnectionFieldEP19CSdpConnectionField @ 12 NONAME + _ZN12CSdpDocument19SetZoneAdjustmentsLERK6TDesC8 @ 13 NONAME + _ZN12CSdpDocument3KeyEv @ 14 NONAME + _ZN12CSdpDocument3UriEv @ 15 NONAME + _ZN12CSdpDocument4NewLEv @ 16 NONAME + _ZN12CSdpDocument5NewLCEv @ 17 NONAME + _ZN12CSdpDocument6SetKeyEP12CSdpKeyField @ 18 NONAME + _ZN12CSdpDocument6SetUriEP5CUri8 @ 19 NONAME + _ZN12CSdpDocument7DecodeLERK6TDesC8 @ 20 NONAME + _ZN12CSdpDocument8DecodeLCERK6TDesC8 @ 21 NONAME + _ZN12CSdpDocument8SetInfoLERK6TDesC8 @ 22 NONAME + _ZN12CSdpDocumentD0Ev @ 23 NONAME + _ZN12CSdpDocumentD1Ev @ 24 NONAME + _ZN12CSdpDocumentD2Ev @ 25 NONAME + _ZN12CSdpKeyField4NewLE8RStringFRK6TDesC8 @ 26 NONAME + _ZN12CSdpKeyField4SetLE8RStringFRK6TDesC8 @ 27 NONAME + _ZN12CSdpKeyField5NewLCE8RStringFRK6TDesC8 @ 28 NONAME + _ZN12CSdpKeyField7DecodeLERK6TDesC8 @ 29 NONAME + _ZN12CSdpKeyField8DecodeLCERK6TDesC8 @ 30 NONAME + _ZN12CSdpKeyFieldD0Ev @ 31 NONAME + _ZN12CSdpKeyFieldD1Ev @ 32 NONAME + _ZN12CSdpKeyFieldD2Ev @ 33 NONAME + _ZN13CSdpTimeField12RepeatFieldsEv @ 34 NONAME + _ZN13CSdpTimeField4NewLERK6TDesC8S2_ @ 35 NONAME + _ZN13CSdpTimeField5NewLCERK6TDesC8S2_ @ 36 NONAME + _ZN13CSdpTimeField7DecodeLERK6TDesC8i @ 37 NONAME + _ZN13CSdpTimeField8DecodeLCERK6TDesC8i @ 38 NONAME + _ZN13CSdpTimeField9SetTimesLERK6TDesC8S2_ @ 39 NONAME + _ZN13CSdpTimeFieldD0Ev @ 40 NONAME + _ZN13CSdpTimeFieldD1Ev @ 41 NONAME + _ZN13CSdpTimeFieldD2Ev @ 42 NONAME + _ZN13TSdpTypedTime8SetValueExNS_5TUnitE @ 43 NONAME + _ZN13TSdpTypedTimeC1Ev @ 44 NONAME + _ZN13TSdpTypedTimeC1ExNS_5TUnitE @ 45 NONAME + _ZN13TSdpTypedTimeC2Ev @ 46 NONAME + _ZN13TSdpTypedTimeC2ExNS_5TUnitE @ 47 NONAME + _ZN14CSdpMediaField11KeepFormatLERK6TDesC8 @ 48 NONAME + _ZN14CSdpMediaField11RejectMediaEv @ 49 NONAME + _ZN14CSdpMediaField12SetProtocolLE8RStringF @ 50 NONAME + _ZN14CSdpMediaField13RemoveFormatLERK6TDesC8 @ 51 NONAME + _ZN14CSdpMediaField13SetPortCountLEj @ 52 NONAME + _ZN14CSdpMediaField14SetFormatListLERK6TDesC8 @ 53 NONAME + _ZN14CSdpMediaField15AttributeFieldsEv @ 54 NONAME + _ZN14CSdpMediaField15BandwidthFieldsEv @ 55 NONAME + _ZN14CSdpMediaField16ConnectionFieldsEv @ 56 NONAME + _ZN14CSdpMediaField21FormatAttributeFieldsEv @ 57 NONAME + _ZN14CSdpMediaField3KeyEv @ 58 NONAME + _ZN14CSdpMediaField4NewLE8RStringFjS0_RK6TDesC8 @ 59 NONAME + _ZN14CSdpMediaField5NewLCE8RStringFjS0_RK6TDesC8 @ 60 NONAME + _ZN14CSdpMediaField6SetKeyEP12CSdpKeyField @ 61 NONAME + _ZN14CSdpMediaField7DecodeLERK6TDesC8i @ 62 NONAME + _ZN14CSdpMediaField8DecodeLCERK6TDesC8i @ 63 NONAME + _ZN14CSdpMediaField8SetInfoLERK6TDesC8 @ 64 NONAME + _ZN14CSdpMediaField8SetPortLEj @ 65 NONAME + _ZN14CSdpMediaField9SetMediaLE8RStringF @ 66 NONAME + _ZN14CSdpMediaFieldD0Ev @ 67 NONAME + _ZN14CSdpMediaFieldD1Ev @ 68 NONAME + _ZN14CSdpMediaFieldD2Ev @ 69 NONAME + _ZN15CSdpOriginField10SetVersionEx @ 70 NONAME + _ZN15CSdpOriginField11SetAddressLERK6TDesC88RStringFS3_ @ 71 NONAME + _ZN15CSdpOriginField12SetSessionIdEx @ 72 NONAME + _ZN15CSdpOriginField12SetUserNameLERK6TDesC8 @ 73 NONAME + _ZN15CSdpOriginField14SetInetAddressERK9TInetAddr @ 74 NONAME + _ZN15CSdpOriginField4NewLERK6TDesC8xx8RStringFS3_S2_ @ 75 NONAME + _ZN15CSdpOriginField4NewLERK6TDesC8xxR9TInetAddr @ 76 NONAME + _ZN15CSdpOriginField5NewLCERK6TDesC8xx8RStringFS3_S2_ @ 77 NONAME + _ZN15CSdpOriginField5NewLCERK6TDesC8xxR9TInetAddr @ 78 NONAME + _ZN15CSdpOriginField7DecodeLERK6TDesC8 @ 79 NONAME + _ZN15CSdpOriginField8DecodeLCERK6TDesC8 @ 80 NONAME + _ZN15CSdpOriginFieldD0Ev @ 81 NONAME + _ZN15CSdpOriginFieldD1Ev @ 82 NONAME + _ZN15CSdpOriginFieldD2Ev @ 83 NONAME + _ZN15CSdpRepeatField15SetTimeOffsetsLERK6RArrayI13TSdpTypedTimeE @ 84 NONAME + _ZN15CSdpRepeatField17SetActiveDurationE13TSdpTypedTime @ 85 NONAME + _ZN15CSdpRepeatField18SetRepeatIntervalLE13TSdpTypedTime @ 86 NONAME + _ZN15CSdpRepeatField4NewLE13TSdpTypedTimeS0_RK6RArrayIS0_E @ 87 NONAME + _ZN15CSdpRepeatField5NewLCE13TSdpTypedTimeS0_RK6RArrayIS0_E @ 88 NONAME + _ZN15CSdpRepeatField7DecodeLERK6TDesC8 @ 89 NONAME + _ZN15CSdpRepeatField8DecodeLCERK6TDesC8 @ 90 NONAME + _ZN15CSdpRepeatFieldD0Ev @ 91 NONAME + _ZN15CSdpRepeatFieldD1Ev @ 92 NONAME + _ZN15CSdpRepeatFieldD2Ev @ 93 NONAME + _ZN15TSdpRtpmapValue7DecodeLERK6TDesC8 @ 94 NONAME + _ZN15TSdpRtpmapValueC1ERK6TPtrC8S2_S2_ @ 95 NONAME + _ZN15TSdpRtpmapValueC2ERK6TPtrC8S2_S2_ @ 96 NONAME + _ZN18CSdpAttributeField4NewLE8RStringFRK6TDesC8 @ 97 NONAME + _ZN18CSdpAttributeField4SetLE8RStringFRK6TDesC8 @ 98 NONAME + _ZN18CSdpAttributeField5NewLCE8RStringFRK6TDesC8 @ 99 NONAME + _ZN18CSdpAttributeField7DecodeLERK6TDesC8 @ 100 NONAME + _ZN18CSdpAttributeField8DecodeLCERK6TDesC8 @ 101 NONAME + _ZN18CSdpAttributeFieldD0Ev @ 102 NONAME + _ZN18CSdpAttributeFieldD1Ev @ 103 NONAME + _ZN18CSdpAttributeFieldD2Ev @ 104 NONAME + _ZN18CSdpBandwidthField11SetModifierE8RStringF @ 105 NONAME + _ZN18CSdpBandwidthField4NewLE8RStringFm @ 106 NONAME + _ZN18CSdpBandwidthField5NewLCE8RStringFm @ 107 NONAME + _ZN18CSdpBandwidthField7DecodeLERK6TDesC8 @ 108 NONAME + _ZN18CSdpBandwidthField8DecodeLCERK6TDesC8 @ 109 NONAME + _ZN18CSdpBandwidthField8SetValueEm @ 110 NONAME + _ZN18CSdpBandwidthFieldD0Ev @ 111 NONAME + _ZN18CSdpBandwidthFieldD1Ev @ 112 NONAME + _ZN18CSdpBandwidthFieldD2Ev @ 113 NONAME + _ZN18SdpCodecStringPool11StringPoolLEv @ 114 NONAME + _ZN18SdpCodecStringPool12StringTableLEv @ 115 NONAME + _ZN18SdpCodecStringPool5CloseEv @ 116 NONAME + _ZN18SdpCodecStringPool5OpenLEv @ 117 NONAME + _ZN19CSdpConnectionField11SetAddressLE8RStringFS0_RK6TDesC8 @ 118 NONAME + _ZN19CSdpConnectionField15SetInetAddressLERK9TInetAddrij @ 119 NONAME + _ZN19CSdpConnectionField16SetNumOfAddressLEj @ 120 NONAME + _ZN19CSdpConnectionField4NewLE8RStringFS0_RK6TDesC8 @ 121 NONAME + _ZN19CSdpConnectionField4NewLERK9TInetAddrij @ 122 NONAME + _ZN19CSdpConnectionField5NewLCE8RStringFS0_RK6TDesC8 @ 123 NONAME + _ZN19CSdpConnectionField5NewLCERK9TInetAddrij @ 124 NONAME + _ZN19CSdpConnectionField7DecodeLERK6TDesC8 @ 125 NONAME + _ZN19CSdpConnectionField7SetTTLLEi @ 126 NONAME + _ZN19CSdpConnectionField8DecodeLCERK6TDesC8 @ 127 NONAME + _ZN19CSdpConnectionFieldD0Ev @ 128 NONAME + _ZN19CSdpConnectionFieldD1Ev @ 129 NONAME + _ZN19CSdpConnectionFieldD2Ev @ 130 NONAME + _ZN21CSdpFmtAttributeField4NewLE8RStringFRK6TDesC8S3_ @ 131 NONAME + _ZN21CSdpFmtAttributeField4SetLE8RStringFRK6TDesC8S3_ @ 132 NONAME + _ZN21CSdpFmtAttributeField5NewLCE8RStringFRK6TDesC8S3_ @ 133 NONAME + _ZN21CSdpFmtAttributeField7DecodeLERK6TDesC8 @ 134 NONAME + _ZN21CSdpFmtAttributeField8DecodeLCERK6TDesC8 @ 135 NONAME + _ZN21CSdpFmtAttributeFieldD0Ev @ 136 NONAME + _ZN21CSdpFmtAttributeFieldD1Ev @ 137 NONAME + _ZN21CSdpFmtAttributeFieldD2Ev @ 138 NONAME + _ZNK12CSdpDocument10SdpVersionEv @ 139 NONAME + _ZNK12CSdpDocument11OriginFieldEv @ 140 NONAME + _ZNK12CSdpDocument11SessionNameEv @ 141 NONAME + _ZNK12CSdpDocument12ExternalizeLER12RWriteStream @ 142 NONAME + _ZNK12CSdpDocument15ConnectionFieldEv @ 143 NONAME + _ZNK12CSdpDocument15ZoneAdjustmentsEv @ 144 NONAME + _ZNK12CSdpDocument3KeyEv @ 145 NONAME + _ZNK12CSdpDocument3UriEv @ 146 NONAME + _ZNK12CSdpDocument4InfoEv @ 147 NONAME + _ZNK12CSdpDocument6CloneLEv @ 148 NONAME + _ZNK12CSdpDocument7EncodeLER12RWriteStream @ 149 NONAME + _ZNK12CSdpDocument7IsValidEv @ 150 NONAME + _ZNK12CSdpKeyField13EncryptionKeyEv @ 151 NONAME + _ZNK12CSdpKeyField6CloneLEv @ 152 NONAME + _ZNK12CSdpKeyField6MethodEv @ 153 NONAME + _ZNK12CSdpKeyField7EncodeLER12RWriteStream @ 154 NONAME + _ZNK12CSdpKeyFieldeqERKS_ @ 155 NONAME + _ZNK13CSdpTimeField6CloneLEi @ 156 NONAME + _ZNK13CSdpTimeField7EncodeLER12RWriteStreami @ 157 NONAME + _ZNK13CSdpTimeField7IsValidEv @ 158 NONAME + _ZNK13CSdpTimeField8StopTimeEv @ 159 NONAME + _ZNK13CSdpTimeField9StartTimeEv @ 160 NONAME + _ZNK13CSdpTimeFieldeqERKS_ @ 161 NONAME + _ZNK13TSdpTypedTimeeqERKS_ @ 162 NONAME + _ZNK14CSdpMediaField10FormatListEv @ 163 NONAME + _ZNK14CSdpMediaField3KeyEv @ 164 NONAME + _ZNK14CSdpMediaField4InfoEv @ 165 NONAME + _ZNK14CSdpMediaField4PortEv @ 166 NONAME + _ZNK14CSdpMediaField5MediaEv @ 167 NONAME + _ZNK14CSdpMediaField6CloneLEi @ 168 NONAME + _ZNK14CSdpMediaField7EncodeLER12RWriteStreami @ 169 NONAME + _ZNK14CSdpMediaField7IsValidEv @ 170 NONAME + _ZNK14CSdpMediaField8ProtocolEv @ 171 NONAME + _ZNK14CSdpMediaField9PortCountEv @ 172 NONAME + _ZNK14CSdpMediaFieldeqERKS_ @ 173 NONAME + _ZNK15CSdpOriginField11AddressTypeEv @ 174 NONAME + _ZNK15CSdpOriginField11InetAddressEv @ 175 NONAME + _ZNK15CSdpOriginField6CloneLEv @ 176 NONAME + _ZNK15CSdpOriginField7AddressEv @ 177 NONAME + _ZNK15CSdpOriginField7EncodeLER12RWriteStream @ 178 NONAME + _ZNK15CSdpOriginField7NetTypeEv @ 179 NONAME + _ZNK15CSdpOriginField7VersionEv @ 180 NONAME + _ZNK15CSdpOriginField8UserNameEv @ 181 NONAME + _ZNK15CSdpOriginField9SessionIdEv @ 182 NONAME + _ZNK15CSdpOriginFieldeqERKS_ @ 183 NONAME + _ZNK15CSdpRepeatField11TimeOffsetsEv @ 184 NONAME + _ZNK15CSdpRepeatField14ActiveDurationEv @ 185 NONAME + _ZNK15CSdpRepeatField14RepeatIntervalEv @ 186 NONAME + _ZNK15CSdpRepeatField6CloneLEv @ 187 NONAME + _ZNK15CSdpRepeatField7EncodeLER12RWriteStream @ 188 NONAME + _ZNK15CSdpRepeatFieldeqERKS_ @ 189 NONAME + _ZNK15TSdpRtpmapValue7EncodeLEv @ 190 NONAME + _ZNK18CSdpAttributeField5ValueEv @ 191 NONAME + _ZNK18CSdpAttributeField6CloneLEv @ 192 NONAME + _ZNK18CSdpAttributeField7EncodeLER12RWriteStream @ 193 NONAME + _ZNK18CSdpAttributeField9AttributeEv @ 194 NONAME + _ZNK18CSdpAttributeFieldeqERKS_ @ 195 NONAME + _ZNK18CSdpBandwidthField5ValueEv @ 196 NONAME + _ZNK18CSdpBandwidthField6CloneLEv @ 197 NONAME + _ZNK18CSdpBandwidthField7EncodeLER12RWriteStream @ 198 NONAME + _ZNK18CSdpBandwidthField8ModifierEv @ 199 NONAME + _ZNK18CSdpBandwidthFieldeqERKS_ @ 200 NONAME + _ZNK19CSdpConnectionField11AddressTypeEv @ 201 NONAME + _ZNK19CSdpConnectionField11InetAddressEv @ 202 NONAME + _ZNK19CSdpConnectionField12NumOfAddressEv @ 203 NONAME + _ZNK19CSdpConnectionField6CloneLEv @ 204 NONAME + _ZNK19CSdpConnectionField7AddressEv @ 205 NONAME + _ZNK19CSdpConnectionField7EncodeLER12RWriteStream @ 206 NONAME + _ZNK19CSdpConnectionField7NetTypeEv @ 207 NONAME + _ZNK19CSdpConnectionField8TTLValueEv @ 208 NONAME + _ZNK19CSdpConnectionFieldeqERKS_ @ 209 NONAME + _ZNK21CSdpFmtAttributeField5ValueEv @ 210 NONAME + _ZNK21CSdpFmtAttributeField6CloneLEv @ 211 NONAME + _ZNK21CSdpFmtAttributeField6FormatEv @ 212 NONAME + _ZNK21CSdpFmtAttributeField7EncodeLER12RWriteStream @ 213 NONAME + _ZNK21CSdpFmtAttributeField9AttributeEv @ 214 NONAME + _ZNK21CSdpFmtAttributeFieldeqERKS_ @ 215 NONAME + _ZTI12CSdpDocument @ 216 NONAME ; ## + _ZTI12CSdpKeyField @ 217 NONAME ; ## + _ZTI13CSdpTimeField @ 218 NONAME ; ## + _ZTI14CSdpMediaField @ 219 NONAME ; ## + _ZTI15CSdpOriginField @ 220 NONAME ; ## + _ZTI15CSdpRepeatField @ 221 NONAME ; ## + _ZTI18CSdpAttributeField @ 222 NONAME ; ## + _ZTI18CSdpBandwidthField @ 223 NONAME ; ## + _ZTI18CSdpCodecParseUtil @ 224 NONAME ; ## + _ZTI19CSdpCodecStringPool @ 225 NONAME ; ## + _ZTI19CSdpConnectionField @ 226 NONAME ; ## + _ZTI21CSdpFmtAttributeField @ 227 NONAME ; ## + _ZTV12CSdpDocument @ 228 NONAME ; ## + _ZTV12CSdpKeyField @ 229 NONAME ; ## + _ZTV13CSdpTimeField @ 230 NONAME ; ## + _ZTV14CSdpMediaField @ 231 NONAME ; ## + _ZTV15CSdpOriginField @ 232 NONAME ; ## + _ZTV15CSdpRepeatField @ 233 NONAME ; ## + _ZTV18CSdpAttributeField @ 234 NONAME ; ## + _ZTV18CSdpBandwidthField @ 235 NONAME ; ## + _ZTV18CSdpCodecParseUtil @ 236 NONAME ; ## + _ZTV19CSdpCodecStringPool @ 237 NONAME ; ## + _ZTV19CSdpConnectionField @ 238 NONAME ; ## + _ZTV21CSdpFmtAttributeField @ 239 NONAME ; ## + _ZN18CSdpAttributeField8AssignToERK21CSdpFmtAttributeField @ 240 NONAME + _ZNK18CSdpAttributeField9BelongsToERK21CSdpFmtAttributeField @ 241 NONAME + _ZTI22CSdpAttributeFieldPtrs @ 242 NONAME ; ## + _ZTV22CSdpAttributeFieldPtrs @ 243 NONAME ; ## + _ZTI19CSdpOriginFieldPtrs @ 244 NONAME ; ## + _ZTV19CSdpOriginFieldPtrs @ 245 NONAME ; ## + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/group/localsdpcodec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/group/localsdpcodec.mmp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,67 @@ +// Copyright (c) 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: +// Name : localsdpcodec is a local copy of the sdpcodec.dll added here to avoid mw dependency +// Part of : Local SDP Codec +// Version : SIP/5.0 +// + + + +TARGET localsdpcodec.dll +TARGETTYPE dll +UID 0x1000008d 0x200305C5 + +SOURCEPATH ../src +SOURCE sdpattributefield.cpp +SOURCE sdpattributefieldptrs.cpp +SOURCE sdpbandwidthfield.cpp +SOURCE sdprepeatfield.cpp +SOURCE sdptimefield.cpp +SOURCE sdptypedtime.cpp +SOURCE sdpconnectionfield.cpp +SOURCE sdpdocument.cpp +SOURCE sdpfmtattributefield.cpp +SOURCE sdpkeyfield.cpp +SOURCE sdpmediafield.cpp +SOURCE sdporiginfield.cpp +SOURCE sdporiginfieldptrs.cpp +SOURCE sdprtpmapvalue.cpp +SOURCE sdputil.cpp +SOURCE sdpcodecstringpool.cpp +SOURCE csdpcodecstringpool.cpp +SOURCE sdpcodecparseutil.cpp + + SOURCEPATH ../strings + START STRINGTABLE localsdpcodecstringconstants.st + EXPORTPATH /epoc32/include + END + +USERINCLUDE ../api +USERINCLUDE ../inc +USERINCLUDE ../src + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY insock.lib +LIBRARY esock.lib +LIBRARY estor.lib +LIBRARY bafl.lib +LIBRARY inetprotutil.lib + +VENDORID 0x70000001 + +CAPABILITY All -Tcb + +SMPSAFE diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/csdpcodecstringpool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/csdpcodecstringpool.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecStringPool.h +* Part of : Local SDP Codec +* Interface : SDK API, Local SDP Codec API +* Version : 1.0 +* +*/ + + + + +/** + @internalComponent +*/ + +#ifndef CSDPCODECSTRINGPOOL_H +#define CSDPCODECSTRINGPOOL_H + +// INCLUDES +#include +#include "_sdpdefs.h" +#include + + +// CLASS DECLARATION +/** + * This class defines string pool for SdpCodec. + * Only one CSdpCodecStringPool object must be created in an application. + * If more than one CSdpCodecStringPool objects are used by an + * application with CSdpDocument objects, panic occurs. + * + * @lib localsdpcodec.lib + */ +class CSdpCodecStringPool : public CBase + { +public: // Constructors and destructor + + /** + * StringPool is created for SdpCodec. + * + * @return The new instance. + */ + static CSdpCodecStringPool* NewLC(); + + /** + * Deletes the resources held by the instance. + */ + ~CSdpCodecStringPool(); + +public: + + /** + * Gets the string pool used by SDP + * + * @return a handle to a string pool + */ + RStringPool StringPool(); + + /** + * Gets the SDP's string pool table + * + * @return the string pool table + */ + static const TStringTable& StringTable(); + +private: + + CSdpCodecStringPool(); + void ConstructL(); + +private: // Data + + RStringPool iPool; + }; + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpattributefieldptrs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpattributefieldptrs.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 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: +* Name : SdpAttributeFieldPtrs.h +* Part of : Local SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + + +/** + @internalComponent +*/ + +#ifndef CSDPATTRIBUTEFIELDPTRS_H +#define CSDPATTRIBUTEFIELDPTRS_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CSdpFmtAttributeField; + +// CLASS DECLARATION +/** + * This class encapsulates the data of CSdpAttributeField. + * + * @lib localsdpcodec.lib + */ +class CSdpAttributeFieldPtrs : public CBase + { + public: + + static CSdpAttributeFieldPtrs* NewL(); + ~CSdpAttributeFieldPtrs(); + + void SetValueL( const TDesC8& aValue ); + const TDesC8& Value() const; + + void SetFmtAttribute( const CSdpFmtAttributeField* aFmtAttribute ); + const CSdpFmtAttributeField* FmtAttribute() const; + + private: // Second phase constructors + + CSdpAttributeFieldPtrs(); + void ConstructL(); + + private: // Data + + HBufC8* iValue; // Owned + const CSdpFmtAttributeField* iFmtAttributeField; // Not owned + }; + +#endif // CSDPATTRIBUTEFIELDPTRS_H + +// End of File diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodec.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodec.pan Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,32 @@ +// Copyright (c) 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: +// Name : SdpCodec.pan +// Part of : SDP Codec +// Interface : - +// Version : 1.0 +// + + + +#ifndef SDPCODEC_PAN +#define SDPCODEC_PAN + +// Panic category for SDP Codec +_LIT(KSdpCodecPanicCat, "SDPCODEC"); + +// Panic codes for SDP Codec +const TInt KSdpCodecPanicInternal = 100; // Internal error +const TInt KSdpConstructor = 101; // Constructor fails + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodecparseutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodecparseutil.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecParseUtil.h +* Part of : Local SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + + +/** + @internalComponent +*/ + +#ifndef CSDPCODECPARSEUTIL_H +#define CSDPCODECPARSEUTIL_H + +// INCLUDES +#include +#include +#include "_sdpdefs.h" +#include +#include "badesca.h" +class CSdpTimeField; +class CSdpBandwidthField; +class CSdpAttributeField; +class CSdpMediaField; +class CSdpOriginField; +class CUri8; +class CSdpConnectionField; +class CSdpKeyField; +class RReadStream; +class RWriteStream; + +// CLASS DECLARATION +/** + * Common utilities used in the implementation of the Local SDP codec. + */ +class CSdpCodecParseUtil :public CBase + { + public: // Constructors and destructor + + /** + * Construct a new, CSdpCodecParseUtil object. + * @return The new instance. + */ + static CSdpCodecParseUtil* NewL(RStringPool aPool,const TDesC8& aValue, + TInt aErrCode); + + /** + * Construct a new, CSdpCodecParseUtil object. + * @return The new instance. + */ + static CSdpCodecParseUtil* NewLC(RStringPool aPool,const TDesC8& aValue, + TInt aErrCode); + + ~CSdpCodecParseUtil(); + + public: // New functions + + static TPtrC8 FieldLineValueL(const TDesC8& aValue); + static RArray CheckFieldNameL(RStringPool aPool, + TInt aIndex, + const TDesC8& aValue, + TInt aErrCode); + static RArray CheckOptionalFieldNameL(RStringPool aPool, + TInt aIndex, + const TDesC8& aValue, + TInt aErrCode); + TUint ParseSessionVersionL(TInt aErrCode); + CSdpOriginField* ParseSessionOwnerL(TInt aErrCode); + const TDesC8& ParseSessionNameL(TInt aErrCode); + const TDesC8& ParseInformationL(TInt aErrCode); + CUri8* ParseUriL(TInt aErrCode); + CDesC8ArraySeg* ParseEmailL(TInt aErrCode); + CDesC8ArraySeg* ParsePhoneL(TInt aErrCode); + CSdpConnectionField* ParseConnectionL(TInt aErrCode); + RPointerArray* ParseBandwidthL(TInt aErrCode); + RPointerArray* ParseConnectionFieldsL(TInt aErrCode); + RPointerArray* ParseTimeFieldL(TInt aErrCode); + const TDesC8& ParseZoneAdjustmentL(TInt aErrCode); + CSdpKeyField* ParseEncryptionKeyL(TInt aErrCode); + RPointerArray* ParseAttributeFieldL(TInt aErrCode); + RPointerArray* ParseMediaLevelL (); + RArray FirstLineArrayElementL(RStringPool aPool, + TInt aIndex, + TInt aErrCode); + + RArray& LineArray(); + + private: + + CSdpCodecParseUtil(); + + void ConstructL(RStringPool aPool,const TDesC8& aValue,TInt aErrCode); + + private: // Data + RArray iLineArray; + RArray iElementArray; + RStringPool iPool; + RPointerArray* iTimeFields; + RPointerArray* iBandwidthFields; + RPointerArray* iAttributeFields; + RPointerArray* iMediaFields; + RPointerArray* iConnectionFields; + CDesC8ArraySeg* iEmailFields; + CDesC8ArraySeg* iPhoneFields; + HBufC8* iToken; + TPtrC8 iData; + }; + +#endif // CSDPCODECPARSEUTIL_H diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodecstringconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodecstringconstants.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2009 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: +* +*/ +// Autogenerated from epoc32/build/cafstreamingsupport/c_f439661e83f96b9c/localsdpcodec_dll/sdpcodecstringconstants.st by the stringtable tool - Do not edit + +#ifndef STRINGTABLE_SdpCodecStringConstants +#define STRINGTABLE_SdpCodecStringConstants + +#include + +struct TStringTable; + +/** + * @publishedAll + * @released +*/ +class SdpCodecStringConstants + { +public: + enum TStrings + { + // SDP field names: + /** v= */ + EVersion, + /** o= */ + EOrigin, + /** s= */ + ESession, + /** i= */ + EInfo, + /** u= */ + EUri, + /** e= */ + EEmail, + /** p= */ + EPhone, + /** c= */ + EConnection, + /** b= */ + EBandwidth, + /** z= */ + EZone, + /** k= */ + EKey, + /** a= */ + EAttribute, + /** t= */ + ETime, + /** r= */ + ERepeat, + /** m= */ + EMedia, + // Predefined bandwidth modifiers: + /** CT */ + EModifierCT, + /** AS */ + EModifierAS, + // Typed time units: + /** d */ + ETimeUnitDays, + /** h */ + ETimeUnitHours, + /** m */ + ETimeUnitMinutes, + /** s */ + ETimeUnitSeconds, + // No typed time unit defined: + /** */ + ETimeUnitNone, + // Predefined encryption methods: + /** clear */ + EMethodClear, + /** base64 */ + EMethodBase64, + /** uri */ + EMethodUri, + /** prompt */ + EMethodPrompt, + // Predefined attributes: + /** cat */ + EAttributeCat, + /** keywds */ + EAttributeKeywds, + /** tool */ + EAttributeTool, + /** ptime */ + EAttributePtime, + /** maxptime */ + EAttributeMaxptime, + /** recvonly */ + EAttributeRecvonly, + /** sendrecv */ + EAttributeSendrecv, + /** sendonly */ + EAttributeSendonly, + /** inactive */ + EAttributeInactive, + /** orient */ + EAttributeOrient, + // Predefined Orient attribute values + /** portrait */ + EAttributeOrientValuePortrait, + /** landscape */ + EAttributeOrientValueLandscape, + /** seascape */ + EAttributeOrientValueSeascape, + /** type */ + EAttributeType, + /** charset */ + EAttributeCharset, + /** sdplang */ + EAttributeSdplang, + /** lang */ + EAttributeLang, + /** framerate */ + EAttributeFramerate, + /** quality */ + EAttributeQuality, + /** control */ + EAttributeControl, + /** range */ + EAttributeRange, + /** etag */ + EAttributeEtag, + /** des */ + EAttributeDes, + /** curr */ + EAttributeCurr, + /** conf */ + EAttributeConf, + // Predefined Strength tag for Curr, Conf and Des attributes + /** mandatory */ + EAttributeStatusStrengthTagMandatory, + /** optional */ + EAttributeStatusStrengthTagOptional, + /** none */ + EAttributeStatusStrengthTagNone, + /** failure */ + EAttributeStatusStrengthTagFailure, + /** unknown */ + EAttributeStatusStrengthTagUnknown, + // Predefined Status type for Curr, Conf and Des attributes + /** e2e */ + EAttributeStatusTypeE2e, + /** local */ + EAttributeStatusTypeLocal, + /** remote */ + EAttributeStatusTypeRemote, + // Predefined Direction tag for Curr, Conf and Des attributes + /** none */ + EAttributeStatusDirectionTagNone, + /** send */ + EAttributeStatusDirectionTagSend, + /** recv */ + EAttributeStatusDirectionTagRecv, + /** sendrecv */ + EAttributeStatusDirectionTagSendrecv, + /** mid */ + EAttributeMid, + /** group */ + EAttributeGroup, + // Predefined semantics for Group attribute + /** LS */ + EAttributeGroupSemanticLS, + /** FID */ + EAttributeGroupSemanticFID, + /** SRF */ + EAttributeGroupSemanticSRF, + /** rtpmap */ + EAttributeRtpmap, + /** fmtp */ + EAttributeFmtp, + // Predefined media types: + /** audio */ + EMediaAudio, + /** video */ + EMediaVideo, + /** application */ + EMediaApplication, + /** data */ + EMediaData, + /** control */ + EMediaControl, + /** image */ + EMediaImage, + // Predefined media transport protocols: + /** RTP/AVP */ + EProtocolRtpAvp, + /** udp */ + EProtocolUdp, + /** TCP */ + EProtocolTcp, + // Network type: + /** IN */ + ENetType, + // Address types: + /** IP4 */ + EAddressTypeIP4, + /** IP6 */ + EAddressType + }; + static const TStringTable Table; + }; + +#endif // STRINGTABLE_SdpCodecStringConstants + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodectemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodectemplate.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecTemplate.h +* Part of : Local SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + + +/** + @internalComponent +*/ + +#ifndef SDPCODECTEMPLATE_H +#define SDPCODECTEMPLATE_H + +// INCLUDES +#include +#include + +#include "_sdpdefs.h" +#include "e32std.h" +#include "stringpool.h" + +class RReadStream; +class RWriteStream; + +template class SdpCodecTemplate + { + public: + + static void ExternalizeL(const T* aElement, RWriteStream& aWriteStream); + static void ExternalizeArrayL(RPointerArray aArray,RWriteStream& aStream); + static void EncodeArrayL(RPointerArray aArray, RWriteStream& aStream); + static void EncodeL(const T* aElement, RWriteStream& aWriteStream); + static void InternalizeArrayL(RPointerArray& aArray, RReadStream& aStream); + static void + CloneArrayL(RPointerArray& aArray, RPointerArray aSourceArray); + + }; + +#include "SdpCodecTemplate.inl" + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodectemplate.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodectemplate.inl Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 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: +* Name : SdpCodecTemplate.inl +* Part of : SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + +#ifndef SDPCODECTEMPLATE_INL +#define SDPCODECTEMPLATE_INL + +// INCLUDES +#include +#include + +#include "_sdpdefs.h" +#include "e32std.h" + +class RReadStream; +class RWriteStream; + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::ExternalizeL +// --------------------------------------------------------------------------- +// +template void SdpCodecTemplate::ExternalizeL(const T* aElement, + RWriteStream& aWriteStream) + { + if(aElement) + { + aWriteStream.WriteUint8L (1); + aElement->ExternalizeL(aWriteStream); + } + else + { + aWriteStream.WriteUint8L (0); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::ExternalizeArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::ExternalizeArrayL(RPointerArray aArray, + RWriteStream& aStream) + { + aStream.WriteUint32L (aArray.Count()); + for (TInt i = 0;i < aArray.Count();i++) + { + aArray[i]->ExternalizeL(aStream); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::EncodeArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::EncodeArrayL(RPointerArray aArray, RWriteStream& aStream) + { + for (TInt i = 0;i < aArray.Count();i++) + { + aArray[i]->EncodeL(aStream); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::EncodeL +// --------------------------------------------------------------------------- +// +template void SdpCodecTemplate::EncodeL(const T* aElement, + RWriteStream& aWriteStream) + { + if(aElement) + { + aElement->EncodeL(aWriteStream); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::InternalizeArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::InternalizeArrayL(RPointerArray& aArray, + RReadStream& aStream) + { + TInt count = aStream.ReadUint32L(); + for (TInt i = 0;i < count;i++) + { + T* obj = T::InternalizeL(aStream); + CleanupStack::PushL(obj); + User::LeaveIfError(aArray.Append(obj)); + CleanupStack::Pop();//obj + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::CloneArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::CloneArrayL(RPointerArray& aArray, + RPointerArray aSourceArray) + { + for (TInt i=0; i < (aSourceArray).Count(); i++) + { + T* obj = aSourceArray[i]->CloneL(); + CleanupStack::PushL(obj); + User::LeaveIfError(aArray.Append(obj)); + CleanupStack::Pop();//obj + } + } + + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdporiginfieldptrs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdporiginfieldptrs.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 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: +* Name : SdpOriginFieldPtrs.h +* Part of : Local SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + + +/** + @internalComponent +*/ + +#ifndef CSDPORIGINFIELDPTRS_H +#define CSDPORIGINFIELDPTRS_H + +// INCLUDES +#include + +// CONSTANTS +const TUint KMaxTInt64Digits = 30; + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +/** + * This class encapsulates the data of CSdpAttributeField. + * + * @lib localsdpcodec.lib + */ +class CSdpOriginFieldPtrs : public CBase + { + public: + + static CSdpOriginFieldPtrs* NewL( TInt64 aSessionId, + TInt64 aSessionVersion ); + ~CSdpOriginFieldPtrs(); + + void SetUserNameL( const TDesC8& aUserName ); + const TDesC8& UserName() const; + + void SetSessionIdL( const TDesC8& aSessionId ); + void SetSessionIdL( TInt64 aSessionId ); + const TDesC8& SessionId() const; + + void SetSessionVersionL( const TDesC8& aSessionVersion ); + void SetSessionVersionL( TInt64 aSessionVersion ); + const TDesC8& SessionVersion() const; + + private: // Second phase constructors + + CSdpOriginFieldPtrs(); + void ConstructL( TInt64 aSessionId, TInt64 aSessionVersion ); + + private: // Data + + // Owned + HBufC8* iUserName; + // Owned + HBufC8* iSessionId; + // Owned + HBufC8* iSessionVersion; + }; + +#endif // CSDPORIGINFIELDPTRS_H + +// End of File diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdputil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdputil.h Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,316 @@ +/* +* Copyright (c) 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: +* Name : SdpUtil.h +* Part of : Local SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + + +/** + @internalComponent +*/ + +#ifndef SDPUTIL_H +#define SDPUTIL_H + +// INCLUDES +#include +#include +#include +#include "_sdpdefs.h" + +// FORWARD DECLARATIONS +class RReadStream; +class RWriteStream; +class CSdpConnectionField; +class CSSdpKeyField; +class CSdpOriginField; +class TInetAddr; + +// CLASS DECLARATION +/** + * Common utilities used in the implementation of the Local SDP codec. + * Utility class, cannot be instantiated + */ +class SdpUtil + { + + public: // New functions + + /** + * Generic method that checks that all aValue's chars are not on illegal charset + * + * @param aIllegalChars Illegal character set + * @param aValue String to be checked + * @param aStart Start position of the string + * @param aEnd End position of the string + * @return Validity of the string + */ + static TBool IsValidCharSet( + const TDesC8& aIllegalChars, const TDesC8& aValue, TInt aStart, TInt aEnd ); + + /** + * Checks that token list is valid (tokens with space as delimiter) + * + * @param aValue String containing tokens + * @return Validity of the string + */ + static TBool IsTokenList( const TDesC8& aValue ); + + /** + * Checks that the token is valid (substring inside string) + * + * @param aValue String containing the token + * @param aStart Start position of the token inside the string + * @param aEnd End position of the token inside the string + * @return Validity of the token + */ + static TBool IsToken( const TDesC8& aValue, TInt aStart, TInt aEnd ); + + /** + * Checks that the token is valid + * + * @param aValue Token string + * @return Validity of the token + */ + static TBool IsToken( const TDesC8& aValue ); + + /** + * Checks that the byte string is valid (substring inside string) + * + * @param aValue String + * @param aStart Start position of the byte string inside the string + * @param aEnd End position of the byte string inside the string + * @return Validity of the byte string + */ + static TBool IsByteString( const TDesC8& aValue, TInt aStart, TInt aEnd ); + + /** + * Checks that the byte string is valid + * + * @param aValue String containing the token + * @return Validity of the byte string + */ + static TBool IsByteString( const TDesC8& aValue ); + + /** + * Checks that the substring is a token-byte string pair with colon char + * as delimiter of the two strings + * + * @param aValue String containing the pair + * @param aStart Start position of the string pair + * @param aEnd End position of the string pair + * @return Validity of the pair + */ + static TBool IsTokenTextPair( + const TDesC8& aValue, TInt aStart, TInt aEnd ); + + /** + * Checks that the string conatins valid token-byte string pair with color + * char as delimiter of the two strings + * + * @param aValue String containing the pair + * @return Validity of the byte string + */ + static TBool IsTokenTextPair( const TDesC8& aValue ); + + /** + * Checks that the string does not contain any whitespace characters + * + * @param aValue String + * @return Validity of the string + */ + static TBool IsNonWhitespace( const TDesC8& aValue ); + + /** + * Checks that the string contains a valid NTP-time element + * + * @param aValue String + * @return Validity of the string + */ + static TBool IsValidNtpTime( const TDesC8& aValue ); + + /** + * Divides the buffer into a number of lines. Each line is marked + * as a TPtrC8 object and added to array that is returned to the user + * NOTE! Each line in the returned array ends in LF character + * NOTE! The aLines must end in LF character, not '\0' character + * + * @param aLines Buffer that contains all the string + * @param aErrCode Error code that is used on leave situations, when the + * aLines parameter contains invalid string set + * @return Array that contains the division of buffer to lines + */ + static RArray DivideToLinesL( + const TDesC8& aLines, TInt aErrCode ); + + /** + * Parses elements from each line. The first item in the returned array + * is the field attribute and equal character (e.g. "a=", "c="), following + * elements are parsed from the string using space character as delimiter + * + * @param aLine String containing line that ends to LF character + * @param aErrCode Error code that is used on leave situations, when + * the contents of aLine are illegal + * @return Array that contains the division of string to elements + */ + static RArray GetElementsFromLineL( + const TDesC8& aLine, TInt aErrCode ); + + /** + * Parses elements from each line. The first item in the returned array + * is the field attribute and equal character (e.g. "a=", "c="), following + * elements are parsed from the string using aDelimiter as delimiter + * + * @param aLine String containing line that ends to LF character + * @param aDelimiter Delimiter character + * @param aErrCode Error code that is used on leave situations, when + * the contents of aLine are illegal + * @return Array that contains the division of string to elements + */ + static RArray GetElementsFromLineL( + const TDesC8& aLine, TChar aDelimiter, TInt aErrCode ); + + /** + * Parses elements from each line. The first item in the returned array + * is the field attribute and equal character (e.g. "a=", "c="), following + * elements are parsed from the string using space character as delimiter + * + * @param aLexer Lexer that has been initialized with the string + * @param aErrCode Error code that is used on leave situations, when + * the contents of aLine are illegal + * @return Array that contains the division of string to elements + */ + static RArray GetElementsFromLineL( + TLex8& aLexer, TChar aDelimiter, TInt aErrCode ); + + /** + * Checks if the string contains only POS-DIGIT characters + * + * @param aDes String + * @return Validity of POS-DIGIT string + */ + static TBool IsPosDigit( const TDesC8& aDes ); + + /** + * Checks if the string contains only DIGIT characters + * + * @param aDes String + * @return Validity of DIGIT string + */ + static TBool IsDigit( const TDesC8& aDes ); + + /** + * Checks if the string contains valid characters + * + * @param aValidChars Valid characters allowed in the string + * @param aDes String + * @return Validity of the string + */ + static TBool IsValidChars( const TDesC8& aValidChars, const TDesC8& aDes ); + + /** + * Checks if the string contains only token characters + * + * @param aValue String + * @return Validity of the string + */ + static TBool IsTokenChar( const TDesC8& aValue ); + + /** + * Checks if the character is a valid token character + * + * @param aChar Character + * @return Validity of the character + */ + static TBool IsTokenChar( TChar aChar ); + + /** + * Checks if the string is a valid token. The string can contain slash character, + * which divides the line into two tokens. The two tokens are then individually + * verified. + * + * @param aValue String + * @return Validity of the string + */ + static TBool IsTokenCharWithOptionalSlash( const TDesC8& aValue ); + + /** + * Checks if the string is a valid token. The string can contain space characters, + * which divides the string into a number of tokens. Each token is then individually + * verified. + * + * @param aValue String + * @return Validity of the string + */ + static TBool IsTokenCharWithSpacesL( const TDesC8& aValue ); + + /** + * Checks if the string is a valid token. The string can contain slash character, + * which divides the line into two tokens. The two tokens are then individually + * verified. + * + * @param aValue String + * @return Validity of the string + */ + static void EncodeBufferL( + const TDesC8& aValue, TInt aIndex, RWriteStream& aStream ); + + /** + * Sets default network type ("IN") and default address type ("IP4" or "IP6") + * to variables given as parameters + * + * @param aPool String pool + * @param aInetAddr Internet address + * @param aNetType Network type + * @param aAddressType Address type + */ + static void SetDefaultNetTypeAndAddrType( + RStringPool aPool, const TInetAddr& aAddress, + RStringF& aNetType, RStringF& aAddressType ); + + /** + * Skips spaces until next line break, if the line break can be found. + * @param aLexer + * @return ETrue if the line break was found, otherwise EFalse. + */ + static TBool SkipSpacesUntilNextLineBreak( TLex8& aLexer ); + + private: + + /** + * After the field tag has been parsed out, all the field elements are + * parsed in this method + * + * @param aArray Reference to the array that contains the chopped elements + * @param aLexer Used lexer + * @param aDelimiter Delimiter character that determines the separation of elements + * @param aErrCode The error code that is used on leaves, when the argument is invalid + */ + static void ChopElementsFromLineL( + RArray& aArray, TLex8& aLexer, TChar aDelimiter, TInt aErrCode ); + + /** + * Private constructor + * This class can never be instantiated + */ + SdpUtil(); + }; + +#endif diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/csdpcodecstringpool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/csdpcodecstringpool.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,82 @@ +// Copyright (c) 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: +// Name : CSdpCodecStringPool.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "csdpcodecstringpool.h" +#include "sdpcodecstringconstants.h" +#include "_sdpdefs.h" + + +// ---------------------------------------------------------------------------- +// CSdpCodecStringPool::NewLC +// ---------------------------------------------------------------------------- +// +CSdpCodecStringPool* CSdpCodecStringPool::NewLC() + { + CSdpCodecStringPool* self = new(ELeave)CSdpCodecStringPool; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// CSdpCodecStringPool::~CSdpCodecStringPool +// ---------------------------------------------------------------------------- +// +CSdpCodecStringPool::~CSdpCodecStringPool() + { + iPool.Close(); + } + +// ---------------------------------------------------------------------------- +// CSdpCodecStringPool::StringPool +// ---------------------------------------------------------------------------- +// +RStringPool CSdpCodecStringPool::StringPool() + { + return iPool; + } + +// ---------------------------------------------------------------------------- +// CSdpCodecStringPool::StringTable +// ---------------------------------------------------------------------------- +// +const TStringTable& CSdpCodecStringPool::StringTable() + { + return SdpCodecStringConstants::Table; + } + +// ---------------------------------------------------------------------------- +// CSdpCodecStringPool::CSdpCodecStringPool +// ---------------------------------------------------------------------------- +// +CSdpCodecStringPool::CSdpCodecStringPool() + { + } + +// ---------------------------------------------------------------------------- +// CSdpCodecStringPool::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpCodecStringPool::ConstructL() + { + iPool.OpenL(SdpCodecStringConstants::Table); + } + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpattributefield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpattributefield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,986 @@ +// Copyright (c) 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: +// Name : SdpAttributeField.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include +#include "sdpattributefield.h" +#include "sdpattributefieldptrs.h" +#include "sdpfmtattributefield.h" +#include "sdputil.h" +#include "sdpcodec.pan" +#include "sdpcodecstringconstants.h" +#include "sdpcodecconstants.h" +#include "sdpcodecstringpool.h" +#include "sdprtpmapvalue.h" +#include "sdpcodecerr.h" +#include "_sdpdefs.h" + +// CONSTANTS +const TInt KHeaderIndex = 0; +const TInt KAttributeIndex = 1; +const TInt KMinAttributeNum = 2; +const TInt KMaxSubtagLength = 8; +const TInt KMaxPrimarySubtagLength = 8; + +// Valid property attribute strings +const TInt KPropertyStringNum = 4; +const SdpCodecStringConstants::TStrings + KValidPropertyStrings[KPropertyStringNum] = + { + SdpCodecStringConstants::EAttributeRecvonly, + SdpCodecStringConstants::EAttributeSendrecv, + SdpCodecStringConstants::EAttributeSendonly, + SdpCodecStringConstants::EAttributeInactive + }; + +// Valid value attribute strings +const TInt KValueStringNum = 22; +const SdpCodecStringConstants::TStrings KValidValueStrings[KValueStringNum] = + { + SdpCodecStringConstants::EAttributeCat, + SdpCodecStringConstants::EAttributeKeywds, + SdpCodecStringConstants::EAttributeTool, + SdpCodecStringConstants::EAttributePtime, + SdpCodecStringConstants::EAttributeMaxptime, + SdpCodecStringConstants::EAttributeRtpmap, + SdpCodecStringConstants::EAttributeOrient, + SdpCodecStringConstants::EAttributeType, + SdpCodecStringConstants::EAttributeCharset, + SdpCodecStringConstants::EAttributeSdplang, + SdpCodecStringConstants::EAttributeLang, + SdpCodecStringConstants::EAttributeFramerate, + SdpCodecStringConstants::EAttributeQuality, + SdpCodecStringConstants::EAttributeFmtp, + SdpCodecStringConstants::EAttributeControl, + SdpCodecStringConstants::EAttributeEtag, + SdpCodecStringConstants::EAttributeMid, + SdpCodecStringConstants::EAttributeGroup, + SdpCodecStringConstants::EAttributeCurr, + SdpCodecStringConstants::EAttributeDes, + SdpCodecStringConstants::EAttributeConf, + SdpCodecStringConstants::EAttributeRange + }; + +// Valid orient value strings +const TInt KValidOrientStringNum = 3; +static const TText8* const KOrientStrings[KValidOrientStringNum] = + { + _S8("portrait\0"), + _S8("landscape\0"), + _S8("seascape\0") + }; + +const TInt KValidGroupSemanticsNum = 3; +static const TText8* const KGroupSemantics[KValidGroupSemanticsNum] = + { + _S8("LS"), + _S8("FID"), + _S8("SRF") + }; + +const TInt KValidStatusTypeNum = 3; +static const TText8* const KStatusTypes[KValidStatusTypeNum] = + { + _S8("e2e"), + _S8("local"), + _S8("remote") + }; + +const TInt KValidDirectionTagsNum = 4; +static const TText8* const KDirectionTags[KValidDirectionTagsNum] = + { + _S8("none"), + _S8("send"), + _S8("recv"), + _S8("sendrecv") + }; + +const TInt KValidStrengthTagsNum = 5; +static const TText8* const KStrengthTags[KValidStrengthTagsNum] = + { + _S8("mandatory"), + _S8("optional"), + _S8("none"), + _S8("failure"), + _S8("unknown") + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CSdpAttributeField +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSdpAttributeField::CSdpAttributeField() + { + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::ConstructL( const TDesC8& aText ) + { + // aText should be in format + // a= or a=: or + // a=: + + __ASSERT_ALWAYS(aText.Length() > 0, User::Leave(KErrSdpCodecAttributeField)); + + iPool = SdpCodecStringPool::StringPoolL(); + CreateAttributeFieldPtrsL(); + + RArray array; + + TInt length = aText.Length(); + if ( aText[aText.Length() - 1] == KLFChar ) + { + if ( length > 1 && aText[aText.Length() - 2] == KCRChar ) + { + length--; + } + length--; + } + TPtrC8 restValue( aText.Left( length )); + + __ASSERT_ALWAYS(SdpUtil::IsByteString(restValue) + || SdpUtil::IsToken(restValue) + || SdpUtil::IsValidChars(KEqualStr, restValue), + User::Leave(KErrSdpCodecAttributeField)); + + array = SdpUtil::GetElementsFromLineL( aText, KErrSdpCodecAttributeField ); + CleanupClosePushL( array ); + + RStringF origHeader = iPool.StringF( SdpCodecStringConstants::EAttribute, + SdpCodecStringConstants::Table ); + + // We need to have at least two tokens (and this should be always the case, + // unless TSdpUtil::GetElementsFromLineL() gets modified) + __ASSERT_ALWAYS( origHeader.DesC().Compare( array[KHeaderIndex] ) == 0 + && array.Count() >= KMinAttributeNum, + User::Leave( KErrSdpCodecAttributeField ) ); + + if ( array[KAttributeIndex].Locate( KColonChar ) == KErrNotFound ) + { + // For property attributes exactly two attributes are needed + __ASSERT_ALWAYS( array.Count() == KMinAttributeNum, + User::Leave( KErrSdpCodecAttributeField )); + + FormatProperyAttributeL( array[KAttributeIndex] ); + } + else + { + HBufC8* attribute = NULL; + HBufC8* value = NULL; + CreateAttributeAndValueStringsLC( array, attribute, value ); + FormatValueAttributeL( *attribute, *value ); + CleanupStack::PopAndDestroy( 2 ); // attribute, value + } + + CleanupStack::PopAndDestroy(); // array + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::ConstructL( RStringF aAttribute, + const TDesC8& aValue ) + { + iPool = SdpCodecStringPool::StringPoolL(); + CreateAttributeFieldPtrsL(); + + TBool property( EFalse ); + for ( TInt i( 0 ); i < KPropertyStringNum && !property; i++ ) + { + if ( aAttribute == + iPool.StringF( KValidPropertyStrings[i], + SdpCodecStringConstants::Table ) ) + { + property = ETrue; + } + } + + if ( property || aValue.Length() == 0) + { + // For property attributes, no value is valid value + __ASSERT_ALWAYS( aValue.Length() == 0, + User::Leave( KErrSdpCodecAttributeField )); + + FormatProperyAttributeL( aAttribute.DesC() ); + } + else + { + FormatValueAttributeL( aAttribute.DesC(), aValue ); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::DecodeL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpAttributeField* CSdpAttributeField::DecodeL( const TDesC8& aText ) + { + CSdpAttributeField* obj = DecodeLC( aText ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::DecodeLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpAttributeField* CSdpAttributeField::DecodeLC( + const TDesC8& aText ) + { + CSdpAttributeField* obj = new ( ELeave ) CSdpAttributeField; + CleanupStack::PushL( obj ); + obj->ConstructL( aText ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpAttributeField* CSdpAttributeField::NewL( RStringF aAttribute, + const TDesC8& aValue ) + { + CSdpAttributeField* obj = NewLC( aAttribute, aValue ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpAttributeField* CSdpAttributeField::NewLC( RStringF aAttribute, + const TDesC8& aValue ) + { + CSdpAttributeField* obj = new ( ELeave ) CSdpAttributeField; + CleanupStack::PushL(obj); + obj->ConstructL( aAttribute, aValue ); + return obj; + } + +// Destructor +EXPORT_C CSdpAttributeField::~CSdpAttributeField() + { + iAttribute.Close(); + CSdpAttributeFieldPtrs* tmp = + reinterpret_cast< CSdpAttributeFieldPtrs* >( iValue ); + delete tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::EncodeL +// Encodes a string into valid output string format +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpAttributeField::EncodeL( RWriteStream& aStream ) const + { + __TEST_INVARIANT; + + RStringF header = iPool.StringF( SdpCodecStringConstants::EAttribute, + SdpCodecStringConstants::Table ); + aStream.WriteL( header.DesC() ); + aStream.WriteL( iAttribute.DesC() ); + TPtrC8 value( AttributeFieldPtrs().Value() ); + if ( value.Length() > 0 ) + { + aStream.WriteL( KColonStr ); + aStream.WriteL( value ); + } + aStream.WriteL( KCRLFStr ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CloneL +// Clones an object and returns the new attribute field +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpAttributeField * CSdpAttributeField::CloneL() const + { + __TEST_INVARIANT; + + CSdpAttributeField* obj = + CSdpAttributeField::NewL( iAttribute, AttributeFieldPtrs().Value() ); + + __ASSERT_DEBUG( *this == *obj, + User::Panic(KSdpCodecPanicCat, KSdpCodecPanicInternal) ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::operator== +// Checks if the two attribute fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpAttributeField::operator== ( + const CSdpAttributeField& aObj ) const + { + __TEST_INVARIANT; + + return ( iAttribute == aObj.Attribute() && + AttributeFieldPtrs().Value().CompareF( aObj.Value() ) == 0 ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::Attribute +// Returns attribute part of attribute field +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpAttributeField::Attribute() const + { + __TEST_INVARIANT; + return iAttribute; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::Value +// Returns value part of attribute field +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpAttributeField::Value() const + { + __TEST_INVARIANT; + + return AttributeFieldPtrs().Value(); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::SetL +// Sets new attribute field values +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpAttributeField::SetL( RStringF aAttribute, + const TDesC8& aValue ) + { + __TEST_INVARIANT; + + ConstructL( aAttribute, aValue ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::AssignTo +// Assigns attribute to a format attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpAttributeField::AssignTo( + const CSdpFmtAttributeField& aFmtAttribute) + { + AttributeFieldPtrs().SetFmtAttribute(&aFmtAttribute); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::BelongsTo +// Check if the attribute field belongs to the format attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpAttributeField::BelongsTo( + const CSdpFmtAttributeField& aFmtAttribute) const + { + return ( AttributeFieldPtrs().FmtAttribute() == &aFmtAttribute ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::ExternalizeL +// Externalizes the object to stream +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::ExternalizeL( RWriteStream& aStream ) const + { + // Attribute + aStream.WriteUint32L( iAttribute.DesC().Length() ); + aStream.WriteL( iAttribute.DesC() ); + // Value + TPtrC8 value( AttributeFieldPtrs().Value() ); + aStream.WriteUint32L( value.Length() ); + if ( value.Length() > 0 ) + { + aStream.WriteL( value, value.Length() ); + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::InternalizeL +// Internalizes the object from stream +// ----------------------------------------------------------------------------- +// +CSdpAttributeField* CSdpAttributeField::InternalizeL( RReadStream& aStream ) + { + RStringPool pool = SdpCodecStringPool::StringPoolL(); + + // Attribute + HBufC8* tmpBuf2; + TUint32 length = aStream.ReadUint32L(); + HBufC8* tmpBuf = HBufC8::NewLC( length ); + TPtr8 ptr( tmpBuf->Des() ); + aStream.ReadL( ptr, length ); + RStringF attribute = pool.OpenFStringL( ptr ); + CleanupClosePushL( attribute ); + + length = aStream.ReadUint32L(); + if ( length > 0 ) + { + tmpBuf2 = HBufC8::NewLC( length ); + TPtr8 ptr2( tmpBuf2->Des() ); + aStream.ReadL( ptr2, length ); + } + else + { + tmpBuf2 = KNullDesC8().AllocLC(); + } + + CSdpAttributeField* obj = CSdpAttributeField::NewL( attribute, *tmpBuf2 ); + CleanupStack::PopAndDestroy( 3 ); // attribute, tmpBuf, tmpBuf2 + + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::FormatPropertyAttributeL +// Formats and initializes class to be a property attribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::FormatProperyAttributeL( const TDesC8& aAttribute ) + { + __ASSERT_ALWAYS( SdpUtil::IsToken( aAttribute ), + User::Leave( KErrSdpCodecAttributeField )); + + TBool found( EFalse ); + for ( TInt i( 0 ); i < KPropertyStringNum && !found; i++ ) + { + RStringF attrString = + iPool.StringF( KValidPropertyStrings[i], + SdpCodecStringConstants::Table ); + + if ( attrString.DesC().CompareF( aAttribute ) == 0 ) + { + AttributeFieldPtrs().SetValueL( KNullDesC8 ); + + iAttribute.Close(); + iAttribute = attrString.Copy(); + iPropertyAttribute = ETrue; + + found = ETrue; + } + } + + if ( !found ) + { + HBufC8* tempValue = KNullDesC8().AllocLC(); + SetNotPredefinedAttributeL(aAttribute, *tempValue); + CleanupStack::PopAndDestroy(); // tempValue + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::FormatValueAttributeL +// Formats and initializes class to be a value attribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::FormatValueAttributeL( const TDesC8& aAttribute, + const TDesC8& aValue ) + { + TBool found( EFalse ); + + __ASSERT_ALWAYS( SdpUtil::IsToken( aAttribute ) + && SdpUtil::IsByteString( aValue ), + User::Leave( KErrSdpCodecAttributeField ) ); + + TInt i = 0; + for( i = 0; i < KPropertyStringNum && !found; i++) + { + RStringF attrString = + iPool.StringF( KValidPropertyStrings[i], + SdpCodecStringConstants::Table ); + + if ( attrString.DesC().CompareF( aAttribute ) == 0 ) + { + //found = ETrue; + User::Leave(KErrSdpCodecAttributeField); + } + } + + for ( i = 0; i < KValueStringNum && !found; i++ ) + { + RStringF attrString = + iPool.StringF( KValidValueStrings[i], + SdpCodecStringConstants::Table ); + + if ( attrString.DesC().CompareF( aAttribute ) == 0 ) + { + VerifyValueAttributeL( KValidValueStrings[i], aValue ); + iAttribute.Close(); + iAttribute = attrString.Copy(); + found = ETrue; + } + } + + if ( !found ) + { + SetNotPredefinedAttributeL(aAttribute, aValue); + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::VerifyValueAttributeL +// Verifies that value given to the attribute is valid +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::VerifyValueAttributeL( + SdpCodecStringConstants::TStrings aString, + const TDesC8& aValue ) + { + TUint str( aString ); + switch ( str ) + { + case SdpCodecStringConstants::EAttributeCat: + case SdpCodecStringConstants::EAttributeType: + case SdpCodecStringConstants::EAttributeCharset: + case SdpCodecStringConstants::EAttributeEtag: + __ASSERT_ALWAYS( aValue.Length() > 0 + && aValue.Locate( KSPChar ) == KErrNotFound, + User::Leave( KErrSdpCodecAttributeField ) ); + break; + + case SdpCodecStringConstants::EAttributeKeywds: + case SdpCodecStringConstants::EAttributeTool: + __ASSERT_ALWAYS( aValue.Length() > 0, + User::Leave( KErrSdpCodecAttributeField ) ); + break; + + case SdpCodecStringConstants::EAttributePtime: + case SdpCodecStringConstants::EAttributeMaxptime: + case SdpCodecStringConstants::EAttributeQuality: + __ASSERT_ALWAYS( SdpUtil::IsDigit( aValue ), + User::Leave( KErrSdpCodecAttributeField ) ); + break; + + case SdpCodecStringConstants::EAttributeOrient: + CheckValidOrientL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeSdplang: + case SdpCodecStringConstants::EAttributeLang: + CheckValidLangStrL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeFramerate: + CheckValidFrameRateL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeControl: + CheckValidControlL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeMid: + if (SdpUtil::IsToken( aValue ) == EFalse) + { + User::Leave( KErrSdpCodecAttributeField ); + } + break; + + case SdpCodecStringConstants::EAttributeGroup: + CheckValidGroupL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeCurr: + CheckValidCurrAndConfL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeDes: + CheckValidDesL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeConf: + CheckValidCurrAndConfL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeRange: + CheckValidRangeL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeRtpmap: + CheckValidRtpmapL( aValue ); + break; + + case SdpCodecStringConstants::EAttributeFmtp: + CheckValidFmtpL( aValue ); + break; + + default: + User::Leave( KErrSdpCodecAttributeField ); + break; + } + + AttributeFieldPtrs().SetValueL( aValue ); + iPropertyAttribute = EFalse; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CreateAttributeAndValueStringsLC +// Forms attribute and value strings +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CreateAttributeAndValueStringsLC( + RArray& aArray, + HBufC8*& aAttribute, + HBufC8*& aValue ) + { + TInt pos = aArray[KAttributeIndex].Locate( KColonChar ); + __ASSERT_ALWAYS( pos > 0, User::Leave( KErrSdpCodecAttributeField ) ); + + aAttribute = HBufC8::NewLC( pos ); + aAttribute->Des().Copy( aArray[KAttributeIndex].Left( pos ) ); + + // Find out the total length of value string + TPtrC8 initialValue( aArray[KAttributeIndex].Right( + aArray[KAttributeIndex].Length() - pos - 1 ) ); + + TInt valueLength( initialValue.Length() ); + for ( TInt i( KAttributeIndex + 1 ); i < aArray.Count(); i++ ) + { + valueLength += KSPStr().Length(); + valueLength += aArray[i].Length(); + } + + // Copy the value string to the value buffer + aValue = HBufC8::NewLC( valueLength ); + aValue->Des().Append( initialValue ); + for ( TInt j( KAttributeIndex + 1 ); j < aArray.Count(); j++ ) + { + aValue->Des().Append( KSPStr ); + aValue->Des().Append( aArray[j] ) ; + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidOrientL +// Checks if value is valid orient value +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidOrientL( const TDesC8& aValue ) + { + TBool found( EFalse ); + for ( TInt i( 0 ); i < KValidOrientStringNum && !found; i++ ) + { + TPtrC8 strPtr( KOrientStrings[i] ); + if ( strPtr.CompareF( aValue ) == 0 ) + { + found = ETrue; + } + } + + __ASSERT_ALWAYS(found, User::Leave( KErrSdpCodecAttributeField ) ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidLangStrL +// Checks if value is valid language tag +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidLangStrL( const TDesC8& aValue ) + { + // Language-Tag = Primary-subtag *( "-" Subtag ) + // Primary-subtag = 1*8ALPHA + // Subtag = 1*8(ALPHA / DIGIT) + TInt primarySubtagPos = aValue.Locate( KHyphenChar ); + + if ( primarySubtagPos > KMaxPrimarySubtagLength ) + { + User::Leave( KErrSdpCodecAttributeField ); + } + + TInt subtagPos( primarySubtagPos ); + TPtrC8 ptr( aValue.Right( aValue.Length() - subtagPos - 1 ) ); + // Check all subtags + while ( subtagPos != ptr.Length() ) + { + subtagPos = ptr.Locate( KHyphenChar ); + + if ( subtagPos == KErrNotFound ) + { + subtagPos = ptr.Length(); + } + + // Check length + __ASSERT_ALWAYS( subtagPos > 0 && subtagPos < KMaxSubtagLength, + User::Leave( KErrSdpCodecAttributeField ) ); + + if ( subtagPos != ptr.Length() ) + { + ptr.Set( aValue.Right( ptr.Length() - subtagPos - 1 ) ); + } + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidFrameRateL +// Checks if value is valid framerate value +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidFrameRateL( const TDesC8& aValue ) + { + TInt dotFound = 0; + // There can be one dot and digits + for ( TInt i( 0 ); i < aValue.Length(); i++ ) + { + __ASSERT_ALWAYS((aValue[i] == KDotChar || TChar( aValue[i] ).IsDigit()) + && dotFound <= 1, + User::Leave( KErrSdpCodecAttributeField )); + + if ( aValue[i] == KDotChar ) + { + dotFound++; + } + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidControlL +// Checks if value is valid uri for group attribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidControlL( const TDesC8& aValue ) + { + TUriParser8 parser; + User::LeaveIfError(parser.Parse(aValue)); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidGroupL +// Checks if value is valid value for group attribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidGroupL( const TDesC8& aValue ) + { + ValidValueInListL(KValidGroupSemanticsNum, KGroupSemantics, aValue); + TInt pos = aValue.Locate( KSPChar ); + TPtrC8 ptr(aValue); + + while ( pos != KErrNotFound) + { + ptr.Set( ptr.Right( ptr.Length() - pos - 1 ) ); + pos = ptr.Locate( KSPChar ); + } + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidDesL +// Checks if value is valid value for des attribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidDesL( const TDesC8& aValue ) + { + TInt pos = aValue.Locate( KSPChar ); + __ASSERT_ALWAYS(pos > 0, User::Leave( KErrSdpCodecAttributeField )); + TPtrC8 ptr(aValue.Left(pos)); + __ASSERT_ALWAYS( SdpUtil::IsToken(ptr), + User::Leave( KErrSdpCodecAttributeField ) ); + + ptr.Set(aValue.Right( aValue.Length() - pos - 1 )); + pos = ptr.Locate( KSPChar ); + __ASSERT_ALWAYS(pos > 0, User::Leave( KErrSdpCodecAttributeField )); + ValidValueInListL(KValidStrengthTagsNum, KStrengthTags, ptr.Left( pos )); + + ptr.Set(ptr.Right( ptr.Length() - pos - 1 )); + pos = ptr.Locate( KSPChar ); + __ASSERT_ALWAYS(pos > 0, User::Leave( KErrSdpCodecAttributeField )); + ValidValueInListL(KValidStatusTypeNum, KStatusTypes, ptr.Left( pos )); + + ptr.Set(ptr.Right( ptr.Length() - pos - 1 )); + __ASSERT_ALWAYS(ptr.Locate( KSPChar ) == KErrNotFound, + User::Leave( KErrSdpCodecAttributeField )); + ValidValueInListL(KValidDirectionTagsNum, KDirectionTags, ptr); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidCurrAndConfL +// Checks if value is valid value for curr and conf attribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidCurrAndConfL( const TDesC8& aValue ) + { + TInt pos = aValue.Locate( KSPChar ); + __ASSERT_ALWAYS(pos > 0, User::Leave( KErrSdpCodecAttributeField )); + TPtrC8 ptr(aValue.Left(pos)); + __ASSERT_ALWAYS( SdpUtil::IsToken(ptr), + User::Leave( KErrSdpCodecAttributeField ) ); + + ptr.Set(aValue.Right( aValue.Length() - pos - 1 )); + pos = ptr.Locate( KSPChar ); + __ASSERT_ALWAYS(pos > 0, User::Leave( KErrSdpCodecAttributeField )); + ValidValueInListL(KValidStatusTypeNum, KStatusTypes, ptr.Left( pos )); + + ptr.Set(ptr.Right( ptr.Length() - pos - 1 )); + __ASSERT_ALWAYS(ptr.Locate( KSPChar ) == KErrNotFound, + User::Leave( KErrSdpCodecAttributeField )); + ValidValueInListL(KValidDirectionTagsNum, KDirectionTags, ptr); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::ValidValueInListL +// Checks if value is included in predefined values list +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::ValidValueInListL( TInt aItemsCount, + const TText8* const aValuesList[], + const TDesC8& aValue ) + { + TBool found( EFalse ); + TInt pos = 0; + for ( TInt i( 0 ); i < aItemsCount && !found; i++ ) + { + TPtrC8 strPtr( aValuesList[i] ); + pos = aValue.Find(strPtr); + if ( pos != KErrNotFound && pos >= 0 ) + { + found = ETrue; + } + } + + __ASSERT_ALWAYS(found, User::Leave( KErrSdpCodecAttributeField )); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidCRangefL +// Checks if precondition type value is valid value +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidRangeL( const TDesC8& aValue ) + { + TInt found = aValue.Find(KEqualStr); + __ASSERT_ALWAYS(found != KErrNotFound && found > 0, User::Leave( KErrSdpCodecAttributeField )); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidRtpmapL +// Checks if value is valid rtpmap value +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidRtpmapL( const TDesC8& aValue ) + { + // If this doesn't leave, then the value is OK + TSdpRtpmapValue::DecodeL( aValue ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CheckValidFmtpL +// Checks if value is valid format value +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CheckValidFmtpL( const TDesC8& aValue ) + { + __ASSERT_ALWAYS(SdpUtil::IsByteString(aValue) && aValue.Length() > 0, + User::Leave( KErrSdpCodecMediaAttributeField )); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::SetNotPredefinedAttributeL +// Sets attribute and value. Attribute is not one of predefined ones. +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::SetNotPredefinedAttributeL(const TDesC8& aAttribute, + const TDesC8& aValue) + { + iAttribute.Close(); + iAttribute = iPool.OpenFStringL(aAttribute); + AttributeFieldPtrs().SetValueL( aValue ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::IsFmtAttribute +// Check if the attribute field belongs to any format attribute +// ----------------------------------------------------------------------------- +// +TBool CSdpAttributeField::IsFmtAttribute() + { + if ( AttributeFieldPtrs().FmtAttribute() ) + { + return ETrue; + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::CreateAttributeFieldPtrsL +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::CreateAttributeFieldPtrsL() + { + CSdpAttributeFieldPtrs* newObj = CSdpAttributeFieldPtrs::NewL(); + CSdpAttributeFieldPtrs* oldObj = + reinterpret_cast< CSdpAttributeFieldPtrs* >( iValue ); + delete oldObj; + iValue = reinterpret_cast< HBufC8* >( newObj ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::AttributeFieldPtrs +// ----------------------------------------------------------------------------- +// +inline CSdpAttributeFieldPtrs& CSdpAttributeField::AttributeFieldPtrs() + { + return *( reinterpret_cast< CSdpAttributeFieldPtrs* >( iValue ) ); + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeField::AttributeFieldPtrs +// ----------------------------------------------------------------------------- +// +inline const CSdpAttributeFieldPtrs& +CSdpAttributeField::AttributeFieldPtrs() const + { + return *( reinterpret_cast< CSdpAttributeFieldPtrs* >( iValue ) ); + } + +// For DEBUG builds + +// ----------------------------------------------------------------------------- +// CSdpOriginField::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// +void CSdpAttributeField::__DbgTestInvariant() const + { + TBool invariant = ( + SdpUtil::IsToken( iAttribute.DesC() ) + && iValue != 0 ); + + if (!invariant) + User::Invariant(); + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpattributefieldptrs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpattributefieldptrs.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,100 @@ +// Copyright (c) 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: +// Name : SdpAttributeFieldPtrs.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include "sdpattributefieldptrs.h" +#include "sdpfmtattributefield.h" + +// ----------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::NewL +// ----------------------------------------------------------------------------- +// +CSdpAttributeFieldPtrs* CSdpAttributeFieldPtrs::NewL() + { + CSdpAttributeFieldPtrs* self = new ( ELeave ) CSdpAttributeFieldPtrs; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::CSdpAttributeFieldPtrs +// ---------------------------------------------------------------------------- +// +CSdpAttributeFieldPtrs::CSdpAttributeFieldPtrs() + { + } + +// ---------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpAttributeFieldPtrs::ConstructL() + { + iValue = KNullDesC8().AllocL(); + } + +// ---------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::~CSdpAttributeFieldPtrs +// ---------------------------------------------------------------------------- +// +CSdpAttributeFieldPtrs::~CSdpAttributeFieldPtrs() + { + delete iValue; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::SetValueL +// ----------------------------------------------------------------------------- +// +void CSdpAttributeFieldPtrs::SetValueL( const TDesC8& aValue ) + { + HBufC8* tmp = aValue.AllocL(); + delete iValue; + iValue = tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::Value +// ----------------------------------------------------------------------------- +// +const TDesC8& CSdpAttributeFieldPtrs::Value() const + { + return *iValue; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::SetFmtAttribute +// ----------------------------------------------------------------------------- +// +void CSdpAttributeFieldPtrs::SetFmtAttribute( + const CSdpFmtAttributeField* aFmtAttribute ) + { + iFmtAttributeField = aFmtAttribute; + } + +// ----------------------------------------------------------------------------- +// CSdpAttributeFieldPtrs::FmtAttribute +// ----------------------------------------------------------------------------- +// +const CSdpFmtAttributeField* CSdpAttributeFieldPtrs::FmtAttribute() const + { + return iFmtAttributeField; + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpbandwidthfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpbandwidthfield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,316 @@ +// Copyright (c) 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: +// Name : SdpBandwidthField.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdpbandwidthfield.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" +#include "sdpcodecstringconstants.h" +#include "sdputil.h" +#include "sdpcodecconstants.h" +#include "sdpcodecerr.h" +#include "sdpcodecstringpool.h" + +// LOCAL CONSTANTS +const TInt KLines = 1; +const TInt KElements = 3; +const TUint KMaxTInt64Digits = 30; + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::DecodeL +// Decodes bandwidth field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpBandwidthField* CSdpBandwidthField::DecodeL(const TDesC8& aText) + { + CSdpBandwidthField* obj = DecodeLC(aText); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::DecodeLC +// Decodes bandwidth field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpBandwidthField* CSdpBandwidthField::DecodeLC(const TDesC8& aText) + { + CSdpBandwidthField* obj = new (ELeave) CSdpBandwidthField(); + CleanupStack::PushL(obj); + obj->ConstructL(aText); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpBandwidthField* CSdpBandwidthField::NewL(RStringF aModifier, + TUint32 aValue) + { + CSdpBandwidthField* obj = NewLC(aModifier, aValue); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpBandwidthField* CSdpBandwidthField::NewLC(RStringF aModifier, + TUint32 aValue) + { + CSdpBandwidthField* obj = new (ELeave) CSdpBandwidthField(); + CleanupStack::PushL(obj); + obj->ConstructL(aModifier, aValue); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::~CSdpBandwidthField +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpBandwidthField::~CSdpBandwidthField() + { + iModifier.Close(); + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpBandwidthField::EncodeL(RWriteStream& aStream) const + { + RStringF header = iModifier.Pool().StringF( + SdpCodecStringConstants::EBandwidth, + SdpCodecStringConstants::Table ); + aStream.WriteL( header.DesC() ); + + aStream.WriteL( iModifier.DesC() ); + aStream.WriteL( KColonStr ); + + TBuf8 number; + number.Format( _L8("%u"), iValue ); + aStream.WriteL( number ); + + aStream.WriteL( KCRLFStr ); + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::CloneL +// Creates an exact copy of the bandwidth field +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpBandwidthField * CSdpBandwidthField::CloneL() const + { + CSdpBandwidthField* obj = NewL(iModifier, iValue); + __ASSERT_DEBUG(*this == *obj, User::Panic(KSdpCodecPanicCat, + KSdpCodecPanicInternal)); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::operator == +// Checks if two bandwidth fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpBandwidthField::operator == (const CSdpBandwidthField& aObj) +const + { + return iModifier == aObj.iModifier && iValue == aObj.iValue; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::Modifier +// Returns bandwidth modifier +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpBandwidthField::Modifier() const + { + return iModifier; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::SetModifier +// Set new bandwidth modifier +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpBandwidthField::SetModifier(RStringF aModifier) + { + iModifier.Close(); + iModifier = aModifier.Copy(); + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::Value +// Returns bandwidth value +// ----------------------------------------------------------------------------- +// +EXPORT_C TUint32 CSdpBandwidthField::Value() const + { + return iValue; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::SetValue +// Set new bandwidth value +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpBandwidthField::SetValue(TUint32 aValue) + { + iValue = aValue; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::ExternalizeL +// Externalizes the object to stream +// ----------------------------------------------------------------------------- +// +void CSdpBandwidthField::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteUint32L(iModifier.DesC().Length()); + aStream.WriteL(iModifier.DesC(), iModifier.DesC().Length()); + aStream.WriteUint32L(iValue); + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::InternalizeL +// Internalizes the object from stream +// ----------------------------------------------------------------------------- +// +CSdpBandwidthField* CSdpBandwidthField::InternalizeL(RReadStream& aStream) + { + TUint32 length = aStream.ReadUint32L(); + HBufC8* modifier = HBufC8::NewLC(length); + TPtr8 ptr(modifier->Des()); + aStream.ReadL(ptr, length); + + TUint32 value = aStream.ReadUint32L(); + + CSdpBandwidthField* obj = new (ELeave) CSdpBandwidthField(); + CleanupStack::PushL(obj); + obj->ConstructL(*modifier, value); + + CleanupStack::PopAndDestroy(); // modifier + CleanupStack::Pop(obj); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::CSdpBandwidthField +// Constructor +// ----------------------------------------------------------------------------- +// +CSdpBandwidthField::CSdpBandwidthField() + { + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpBandwidthField::ConstructL(const TDesC8& aText) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + RArray lines; + lines = SdpUtil::DivideToLinesL(aText, KErrSdpCodecBandwidthField); + CleanupClosePushL(lines); + RArray bwArray; + bwArray = SdpUtil::GetElementsFromLineL(lines[0], KColonChar, + KErrSdpCodecBandwidthField); + CleanupClosePushL(bwArray); + const TDesC8& bwName = iStringPool.StringF( + SdpCodecStringConstants::EBandwidth, + SdpCodecStringConstants::Table).DesC(); + + __ASSERT_ALWAYS(lines.Count() == KLines + && bwArray.Count() == KElements + && bwArray[0].Find(bwName) != KErrNotFound, + User::Leave(KErrSdpCodecBandwidthField)); + + CopyModifierL(bwArray[1]); + TLex8 lexer(bwArray[2]); + lexer.Val(iValue, EDecimal); + + CleanupStack::PopAndDestroy(2); //lines, bwArray + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpBandwidthField::ConstructL(RStringF aModifier, TUint32 aValue) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + iModifier = aModifier.Copy(); + iValue = aValue; + } + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpBandwidthField::ConstructL(const TDesC8& aModifier, TUint32 aValue) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + CopyModifierL(aModifier); + iValue = aValue; + } + + +// ----------------------------------------------------------------------------- +// CSdpBandwidthField::CopyModifierL +// Copies modifier to object after check +// ----------------------------------------------------------------------------- +// +void CSdpBandwidthField::CopyModifierL(const TDesC8& aModifier) + { + RStringF modifierCT = iStringPool.StringF( + SdpCodecStringConstants::EModifierCT, + SdpCodecStringConstants::Table ); + RStringF modifierAS = iStringPool.StringF( + SdpCodecStringConstants::EModifierAS, + SdpCodecStringConstants::Table ); + + if (modifierCT.DesC().CompareF(aModifier) == 0) + { + iModifier.Close(); + iModifier = modifierCT.Copy(); + } + else if ( modifierAS.DesC().CompareF(aModifier) == 0) + { + iModifier.Close(); + iModifier = modifierAS.Copy(); + } + else + { + iModifier.Close(); + iModifier = iStringPool.OpenFStringL(aModifier); + } + } + + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpcodecparseutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpcodecparseutil.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,763 @@ +// Copyright (c) 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: +// Name : SdpCodecParseUtil.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include "sdpcodecparseutil.h" +#include "sdpcodecstringconstants.h" +#include "_sdpdefs.h" +#include +#include "sdputil.h" +#include "sdptimefield.h" +#include "sdpbandwidthfield.h" +#include "sdpattributefield.h" +#include "sdpmediafield.h" +#include "sdpconnectionfield.h" +#include "sdpkeyfield.h" +#include "sdporiginfield.h" +#include "sdprepeatfield.h" +#include "sdpcodecerr.h" +#include "sdpcodecconstants.h" +#include "uri8.h" +#include "uriutilscommon.h" +#include "badesca.h" + +// ---------------------------------------------------------------------------- +// CSdpCodecParseUtil::NewL +// ---------------------------------------------------------------------------- +// +CSdpCodecParseUtil* +CSdpCodecParseUtil::NewL(RStringPool aPool, const TDesC8& aValue,TInt aErrCode) + { + CSdpCodecParseUtil* obj = CSdpCodecParseUtil::NewLC(aPool, aValue,aErrCode); + CleanupStack::Pop();//obj + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpCodecParseUtil::NewLC +// ---------------------------------------------------------------------------- +// +CSdpCodecParseUtil* +CSdpCodecParseUtil::NewLC(RStringPool aPool, const TDesC8& aValue,TInt aErrCode) + { + CSdpCodecParseUtil* obj = new(ELeave)CSdpCodecParseUtil; + CleanupStack::PushL(obj); + obj->ConstructL(aPool, aValue,aErrCode); + return obj; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::FieldLineValueL +// --------------------------------------------------------------------------- +// +TPtrC8 CSdpCodecParseUtil::FieldLineValueL(const TDesC8& aValue) + { + __ASSERT_ALWAYS (aValue.Length() > 0, User::Leave(KErrArgument)); + TPtrC8 lineStartBuf(aValue.Mid(2)); + TInt lineEndPosition = lineStartBuf.Locate('\r'); + if(lineEndPosition == KErrNotFound) + { + lineEndPosition = lineStartBuf.Locate('\n'); + } + return lineStartBuf.Left(lineEndPosition); + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::CheckFieldNameL +// --------------------------------------------------------------------------- +// +RArray CSdpCodecParseUtil::CheckFieldNameL(RStringPool aPool, + TInt aIndex, + const TDesC8& aValue, + TInt aErrCode) + { + if(!aValue.Length()) + { + User::Leave(KErrArgument); + } + RArray elementArray = SdpUtil::GetElementsFromLineL(aValue, + aErrCode); + CleanupClosePushL(elementArray); + RStringF name = aPool.OpenFStringL(elementArray[0]); + CleanupClosePushL(name); + if(name!=(aPool.StringF(aIndex, SdpCodecStringConstants::Table))) + { + User::Leave(KErrArgument);//parsererror + } + CleanupStack::Pop(2);//name, elementArray + name.Close(); + return elementArray; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::CheckOptionalFieldNameL +// --------------------------------------------------------------------------- +// +RArray CSdpCodecParseUtil::CheckOptionalFieldNameL(RStringPool aPool, + TInt aIndex, + const TDesC8& aValue, + TInt aErrCode) + { + RArray elementArray; + elementArray.Reset(); + if(aValue.Length()) + { + elementArray = SdpUtil::GetElementsFromLineL(aValue, aErrCode); + CleanupClosePushL(elementArray); + RStringF name = aPool.OpenFStringL(elementArray[0]); + CleanupClosePushL(name); + if(name!=(aPool.StringF(aIndex, SdpCodecStringConstants::Table))) + { + elementArray.Reset(); + } + CleanupStack::Pop(2);//name, elementArray + name.Close(); + } + return elementArray; + } + +// ---------------------------------------------------------------------------- +// CSdpCodecParseUtil::CSdpCodecParseUtil +// ---------------------------------------------------------------------------- +// +CSdpCodecParseUtil::CSdpCodecParseUtil() + { + + } + +// ---------------------------------------------------------------------------- +// CSdpCodecParseUtil::~CSdpCodecParseUtil +// ---------------------------------------------------------------------------- +// +CSdpCodecParseUtil::~CSdpCodecParseUtil() + { + iLineArray.Reset(); + iElementArray.Reset(); + if(iTimeFields) + { + iTimeFields->ResetAndDestroy(); + delete iTimeFields; + } + + if(iBandwidthFields) + { + iBandwidthFields->ResetAndDestroy(); + delete iBandwidthFields; + } + + if(iAttributeFields) + { + iAttributeFields->ResetAndDestroy(); + delete iAttributeFields; + } + + if(iMediaFields) + { + iMediaFields->ResetAndDestroy(); + delete iMediaFields; + } + + if(iConnectionFields) + { + iConnectionFields->ResetAndDestroy(); + delete iConnectionFields; + } + + if(iEmailFields) + { + iEmailFields->Reset(); + delete iEmailFields; + } + + if(iPhoneFields) + { + iPhoneFields->Reset(); + delete iPhoneFields; + } + delete iToken; + } + +// ---------------------------------------------------------------------------- +// CSdpCodecParseUtil::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpCodecParseUtil::ConstructL(RStringPool aPool, const TDesC8& aValue, + TInt aErrCode) + { + iPool = aPool; + iData.Set(aValue); + iToken = KNullDesC8().AllocL(); + iEmailFields = new(ELeave)CDesC8ArraySeg(1); + iPhoneFields = new(ELeave)CDesC8ArraySeg(1); + iBandwidthFields = new(ELeave)RPointerArray; + iTimeFields = new(ELeave)RPointerArray; + iAttributeFields = new(ELeave)RPointerArray; + iMediaFields = new(ELeave)RPointerArray; + iConnectionFields = new(ELeave)RPointerArray; + iLineArray = SdpUtil::DivideToLinesL(aValue,aErrCode); + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseSessionVersionL +// --------------------------------------------------------------------------- +// +TUint CSdpCodecParseUtil::ParseSessionVersionL(TInt aErrCode) + { + TUint sdpVersion = 0; + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckFieldNameL(iPool, + SdpCodecStringConstants::EVersion, + iLineArray[0],aErrCode); + if(iElementArray.Count() > 1) + { + TLex8 lex(iElementArray[1]); + if(lex.Val(sdpVersion) == KErrNone) + { + iLineArray.Remove(0); + iElementArray.Reset(); + } + else + { + User::Leave(KErrSdpCodecVersionField); + } + } + } + else + { + User::Leave(KErrSdpCodecVersionField); + } + return sdpVersion; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseSessionOwnerL +// --------------------------------------------------------------------------- +// +CSdpOriginField* CSdpCodecParseUtil::ParseSessionOwnerL(TInt aErrCode) + { + CSdpOriginField* sdpOriginField = NULL; + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckFieldNameL(iPool, + SdpCodecStringConstants::EOrigin, + iLineArray[0],aErrCode); + sdpOriginField = + CSdpOriginField::DecodeL(iLineArray[0]); + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + User::Leave(KErrSdpCodecOriginField); + } + return sdpOriginField; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseSessionNameL +// --------------------------------------------------------------------------- +// +const TDesC8& CSdpCodecParseUtil::ParseSessionNameL(TInt aErrCode) + { + delete iToken; + iToken = 0; + iToken = KNullDesC8().AllocL(); + if(iLineArray.Count()) + { + if(iLineArray[0].Length() < 6 && + (iLineArray[0].CompareF(_L8("s= \r\n")) == 0 || + iLineArray[0].CompareF(_L8("s= \n")) == 0 )) + { + iLineArray.Remove(0); + delete iToken; + iToken = 0; + iToken = _L8(" ").AllocL(); + return *iToken; + } + iElementArray = CSdpCodecParseUtil::CheckFieldNameL(iPool, + SdpCodecStringConstants::ESession, + iLineArray[0],aErrCode); + __ASSERT_ALWAYS (iElementArray.Count() > 1, + User::Leave(KErrSdpCodecSessionField)); + delete iToken; + iToken = 0; + iToken = (CSdpCodecParseUtil::FieldLineValueL(iLineArray[0])).AllocL(); + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + User::Leave(KErrSdpCodecSessionField); + } + return *iToken; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseInformationL +// --------------------------------------------------------------------------- +// +const TDesC8& CSdpCodecParseUtil::ParseInformationL(TInt aErrCode) + { + delete iToken; + iToken = 0; + iToken = KNullDesC8().AllocL(); + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EInfo, + iLineArray[0],aErrCode); + + if(iElementArray.Count()) + { + __ASSERT_ALWAYS (iElementArray.Count() > 1, + User::Leave(KErrSdpCodecInfoField)); + delete iToken; + iToken = 0; + iToken = + (CSdpCodecParseUtil::FieldLineValueL(iLineArray[0])).AllocL(); + iElementArray.Reset(); + iLineArray.Remove(0); + } + } + return *iToken; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseUriL +// --------------------------------------------------------------------------- +// +CUri8* CSdpCodecParseUtil::ParseUriL(TInt aErrCode) + { + CUri8* uri = 0; + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EUri, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + __ASSERT_ALWAYS (iElementArray.Count() == 2, + User::Leave(KErrSdpCodecUriField)); + TUriParser8 parser; + User::LeaveIfError(parser.Parse(iElementArray[1])); + uri = CUri8::NewL(parser); + iElementArray.Reset(); + iLineArray.Remove(0); + } + } + return uri; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseEmailL +// --------------------------------------------------------------------------- +// +CDesC8ArraySeg* CSdpCodecParseUtil::ParseEmailL(TInt aErrCode) + { + TBool endloop = EFalse; + while (iLineArray.Count() && !endloop) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EEmail, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + __ASSERT_ALWAYS (iElementArray.Count() > 1, + User::Leave(KErrSdpCodecEmailField)); + iEmailFields->AppendL( + CSdpCodecParseUtil::FieldLineValueL(iLineArray[0])); + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + endloop = ETrue; + } + } + CDesC8ArraySeg* array = iEmailFields; + iEmailFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParsePhoneL +// --------------------------------------------------------------------------- +// +CDesC8ArraySeg* CSdpCodecParseUtil::ParsePhoneL(TInt aErrCode) + { + TBool endloop = EFalse; + while (iLineArray.Count() && !endloop) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EPhone, + iLineArray[0],aErrCode); + if(iElementArray.Count() != 0) + { + __ASSERT_ALWAYS (iElementArray.Count() > 1, + User::Leave(KErrSdpCodecPhoneField)); + iPhoneFields->AppendL( + CSdpCodecParseUtil::FieldLineValueL(iLineArray[0])); + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + endloop = ETrue; + } + } + CDesC8ArraySeg* array = iPhoneFields; + iPhoneFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseConnectionL +// --------------------------------------------------------------------------- +// +CSdpConnectionField* CSdpCodecParseUtil::ParseConnectionL(TInt aErrCode) + { + CSdpConnectionField* sdpConnectionField = NULL; + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EConnection, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + sdpConnectionField = + CSdpConnectionField::DecodeL(iLineArray[0]); + iElementArray.Reset(); + iLineArray.Remove(0); + } + } + return sdpConnectionField; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseBandwidthL +// --------------------------------------------------------------------------- +// +RPointerArray* +CSdpCodecParseUtil::ParseBandwidthL(TInt aErrCode) + { + TBool endloop = EFalse; + CSdpBandwidthField* bandwidth = NULL; + while (iLineArray.Count() && !endloop) + { + iElementArray = + CSdpCodecParseUtil::CheckOptionalFieldNameL( + iPool,SdpCodecStringConstants::EBandwidth, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + bandwidth = CSdpBandwidthField::DecodeLC(iLineArray[0]); + iBandwidthFields->AppendL(bandwidth); + CleanupStack::Pop(bandwidth); + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + endloop = ETrue; + } + } + RPointerArray* array = iBandwidthFields; + iBandwidthFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseConnectionFieldsL +// --------------------------------------------------------------------------- +// +RPointerArray* +CSdpCodecParseUtil::ParseConnectionFieldsL(TInt aErrCode) + { + TBool endloop = EFalse; + CSdpConnectionField* connection = NULL; + while(iLineArray.Count() && !endloop) + { + iElementArray = + CSdpCodecParseUtil::CheckOptionalFieldNameL( + iPool,SdpCodecStringConstants::EConnection, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + connection = CSdpConnectionField::DecodeLC(iLineArray[0]); + iConnectionFields->AppendL(connection); + CleanupStack::Pop(connection); + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + endloop = ETrue; + } + } + RPointerArray* array = iConnectionFields; + iConnectionFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseTimeFieldL +// --------------------------------------------------------------------------- +// +RPointerArray* +CSdpCodecParseUtil::ParseTimeFieldL(TInt aErrCode) + { + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckFieldNameL(iPool, + SdpCodecStringConstants::ETime, + iLineArray[0],aErrCode); + iElementArray.Reset(); + CSdpTimeField* timefield = NULL; + CSdpRepeatField* repeatfield = NULL; + TBool endloop = EFalse; + while(iLineArray.Count() && !endloop) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::ETime, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + timefield = CSdpTimeField::DecodeLC(iLineArray[0]); + User::LeaveIfError(iTimeFields->Append(timefield)); + CleanupStack::Pop();//timefield + iElementArray.Reset(); + iLineArray.Remove(0); + TBool repeatEnd = EFalse; + while(iLineArray.Count() && !repeatEnd) + { + iElementArray = + CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::ERepeat, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + repeatfield = + CSdpRepeatField::DecodeLC(iLineArray[0]); + User::LeaveIfError((timefield->RepeatFields()).Append( + repeatfield)); + CleanupStack::Pop();//repeatfield + repeatfield = 0; + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + repeatEnd = ETrue; + } + } + timefield = 0; + } + else + { + endloop = ETrue; + } + } + } + RPointerArray* array = iTimeFields; + iTimeFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseZoneAdjustmentL +// --------------------------------------------------------------------------- +// +const TDesC8& CSdpCodecParseUtil::ParseZoneAdjustmentL(TInt aErrCode) + { + delete iToken; + iToken = 0; + iToken = KNullDesC8().AllocL(); + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EZone, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + __ASSERT_ALWAYS (iElementArray.Count() > 1, + User::Leave(KErrSdpCodecZoneField)); + delete iToken; + iToken = 0; + iToken = + (CSdpCodecParseUtil::FieldLineValueL(iLineArray[0])).AllocL(); + iElementArray.Reset(); + iLineArray.Remove(0); + } + } + return *iToken; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseEncryptionKeyL +// --------------------------------------------------------------------------- +// +CSdpKeyField* CSdpCodecParseUtil::ParseEncryptionKeyL(TInt aErrCode) + { + CSdpKeyField* sdpKeyField = NULL; + if(iLineArray.Count()) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EKey, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + __ASSERT_ALWAYS (iElementArray.Count() > 1, + User::Leave(KErrSdpCodecKeyField)); + sdpKeyField = CSdpKeyField::DecodeL(iLineArray[0]); + iElementArray.Reset(); + iLineArray.Remove(0); + } + } + return sdpKeyField; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseAttributeFieldL +// --------------------------------------------------------------------------- +// +RPointerArray* +CSdpCodecParseUtil::ParseAttributeFieldL(TInt aErrCode) + { + TBool endloop = EFalse; + CSdpAttributeField* attributefield = NULL; + while(iLineArray.Count() && !endloop) + { + iElementArray = CSdpCodecParseUtil::CheckOptionalFieldNameL(iPool, + SdpCodecStringConstants::EAttribute, + iLineArray[0],aErrCode); + if(iElementArray.Count()) + { + attributefield = + CSdpAttributeField::DecodeLC(iLineArray[0]); + User::LeaveIfError(iAttributeFields->Append(attributefield)); + CleanupStack::Pop();//attributefield + attributefield = NULL; + iElementArray.Reset(); + iLineArray.Remove(0); + } + else + { + endloop = ETrue; + } + } + RPointerArray* array = iAttributeFields; + iAttributeFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::ParseMediaLevelL +// --------------------------------------------------------------------------- +// +RPointerArray* +CSdpCodecParseUtil::ParseMediaLevelL() + { + RStringF headername = iPool.StringF( SdpCodecStringConstants::EMedia, + SdpCodecStringConstants::Table ); + TInt linestartPosition = 0; + TInt lineEndPosition = 0; + CSdpMediaField* mediafield = NULL; + TBool endloop = EFalse; + while(iData.Length() > 0 && !endloop) + { + linestartPosition = iData.FindF(headername.DesC()); + if(linestartPosition != KErrNotFound) + { + TPtrC8 firstline(iData.Mid(linestartPosition)); + TPtrC8 templine(iData.Mid(linestartPosition + 1)); + HBufC8* searchString = + HBufC8::NewLC(KCRLFStr().Length() + + headername.DesC().Length()); + TPtr8 strPtr(searchString->Des()); + strPtr.Append(KCRLFStr); + strPtr.Append(headername.DesC()); + lineEndPosition = templine.FindF(strPtr); + CleanupStack::PopAndDestroy(searchString); + if(lineEndPosition == KErrNotFound) + { + mediafield = + CSdpMediaField::DecodeLC(iData.Mid(linestartPosition)); + User::LeaveIfError(iMediaFields->Append(mediafield)); + CleanupStack::Pop();//mediafield + mediafield = 0; + iElementArray.Reset(); + iLineArray.Reset(); + endloop = ETrue; + } + else + { + mediafield = + CSdpMediaField::DecodeLC(firstline.Left( + lineEndPosition+1+KCRLFStr().Length())); + User::LeaveIfError(iMediaFields->Append(mediafield)); + CleanupStack::Pop();//mediafield + mediafield = 0; + iData.Set(firstline.Mid(lineEndPosition+1)); + } + } + else + { + endloop = ETrue; + } + } + RPointerArray* array = iMediaFields; + iMediaFields = 0; + return array; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::FirstLineArrayElementL +// --------------------------------------------------------------------------- +// +RArray CSdpCodecParseUtil::FirstLineArrayElementL(RStringPool aPool, + TInt aIndex, + TInt aErrCode) + { + if(!iLineArray.Count()) + { + User::Leave(aErrCode); + } + RArray elementArray = + SdpUtil::GetElementsFromLineL(iLineArray[0],aErrCode); + CleanupClosePushL(elementArray); + RStringF name = aPool.OpenFStringL(elementArray[0]); + CleanupClosePushL(name); + if(name!=(aPool.StringF(aIndex, SdpCodecStringConstants::Table))) + { + User::Leave(aErrCode);//parsererror + } + CleanupStack::Pop(2);//name, elementArray + name.Close(); + return elementArray; + } + +// --------------------------------------------------------------------------- +// CSdpCodecParseUtil::LineArray +// --------------------------------------------------------------------------- +// +RArray& CSdpCodecParseUtil::LineArray() + { + return iLineArray; + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpcodecstringpool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpcodecstringpool.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,89 @@ +// Copyright (c) 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: +// Name : SdpCodecStringPool.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdpcodecerr.h" +#include "sdpcodecstringpool.h" +#include "csdpcodecstringpool.h" +#include "sdpcodecstringconstants.h" +#include "_sdpdefs.h" + + +// ----------------------------------------------------------------------------- +// SdpCodecStringPool::OpenL +// Opens stringpool owner, leaves if one already exists in TLS +// ----------------------------------------------------------------------------- +// +EXPORT_C void SdpCodecStringPool::OpenL() + { + __ASSERT_ALWAYS( Dll::Tls() == NULL, User::Leave ( KErrAlreadyExists ) ); + + CSdpCodecStringPool* codecStringPool = CSdpCodecStringPool::NewLC(); + User::LeaveIfError( Dll::SetTls( codecStringPool ) ); + CleanupStack::Pop(); // codecStringPool + } + +// ----------------------------------------------------------------------------- +// SdpCodecStringPool::Close +// Closes & deletes string pool +// ----------------------------------------------------------------------------- +// +EXPORT_C void SdpCodecStringPool::Close() + { + if ( Dll::Tls() == NULL ) + { + return; + } + + CSdpCodecStringPool* codecStringPool = + static_cast( Dll::Tls() ); + delete codecStringPool; + Dll::SetTls( NULL ); + } + +// ----------------------------------------------------------------------------- +// SdpCodecStringPool::StringPoolL +// Returns string pool +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringPool SdpCodecStringPool::StringPoolL() + { + CSdpCodecStringPool* codecStringPool = + static_cast( Dll::Tls() ); + __ASSERT_ALWAYS( codecStringPool != NULL, + User::Leave( KErrSdpCodecStringPool ) ); + + return codecStringPool->StringPool(); + } + +// ----------------------------------------------------------------------------- +// SdpCodecStringPool::StringTableL +// Returns string table +// ----------------------------------------------------------------------------- +// +EXPORT_C const TStringTable& SdpCodecStringPool::StringTableL() + { + CSdpCodecStringPool* codecStringPool = + static_cast( Dll::Tls() ); + __ASSERT_ALWAYS( codecStringPool != NULL, + User::Leave( KErrSdpCodecStringPool ) ); + + return codecStringPool->StringTable(); + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpconnectionfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpconnectionfield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,1155 @@ +// Copyright (c) 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: +// Name : SdpConnectionField.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + + +#include +#include +#include +#include "sdpconnectionfield.h" +#include "sdpcodecstringconstants.h" +#include "sdpcodecconstants.h" +#include "sdpcodecstringpool.h" +#include "sdputil.h" +#include "sdpcodecerr.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" +#include "uriutils.h" + +// LOCAL CONSTANTS +const TInt KHeaderIndex = 0; +const TInt KNetworkTypeIndex = 1; +const TInt KAddressTypeIndex = 2; +const TInt KAddressIndex = 3; +const TInt KTokenCount = 4; +const TInt KMaxAddressLength = 256; +const TUint KMaxIPDesLength = 39; +_LIT16(KWildAddr, "0.0.0.0"); +_LIT16(KWildAddrIPv6, "::"); + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::CSdpConnectionField +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSdpConnectionField::CSdpConnectionField() : + iTTL( KErrNotFound ), + iNumOfAddress( KDefaultNumOfAddress ) + { + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::ConstructL( + const TDesC8& aText ) + { + // aText should be in format + // c=
+ iPool = SdpCodecStringPool::StringPoolL(); + + RArray array = + SdpUtil::GetElementsFromLineL( aText, KErrSdpCodecConnectionField ); + CleanupClosePushL( array ); + + if ( array.Count() != KTokenCount ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + + RStringF origHeader = iPool.StringF( SdpCodecStringConstants::EConnection, + SdpCodecStringConstants::Table ); + if ( origHeader.DesC().CompareF( array[KHeaderIndex] ) != 0 ) + { + // Header didn't match + User::Leave( KErrSdpCodecConnectionField ); + } + + // + CopyNetTypeL( array[KNetworkTypeIndex] ); + + //
+ CopyAddressTypeL( array[KAddressTypeIndex] ); + + //
+ CopyAddressL( array[KAddressIndex], iPool ); + + CleanupStack::PopAndDestroy(); // array + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::ConstructL( + const TInetAddr& aAddress, + TInt aTTL, + TUint aNumOfAddress ) + { + __ASSERT_ALWAYS( IsValidAddress(aAddress, aTTL, aNumOfAddress) == KErrNone, + User::Leave( KErrSdpCodecConnectionField ) ); + + iPool = SdpCodecStringPool::StringPoolL(); + TBuf addr; + //If aAddress is IPv4-Mapped IPv6,the result of Output is IPv4 + aAddress.Output( addr ); + + // Copy address + iAddress = HBufC8::NewL( addr.Length() ); + iAddress->Des().Copy( addr ); + + // TTL + iTTL = aTTL; + // Num of addresses + iNumOfAddress = aNumOfAddress; + // Network type + iNetType = iPool.StringF( SdpCodecStringConstants::ENetType, + SdpCodecStringConstants::Table ).Copy(); + // Address type + if ( UriUtils::HostType( addr ) == UriUtils::EIPv4Host ) + { + //addresstype for IPv4 + iAddressType = iPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ).Copy(); + } + else if ( UriUtils::HostType( addr ) == UriUtils::EIPv6Host ) + { + //addresstype IPv6 + iAddressType = iPool.StringF( SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ).Copy(); + } + else + { + User::Leave(KErrArgument); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::ConstructL( + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + iPool = SdpCodecStringPool::StringPoolL(); + + // Network type + CopyNetTypeL( aNetType.DesC() ); + + // Address type + CopyAddressTypeL( aAddressType.DesC() ); + + // Address + TTL + numOfAddress + CopyAddressL( aAddress, aNetType.Pool() ); + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::DecodeL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::DecodeL( + const TDesC8& aText ) + { + CSdpConnectionField* obj = CSdpConnectionField::DecodeLC( aText ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::DecodeLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::DecodeLC( + const TDesC8& aText ) + { + CSdpConnectionField* obj = new ( ELeave ) CSdpConnectionField; + CleanupStack::PushL( obj ); + obj->ConstructL( aText ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::NewL( + const TInetAddr& aAddress, + TInt aTTL, + TUint aNumOfAddress ) + { + CSdpConnectionField* obj = CSdpConnectionField::NewLC( + aAddress, aTTL, aNumOfAddress ); + CleanupStack::Pop(); + return obj; + } +// ----------------------------------------------------------------------------- +// CSdpConnectionField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::NewLC( + const TInetAddr& aAddress, + TInt aTTL, + TUint aNumOfAddress ) + { + CSdpConnectionField* obj = new ( ELeave ) CSdpConnectionField; + CleanupStack::PushL( obj ); + obj->ConstructL( aAddress, aTTL, aNumOfAddress ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::NewL( + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + CSdpConnectionField* obj = CSdpConnectionField::NewLC( + aNetType, aAddressType, aAddress ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::NewLC( + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + CSdpConnectionField* obj = new ( ELeave ) CSdpConnectionField; + CleanupStack::PushL( obj ); + obj->ConstructL( aNetType, aAddressType, aAddress ); + return obj; + } + +// Destructor +EXPORT_C CSdpConnectionField::~CSdpConnectionField() + { + delete iAddress; + iNetType.Close(); + iAddressType.Close(); + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpConnectionField::EncodeL( + RWriteStream& aStream ) const + { + __TEST_INVARIANT; + TBuf8<20> number; // Is enough for addr as well + + // c=
+ RStringF header = iPool.StringF( SdpCodecStringConstants::EConnection, + SdpCodecStringConstants::Table ); + aStream.WriteL( header.DesC() ); + + // Network type + aStream.WriteL( iNetType.DesC() ); + aStream.WriteL( KSPStr ); + + // Address type + aStream.WriteL( iAddressType.DesC() ); + aStream.WriteL( KSPStr ); + + // Connection address + aStream.WriteL( *iAddress ); + if ( iTTL != KErrNotFound ) + { + number.Zero(); + number.Append( KSlashStr ); + number.AppendFormat( _L8("%d"), iTTL ); + aStream.WriteL( number ); + } + + if ( iNumOfAddress > 1 ) + { + number.Zero(); + number.Append( KSlashStr ); + number.AppendFormat( _L8("%u"), iNumOfAddress ); + aStream.WriteL( number ); + } + + // End-of-Line mark + aStream.WriteL( KCRLFStr ); + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::CloneL +// Clones an exact copy of this object +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpConnectionField::CloneL() const + { + __TEST_INVARIANT; + + CSdpConnectionField* obj = NULL; + const TInetAddr* addr = InetAddress(); + + if ( addr ) + { + // Could be anything + obj = CSdpConnectionField::NewL( *addr, iTTL, iNumOfAddress ); + } + else + { + // Unicast FQDN address + obj = CSdpConnectionField::NewL( iNetType, iAddressType, *iAddress ); + } + + __ASSERT_DEBUG( *this == *obj, User::Panic( + KSdpCodecPanicCat, KSdpCodecPanicInternal)); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::operator== +// Checks if two origin fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpConnectionField::operator== ( + const CSdpConnectionField& aObj ) const + { + __TEST_INVARIANT; + + TBool equal( EFalse ); + + if ( (*iAddress).CompareF( aObj.Address() ) == 0 && + NetType() == aObj.NetType() && + AddressType() == aObj.AddressType() && + TTLValue() == aObj.TTLValue() && + NumOfAddress() == aObj.NumOfAddress() ) + { + // All attributes match, two fields are equal + equal = ETrue; + } + + return equal; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::NetType +// Returns network type +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpConnectionField::NetType() const + { + __TEST_INVARIANT; + return iNetType; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::AddressType +// Returns address type +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpConnectionField::AddressType() const + { + __TEST_INVARIANT; + return iAddressType; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::InetAddress +// Returns address in TInetAddr format if possible +// ----------------------------------------------------------------------------- +// +EXPORT_C const TInetAddr* CSdpConnectionField::InetAddress() const + { + __TEST_INVARIANT; + + TInetAddr* addr = NULL; + TBuf addr16; + + addr16.Copy( iAddress->Des() ); + TInt err = iInetAddress.Input( addr16 ); + + if ( err == KErrNone ) + { + addr = &iInetAddress; + } + + return addr; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::Address +// Returns address in TDesC8 format +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpConnectionField::Address() const + { + return *iAddress; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::SetInetAddressL +// Sets address from TInetAddr +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpConnectionField::SetInetAddressL( + const TInetAddr& aAddress, + TInt aTTL, + TUint aNumOfAddress ) + { + __TEST_INVARIANT; + + if ( IsValidAddress( aAddress, aTTL, aNumOfAddress ) == KErrNone ) + { + TBuf addr16; + //If aAddress IPv4-Mapped IPv6, result of Output IPv4 + aAddress.Output( addr16 ); + + HBufC8* tempBuf = HBufC8::NewL( addr16.Length() ); + tempBuf->Des().Copy( addr16 ); + + SdpUtil::SetDefaultNetTypeAndAddrType( + iPool, aAddress, iNetType, iAddressType ); + if(aAddress.Address() && aAddress.IsV4Mapped()) + { + iAddressType.Close(); + iAddressType = iPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ).Copy(); + } + // Set address + delete iAddress; + iAddress = tempBuf; + // Set attributes for address + iTTL = aTTL; + iNumOfAddress = aNumOfAddress; + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::SetAddressL +// Sets new address and types, leaves on error +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpConnectionField::SetAddressL( + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + __TEST_INVARIANT; + TInt err( KErrNone ); + RStringF netTypeBackup = iNetType.Copy(); + RStringF addressTypeBackup = iAddressType.Copy(); + CleanupClosePushL( netTypeBackup ); + CleanupClosePushL( addressTypeBackup ); + + TRAP( err, CopyNetTypeL( aNetType.DesC() ) ); + if ( !err ) + { + // Netowrk type changed successfully + TRAP( err, CopyAddressTypeL( aAddressType.DesC() ) ); + if ( !err ) + { + // Address type & network type changed successfully + TRAP( err, CopyAddressL( aAddress, iAddressType.Pool() ) ); + + if ( err ) + { + // Place back old netType & address + iNetType.Close(); + iNetType = netTypeBackup.Copy(); + + iAddressType.Close(); + iAddressType = addressTypeBackup.Copy(); + + User::LeaveIfError( err ); + } + // Everything changed succesfully + } + else + { + // Place back old netType + iNetType.Close(); + iNetType = netTypeBackup.Copy(); + + User::LeaveIfError( err ); + } + } + else + { + User::LeaveIfError( err ); + } + + CleanupStack::PopAndDestroy( 2 ); // netTypeBackup, addressTypeBackup + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::TTLValue +// Returns TTL attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSdpConnectionField::TTLValue() const + { + __TEST_INVARIANT; + return iTTL; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::SetTTLL +// Sets new TTL attribute value, leaves on error +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpConnectionField::SetTTLL( + TInt aTTL ) + { + __TEST_INVARIANT; + + const TInetAddr* addr = InetAddress(); + + // FQDN; Unicast, can be only KErrNotFound + // IP4 Multicast: 0 <= TTL <= 255 + // IP4 Unicast, can be only KErrNotFound + // IP6 can be only KErrNotFound + + if ( ( !addr && aTTL != KErrNotFound ) || + ( addr && addr->Address() && addr->IsMulticast() && + ( aTTL < 0 || aTTL > 255 ) ) || + ( addr && addr->Address() && !addr->IsMulticast() && + aTTL != KErrNotFound ) || + ( addr && !addr->Address() && aTTL != KErrNotFound ) ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + + iTTL = aTTL; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::NumOfAddress +// Returns number of continuous addresses for multicast +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSdpConnectionField::NumOfAddress() const + { + return iNumOfAddress; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::SetNumOfAddressL +// Sets number of addresses +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpConnectionField::SetNumOfAddressL( + TUint aNumOfAddress ) + { + const TInetAddr* addr = InetAddress(); + if ( aNumOfAddress < 1 || ( !addr && aNumOfAddress != 1 ) || + ( addr && !addr->IsMulticast() && aNumOfAddress != 1 ) ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + + iNumOfAddress = aNumOfAddress; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ExternalizeL +// Externalizes the object to stream +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::ExternalizeL( + RWriteStream& aStream ) const + { + __TEST_INVARIANT; + + // Address + aStream.WriteUint32L( iAddress->Des().Length() ); + aStream.WriteL( iAddress->Des(), iAddress->Des().Length() ); + // TTL + aStream.WriteInt32L( iTTL ); + // Number of addresses + aStream.WriteInt32L( iNumOfAddress ); + // + aStream.WriteUint32L( iNetType.DesC().Length() ); + aStream.WriteL( iNetType.DesC() ); + //
+ aStream.WriteUint32L( iAddressType.DesC().Length() ); + aStream.WriteL( iAddressType.DesC() ); + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::InternalizeL +// Internalizes the object from stream +// ----------------------------------------------------------------------------- +// +CSdpConnectionField* CSdpConnectionField::InternalizeL( + RReadStream& aStream ) + { + TUint32 length; + CSdpConnectionField* obj = NULL; + RStringPool pool = SdpCodecStringPool::StringPoolL(); + + // address + length = aStream.ReadUint32L(); + HBufC8* address = HBufC8::NewLC( length ); + TPtr8 ptr( address->Des() ); + aStream.ReadL( ptr, length ); + // TTL + TInt ttl = aStream.ReadInt32L(); + // Number of addresses + TInt numOfAddr = aStream.ReadInt32L(); + // Network type + length = aStream.ReadUint32L(); + HBufC8* netType = HBufC8::NewLC( length ); + ptr.Set( netType->Des() ); + aStream.ReadL( ptr, length ); + // Address type + length = aStream.ReadUint32L(); + HBufC8* addrType = HBufC8::NewLC( length ); + ptr.Set( addrType->Des() ); + aStream.ReadL( ptr, length ); + + TInetAddr addr; + HBufC* address16 = HBufC::NewLC( address->Length() ) ; + address16->Des().Copy( *address ); + TInt err = addr.Input( *address16 ); + + if ( !err ) + { + // Create connection field based on TInetAddr + obj = CSdpConnectionField::NewL( addr, ttl, numOfAddr ); + } + else + { + // Create connection field from buffer, ttl & numOfAddr + // are in this case irrelevant + RStringF netTypeStr = pool.OpenFStringL( *netType ); + CleanupClosePushL( netTypeStr ); + RStringF addrTypeStr = pool.OpenFStringL( *addrType ); + CleanupClosePushL( addrTypeStr ); + obj = CSdpConnectionField::NewL( netTypeStr, addrTypeStr, *address ); + CleanupStack::PopAndDestroy( 2 ); // netTypeStr, addrTypeStr + } + + CleanupStack::PopAndDestroy( 4 ); // address, netType, addrType, address16 + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::IsValidAddress +// Checks if the given address is valid +// ----------------------------------------------------------------------------- +// +TInt CSdpConnectionField::IsValidAddress( + TBool aAddressTypeIP4, + const TDesC8& aAddress ) const + { + HBufC8* address = NULL; + TInt ttl( 0 ); + TUint num( 0 ); + + TRAPD( err, address = + ParseAddressFieldL( aAddressTypeIP4, aAddress, ttl, num ) ); + delete address; + + return err; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::IsValidAddress +// Checks if the given address is valid +// ----------------------------------------------------------------------------- +// +TInt CSdpConnectionField::IsValidAddress( + const TInetAddr& aAddress, + TInt aTTL, + TUint aNumOfAddress ) const + { + TInt err( KErrSdpCodecConnectionField ); + // 0 <= TTL <= 255 or KErrNotFound if not defined + // Number of addresses > 0 + if ( ( aTTL == KErrNotFound || ( aTTL >= 0 && aTTL <= 255 ) ) && + aNumOfAddress > 0 ) + { + TBuf16 output; + aAddress.Output(output); + + // Address has to be either of type IP4 or IP6 + // If IP4 and multicast then it must contain TTL attribute + // If IP4 and unicast then it must NOT contain TTL and must have 1 address + // If IP6 and multicast then it must NOT contain TTL + // If IP6 and unicast then it must NOT contain TTL and must have 1 address + if ( ( aAddress.Address() && + ( ( aAddress.IsMulticast() && aTTL != KErrNotFound ) || + ( aAddress.IsUnicast() && aTTL == KErrNotFound && + aNumOfAddress == 1 ) ) ) || + ( !aAddress.Address() && + ( ( aAddress.IsMulticast() && aTTL == KErrNotFound ) || + ( aAddress.IsUnicast() && aTTL == KErrNotFound && + aNumOfAddress == 1 ) ) || + ( aAddress.IsWildAddr() && + ( output.Match(KWildAddr) == 0|| + output.Match(KWildAddrIPv6) == 0 )) ) ) + { + err = KErrNone; + } + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ParseAddressFieldL +// Format the address field +// ----------------------------------------------------------------------------- +// +HBufC8* CSdpConnectionField::ParseAddressFieldL( + TBool aAddressTypeIP4, + const TDesC8& aAddress, + TInt& aTTL, + TUint& aNumberOfAddresses ) const + { + HBufC8* address = NULL; + + if ( aAddress.Length() > 0 && aAddress.Length() <= KMaxAddressLength ) + { + // IP4 address + TInetAddr addr; + TBuf buf16; + + // IP address lasts till first separator mark + TInt pos = aAddress.Locate( KSlashChar ); + if ( pos == KErrNotFound ) + { + pos = aAddress.Length(); + } + buf16.Copy( aAddress.Left( pos ) ); + + // Try to convert the string to TInetAddr + TInt err = addr.Input( buf16 ); + + //Type and address check + TBuf16 output; + addr.Output(output); + if (err == KErrNone) + { + if (addr.Address() ) + { + if ( (addr.IsV4Mapped() && aAddressTypeIP4) || + (!addr.IsV4Mapped() && !aAddressTypeIP4) ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + else + { + // IP4 address + address = ParseIP4AddressL( pos, addr, aAddress, aTTL, + aNumberOfAddresses ); + } + } + else + { + if ( !aAddressTypeIP4) + { + // IP6 address + address = ParseIP6AddressL( pos, addr, aAddress, aTTL, + aNumberOfAddresses ); + } + else if ( addr.IsWildAddr() && output.Match(KWildAddr) == 0 ) + { + // 0.0.0.0 + address = ParseIP4AddressL( pos, addr, aAddress, aTTL, + aNumberOfAddresses ); + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + } + } + else + { + // FQDN + // Clarify that the address contains only valid FQDN chars + // This is always unicast + for ( TInt i( 0 ); i < aAddress.Length(); i++ ) + { + if ( KValidFQDNChars().Locate( aAddress[i] ) == + KErrNotFound ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + } + address = aAddress.AllocL(); + aTTL = KErrNotFound; + aNumberOfAddresses = 1; + } + + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + + return address; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ParseIP4AddressL +// Parses IP4 address and checks that it is valid +// ----------------------------------------------------------------------------- +// +HBufC8* CSdpConnectionField::ParseIP4AddressL( + TInt aPos, + TInetAddr& aAddr, + const TDesC8& aAddress, + TInt& aTTL, + TUint& aNumberOfAddresses ) const + { + HBufC8* address = NULL; + + if ( aAddr.IsMulticast() ) + { + // Multicast address - MUST contain TTL and possibly + // number of addresses + if ( aPos != aAddress.Length() ) + { + TInt pos2 = aAddress.Right( aAddress.Length() - aPos - 1 ).Locate( + KSlashChar ); + + if ( pos2 != KErrNotFound ) + { + pos2 += aPos + 1; + + // Validity check for number strings + TBool digit = SdpUtil::IsDigit( + aAddress.Mid( aPos + 1, pos2 - aPos - 1 ) ); + digit = digit && SdpUtil::IsDigit( + aAddress.Mid( pos2 + 1, aAddress.Length() - pos2 - 1 ) ); + if ( !digit ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + + // TTL & number of addresses + User::LeaveIfError( + TLex8( aAddress.Mid( aPos + 1, pos2 - aPos - 1 ) ).Val( + aTTL ) ); + User::LeaveIfError( + TLex8( aAddress.Mid( + pos2 + 1, aAddress.Length() - pos2 - 1 ) ).Val( + aNumberOfAddresses, EDecimal ) ); + + __ASSERT_ALWAYS( aTTL >= 0 + && aTTL <= 255 + && aNumberOfAddresses > 0, + User::Leave( KErrSdpCodecConnectionField ) ); + } + else + { + // Validity check for number strings + TBool digit = SdpUtil::IsDigit( + aAddress.Mid( aPos + 1, aAddress.Length() - aPos - 1 ) ); + if ( !digit ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + + // Plain TTL + User::LeaveIfError( + TLex8( aAddress.Mid( + aPos + 1, aAddress.Length() - aPos - 1 ) ).Val( + aTTL ) ); + aNumberOfAddresses = 1; + + __ASSERT_ALWAYS( aTTL >= 0 && aTTL <= 255, + User::Leave( KErrSdpCodecConnectionField ) ); + } + + address = aAddress.Left( aPos ).AllocL(); + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + } + else + { + // Unicast address - cannot contain any multicast TTLs etc. + if ( aPos == aAddress.Length() ) + { + address = aAddress.AllocL(); + aTTL = KErrNotFound; + aNumberOfAddresses = 1; + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + } + + return address; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::ParseIP6AddressL +// Parses IP6 address and checks that it is valid +// ----------------------------------------------------------------------------- +// +HBufC8* CSdpConnectionField::ParseIP6AddressL( + TInt aPos, + TInetAddr& aAddr, + const TDesC8& aAddress, + TInt& aTTL, + TUint& aNumberOfAddresses ) const + { + HBufC8* address = NULL; + + if ( aAddr.IsMulticast() ) + { + // Multicast address - CAN contain one extra attribute, + // number of addresses + if ( aPos != aAddress.Length() ) + { + // Validity check for number strings + + TBool digit = SdpUtil::IsDigit( + aAddress.Mid( aPos + 1, aAddress.Length() - aPos - 1 ) ); + if ( !digit ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + + User::LeaveIfError( TLex8( aAddress.Mid( + aPos + 1, aAddress.Length() - aPos - 1 ) ).Val( + aNumberOfAddresses, EDecimal ) ); + + __ASSERT_ALWAYS( aNumberOfAddresses > 0, + User::Leave( KErrSdpCodecConnectionField ) ); + } + else + { + aNumberOfAddresses = 1; + } + + aTTL = KErrNotFound; // IP6 does not use TTL + address = aAddress.Left( aPos ).AllocL(); + } + else + { + // Unicast address - cannot contain any multicast TTLs etc. + if ( aPos == aAddress.Length() ) + { + address = aAddress.AllocL(); + aTTL = KErrNotFound; + aNumberOfAddresses = 1; + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + } + + return address; + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::CopyNetTypeL +// Copies network type to object after checking that it is valid +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::CopyNetTypeL( + const TDesC8& aNetType ) + { + if ( !SdpUtil::IsToken( aNetType ) ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + else + { + RStringF netType = iPool.OpenFStringL( aNetType ); + iNetType.Close(); + iNetType = netType; + } + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::CopyAddressTypeL +// Copies address type after checking that it is valid +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::CopyAddressTypeL( + const TDesC8& aAddrType ) + { + if ( !SdpUtil::IsToken( aAddrType ) ) + { + User::Leave( KErrSdpCodecConnectionField ); + } + else + { + RStringF addrType = iPool.OpenFStringL( aAddrType ); + iAddressType.Close(); + iAddressType = addrType; + } + } + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::CopyAddressL +// Copies address after checking that it is valid +// ----------------------------------------------------------------------------- +// +void CSdpConnectionField::CopyAddressL( + const TDesC8& aAddress, + RStringPool aPool ) + { + RStringF addrTypeIP4 = aPool.StringF( + SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ); + RStringF addrTypeIP6 = aPool.StringF( + SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ); + HBufC8* addr = NULL; + + if ( iAddressType == addrTypeIP4 || iAddressType == addrTypeIP6 ) + { + User::LeaveIfError( + IsValidAddress( iAddressType == addrTypeIP4, aAddress ) ); + + addr = ParseAddressFieldL( iAddressType == addrTypeIP4, aAddress, + iTTL, iNumOfAddress ); + //If address is IPv4-Mapped IPv6 , it is changed to IPv4 + TInetAddr inetaddr; + TBuf address; + address.Copy(*addr); + TInt err = inetaddr.Input(address); + TBuf16 output; + inetaddr.Output(output); + if(!err && + ( ( inetaddr.Address() && inetaddr.IsV4Mapped() ) || + ( inetaddr.IsWildAddr() && output.Match(KWildAddr) != KErrNotFound ) + ) ) + {//IPv4-Mapped IPv6 is changed to IPv4 address + TBuf buf; + inetaddr.Output( buf ); + // Copy new address to safe + delete addr; + addr = NULL; + addr = HBufC8::NewL(buf.Length()); + addr->Des().Copy(buf); + iAddressType.Close(); + iAddressType = + iPool.StringF(SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ).Copy(); + } + + } + else + { + // Address not IP4 or IP6, must be then non-ws-string + if ( SdpUtil::IsNonWhitespace( aAddress ) ) + { + addr = aAddress.AllocL(); + } + else + { + User::Leave( KErrSdpCodecConnectionField ); + } + } + + delete iAddress; + iAddress = addr; + } + +// For DEBUG builds + +// ----------------------------------------------------------------------------- +// CSdpConnectionField::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// + +void CSdpConnectionField::__DbgTestInvariant() const + { + TBool validAddr = EFalse; + + RStringF addrTypeIP4 = iPool.StringF( + SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ); + RStringF addrTypeIP6 = iPool.StringF( + SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ); + + if ( iAddress && + ( iAddressType == addrTypeIP4 || iAddressType == addrTypeIP6 ) ) + { + TInetAddr addr; + TBuf buf16; + buf16.Copy( *iAddress ); + TInt err = addr.Input( buf16 ); + if ( !err ) + { + validAddr = IsValidAddress(addr, iTTL, iNumOfAddress) == KErrNone; + } + else + { + // FQDN unicast + if ( iTTL == KErrNotFound && iNumOfAddress == 1 ) + { + validAddr = ETrue; + } + } + } + + TBool invariant = ( SdpUtil::IsToken( iNetType.DesC() ) && + SdpUtil::IsToken( iAddressType.DesC() ) && + iAddress && SdpUtil::IsNonWhitespace( *iAddress ) && + validAddr ); + + if ( !invariant ) + { + User::Invariant(); + } + } + + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpdocument.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,914 @@ +// Copyright (c) 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: +// Name : SdpDocument.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include +#include "sdpdocument.h" +#include "sdptimefield.h" +#include "sdpbandwidthfield.h" +#include "sdpattributefield.h" +#include "sdpmediafield.h" +#include "sdpconnectionfield.h" +#include "sdpkeyfield.h" +#include "sdporiginfield.h" +#include "sdprepeatfield.h" +#include "sdpcodecstringconstants.h" +#include "sdpcodecerr.h" +#include "sdpcodecconstants.h" +#include "uri8.h" +#include "uriutilscommon.h" +#include "badesca.h" +#include "_sdpdefs.h" +#include "sdpcodecstringpool.h" +#include "sdputil.h" +#include "sdpcodectemplate.h" +#include "sdpcodecparseutil.h" + +_LIT8(KCRLF, "\r\n"); +// ---------------------------------------------------------------------------- +// CSdpDocument::DecodeL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument* +CSdpDocument::DecodeL(const TDesC8& aText) + { + CSdpDocument* sdpDocument = CSdpDocument::DecodeLC(aText); + CleanupStack::Pop(); + return sdpDocument; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::DecodeLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument* +CSdpDocument::DecodeLC(const TDesC8& aText) + { + __ASSERT_ALWAYS (aText.Length() > 0, User::Leave(KErrArgument)); + CSdpDocument* sdpDocument = new(ELeave)CSdpDocument; + CleanupStack::PushL(sdpDocument); + sdpDocument->ConstructL(); + sdpDocument->ParseL(aText); + return sdpDocument; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument* CSdpDocument::NewL() + { + CSdpDocument* self = CSdpDocument::NewLC(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::NewLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument* CSdpDocument::NewLC() + { + CSdpDocument* self = new(ELeave)CSdpDocument; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::~CSdpDocument +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument::~CSdpDocument() + { + delete iInfo; + delete iSessionName; + delete iZoneAdjustments; + delete iSdpKeyField; + delete iSdpOriginField; + delete iSdpConnectionField; + if(iTimeFields) + { + iTimeFields->ResetAndDestroy(); + delete iTimeFields; + } + if(iBandwidthFields) + { + iBandwidthFields->ResetAndDestroy(); + delete iBandwidthFields; + } + if(iAttributeFields) + { + iAttributeFields->ResetAndDestroy(); + delete iAttributeFields; + } + if(iMediaFields) + { + iMediaFields->ResetAndDestroy(); + delete iMediaFields; + } + delete iUri; + if(iEmailFields) + { + iEmailFields->Reset(); + delete iEmailFields; + } + + if(iPhoneFields) + { + iPhoneFields->Reset(); + delete iPhoneFields; + } + delete iToken; + delete iSdpCodecParseUtil; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::ExternalizeL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteUint32L (iSdpVersion); + SdpCodecTemplate::ExternalizeL(OriginField(), aStream); + aStream.WriteUint32L (iSessionName->Length()); + if (iSessionName->Length() > 0) + { + aStream.WriteL (*iSessionName); + } + aStream.WriteUint32L (iInfo->Length()); + if (iInfo->Length() > 0) + { + aStream.WriteL (*iInfo); + } + if(Uri()) + { + aStream.WriteUint8L (1); + aStream.WriteUint32L ((iUri->Uri()).UriDes().Length()); + aStream.WriteL((iUri->Uri()).UriDes()); + } + else + { + aStream.WriteUint8L (0); + } + ExternalizeDesCArrayL(*iEmailFields, aStream); + ExternalizeDesCArrayL(*iPhoneFields, aStream); + + SdpCodecTemplate::ExternalizeL(iSdpConnectionField, + aStream); + SdpCodecTemplate::ExternalizeArrayL(*iBandwidthFields, + aStream); + SdpCodecTemplate::ExternalizeArrayL(*iTimeFields, aStream); + aStream.WriteUint32L (iZoneAdjustments->Length()); + if (iZoneAdjustments->Length() > 0) + { + aStream.WriteL (*iZoneAdjustments); + } + SdpCodecTemplate::ExternalizeL(Key(), aStream); + SdpCodecTemplate::ExternalizeArrayL(*iAttributeFields, + aStream); + SdpCodecTemplate::ExternalizeArrayL(*iMediaFields, + aStream); + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::InternalizeL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument* +CSdpDocument::InternalizeL(RReadStream& aStream) + { + CSdpDocument* self = new(ELeave)CSdpDocument; + CleanupStack::PushL(self); + self->ConstructL(); + self->DoInternalizeL (aStream); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::DoInternalizeL +// ---------------------------------------------------------------------------- +// +void CSdpDocument::DoInternalizeL(RReadStream& aStream) + { + if(iTimeFields) + { + iTimeFields->ResetAndDestroy(); + } + iSdpVersion = aStream.ReadUint32L(); + if(aStream.ReadUint8L()) + { + SetOriginField(CSdpOriginField::InternalizeL(aStream)); + } + SetSessionNameL(GetTokenFromStreamL(aStream)); + SetInfoL(GetTokenFromStreamL(aStream)); + if(aStream.ReadUint8L()) + { + TUriParser8 parser; + User::LeaveIfError(parser.Parse(GetTokenFromStreamL(aStream))); + SetUri(CUri8::NewL(parser)); + } + TInt i = 0; + TInt count = aStream.ReadUint32L(); + for (i = 0;i < count;i++) + { + TPtrC8 temp(GetTokenFromStreamL(aStream)); + if(temp.Compare(KNullDesC8) != 0) + { + iEmailFields->AppendL(temp); + } + } + count = aStream.ReadUint32L(); + for (i = 0;i < count;i++) + { + TPtrC8 temp(GetTokenFromStreamL(aStream)); + if(temp.Compare(KNullDesC8) != 0) + { + iPhoneFields->AppendL(temp); + } + } + if(aStream.ReadUint8L()) + { + SetConnectionField(CSdpConnectionField::InternalizeL(aStream)); + } + SdpCodecTemplate::InternalizeArrayL( + *iBandwidthFields, aStream); + SdpCodecTemplate::InternalizeArrayL(*iTimeFields, + aStream); + SetZoneAdjustmentsL(GetTokenFromStreamL(aStream)); + if(aStream.ReadUint8L()) + { + SetKey(CSdpKeyField::InternalizeL(aStream)); + } + SdpCodecTemplate::InternalizeArrayL( + *iAttributeFields, aStream); + SdpCodecTemplate::InternalizeArrayL(*iMediaFields, + aStream); + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::EncodeL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::EncodeL(RWriteStream& aStream) const + { + RStringF headername = iPool.StringF( SdpCodecStringConstants::EVersion, + SdpCodecStringConstants::Table ); + aStream.WriteL(headername.DesC()); + TBuf8<80> text; + text.Format(_L8("%u"), iSdpVersion); + aStream.WriteL(text); + aStream.WriteL(KCRLF); + SdpCodecTemplate::EncodeL(OriginField(), aStream); + SdpUtil::EncodeBufferL(*iSessionName, SdpCodecStringConstants::ESession, + aStream); + SdpUtil::EncodeBufferL(*iInfo, SdpCodecStringConstants::EInfo, aStream); + if(Uri()) + { + SdpUtil::EncodeBufferL(((iUri->Uri()).UriDes()), + SdpCodecStringConstants::EUri, aStream); + } + EncodeDesCArrayL(*iEmailFields, SdpCodecStringConstants::EEmail, aStream); + EncodeDesCArrayL(*iPhoneFields, SdpCodecStringConstants::EPhone, aStream); + SdpCodecTemplate::EncodeL(iSdpConnectionField, + aStream); + SdpCodecTemplate::EncodeArrayL(*iBandwidthFields, + aStream); + SdpCodecTemplate::EncodeArrayL(*iTimeFields, aStream); + SdpUtil::EncodeBufferL(*iZoneAdjustments, + SdpCodecStringConstants::EZone, aStream); + SdpCodecTemplate::EncodeL(Key(), aStream); + SdpCodecTemplate::EncodeArrayL(*iAttributeFields, + aStream); + SdpCodecTemplate::EncodeArrayL(*iMediaFields, aStream); + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::CloneL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpDocument* CSdpDocument::CloneL() const + { + CSdpDocument* sdpdocument = new(ELeave)CSdpDocument; + CleanupStack::PushL(sdpdocument); + sdpdocument->ConstructL(*this); + CleanupStack::Pop();//sdpdocument + return sdpdocument; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::IsValid +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpDocument::IsValid() const + { + if (iTimeFields->Count() == 0 || !OriginField() || + !SessionName().Length()|| + (!iMediaFields->Count() && !ConnectionField())) + { + return EFalse; + } + TInt j; + for (j=0; j < iMediaFields->Count(); j++) + { + if(!(*iMediaFields)[j]->IsValid() || + (!ConnectionField() && (!(*iMediaFields)[j]->IsContactPresent()))) + { + return EFalse; + } + } + + for (j=0; j < iTimeFields->Count(); j++) + { + if ( !(*iTimeFields)[j]->IsValid()) + { + return EFalse; + } + } + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SdpVersion +// ---------------------------------------------------------------------------- +// +EXPORT_C TUint CSdpDocument::SdpVersion() const + { + return iSdpVersion; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::OriginField +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpDocument::OriginField() + { + return iSdpOriginField; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::OriginField +// ---------------------------------------------------------------------------- +// +EXPORT_C const CSdpOriginField* CSdpDocument::OriginField() const + { + return iSdpOriginField; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetOriginField +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetOriginField(CSdpOriginField* aObj) + { + delete iSdpOriginField; + iSdpOriginField = aObj; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SessionName +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpDocument::SessionName() const + { + return *iSessionName; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetSessionNameL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetSessionNameL(const TDesC8& aValue) + { + __ASSERT_ALWAYS (aValue.Compare(KNullDesC8) == 0|| + aValue.Compare(_L8(" ")) == 0|| + SdpUtil::IsByteString(aValue), + User::Leave(KErrSdpCodecSessionField)); + HBufC8* tmp = aValue.AllocL(); + delete iSessionName; + iSessionName = tmp; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::Info +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpDocument::Info() const + { + return *iInfo; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetInfoL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetInfoL(const TDesC8& aValue) + { + __ASSERT_ALWAYS (aValue.Compare(KNullDesC8) == 0|| + SdpUtil::IsByteString(aValue), + User::Leave(KErrSdpCodecInfoField)); + HBufC8* tmp = aValue.AllocL(); + tmp->Des().Trim(); + delete iInfo; + iInfo = tmp; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::Uri +// ---------------------------------------------------------------------------- +// +EXPORT_C CUri8* CSdpDocument::Uri() + { + return iUri; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::Uri +// ---------------------------------------------------------------------------- +// +EXPORT_C const CUri8* CSdpDocument::Uri() const + { + return iUri; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetUriL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetUri(CUri8* aValue) + { + delete iUri; + iUri = aValue; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::EmailFields +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesC8Array& CSdpDocument::EmailFields() + { + return *iEmailFields; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::PhoneFields +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesC8Array& CSdpDocument::PhoneFields() + { + return *iPhoneFields; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::ConnectionField +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpConnectionField* CSdpDocument::ConnectionField() + { + return iSdpConnectionField; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::ConnectionField +// ---------------------------------------------------------------------------- +// +EXPORT_C const CSdpConnectionField* CSdpDocument::ConnectionField() const + { + return iSdpConnectionField; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetConnectionField +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetConnectionField(CSdpConnectionField* aObj) + { + delete iSdpConnectionField; + iSdpConnectionField = aObj; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::BandwidthFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpDocument::BandwidthFields() + { + return *iBandwidthFields; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::TimeFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpDocument::TimeFields() + { + return *iTimeFields; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::ZoneAdjustments +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpDocument::ZoneAdjustments() const + { + return *iZoneAdjustments; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetZoneAdjustmentsL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetZoneAdjustmentsL(const TDesC8& aValue) + { + HBufC8* tmp = aValue.AllocL(); + tmp->Des().Trim(); + delete iZoneAdjustments; + iZoneAdjustments = tmp; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::Key +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField* CSdpDocument::Key() + { + return iSdpKeyField; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::Key +// ---------------------------------------------------------------------------- +// +EXPORT_C const CSdpKeyField* CSdpDocument::Key() const + { + return iSdpKeyField; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::SetKey +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpDocument::SetKey(CSdpKeyField* aObj) + { + delete iSdpKeyField; + iSdpKeyField = aObj; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::AttributeFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpDocument::AttributeFields() + { + return *iAttributeFields; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::MediaFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpDocument::MediaFields() + { + return *iMediaFields; + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::CSdpDocument +// ---------------------------------------------------------------------------- +// +CSdpDocument::CSdpDocument() + { + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpDocument::ConstructL() + { + iPool = SdpCodecStringPool::StringPoolL(); + iInfo = KNullDesC8().AllocL(); + iSessionName = KNullDesC8().AllocL(); + iZoneAdjustments = KNullDesC8().AllocL(); + iSdpVersion = 0; + iEmailFields = new(ELeave)CDesC8ArraySeg(1); + iPhoneFields = new(ELeave)CDesC8ArraySeg(1); + iBandwidthFields = new(ELeave)RPointerArray; + iTimeFields = new(ELeave)RPointerArray; + iAttributeFields = new(ELeave)RPointerArray; + iMediaFields = new(ELeave)RPointerArray; + CSdpTimeField* timefield = CSdpTimeField::NewLC(_L8("0"),_L8("0")); + User::LeaveIfError(iTimeFields->Append(timefield)); + CleanupStack::Pop(); + iToken = KNullDesC8().AllocL(); + } + +// ---------------------------------------------------------------------------- +// CSdpDocument::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpDocument::ConstructL(const CSdpDocument& aSdpDocument) + { + ConstructL(); + iSdpVersion = aSdpDocument.SdpVersion(); + if ( aSdpDocument.OriginField() ) + { + iSdpOriginField = aSdpDocument.OriginField()->CloneL(); + } + delete iSessionName; + iSessionName = 0; + iSessionName = aSdpDocument.SessionName().AllocL(); + HBufC8* tmp = aSdpDocument.Info().AllocL(); + delete iInfo; + iInfo = tmp; + if ( aSdpDocument.Uri() ) + { + iUri = CUri8::NewL(aSdpDocument.Uri()->Uri()); + } + TInt i = 0; + for ( i=0; i < (aSdpDocument.iEmailFields)->MdcaCount(); i++ ) + { + iEmailFields->AppendL(aSdpDocument.iEmailFields->MdcaPoint(i)); + } + + for (i=0; i < (aSdpDocument.iPhoneFields)->MdcaCount(); i++) + { + iPhoneFields->AppendL(aSdpDocument.iPhoneFields->MdcaPoint(i)); + } + + if ( aSdpDocument.ConnectionField() ) + { + iSdpConnectionField = aSdpDocument.ConnectionField()->CloneL(); + } + SdpCodecTemplate::CloneArrayL(*iBandwidthFields, + *aSdpDocument.iBandwidthFields); + if ( iTimeFields ) + { + iTimeFields->ResetAndDestroy(); + } + SdpCodecTemplate::CloneArrayL(*iTimeFields, + *aSdpDocument.iTimeFields); + delete iZoneAdjustments; + iZoneAdjustments = 0; + iZoneAdjustments = aSdpDocument.ZoneAdjustments().AllocL(); + if(aSdpDocument.Key()) + { + iSdpKeyField = aSdpDocument.Key()->CloneL(); + } + SdpCodecTemplate::CloneArrayL(*iAttributeFields, + *aSdpDocument.iAttributeFields); + SdpCodecTemplate::CloneArrayL(*iMediaFields, + *aSdpDocument.iMediaFields); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseL (const TDesC8& aText) + { + if(iTimeFields) + { + iTimeFields->ResetAndDestroy(); + delete iTimeFields; + iTimeFields = 0; + } + iSdpCodecParseUtil = CSdpCodecParseUtil::NewL(iPool,aText,KErrSdpCodecDecode); + ParseSessionVersionL(); + ParseSessionOwnerL(); + ParseSessionNameL(); + ParseSessionInformationL(); + ParseUriL(); + ParseEmailL(); + ParsePhoneL(); + ParseConnectionL(); + ParseBandwidthL(); + ParseTimeFieldL(); + ParseZoneAdjustmentL(); + ParseEncryptionKeyL(); + ParseAttributeFieldL(); + ParseMediaLevelL (); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseSessionVersionL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseSessionVersionL() + { + iSdpVersion = + iSdpCodecParseUtil->ParseSessionVersionL(KErrSdpCodecSessionField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseSessionOwnerL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseSessionOwnerL() + { + iSdpOriginField = iSdpCodecParseUtil->ParseSessionOwnerL( + KErrSdpCodecOriginField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseSessionNameL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseSessionNameL() + { + SetSessionNameL(iSdpCodecParseUtil->ParseSessionNameL( + KErrSdpCodecSessionField)); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseSessionInformationL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseSessionInformationL() + { + SetInfoL(iSdpCodecParseUtil->ParseInformationL(KErrSdpCodecInfoField)); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseUriL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseUriL() + { + SetUri(iSdpCodecParseUtil->ParseUriL(KErrSdpCodecUriField)); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseEmailL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseEmailL() + { + delete iEmailFields; + iEmailFields = NULL; + iEmailFields = iSdpCodecParseUtil->ParseEmailL(KErrSdpCodecEmailField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParsePhoneL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParsePhoneL() + { + delete iPhoneFields; + iPhoneFields = NULL; + iPhoneFields = iSdpCodecParseUtil->ParsePhoneL(KErrSdpCodecPhoneField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseConnectionL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseConnectionL() + { + iSdpConnectionField = + iSdpCodecParseUtil->ParseConnectionL(KErrSdpCodecConnectionField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseBandwidthL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseBandwidthL() + { + delete iBandwidthFields; + iBandwidthFields = 0; + iBandwidthFields = + iSdpCodecParseUtil->ParseBandwidthL(KErrSdpCodecBandwidthField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseTimeFieldL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseTimeFieldL() + { + delete iTimeFields; + iTimeFields = 0; + iTimeFields = iSdpCodecParseUtil->ParseTimeFieldL(KErrSdpCodecTimeField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseZoneAdjustmentL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseZoneAdjustmentL() + { + SetZoneAdjustmentsL( + iSdpCodecParseUtil->ParseZoneAdjustmentL(KErrSdpCodecZoneField)); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseEncryptionKeyL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseEncryptionKeyL() + { + SetKey(iSdpCodecParseUtil->ParseEncryptionKeyL(KErrSdpCodecKeyField)); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseAttributeFieldL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseAttributeFieldL() + { + delete iAttributeFields; + iAttributeFields = 0; + iAttributeFields = + iSdpCodecParseUtil->ParseAttributeFieldL(KErrSdpCodecAttributeField); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ParseMediaLevelL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ParseMediaLevelL() + { + delete iMediaFields; + iMediaFields = 0; + iMediaFields = iSdpCodecParseUtil->ParseMediaLevelL(); + } + +// --------------------------------------------------------------------------- +// CSdpDocument::ExternalizeDesCArrayL +// --------------------------------------------------------------------------- +// +void CSdpDocument::ExternalizeDesCArrayL(CDesC8ArraySeg& aArray, + RWriteStream& aStream) const + { + aStream.WriteUint32L (aArray.MdcaCount()); + for (TInt i = 0;i < aArray.MdcaCount();i++) + { + aStream.WriteUint32L (aArray.MdcaPoint(i).Length()); + aStream.WriteL(aArray.MdcaPoint(i)); + } + } + +// --------------------------------------------------------------------------- +// CSdpDocument::EncodeDesCArrayL +// --------------------------------------------------------------------------- +// +void CSdpDocument::EncodeDesCArrayL(CDesC8ArraySeg& aArray, TInt aIndex, + RWriteStream& aStream) const + { + RStringF headername = + iPool.StringF(aIndex, SdpCodecStringConstants::Table); + for (TInt i = 0;i < aArray.MdcaCount();i++) + { + if(aArray.MdcaPoint(i).Compare(KNullDesC8) != 0) + { + aStream.WriteL(headername.DesC()); + aStream.WriteL(aArray.MdcaPoint(i)); + aStream.WriteL(KCRLF); + } + } + } + +// --------------------------------------------------------------------------- +// CSdpDocument::GetTokenFromStreamL +// --------------------------------------------------------------------------- +// +TDesC8& CSdpDocument::GetTokenFromStreamL(RReadStream& aStream) + { + TUint32 tokenLength = aStream.ReadUint32L(); + HBufC8* tmp = 0; + if (tokenLength > 0) + { + tmp = HBufC8::NewLC(tokenLength); + TPtr8 tokenptr(tmp->Des()); + aStream.ReadL (tokenptr, tokenLength); + CleanupStack::Pop();//tmp + } + else + { + tmp = KNullDesC8().AllocL(); + } + delete iToken; + iToken = tmp; + return *iToken; + } + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpfmtattributefield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpfmtattributefield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,393 @@ +// Copyright (c) 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: +// Name : SdpFmtAttributeField.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdpfmtattributefield.h" +#include "sdpattributefield.h" +#include "sdprtpmapvalue.h" +#include "sdputil.h" +#include "sdpcodecconstants.h" +#include "sdpcodecstringpool.h" +#include "sdpcodecerr.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::CSdpFmtAttributeField +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSdpFmtAttributeField::CSdpFmtAttributeField() +: iFormat ( KNullDesC8() ), iValuePart( KNullDesC8() ) + { + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::ConstructL( + const TDesC8& aText ) + { + iPool = SdpCodecStringPool::StringPoolL(); + + iAttributeField = CSdpAttributeField::DecodeL( aText ); + FormatValueParamsL( iAttributeField ); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::ConstructL( RStringF aAttribute, + const TDesC8& aFormat, + const TDesC8& aValue ) + { + iPool = SdpCodecStringPool::StringPoolL(); + + TInt length = aFormat.Length() + aValue.Length() + KSPStr().Length(); + HBufC8* text = HBufC8::NewLC( length ); + text->Des().Copy( aFormat ); + if ( aValue.Length() > 0 ) + { + text->Des().Append( KSPStr ); + text->Des().Append( aValue ); + } + + iAttributeField = CSdpAttributeField::NewL( aAttribute, *text ); + CleanupStack::PopAndDestroy(); //text + + FormatValueParamsL( iAttributeField ); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::DecodeL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpFmtAttributeField* CSdpFmtAttributeField::DecodeL( + const TDesC8& aText ) + { + CSdpFmtAttributeField* field = + CSdpFmtAttributeField::DecodeLC( aText ); + CleanupStack::Pop(); // field + return field; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::DecodeLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpFmtAttributeField* CSdpFmtAttributeField::DecodeLC( + const TDesC8& aText ) + { + CSdpFmtAttributeField* field = new ( ELeave ) CSdpFmtAttributeField; + CleanupStack::PushL( field ); + field->ConstructL( aText ); + return field; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpFmtAttributeField* CSdpFmtAttributeField::NewL( + RStringF aAttribute, + const TDesC8& aFormat, + const TDesC8& aValue ) + { + CSdpFmtAttributeField* field = + CSdpFmtAttributeField::NewLC( aAttribute, aFormat, aValue ); + CleanupStack::Pop(); // field + return field; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpFmtAttributeField* CSdpFmtAttributeField::NewLC( + RStringF aAttribute, + const TDesC8& aFormat, + const TDesC8& aValue ) + { + CSdpFmtAttributeField* field = new ( ELeave ) CSdpFmtAttributeField; + CleanupStack::PushL( field ); + field->ConstructL( aAttribute, aFormat, aValue ); + return field; + } + +// Destructor +EXPORT_C CSdpFmtAttributeField::~CSdpFmtAttributeField() + { + delete iAttributeField; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::EncodeL +// Encodes the string to a proper message format +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpFmtAttributeField::EncodeL( RWriteStream& aStream ) const + { + __TEST_INVARIANT; + iAttributeField->EncodeL( aStream ); + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::CloneL +// Creates an exact copy of the object +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpFmtAttributeField* CSdpFmtAttributeField::CloneL() const + { + __TEST_INVARIANT; + + CSdpFmtAttributeField* obj = + CSdpFmtAttributeField::NewL( iAttributeField->Attribute(), + Format(), Value() ); + + __ASSERT_DEBUG( *obj == *this, + User::Panic( KSdpCodecPanicCat, KSdpCodecPanicInternal ) ); + + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::operator== +// Creates an exact copy of the object +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpFmtAttributeField::operator==( + const CSdpFmtAttributeField& aObj ) const + { + __TEST_INVARIANT; + + return ( *iAttributeField == *(aObj.AttributeField()) + && iFormat.Compare(aObj.Format()) == 0 + && iValuePart.Compare(aObj.Value()) == 0); + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::Attribute +// Returns attribute field +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpFmtAttributeField::Attribute() const + { + __TEST_INVARIANT; + return iAttributeField->Attribute(); + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::Format +// Returns Format +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpFmtAttributeField::Format() const + { + __TEST_INVARIANT; + + return iFormat; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::Value +// Returns Format value +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpFmtAttributeField::Value() const + { + __TEST_INVARIANT; + return iValuePart; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::SetL +// Sets new format attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpFmtAttributeField::SetL( RStringF aAttribute, + const TDesC8& aFormat, + const TDesC8& aValue ) + { + __TEST_INVARIANT; + + TInt length = aFormat.Length() + aValue.Length() + KSPStr().Length(); + HBufC8* txt = HBufC8::NewLC( length ); + txt->Des().Copy( aFormat ); + if ( aValue.Length() > 0 ) + { + txt->Des().Append( KSPStr ); + txt->Des().Append( aValue ); + } + + CSdpAttributeField* attrFld = CSdpAttributeField::NewL(aAttribute, *txt); + CleanupStack::PopAndDestroy(); //txt + + delete iAttributeField; + iAttributeField = attrFld; + + FormatValueParamsL( iAttributeField ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::ExternalizeL +// Externalizes object to stream +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::ExternalizeL( RWriteStream& aStream ) const + { + __TEST_INVARIANT; + + iAttributeField->ExternalizeL( aStream ); + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::InternalizeL +// Internalizes object from stream +// ----------------------------------------------------------------------------- +// +CSdpFmtAttributeField* CSdpFmtAttributeField::InternalizeL( + RReadStream& aStream ) + { + CSdpFmtAttributeField* obj = new ( ELeave ) CSdpFmtAttributeField(); + CleanupStack::PushL( obj ); + obj->DoInternalizeL( aStream ); + CleanupStack::Pop(); + + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::DoInternalizeL +// Does the "2nd phase construction" of internalization +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::DoInternalizeL( RReadStream& aStream ) + { + iPool = SdpCodecStringPool::StringPoolL(); + iAttributeField = CSdpAttributeField::InternalizeL( aStream ); + FormatValueParamsL( iAttributeField ); + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::AttributeField +// Returns attribute field +// ----------------------------------------------------------------------------- +// +const CSdpAttributeField* CSdpFmtAttributeField::AttributeField() const + { + __TEST_INVARIANT; + return iAttributeField; + } + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::FormatValueParamsL +// Formats value parameters +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::FormatValueParamsL( CSdpAttributeField* aField ) + { + __ASSERT_ALWAYS (aField->Attribute() == + iPool.StringF( SdpCodecStringConstants::EAttributeFmtp, + SdpCodecStringConstants::Table ) + || aField->Attribute() == + iPool.StringF( SdpCodecStringConstants::EAttributeRtpmap, + SdpCodecStringConstants::Table ), + User::Leave( KErrSdpCodecMediaAttributeField )); + DecodeFormatL( aField->Value() ); + if ( iValuePart.Length() == 0 && + aField->Attribute() == + iPool.StringF( SdpCodecStringConstants::EAttributeRtpmap, + SdpCodecStringConstants::Table )) + { + User::Leave( KErrSdpCodecMediaAttributeField ); + } + } + + +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::DecodeFormatL +// Decodes format parameter from string +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::DecodeFormatL( const TDesC8& aText ) + { + __ASSERT_ALWAYS( aText.Length() > 0, + User::Leave( KErrSdpCodecAttributeField ) ); + + TInt pos = aText.Locate( KSPChar ); + + if ( pos == 0 ) + { + User::Leave( KErrSdpCodecAttributeField ); + } + + if ( pos > 0 ) + { + iFormat.Set( aText.Left( pos ) ); + + TPtrC8 formatParameters( aText.Right( aText.Length() - pos - 1 ) ); + + if ( formatParameters.Length() > 0 ) + { + iValuePart.Set( formatParameters ); + } + else + { + iValuePart.Set( KNullDesC8 ); + } + } + else + { + // No format parameters + iFormat.Set( aText ); + iValuePart.Set( KNullDesC8 ); + } + } + +// For DEBUG builds +// ----------------------------------------------------------------------------- +// CSdpFmtAttributeField::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// +void CSdpFmtAttributeField::__DbgTestInvariant() const + { + TBool invariant = iAttributeField != NULL; + + if ( !invariant ) + { + User::Invariant(); + } + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpkeyfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpkeyfield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,525 @@ +// Copyright (c) 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: +// Name : SdpKeyField.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include +#include "sdpkeyfield.h" +#include "sdputil.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" +#include "sdpcodecstringconstants.h" +#include "sdpcodecconstants.h" +#include "sdpcodecerr.h" +#include "sdpcodecstringpool.h" + +// LOCAL CONSTANTS +const TText8 KPlusChar = '+'; + +// ----------------------------------------------------------------------------- +// CSdpKeyField::DecodeL +// Decodes key field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField* CSdpKeyField::DecodeL(const TDesC8& aFieldValue) + { + CSdpKeyField* obj = DecodeLC(aFieldValue); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::DecodeL +// Decodes key field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField* CSdpKeyField::DecodeLC(const TDesC8& aFieldValue) + { + CSdpKeyField* obj = new (ELeave) CSdpKeyField(); + CleanupStack::PushL(obj); + obj->ConstructL(aFieldValue); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField* CSdpKeyField::NewL(RStringF aMethod, + const TDesC8& aEncryptionKey) + { + CSdpKeyField* obj = NewLC(aMethod, aEncryptionKey); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField* CSdpKeyField::NewLC(RStringF aMethod, + const TDesC8& aEncryptionKey) + { + CSdpKeyField* obj = new (ELeave) CSdpKeyField(); + CleanupStack::PushL(obj); + obj->ConstructL(aMethod, aEncryptionKey); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::~CSdpKeyField +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField::~CSdpKeyField() + { + iMethod.Close(); + delete iEncryptionKey; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpKeyField::EncodeL(RWriteStream& aStream) const + { + __TEST_INVARIANT; + RStringF header = iStringPool.StringF(SdpCodecStringConstants::EKey, + SdpCodecStringConstants::Table); + aStream.WriteL( header.DesC() ); + + aStream.WriteL( iMethod.DesC() ); + if (iMethod != iStringPool.StringF(SdpCodecStringConstants::EMethodPrompt, + SdpCodecStringConstants::Table)) + { + aStream.WriteL( KColonStr ); + if (iEncryptionKey->Length() > 0) + { + aStream.WriteL( *iEncryptionKey ); + } + } + + aStream.WriteL( KCRLFStr ); + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::CloneL +// Creates an exact copy of the key field +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField * CSdpKeyField::CloneL() const + { + __TEST_INVARIANT; + CSdpKeyField* obj = CSdpKeyField::NewL(iMethod, *iEncryptionKey); + __ASSERT_DEBUG(*this == *obj, User::Panic( KSdpCodecPanicCat, + KSdpCodecPanicInternal)); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::operator == +// Checks if two key fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpKeyField::operator == (const CSdpKeyField& aObj) const + { + __TEST_INVARIANT; + return iMethod == aObj.iMethod + && ((iEncryptionKey == 0 && aObj.iEncryptionKey == 0) + || (iEncryptionKey != 0 && aObj.iEncryptionKey != 0 + && aObj.iEncryptionKey->Compare(*iEncryptionKey) == 0)); + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::Method +// Returns method +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpKeyField::Method() const + { + __TEST_INVARIANT; + return iMethod; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::EncryptionKey +// Returns encryption key +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpKeyField::EncryptionKey() const + { + __TEST_INVARIANT; + return *iEncryptionKey; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::SetL +// Sets new values to key method and encryption key +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpKeyField::SetL(RStringF aMethod, + const TDesC8& aEncryptionKey) + { + RStringF methodClear = iStringPool.StringF( + SdpCodecStringConstants::EMethodClear, + SdpCodecStringConstants::Table ); + RStringF methodBase64 = iStringPool.StringF( + SdpCodecStringConstants::EMethodBase64, + SdpCodecStringConstants::Table ); + RStringF methodUri = iStringPool.StringF( + SdpCodecStringConstants::EMethodUri, + SdpCodecStringConstants::Table ); + RStringF methodPrompt = iStringPool.StringF( + SdpCodecStringConstants::EMethodPrompt, + SdpCodecStringConstants::Table ); + + if (aMethod == methodClear) + { + SetMethodClearAndKeyL(methodClear, aEncryptionKey); + } + else if (aMethod == methodBase64) + { + SetMethodBase64AndKeyL(methodBase64, aEncryptionKey); + } + else if (aMethod == methodUri) + { + SetMethodUriAndKeyL(methodUri, aEncryptionKey); + } + else if (aMethod == methodPrompt) + { + SetMethodPromptL(methodPrompt, aEncryptionKey); + } + else + { + User::Leave(KErrSdpCodecKeyField); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::ExternalizeL +// Externalizes the object to stream +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteUint32L( iMethod.DesC().Length() ); + aStream.WriteL( iMethod.DesC() ); + + aStream.WriteUint32L( iEncryptionKey->Des().Length() ); + if (iEncryptionKey->Des().Length() > 0) + { + aStream.WriteL(iEncryptionKey->Des(), iEncryptionKey->Des().Length()); + } + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::InternalizeL +// Internalizes the object from stream +// ----------------------------------------------------------------------------- +// +CSdpKeyField* CSdpKeyField::InternalizeL(RReadStream& aStream) + { + CSdpKeyField* self = new (ELeave) CSdpKeyField(); + CleanupStack::PushL(self); + self->iStringPool = SdpCodecStringPool::StringPoolL(); + + self->DoInternalizeL(aStream); + + CleanupStack::Pop(); // self + return self; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::CSdpKeyField +// Constructor +// ----------------------------------------------------------------------------- +// +CSdpKeyField::CSdpKeyField() + { + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::ConstructL(const TDesC8& aText) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + RArray lines; + lines = SdpUtil::DivideToLinesL(aText, KErrSdpCodecKeyField); + CleanupClosePushL(lines); + + TLex8 lexer(lines[0]); + RArray keyArray = GetElementsFromLineL(lexer); + CleanupClosePushL(keyArray); + const TDesC8& keyName = iStringPool.StringF(SdpCodecStringConstants::EKey, + SdpCodecStringConstants::Table).DesC(); + + __ASSERT_ALWAYS(lines.Count() == 1 + && keyArray.Count() >= 2 && keyArray.Count() <= 3 + && keyArray[0].Find(keyName) != KErrNotFound, + User::Leave(KErrSdpCodecKeyField)); + + RStringF method = iStringPool.OpenFStringL(keyArray[1]); + CleanupClosePushL(method); + + if (keyArray.Count() == 3) + { + SetL(method, keyArray[2]); + } + else + { + SetL(method, KNullDesC8); + } + CleanupStack::PopAndDestroy(3); // method, lines, keyArray + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::ConstructL(RStringF aMethod, const TDesC8& aEncryptionKey) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + SetL(aMethod, aEncryptionKey); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::DoInternalizeL +// Internalizes the object members from stream +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::DoInternalizeL(RReadStream& aStream) + { + // + TUint32 length = aStream.ReadUint32L(); + HBufC8* method = HBufC8::NewLC(length); + TPtr8 ptr(method->Des()); + aStream.ReadL(ptr, length); + + RStringF methodStr = iStringPool.OpenFStringL(*method); + CleanupStack::PopAndDestroy(); // method + CleanupClosePushL(methodStr); + + length = aStream.ReadUint32L(); + if (length > 0) + { + HBufC8* key = HBufC8::NewLC(length); + ptr.Set(key->Des()); + aStream.ReadL(ptr, length); + + SetL(methodStr, *key); + CleanupStack::PopAndDestroy(); //key + } + else + { + SetL(methodStr, KNullDesC8); + } + CleanupStack::PopAndDestroy(); // methodStr + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::SetMethodAndKeyL +// Sets new values to key method and encryption key +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::SetMethodAndKeyL(RStringF aMethod, + const TDesC8& aEncryptionKey, + TBool aAllowEmptyKeyValue) + { + HBufC8* tempKey = aEncryptionKey.AllocL(); + tempKey->Des().Trim(); + if (tempKey->Length() == 0 && !aAllowEmptyKeyValue) + { + delete tempKey; + User::Leave(KErrSdpCodecKeyField); + } + iMethod.Close(); + iMethod = aMethod.Copy(); + delete iEncryptionKey; + iEncryptionKey = tempKey; + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::SetMethodClearAndKeyL +// Sets key method to clear and new encryption key +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::SetMethodClearAndKeyL(RStringF aMethod, + const TDesC8& aEncryptionKey) + { + __ASSERT_ALWAYS(SdpUtil::IsByteString(aEncryptionKey), + User::Leave(KErrSdpCodecKeyField)); + SetMethodAndKeyL(aMethod, aEncryptionKey, EFalse); + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::SetMethodBase64AndKeyL +// Sets key method to Base64 and new encryption key +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::SetMethodBase64AndKeyL(RStringF aMethod, + const TDesC8& aText) + { + __ASSERT_ALWAYS(aText.Length() > 0, User::Leave(KErrSdpCodecKeyField)); + + for (TInt i = 0; i < aText.Length(); i++) + { + if ( !( ( aText[i] >= 'a' && aText[i] <= 'z' ) || + ( aText[i] >= 'A' && aText[i] <= 'Z' ) || + ( aText[i] >= '0' && aText[i] <= '9' ) || + ( aText[i] == KPlusChar ) || + ( aText[i] == KSlashChar ) || + ( aText[i] == KEqualChar ) ) ) + { + User::Leave(KErrSdpCodecKeyField); + } + } + SetMethodAndKeyL(aMethod, aText, EFalse); + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::SetMethodUriAndKeyL +// Sets key method to uri and new encryption key +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::SetMethodUriAndKeyL(RStringF aMethod, const TDesC8& aText) + { + TUriParser8 parser; + User::LeaveIfError(parser.Parse(aText)); + SetMethodAndKeyL(aMethod, aText, EFalse); + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::SetMethodPromptL +// Sets key method to Prompt and new encryption key +// ----------------------------------------------------------------------------- +// +void CSdpKeyField::SetMethodPromptL(RStringF aMethod, const TDesC8& aText) + { + __ASSERT_ALWAYS(aText.Length() == 0, User::Leave(KErrSdpCodecKeyField)); + SetMethodAndKeyL(aMethod, aText, ETrue); + } + +// ----------------------------------------------------------------------------- +// CSdpKeyField::GetElementsFromLineL +// Gets all the elements from a single line +// ----------------------------------------------------------------------------- +// +RArray CSdpKeyField::GetElementsFromLineL( TLex8& aLexer) + { + RArray lineArray; + CleanupClosePushL(lineArray); + + aLexer.Mark(); + for (TChar curChar(KColonChar); curChar != KEqualChar;) + { + curChar = aLexer.Peek(); + if (curChar == KEofChar || curChar == KLFChar || + curChar == KCRChar) + { + User::Leave(KErrSdpCodecKeyField); + } + aLexer.Inc(); + } + User::LeaveIfError(lineArray.Append(aLexer.MarkedToken())); + + TBool colonFound = EFalse; + TBool eofcFound = EFalse; + while (!eofcFound) + { + aLexer.Mark(); + while ((aLexer.Peek() != KColonChar || colonFound) && + aLexer.Peek() != KCRChar && + aLexer.Peek() != KLFChar && + aLexer.Peek() != KEofChar) + { + aLexer.Inc(); + } + + if (aLexer.MarkedToken().Length() > 0) + { + User::LeaveIfError(lineArray.Append(aLexer.MarkedToken())); + } + else + { + User::Leave(KErrSdpCodecKeyField); + } + + if (aLexer.Peek() == KColonChar) + { + colonFound = ETrue; + } + + if (aLexer.Peek() == KCRChar) + { + aLexer.Inc(); + } + if (aLexer.Peek() == KLFChar) + { + aLexer.Inc(); + if (aLexer.Peek() == KEofChar) + { + eofcFound = ETrue; + } + } + else + { + aLexer.Inc(); + } + } + + CleanupStack::Pop(); + return lineArray; + } + +void CSdpKeyField::__DbgTestInvariant() const + { + RStringF methodClear = iStringPool.StringF( + SdpCodecStringConstants::EMethodClear, + SdpCodecStringConstants::Table ); + RStringF methodBase64 = iStringPool.StringF( + SdpCodecStringConstants::EMethodBase64, + SdpCodecStringConstants::Table ); + RStringF methodUri = iStringPool.StringF( + SdpCodecStringConstants::EMethodUri, + SdpCodecStringConstants::Table ); + RStringF methodPrompt = iStringPool.StringF( + SdpCodecStringConstants::EMethodPrompt, + SdpCodecStringConstants::Table ); + + TBool invariant = (iMethod == methodPrompt + && (iEncryptionKey != 0 && (iEncryptionKey->Length() == 0)) ) + || ((iMethod == methodClear || iMethod == methodBase64 + || iMethod == methodUri) + && (iEncryptionKey != 0 && (iEncryptionKey->Length() != 0)) ); + + if (!invariant) + User::Invariant(); + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpmediafield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdpmediafield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,1044 @@ +// Copyright (c) 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: +// Name : SdpMediaField.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include +#include "sdpmediafield.h" +#include "sdpconnectionfield.h" +#include "sdpbandwidthfield.h" +#include "sdpattributefield.h" +#include "sdpkeyfield.h" +#include "sdpcodecstringconstants.h" +#include "sdputil.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" +#include "sdpcodecstringpool.h" +#include "sdpfmtattributefield.h" +#include "sdpcodectemplate.h" +#include "sdpcodecerr.h" +#include "sdpcodecparseutil.h" +#include "sdpcodecconstants.h" + +// ---------------------------------------------------------------------------- +// CSdpMediaField::DecodeL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpMediaField* +CSdpMediaField::DecodeL(const TDesC8& aText, TBool aRecurse) + { + CSdpMediaField* obj = DecodeLC(aText,aRecurse); + CleanupStack::Pop(); + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::DecodeLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpMediaField* +CSdpMediaField::DecodeLC(const TDesC8& aText, TBool aRecurse) + { + __ASSERT_ALWAYS (aText.Length() > 0, User::Leave(KErrSdpCodecMediaField)); + CSdpMediaField* obj = new(ELeave)CSdpMediaField; + CleanupStack::PushL(obj); + obj->ConstructL(aRecurse); + obj->ParseL(aText); + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpMediaField* CSdpMediaField::NewL(RStringF aMedia, + TUint aPort, + RStringF aProtocol, + const TDesC8& aFormatList) + { + CSdpMediaField* obj = NewLC(aMedia, aPort, aProtocol, aFormatList); + CleanupStack::Pop(); + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::NewLC +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpMediaField* CSdpMediaField::NewLC(RStringF aMedia, + TUint aPort, + RStringF aProtocol, + const TDesC8& aFormatList) + { + CSdpMediaField* obj = new(ELeave)CSdpMediaField; + CleanupStack::PushL(obj); + obj->ConstructL(aMedia, aPort, aProtocol, aFormatList); + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::~CSdpMediaField +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpMediaField::~CSdpMediaField() + { + delete iInfo; + delete iSdpKeyField; + iElementArray.Reset(); + iMedia.Close(); + iProtocol.Close(); + delete iFormatList; + delete iToken; + if(iBandwidthFields) + { + iBandwidthFields->ResetAndDestroy(); + delete iBandwidthFields; + } + if(iAttributeFields) + { + iAttributeFields->ResetAndDestroy(); + delete iAttributeFields; + } + if(iConnectionFields) + { + iConnectionFields->ResetAndDestroy(); + delete iConnectionFields; + } + if(iFmtAttrFields) + { + iFmtAttrFields->ResetAndDestroy(); + delete iFmtAttrFields; + } + delete iSdpCodecParseUtil; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::CloneL +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpMediaField * CSdpMediaField::CloneL(TBool aRecurse) const + { + CSdpMediaField* obj = new(ELeave)CSdpMediaField; + CleanupStack::PushL(obj); + obj->ConstructL(aRecurse); + obj->ConstructL(*this); + CleanupStack::Pop();//obj + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::operator == +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpMediaField::operator == (const CSdpMediaField& aObj) const + { + TBool result = ETrue; + if( !(iMedia==aObj.Media()) || + !(iPort == aObj.Port()) || + !(iPortCount == aObj.iPortCount) || + !(iProtocol == aObj.Protocol()) || + !(*iFormatList==(*aObj.iFormatList)) || + (!(*iInfo==(*aObj.iInfo)))|| + (!iSdpKeyField && aObj.Key())|| + (iSdpKeyField && !aObj.Key())|| + ((iSdpKeyField && aObj.Key()) && (!(*iSdpKeyField==(*aObj.Key()))))|| + (iBandwidthFields->Count() != aObj.iBandwidthFields->Count())|| + (iAttributeFields->Count() != aObj.iAttributeFields->Count())|| + (iFmtAttrFields->Count() != aObj.iFmtAttrFields->Count())|| + (iConnectionFields->Count() != aObj.iConnectionFields->Count())) + { + result = EFalse; + } + + TInt i = 0; + if(result) + { + for (i=0; i < (aObj.iConnectionFields)->Count(); i++) + { + if((!(*iConnectionFields)[i] && (*aObj.iConnectionFields)[i]) || + ((*iConnectionFields)[i] && !(*aObj.iConnectionFields)[i])) + { + return EFalse; + } + + if(((*iConnectionFields)[i] && (*aObj.iConnectionFields)[i]) && + (!(*(*iConnectionFields)[i]==(*(*aObj.iConnectionFields)[i])))) + { + return EFalse; + } + } + + for (i=0; i < (aObj.iBandwidthFields)->Count(); i++) + { + if((!(*iBandwidthFields)[i] && (*aObj.iBandwidthFields)[i]) || + ((*iBandwidthFields)[i] && !(*aObj.iBandwidthFields)[i])) + { + return EFalse; + } + + if(((*iBandwidthFields)[i] && (*aObj.iBandwidthFields)[i]) && + (!(*(*iBandwidthFields)[i]==(*(*aObj.iBandwidthFields)[i])))) + { + return EFalse; + } + } + + for (i=0; i < (aObj.iAttributeFields)->Count(); i++) + { + if((!((*iAttributeFields)[i]) && ((*aObj.iAttributeFields)[i]))|| + ((*iAttributeFields)[i] && !(*aObj.iAttributeFields)[i])) + { + return EFalse; + } + + if(((*iAttributeFields)[i] && (*aObj.iAttributeFields)[i]) && + (!(*(*iAttributeFields)[i]==(*(*aObj.iAttributeFields)[i])))) + { + return EFalse; + } + } + + for (i=0; i < (aObj.iFmtAttrFields)->Count(); i++) + { + if((!((*iFmtAttrFields)[i]) && ((*aObj.iFmtAttrFields)[i]))|| + ((*iFmtAttrFields)[i] && !(*aObj.iFmtAttrFields)[i])) + { + return EFalse; + } + + if(((*iFmtAttrFields)[i] && (*aObj.iFmtAttrFields)[i]) && + (!(*(*iFmtAttrFields)[i]==(*(*aObj.iFmtAttrFields)[i])))) + { + return EFalse; + } + } + } + return result; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::Media +// ---------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpMediaField::Media() const + { + return iMedia; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetMedia +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetMediaL(RStringF aMedia) + { + __ASSERT_ALWAYS(SdpUtil::IsTokenChar(aMedia.DesC()), + User::Leave(KErrSdpCodecMediaField)); + iMedia.Close(); + iMedia = aMedia.Copy(); + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::Protocol +// ---------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpMediaField::Protocol() const + { + return iProtocol; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetProtocol +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetProtocolL(RStringF aProtocol) + { + __ASSERT_ALWAYS(SdpUtil::IsTokenCharWithOptionalSlash(aProtocol.DesC()), + User::Leave(KErrSdpCodecMediaField)); + if (aProtocol == iPool.StringF( SdpCodecStringConstants::EProtocolUdp, + SdpCodecStringConstants::Table )) + { + __ASSERT_ALWAYS((iPort == 0 || (iPort >= 1024 && iPort <= 65535)), + User::Leave(KErrSdpCodecMediaField)); + } + + iProtocol.Close(); + iProtocol = aProtocol.Copy(); + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::Port +// ---------------------------------------------------------------------------- +// +EXPORT_C TUint CSdpMediaField::Port() const + { + return iPort; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetPortL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetPortL(TUint aPort) + { + if ( iProtocol == iPool.StringF( SdpCodecStringConstants::EProtocolUdp, + SdpCodecStringConstants::Table )) + { + __ASSERT_ALWAYS((aPort == 0 || (aPort >= 1024 && aPort <= 65535)), + User::Leave(KErrSdpCodecMediaField)); + } + iPort = aPort; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::PortCount +// ---------------------------------------------------------------------------- +// +EXPORT_C TUint CSdpMediaField::PortCount() const + { + return iPortCount; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetPortCount +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetPortCountL(TUint aCount) + { + __ASSERT_ALWAYS(aCount > 0, User::Leave(KErrSdpCodecMediaField)); + iPortCount = aCount; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::FormatList +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpMediaField::FormatList() const + { + return *iFormatList; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetFormatListL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetFormatListL(const TDesC8& aValue) + { + __ASSERT_ALWAYS(SdpUtil::IsTokenCharWithSpacesL(aValue), + User::Leave(KErrSdpCodecMediaField)); + HBufC8* tmp = aValue.AllocL(); + delete iFormatList; + iFormatList = tmp; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::CSdpMediaField +// ---------------------------------------------------------------------------- +// +CSdpMediaField::CSdpMediaField() + { + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpMediaField::ConstructL() + { + iPool = SdpCodecStringPool::StringPoolL(); + iInfo = KNullDesC8().AllocL(); + iFormatList = KNullDesC8().AllocL(); + iToken = KNullDesC8().AllocL(); + iBandwidthFields = new(ELeave)RPointerArray; + iConnectionFields = new(ELeave)RPointerArray; + iAttributeFields = new(ELeave)RPointerArray; + iFmtAttrFields = new(ELeave)RPointerArray; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpMediaField::ConstructL(TBool aRecurse) + { + ConstructL(); + iRecurse = aRecurse; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::ConstructL +// ---------------------------------------------------------------------------- +// +void +CSdpMediaField::ConstructL(RStringF aMedia, TUint aPort, RStringF aProtocol, + const TDesC8& aFormatList) + { + __ASSERT_ALWAYS(SdpUtil::IsTokenChar(aMedia.DesC()) && + (aPort== 0 || (aPort >= 1024 && aPort <= 65535)) && + SdpUtil::IsTokenCharWithOptionalSlash(aProtocol.DesC()) && + SdpUtil::IsTokenCharWithSpacesL(aFormatList), + User::Leave(KErrArgument)); + ConstructL(); + iMedia = aMedia.Copy(); + iProtocol = aProtocol.Copy(); + SetPortL(aPort); + delete iFormatList; + iFormatList = 0; + iFormatList = aFormatList.AllocL(); + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpMediaField::ConstructL(const CSdpMediaField& aSdpMediaField) + { + iMedia = aSdpMediaField.Media().Copy(); + iProtocol = aSdpMediaField.Protocol().Copy(); + SetPortL(aSdpMediaField.Port()); + iPortCount = aSdpMediaField.PortCount(); + HBufC8* tmp = aSdpMediaField.FormatList().AllocL(); + delete iFormatList; + iFormatList = 0; + iFormatList = tmp; + if(iRecurse) + { + tmp = aSdpMediaField.Info().AllocL(); + delete iInfo; + iInfo = tmp; + SdpCodecTemplate::CloneArrayL(*iConnectionFields, + *aSdpMediaField.iConnectionFields); + SdpCodecTemplate::CloneArrayL(*iBandwidthFields, + *aSdpMediaField.iBandwidthFields); + if(aSdpMediaField.Key()) + { + iSdpKeyField = aSdpMediaField.Key()->CloneL(); + } + SdpCodecTemplate::CloneArrayL(*iAttributeFields, + *aSdpMediaField.iAttributeFields); + SdpCodecTemplate::CloneArrayL(*iFmtAttrFields, + *aSdpMediaField.iFmtAttrFields); + } + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::Info +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpMediaField::Info() const + { + return *iInfo; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetInfoL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetInfoL(const TDesC8& aValue) + { + __ASSERT_ALWAYS (aValue.Compare(KNullDesC8) == 0|| + SdpUtil::IsByteString(aValue), + User::Leave(KErrSdpCodecMediaInfoField)); + HBufC8* tmp = aValue.AllocL(); + tmp->Des().Trim(); + delete iInfo; + iInfo = tmp; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::Key +// ---------------------------------------------------------------------------- +// +EXPORT_C CSdpKeyField* CSdpMediaField::Key() + { + return iSdpKeyField; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::Key +// ---------------------------------------------------------------------------- +// +EXPORT_C const CSdpKeyField* CSdpMediaField::Key() const + { + return iSdpKeyField; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::SetKey +// ---------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::SetKey(CSdpKeyField* aObj) + { + delete iSdpKeyField; + iSdpKeyField = aObj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::ConnectionFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpMediaField::ConnectionFields() + { + return *iConnectionFields; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::BandwidthFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpMediaField::BandwidthFields() + { + return *iBandwidthFields; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::AttributeFields +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpMediaField::AttributeFields() + { + return *iAttributeFields; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::FormatAttributeFields() +// ---------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& +CSdpMediaField::FormatAttributeFields() + { + return *iFmtAttrFields; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::EncodeL +// ---------------------------------------------------------------------------- +// +EXPORT_C void +CSdpMediaField::EncodeL(RWriteStream& aStream, TBool aRecurse) const + { + RStringF headername = iPool.StringF( SdpCodecStringConstants::EMedia, + SdpCodecStringConstants::Table ); + aStream.WriteL(headername.DesC()); + aStream.WriteL(iMedia.DesC()); + aStream.WriteL(KSPStr); + TBuf8<80> text; + text.Format(_L8("%u"), iPort); + aStream.WriteL(text); + if(iPortCount>0) + { + aStream.WriteL(_L8("/")); + text.Format(_L8("%u"), iPortCount); + aStream.WriteL(text); + } + aStream.WriteL(KSPStr); + aStream.WriteL(iProtocol.DesC()); + aStream.WriteL(KSPStr); + aStream.WriteL(*iFormatList); + aStream.WriteL(KCRLFStr); + if(aRecurse) + { + SdpUtil::EncodeBufferL(*iInfo, + SdpCodecStringConstants::EInfo, aStream); + SdpCodecTemplate::EncodeArrayL(*iConnectionFields, + aStream); + SdpCodecTemplate::EncodeArrayL(*iBandwidthFields, + aStream); + SdpCodecTemplate::EncodeL(Key(), aStream); + + for (TInt i = 0;i < iAttributeFields->Count();i++) + { + if (!(((*iAttributeFields)[i])->IsFmtAttribute())) + { + ((*iAttributeFields)[i])->EncodeL(aStream); + } + } + + for (TInt i = 0;i < iFmtAttrFields->Count();i++) + { + ((*iFmtAttrFields)[i])->EncodeL(aStream); + + for (TInt j=0; jCount(); j++) + { + if ((((*iAttributeFields)[j])->IsFmtAttribute()) && + ((*iAttributeFields)[j])->BelongsTo(*(*iFmtAttrFields)[i])) + { + ((*iAttributeFields)[j])->EncodeL(aStream); + } + } + } + } + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::IsValid +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpMediaField::IsValid() const + { + TBool result = EFalse; + if(!(iMedia.DesC()==(KNullDesC8)) && + !(iProtocol.DesC()==(KNullDesC8))&& + !(*iFormatList==(KNullDesC8))) + { + result = ETrue; + } + return result; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::IsContactPresent +// ---------------------------------------------------------------------------- +// +TBool CSdpMediaField::IsContactPresent() const + { + TBool result = EFalse; + if(iConnectionFields->Count() > 0) + { + result = ETrue; + } + return result; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::ExternalizeL +// ---------------------------------------------------------------------------- +// +void CSdpMediaField::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteUint32L (iMedia.DesC().Length()); + if (iMedia.DesC().Length() > 0) + { + aStream.WriteL (iMedia.DesC()); + } + aStream.WriteUint32L (iPort); + if(iPortCount) + { + aStream.WriteUint8L (1); + aStream.WriteUint32L (iPortCount); + } + else + { + aStream.WriteUint8L (0); + } + aStream.WriteUint32L (iProtocol.DesC().Length()); + if (iProtocol.DesC().Length() > 0) + { + aStream.WriteL (iProtocol.DesC()); + } + aStream.WriteUint32L (iFormatList->Length()); + if (iFormatList->Length() > 0) + { + aStream.WriteL (*iFormatList); + } + aStream.WriteUint32L (iInfo->Length()); + if (iInfo->Length() > 0) + { + aStream.WriteL (*iInfo); + } + SdpCodecTemplate::ExternalizeArrayL(*iConnectionFields, + aStream); + SdpCodecTemplate::ExternalizeArrayL(*iBandwidthFields, + aStream); + SdpCodecTemplate::ExternalizeL(Key(), aStream); + SdpCodecTemplate::ExternalizeArrayL(*iAttributeFields, + aStream); + SdpCodecTemplate::ExternalizeArrayL(*iFmtAttrFields, + aStream); + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::InternalizeL +// ---------------------------------------------------------------------------- +// +CSdpMediaField* CSdpMediaField::InternalizeL(RReadStream& aStream) + { + CSdpMediaField* obj = new(ELeave)CSdpMediaField(); + CleanupStack::PushL(obj); + obj->ConstructL(); + obj->DoInternalizeL (aStream); + CleanupStack::Pop(); + return obj; + } + +// ---------------------------------------------------------------------------- +// CSdpMediaField::DoInternalizeL +// ---------------------------------------------------------------------------- +// +void CSdpMediaField::DoInternalizeL(RReadStream& aStream) + { + RStringF media = iPool.OpenFStringL(GetTokenFromStreamL(aStream)); + CleanupClosePushL(media); + SetMediaL(media); + CleanupStack::Pop();//media + media.Close(); + TUint32 port = aStream.ReadUint32L(); + //SetPortL(aStream.ReadUint32L()); + TUint flag = aStream.ReadUint8L(); + if(flag) + { + SetPortCountL(aStream.ReadUint32L()); + } + RStringF protocol =iPool.OpenFStringL(GetTokenFromStreamL(aStream)); + CleanupClosePushL(protocol); + SetProtocolL(protocol); + CleanupStack::Pop();//protocol + protocol.Close(); + SetPortL(port); + SetFormatListL(GetTokenFromStreamL(aStream)); + SetInfoL(GetTokenFromStreamL(aStream)); + SdpCodecTemplate::InternalizeArrayL(*iConnectionFields, + aStream); + SdpCodecTemplate::InternalizeArrayL(*iBandwidthFields, + aStream); + if(aStream.ReadUint8L()) + { + SetKey(CSdpKeyField::InternalizeL(aStream)); + } + SdpCodecTemplate::InternalizeArrayL(*iAttributeFields, + aStream); + SdpCodecTemplate::InternalizeArrayL(*iFmtAttrFields, + aStream); + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseL (const TDesC8& aText) + { + iElementArray.Reset(); + iSdpCodecParseUtil = + CSdpCodecParseUtil::NewL(iPool,aText, KErrSdpCodecMediaField); + ParseMediaL(); + if(iRecurse) + { + ParseAttributeFieldsL(); + ParseInformationL(); + ParseConnectionL(); + ParseBandwithL(); + ParseEncryptionKeyL(); + } + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseMediaL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseMediaL() + { + iElementArray = iSdpCodecParseUtil->FirstLineArrayElementL(iPool, + SdpCodecStringConstants::EMedia, + KErrSdpCodecMediaField); + __ASSERT_ALWAYS (iElementArray.Count() >= 4, + User::Leave(KErrSdpCodecMediaField)); + + RStringF media = iPool.OpenFStringL(iElementArray[1]); + CleanupClosePushL(media); + SetMediaL(media); + CleanupStack::Pop();//media + media.Close(); + + iProtocol = iPool.OpenFStringL(iElementArray[3]); + + TInt lineEndPosition = iElementArray[2].Locate('/'); + TUint port; + if(lineEndPosition == KErrNotFound) + { + User::LeaveIfError( + TLex8(iElementArray[2]).Val(port, EDecimal)); + SetPortL(port); + } + else + { + User::LeaveIfError(TLex8( + (iElementArray[2]).Left(lineEndPosition)).Val(port, EDecimal)); + SetPortL(port); + User::LeaveIfError(TLex8( + (iElementArray[2]).Mid(lineEndPosition +1)).Val(port, EDecimal)); + SetPortCountL(port); + } + __ASSERT_ALWAYS(SdpUtil::IsTokenCharWithOptionalSlash(iElementArray[3]), + User::Leave(KErrArgument)); + + //iProtocol = iPool.OpenFStringL(iElementArray[3]); + + TInt length = 0; + TInt i; + for(i=4;iDes()); + for(i=4;iLineArray().Count() > 0) + { + iSdpCodecParseUtil->LineArray().Remove(0); + } + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseInformationL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseInformationL() + { + SetInfoL(iSdpCodecParseUtil->ParseInformationL(KErrSdpCodecMediaInfoField)); + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseConnectionL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseConnectionL() + { + delete iConnectionFields; + iConnectionFields = 0; + iConnectionFields = iSdpCodecParseUtil->ParseConnectionFieldsL( + KErrSdpCodecMediaConnectionField); + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseBandwithL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseBandwithL() + { + delete iBandwidthFields; + iBandwidthFields = 0; + iBandwidthFields = + iSdpCodecParseUtil->ParseBandwidthL(KErrSdpCodecMediaBandwidthField); + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseEncryptionKeyL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseEncryptionKeyL() + { + SetKey(iSdpCodecParseUtil->ParseEncryptionKeyL(KErrSdpCodecMediaKeyField)); + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::ParseAttributeFieldsL +// --------------------------------------------------------------------------- +// +void CSdpMediaField::ParseAttributeFieldsL() + { + CSdpFmtAttributeField* fmtattributefield = 0; + + RArray& lineArray = iSdpCodecParseUtil->LineArray(); + for (TInt i=0; iAttribute() == + iPool.StringF( SdpCodecStringConstants::EAttributeRtpmap, + SdpCodecStringConstants::Table ) || + attributefield->Attribute() == + iPool.StringF( SdpCodecStringConstants::EAttributeFmtp, + SdpCodecStringConstants::Table ) ) + { + CleanupStack::PopAndDestroy(attributefield); + fmtattributefield = + CSdpFmtAttributeField::DecodeLC(lineArray[i]); + iFmtAttrFields->AppendL(fmtattributefield); + CleanupStack::Pop(fmtattributefield); + } + else + { + iAttributeFields->AppendL(attributefield); + CleanupStack::Pop(attributefield); + if (fmtattributefield) + { + attributefield->AssignTo(*fmtattributefield); + } + } + + iElementArray.Reset(); + lineArray.Remove(i); + if (i < lineArray.Count()) + { + i--; + } + } + } + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::GetTokenFromStreamL +// --------------------------------------------------------------------------- +// +TDesC8& CSdpMediaField::GetTokenFromStreamL(RReadStream& aStream) + { + TUint32 tokenLength = aStream.ReadUint32L(); + HBufC8* tmp = 0; + if (tokenLength > 0) + { + tmp = HBufC8::NewLC(tokenLength); + TPtr8 tokenptr(tmp->Des()); + aStream.ReadL (tokenptr, tokenLength); + CleanupStack::Pop();//tmp + } + else + { + tmp = KNullDesC8().AllocL(); + } + delete iToken; + iToken = tmp; + return *iToken; + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::RemoveFormatL +// --------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::RemoveFormatL(const TDesC8& aFormat) + { + if ( !iFormatList || iFormatList->Des().Length() == 0 ) + { + User::Leave( KErrSdpCodecMediaField ); + } + TLex8 lexer( *iFormatList ); + TBool tokenRemoved( EFalse ); + while ( !tokenRemoved && !lexer.Eos() ) + { + lexer.SkipSpaceAndMark(); + lexer.SkipCharacters(); + if ( lexer.TokenLength() > 0 ) + { + if ( aFormat.CompareF(lexer.MarkedToken()) == 0) + { + RArray removedObjs; + CleanupClosePushL( removedObjs ); + for ( TInt i( 0 ); i < iFmtAttrFields->Count(); i++ ) + { + if (aFormat.CompareF((*iFmtAttrFields)[i]->Format()) == 0) + { + User::LeaveIfError( removedObjs.Append(i) ); + } + } + // Remove all format attributes of type format + TInt removedCount( 0 ); + while ( removedObjs.Count() > 0 ) + { + CSdpFmtAttributeField* obj = + (*iFmtAttrFields)[removedObjs[0] - removedCount]; + delete obj; + obj = 0; + iFmtAttrFields->Remove( removedObjs[0] - removedCount); + removedObjs.Remove(0); + removedCount++; + } + CleanupStack::PopAndDestroy(); // removedObjs + + // Remove format from format list + iFormatList->Des().Delete( lexer.MarkedOffset(), + lexer.Offset() - lexer.MarkedOffset()); + iFormatList->Des().TrimAll(); + tokenRemoved = ETrue; + } + } + } + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::KeepFormatL +// --------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::KeepFormatL(const TDesC8& aFormat) + { + if ( !iFormatList ) + { + User::Leave( KErrSdpCodecMediaField ); + } + // Empty set will continue to be empty + if ( iFormatList->Des().Length() > 0 ) + { + HBufC8* formatList = aFormat.AllocLC(); + // Mark all format attributes not aFormat so that they will be deleted + RArray removedObjs; + CleanupClosePushL( removedObjs ); + for ( TInt i( 0 ); i < iFmtAttrFields->Count(); i++ ) + { + if (aFormat.CompareF((*iFmtAttrFields)[i]->Format()) != 0) + { + User::LeaveIfError( removedObjs.Append( i ) ); + } + } + // Delete attribute fields + TInt removedCount( 0 ); + while ( removedObjs.Count() > 0 ) + { + CSdpFmtAttributeField* obj = + (*iFmtAttrFields)[removedObjs[0] - removedCount]; + delete obj; + iFmtAttrFields->Remove( removedObjs[0] - removedCount ); + removedObjs.Remove( 0 ); + removedCount++; + } + CleanupStack::PopAndDestroy(); // removedObjs + // Change format list + delete iFormatList; + iFormatList = formatList; + CleanupStack::Pop(); // formatList + } + } + +// --------------------------------------------------------------------------- +// CSdpMediaField::RejectMedia +// --------------------------------------------------------------------------- +// +EXPORT_C void CSdpMediaField::RejectMedia() + { + iPort = 0; + iPortCount = 0; + + TLex8 lexer( *iFormatList ); + lexer.SkipSpaceAndMark(); + lexer.SkipCharacters(); + if ( lexer.TokenLength() > 0 ) + { + TRAPD(err, KeepFormatL( lexer.MarkedToken() )); + err++; // Nothing to do, if error happens. Silence compiler warning. + } + } + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdporiginfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdporiginfield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,1038 @@ +// Copyright (c) 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: +// Name : SdpOriginField.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include +#include "sdporiginfield.h" +#include "sdporiginfieldptrs.h" +#include "sdputil.h" +#include "sdpcodecstringconstants.h" +#include "sdpcodecconstants.h" +#include "sdpcodecstringpool.h" +#include "sdpcodecerr.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" + +// LOCAL CONSTANTS AND MACROS +const TUint KMaxIPDesLength = 39; +const TUint KHeaderIndex = 0; +const TUint KUserNameIndex = 1; +const TUint KSessionIdIndex = 2; +const TUint KSessionVersionIndex = 3; +const TUint KNetworkTypeIndex = 4; +const TUint KAddressTypeIndex = 5; +const TUint KAddressIndex = 6; +const TInt KTokenCount = 7; +const TInt64 KDummyValue = 1; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSdpOriginField::CSdpOriginField +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSdpOriginField::CSdpOriginField() + { + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ConstructL( + const TDesC8& aText ) + { + // aText should be of format: + // o= + //
+ iPool = SdpCodecStringPool::StringPoolL(); + + RArray array; + array = SdpUtil::GetElementsFromLineL( aText, KErrSdpCodecOriginField ); + + CleanupClosePushL( array ); + + if ( array.Count() != KTokenCount ) + { + User::Leave( KErrSdpCodecOriginField ); + } + + // Check that the line contains valid header + RStringF origHeader = iPool.StringF( SdpCodecStringConstants::EOrigin, + SdpCodecStringConstants::Table ); + if ( origHeader.DesC().CompareF( array[KHeaderIndex] ) != 0 ) + { + // Header didn't match + User::Leave( KErrSdpCodecOriginField ); + } + + iUserName = + reinterpret_cast< HBufC8* >( CSdpOriginFieldPtrs::NewL( 0, 0 ) ); + + + // + ParseUserNameL( array ); + + // & + ParseSessionIDAndVersionL( array ); + + // &
+ ParseNetTypeAndAddressTypeL( array ); + + //
+ ParseAddressL( array ); + + //If address is IPv4-Mapped IPv6 , it is changed to IPv4 + TInetAddr addr; + TBuf address; + address.Copy(iAddress); + + TInt err = addr.Input( address ); + if ( err == KErrNone ) + { + // Valid IP address + TBuf buf; + addr.Output( buf ); + iAddress.Copy(buf); + + SetIPAddressType( addr ); + } + + + + CleanupStack::PopAndDestroy(); // array + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ConstructL( + const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + TInetAddr& aUnicastAddress ) + { + iPool = SdpCodecStringPool::StringPoolL(); + + __ASSERT_ALWAYS( + IsValidUserName( aUserName ) + && IsValidAddress( aUnicastAddress ) + && aSessionId >= 0 && aSessionVersion >= 0, + User::Leave( KErrSdpCodecOriginField ) ); + + iUserName = reinterpret_cast< HBufC8* > + ( CSdpOriginFieldPtrs::NewL( aSessionId, aSessionVersion ) ); + OriginFieldPtrs().SetUserNameL( aUserName ); + + TBuf des; + aUnicastAddress.Output( des ); + //if aUnicastAddress was IPv4-Mapped IPv6 address, + // the result of Output is IPv4 + // the address is stored in IPv4 format, so the iAddressType + // must also be IPv4. + iAddress.Copy( des ); + SetIPAddressType( aUnicastAddress ); + + iNetType = iPool.StringF( SdpCodecStringConstants::ENetType, + SdpCodecStringConstants::Table ).Copy(); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ConstructL( + const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + iPool = SdpCodecStringPool::StringPoolL(); + + __ASSERT_ALWAYS( + IsValidUserName( aUserName ) + && IsValidAddress( aAddress ) && + TypeMatchesWithFormat( aAddress, aAddressType.DesC(), iPool ) + && ( SdpUtil::IsToken( aNetType.DesC() ) ) + && ( SdpUtil::IsToken( aAddressType.DesC() ) ) + && aSessionId >= 0 && aSessionVersion >= 0, + User::Leave( KErrSdpCodecOriginField ) ); + + iUserName = reinterpret_cast< HBufC8* > + ( CSdpOriginFieldPtrs::NewL( aSessionId, aSessionVersion ) ); + OriginFieldPtrs().SetUserNameL( aUserName ); + + iNetType = aNetType.Copy(); + TInetAddr addr; + TBuf address; + address.Copy(aAddress); + TInt err = addr.Input(address); + if ( err == KErrNone ) + { + // Valid IP address + TBuf< KMaxIPDesLength > buf; + addr.Output( buf ); + iAddress.Copy( buf ); + SetIPAddressType( addr ); + } + else + { + iAddress = aAddress; + iAddressType = aAddressType.Copy(); + } + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::DecodeL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::DecodeL( + const TDesC8& aText ) + { + CSdpOriginField* obj = CSdpOriginField::DecodeLC( aText ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::DecodeLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::DecodeLC( + const TDesC8& aText ) + { + CSdpOriginField* obj = new ( ELeave ) CSdpOriginField; + CleanupStack::PushL( obj ); + obj->ConstructL(aText ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::NewL( + const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + TInetAddr& aAddress ) + { + CSdpOriginField* obj = CSdpOriginField::NewLC( + aUserName, aSessionId, aSessionVersion, aAddress ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::NewLC( + const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + TInetAddr& aAddress ) + { + CSdpOriginField* obj = new ( ELeave ) CSdpOriginField; + CleanupStack::PushL(obj); + obj->ConstructL( aUserName, aSessionId, aSessionVersion, aAddress ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::NewL( + const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + CSdpOriginField* obj = CSdpOriginField::NewLC( + aUserName, aSessionId, aSessionVersion, aNetType, + aAddressType, aAddress ); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::NewLC( + const TDesC8& aUserName, + TInt64 aSessionId, + TInt64 aSessionVersion, + RStringF aNetType, + RStringF aAddressType, + const TDesC8& aAddress ) + { + CSdpOriginField* obj = new ( ELeave ) CSdpOriginField; + CleanupStack::PushL( obj ); + obj->ConstructL( aUserName, aSessionId, aSessionVersion, aNetType, + aAddressType, aAddress ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::~CSdpOriginField +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField::~CSdpOriginField() + { + CSdpOriginFieldPtrs* tmp = + reinterpret_cast< CSdpOriginFieldPtrs* >( iUserName ); + delete tmp; + + iNetType.Close(); + iAddressType.Close(); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpOriginField::EncodeL( + RWriteStream& aStream ) const + { + __TEST_INVARIANT; + + // o=
+ //
+ + // "o=" + RStringF header = iPool.StringF( SdpCodecStringConstants::EOrigin, + SdpCodecStringConstants::Table ); + aStream.WriteL( header.DesC() ); + + // + aStream.WriteL( OriginFieldPtrs().UserName() ); + aStream.WriteL( KSPStr ); + + // + aStream.WriteL( OriginFieldPtrs().SessionId() ); + aStream.WriteL( KSPStr ); + + // + aStream.WriteL( OriginFieldPtrs().SessionVersion() ); + aStream.WriteL( KSPStr ); + + // + aStream.WriteL( iNetType.DesC() ); + aStream.WriteL( KSPStr ); + + //
+ aStream.WriteL( iAddressType.DesC() ); + aStream.WriteL( KSPStr ); + + //
+ aStream.WriteL( iAddress ); + + // End-of-Line mark + aStream.WriteL( KCRLFStr ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::CloneL +// Creates an exact copy of the origin field +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpOriginField* CSdpOriginField::CloneL() const + { + __TEST_INVARIANT; + + CSdpOriginField* obj = 0; + + if ( InetAddress() ) + { + // Clones instance with TInetAddr + TInetAddr addr( *InetAddress() ); + obj = CSdpOriginField::NewLC( UserName(), KDummyValue, + KDummyValue, addr ); + } + else + { + // Clones instance with Internet address as a standard string + obj = CSdpOriginField::NewLC( UserName(), KDummyValue, KDummyValue, + iNetType, iAddressType, Address() ); + } + + // Set the real values + obj->OriginFieldPtrs().SetSessionIdL( OriginFieldPtrs().SessionId() ); + obj->OriginFieldPtrs().SetSessionVersionL( + OriginFieldPtrs().SessionVersion() ); + CleanupStack::Pop( obj ); + + __ASSERT_DEBUG( *this == *obj, User::Panic( KSdpCodecPanicCat, + KSdpCodecPanicInternal ) ); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::operator == +// Checks if two origin fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpOriginField::operator == ( + const CSdpOriginField& aObj) const + { + __TEST_INVARIANT; + + TBool equalFields = EFalse; + + // Check that username, session ID and address type match before + // going to internet address + if ( ( UserName().CompareF( aObj.UserName() ) == 0 ) && + ( SessionId() == aObj.SessionId() ) && + ( AddressType() == aObj.AddressType() ) && + ( Version() == aObj.Version() ) && + ( NetType() == aObj.NetType() ) ) + { + if ( InetAddress() && aObj.InetAddress() ) + { + if ( (*InetAddress()).Match( *aObj.InetAddress() ) ) + { + equalFields = ETrue; + } + } + else if ( !InetAddress() && !aObj.InetAddress() ) + { + if ( iAddress.CompareF( aObj.Address() ) == 0 ) + { + equalFields = ETrue; + } + } + else + { + // These two are not the same + } + } + + return equalFields; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::UserName +// Returns username +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpOriginField::UserName() const + { + __TEST_INVARIANT; + return OriginFieldPtrs().UserName(); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SetUserNameL +// Sets a new username +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpOriginField::SetUserNameL( + const TDesC8& aValue ) + { + __TEST_INVARIANT; + if ( IsValidUserName( aValue ) ) + { + OriginFieldPtrs().SetUserNameL( aValue ); + } + else + { + User::Leave( KErrSdpCodecOriginField ); + } + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SessionId +// Returns current session id +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt64 CSdpOriginField::SessionId() const + { + __TEST_INVARIANT; + + return Get63Msbs( OriginFieldPtrs().SessionId() ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SetSessionId +// Sets new session ID +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpOriginField::SetSessionId( + TInt64 aValue ) + { + __TEST_INVARIANT; + if ( aValue >= 0 ) + { + TRAP_IGNORE( OriginFieldPtrs().SetSessionIdL( aValue ) ) + } + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::Version +// Returns version number of the announcement +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt64 CSdpOriginField::Version() const + { + __TEST_INVARIANT; + + return Get63Msbs( OriginFieldPtrs().SessionVersion() ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SetVersion +// Sets new version for this session's announcement +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpOriginField::SetVersion( + TInt64 aValue ) + { + __TEST_INVARIANT; + if ( aValue >= 0 ) + { + TRAP_IGNORE( OriginFieldPtrs().SetSessionVersionL( aValue ) ) + } + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::NetType +// Returns net type (always Internet) +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpOriginField::NetType() const + { + __TEST_INVARIANT; + return iNetType; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::AddressType +// Returns address type (IP4/IP6) +// ----------------------------------------------------------------------------- +// +EXPORT_C RStringF CSdpOriginField::AddressType() const + { + __TEST_INVARIANT; + return iAddressType; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::InetAddress +// Returns the unicast address +// ----------------------------------------------------------------------------- +// +EXPORT_C const TInetAddr* CSdpOriginField::InetAddress() const + { + __TEST_INVARIANT; + + TBuf address16; + address16.Copy( iAddress ); + TInt err = iUnicastAddress.Input( address16 ); + + if ( !err ) + { + return &iUnicastAddress; + } + else + { + return NULL; + } + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::Address +// Returns the address +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpOriginField::Address() const + { + __TEST_INVARIANT; + return iAddress; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SetInetAddress +// Sets Internet Address +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpOriginField::SetInetAddress( + const TInetAddr& aValue ) + { + __TEST_INVARIANT; + + if ( IsValidAddress( aValue ) ) + { + TBuf buf; + aValue.Output( buf ); + // Copy new address to safe + iAddress.Copy( buf ); + + // Copy network type and address type + SdpUtil::SetDefaultNetTypeAndAddrType( + iPool, aValue, iNetType, iAddressType ); + SetIPAddressType( aValue ); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SetAddressL +// Sets address from the buffer +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpOriginField::SetAddressL( + const TDesC8& aAddress, + RStringF aNetType, + RStringF aAddressType ) + { + __TEST_INVARIANT; + + __ASSERT_ALWAYS( SdpUtil::IsToken( aNetType.DesC() ) && + SdpUtil::IsToken( aAddressType.DesC() ) && + IsValidAddress( aAddress ) && + TypeMatchesWithFormat( aAddress, + aAddressType.DesC(), iPool ), + User::Leave( KErrSdpCodecOriginField ) ); + + iAddress = aAddress; + iAddressType.Close(); + iAddressType = aAddressType.Copy(); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ExternalizeL +// Externalizes the field back to string +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ExternalizeL( + RWriteStream& aStream ) const + { + __TEST_INVARIANT; + + // + aStream.WriteUint32L( UserName().Length() ); + aStream.WriteL( UserName(), UserName().Length() ); + // + aStream.WriteUint32L( OriginFieldPtrs().SessionId().Length() ); + aStream.WriteL( OriginFieldPtrs().SessionId(), + OriginFieldPtrs().SessionId().Length() ); + // + aStream.WriteUint32L( OriginFieldPtrs().SessionVersion().Length() ); + aStream.WriteL( OriginFieldPtrs().SessionVersion(), + OriginFieldPtrs().SessionVersion().Length() ); + // + aStream.WriteUint32L( iNetType.DesC().Length() ); + aStream.WriteL( iNetType.DesC() ); + //
+ aStream.WriteUint32L( iAddressType.DesC().Length() ); + aStream.WriteL( iAddressType.DesC() ); + //
+ aStream.WriteUint32L( iAddress.Length() ); + aStream.WriteL( iAddress ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::InternalizeL +// Internalizes from stream +// ----------------------------------------------------------------------------- +// +CSdpOriginField* CSdpOriginField::InternalizeL( + RReadStream& aStream ) + { + RStringPool pool = SdpCodecStringPool::StringPoolL(); + + // + TUint32 length = aStream.ReadUint32L(); + HBufC8* userName = HBufC8::NewLC( length ); + TPtr8 ptr( userName->Des() ); + aStream.ReadL( ptr, length ); + + // + length = aStream.ReadUint32L(); + HBufC8* sessionId = HBufC8::NewLC( length ); + ptr.Set( sessionId->Des() ); + aStream.ReadL( ptr, length ); + + // + length = aStream.ReadUint32L(); + HBufC8* version = HBufC8::NewLC( length ); + ptr.Set( version->Des() ); + aStream.ReadL( ptr, length ); + + // + length = aStream.ReadUint32L(); + HBufC8* netType = HBufC8::NewLC( length ); + ptr.Set( netType->Des() ); + aStream.ReadL( ptr, length ); + + //
+ length = aStream.ReadUint32L(); + HBufC8* addrType = HBufC8::NewLC( length ); + ptr.Set( addrType->Des() ); + aStream.ReadL( ptr, length ); + + //
+ length = aStream.ReadUint32L(); + HBufC8* address = HBufC8::NewLC( length ); + TPtr8 ptr2( address->Des() ); + aStream.ReadL( ptr2, length ); + + RStringF netTypeStr = pool.OpenFStringL( *netType ); + RStringF addrTypeStr = pool.OpenFStringL( *addrType ); + CleanupClosePushL( netTypeStr ); + CleanupClosePushL( addrTypeStr ); + + CSdpOriginField* obj = CSdpOriginField::NewLC( *userName, KDummyValue, + KDummyValue, netTypeStr, + addrTypeStr, *address ); + // Set the real values + obj->OriginFieldPtrs().SetSessionIdL( *sessionId ); + obj->OriginFieldPtrs().SetSessionVersionL( *version ); + CleanupStack::Pop( obj ); + CleanupStack::Pop( 2 ); // addrTypeStr, netTypeStr + CleanupStack::PopAndDestroy( address ); + CleanupStack::PopAndDestroy( addrType ); + CleanupStack::PopAndDestroy( netType ); + CleanupStack::PopAndDestroy( version ); + CleanupStack::PopAndDestroy( sessionId ); + CleanupStack::PopAndDestroy( userName ); + + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::IsValidAddress +// Checks if the address is valid +// ----------------------------------------------------------------------------- +// +TBool CSdpOriginField::IsValidAddress( + const TDesC8& aAddress ) const + { + TInetAddr addr; + TBool valid = ETrue; + + if ( aAddress.Length() > 0 && aAddress.Length() <= KMaxAddressLength ) + { + TBuf address16; + address16.Copy( aAddress ); + TInt err = addr.Input( address16 ); + + if ( !err ) + { + valid = ( addr.IsUnicast() || addr.IsUnspecified() ); + } + else + { + RStringF addrTypeIP4 = + iPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ); + RStringF addrTypeIP6 = + iPool.StringF( SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ); + + if ( iAddressType == addrTypeIP4 || iAddressType == addrTypeIP6 ) + { + // FQDN address, check that it has only valid characters + // 0..9, a..z, A..Z, '.', '-' + + for ( TInt i( 0 ); i < aAddress.Length() && valid; i++ ) + { + if (KValidFQDNChars().Locate(aAddress[i]) == KErrNotFound) + { + valid = EFalse; + } + } + } + else + { + valid = SdpUtil::IsNonWhitespace( aAddress ); + } + } + } + else + { + valid = EFalse; + } + + return valid; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::IsValidAddress +// Checks if the address is valid +// ----------------------------------------------------------------------------- +// +TBool CSdpOriginField::IsValidAddress( + const TInetAddr& addr ) const + { + TBuf buf16; + TBuf8 buf; + //if addr is IPv4-Mapped IPv6, buf value will be IPv4 after Output + addr.Output( buf16 ); + buf.Copy( buf16 ); + + return IsValidAddress( buf ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::TypeMatchesWithFormat +// Checks if address type is aligned with the address format +// ----------------------------------------------------------------------------- +// +TBool CSdpOriginField::TypeMatchesWithFormat( + const TDesC8& aAddress, + const TDesC8& aType, + RStringPool aPool ) const + { + RStringF addrTypeIP4 = + aPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ); + RStringF addrTypeIP6 = + aPool.StringF( SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ); + + TBool valid( ETrue ); + + // Check that address type and address matches together + TInetAddr addr; + TBuf address16; + address16.Copy( aAddress ); + TInt err = addr.Input( address16 ); + if ( err == KErrNone && !addr.IsUnspecified()) + { + TBool ip4Type = ( addrTypeIP4.DesC().CompareF( aType ) == 0 ); + TBool ip6Type = ( addrTypeIP6.DesC().CompareF( aType ) == 0 ); + + if ( ip4Type || ip6Type ) + { + if ( ( addr.Address() && !addr.IsV4Mapped() && !ip4Type ) || + (addr.Address() && addr.IsV4Mapped() && !ip6Type) || + ( !addr.Address() && !ip6Type ) ) + { + valid = EFalse; + } + } + } + + return valid; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::IsValidUserName +// Checks if the given username is valid +// ----------------------------------------------------------------------------- +// +TBool CSdpOriginField::IsValidUserName( + const TDesC8& aUserName ) const + { + TBool valid = EFalse; + + if ( aUserName.Length() > 0 && SdpUtil::IsNonWhitespace( aUserName ) ) + { + valid = ETrue; + } + + return valid; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ParseUserNameL +// Parses username. Can't use CSdpOriginField::SetUserNameL, as invariant would +// fail. +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ParseUserNameL( + RArray& aArray ) + { + __ASSERT_ALWAYS( IsValidUserName( aArray[KUserNameIndex] ), + User::Leave( KErrSdpCodecOriginField ) ); + OriginFieldPtrs().SetUserNameL( aArray[KUserNameIndex] ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ParseSessionIDAndVersionL +// Parses session ID and version +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ParseSessionIDAndVersionL( + RArray& aArray ) + { + __ASSERT_ALWAYS( SdpUtil::IsDigit( aArray[KSessionIdIndex] ) && + SdpUtil::IsDigit( aArray[KSessionVersionIndex] ), + User::Leave( KErrSdpCodecOriginField ) ); + + OriginFieldPtrs().SetSessionIdL( aArray[KSessionIdIndex] ); + OriginFieldPtrs().SetSessionVersionL( aArray[KSessionVersionIndex] ); + } + + // ----------------------------------------------------------------------------- +// CSdpOriginField::ParseNetTypeAndAddressTypeL +// Parses network type and address type +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ParseNetTypeAndAddressTypeL( + RArray& aArray ) + { + if ( !SdpUtil::IsToken( aArray[KNetworkTypeIndex] ) || + !SdpUtil::IsToken( aArray[KAddressTypeIndex] ) ) + { + User::Leave( KErrSdpCodecOriginField ); + } + + iNetType = iPool.OpenFStringL( aArray[KNetworkTypeIndex] ); + iAddressType = iPool.OpenFStringL( aArray[KAddressTypeIndex] ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::ParseAddressL +// Parses address +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::ParseAddressL( + RArray& aArray ) + { + if ( !IsValidAddress( aArray[KAddressIndex] ) ) + { + User::Leave( KErrSdpCodecOriginField ); + } + else + { + iAddress = aArray[KAddressIndex]; + } + + // Check that address type and address matches together + if ( !TypeMatchesWithFormat( + aArray[KAddressIndex], aArray[KAddressTypeIndex], iPool ) ) + { + User::Leave( KErrSdpCodecOriginField ); + } + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::OriginFieldPtrs +// ----------------------------------------------------------------------------- +// +inline CSdpOriginFieldPtrs& CSdpOriginField::OriginFieldPtrs() + { + return *( reinterpret_cast< CSdpOriginFieldPtrs* >( iUserName ) ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::OriginFieldPtrs +// ----------------------------------------------------------------------------- +// +inline const CSdpOriginFieldPtrs& CSdpOriginField::OriginFieldPtrs() const + { + return *( reinterpret_cast< CSdpOriginFieldPtrs* >( iUserName ) ); + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::Get63Msbs +// Returns a maximum of 63 bits of information from the descriptor containing a +// decimal number. +// ----------------------------------------------------------------------------- +// +TInt64 CSdpOriginField::Get63Msbs( const TDesC8& aDecimalValue ) const + { + // The maximum amount of digits in a decimal number, that is guaranteed to + // fit into 63 bits, is 18. Even if all the 18 digits are 9, the decimal + // number is 999999999999999999. + const TInt64 KMaxAmountOfDecimalDigits = 18; + + TInt64 value( 0 ); + TPtrC8 msbPart = aDecimalValue.Left( KMaxAmountOfDecimalDigits ); + TLex8( msbPart ).Val( value ); + return value; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginField::SetIPAddressType +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::SetIPAddressType( const TInetAddr& aAddr ) + { + iAddressType.Close(); + if ( aAddr.Address() || aAddr.IsUnspecified() ) + { + //IPv4, IPv4-Mapped IPv6 and 0.0.0.0 + iAddressType = + iPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ).Copy(); + } + else + { + //IPv6 + iAddressType = + iPool.StringF( SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ).Copy(); + } + } + +// For DEBUG builds + +// ----------------------------------------------------------------------------- +// CSdpOriginField::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// +void CSdpOriginField::__DbgTestInvariant() const + { + TBool invariant = + iUserName != NULL + && SdpUtil::IsToken( iAddressType.DesC() ) + && SdpUtil::IsToken( iNetType.DesC() ) + && IsValidAddress( iAddress ) + && IsValidUserName( OriginFieldPtrs().UserName() ) + && TypeMatchesWithFormat(iAddress, iAddressType.DesC(), iPool) + && SdpUtil::IsNonWhitespace( OriginFieldPtrs().UserName() ); + + if ( !invariant ) + { + User::Invariant(); + } + } + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdporiginfieldptrs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdporiginfieldptrs.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,152 @@ +// Copyright (c) 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: +// Name : SdpOriginFieldPtrs.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include "sdporiginfieldptrs.h" + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::NewL +// ----------------------------------------------------------------------------- +// +CSdpOriginFieldPtrs* CSdpOriginFieldPtrs::NewL( TInt64 aSessionId, + TInt64 aSessionVersion ) + { + CSdpOriginFieldPtrs* self = new ( ELeave ) CSdpOriginFieldPtrs; + CleanupStack::PushL( self ); + self->ConstructL( aSessionId, aSessionVersion ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::CSdpOriginFieldPtrs +// ---------------------------------------------------------------------------- +// +CSdpOriginFieldPtrs::CSdpOriginFieldPtrs() + { + } + +// ---------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::ConstructL +// ---------------------------------------------------------------------------- +// +void CSdpOriginFieldPtrs::ConstructL( TInt64 aSessionId, + TInt64 aSessionVersion ) + { + iUserName = KNullDesC8().AllocL(); + SetSessionIdL( aSessionId ); + SetSessionVersionL( aSessionVersion ); + } + +// ---------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::~CSdpOriginFieldPtrs +// ---------------------------------------------------------------------------- +// +CSdpOriginFieldPtrs::~CSdpOriginFieldPtrs() + { + delete iUserName; + delete iSessionId; + delete iSessionVersion; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SetUserNameL +// ----------------------------------------------------------------------------- +// +void CSdpOriginFieldPtrs::SetUserNameL( const TDesC8& aUserName ) + { + HBufC8* tmp = aUserName.AllocL(); + delete iUserName; + iUserName = tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::UserName +// ----------------------------------------------------------------------------- +// +const TDesC8& CSdpOriginFieldPtrs::UserName() const + { + return *iUserName; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SetSessionIdL +// ----------------------------------------------------------------------------- +// +void CSdpOriginFieldPtrs::SetSessionIdL( const TDesC8& aSessionId ) + { + HBufC8* tmp = aSessionId.AllocL(); + delete iSessionId; + iSessionId = tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SetSessionIdL +// ----------------------------------------------------------------------------- +// +void CSdpOriginFieldPtrs::SetSessionIdL( TInt64 aSessionId ) + { + TBuf8< KMaxTInt64Digits > number; + number.AppendNum( aSessionId ); + HBufC8* tmp = number.AllocL(); + delete iSessionId; + iSessionId = tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SessionId +// ----------------------------------------------------------------------------- +// +const TDesC8& CSdpOriginFieldPtrs::SessionId() const + { + return *iSessionId; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SetSessionVersionL +// ----------------------------------------------------------------------------- +// +void CSdpOriginFieldPtrs::SetSessionVersionL( const TDesC8& aSessionVersion ) + { + HBufC8* tmp = aSessionVersion.AllocL(); + delete iSessionVersion; + iSessionVersion = tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SetSessionVersionL +// ----------------------------------------------------------------------------- +// +void CSdpOriginFieldPtrs::SetSessionVersionL( TInt64 aSessionVersion ) + { + TBuf8< KMaxTInt64Digits > number; + number.AppendNum( aSessionVersion ); + HBufC8* tmp = number.AllocL(); + delete iSessionVersion; + iSessionVersion = tmp; + } + +// ----------------------------------------------------------------------------- +// CSdpOriginFieldPtrs::SessionVersion +// ----------------------------------------------------------------------------- +// +const TDesC8& CSdpOriginFieldPtrs::SessionVersion() const + { + return *iSessionVersion; + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdprepeatfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdprepeatfield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,385 @@ +// Copyright (c) 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: +// Name : SdpRepeatField.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdprepeatfield.h" +#include "sdputil.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" +#include "sdpcodecstringconstants.h" +#include "sdpdocument.h" +#include "sdpcodecConstants.h" +#include "sdpcodecErr.h" +#include "sdpcodecStringPool.h" + + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::DecodeL +// Decodes bandwidth field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpRepeatField* CSdpRepeatField::DecodeL(const TDesC8& aText) + { + CSdpRepeatField* obj = DecodeLC(aText); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::DecodeLC +// Decodes bandwidth field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpRepeatField* CSdpRepeatField::DecodeLC(const TDesC8& aText) + { + CSdpRepeatField* obj = new (ELeave) CSdpRepeatField(); + CleanupStack::PushL(obj); + obj->ConstructL(aText); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpRepeatField* CSdpRepeatField::NewL( + const TSdpTypedTime aRepeatInterval, + const TSdpTypedTime aActiveDuration, + const RArray& aOffsets) + { + CSdpRepeatField* obj = NewLC(aRepeatInterval, aActiveDuration, aOffsets); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpRepeatField* CSdpRepeatField::NewLC( + const TSdpTypedTime aRepeatInterval, + const TSdpTypedTime aActiveDuration, + const RArray& aOffsets) + { + CSdpRepeatField* obj = new (ELeave) CSdpRepeatField(aRepeatInterval, + aActiveDuration); + CleanupStack::PushL(obj); + obj->ConstructL(aOffsets); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::~CSdpRepeatField +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpRepeatField::~CSdpRepeatField() + { + iTimeOffsets.Close(); + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpRepeatField::EncodeL(RWriteStream& aStream) const + { + const TDesC8& repeatName = iPool.StringF(SdpCodecStringConstants::ERepeat, + SdpCodecStringConstants::Table).DesC(); + aStream.WriteL(repeatName); + iRepeatInterval.EncodeL(aStream); + aStream.WriteL(KSPStr); + iActiveDuration.EncodeL(aStream); + for (TInt i = 0; i < iTimeOffsets.Count(); i++) + { + aStream.WriteL(KSPStr); + (iTimeOffsets)[i].EncodeL(aStream); + } + aStream.WriteL(KCRLFStr); + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::CloneL +// Creates an exact copy of the repeat field +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpRepeatField* CSdpRepeatField::CloneL() const + { + __TEST_INVARIANT; + CSdpRepeatField* obj = NewL(iRepeatInterval, iActiveDuration, + iTimeOffsets); + __ASSERT_DEBUG(*this == *obj, User::Panic(KSdpCodecPanicCat, + KSdpCodecPanicInternal)); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::operator == +// Checks if two repeat fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpRepeatField::operator == (const CSdpRepeatField & aObj) + const + { + __TEST_INVARIANT; + TBool result = iRepeatInterval == aObj.iRepeatInterval + && iActiveDuration == aObj.iActiveDuration + && iTimeOffsets.Count() == (aObj.iTimeOffsets).Count(); + if (result) + { + int i = 0; + while (result && i < iTimeOffsets.Count()) + { + result = (iTimeOffsets)[i] == (aObj.iTimeOffsets)[i]; + i++; + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::RepeatInterval +// Return repeat interval value +// ----------------------------------------------------------------------------- +// +EXPORT_C const TSdpTypedTime CSdpRepeatField::RepeatInterval() const + { + __TEST_INVARIANT; + return iRepeatInterval; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::SetRepeatIntervalL +// Sets repeat interval to one of predefined values +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpRepeatField::SetRepeatIntervalL(const TSdpTypedTime aValue) + { + __TEST_INVARIANT; + __ASSERT_ALWAYS(aValue.iValue > 0, User::Leave(KErrSdpCodecRepeatField)); + iRepeatInterval = aValue; + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::ActiveDuration +// Returns active duration value +// ----------------------------------------------------------------------------- +// +EXPORT_C const TSdpTypedTime CSdpRepeatField::ActiveDuration() const + { + __TEST_INVARIANT; + return iActiveDuration; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::SetActiveDuration +// Sets new active duration value +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpRepeatField::SetActiveDuration(const TSdpTypedTime aValue) + { + __TEST_INVARIANT; + iActiveDuration = aValue; + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::TimeOffsets +// CReturns timeoffsets +// ----------------------------------------------------------------------------- +// +EXPORT_C const RArray& CSdpRepeatField::TimeOffsets() const + { + __TEST_INVARIANT; + return iTimeOffsets; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::SetTimeOffsetsL +// Sets timeoffsets +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpRepeatField::SetTimeOffsetsL( + const RArray& aValue) + { + RArray tempOffsets; + if (aValue.Count() > 0) + { + CleanupClosePushL( tempOffsets ); + for (TInt i = 0; i < aValue.Count(); i++) + { + User::LeaveIfError(tempOffsets.Append(aValue[i])); + } + CleanupStack::Pop(); // tempOffsets + iTimeOffsets.Close(); + iTimeOffsets = tempOffsets; + } + else + { + // remove old timeoffsets + iTimeOffsets.Reset(); + } + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::ExternalizeL +// Externalizes the object to stream +// ----------------------------------------------------------------------------- +// +void CSdpRepeatField::ExternalizeL(RWriteStream& aStream) const + { + iRepeatInterval.ExternalizeL(aStream); + iActiveDuration.ExternalizeL(aStream); + aStream.WriteUint32L(iTimeOffsets.Count()); + for (TInt i = 0; i < iTimeOffsets.Count(); i++) + { + (iTimeOffsets)[i].ExternalizeL(aStream); + } + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::InternalizeL +// Internalizes the object from stream +// ----------------------------------------------------------------------------- +// +CSdpRepeatField* CSdpRepeatField::InternalizeL(RReadStream& aStream) + { + const TSdpTypedTime repeatInterval = TSdpTypedTime::InternalizeL(aStream); + TSdpTypedTime activeDuration = TSdpTypedTime::InternalizeL(aStream); + TUint32 offsetsCount = aStream.ReadUint32L(); + RArray offsets; + CleanupClosePushL(offsets); + + if (offsetsCount > 0) + { + for (TUint i = 0; i < offsetsCount; i++) + { + User::LeaveIfError(offsets.Append( + TSdpTypedTime::InternalizeL(aStream))); + } + + } + + CSdpRepeatField* obj = CSdpRepeatField::NewL(repeatInterval, + activeDuration, offsets); + + CleanupStack::PopAndDestroy(); // offsets + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::CSdpRepeatField +// Constructor +// ----------------------------------------------------------------------------- +// +CSdpRepeatField::CSdpRepeatField(const TSdpTypedTime aRepeatInterval, + const TSdpTypedTime aActiveDuration) +: iRepeatInterval(aRepeatInterval), iActiveDuration(aActiveDuration) + { + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::CSdpRepeatField +// Constructor +// ----------------------------------------------------------------------------- +// +CSdpRepeatField::CSdpRepeatField() + { + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpRepeatField::ConstructL(const TDesC8& aText) + { + iPool = SdpCodecStringPool::StringPoolL(); + RArray lines; + lines = SdpUtil::DivideToLinesL(aText, KErrSdpCodecRepeatField); + CleanupClosePushL(lines); + RArray repeatArray; + repeatArray = SdpUtil::GetElementsFromLineL(lines[0], + KErrSdpCodecRepeatField); + CleanupClosePushL(repeatArray); + const TDesC8& repeatName = iPool.StringF(SdpCodecStringConstants::ERepeat, + SdpCodecStringConstants::Table).DesC(); + __ASSERT_ALWAYS(lines.Count() == 1 + && repeatArray.Count() >= 3 + && repeatName.CompareF(repeatArray[0]) == 0, + User::Leave(KErrSdpCodecRepeatField)); + + // repeat interval + __ASSERT_ALWAYS(TLex8(repeatArray[1]).Peek() != '0', + User::Leave(KErrSdpCodecRepeatField)); + iRepeatInterval = TSdpTypedTime::DecodeL(repeatArray[1]); + + // active duration + iActiveDuration = TSdpTypedTime::DecodeL(repeatArray[2]); + + if (repeatArray.Count() > 3) + { + for (TInt i = 3; i < repeatArray.Count(); i++) + { + User::LeaveIfError(iTimeOffsets.Append( + TSdpTypedTime::DecodeL(repeatArray[i]))); + } + } + CleanupStack::PopAndDestroy(2); // lines, repeatArray + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpRepeatField::ConstructL(const RArray& aOffsets) + { + __ASSERT_ALWAYS(iRepeatInterval.iValue > 0, + User::Leave(KErrSdpCodecRepeatField)); + iPool = SdpCodecStringPool::StringPoolL(); + if (aOffsets.Count() > 0) + { + for (TInt i = 0; i < aOffsets.Count(); i++) + { + User::LeaveIfError(iTimeOffsets.Append(aOffsets[i])); + } + } + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpRepeatField::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// +void CSdpRepeatField::__DbgTestInvariant() const + { + TBool invariant = iRepeatInterval.iValue > 0; + if (!invariant) + User::Invariant(); + } + + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdprtpmapvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdprtpmapvalue.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,131 @@ +// Copyright (c) 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: +// Name : SdpRtpmapValue.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdprtpmapvalue.h" +#include "sdputil.h" +#include "sdpcodecerr.h" +#include "sdpcodecconstants.h" +#include "_sdpdefs.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TSdpRtpmapValue::TSdpRtpmapValue +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C TSdpRtpmapValue::TSdpRtpmapValue( + const TPtrC8& aEncodingName, + const TPtrC8& aClockrate, + const TPtrC8& aEncodingParameters ) : + iEncName( aEncodingName ), + iClockrate( aClockrate ), + iEncParams( aEncodingParameters ) + { + } + +// ----------------------------------------------------------------------------- +// TSdpRtpmapValue::DecodeL +// Decodes string and puts it into parts +// ----------------------------------------------------------------------------- +// +EXPORT_C TSdpRtpmapValue TSdpRtpmapValue::DecodeL( + const TDesC8& aText ) + { + __ASSERT_ALWAYS(aText.Length() > 0 && + aText.Locate( KSlashChar ) != KErrNotFound, + User::Leave(KErrSdpCodecMediaAttributeField)); + + TInt length( aText.Length() ); + if ( aText[length - 1] == KLFChar ) + { + if ( length > 1 && aText[length - 2] == KCRChar ) + { + length--; + } + length--; + } + TPtrC8 restValue( aText.Left( length ) ); + + __ASSERT_ALWAYS(SdpUtil::IsByteString(restValue), + User::Leave(KErrSdpCodecMediaAttributeField)); + + TInt pos = restValue.Locate( KSlashChar ); + + // + TPtrC8 encName( restValue.Left( pos ) ); + + restValue.Set( restValue.Right( restValue.Length() - pos - 1 ) ); + pos = restValue.Locate( KSlashChar ); + + // + TPtrC8 encParam( KNullDesC8 ); + TPtrC8 clockRate( KNullDesC8 ); + + if ( pos == KErrNotFound ) + { + clockRate.Set( restValue ); + + __ASSERT_ALWAYS( clockRate.Length() > 0 && encParam.Length() == 0, + User::Leave( KErrSdpCodecMediaAttributeField ) ); + } + else + { + clockRate.Set( restValue.Left( pos ) ); + encParam.Set( restValue.Right( restValue.Length() - pos - 1 ) ); + + __ASSERT_ALWAYS( clockRate.Length() > 0 && encParam.Length() > 0, + User::Leave( KErrSdpCodecMediaAttributeField ) ); + } + + return TSdpRtpmapValue( encName, clockRate, encParam ); + } + +// ----------------------------------------------------------------------------- +// TSdpRtpmapValue::EncodeL +// Encodes a string into valid output string format +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* TSdpRtpmapValue::EncodeL() const + { + TUint length = iEncName.Length() + iClockrate.Length() + 2; + + if (iEncParams.Length() > 0) + { + length += iEncParams.Length() + 1; + } + + HBufC8* returnValue = HBufC8::NewL(length); + + TPtr8 retValPtr(returnValue->Des()); + retValPtr.Append(iEncName); + retValPtr.Append(KSlashStr); + retValPtr.Append(iClockrate); + + if (iEncParams.Length() > 0) + { + retValPtr.Append(KSlashStr); + retValPtr.Append(iEncParams); + } + + return returnValue; + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdptimefield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdptimefield.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,415 @@ +// Copyright (c) 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: +// Name : SdpTimeField.h +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdptimefield.h" +#include "sdputil.h" +#include "sdpcodec.pan" +#include "_sdpdefs.h" +#include "sdprepeatfield.h" +#include "sdpcodecstringconstants.h" +#include "sdpdocument.h" +#include "sdpcodecerr.h" +#include "sdpcodecconstants.h" +#include "sdpcodecerr.h" +#include "sdpcodecstringpool.h" + +// LOCAL CONSTANTS +_LIT8(KZeroTime, "0"); + +// ----------------------------------------------------------------------------- +// CSdpTimeField::DecodeL +// Decodes time field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpTimeField * CSdpTimeField::DecodeL(const TDesC8& aText, + TBool aRecurse) + { + CSdpTimeField* obj = DecodeLC(aText, aRecurse); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::DecodeLC +// Decodes time field from TDesC +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpTimeField * CSdpTimeField::DecodeLC(const TDesC8& aText, + TBool aRecurse) + { + CSdpTimeField* obj = new (ELeave) CSdpTimeField(); + CleanupStack::PushL(obj); + obj->ConstructL(aText, aRecurse); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::NewL +// Two-phased constructor +// ----------------------------------------------------------------------------- +EXPORT_C CSdpTimeField * CSdpTimeField::NewL(const TDesC8& aStartTime, + const TDesC8& aStopTime) + { + CSdpTimeField* obj = NewLC(aStartTime, aStopTime); + CleanupStack::Pop(); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::NewLC +// Two-phased constructor +// ----------------------------------------------------------------------------- +EXPORT_C CSdpTimeField * CSdpTimeField::NewLC(const TDesC8& aStartTime, + const TDesC8& aStopTime) + { + CSdpTimeField* obj = new (ELeave) CSdpTimeField(); + CleanupStack::PushL(obj); + obj->ConstructL(aStartTime, aStopTime); + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::~CSdpTimeField +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpTimeField::~CSdpTimeField () + { + iRFields.ResetAndDestroy(); + delete iStopTime; + delete iStartTime; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpTimeField::EncodeL(RWriteStream& aStream, + TBool aRecurse) const + { + __ASSERT_ALWAYS(this->IsValid(), User::Leave(KErrNotReady)); + const TDesC8& timeName = iStringPool.StringF(SdpCodecStringConstants::ETime, + SdpCodecStringConstants::Table).DesC(); + aStream.WriteL(timeName); + aStream.WriteL(*iStartTime); + aStream.WriteL(KSPStr); + aStream.WriteL(*iStopTime); + aStream.WriteL(KCRLFStr); + if (aRecurse) + { + for(TInt i=0; iEncodeL(aStream); + } + } + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::CloneL +// Creates an exact copy of the time field +// ----------------------------------------------------------------------------- +// +EXPORT_C CSdpTimeField* CSdpTimeField::CloneL(TBool aRecurse) const + { + CSdpTimeField* obj = CSdpTimeField::NewLC(*this->iStartTime, + *this->iStopTime); + __TEST_INVARIANT; + if (aRecurse) + { + for (TInt i = 0; i < iRFields.Count(); i++) + { + CSdpRepeatField* repObj = iRFields[i]->CloneL(); + CleanupStack::PushL(repObj); + User::LeaveIfError(obj->RepeatFields().Append(repObj)); + CleanupStack::Pop(); // repObj + } + } + CleanupStack::Pop(); //obj + return obj; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::operator == +// Checks if two time fields are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpTimeField::operator == (const CSdpTimeField & aObj) const + { + __TEST_INVARIANT; + return (aObj.StartTime().Compare(this->StartTime()) == 0 + && aObj.StopTime().Compare(this->StopTime()) == 0 + && RepeatFieldsCompare(aObj)); + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::IsValid +// Checks if start time and stop time are valid +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSdpTimeField::IsValid() const + { + return ( (iStartTime->Match(KZeroTime) + && iStopTime->Match(KZeroTime)) + || (iStartTime->Length() != 0 + && iStopTime->Length() != 0 + && *iStartTime <= *iStopTime)); + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::StartTime +// Returns start time +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpTimeField::StartTime() const + { + __TEST_INVARIANT; + return *iStartTime; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::StopTime +// Returns stop time +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CSdpTimeField::StopTime() const + { + __TEST_INVARIANT; + return *iStopTime; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::SetTimesL +// Sets start time and stop time if they are valid ones +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSdpTimeField::SetTimesL(const TDesC8& aStartTime, + const TDesC8& aStopTime) + { + __ASSERT_ALWAYS( + (aStartTime.Length() == 1 && aStartTime[0] -'0' == 0 + && ((aStopTime.Length() == 1 && aStopTime[0] -'0' == 0) + || (aStopTime.Length() > 1 + && SdpUtil::IsValidNtpTime(aStopTime)))) + || (aStartTime.Length() > 1 && SdpUtil::IsValidNtpTime(aStartTime) + && aStopTime.Length() > 1 && SdpUtil::IsValidNtpTime(aStopTime) + && aStartTime < aStopTime), + User::Leave(KErrSdpCodecTimeField)); + + HBufC8* tmpStartTime = aStartTime.AllocL(); + CleanupStack::PushL(tmpStartTime); + HBufC8* tmpStopTime = aStopTime.AllocL(); + + tmpStartTime->Des().Trim(); + delete iStartTime; + iStartTime = tmpStartTime; + tmpStopTime->Des().Trim(); + delete iStopTime; + iStopTime = tmpStopTime; + + CleanupStack::Pop(); // tmpStartTime + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::RepeatFields +// Returns repeat fields +// ----------------------------------------------------------------------------- +// +EXPORT_C RPointerArray& CSdpTimeField::RepeatFields() + { + __TEST_INVARIANT; + return iRFields; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::ExternalizeL +// Externalizes the object to stream +// ----------------------------------------------------------------------------- +// +void CSdpTimeField::ExternalizeL(RWriteStream& aStream) const + { + __TEST_INVARIANT; + aStream.WriteUint32L(iStartTime->Length()); + aStream.WriteL(*iStartTime); + aStream.WriteUint32L(iStopTime->Length()); + aStream.WriteL(*iStopTime); + aStream.WriteUint32L(iRFields.Count()); + for(TInt i=0; iExternalizeL(aStream); + } + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::InternalizeL +// Internalizes the object from stream +// ----------------------------------------------------------------------------- +// +CSdpTimeField* CSdpTimeField::InternalizeL(RReadStream& aStream) + { + CSdpTimeField* self = new (ELeave) CSdpTimeField(); + CleanupStack::PushL(self); + self->iStringPool = SdpCodecStringPool::StringPoolL(); + + self->DoInternalizeL(aStream); + + CleanupStack::Pop(); //self + + return self; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::DoInternalizeL +// Internalizes the object members from stream +// ----------------------------------------------------------------------------- +// +void CSdpTimeField::DoInternalizeL(RReadStream& aStream) + { + + TUint32 valueLength = aStream.ReadUint32L(); + iStartTime = HBufC8::NewL (valueLength); + TPtr8 startTime(iStartTime->Des()); + aStream.ReadL (startTime,valueLength); + valueLength = aStream.ReadUint32L(); + iStopTime = HBufC8::NewL (valueLength); + TPtr8 stopTime(iStopTime->Des()); + aStream.ReadL (stopTime,valueLength); + + TUint rFieldsCount = aStream.ReadUint32L(); + for (TUint i = 0; i < rFieldsCount; i++) + { + CSdpRepeatField* rField = CSdpRepeatField::InternalizeL(aStream); + CleanupStack::PushL(rField); + User::LeaveIfError(iRFields.Append(rField)); + CleanupStack::Pop(); //rField + } + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::CSdpTimeField +// Constructor +// ----------------------------------------------------------------------------- +// +CSdpTimeField::CSdpTimeField() + { + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpTimeField::ConstructL(const TDesC8& aText, TBool aRecurse) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + RArray lines; + lines = SdpUtil::DivideToLinesL(aText, KErrSdpCodecTimeField); + CleanupClosePushL(lines); + RArray timeArray; + timeArray = SdpUtil::GetElementsFromLineL(lines[0], KErrSdpCodecTimeField); + CleanupClosePushL(timeArray); + const TDesC8& timeName = iStringPool.StringF(SdpCodecStringConstants::ETime, + SdpCodecStringConstants::Table).DesC(); + __ASSERT_ALWAYS(lines.Count() > 0 + && timeArray.Count() == 3 + && timeArray[0].Find(timeName) != KErrNotFound, + User::Leave(KErrSdpCodecTimeField)); + + SetTimesL(timeArray[1], timeArray[2]); + + if (aRecurse && lines.Count() > 1) + { + const TDesC8& repeatName = + iStringPool.StringF(SdpCodecStringConstants::ERepeat, + SdpCodecStringConstants::Table).DesC(); + for( TInt i = 1; i lineArray; + lineArray = SdpUtil::GetElementsFromLineL(lines[i], KErrSdpCodecTimeField); + CleanupClosePushL(lineArray); + __ASSERT_ALWAYS(lineArray[0].Find(repeatName) != KErrNotFound, + User::Leave(KErrSdpCodecTimeField)); + CSdpRepeatField* repeatField = CSdpRepeatField::DecodeL(lines[i]); + CleanupStack::PushL(repeatField); + User::LeaveIfError(iRFields.Append(repeatField)); + CleanupStack::Pop(); // repeatField + CleanupStack::PopAndDestroy(); //lineArray + } + } + CleanupStack::PopAndDestroy(2); // timeArray, lines + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSdpTimeField::ConstructL(const TDesC8& aStartTime, + const TDesC8& aStopTime) + { + iStringPool = SdpCodecStringPool::StringPoolL(); + SetTimesL(aStartTime, aStopTime); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::RepeatFieldsCompare +// Checks if two time field objects repeat fields are equal +// ----------------------------------------------------------------------------- +// +TBool CSdpTimeField::RepeatFieldsCompare(const CSdpTimeField& aObj) const + { + TBool returnValue = ETrue; + if (iRFields.Count() == aObj.iRFields.Count()) + { + for (TInt i = 0; i < iRFields.Count() && returnValue; i++) + { + if (!(*iRFields[i] == *aObj.iRFields[i])) + returnValue = EFalse; + } + } + + return returnValue; + } + +// ----------------------------------------------------------------------------- +// CSdpTimeField::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// +void CSdpTimeField::__DbgTestInvariant() const + { + TBool invariant = + ((iStartTime->Length() == 1 && (iStartTime->Des())[0] -'0' == 0) + && ((iStopTime->Length() == 1 && (iStopTime->Des())[0] -'0' == 0) + || (iStopTime->Length() > 1 + && SdpUtil::IsValidNtpTime(*iStopTime)))) + || (iStartTime->Length() > 1 && SdpUtil::IsValidNtpTime(*iStartTime) + && iStopTime->Length() > 1 && SdpUtil::IsValidNtpTime(*iStopTime) + && *iStartTime < *iStopTime); + + if (!invariant) + User::Invariant(); + } + + diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdptypedtime.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdptypedtime.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,206 @@ +// Copyright (c) 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: +// Name : SdpTypedTime.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include "sdptypedtime.h" +#include "_sdpdefs.h" +#include "sdpcodecerr.h" +#include "sdpcodecstringconstants.h" +#include "sdpcodecstringpool.h" + +// LOCAL CONSTANTS +const TUint KMaxTInt64Digits = 30; + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::TSdpTypedTime +// Contructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TSdpTypedTime::TSdpTypedTime() +: iValue(0), iUnit(ETimeUnitNone) + { + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::TSdpTypedTime +// Contructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TSdpTypedTime::TSdpTypedTime(TInt64 aValue, TUnit aUnit) +: iValue(aValue), iUnit(aUnit) + { + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::operator == +// Checks if two TSdpTypedTimes are equal +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TSdpTypedTime::operator == (const TSdpTypedTime& aObj) const + { + return iValue == aObj.iValue && iUnit == aObj.iUnit; + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::SetValue +// Sets typed time value +// ----------------------------------------------------------------------------- +// +EXPORT_C void TSdpTypedTime::SetValue(TInt64 aValue, TUnit aUnit) + { + iValue = aValue; + iUnit = aUnit; + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::ExternalizeL +// Externalizes the typed time to stream +// ----------------------------------------------------------------------------- +// +void TSdpTypedTime::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteUint32L( I64HIGH( iValue ) ); + aStream.WriteUint32L( I64LOW( iValue ) ); + aStream.WriteInt16L(iUnit); + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::InternalizeL +// Internalizes typed time from stream +// ----------------------------------------------------------------------------- +// +TSdpTypedTime TSdpTypedTime::InternalizeL(RReadStream& aStream) + { + TUint32 high = aStream.ReadUint32L(); + TUint32 low = aStream.ReadUint32L(); + TInt64 value = MAKE_TINT64( high, low ); + TUnit unit = static_cast(aStream.ReadInt16L()); + TSdpTypedTime typedTime(value, unit); + return typedTime; + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::EncodeL +// Writes attributes in proper format to the stream +// ----------------------------------------------------------------------------- +// +void TSdpTypedTime::EncodeL(RWriteStream& aStream) const + { + TBuf8 number; + number.AppendNum( iValue ); + aStream.WriteL( number ); + + RStringPool pool = SdpCodecStringPool::StringPoolL(); + const TDesC8& timeDays = pool.StringF( + SdpCodecStringConstants::ETimeUnitDays, + SdpCodecStringConstants::Table).DesC(); + const TDesC8& timeHours = pool.StringF( + SdpCodecStringConstants::ETimeUnitHours, + SdpCodecStringConstants::Table).DesC(); + const TDesC8& timeMinutes = pool.StringF( + SdpCodecStringConstants::ETimeUnitMinutes, + SdpCodecStringConstants::Table).DesC(); + const TDesC8& timeSeconds = pool.StringF( + SdpCodecStringConstants::ETimeUnitSeconds, + SdpCodecStringConstants::Table).DesC(); + + if (iUnit != ETimeUnitNone) + { + TBuf8<1> unit; + if (iUnit == ETimeUnitDays) + { + unit.Append(timeDays); + } + else if (iUnit == ETimeUnitHours) + { + unit.Append(timeHours); + } + else if (iUnit == ETimeUnitMinutes) + { + unit.Append(timeMinutes); + } + else if (iUnit == ETimeUnitSeconds) + { + unit.Append(timeSeconds); + } + else + {} + + aStream.WriteL(unit); + } + } + +// ----------------------------------------------------------------------------- +// TSdpTypedTime::DecodeL +// Decodes typed time from TDesC +// ----------------------------------------------------------------------------- +// +TSdpTypedTime TSdpTypedTime::DecodeL(const TDesC8& aText) + { + TLex8 typedTimeLex(aText); + TSdpTypedTime typedTime; + User::LeaveIfError(typedTimeLex.Val(typedTime.iValue, EDecimal)); + + if (typedTimeLex.Peek() != 0) + { + TPtrC8 unitString = typedTimeLex.NextToken(); + + RStringPool pool = SdpCodecStringPool::StringPoolL(); + const TDesC8& timeDays = pool.StringF( + SdpCodecStringConstants::ETimeUnitDays, + SdpCodecStringConstants::Table).DesC(); + const TDesC8& timeHours = pool.StringF( + SdpCodecStringConstants::ETimeUnitHours, + SdpCodecStringConstants::Table).DesC(); + const TDesC8& timeMinutes = pool.StringF( + SdpCodecStringConstants::ETimeUnitMinutes, + SdpCodecStringConstants::Table).DesC(); + const TDesC8& timeSeconds = pool.StringF( + SdpCodecStringConstants::ETimeUnitSeconds, + SdpCodecStringConstants::Table).DesC(); + + if (unitString.Compare(timeDays) == 0) + { + typedTime.iUnit = ETimeUnitDays; + } + else if (unitString.Compare(timeHours) == 0) + { + typedTime.iUnit = ETimeUnitHours; + } + else if (unitString.Compare(timeMinutes) == 0) + { + typedTime.iUnit = ETimeUnitMinutes; + } + else if (unitString.Compare(timeSeconds) == 0) + { + typedTime.iUnit = ETimeUnitSeconds; + } + else + { + User::Leave(KErrSdpCodecTypedTime); + } + } + else + { + typedTime.iUnit = ETimeUnitNone; + } + + return typedTime; + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdputil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/src/sdputil.cpp Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,635 @@ +// Copyright (c) 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: +// Name : SdpUtil.cpp +// Part of : Local SDP Codec +// Version : 1.0 +// + + + +#include +#include +#include "sdputil.h" +#include "sdpcodecstringconstants.h" +#include "sdpcodecstringpool.h" +#include "sdpcodecconstants.h" +#include "_sdpdefs.h" + +// LOCAL CONSTANTS +const TInt KMaxAddressLength = 256; +_LIT8(KInvalidTokenCharacters, "\0\r\n\t ()<>@,;:"); +_LIT8(KInvalidByteStringCharacters, "\0\r\n"); +_LIT8(KWhitespaceCharacters, "\0\r\n \t"); +_LIT16(KWildAddr, "0.0.0.0"); + +// ----------------------------------------------------------------------------- +// SdpUtil::IsValidCharSet +// Generic checker to validate that string has only valid characters +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsValidCharSet( + const TDesC8& aIllegalChars, + const TDesC8& aValue, + TInt aStart, + TInt aEnd) + { + TBool result = EFalse; + + if ( aIllegalChars.Length() > 0 && aStart >= 0 && + aEnd <= aValue.Length() && aStart < aEnd ) + { + TInt comp = KErrNotFound; + while (comp == KErrNotFound && aStart < aEnd) + { + comp = aIllegalChars.Locate( aValue[aStart] ); + ++aStart; + } + result = ( comp == KErrNotFound ); + } + else + { + result = ( ( aStart < aEnd ) && + ( aIllegalChars.Length() == 0 || aValue.Length() == 0 ) ); + } + + return result; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenList +// Checks that token list is valid +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenList( + const TDesC8& aValue ) + { + TBool atError = ( aValue.Length() == 0 ); + + // Check that we are starting with valid character, not e.g. with space + if ( !atError && + KInvalidTokenCharacters().Locate( aValue[0] ) != KErrNotFound ) + { + atError = ETrue; + } + + TLex8 lexer( aValue ); + // Go through the tokens to see that they are valid + while ( !atError && !lexer.Eos() ) + { + if ( !IsToken( lexer.NextToken() ) ) + { + atError = ETrue; + } + } + + return !atError; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsToken +// Checks if aValue is valid token +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsToken( + const TDesC8& aValue, + TInt aStart, + TInt aEnd) + { + return IsValidCharSet( KInvalidTokenCharacters, aValue, aStart, aEnd ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsToken +// Checks if aValue is valid token +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsToken( + const TDesC8& aValue ) + { + return IsValidCharSet( KInvalidTokenCharacters, aValue, 0, aValue.Length() ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsByteString +// Checks if aValue is valid byte string +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsByteString( + const TDesC8& aValue, + TInt aStart, + TInt aEnd ) + { + return IsValidCharSet( KInvalidByteStringCharacters, aValue, aStart, aEnd ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsByteString +// Checks if aValue is valid byte string +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsByteString( + const TDesC8& aValue ) + { + return IsValidCharSet( KInvalidByteStringCharacters, aValue, 0, + aValue.Length() ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenTextPair +// Checks if aValue is valid pair ("valid token":"valid byte-string") +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenTextPair( + const TDesC8& aValue, + TInt aStart, + TInt aEnd ) + { + // token ":" text + TBool result = EFalse; + if ( aStart >= 0 && aEnd <= aValue.Length() && aStart < aEnd ) + { + TPtrC8 subVal = aValue.Mid( aStart, aEnd - aStart ); + TInt colonPos = subVal.Locate( KColonChar ); + result = colonPos != KErrNone && + IsToken( subVal, 0, colonPos ) && + IsByteString( subVal, colonPos + 1, subVal.Length() ); + } + return result; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenTextPair +// Checks if aValue is valid pair ("valid token":"valid byte-string") +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenTextPair( + const TDesC8& aValue ) + { + return IsTokenTextPair( aValue, 0, aValue.Length() ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsNonWhitepce +// Checks if aValue contains only non-whitespace characters +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsNonWhitespace( + const TDesC8& aValue ) + { + return IsValidCharSet( KWhitespaceCharacters, aValue, 0, aValue.Length() ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsValidNtpTime +// Checks if aValue contains only non-whitespace characters +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsValidNtpTime( + const TDesC8& aValue ) + { + // POS-DIGIT 9*DIGIT + TUint len = aValue.Length(); + TBool result = len >= 10 && TChar( aValue[0] ) != TChar('0'); + if ( result ) + { + for ( TUint i( 0 ); result && i < len; i++) + { + TInt tmp = aValue[i] - '0'; + result = ( tmp >= 0 && tmp <= 9 ); + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::DivideToLinesL +// Divides descriptor into a number of lines that are separated by +// CRLF or LF marks +// ----------------------------------------------------------------------------- +// +RArray SdpUtil::DivideToLinesL( + const TDesC8& aLines, + TInt aErrCode ) + { + RArray lineArray; + CleanupClosePushL( lineArray ); + + TInt lineStartPos( 0 ); + TInt lineEndPos( aLines.Length() ); + TInt pos( 0 ); + + TPtrC8 parsedPart( aLines.Right( lineEndPos - lineStartPos ) ); + // Splits aLines to number of TPtrC8s, each ending to CRLF/LF + while ( lineStartPos < lineEndPos && + ( pos = parsedPart.Find( KLFStr ) ) != KErrNotFound ) + { + if ( ! ( pos == 0 || + ( pos == ( KCRLFStr().Length() - 1 ) && + parsedPart.Find( KCRLFStr ) == 0 ) ) ) + { + // Lines that contain only CRLF or LF are ignored + // Put the valid lines to the array + User::LeaveIfError( + lineArray.Append( + TPtrC8( parsedPart.Left( pos + KLFStr().Length() ) ) ) ); + } + // Advance the start of the line after LF mark + lineStartPos += pos + KLFStr().Length(); + parsedPart.Set( aLines.Right( lineEndPos - lineStartPos ) ); + } + + // This method expects that last line of aLines ends _always_ + // to LF not to '\0' + if ( aLines.Length() == 0 || + ( aLines.Length() > 0 && aLines[aLines.Length() - 1] != '\n' ) ) + { + User::Leave( aErrCode ); + } + + CleanupStack::Pop(); // lineArray + return lineArray; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::GetElementsFromLineL +// Gets all the elements from a single line +// ----------------------------------------------------------------------------- +// +RArray SdpUtil::GetElementsFromLineL( + const TDesC8& aLine, + TInt aErrCode ) + { + TLex8 lexer( aLine ); + RArray lineArray = + SdpUtil::GetElementsFromLineL( lexer, KSPChar, aErrCode ); + return lineArray; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::GetElementsFromLineL +// Gets all the elements from a single line +// ----------------------------------------------------------------------------- +// +RArray SdpUtil::GetElementsFromLineL( + const TDesC8& aLine, + TChar aDelimiter, + TInt aErrCode ) + { + TLex8 lexer( aLine ); + RArray lineArray = + SdpUtil::GetElementsFromLineL( lexer, aDelimiter, aErrCode ); + return lineArray; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::GetElementsFromLineL +// Gets all the elements from a single line +// ----------------------------------------------------------------------------- +// +RArray SdpUtil::GetElementsFromLineL( + TLex8& aLexer, + TChar aDelimiter, + TInt aErrCode ) + { + RArray lineArray; + CleanupClosePushL( lineArray ); + + // Header is special case, because it is joined _without_ + // space character with the first attribute, so it must be + // parsed separately + + aLexer.Mark(); + // curChar must be != KEqualChar at first comparison + for ( TChar curChar( KSPChar ); curChar != KEqualChar; ) + { + curChar = aLexer.Peek(); + // Syntax check + if ( curChar == KEofChar || curChar == KLFChar || + curChar == KCRChar ) + { + User::Leave( aErrCode ); + } + aLexer.Inc(); + } + // Append header to array + User::LeaveIfError( lineArray.Append( aLexer.MarkedToken() ) ); + + // Whitespace MUST NOT be used after the "=" sign + if (aLexer.Peek() == KSPChar) + { + User::Leave( aErrCode ); + } + + // Get the other elements from the string to the array + ChopElementsFromLineL( lineArray, aLexer, aDelimiter, aErrCode ); + + CleanupStack::Pop(); // lineArray + return lineArray; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsPosDigit +// Checks if all the charcaters on the descriptor are POS-DIGITs +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsPosDigit( + const TDesC8& aDes ) + { + // POS-DIGIT = %x31-39 ; 1 - 9 + _LIT8( KValidPosDigits, "123456789" ); + return SdpUtil::IsValidChars( KValidPosDigits, aDes ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsDigit +// Checks if all the charcaters on the descriptor are DIGITs +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsDigit( + const TDesC8& aDes ) + { + // DIGIT = "0" / "1" / "2" / "3" / "4" / "5" / "6" / + // "7" / "8" / "9" + _LIT8( KValidDigits, "0123456789" ); + + return SdpUtil::IsValidChars( KValidDigits, aDes ); + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsValidChars +// Checks if all the charcaters on the descriptor are from valid charset +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsValidChars( + const TDesC8& aValidChars, + const TDesC8& aDes ) + { + TBool valid( aDes.Length() > 0 ); + for ( TInt i( 0 ); i < aDes.Length() && valid; i++ ) + { + if ( aValidChars.Locate( aDes[i] ) == KErrNotFound ) + { + valid = EFalse; + } + } + + return valid; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenCharWithSpacesL +// Checks if all the elements on the string are valid tokens +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenCharWithSpacesL( + const TDesC8& aValue ) + { + TLex8 lex( aValue ); + lex.SkipSpace(); + + if( lex.Remainder().Length() == 0 ) + { + User::Leave( KErrArgument ); + } + + while ( !lex.Eos() ) + { + if ( !IsTokenChar( lex.NextToken() ) ) + { + return EFalse; + } + lex.SkipSpace(); + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenCharWithOptionalSlash +// Checks if all the possible two elements divided by slash are valid tokens +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenCharWithOptionalSlash(const TDesC8& aValue) + { + TInt lineEndPosition = aValue.Locate('/'); + + if ( lineEndPosition != KErrNotFound ) + { + TPtrC8 firstToken( aValue.Left( lineEndPosition ) ); + if( !IsTokenChar( firstToken ) || + !IsTokenChar( aValue.Mid( lineEndPosition + 1 ) ) ) + { + return EFalse; + } + } + else + { + return IsTokenChar( aValue ); + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenChar +// Checks if all the elements on the string are valid tokens +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenChar( + const TDesC8& aValue ) + { + TLex8 lex( aValue ); + while( !lex.Eos() ) + { + TChar ch = lex.Get(); + lex.Inc(); + + if( ch == '\r' ||ch == '\n' || ch == '\0' || !IsTokenChar( ch ) ) + { + return EFalse; + } + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// SdpUtil::IsTokenChar +// Checks if the character is a valid token character +// ----------------------------------------------------------------------------- +// +TBool SdpUtil::IsTokenChar( + TChar aChar ) + { + return ( ( aChar == '!')|| + ( aChar >= '#' && aChar <= '\'' ) || + ( aChar == '*' || aChar == '+' ) || + ( aChar == '-' || aChar == '.' ) || + ( aChar.IsDigit() ) || + ( aChar >= 'a' && aChar <= 'z' ) || + ( aChar >= 'A' && aChar <= 'Z' ) || + ( aChar >= '^' && aChar <= '~' ) ); + } + +// --------------------------------------------------------------------------- +// SdpUtil::EncodeBufferL +// Encodes headername and a value to the stream +// --------------------------------------------------------------------------- +// +void SdpUtil::EncodeBufferL( + const TDesC8& aValue, + TInt aIndex, + RWriteStream& aStream ) + { + if( aValue.Length() != 0 ) + { + RStringPool pool = SdpCodecStringPool::StringPoolL(); + RStringF headername = pool.StringF( aIndex, + SdpCodecStringPool::StringTableL() ); + aStream.WriteL( headername.DesC() ); + aStream.WriteL( aValue ); + aStream.WriteL( KCRLFStr ); + } + } + +// --------------------------------------------------------------------------- +// SdpUtil::SetDefaultNetTypeAndAddrType +// Sets network type and address type to their "default" values +// --------------------------------------------------------------------------- +// +void SdpUtil::SetDefaultNetTypeAndAddrType( + RStringPool aPool, + const TInetAddr& aAddress, + RStringF& aNetType, + RStringF& aAddressType ) + { + // Sets network type to IN + aNetType.Close(); + aNetType = aPool.StringF( SdpCodecStringConstants::ENetType, + SdpCodecStringConstants::Table ).Copy(); + // Address type + aAddressType.Close(); + + TBuf16 output; + aAddress.Output(output); + + + //addresstype for IPv4 + if((aAddress.Address() && !aAddress.IsV4Mapped()) || + (!aAddress.Address() && aAddress.IsWildAddr() && + output.Match(KWildAddr) == 0)) + { + aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressTypeIP4, + SdpCodecStringConstants::Table ).Copy(); + } + else + { + //addresstype for IPv4-Mapped IPv6 && IPv6 + aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressType, + SdpCodecStringConstants::Table ).Copy(); + } + } + +// --------------------------------------------------------------------------- +// SdpUtil::SkipSpacesUntilNextLineBreak +// Skips spaces until next line break, if the line break can be found. +// Examples: " \r\n" -> "\r\n", "abc def\r\n" -> "abc def\r\n" +// --------------------------------------------------------------------------- +// +TBool SdpUtil::SkipSpacesUntilNextLineBreak( TLex8& aLexer ) + { + TBool found = EFalse; + if ( aLexer.Peek() == KSPChar ) + { + TInt spaceCount = 0; + while ( aLexer.Peek() == KSPChar ) + { + spaceCount++; + aLexer.Get(); + } + if ( aLexer.Peek() != KCRChar && aLexer.Peek() != KLFChar ) + { + for ( TInt i=0; i < spaceCount; i++ ) + { + aLexer.UnGet(); + } + } + else + { + found = ETrue; + } + } + return found; + } + +// --------------------------------------------------------------------------- +// SdpUtil::ChopElementsFromLineL +// Chops all the elements that are divided by delimiter from the string +// --------------------------------------------------------------------------- +// +void SdpUtil::ChopElementsFromLineL( + RArray& aArray, + TLex8& aLexer, + TChar aDelimiter, + TInt aErrCode ) + { + // Chop the elements to the array from lexer + TBool eofcFound = EFalse; + while (!eofcFound) + { + aLexer.Mark(); + // Parse single token, leave other special characters + // to token except aDelimiter | '\r' | '\n' | '\0' + while ( aLexer.Peek() != aDelimiter && + aLexer.Peek() != KCRChar && + aLexer.Peek() != KLFChar && + aLexer.Peek() != KEofChar ) + { + aLexer.Inc(); + } + + if ( aLexer.MarkedToken().Length() > 0 ) + { + aArray.AppendL( aLexer.MarkedToken() ); + } + + if ( aDelimiter == KSPChar && + aLexer.Peek() == aDelimiter ) + { + SkipSpacesUntilNextLineBreak( aLexer ); + } + + // Check if its end-of-line + if ( aLexer.Peek() == KCRChar ) + { + aLexer.Inc(); + } + + if ( aLexer.Peek() == KLFChar ) + { + aLexer.Inc(); + if ( aLexer.Peek() != KEofChar ) + { + User::Leave( aErrCode ); + } + eofcFound = ETrue; + } + else if ( aLexer.Peek() == KEofChar ) + { + // EoF character not tolerated at the middle of the string + User::Leave( aErrCode ); + } + else + { + aLexer.Inc(); + } + } + } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/strings/localsdpcodecstringconstants.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/strings/localsdpcodecstringconstants.st Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,148 @@ +!/** +! * @publishedAll +! * @released +!*/ +# SDPCodec String table +fstringtable SdpCodecStringConstants +# Strings are case-sensitive +# +# +!// SDP field names: +EVersion v= +EOrigin o= +ESession s= +EInfo i= +EUri u= +EEmail e= +EPhone p= +EConnection c= +EBandwidth b= +EZone z= +EKey k= +EAttribute a= +ETime t= +ERepeat r= +EMedia m= +# +# +!// Predefined bandwidth modifiers: +EModifierCT CT +EModifierAS AS +# +# +!// Typed time units: +ETimeUnitDays d +ETimeUnitHours h +ETimeUnitMinutes m +ETimeUnitSeconds s +!// No typed time unit defined: +ETimeUnitNone +# +# +!// Predefined encryption methods: +EMethodClear clear +EMethodBase64 base64 +EMethodUri uri +EMethodPrompt prompt +# +# +!// Predefined attributes: +# Defined in RFC2327 if no comment +EAttributeCat cat +EAttributeKeywds keywds +EAttributeTool tool +EAttributePtime ptime +# draft-ietf-mmusic-sdp-new +EAttributeMaxptime maxptime +EAttributeRecvonly recvonly +EAttributeSendrecv sendrecv +EAttributeSendonly sendonly +# draft-ietf-mmusic-sdp-new +EAttributeInactive inactive +EAttributeOrient orient +!// Predefined Orient attribute values +EAttributeOrientValuePortrait portrait +EAttributeOrientValueLandscape landscape +EAttributeOrientValueSeascape seascape +EAttributeType type +EAttributeCharset charset +EAttributeSdplang sdplang +EAttributeLang lang +EAttributeFramerate framerate +EAttributeQuality quality +# RFC2326 +EAttributeControl control +# RFC2326 +EAttributeRange range +# RFC2326 +EAttributeEtag etag +# RFC3312 +EAttributeDes des +# RFC3312 +EAttributeCurr curr +# RFC3312 +EAttributeConf conf +# RFC3312 +!// Predefined Strength tag for Curr, Conf and Des attributes +EAttributeStatusStrengthTagMandatory mandatory +# RFC3312 +EAttributeStatusStrengthTagOptional optional +# RFC3312 +EAttributeStatusStrengthTagNone none +# RFC3312 +EAttributeStatusStrengthTagFailure failure +# RFC3312 +EAttributeStatusStrengthTagUnknown unknown +# RFC3312 +!// Predefined Status type for Curr, Conf and Des attributes +EAttributeStatusTypeE2e e2e +# RFC3312 +EAttributeStatusTypeLocal local +# RFC3312 +EAttributeStatusTypeRemote remote +# RFC3312 +!// Predefined Direction tag for Curr, Conf and Des attributes +EAttributeStatusDirectionTagNone none +# RFC3312 +EAttributeStatusDirectionTagSend send +# RFC3312 +EAttributeStatusDirectionTagRecv recv +# RFC3312 +EAttributeStatusDirectionTagSendrecv sendrecv +# RFC3388 +EAttributeMid mid +# RFC3388 +EAttributeGroup group +# RFC3388 +!// Predefined semantics for Group attribute +EAttributeGroupSemanticLS LS +# RFC3388 +EAttributeGroupSemanticFID FID +# RFC3524 +EAttributeGroupSemanticSRF SRF +EAttributeRtpmap rtpmap +EAttributeFmtp fmtp +# +# +!// Predefined media types: +EMediaAudio audio +EMediaVideo video +EMediaApplication application +EMediaData data +EMediaControl control +EMediaImage image +# +# +!// Predefined media transport protocols: +EProtocolRtpAvp RTP/AVP +EProtocolUdp udp +EProtocolTcp TCP +# +# +!// Network type: +ENetType IN +# +# +!// Address types: +EAddressTypeIP4 IP4 +EAddressType IP6 diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/sracommon.h --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/sracommon.h Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/sracommon.h Thu May 27 14:32:46 2010 +0300 @@ -34,14 +34,12 @@ #include #include -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -#include -#include -#include -#include -#include -#include -#endif +#include "sdpdocument.h" +#include "sdpmediafield.h" +#include "sdpattributefield.h" +#include "sdpcodecstringpool.h" +#include "sdpfmtattributefield.h" +#include "sdpcodecstringconstants.h" #include #include diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/sraserver.h --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/sraserver.h Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/sraserver.h Thu May 27 14:32:46 2010 +0300 @@ -97,10 +97,8 @@ CSraProcessor* iProcessor; CKeyStreamSink* iKeyStreamSink; CSraRightsObject* iRo; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY CSdpMediaField* iSdp; CSdpDocument* iSdpDoc; -#endif /** A handle to a mutex which is used to signal the client that the key has been implemented. Not necessary in real-life agents and is present here only for testing. diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/srautils.h --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/srautils.h Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/inc/srautils.h Thu May 27 14:32:46 2010 +0300 @@ -27,11 +27,7 @@ #define SRAUTILS_H #include "srarightsobject.h" -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -#include -#else -class CSdpMediaField; -#endif +#include "sdpmediafield.h" #include diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/client/sraclient.cpp --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/client/sraclient.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/client/sraclient.cpp Thu May 27 14:32:46 2010 +0300 @@ -185,14 +185,10 @@ @param aKey An SDP object data. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY HBufC8* sdpBuf(0); TPtr8 ptr(EncodeLC(aSdp, sdpBuf)); User::LeaveIfError(RSessionBase::SendReceive(ESetSdpKeyStream, TIpcArgs(&ptr))); CleanupStack::PopAndDestroy(sdpBuf); -#else - (void) aSdp; -#endif } EXPORT_C void RSraClient::SendSdpDocumentL(const CSdpDocument& aSdpDoc) const @@ -201,13 +197,8 @@ @param aKey An SDP object data. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY HBufC8* sdpDocBuf(0); TPtr8 ptr(EncodeLC(aSdpDoc, sdpDocBuf)); User::LeaveIfError(RSessionBase::SendReceive(ESetSdpDocument, TIpcArgs(&ptr))); CleanupStack::PopAndDestroy(sdpDocBuf); -#else - (void) aSdpDoc; -#endif - } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/sraserver.cpp --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/sraserver.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/sraserver.cpp Thu May 27 14:32:46 2010 +0300 @@ -61,9 +61,7 @@ delete iShutdownTimer; iFs.Close(); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY SdpCodecStringPool::Close(); -#endif } @@ -81,9 +79,7 @@ User::LeaveIfError(iFs.Connect()); User::LeaveIfError(iFs.ShareProtected()); User::LeaveIfError(iFs.CreatePrivatePath(iFs.GetSystemDrive())); -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY SdpCodecStringPool::OpenL(); -#endif StartL(KSraName); iShutdownTimer = CShutdownTimer::NewL(KSraShutdownPeriod); iShutdownTimer->Restart(); diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/srasession.cpp --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/srasession.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/server/srasession.cpp Thu May 27 14:32:46 2010 +0300 @@ -23,9 +23,7 @@ #include "sraprocessor.h" #include "srautils.h" #include -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -#include -#endif +#include "sdpconnectionfield.h" CSraSession::CSraSession() //constructor @@ -42,10 +40,8 @@ delete iKeyStreamSink; delete iRo; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY delete iSdp; delete iSdpDoc; -#endif delete iProcessor; iMutex.Close(); } @@ -331,7 +327,6 @@ @param aMessage Standard server-side handle to message. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY TInt len = aMessage.GetDesMaxLengthL(0); HBufC8* des = HBufC8::NewLC(len); TPtr8 ptr(des->Des()); @@ -355,10 +350,6 @@ } StartProcessorL(); aMessage.Complete(KErrNone); -#else - (void) aMessage; - User::Leave(KErrCANoRights); -#endif } @@ -369,7 +360,6 @@ @param aMessage Standard server-side handle to message. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY TInt len = aMessage.GetDesMaxLengthL(0); HBufC8* des = HBufC8::NewLC(len); TPtr8 ptr(des->Des()); @@ -384,9 +374,6 @@ CleanupStack::PopAndDestroy(des); aMessage.Complete(KErrNone); -#else - (void) aMessage; -#endif } @@ -396,7 +383,6 @@ and then process that by using the key stream sink. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY // Mutex is used to synchronise the agent with the test harness. // A real-life agent should not need to use a mutex object. User::LeaveIfError(iMutex.CreateGlobal(KSraMutexName)); @@ -433,5 +419,4 @@ // Launch the processor iProcessor->StartProcessing(); -#endif } diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/utils/srautils.cpp --- a/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/utils/srautils.cpp Fri May 14 17:39:00 2010 +0300 +++ b/contentmgmt/referencedrmagent/RefTestAgent/streamingrefagent/source/utils/srautils.cpp Thu May 27 14:32:46 2010 +0300 @@ -19,11 +19,9 @@ #include "srautils.h" #include -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY -#include -#include -#include -#endif +#include "sdpfmtattributefield.h" +#include "sdpcodecstringpool.h" +#include "sdpattributefield.h" HBufC8* ExtractKmsIdLC(const TDesC8& aValue) /** @@ -75,7 +73,6 @@ */ { TBool supported = EFalse; -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY //FormatAttributeFields method is not constant. So create a new instance. CSdpMediaField* sdp = aSdpKeyStream.CloneL(); CleanupStack::PushL(sdp); @@ -103,10 +100,6 @@ CleanupStack::PopAndDestroy(kmsid); } CleanupStack::PopAndDestroy(sdp); -#else - (void) aSdpKeyStream; - (void) aSupportedKmsIds; -#endif return supported; } @@ -175,7 +168,6 @@ Finds and loads the Rights Object specified in the SDP given. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY // Find the rights object if it is defined in the SDP CSdpAttributeField* roAttrField = NULL; TInt count = aSdp.AttributeFields().Count(); @@ -209,12 +201,6 @@ {//the rights object is defined in the SDP FindAndLoadRightsObjectL(aFs, roAttrField->Value(), aPrivateFolder, aRo); } -#else - (void) aFs; - (void) aSdp; - (void) aRo; - (void) aPrivateFolder; -#endif } EXPORT_C void DoSetSdpMediaFieldL(RFs& aFs, CSdpMediaField*& aSdp, CSraRightsObject*& aRo, const TDesC8& aSdpData, const TDesC& aPrivateFolder) @@ -228,17 +214,9 @@ @param aPrivateFolder The private folder of the agent. */ { -#ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY ASSERT(!aSdp); // Decode the received message into an SDP object aSdp = CSdpMediaField::DecodeL(aSdpData,ETrue); // Set the specified RO DoSetRightsObjectL(aFs, *aSdp, aRo, aPrivateFolder); -#else - (void) aFs; - (void) aSdp; - (void) aRo; - (void) aSdpData; - (void) aPrivateFolder; -#endif } diff -r b23410e29e22 -r 8873e6835f7b securityanddataprivacytools/securitytools/openssllib/import/bin/deb/distribution.policy --- a/securityanddataprivacytools/securitytools/openssllib/import/bin/deb/distribution.policy Fri May 14 17:39:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Category E -OSD: Optional Replaceable Software Install Tools PC Side -Export Restricted -# This code has been obtained from www.OpenSSL.org and is -# potentially subject to license and export restrictions. - diff -r b23410e29e22 -r 8873e6835f7b securityanddataprivacytools/securitytools/openssllib/import/bin/linux-x86/deb/distribution.policy --- a/securityanddataprivacytools/securitytools/openssllib/import/bin/linux-x86/deb/distribution.policy Fri May 14 17:39:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Category E -OSD: Optional Replaceable Software Install Tools PC Side -Export Restricted -# This code has been obtained from www.OpenSSL.org and is -# potentially subject to license and export restrictions. - diff -r b23410e29e22 -r 8873e6835f7b securityanddataprivacytools/securitytools/openssllib/import/bin/linux-x86/rel/distribution.policy --- a/securityanddataprivacytools/securitytools/openssllib/import/bin/linux-x86/rel/distribution.policy Fri May 14 17:39:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Category E -OSD: Optional Replaceable Software Install Tools PC Side -Export Restricted -# This code has been obtained from www.OpenSSL.org and is -# potentially subject to license and export restrictions. - diff -r b23410e29e22 -r 8873e6835f7b securityanddataprivacytools/securitytools/openssllib/import/bin/rel/distribution.policy --- a/securityanddataprivacytools/securitytools/openssllib/import/bin/rel/distribution.policy Fri May 14 17:39:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Category E -OSD: Optional Replaceable Software Install Tools PC Side -Export Restricted -# This code has been obtained from www.OpenSSL.org and is -# potentially subject to license and export restrictions. -