contentmgmt/cafstreamingsupport/test/streamingtestagent/inc/staserver.h
branchRCL_3
changeset 43 2f10d260163b
child 61 641f389e9157
equal deleted inserted replaced
42:eb9b28acd381 43:2f10d260163b
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Defines server-side classes which are used to implement the Streaming Test Agent.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21  @test
       
    22 */
       
    23 
       
    24 #ifndef STASERVER_H_
       
    25 #define STASERVER_H_
       
    26 
       
    27 #include <scs/scsserver.h>
       
    28 #include <caf/rightsinfo.h>
       
    29 #include <f32file.h>
       
    30 #include <s32file.h>
       
    31 #include "stacommon.h"
       
    32 #include "srarightsobject.h"
       
    33 #include "testkeyassociation.h"
       
    34 #include "testkeystreamsink.h"
       
    35 
       
    36 class CSdpMediaField;
       
    37 class CSdpDocument;
       
    38 
       
    39 namespace StreamAccess
       
    40 	{
       
    41 	//forward declaration
       
    42 	class CStaServer;
       
    43 	
       
    44 	class CStaSession : public CScsSession
       
    45 	/**
       
    46 		This session object is created for each key stream decoder client.
       
    47 		It is used to perform client requests.
       
    48 	 */
       
    49 		{
       
    50 	public:
       
    51 		static CStaSession* NewL(CStaServer &aServer);
       
    52 		~CStaSession();
       
    53 			
       
    54 		// implement CStreamingTestAgentSession
       
    55 		TBool DoServiceL(TInt aFunction, const RMessage2& aMessage);
       
    56 		inline CStaServer* Server();
       
    57 		
       
    58 	private:
       
    59 		CStaSession(CStaServer& aServer);
       
    60 		
       
    61 		void GetAttributeL(const RMessage2& aMessage);
       
    62 		void GetStringAttributeSizeL(const RMessage2& aMessage);
       
    63 		void GetStringAttributeDataL(const RMessage2& aMessage);
       
    64 		void GetPostDeliveryRightsL(const RMessage2& aMessage);
       
    65 		void GetKeyStreamL(const RMessage2& aMessage);
       
    66 		void SetKeyStreamSinkL(const RMessage2& aMessage);
       
    67 		void SetSdpMediaFieldL(const RMessage2& aMessage);
       
    68 		void SetIpSecAssociationL(const RMessage2& aMessage);
       
    69 		void SetSdpDocumentL(const RMessage2& aMessage);
       
    70 		
       
    71 		void VerifyRoL();
       
    72 		void PanicClient(const RMessagePtr2& aMessage, TInt aReason);
       
    73 		
       
    74 	private:
       
    75 		HBufC8* iBuffer;
       
    76 		CKeyStreamSink* iKeyStreamSink;
       
    77 #ifdef INTERNALLY_ENABLE_UPWARD_DEPENDENCY
       
    78 		CSdpMediaField* iSdp;
       
    79 		CSdpDocument* iSdpDoc;
       
    80 #endif
       
    81 		CSraRightsObject* iRo;
       
    82 		};
       
    83 	
       
    84 	/** The mime type of the post-acquisition rights object file. */
       
    85 	_LIT8(KPostAcquisitionRoMimeType,"application/x-rta.drm.postacqrights");
       
    86 	/** The mime type of the post-acquisition rights object file. */
       
    87 	_LIT8(KPostAcquisitionContentMimeType,"application/x-rta.drm.postacqcontent");
       
    88 	/** The content Id of the post-acquisition rights object file. */
       
    89 	_LIT8(KPostAcquisitionCid,"PostAcquisitionTest");
       
    90 	
       
    91 	class CStaServer : public CScsServer
       
    92 	/**
       
    93 		The CScsServer derived object which is used to generate Streaming 
       
    94 		Test Agent sessions for the key stream decoder client.
       
    95 	 */
       
    96 		{
       
    97 	public:
       
    98 		static CStaServer* NewLC();
       
    99 				
       
   100 		~CStaServer();
       
   101 	
       
   102 		//Implement from CScsServer
       
   103 		//void DoPreHeapMarkOrCheckL();
       
   104 		//void DoPostHeapMarkOrCheckL();
       
   105 		CScsSession* DoNewSessionL(const RMessage2& aMessage);
       
   106 				
       
   107 	private:
       
   108 		CStaServer();
       
   109 		void ConstructL();	
       
   110 
       
   111 	public:
       
   112 		/** 
       
   113 		 	File server handle. Public, because it is accessed by session objects. 
       
   114 		 	Since session objects write/read files, they need a file server handle.
       
   115 		 	Sessions use this file handle instead of creating a new one. 
       
   116 		 */
       
   117 		RFs iFs;
       
   118 		};
       
   119 	
       
   120 	inline CStaServer* CStaSession::Server()
       
   121 		{
       
   122 		CStaServer *server = dynamic_cast<CStaServer*>(&iServer);
       
   123 		ASSERT(server);
       
   124 		return server;
       
   125 		}
       
   126 		
       
   127 	/** The private folder of the Streaming Test Agent. */
       
   128 	_LIT(KStaPrivateFolder,"!:\\private\\1028588b\\");	
       
   129 	} //End of the namespace StreamAccess
       
   130 
       
   131 #endif /*STASERVER_H_*/