pkiutilities/ocsp/test/command.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 // Copyright (c) 2005-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 // Takes a line from a script file representing a command and its parameters,
       
    15 // interprets it and applies them to the engine
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file 
       
    21  @internalTechnology
       
    22 */
       
    23 
       
    24 #ifndef __TOCSP_COMMAND_H__
       
    25 #define __TOCSP_COMMAND_H__
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <ocsp.h>
       
    29 #include "t_input.h"
       
    30 
       
    31 class CTOCSPEngine;
       
    32 class CTOCSPResult;
       
    33 class CTOCSPLogger;
       
    34 class RFs;
       
    35 
       
    36 class CTOCSPCommand : public CActive
       
    37 	{
       
    38 public:
       
    39 	static CTOCSPCommand* NewL(CTOCSPLogger& aLog,
       
    40 							   CTOCSPResult& aResult,
       
    41 							   TInt aTransaction = 0);
       
    42 	~CTOCSPCommand();
       
    43 
       
    44 	// Return False means abort, True means carry on as normal
       
    45 	TBool ProcessCommand(const TDesC& aLine, TRequestStatus& aStatus);
       
    46 
       
    47     // Reset internal state after processing a whole script
       
    48 	// Need to call this to make sure last test result is recorded
       
    49     void ResetL();
       
    50 
       
    51     // Get the index of the current transaction we're processing
       
    52     TInt CurrentTransaction() const;
       
    53 
       
    54 	/** Set whether to print informational messages. */
       
    55 	void SetVerbose(TBool aVerbose);
       
    56 
       
    57 private:
       
    58 	void RunL();
       
    59 	void DoCancel();
       
    60     TInt RunError(TInt aError);
       
    61 
       
    62 private:
       
    63 	CTOCSPCommand(CTOCSPLogger& aLog,
       
    64 				  CTOCSPResult& aResult,
       
    65 				  TInt aTransaction);
       
    66 
       
    67 	void ConstructL();
       
    68 
       
    69 	TBool DoProcessCommandL(const TDesC& aLine);    
       
    70 	TBool ProcessTestCommandL(const TDesC& command);
       
    71 
       
    72 	// Command functions
       
    73 	void UnknownCommandL(const TDesC& aCommand);
       
    74 	void PrintCommandL(const TDesC& aMess);
       
    75 
       
    76 	void StartCommandL();
       
    77 	void EndCommandL();
       
    78 	void SetURICommandL();
       
    79 
       
    80 
       
    81 	void CertCommandL();
       
    82 	void SetTransportCommandL();
       
    83 	void SetTransportRetryCommandL();
       
    84 	void SetTransportTimeoutCommandL();
       
    85 	void SetNonceCommandL();
       
    86 
       
    87 	void CancelCommandL();
       
    88 
       
    89 	void ValidationDateCommandL();
       
    90 	void DirectAuthorisationCommandL();
       
    91 	void CADelegateAuthorisationCommandL();
       
    92 	void CADirectAuthorisationCommandL();
       
    93 	void AllAuthorisationSchemesCommandL();
       
    94 	void SetMaxStatusAgeCommandL();
       
    95 	void SetFilterParamsCommandL();
       
    96 	void CheckCommand();
       
    97 	void TestCancelCommand();
       
    98 	void TestSummaryCommandL();
       
    99 	void TestOutcomeCommandL();
       
   100 	void TestTransportCommandL();
       
   101 	void TestTransportRetryCommandL();
       
   102 
       
   103 	void LogResponseCommandL();
       
   104 	void LogRequestCommandL();
       
   105 
       
   106 	void LogCommandL(const TDesC& line);
       
   107 	
       
   108 	void FinishedTestL();
       
   109 
       
   110 	void WrongNumberOfArgumentsL();
       
   111 
       
   112 	TTime ParseTimeL(TInt aStartToken);
       
   113 	
       
   114 	void SetResponderCertCheck();
       
   115 	void AddCertToStoreL();
       
   116 	void SetCheckCertsWithAiaOnly();
       
   117 	void SetUseAIAL();
       
   118 	
       
   119 	void InvalidArgumentL(const TDesC& aCommand, const TDesC& aCommandOptions);
       
   120 	void InvalidArgumentL(const TDesC& aCommand);
       
   121 	void LogErrorL();
       
   122 	
       
   123 private:
       
   124 	enum TState 
       
   125 		{
       
   126 		EEngineStart,
       
   127 		EEngineEnd,
       
   128 		EDirectAuthorisationCommand,
       
   129 		ECheckCommand
       
   130 		};
       
   131 
       
   132 private:
       
   133 	TState iState;
       
   134 	TRequestStatus* iOriginalRequestStatus;
       
   135 
       
   136 	CTOCSPResult& iResult;
       
   137 
       
   138 	CTOCSPLogger& iLog;
       
   139 
       
   140 	CTOCSPEngine* iEngine;
       
   141 
       
   142 	RArray<TPtrC> iTokens;
       
   143 
       
   144 	TInt iSkipping;
       
   145 
       
   146 	TBool iInsideTest;
       
   147     TInt iTestIndex;
       
   148     TInt iTestToProcess;
       
   149 
       
   150 	TBool iTestResult;
       
   151 
       
   152 	TPtrC iCert;
       
   153 	TPtrC iLabel;
       
   154 
       
   155 	TBool iVerbose;
       
   156 	TBool iTransportSet;
       
   157 
       
   158 	// Contains result of cancellation (ETrue if revocation successfully cancelled)
       
   159 	TBool iCheckCancelled;
       
   160 	TInt iError;
       
   161 	TBuf<128> iTmsId;
       
   162 
       
   163 	};
       
   164 
       
   165 /** Use direct authorisation without supplying an authorising cert. */
       
   166 _LIT(KAuthCertNone, "AUTHCERTNONE");
       
   167 
       
   168 #endif