IMPSengine/engsrv/inc/impscspsession.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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: Include CTransaction. CSP transaction state object
       
    15 *              include CImpsCSPSession. The core of the whole WV engine.
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CImpsCSPSession_H
       
    20 #define CImpsCSPSession_H
       
    21 
       
    22 #ifdef LOCAL_IMPS
       
    23 #ifndef _FAKE_RESPONSE
       
    24 #define _FAKE_RESPONSE
       
    25 #endif
       
    26 #endif
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32base.h>
       
    30 #include <s32file.h>
       
    31 #include "impsconst.h"
       
    32 #include "impscspsessionapi.h"
       
    33 #include "Impsservercommon.h"
       
    34 #include "impsservices.h"
       
    35 #include "impsmessageinterpreterapi.h"
       
    36 #include "impsdataaccessorapi.h"
       
    37 #include "impssrvutils.h"
       
    38 #include "impscommonenums.h"
       
    39 
       
    40 // DATA TYPES
       
    41 // Sub-state operations
       
    42 enum TImpsCSPState
       
    43     {
       
    44     EImpsCSPIdle,
       
    45     EImpsCSPShuttingDown,
       
    46     EImpsCSPDisconnecting,
       
    47     EImpsCSPLogging,
       
    48     EImpsCSPLogged,
       
    49     EImpsCSPNegotiation,
       
    50     EImpsCSPOnLine,
       
    51     EImpsCSPOnLineIdle,         // PDP-context closed
       
    52     EImpsCSPOnLineIdleStart,    // PDP-context closing
       
    53     EImpsCSPOnLineIdleEnd       // PDP-context re-opening
       
    54     };
       
    55 
       
    56 // Poll-state
       
    57 enum TImpsPollMode
       
    58     {
       
    59     EImpsPollNone,
       
    60     EImpsPollAdaptive,  // regular mode
       
    61     EImpsPollPending,   // pending send poll
       
    62     EImpsPollExtWait,   // Extra wait after on-line resume
       
    63     EImpsPollCIR        // cir mode
       
    64     };
       
    65 
       
    66 // PDP:
       
    67 enum TImpsPDPPend
       
    68     {
       
    69     EImpsPDPPendNone,
       
    70     EImpsPDPPendOpen,
       
    71     EImpsPDPPendClose
       
    72     };
       
    73 
       
    74 
       
    75 // SAP initated transaction response status
       
    76 enum TImpsSAPResStatus
       
    77     {
       
    78     EImpsSAPNone,       // no sap requests
       
    79     EImpsSAPMore,       // more sap requests
       
    80     EImpsSAPLast        // last sap request handled
       
    81     };
       
    82 // Logout transaction type
       
    83 enum TImpsLogoutTrans
       
    84     {
       
    85     EImpsLogoutNone,
       
    86     EImpsLogoutTerminal,   // terminal initiated
       
    87     EImpsLogoutSAP         // SAP inititiated
       
    88     };
       
    89 
       
    90 
       
    91 // FORWARD DECLARATIONS
       
    92 class CImpsFields;
       
    93 class CImpsIdleTimer;
       
    94 class CImpsSendReceive2;
       
    95 class CImpsSendQueued;
       
    96 class CImpsAliveManager;
       
    97 class CImpsCirManager;
       
    98 class CImpsVariant;
       
    99 class CImpsPDPIdleTimer;
       
   100 class CImpsPDPOpenTimer;
       
   101 class CImpsTidQueue;
       
   102 
       
   103 // CLASS DECLARATION
       
   104 
       
   105 /**
       
   106 *  CSP transaction state object
       
   107 */
       
   108 
       
   109 class CTransaction : public CBase    // a synch request from client
       
   110     {
       
   111     public:
       
   112         CTransaction(
       
   113             TBool aOrphan,
       
   114             const TDesC& aTID,
       
   115             const TDesC& aSessionId,
       
   116             TImpsMessageType aMessageType,
       
   117             CImpsFields* aFields );
       
   118         ~CTransaction();
       
   119         void Destroy();
       
   120 
       
   121         TBuf<KImpsMaxTID>   iTID;           //lint !e1925  // CSP TID
       
   122         TBuf<KImpsMaxSID>   iSessionId;     //lint !e1925  // CSP session id
       
   123         TImpsMessageType    iMessageType;   //lint !e1925  // CSP message type
       
   124         CImpsFields*        iFields;        //lint !e1925
       
   125         TBool               iOrphan;        //lint !e1925  // Orphan msg?
       
   126         TDblQueLink         iLink;          //lint !e1925
       
   127     };
       
   128 
       
   129 /**
       
   130 *  Client request buffer element
       
   131 */
       
   132 class CReq : public CBase    // a notify event
       
   133     {
       
   134     public:
       
   135         CReq( CImpsFields* aFields );
       
   136         ~CReq();
       
   137         void Destroy();
       
   138 
       
   139         CImpsFields*        iFields; //lint !e1925
       
   140         TDblQueLink         iLink;   //lint !e1925
       
   141         TTime               iExpiry; //lint !e1925
       
   142     };
       
   143 
       
   144 
       
   145 
       
   146 /**
       
   147 *  CImpsCSPSession.
       
   148 *  The core of the whole WV engine.
       
   149 */
       
   150 class CImpsCSPSession : public CBase, public MImpsCSPSession
       
   151     {
       
   152     public:  // Constructors and destructor
       
   153 
       
   154 
       
   155         /**
       
   156         * constructor
       
   157         * @param aServer server thread core
       
   158         * @param aSettings initial settings
       
   159         * @param aFs file system, for debug logs only
       
   160         * @paran aVariant run time variation accossor
       
   161         * @param aVer CSP protocol version to be supported
       
   162         */
       
   163         static CImpsCSPSession* NewL(
       
   164             CImpsServer& aServer,
       
   165             TImpsSrvSettings& aSettings,
       
   166             RFs& aFs,
       
   167             CImpsVariant& aVariant,
       
   168             TImpsCspVersion aVer );
       
   169 
       
   170         /**
       
   171         * Destructor.
       
   172         */
       
   173         virtual ~CImpsCSPSession();
       
   174 
       
   175     public: // New functions
       
   176 
       
   177         /**
       
   178         * Login WV server
       
   179         * @param aUser User-id  (max 50 characters)
       
   180         * @param aPsw password  (max 50 characters)
       
   181         * @param aClientId client id used to log in server.
       
   182         *        The client-id having prefix '+' or number is considered
       
   183         *        as MSISDN number (E.164),
       
   184         *        otherwise it is handled as URL (max 200 character).
       
   185         *        This MAY be used for CIR addressing if SAP is not able to
       
   186         *        detect MSISDN number in other way
       
   187         * @param aServer SAP URI, may include port number
       
   188         * @param aAP CommDb id for access point
       
   189         * @param aAnyAP ETrue if any other open access point is accepted
       
   190         * @param aKey1 future option
       
   191         * @param aKey2 future option
       
   192         * @param aLoginExpiry expiry time for this request
       
   193         * @param aReactive reactive presence auth negotiation
       
   194         * @return TID
       
   195         */
       
   196         TPtrC LoginL(
       
   197             const TDesC& aUser,
       
   198             const TDesC& aPassword,
       
   199             const TDesC& aClientId,
       
   200             const TDesC& aSAP,
       
   201             TUint32 aAP,
       
   202             const TDesC& aKey1,
       
   203             const TDesC& aKey2,
       
   204             TTime aLoginExpiry,
       
   205             TBool aReactive );
       
   206 
       
   207         /**
       
   208         * Logout SAP
       
   209         * @param aCancel ETrue if login cancel functionaliy wanted
       
   210         * @leave KImpsErrorNotLogged if not logged. Does nothing.
       
   211         * @leave KImpsErrorTerminalOffLine if terminal off line. Rejects CSP anyway.
       
   212         * @return TID
       
   213         */
       
   214         TPtrC LogoutL( TBool aCancel );
       
   215 
       
   216         /**
       
   217         * CIR message handler
       
   218         * @param aCookie entire session cookie message
       
   219         */
       
   220         void CirMessageL(
       
   221             const TDesC8& aCookie );
       
   222 
       
   223         /**
       
   224         * Send data from session current data to WV server.
       
   225         * Login must have been done.
       
   226         * @param aFields data
       
   227         * @param aExpiry expiry time in seconds, if 0, then time in gerarated.
       
   228         * @param aOwnerCh OUTPUT ETrue is ownership of aFields is changed
       
   229         * @return transaction-id
       
   230         */
       
   231         TPtrC SendDataL(
       
   232             CImpsFields* aFields,
       
   233             TInt aExpiry,
       
   234             TBool& aOwnerChange );
       
   235 
       
   236         /**
       
   237         * Callback for response from transport watcher
       
   238         * @param aDataPtr data received, It must be set to NULL after data is consumed.
       
   239         */
       
   240         void TransportResponseL( HBufC8** aDataPtr );
       
   241 
       
   242         /**
       
   243         * Callback for error from transport watcher
       
   244         * @param aTID transaction-id, 0 means undefined
       
   245         * @param aError error code
       
   246         */
       
   247         void TransportErrorL(
       
   248             const TDesC& aTID,
       
   249             TInt aError
       
   250         );
       
   251 
       
   252         /**
       
   253         * Get next message to be sent. Copies the data to iOutputBuffer.
       
   254         * Validates first the expiry time and discards a message is necessary.
       
   255         */
       
   256         void GetNextMessageL( );
       
   257 
       
   258         /**
       
   259         * Send Poll request
       
   260         */
       
   261         void SendPollL();
       
   262 
       
   263         /**
       
   264         * Send KeepAlive request
       
   265         * @return TID of KeepAlive request
       
   266         */
       
   267         TPtrC DoSendAliveL( );
       
   268 
       
   269         /**
       
   270         * Send KeepAlive request
       
   271         * @return TID of KeepAlive request
       
   272         */
       
   273         TPtrC SendAliveL( );
       
   274 
       
   275         /**
       
   276         * Send KeepAlive request when GPRS resumes
       
   277         */
       
   278         void SendAliveInResume();
       
   279 
       
   280         /**
       
   281         * Is the server logging in curretly
       
   282         * @return ETrue if log in active
       
   283         */
       
   284         TBool IsLogging();
       
   285 
       
   286         /**
       
   287         * Is the server logged in
       
   288         * @return ETrue if logged in
       
   289         */
       
   290         TBool IsLogged();
       
   291 
       
   292         /**
       
   293         * Is the CSP session capabilities negotiated
       
   294         * @return ETrue if negotiated
       
   295         */
       
   296         TBool IsNegotiated();
       
   297 
       
   298         /**
       
   299         * Current User-id accessor
       
   300         * @return UserId
       
   301         */
       
   302         TPtrC UserId();
       
   303 
       
   304         /**
       
   305         * Current SAP accessor
       
   306         * @return SAP
       
   307         */
       
   308         TPtrC SAP();
       
   309 
       
   310         /**
       
   311         * Current CSP Session-id accessor
       
   312         * @return Session-id
       
   313         */
       
   314         TPtrC SID();
       
   315 
       
   316         /**
       
   317         * Current password accesor
       
   318         * @return password
       
   319         */
       
   320         TPtrC Password();
       
   321 
       
   322         /**
       
   323         * Transport status change indicator
       
   324         * @param aConnectionState  new status, on_line, off_line or no_iap
       
   325         */
       
   326         void TransportStatus( EImpsInternalStatus aConnectionState );
       
   327 
       
   328         /**
       
   329         * active services accessor
       
   330         * @return current WV services
       
   331         */
       
   332         TImpsServices* Services();
       
   333 
       
   334         /*
       
   335         * Is engine shutting down
       
   336         * @return ETrue if shutting down
       
   337         */
       
   338         TBool IsShuttingDown();
       
   339 
       
   340         /**
       
   341         * Is there pendig login operation
       
   342         * @return ETrue if yes
       
   343         */
       
   344         TBool IsPendingLogin();
       
   345 
       
   346         /**
       
   347         * Cancel a transaction.
       
   348         * Removes request from server's transaction queue and
       
   349         * asks transport to cancel the request too.
       
   350         * @param aTID transaction id to identify the request.
       
   351         */
       
   352         void CancelTrans( const TDesC& aTID );
       
   353 
       
   354         /**
       
   355         * Cancel active data channel requests.
       
   356         */
       
   357         void CancelData();
       
   358 
       
   359         /**
       
   360         * Close All.
       
   361         */
       
   362         void CloseAll();
       
   363 
       
   364         /**
       
   365         * Close PDP conntext only.
       
   366         */
       
   367         virtual void ClosePDP();
       
   368 
       
   369         /**
       
   370         * Open PDP context only.
       
   371         * @return error code
       
   372         */
       
   373         virtual TInt OpenPDP();
       
   374 
       
   375         /**
       
   376         * Removes request from server's transaction queue
       
   377         * @param aTID transaction id to identify the request.
       
   378         */
       
   379         void DiscardTid( const TDesC& aTid );
       
   380 
       
   381         /**
       
   382         * Give next non expired request waiting.
       
   383         * Deletes expired requests and informs corresponding session
       
   384         * @return request or NULL if not any
       
   385         */
       
   386         CReq* GiveNextRequestL();
       
   387 
       
   388         /**
       
   389         * Send so many queued client requests as possible to transport.
       
   390         *
       
   391         */
       
   392         void DoSendAllQueuedL();
       
   393 
       
   394         /**
       
   395         * Do the internal logout routines immediately
       
   396         */
       
   397         void DoLogout( );
       
   398 
       
   399         /**
       
   400         * Ip-Cir-channel opened callback
       
   401         */
       
   402         void CirChOpened();
       
   403 
       
   404         /**
       
   405         * Ip-Cir-channel error callback
       
   406         */
       
   407         void CirChError();
       
   408 
       
   409         /**
       
   410         * Receive terminal off_line/on_line indication
       
   411         * @param aParam True if connections allowed, else False.
       
   412         */
       
   413         void SetConnAllowed( TBool aParam );
       
   414 
       
   415         /**
       
   416         * Check exiparation of current requests and asks server to
       
   417         * remove requests from client sessions if necessary
       
   418         * @param sType service types
       
   419         * @param aExpiry expiration time for requests
       
   420         */
       
   421         void CheckExpiry(
       
   422             TImpsEventType aType,
       
   423             const TTime aExpiry  );
       
   424 
       
   425         /**
       
   426         * Destructor
       
   427         */
       
   428         void Destroy();
       
   429 
       
   430         /**
       
   431         * Is this logout transaction response
       
   432         * Harmonize WV 1.1 and WV 1.2 logout responses.
       
   433         * @param aFields received message, must not be NULL.
       
   434         * @return type of the logout transaction
       
   435         */
       
   436         TImpsLogoutTrans IsLogoutResp( CImpsFields* aFields );
       
   437 
       
   438         /**
       
   439         * Maximum parser size
       
   440         */
       
   441         TInt MaxParserSize();
       
   442 
       
   443         /**
       
   444         * Maximum IM message size
       
   445         */
       
   446         TInt MaxMessageSize();
       
   447 
       
   448 
       
   449     protected:  // Functions from base classes
       
   450 
       
   451 
       
   452         /**
       
   453         * C++ default constructor.
       
   454         */
       
   455         CImpsCSPSession( CImpsServer& aServer,
       
   456                          TImpsSrvSettings& aSettings,
       
   457                          RFs& aFs,
       
   458                          CImpsVariant& aVariant,
       
   459                          TImpsCspVersion aVer );
       
   460 
       
   461     private:
       
   462 
       
   463         /**
       
   464         * Memory allocations.
       
   465         */
       
   466         void ConstructL();
       
   467 
       
   468         // By default, prohibit copy constructor
       
   469         CImpsCSPSession( const CImpsCSPSession& );
       
   470         // Prohibit assigment operator
       
   471         CImpsCSPSession& operator= ( const CImpsCSPSession& );
       
   472 
       
   473         /**
       
   474         * Insert client request into request queue.
       
   475         * This does not copy of the fields parameter anymore!
       
   476         * This is a buffer used while transport is busy
       
   477         * @param aFields request data from client
       
   478         * @param aExpiry expiry time in seconds
       
   479         * @param aLast ETrue if added to the end of request list,
       
   480         *        otherwise as the first one.
       
   481         */
       
   482         void QueueClientRequestL(
       
   483             CImpsFields* aFields,
       
   484             TInt aExpiry,
       
   485             TBool aLast = ETrue );
       
   486 
       
   487         /**
       
   488         * Route message to clients
       
   489         */
       
   490         void RouteMessageL();
       
   491 
       
   492         /**
       
   493         * Queue pending CSP transaction, SAP originated one.
       
   494         * @param aOrphan ETrue if the message is an orphan, i.e.
       
   495         * no subsession has accepted that because of illegal client-id.
       
   496         * Does not copy fields anymore!
       
   497         */
       
   498         void QueueTidL( TBool aOrphan );
       
   499 
       
   500         /**
       
   501         * Validate SAP initiated TID in iRcv.
       
   502         * Validation means that the TID is not already handled.
       
   503         * Saves also SAP into tid-client-history if not already there if
       
   504         * aClientHistory==ETrue.
       
   505         * @param aClientHistory ETrue if client-msg-history is to be validated,
       
   506         *        otherwise SAP-response-history is to be validated.
       
   507         * @return ETrue if TID not found in appropriate history
       
   508         */
       
   509         TBool ValidateTid( TBool aClientHistory );
       
   510 
       
   511         /**
       
   512         * Send so many queued requests as possible.
       
   513         * This starts an own active object to carry out this issue.
       
   514         */
       
   515         void SendAllQueued();
       
   516 
       
   517         /**
       
   518         * Create response for SAP Intiated transaction
       
   519         * @return SAP request status
       
   520         */
       
   521         TImpsSAPResStatus CreateSapResponse();
       
   522 
       
   523         /**
       
   524         * Generate TID
       
   525         */
       
   526         TPtrC GenerateTid();
       
   527 
       
   528         /**
       
   529         * Generate CSP Session Cookie
       
   530         */
       
   531         TPtrC GenerateCookie();
       
   532 
       
   533         /**
       
   534         * Delete pending transactions
       
   535         */
       
   536         void DeleteTransactions();
       
   537 
       
   538         /**
       
   539         * Delete client requests
       
   540         */
       
   541         void DeleteRequests();
       
   542 
       
   543         /**
       
   544         * Delete specific client requests
       
   545         * @param aTID transaction id
       
   546         */
       
   547         void DeleteRequest( const TDesC& aTID );
       
   548 
       
   549         /**
       
   550         * Check if there are any client request queued
       
   551         */
       
   552         TBool RequestExist();
       
   553 
       
   554         /**
       
   555         * Check if there are any SAP initiated request queued
       
   556         */
       
   557         TBool SapReqExist();
       
   558 
       
   559         /**
       
   560         * Handles negotiation data to internal data structures
       
   561         * Both Client capabilities and WV Services and Login response
       
   562         * @param aFields received message
       
   563         */
       
   564         void SessionStartupL( CImpsFields* aFields );
       
   565 
       
   566         /**
       
   567         * Send next buffered message to SAP
       
   568         * @param aFields message to be sent
       
   569         */
       
   570         void DoSendNextBufferedL( CImpsFields* aFields );
       
   571 
       
   572         /**
       
   573         * Encode and send a single regular message
       
   574         * @param aAc data accessor for a message, cannot be null
       
   575         * @param aTID CSP TransactionID
       
   576         * @param aMsgType message primitive
       
   577         * @param aExpiryTime expiry time
       
   578         */
       
   579         void DoSendSingleL(
       
   580             MImpsDataAccessor* aAc,
       
   581             const TDesC& aTID,
       
   582             TImpsMessageType aMsgType,
       
   583             TInt aExpiryTime = 0 );
       
   584 
       
   585         /**
       
   586         * Send LogoutRequest primitive
       
   587         * @param aTID CSP TransactionID to be used
       
   588         */
       
   589         void DoSendLogoutL( const TDesC& aTID );
       
   590 
       
   591         /**
       
   592         * Make response primitive for SAP initiated request
       
   593         * @param aTrans request of transaction
       
   594         */
       
   595         void DoMakeSapResponseL( CTransaction* aTrans );
       
   596 
       
   597         /**
       
   598         * Handle ClientCapabilityResponse
       
   599         * @param aFields received message
       
   600         */
       
   601         void HandleClientCapabilityResL ( CImpsFields* aFields );
       
   602 
       
   603         /**
       
   604         * Handle LoginResponse
       
   605         * @param aFields received message
       
   606         */
       
   607         void HandleLoginResponseL ( CImpsFields* aFields );
       
   608 
       
   609         /**
       
   610         * Send ServiceNegotiationRequest
       
   611         */
       
   612         void DoSendServiceNegotiationReqL();
       
   613 
       
   614         /**
       
   615         * Send CreateAttributeListRequest
       
   616         */
       
   617         void DoSendCreateAttributeListReqL();
       
   618 
       
   619         /**
       
   620         * Send ClientCapabilityRequest
       
   621         */
       
   622         void DoSendClientCapabilityReqL ();
       
   623 
       
   624         /**
       
   625         * Increase poll time
       
   626         */
       
   627         void IncreasePollTime();
       
   628 
       
   629         /**
       
   630         * Reset poll time
       
   631         */
       
   632         void ResetPollTime();
       
   633 
       
   634         /**
       
   635         * Transport status change indicator
       
   636         * @param aConnectionState  new status, on_line, off_line or no_iap
       
   637         */
       
   638         void DoTransportStatusL( EImpsInternalStatus aConnectionState );
       
   639 
       
   640         /**
       
   641         * Do the internal logout routines immediately
       
   642         * @param aOpId operation-id
       
   643         */
       
   644         void DoLogoutNow( TInt aOpId );
       
   645 
       
   646         /**
       
   647         * Start IP based CIR channels
       
   648         */
       
   649         void DoStartIpCIRL();
       
   650 
       
   651         /**
       
   652         * Calculates CIR expiration time
       
   653         * @return expiry time
       
   654         */
       
   655         TTime CIRExpiryTime( );
       
   656 
       
   657         /**
       
   658         * Internal state change
       
   659         * @param aNew new status
       
   660         */
       
   661         void NewState( TImpsCSPState aNew );
       
   662 
       
   663         /**
       
   664         * Decrese iTr
       
   665         */
       
   666         void TrMinus();
       
   667 
       
   668         /**
       
   669         * Reset session settings
       
   670         */
       
   671         void ResetSession();
       
   672 
       
   673         /**
       
   674         * Close All.
       
   675         * @param aSynch ETrue if connection is closed synchronously immediately
       
   676         */
       
   677         void CloseAll( TBool aSynch );
       
   678 
       
   679         /**
       
   680         * Start login cancel
       
   681         */
       
   682         void StartLoginCancel();
       
   683 
       
   684         /**
       
   685         * Handle pending logout situation
       
   686         */
       
   687         void DoPendingLogout();
       
   688 
       
   689         /**
       
   690         * Current User-id accessor
       
   691         * @return UserId
       
   692         */
       
   693         inline TPtrC DoUserId() const;
       
   694 
       
   695         /**
       
   696         * Current SAP accessor
       
   697         * @return SAP address
       
   698         */
       
   699         inline TPtrC DoSAP() const;
       
   700 
       
   701         /**
       
   702         * Is the server logged in
       
   703         * @return ETrue if logged in
       
   704         */
       
   705         inline TBool DoIsLogged() const;
       
   706 
       
   707         /**
       
   708         * Is the server logged in
       
   709         * @return ETrue if logged in
       
   710         */
       
   711         inline TBool DoIsLogging() const;
       
   712 
       
   713         /**
       
   714         * Is the CSP session capabilities negotiated
       
   715         * @return ETrue if negotiated
       
   716         */
       
   717         inline TBool DoIsNegotiated() const;
       
   718 
       
   719         /*
       
   720         * Is engine shutting down
       
   721         * @return ETrue if shutting down
       
   722         */
       
   723         inline TBool DoIsShuttingDown() const;
       
   724 
       
   725         /**
       
   726         * Logout transaction id accessor
       
   727         * @return Logout TID
       
   728         */
       
   729         inline TPtrC LogoutTID() const;
       
   730 
       
   731         /**
       
   732         * SAP address accessor
       
   733         * @return SAP address
       
   734         */
       
   735         inline TPtrC SAP() const;
       
   736 
       
   737         /**
       
   738         * Login TID accessor
       
   739         * @return TID
       
   740         */
       
   741         inline TPtrC LogTid() const;
       
   742 
       
   743         /**
       
   744         * Login password accessor
       
   745         * @return password
       
   746         */
       
   747         inline TPtrC LogPwd() const;
       
   748 
       
   749         /**
       
   750         * Is PDP idle closed in ON_LINE?
       
   751         * @return ETrue if PDP is closed in CSP ON_LINE
       
   752         */
       
   753         inline TBool IsPDPIdleOnLine() const;
       
   754 
       
   755         /**
       
   756         * Is PDP closed in OFF_LINE?
       
   757         * @return ETrue if PDP is closed in CSP is OFF_LINE
       
   758         */
       
   759         inline TBool IsPDPIdleOffLine() const;
       
   760 
       
   761         /**
       
   762         * Is PDP closed?
       
   763         * @return ETrue if PDP is closed
       
   764         */
       
   765         inline TBool IsPDPIdle() const;
       
   766 
       
   767     public:     // Data
       
   768 
       
   769     protected:  // Data
       
   770 
       
   771     private:    // Data
       
   772         CImpsServer&        iServer;
       
   773         TImpsCspVersion     iCSPVersion;
       
   774 
       
   775         MImpsDecoder*       iDecoder;       // CSP message decoder
       
   776         MImpsEncoder*       iEncoder;       // CSP message encoder
       
   777 
       
   778         TImpsSrvSettings    iSettings;
       
   779         RFs&                iFs;
       
   780         CImpsVariant&       iVariant;
       
   781         // Pending transaction queue
       
   782         TDblQue<CTransaction>    iTransactionList;
       
   783         // Buffer for client requests
       
   784         TDblQue<CReq>       iRequestList;
       
   785 
       
   786         TImpsCSPState       iCSPState;
       
   787         TBool               iPendingLogout;
       
   788 
       
   789         TBuf<KImpsMaxSID>   iCSPSessionId;  // current CSP session-id
       
   790         TBuf8<KImpsMaxSID>  iCSPSessionId8;  // current CSP session-id
       
   791         TInt                iLastSent;      // message type
       
   792         TInt                iLastReceived;  // message type
       
   793 
       
   794         CBufFlat*           iTransportOut;  // transport ouput buffer
       
   795 
       
   796         CImpsSendReceive2*  iReceiver2;      // transport callback
       
   797 
       
   798         CImpsFields*        iSnd;        // internal data structure
       
   799         CImpsFields*        iRcv;        // internal data structure
       
   800         CImpsFields*        iAllMessages;// internal data structure
       
   801         CImpsIdleTimer*     iIdleTimer;  // Poll timer
       
   802         CImpsPDPIdleTimer*  iPDPIdleTimer; // PDP-context Idle Timer
       
   803         CImpsPDPOpenTimer*  iPDPOpenTimer; // PDP open re-try timer
       
   804         CImpsAliveManager*  iAliveMgr;   // Keep-alive timer
       
   805         TInt                iPollTime;
       
   806         TInt                iAliveTime;
       
   807 
       
   808         CImpsSendQueued*    iSendQ;
       
   809         TBool               iPollWasRequested;   // Poll requested by SAP
       
   810         HBufC*              iUserId;        // User-ID, may be WV address encoded
       
   811         TBuf<KImpsMaxTID>   iTempTid;       // to generate own tid
       
   812         TBuf<KImpsMaxTID>   iTempTid2;      // login and negotiation phase tid
       
   813         // used also for pending KeepAlive-req
       
   814         TBuf<KImpsMaxCookie>  iCookie;      // CSP session cookie for CIR
       
   815         TBuf8<KImpsMaxCookie> iCookie8;     // CSP session cookie for CIR
       
   816 
       
   817         TImpsServices       iServices;      // Current services
       
   818 
       
   819         EImpsInternalStatus iIntStatus;     // Internal status
       
   820 
       
   821         TBuf<KImpsMaxClientId>   iLogCID;   // Login client-id
       
   822 
       
   823         TInt                iMultiTrans;    // CSP MultiTrans
       
   824         TInt                iTr;            // nbr of current transactions
       
   825 
       
   826         TImpsMessageType    iMsg;           // Message type in negotiation phase
       
   827 
       
   828         TTime               iNegoExpiry;    // Expiry time for negotiation command
       
   829 
       
   830         TInt                iLoginPhase;    // Login
       
   831         HBufC*              iLogPwd;        // Login password
       
   832         HBufC*              iLogTid;        // Login TID
       
   833         HBufC*              iKey1;          // private client key
       
   834         HBufC*              iKey2;          // private client key
       
   835         HBufC*              iTCPAddr;       // CIR TCP address
       
   836         TUint               iTCPPort;       // CIR TCP port
       
   837         TInt                iUDPPort;       // CIR UDP port
       
   838         CImpsCirManager*    iCirManager;
       
   839         TBuf<KImpsMaxTID>   iLogoutTID;
       
   840         TBool               iConAllowed;
       
   841         TBool               iPendingAlive;
       
   842 
       
   843         HBufC*              iSAP;           // SAP TCP/IP address (data channel)
       
   844         TUint32             iIAP;           // IAP for data channel
       
   845 
       
   846         TImpsPollMode       iPollState;     // Send poll after network problem
       
   847         // 0=no problem, 1=try once, 2=try in resume
       
   848         TInt                iPollInResume;  // Send poll after GPRS resume
       
   849         TImpsPDPPend        iPendingPDP;    // Pending PDP open
       
   850         TBool               iPendPDPLogout; // PDP has tp open befotre logout msg
       
   851         CImpsTidQueue*      iTidSapHistory; // SAP initiated TIDs for validity check
       
   852         CImpsTidQueue*      iTidCliHistory; // SAP initiated TIDs for validity check
       
   853         TBool               iTcpCIRError;   // If WV 1.2 CIR element is T in received msg
       
   854         TBool               iReactive;      // reactive presence auth negotiation
       
   855         TBool               iCancelLogin;   // cancel login in progress
       
   856 
       
   857 #ifdef _FAKE_RESPONSE
       
   858         TBuf<KImpsMaxTID>   iTestMsgTid;    // local mode test auxiliary
       
   859 #endif
       
   860 
       
   861 
       
   862     private:    // Friend classes
       
   863         // internal module test suite class
       
   864         friend class TImpsSrvTestUtils;
       
   865 
       
   866     };
       
   867 
       
   868 #include "ImpsCSPSession.inl"
       
   869 
       
   870 #endif      // ?INCLUDE_H   
       
   871 
       
   872 // End of File