|
1 /* |
|
2 * Copyright (c) 1999-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: Active object that retrieves an SPI value for IPsec SA |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IPSECSASPIRETRIEVER_H_ |
|
20 #define IPSECSASPIRETRIEVER_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * A Callback interface for IPsec SA SPI value retriever. |
|
26 * Callback interface which is used by CIpsecSaSpiRetriever object to |
|
27 * notify about completion of IPsec SA SPI retrieve |
|
28 * |
|
29 * @lib ikeutils.lib |
|
30 */ |
|
31 class MIpsecSaSpiRetrieverCallback |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Notifies about completion of IPsec SPI SA retrieve. |
|
37 * |
|
38 * @param aSpiRequestId Id of the SPI retrieve request. |
|
39 * @param aStatus Completion status |
|
40 * @param aSpi SPI value |
|
41 */ |
|
42 virtual void IpsecSaSpiRetrieved(TUint32 aSpiRequestId, |
|
43 TInt aStatus, |
|
44 TUint32 aSpi) = 0; |
|
45 |
|
46 }; |
|
47 |
|
48 class CPFKeySocketIf; |
|
49 class TInetAddr; |
|
50 |
|
51 /** |
|
52 * Retrieves new IPsec SA SPI value from the IPsec |
|
53 * |
|
54 * @lib ikeutils.lib |
|
55 */ |
|
56 class CIpsecSaSpiRetriever : public CActive |
|
57 { |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Constructs new IPsec SA SPI retriever. |
|
62 * |
|
63 * @param aRetrieverCallback Used callback interface |
|
64 * @param aSocketIf Used PFKey socket interface. |
|
65 */ |
|
66 IMPORT_C static CIpsecSaSpiRetriever* NewL(MIpsecSaSpiRetrieverCallback& aRetrieverCallback, |
|
67 CPFKeySocketIf& aSocketIf); |
|
68 ~CIpsecSaSpiRetriever(); |
|
69 |
|
70 /** |
|
71 * Issues new IPsec SA SPI retrieve request. |
|
72 * The completation of the SPI retrieve request is notified by using |
|
73 * MIpsecSaSpiRetrieverCallback interface. |
|
74 * |
|
75 * @param aSpiRequestId Id for the SPI request. |
|
76 * @param aIpsecProtocol Used IPsec protocol. |
|
77 * Possible values are SADB_SATYPE_AH and SADB_SATYPE_ESP. |
|
78 * @param aSrc Source address of the IPsec SA. |
|
79 * If SRC_SPECIFIC is not set in the IPsec policy can be set to Unspecified. |
|
80 * @param aDst Destination address of the IPsec SA. |
|
81 */ |
|
82 IMPORT_C void GetIpsecSaSpi(const TUint32 aSpiRequestId, |
|
83 const TUint8 aIpsecProtocol, |
|
84 const TInetAddr& aSrc, |
|
85 const TInetAddr& aDst); |
|
86 |
|
87 private: |
|
88 CIpsecSaSpiRetriever(MIpsecSaSpiRetrieverCallback& aRetrieverCallback, |
|
89 CPFKeySocketIf& aSocketIf); |
|
90 |
|
91 void RunL(); |
|
92 void DoCancel(); |
|
93 TInt RunError(TInt aStatus); |
|
94 |
|
95 MIpsecSaSpiRetrieverCallback& iRetrieverCallback; |
|
96 CPFKeySocketIf& iSocketIf; |
|
97 |
|
98 TUint32 iSpi; |
|
99 TUint32 iSpiRequestId; |
|
100 }; |
|
101 |
|
102 #endif /* IPSECSASPIRETRIEVER_H_ */ |