|
1 /* |
|
2 * Copyright (c) 2008-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 monitors the completion of FQDN resolve. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FQDNRESOLVER_H |
|
20 #define C_FQDNRESOLVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <es_sock.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CVpnConnection; |
|
27 |
|
28 /** |
|
29 * FQDN resolver callback interface. |
|
30 * Callback interface which is used by CFqdnResolver object to notify |
|
31 * about completion of FQDN address resolving. |
|
32 * |
|
33 * @lib internal (kmdserver.exe) |
|
34 */ |
|
35 class MFqdnResolverCallback |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * Notifies about completion of FQDN address resolving. |
|
40 * @param aStatus Completion status |
|
41 * @param aNameEntry Result of name resolution |
|
42 */ |
|
43 virtual void AddressResolveCompleted( const TInt aStatus, |
|
44 const TNameEntry aNameEntry ) = 0; |
|
45 }; |
|
46 |
|
47 /** |
|
48 * FQDN address resolver. |
|
49 * Active object provides functionality for resolving an IP address from FQDN |
|
50 * address. |
|
51 * |
|
52 * @lib internal (kmdserver.exe) |
|
53 */ |
|
54 class CFqdnResolver : public CActive |
|
55 { |
|
56 public: |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @param aConnection VPN connection object |
|
60 * @param aCallback Callback interface |
|
61 */ |
|
62 static CFqdnResolver* NewL( CVpnConnection& aConnection, |
|
63 MFqdnResolverCallback& aCallback ); |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 ~CFqdnResolver(); |
|
68 |
|
69 /** |
|
70 * Resolves IP address from FQDN address. Completion is notified via |
|
71 * MFqdnResolverCallback interface. |
|
72 * @param aFqdn FQDN address. Ownership transferred. |
|
73 */ |
|
74 void ResolveAddress( HBufC* aFqdn ); |
|
75 |
|
76 private: |
|
77 |
|
78 CFqdnResolver( CVpnConnection& aConnection, |
|
79 MFqdnResolverCallback& aCallback ); |
|
80 |
|
81 // from base class CActive |
|
82 |
|
83 /** |
|
84 * From CActive |
|
85 * Handles completion of asynchronous resolving request. |
|
86 */ |
|
87 void RunL(); |
|
88 |
|
89 /** |
|
90 * From CActive |
|
91 * Handles cancellation of asynchronous resolving request. |
|
92 */ |
|
93 void DoCancel(); |
|
94 |
|
95 private: // data |
|
96 |
|
97 /** |
|
98 * VPN connection object. |
|
99 * Not own. |
|
100 */ |
|
101 CVpnConnection& iConnection; |
|
102 |
|
103 /** |
|
104 * FQDN address |
|
105 * Own. |
|
106 */ |
|
107 HBufC* iFqdn; |
|
108 |
|
109 /** |
|
110 * Name entry. |
|
111 * Own. |
|
112 */ |
|
113 TNameEntry iNameEntry; |
|
114 |
|
115 /** |
|
116 * Callback interface. |
|
117 * Not own. |
|
118 */ |
|
119 MFqdnResolverCallback& iCallback; |
|
120 }; |
|
121 |
|
122 #endif // C_FQDNRESOLVER_H |