|
1 /* |
|
2 * Copyright (c) 2007 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 #ifndef DHCPSERVERIPADDRESSRESOLVER_H |
|
20 #define DHCPSERVERIPADDRESSRESOLVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <in_sock.h> |
|
24 #include <comms-infras/netcfgextndhcpmsg.h> // TDhcp4RawOptionDataPckg |
|
25 |
|
26 #include "dhcpconstants.h" |
|
27 |
|
28 /** |
|
29 * Resolve ip address of DHCP server from WLAN network. |
|
30 * |
|
31 * @lib dhcppositionprovider |
|
32 * @since S60 3.2 |
|
33 */ |
|
34 class CDhcpPsyDhcpServerIPResolver : public CActive |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Two-phased statical constructor which can leave |
|
40 * |
|
41 * @since S60 3.2 |
|
42 */ |
|
43 static CDhcpPsyDhcpServerIPResolver* NewL( RConnection& aConnection, TRequestStatus& aStatus ); |
|
44 |
|
45 /** |
|
46 * Default destructor. |
|
47 * |
|
48 * @since S60 3.2 |
|
49 */ |
|
50 virtual ~CDhcpPsyDhcpServerIPResolver(); |
|
51 |
|
52 public: |
|
53 |
|
54 /** |
|
55 * |
|
56 * Returns ip address of the dhcp server at WLAN network. |
|
57 * |
|
58 * @since S60 3.2 |
|
59 * @return const TDesC8& |
|
60 */ |
|
61 TInetAddr& DhcpServerInetAddress (); |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * Called by static periodic timer callback |
|
67 */ |
|
68 void CancelOutstandigRequest (); |
|
69 |
|
70 private: |
|
71 |
|
72 /** |
|
73 * C++ constructor |
|
74 * |
|
75 * @since S60 3.2 |
|
76 */ |
|
77 CDhcpPsyDhcpServerIPResolver( RConnection& aConnection, TRequestStatus& aStatus ); |
|
78 |
|
79 /** |
|
80 * Finalize construction and launches the adddress to the WLAN network |
|
81 */ |
|
82 void ConstructL(); |
|
83 |
|
84 protected: |
|
85 |
|
86 /** |
|
87 * Cancellation of an outstanding request. |
|
88 */ |
|
89 void DoCancel(); |
|
90 |
|
91 /** |
|
92 * Handles an active object's request completion event. |
|
93 */ |
|
94 void RunL(); |
|
95 |
|
96 private: // Methods |
|
97 |
|
98 /* |
|
99 * The callback function. |
|
100 * param aAny A pointer to this class. |
|
101 */ |
|
102 static TInt PeriodicTimerCallBack(TAny* aAny); |
|
103 |
|
104 /* |
|
105 * Complete client request. |
|
106 */ |
|
107 void CompleteRequest(TInt aStatusCode); |
|
108 |
|
109 private: // data |
|
110 |
|
111 // |
|
112 RConnection& iConnection; |
|
113 |
|
114 // To cancel outstanding request if needed. |
|
115 CPeriodic* iPeriodicTimer; |
|
116 |
|
117 // If true, we have received response from network |
|
118 TBool iDhcpResponseReceived; |
|
119 |
|
120 // Client TRequestStatus to be notify after request |
|
121 // has been completed. |
|
122 TRequestStatus& iClientStatus; |
|
123 |
|
124 // |
|
125 TConnectionAddrBuf iPckg; |
|
126 |
|
127 // Container for ip addres of the dhcp server. |
|
128 TInetAddr iInetAddress; |
|
129 |
|
130 }; |
|
131 |
|
132 #endif // DHCPSERVERIPADDRESSRESOLVER_H |
|
133 |
|
134 |