pkiutilities/ocsp/test/ocspsupport.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /**
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalTechnology
       
    23 */
       
    24 
       
    25 #ifndef __OCSPSUPPORT_H__
       
    26 #define __OCSPSUPPORT_H__
       
    27 
       
    28 #include <e32std.h>
       
    29 // file duplicated from \\swi\\inc
       
    30 namespace Swi
       
    31 {
       
    32 
       
    33 /// The name of the OCSP Support Server
       
    34 _LIT(KOcspSupportServerName,"!OCSPSUPPORTSERVER");
       
    35 
       
    36 /// The name of the OCSP Support Executable
       
    37 _LIT(KOcspSupportServerExeName,"OCSPSUPPORT");
       
    38 
       
    39 /// The name of the OCSP Support Thread
       
    40 _LIT(KOcspSupportServerThreadName,"OCSPSUPPORTSERVER-THREAD");
       
    41 
       
    42 /// The current version of the OCSP Support Server
       
    43 const TInt KOcspSupportServerVersionMajor=0;
       
    44 const TInt KOcspSupportServerVersionMinor=1;
       
    45 const TInt KOcspSupportServerVersionBuild=0;
       
    46 
       
    47 /**
       
    48  * This class is a handle to the server, which uses HTTP to make the OCSP request
       
    49  */
       
    50 class ROcspHandler : public RSessionBase
       
    51 	{
       
    52 	static const TInt KDefaultBufferSize;
       
    53 public:
       
    54 	/// Connect to the server	
       
    55 	TInt Connect();
       
    56 	
       
    57 	/// Close the connection tothe server
       
    58 	void Close();
       
    59 	
       
    60 	/// Cancel the OCSP request
       
    61 	void CancelRequest();
       
    62 	
       
    63 	/**
       
    64 	 * Get the response data from the OCSP request. This is only valid when SendRequest
       
    65 	 * has been called, and completed with no error. Ownership is transferred to client.
       
    66 	 *
       
    67 	 * @param	aIapOut		The IAP that was used in this request
       
    68 	 * @return	The body of the OCSP response
       
    69 	 */
       
    70 	TPtrC8 GetResponseL(TUint32& aIapOut) const;
       
    71 	
       
    72 	/**
       
    73 	 * Send an OCSP request, using the server.
       
    74 	 * @param	aUri		The URI of the server to send the request to.
       
    75 	 * @param	aRequest	The request data to send.
       
    76 	 * @param	aTimeout	The request timeout value in milliseconds
       
    77 	 * @param	aIap		The IAP to use for this OCSP request
       
    78 	 * @param	aStatus		Request status. On completion contains an error code.
       
    79 	 */
       
    80 	void SendRequest(const TDesC8& aUri, const TDesC8& aRequest, const TInt aTimeout, TUint32 aIap, TRequestStatus& aStatus);
       
    81 
       
    82 private:
       
    83 	/// Starts the server which carries out the requests
       
    84 	TInt StartServer();
       
    85 	
       
    86 	
       
    87 	mutable HBufC8* iResultData;
       
    88 	};
       
    89 
       
    90 } // namespace Swi
       
    91 
       
    92 #endif // #ifndef __OCSPSUPPORT_H__