|
1 // Copyright (c) 2001-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 // Header file for OCSP transaction object |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef __OCSP_TRANSACTION_H__ |
|
24 #define __OCSP_TRANSACTION_H__ |
|
25 |
|
26 #include <ocsp.h> |
|
27 #include <e32base.h> |
|
28 #include "ocsprequestandresponse.h" |
|
29 |
|
30 class COCSPRequestEncoder; |
|
31 class COCSPResponseDecoder; |
|
32 |
|
33 /** |
|
34 * OCSP Transaction object, used to send the request to the server and get the |
|
35 * response back again. |
|
36 */ |
|
37 |
|
38 NONSHARABLE_CLASS(COCSPTransaction) : public CActive |
|
39 { |
|
40 public: |
|
41 // Does not take ownership of the transport object |
|
42 static COCSPTransaction* NewL(const TDesC8& aURI, |
|
43 MOCSPTransport& aTransport, const TUint aRetryCount, const TInt aTimeout); |
|
44 |
|
45 ~COCSPTransaction(); |
|
46 |
|
47 /** |
|
48 * Asynchronous interface to send the reqest. Can complete with one of the |
|
49 * status codes from OCSP::TStatus if there's a problem decoding the |
|
50 * response. |
|
51 */ |
|
52 |
|
53 void SendRequest(COCSPRequest& aRequest, TRequestStatus& aStatus); |
|
54 |
|
55 void CancelRequest(); |
|
56 |
|
57 /** |
|
58 * Get the response and relinquish ownership of it. Returns NULL unless |
|
59 * SendRequest completed successfully. |
|
60 */ |
|
61 |
|
62 COCSPResponse* TakeResponse(); |
|
63 |
|
64 private: |
|
65 // From CActive |
|
66 void RunL(); |
|
67 void DoCancel(); |
|
68 TInt RunError(TInt aError); |
|
69 |
|
70 private: |
|
71 COCSPTransaction(MOCSPTransport& aTransport, const TUint aRetryCount, const TInt aTimeout); |
|
72 void ConstructL(const TDesC8& aURI); |
|
73 |
|
74 void CompleteClient(const TInt aStatus); |
|
75 |
|
76 private: |
|
77 |
|
78 enum TState |
|
79 { |
|
80 ESendRequest, |
|
81 EFinished |
|
82 }; |
|
83 |
|
84 MOCSPTransport& iTransport; |
|
85 HBufC8* iURI; |
|
86 |
|
87 TState iState; |
|
88 |
|
89 // Client TRequestStatus, for the asynchronous SendRequestL |
|
90 TRequestStatus* iClientRequestStatus; |
|
91 |
|
92 // Request object to send |
|
93 COCSPRequest* iRequest; |
|
94 |
|
95 // Request encoder. We own this. |
|
96 COCSPRequestEncoder* iRequestEncoder; |
|
97 |
|
98 // Response object, NULL unless response data received OK |
|
99 COCSPResponseDecoder* iResponseDecoder; |
|
100 |
|
101 // Remaining number of times to send request on failed response (1 means no retry) |
|
102 TUint iRetryCount; |
|
103 |
|
104 // Timeout value (passed on to the transport layer) |
|
105 TInt iTimeout; |
|
106 }; |
|
107 |
|
108 #endif |