datacommsserver/esockserver/test/CapTests/Socket/Common/CSuite.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-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 "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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #if (!defined CAP_PARAM_SVR_SUITENAME_SERVER_H_)
       
    22 #define CAP_PARAM_SVR_SUITENAME_SERVER_H_
       
    23 
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32svr.h>
       
    28 #include "f32file.h"
       
    29 #include "e32test.h"
       
    30 #include <in_sock.h>
       
    31 
       
    32 #ifdef SYMBIAN_OLD_EXPORT_LOCATION
       
    33 #include <TestExecuteStepBase.h>
       
    34 #include <TestExecuteServerBase.h>
       
    35 #else
       
    36 #include <test/TestExecuteStepBase.h>
       
    37 #include <test/TestExecuteServerBase.h>
       
    38 #endif
       
    39 
       
    40 #include <in_sock.h>
       
    41 #include <in6_opt.h>
       
    42 
       
    43 
       
    44 //The two ways to get thru
       
    45 #define API_RetValue_ServerPanic			0
       
    46 #define API_RetValue_NoCapError				0
       
    47 
       
    48 //The only way to get rejected
       
    49 #define API_RetValue_PermissionDenied		1
       
    50 #define DEBUG_ONLY		1
       
    51 #define DYNAMIC_IPC		2
       
    52 
       
    53 
       
    54 //
       
    55 // Bunch up IPCs that need similar action
       
    56 //
       
    57 template <TInt S>
       
    58 struct dispatch_num
       
    59 	{
       
    60 	enum { result =  S };
       
    61 	/*enum { result =
       
    62 			S >= ESSProtocolStart && S <= ESSProtocolStop ? ESSProtocolStart :
       
    63 			S >= ESoCreate && S <= ESoCreateNull ? ESoCreate :
       
    64 			S >= ESoSend && S <= ESoWrite ? ESoSend :
       
    65 			S >= ESoSendTo && S <= ESoRecvFromNoLength ? ESoSendTo :
       
    66 			S >= ESoSetOpt && S <= ESoGetOpt ? ESoSetOpt :
       
    67 			S >= ESoGetDiscData && S <= ESoGetRemoteName ? ESoGetDiscData :
       
    68 			S >= EHRGetHostName && S <= EHRSetHostName ? EHRGetHostName :
       
    69 			S >= ESRRegisterService && S <= ESRRemoveService ? ESRRegisterService:
       
    70 			S >= ENDAdd && S <= ENDRemove ? ENDAdd :
       
    71 			S >= ECNCreate && S<= ECNCreateWithName ? ECNCreate :
       
    72 			S == ECNProgress || S == ECNLastProgressError ? ECNProgress :
       
    73 	#if defined(_DEBUG)
       
    74 			S >= ESSDbgCheckHeap && S <= ESSDbgCheckMbuf ? ESSDbgCheckHeap :
       
    75 			S >= ESSDbgMbufFreeSpace && S <= ESSDbgMbufTotalSpace ? ESSDbgMbufFreeSpace :
       
    76 	#else
       
    77 			S >= ESSDbgMarkHeap && S <= ESSDbgMbufTotalSpace ? ESSDbgMbufFreeSpace:
       
    78 	#endif
       
    79 			S };*/
       
    80 	};
       
    81 
       
    82 template <TInt v>
       
    83 struct Int2Type
       
    84 	{
       
    85 	enum { value = v};
       
    86 	};
       
    87 
       
    88 
       
    89 // TS_PARAM_SVR_SUITENAMEServer.h
       
    90 //
       
    91 // This contains CTestPARAM_SVR_SUITENAMESuite
       
    92 
       
    93 const TUint KTestSecureServerMajorVersionNumber = 0;
       
    94 const TUint KTestSecureServerMinorVersionNumber	= 1;
       
    95 const TUint KTestSecureServerBuildVersionNumber = 1;
       
    96 
       
    97 
       
    98 class  CTestPARAM_SVR_SUITENAMEServer : public CTestServer
       
    99 {
       
   100 public:
       
   101 	static CTestPARAM_SVR_SUITENAMEServer* NewL();
       
   102 	// Base class pure virtual override
       
   103 	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
       
   104 
       
   105 private:
       
   106 	void CTestPARAM_SVR_SUITENAMEServer::RetrieveUpsAuthorisationGrantedL();
       
   107 
       
   108 private:
       
   109 	// Flag indicating whether UPS authorisation will always be granted and thus override
       
   110 	// the standard Platform Security check.
       
   111 	TBool iUpsAuthorisationGranted;
       
   112 };
       
   113 
       
   114 
       
   115 
       
   116 class CCapabilityTestStep : public CTestStep, public RSessionBase
       
   117 {
       
   118 public:
       
   119  	virtual TVerdict doTestStepPreambleL( void );
       
   120 	virtual TVerdict doTestStepPostambleL( void );
       
   121 //	void ServerClose(RTelServer& aServer);
       
   122 	CActiveScheduler*	testScheduler;
       
   123 
       
   124 	TInt StartServer() ;
       
   125 // from CStep.h
       
   126 	#define SR_MESSAGE_TYPE_CHNGED		2
       
   127 	#define SR_MESSAGE_ID_CHNGED		10
       
   128 	#define SR_ServerName_CHNGED		_L("FLogger server")
       
   129 
       
   130 	#define SR_CAPTEST_INVERSE			0
       
   131 
       
   132 	//The Server Name (eg: CommServer, EtelServer,FLogger server, etc)
       
   133 	TBuf<100>	SR_ServerName;
       
   134 	TBuf<100>	iServer_Panic;
       
   135 
       
   136 	//Following flags influence inverse tests
       
   137 	TBool		iExpect_Rejection;
       
   138 
       
   139 	TUint32  	iStepCap;
       
   140 
       
   141 
       
   142 	//Is it Async or sync?
       
   143 	TInt		SR_MESSAGE_TYPE;
       
   144 
       
   145 	//It holds the IPC number
       
   146 	TInt		SR_MESSAGE_ID;
       
   147 
       
   148 	//Holds the cap mask for the message
       
   149 	TInt		SR_MESSAGE_MASK;
       
   150 
       
   151 	//We name the child thread appended by the IPC_Number it tests
       
   152 	TBuf<100>	ChildThread_SR;
       
   153 
       
   154 	//The flag informs the main thread whether the connection to the server was established
       
   155 	volatile TBool iSessionCreated;
       
   156 
       
   157 	//To find out if an Async message was completed and if then with what result?
       
   158 	TRequestStatus	RequestStatus_SR;
       
   159 
       
   160 	//For an Sync message, nResult_SR get you the return value
       
   161 	TInt	iResult_SR;
       
   162 
       
   163 	//Hold the retusn value from "CreateSession" API
       
   164 	TInt	iResult_Server;
       
   165 
       
   166 	TInt	iResult_C32;
       
   167 
       
   168 	enum 	TDbgFns  {MarkHeapStart, MarkHeapEnd, CheckHeap, FailNext, ResetFailNext};
       
   169 
       
   170  	TInt	iOptions;
       
   171 
       
   172 
       
   173 	//The Child thread object
       
   174 	RThread tChildThread;
       
   175 
       
   176 	//This is the Function called from "doTestStepL" by the test Suite,and it creates an
       
   177 	//child thread which internally calls the corresponding Exec_SendReceive_SERVERNAME fn.
       
   178 	TVerdict MainThread();
       
   179 	TVerdict GetVerdict(TInt aAPIretValue);
       
   180  	TVerdict GetVerdict(TExitType aExit,TInt aInitRetValue, TInt aApiRetValue);
       
   181  	TInt TestDebugHeap(TInt *iDbgIPCNo);
       
   182 
       
   183 
       
   184 	//This is for the scheduler test framework
       
   185 	virtual enum TVerdict doTestStepL();
       
   186 
       
   187 	// Stuff that derived classes need to implement
       
   188 	virtual TVersion Version()=0;
       
   189 	virtual TInt Exec_SendReceive()=0;
       
   190 
       
   191 
       
   192 };
       
   193 
       
   194 
       
   195 #endif /* TS_PARAM_SVR_SUITENAME_SERVER_H_ */
       
   196