IMPSengine/engsrv/inc/impssrvutils.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002 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: Util classes for IMPS service
       
    15 * 
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIMPSSRVUTILS_H
       
    20 #define CIMPSSRVUTILS_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <s32file.h>
       
    25 
       
    26 #include "impsservercommon.h"
       
    27 #include "impsservices.h"
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CImpsDataAccessor;
       
    32 class CImpsServer;
       
    33 class MImpsKey;
       
    34 class MImpsDataAccessor;
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 class TImpsSrvSettings
       
    40     {
       
    41     public:  // Constructors and destructor
       
    42 
       
    43         TImpsSrvSettings( );
       
    44 
       
    45     public:  // New methods
       
    46 
       
    47         /**
       
    48         * Read static settings
       
    49         */
       
    50         void ReadStaticSettings();
       
    51 
       
    52 #ifdef _DEBUG
       
    53         /**
       
    54         * Read ini file, DEBUG mode only
       
    55         */
       
    56         void ReadIniFileL( RFs&  aFs );
       
    57 #endif
       
    58 
       
    59         /**
       
    60         * Set Cir channel info
       
    61         * @param aAccess data accessor pointing to parent of CIR method list
       
    62         * @param aKey data key instance
       
    63         */
       
    64         void SetCirBindingsL( MImpsDataAccessor* aAcess, MImpsKey* aKey );
       
    65 
       
    66         /**
       
    67         * Accessors for CIR channel data
       
    68         */
       
    69         inline TInt UDPWAPCIR() const;
       
    70         inline TInt SMSWAPCIR() const;
       
    71         inline TInt TCPSCIR() const;
       
    72         inline TInt UDPSCIR() const;
       
    73 
       
    74         /**
       
    75         * Accessor for PDP expiry time
       
    76         * @return expiry time in seconds
       
    77         */
       
    78         inline TInt PDPExpiryTime() const;
       
    79 
       
    80         /**
       
    81         * Accessor for CIR mode poll time
       
    82         * @return poll time in seconds
       
    83         */
       
    84         inline TInt CIRModePollTime() const;
       
    85 
       
    86         /**
       
    87         * Accessor for Maximum Message Size
       
    88         * @return Accepted content Length
       
    89         */
       
    90         inline TInt MaximumMessageSize() const;
       
    91 
       
    92         /**
       
    93         * Calculates Maximum Parser size based on maximum message size
       
    94         */
       
    95         inline TInt MaximumParserSize() const;
       
    96 
       
    97     private:    // Data
       
    98         TInt           iPollTime;
       
    99         TInt           iAliveTime;
       
   100         TInt           iMaxPollTime;
       
   101         TInt           iXmlLog;        // Is CSP primitives logged
       
   102         // 1 Messages are logged
       
   103         // 2 Polling is also logged
       
   104 
       
   105         TInt           iUDPWAPCIR;     // Is CIR available, 1=ordered,2=accepted
       
   106         TInt           iSMSWAPCIR;     // Is CIR available
       
   107         TInt           iTCPSCIR;       // Is CIR available
       
   108         TInt           iUDPSCIR;       // Is CIR available
       
   109 
       
   110         TInt           iAccessExp;     // Access expiry time in seconds
       
   111         TInt           iImExp;         // IM expiry time
       
   112         TInt           iPrExp;         // Presence expiry time
       
   113         TInt           iGrExp;         // Group expiry time
       
   114         TInt           iFuExp;         // Fundamental expiry time
       
   115 
       
   116         TInt           iMultiTrans;    // CSP MultiTrans
       
   117         TBool          iFourWayLogin;  // Use 4-Way login
       
   118 
       
   119         TInt           iPDPExpiry;     // PDP expiry in seconds
       
   120         TInt           iCIRModePollTime; // Poll time in CIR mode
       
   121 
       
   122         TInt           iMaxMessageSize; // Max IM message size to be negotiated
       
   123 
       
   124     private:
       
   125         friend class CImpsServer;
       
   126         friend class CImpsCSPSession;
       
   127 
       
   128     };
       
   129 
       
   130 
       
   131 class TImpsSrvUtils
       
   132     {
       
   133     public:  // New methods
       
   134 
       
   135         /**
       
   136         * Initialize suggested CSP services
       
   137         * @param aServices service tree
       
   138         * @param aReactive reactive presence auth negotiation
       
   139         */
       
   140         static void InitializeServices(
       
   141             TImpsServices& aServices,
       
   142             TBool aReactive );
       
   143 
       
   144         /**
       
   145         * Discard CSP services based on response from SAP
       
   146         * @param aData response service tree
       
   147         * @param aServices service tree OUTPUT
       
   148         */
       
   149         static void DiscardServicesL(
       
   150             MImpsDataAccessor* aData,
       
   151             TImpsServices* aServices );
       
   152 
       
   153         /**
       
   154         * Check availability of the service
       
   155         * @param aFeature required feature
       
   156         * @param aSrvS server features
       
   157         * Leave with KErrNotSupported if not available
       
   158         */
       
   159         static void CheckServiceL(
       
   160             TImpsFeatures aFeature,
       
   161             TImpsServices* aSrvS );
       
   162 
       
   163     private:  // methods
       
   164 
       
   165     };
       
   166 
       
   167 // Identification of unique CSP session.
       
   168 // Notice that this class does not store any data and thus this
       
   169 // can be used only for passing CSP identification in function calls.
       
   170 // References to data members are temporary only and may not be valid
       
   171 // after function call, and thus each class entity should make an own
       
   172 // copy of data if it needs that data later on.
       
   173 class TImpsSessIdent
       
   174     {
       
   175     public:
       
   176         /**
       
   177         * Constructor
       
   178         * @param aSID CSP session id
       
   179         * @param aSAP SAP address
       
   180         * @param aUserId WV user id
       
   181         */
       
   182         TImpsSessIdent( const TDesC& aSID,
       
   183                         const TDesC& aSAP, const TDesC& aUserId );
       
   184 
       
   185     public:  // New methods
       
   186 
       
   187         /**
       
   188         * Accessors
       
   189         */
       
   190         inline TPtrC SID() const;
       
   191         inline TPtrC SAP() const;
       
   192         inline TPtrC UserId() const;
       
   193 
       
   194         /**
       
   195         * check if all fields are zero length
       
   196         * @return ETrue if all is zero
       
   197         */
       
   198         inline TBool IsZero() const;
       
   199 
       
   200     private:    // Data
       
   201         const TDesC&           iSID;
       
   202         const TDesC&           iSAP;
       
   203         const TDesC&           iUserId;
       
   204 
       
   205     };
       
   206 
       
   207 
       
   208 inline TInt TImpsSrvSettings::UDPWAPCIR() const
       
   209     {
       
   210     return iUDPWAPCIR;
       
   211     }
       
   212 
       
   213 inline TInt TImpsSrvSettings::SMSWAPCIR() const
       
   214     {
       
   215     return iSMSWAPCIR;
       
   216     }
       
   217 
       
   218 inline TInt TImpsSrvSettings::TCPSCIR() const
       
   219     {
       
   220     return iTCPSCIR;
       
   221     }
       
   222 
       
   223 inline TInt TImpsSrvSettings::UDPSCIR() const
       
   224     {
       
   225     return iUDPSCIR;
       
   226     }
       
   227 
       
   228 inline TInt TImpsSrvSettings::PDPExpiryTime() const
       
   229     {
       
   230     return iPDPExpiry;
       
   231     }
       
   232 
       
   233 inline TInt TImpsSrvSettings::CIRModePollTime() const
       
   234     {
       
   235     return iCIRModePollTime;
       
   236     }
       
   237 
       
   238 inline TInt TImpsSrvSettings::MaximumMessageSize() const
       
   239     {
       
   240     return iMaxMessageSize;
       
   241     }
       
   242 
       
   243 inline TInt TImpsSrvSettings::MaximumParserSize() const
       
   244     {
       
   245     // Max( msg size + 2K ; 1 MB )
       
   246     // Remember that presence, group messages etc are not limited
       
   247     // by msg size, it's only for IM.
       
   248     return Max( ( iMaxMessageSize + 2048 ), KImpsParserSizeMax );
       
   249     }
       
   250 
       
   251 inline TPtrC TImpsSessIdent::SID() const
       
   252     {
       
   253     return iSID;
       
   254     }
       
   255 
       
   256 inline TPtrC TImpsSessIdent::SAP() const
       
   257     {
       
   258     return iSAP;
       
   259     }
       
   260 
       
   261 inline TPtrC TImpsSessIdent::UserId() const
       
   262     {
       
   263     return iUserId;
       
   264     }
       
   265 
       
   266 inline TBool TImpsSessIdent::IsZero() const
       
   267     {
       
   268     return ( !iSAP.Length() && !iSID.Length() && !iUserId.Length() ) ? ETrue : EFalse;
       
   269     }
       
   270 
       
   271 #endif      // ?INCLUDE_H   
       
   272 
       
   273 // End of File