datacommsserver/networkingdialogapi/src/ND_DLGSV.H
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 1997-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 // Dial Up Networking Dialog Server Header - Server Side
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef __ND_DLGSV_H__
       
    24 #define __ND_DLGSV_H__
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <agentdialog.h>
       
    28 #include <cfmsgs.h>
       
    29 #include <cfshared.h>
       
    30 #include <cfutil.h>
       
    31 #include <comms-infras/commsdebugutility.h>
       
    32 #include <metadatabase.h>
       
    33 using namespace CommsDat;
       
    34 
       
    35 /**
       
    36 Reasons for panic
       
    37 */
       
    38 enum TAgentDialogPanic
       
    39 	{
       
    40 	EClientBadRequest,
       
    41 	EClientBadDescriptor,
       
    42 	EClientBadRecordId,
       
    43 	EClientPctNotOpen,
       
    44 	EClientPctAlreadyOpen,
       
    45 	EClientReadPctOutstandingOnClose,
       
    46 	EClientDestroyPctNotfcnOutstandingOnClose,
       
    47 	//
       
    48 	ESvrMainSchedulerError,
       
    49 	ESvrCreateServer,
       
    50 	ESvrStartServer,
       
    51 	ESvrDllFileNameNotFound,
       
    52 	ESvrPctNotOpen,
       
    53 	ESvrClosePctReturnedError,
       
    54 	ESvrNoReadPctOutstanding,
       
    55 	ESvrNoDestroyPctNotfcnOutstanding,
       
    56 	ESvrNotNullOnClose,
       
    57 	ESvrNoCommsServerProcess,
       
    58 	ESvrCannotOpenServerProcess,
       
    59 	ESvrCancelReturnedError,
       
    60 	ESvrGeneralCallBackNoSession,
       
    61 	ESvrGeneralCallBackError,
       
    62 	ESvrUnloaderNull
       
    63 	};
       
    64 
       
    65 /** 
       
    66 Dialog Server Major Version Number
       
    67 
       
    68 Note that a version must be specifyed when creating a session with the server 
       
    69 */
       
    70 const TUint KDialogServMajorVersionNumber=1;
       
    71 /** 
       
    72 Dialog Server Minor Version Number
       
    73 
       
    74 Note that a version must be specifyed when creating a session with the server 
       
    75 */
       
    76 const TUint KDialogServMinorVersionNumber=0;
       
    77 /** 
       
    78 Dialog Server Build Version Number 
       
    79 
       
    80 Note that a version must be specifyed when creating a session with the server 
       
    81 */
       
    82 const TUint KDialogServBuildVersionNumber=102;
       
    83 
       
    84 
       
    85 /**
       
    86 opcodes used in message passing between client and server
       
    87 */
       
    88 enum TDialogServRqst
       
    89 	{
       
    90 	EGetIAP,
       
    91 	EGetModemAndLocation,
       
    92 	EWarnNewIAP,
       
    93 	EGetAuthentication,
       
    94 	EGetLogin,
       
    95 	EGetReconnectReq,
       
    96 	EOpenPct,
       
    97 	EWritePct,
       
    98 	EReadPct,
       
    99 	EDestroyPctNotification,
       
   100 	EClosePct,
       
   101 	ECancelGetIAP,
       
   102 	ECancelGetModemAndLocation,
       
   103 	ECancelWarnIAP,
       
   104 	ECancelLogin,
       
   105 	ECancelAuthenticate,
       
   106 	ECancelReconnect,
       
   107 	ECancelReadPct,
       
   108 	ECancelDestroyPctNotification,
       
   109 	EWarnQoS,
       
   110 	ECancelWarnQoS,
       
   111 	EShutdownDialogServer,
       
   112 	EGetAccessPoint,
       
   113 	ECancelGetAccessPoint,
       
   114     EGetAccessPointAP
       
   115 	};
       
   116 
       
   117 class CNetDialDialogServerChannelHandler;
       
   118 NONSHARABLE_CLASS(CNetDialDialogServer) : public CServer2
       
   119 /**
       
   120 CNetDialDialogServer
       
   121 
       
   122 The server class; an active object.
       
   123 Contains an instance of RServer; a handle to the kernel
       
   124 server representation which is used to receive messages. 
       
   125 */
       
   126 	{
       
   127 public:
       
   128  	static CNetDialDialogServer* NewL(CommsFW::RCFChannel::TMsgQueues aRxQueues, CommsFW::RCFChannel::TMsgQueues aTxQueues);
       
   129  	virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
       
   130 	void Shutdown();
       
   131 	~CNetDialDialogServer();
       
   132 private:
       
   133    	CNetDialDialogServer(TInt aPriority);
       
   134 	void ConstructL(CommsFW::RCFChannel::TMsgQueues aRxQueues, CommsFW::RCFChannel::TMsgQueues aTxQueues);
       
   135 private:
       
   136 	CNetDialDialogServerChannelHandler* iChannel;
       
   137     __FLOG_DECLARATION_MEMBER;
       
   138    	};
       
   139 
       
   140 NONSHARABLE_CLASS(CNetDialDialogServerChannelHandler) : public CommsFW::CCFModuleChannelHandler
       
   141 /**
       
   142 @internalComponent
       
   143 */
       
   144 	{
       
   145 	public:
       
   146 		static CNetDialDialogServerChannelHandler* NewL(CommsFW::RCFChannel::TMsgQueues aRxQueues,
       
   147 			CommsFW::RCFChannel::TMsgQueues aTxQueues, CNetDialDialogServer& aServer);
       
   148 	private:
       
   149 		CNetDialDialogServerChannelHandler(CNetDialDialogServer& aServer);
       
   150 		virtual void CFMessageShutdown(const CommsFW::TCFShutdownMsg& aMessage);
       
   151 	private:
       
   152 		CNetDialDialogServer& iServer;
       
   153 	};
       
   154 
       
   155 //
       
   156 // CNetDialDialogSession
       
   157 class CIAPSelection;
       
   158 class CAccessPointSelection;
       
   159 class CModemAndLocationSelection;
       
   160 class CIAPWarning;
       
   161 class CLogin;
       
   162 class CAuthenticate;
       
   163 class CReconnect;
       
   164 class CPct;
       
   165 class CCommsDatabase;
       
   166 class CQoSWarning;
       
   167 
       
   168 NONSHARABLE_CLASS(CNetDialDialogSession) : public CSession2
       
   169 /**
       
   170 CNetDialDialogSession
       
   171 */
       
   172 	{
       
   173 public:
       
   174 	static CNetDialDialogSession* NewL(CNetDialDialogServer* aServer);
       
   175 	~CNetDialDialogSession();
       
   176 // CSession
       
   177 
       
   178 	virtual void ServiceL(const RMessage2& aMessage);
       
   179 	void DispatchMessageL(const RMessage2& aMessage);
       
   180 //
       
   181 	void GetModemAndLocationL();
       
   182 	void GetModemAndLocationCompleteL(TInt aStatus);
       
   183 	void GetIAPL();
       
   184 	void GetIAPCompleteL(TInt aStatus);
       
   185 	void WarnIAPL();
       
   186 	void WarnIAPCompleteL(TInt aStatus);
       
   187     void GetAccessPointL();
       
   188     void GetAccessPointAPL();
       
   189     void GetAccessPointCompleteL(TInt aStatus);
       
   190 	void GetAuthenticationL();
       
   191 	void CompleteAuthentication(TInt aStatus);
       
   192 	void GetLoginL();
       
   193 	void CompleteLoginL(TInt aStatus);
       
   194 	void ReconnectReqL();
       
   195 	void CompleteReconnectReq(TBool aBool);
       
   196 //
       
   197 
       
   198 	void CheckPctL(const RMessage2& aMessage);
       
   199 	void OpenPctL();
       
   200 	void WritePct();
       
   201 	void ReadPctL();
       
   202 	static TInt ReadPctCallBack(TAny* aContext);
       
   203 	void ReadPctComplete(TInt aStatus);
       
   204 	void DestroyPctNotificationL();
       
   205 	static TInt DestroyPctCallBack(TAny* aContext);
       
   206 	void DestroyPctComplete(TInt aStatus);
       
   207 	void ClosePct();
       
   208 	void WarnQoSL();
       
   209 	void WarnQoSCompleteL(TInt aStatus);
       
   210 	static TInt GeneralCallBackL(TAny* aSession);
       
   211 	void Cancel(TDialogServRqst aRequest);
       
   212 protected:
       
   213 	void PanicClient(TInt aPanic) const;
       
   214 private:
       
   215 	CNetDialDialogSession(CNetDialDialogServer* aServer);
       
   216 	void ConstructL();
       
   217 	void CheckBusyL();
       
   218 	void CancelEverything();
       
   219 private:
       
   220 	enum TSessionStates
       
   221 		{
       
   222 		EGetIAP,
       
   223 		EGetModemAndLocation,
       
   224 		EWarnIAP,
       
   225 		ELogin,
       
   226 		EAuthentication,
       
   227 		EReconnectReq,
       
   228 		EPct,
       
   229 		EWarnQoSState,
       
   230 		EGetAccessPointState
       
   231 		} iState;
       
   232 
       
   233 	enum TBufferSizes
       
   234 		{
       
   235 		EMaxWriteBufferSize=64,
       
   236 		EMaxReadBufferSize=100
       
   237 		};
       
   238 private:
       
   239 	TBool iBusy;
       
   240 	TBool iPctOpen;
       
   241 	TBool iReadPctOutstanding;
       
   242 	TBool iDestroyPctNotfcnOutstanding;
       
   243 
       
   244 	RMessage2 iMessage;
       
   245 	RMessage2 iDestroyNotificationMessage;
       
   246 	RMessage2 iReadPctMessage;
       
   247 
       
   248 	CNetDialDialogServer* iNetDialDialogSvr;
       
   249 	CMDBSession* iDb;
       
   250 
       
   251 	CIAPSelection* iIAPSelection;
       
   252 	CModemAndLocationSelection* iModemAndLocationSelection;
       
   253 	CIAPWarning* iIAPWarning;
       
   254 	CLogin* iLogin;
       
   255 	CAuthenticate* iAuthenticate;
       
   256 	CReconnect* iReconnect;
       
   257 	CPct* iPct;
       
   258 	CQoSWarning* iQoSWarning;
       
   259 
       
   260 	TPckgBuf<TUint32> iIAP;
       
   261 	TPckgBuf<TUint32> iModemId;
       
   262 	TPckgBuf<TUint32> iLocationId;
       
   263 	TPckgBuf<TIspConnectionNames> iConNames;
       
   264 	TPckgBuf<TConnectionPrefs> iPrefs;
       
   265 	TPckgBuf<TBool> iBool;
       
   266 	TBuf<KCommsDbSvrDefaultTextFieldLength> iNewIAPName;
       
   267 	TBuf<KCommsDbSvrMaxUserIdPassLength> iUsername;
       
   268 	TBuf<KCommsDbSvrMaxUserIdPassLength> iPassword;
       
   269 	HBufC* iBuffer;
       
   270 	TPtr iBufPtr;
       
   271 	TPtr iPctWriteBuffer;
       
   272 	TBuf<EMaxReadBufferSize> iPctReadBuffer;
       
   273 	TPckgBuf<TUint32> iAccessPoint;
       
   274 	CAccessPointSelection* iAccessPointSelection;
       
   275 	__FLOG_DECLARATION_MEMBER;
       
   276 	};
       
   277 
       
   278 /**
       
   279 Global functions
       
   280 */
       
   281 GLREF_C void PanicServer(TAgentDialogPanic aPanic);
       
   282 IMPORT_C TInt ThreadFunction(TAny* aStarted);
       
   283 
       
   284 #endif