|
1 // Copyright (c) 2003-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 // The DHCP Control header file |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file DHCPControl.h |
|
20 */ |
|
21 |
|
22 #ifndef DHCPCONTROL_H |
|
23 #define DHCPCONTROL_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <es_enum.h> |
|
27 #include <comms-infras/statemachine.h> |
|
28 #include "ExpireTimer.h" |
|
29 #ifdef SYMBIAN_NETWORKING_PLATSEC |
|
30 #include <comms-infras/rconfigdaemonmess.h> |
|
31 #else |
|
32 #include <comms-infras/cs_daemonmess.h> |
|
33 #endif |
|
34 |
|
35 class CDHCPStateMachine; |
|
36 class CDHCPDb; |
|
37 class CDHCPConfigListener; |
|
38 #ifdef SYMBIAN_NETWORKING_ADDRESS_PROVISION |
|
39 class CDhcpHwAddrManager; |
|
40 #endif //SYMBIAN_NETWORKING_ADDRESS_PROVISION |
|
41 class CDHCPControl : public CBase, public MStateMachineNotify, public MExpireTimer |
|
42 /** |
|
43 * Base class for DHCP control |
|
44 * |
|
45 * |
|
46 * @internalTechnology |
|
47 * |
|
48 */ |
|
49 { |
|
50 public: |
|
51 virtual ~CDHCPControl(); |
|
52 |
|
53 virtual void ConfigureL(const TConnectionInfo& aInfo, const RMessage2* aMessage); |
|
54 virtual void Cancel(); |
|
55 void HandleClientRequestL(const RMessage2& aMessage); |
|
56 |
|
57 virtual TBool OnCompletion(CStateMachine* aStateMachine); |
|
58 |
|
59 virtual void TimerExpired(); //timer callback |
|
60 |
|
61 virtual void LinkLocalCreated() {} |
|
62 |
|
63 public: |
|
64 enum TConfigType |
|
65 { |
|
66 EConfigToBeDecided, |
|
67 EConfigIPAddress, |
|
68 EConfigNoIPAddress |
|
69 }; |
|
70 |
|
71 protected: |
|
72 CDHCPControl(RSocketServ& aEsock,TConfigType aConfigType) : |
|
73 iEsock(aEsock), |
|
74 iState(EStart), |
|
75 iConfigType( aConfigType ) |
|
76 { |
|
77 } |
|
78 |
|
79 virtual TInt HandleClientRequestL(TUint aName, TDes8* aDes); |
|
80 virtual TInt HandleClientRequestL(TUint aName); |
|
81 virtual TInt HandleClientRequestL(TUint aName, TInt aValue); |
|
82 void SaveAndHandleClientRequestL(const RMessage2& aMessage,TUint aOptionName,TInt aValue = 0); |
|
83 |
|
84 void HandleInterfaceDebugL(const RMessage2& aMessage); |
|
85 |
|
86 virtual void TaskCompleteL(TInt aError); |
|
87 virtual void HandleGetRawOptionDataL(TDes8* aDes) = 0; |
|
88 virtual void HandleGetSipServerAddrL(TDes8* aDes) = 0; |
|
89 virtual void HandleGetSipServerDomainL(TDes8* aDes) = 0; |
|
90 #ifdef SYMBIAN_TCPIPDHCP_UPDATE |
|
91 virtual void HandleGetDomainSearchListL(TDes8* /* aDes */){}; |
|
92 virtual void HandleGetDNSServerListL(TDes8* /*aDes */){}; |
|
93 #endif //SYMBIAN_TCPIPDHCP_UPDATE |
|
94 #ifdef SYMBIAN_NETWORKING_DHCP_MSG_HEADERS |
|
95 virtual void HandleGetMultipleParamsL(TDes8& aDesc)=0; |
|
96 virtual void HandleGetTftpServerAddrL(TDes8& aDes)=0 ; |
|
97 virtual void HandleGetTftpServerNameL(TDes8& aDes)=0 ; |
|
98 virtual TInt InformCompleteRequestHandlerL()=0; |
|
99 virtual void GetDhcpHdrSiaddrL(TDes8& aNxtAddress)=0; |
|
100 virtual void GetDhcpHdrSnameL(TDes8& aHdrSvrName)=0; |
|
101 #endif // SYMBIAN_NETWORKING_DHCP_MSG_HEADERS |
|
102 |
|
103 void FindInterfaceNameL(const TConnectionInfo& aInfo, TInt aFamily); |
|
104 TBool InformNegotiationIsRequiredForConnectionStartCompletion(void) const; |
|
105 virtual TBool ShouldInformAfterFailedInit(); |
|
106 |
|
107 TBool CompleteClientMessage(TInt aError, TInt aFunctionToCancel = -1); |
|
108 TBool CompleteClientIoctlMessage(TInt aError) {return CompleteClientMessage(aError, EConfigDaemonIoctl);} |
|
109 TBool CompleteClientConfigureMessage(TInt aError) {return CompleteClientMessage(aError, EConfigDaemonConfigure);} |
|
110 #ifdef SYMBIAN_NETWORKING_DHCPSERVER |
|
111 TBool CompleteServerConfigureMessage(TInt aError) {return CompleteClientMessage(aError, EConfigDaemonConfigure);} |
|
112 TBool CompleteServerIoctlMessage(TInt aError) {return CompleteClientMessage(aError, EConfigDaemonIoctl);} |
|
113 virtual void HandleSetRawOptionCodeL(TDes8* aDes); |
|
114 void ServiceAnyOutstandingServerIoctlL(); |
|
115 #endif // SYMBIAN_NETWORKING_DHCPSERVER |
|
116 void ServiceAnyOutstandingIoctlL(); |
|
117 void UpdateDns(TDesC8* aHostName, TDesC8* aDomainName); |
|
118 void ConfigureL( TBool aStaticAddress ); |
|
119 virtual void BindingFinishedL(); |
|
120 void SaveMessageBufferForLaterReference(); |
|
121 |
|
122 |
|
123 protected: |
|
124 CDHCPStateMachine* iDhcpStateMachine; // owns (created by subclass) |
|
125 const RMessage2* iMessage; |
|
126 RSocketServ& iEsock; |
|
127 RConnection iConnection; |
|
128 TName iInterfaceName; |
|
129 |
|
130 CDHCPDb* iDhcpDb; //owns (created by subclass) |
|
131 CDHCPConfigListener* iDhcpConfigListener; // owns |
|
132 #ifdef SYMBIAN_NETWORKING_ADDRESS_PROVISION |
|
133 CDhcpHwAddrManager* iDhcpHwAddrManager; //owns (created by subclass) |
|
134 #endif //SYMBIAN_NETWORKING_ADDRESS_PROVISION |
|
135 |
|
136 protected: |
|
137 CExpireTimer* iTimer; // owns |
|
138 enum TState |
|
139 { |
|
140 EStart, |
|
141 EInitInProgress, |
|
142 EInitialised, |
|
143 ERenewInProgress, |
|
144 ERebindInProgress, |
|
145 EDeclineInProgress, |
|
146 EReleaseInProgress, |
|
147 EInformInProgress, |
|
148 EDeferredInform, // awaiting an ioctl call to trigger an inform negotiation |
|
149 EReconfigureInProgress, |
|
150 EDeclineInitialisedInProgress, |
|
151 EEnd |
|
152 }; |
|
153 TState iState; |
|
154 TBool iInitStartedByRenew; |
|
155 TBool iDhcpDaemonDeregister; // to decide RemoveConfigureAddress not to be called while completion of DHCPREL msg |
|
156 TConfigType iConfigType; |
|
157 RBuf8 iValidMsg; //to save msg buffer in case user wants to retrieve any info |
|
158 #ifdef SYMBIAN_NETWORKING_DHCPSERVER |
|
159 HBufC8* iDNSRawOption; |
|
160 public: |
|
161 TBool iDHCPServerImpl; |
|
162 #endif // SYMBIAN_NETWORKING_DHCPSERVER |
|
163 }; |
|
164 |
|
165 #endif |
|
166 |