xdmprotocols/XcapProtocol/inc/XcapProtocol.h
branchGCC_SURGE
changeset 28 d9861ae9169c
parent 23 77cb48a03620
parent 26 04ca1926b01c
equal deleted inserted replaced
23:77cb48a03620 28:d9861ae9169c
     1 /*
       
     2 * Copyright (c) 2005 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:  CXcapProtocol
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __XCAPPROTOCOL__
       
    22 #define __XCAPPROTOCOL__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <XdmEngine.h>
       
    26 #include <msgbearerobscallback.h>
       
    27 #include "XcapCache.h"
       
    28 #include "XdmProtocol.h"
       
    29 #include "XdmShutdownSwitch.h"
       
    30 #include "XcapUtilsInterface.h"
       
    31 
       
    32 enum TXcapAuthType
       
    33     {
       
    34     EXcapAuthGaa = 0,
       
    35     EXcapAuthEarlyIms,
       
    36     EXcapAuthHttpDigest
       
    37     };
       
    38     
       
    39 //CONSTANTS
       
    40 _LIT( KHttp,                                    "http://" );
       
    41 _LIT( KHttps,                                   "https://" );
       
    42 _LIT( KHostSeparator,                           "/" );
       
    43 _LIT( KXcapEngLogDir,                           "XDM" );
       
    44 _LIT( KXcapEngLogFile,                          "XcapProtocol" );
       
    45 const TInt KXcapEngLogBufferMaxSize		        = 2000;
       
    46 
       
    47 //FORWARD DECLARATIONS
       
    48 class CXdmLogWriter;
       
    49 class CXcapDocument;
       
    50 class CXdmXmlParser;
       
    51 class CXcapEarlyIms;
       
    52 class MMsgConnManager;
       
    53 class CXdmShutdownTimer;
       
    54 class CXcapHttpTransport;
       
    55 class CXdmOperationFactory;
       
    56 class CXdmSettingsCollection;
       
    57 
       
    58 //CLASS DECLARATION
       
    59 class CXcapProtocol : public CXdmProtocol,
       
    60                       public MXcapEarlyImsObs,
       
    61                       public MXdmShutdownSwitch,
       
    62                       public MMsgBearerObsCallback
       
    63     {
       
    64     
       
    65     public:
       
    66                 
       
    67         /**
       
    68         * Return an operation object that knows how to manipulate
       
    69         * partial document
       
    70         */
       
    71         IMPORT_C TPtrC8 PublicID();
       
    72         
       
    73         /**
       
    74         * Return a pointer to the cache client interface
       
    75         * @return RXcapCache* Pointer to the cache interface
       
    76         */
       
    77         IMPORT_C RXcapCache* Cache();
       
    78            
       
    79         /**
       
    80         * Return a reference to the XML Parser
       
    81         * @return CXdmXmlParser& Reference to XML Parser
       
    82         */
       
    83         IMPORT_C CXdmXmlParser& Parser();
       
    84         
       
    85         /**
       
    86         * Return a reference to the XML Parser
       
    87         * @return CXdmXmlParser& Reference to XML Parser
       
    88         */
       
    89         IMPORT_C CXcapHttpTransport& Transport();
       
    90                    
       
    91         /**
       
    92         * Check whether network is available
       
    93         * @return TBool Is network available
       
    94         */
       
    95         IMPORT_C TBool IsNetworkAvailable();
       
    96         
       
    97     public:     //Not exported
       
    98         
       
    99         /**
       
   100         * Check whether there are requests being carried out
       
   101         * and start the idle timer if appropriate
       
   102         *
       
   103         * @return void
       
   104         */ 
       
   105         void CheckActivity();
       
   106         
       
   107         /**
       
   108         * Return an operation object that knows how to manipulate
       
   109         * partial document
       
   110         */
       
   111         TPtrC8 UserName() const;
       
   112         
       
   113         /**
       
   114         * Return an operation object that knows how to manipulate
       
   115         * partial document
       
   116         */
       
   117         TXcapAuthType AuthType() const;
       
   118         
       
   119         /**
       
   120         * Return an operation object that knows how to manipulate
       
   121         * partial document
       
   122         */
       
   123         TBool IsSimRequestPending( TInt& aError ) const;
       
   124         
       
   125         /**
       
   126         * Return an operation object that knows how to manipulate
       
   127         * partial document
       
   128         */
       
   129         void AppendNotifyeeL( CXcapDocument* aPendingDoc );
       
   130         
       
   131         /**
       
   132         * Return an operation object that knows how to manipulate
       
   133         * partial document
       
   134         */
       
   135         void CancelImsResolver();
       
   136         
       
   137         /**
       
   138         * Logging function
       
   139         * @param TRefByValue<const TDesC8> aFmt,...
       
   140         * @return void
       
   141         */ 
       
   142         void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
       
   143    
       
   144     private:  //From CXdmProtocol
       
   145    
       
   146         /**
       
   147         * Initialise the media used to transfer Xdm data
       
   148         */
       
   149         void InitTransferMedium( TInt aIdleTimeout, TRequestStatus& aStatus );
       
   150                                 
       
   151         /**
       
   152         * Cancel initialisation of the transfer media.
       
   153         */
       
   154         void CancelTransferMediumInit();
       
   155         
       
   156         /**
       
   157         * Cancel initialisation of the transfer media.
       
   158         */
       
   159         TBool IsTransferAvailable() const;
       
   160         
       
   161         /**
       
   162         * Create a new document node.
       
   163         */
       
   164         CXdmDocumentNode* CreateDocumentNodeL();
       
   165         
       
   166         /**
       
   167         * Create a new protocol dependent document model
       
   168         */
       
   169         CXdmDocument* CreateDocumentL( const TDesC& aDocumentName,
       
   170                                        const TXdmDocType aDocumentType );
       
   171         
       
   172         /**
       
   173         * Create a new protocol dependent document model
       
   174         */
       
   175         CXdmDirectory* CreateDirectoryL( const TDesC& aDirectoryPath );
       
   176 
       
   177         /**
       
   178         * Destructor.
       
   179         */      
       
   180         virtual ~CXcapProtocol();
       
   181         
       
   182     private:
       
   183     
       
   184         /**
       
   185         * From MXdmShutdownSwitch
       
   186         * @return void
       
   187         */ 
       
   188         void SwitchOff();
       
   189         
       
   190 		/**
       
   191         * From MXcapEarlyImsObs.
       
   192         * @param TInt Error
       
   193         * @return void
       
   194         */
       
   195 		void RequestComplete( TInt aError );
       
   196 
       
   197     public:  //Static
       
   198         
       
   199         /**
       
   200         * Symbian OS default constructor.
       
   201         * @param TInt Default Access Point ID
       
   202         * @return CXdmDocOperation*
       
   203         */     
       
   204         static CXcapProtocol* NewL( const TXdmProtocolParams& aProtocolInfo );
       
   205         
       
   206         /**
       
   207         * A Global logging function
       
   208         * @param TRefByValue<const TDesC8> aFmt,...
       
   209         * @return void
       
   210         */ 
       
   211         static TInt GenerateUniqueIdL();
       
   212 
       
   213     private:  //Methods
       
   214         
       
   215         /**
       
   216         * Symbian OS default constructor.
       
   217         * @param TInt Default Access Point ID
       
   218         * @return CXdmDocOperation*
       
   219         */     
       
   220         CXcapProtocol();
       
   221         
       
   222         /**
       
   223         * Symbian OS default constructor.
       
   224         * @param TInt Default Access Point ID
       
   225         * @return CXdmDocOperation*
       
   226         */     
       
   227         void ConstructL( const TXdmProtocolParams& aProtocolParams );
       
   228         
       
   229         /**
       
   230         * Symbian OS default constructor.
       
   231         * @param TInt Default Access Point ID
       
   232         * @return CXdmDocOperation*
       
   233         */     
       
   234         void DeleteLogFileL();
       
   235         
       
   236         /**
       
   237         * Return an operation object that knows how to manipulate
       
   238         * partial document
       
   239         */
       
   240         TInt SaveSettingsL();
       
   241         
       
   242         /**
       
   243         * Return an operation object that knows how to manipulate
       
   244         * partial document
       
   245         */
       
   246         void SaveFromCollectionL( const CXdmSettingsCollection& aSettings );
       
   247         
       
   248         /**
       
   249         * Return an operation object that knows how to manipulate
       
   250         * partial document
       
   251         */
       
   252         void ResolveIdentityL();
       
   253         
       
   254         /**
       
   255         * Select the type of the authentication 
       
   256         */
       
   257         void SelectAuthTypeL( const CXdmSettingsCollection& aSettings );
       
   258         
       
   259         /**
       
   260         * Symbian OS default constructor.
       
   261         * @param TInt Default Access Point ID
       
   262         * @return CXdmDocOperation*
       
   263         */     
       
   264         RXcapCache* CacheHandle();
       
   265         
       
   266         /**
       
   267         * Symbian OS default constructor.
       
   268         * @param TInt Default Access Point ID
       
   269         * @return CXdmDocOperation*
       
   270         */  
       
   271         TPtrC8 Impu() const;
       
   272         
       
   273         /**
       
   274         * Symbian OS default constructor.
       
   275         * @param TInt Default Access Point ID
       
   276         * @return CXdmDocOperation*
       
   277         */     
       
   278         HBufC* ParseRootLocationLC( const TBool aSecurity,
       
   279                                     const TDesC& aRootLocation );
       
   280         /**
       
   281         * Symbian OS default constructor.
       
   282         * @param TInt Default Access Point ID
       
   283         * @return CXdmDocOperation*
       
   284         */     
       
   285         HBufC* CheckProtocolPrefixL( const TDesC& aRootLocation );
       
   286         
       
   287         /**
       
   288         * Symbian OS default constructor.
       
   289         * @param TInt Default Access Point ID
       
   290         * @return CXdmDocOperation*
       
   291         */     
       
   292         HBufC* ConstructSecureUriL( const TDesC& aBasicUri );
       
   293         
       
   294         /**
       
   295         * Symbian OS default constructor.
       
   296         * @param TInt Default Access Point ID
       
   297         * @return CXdmDocOperation*
       
   298         */     
       
   299         HBufC* ConstructStandardUriL( const TDesC& aBasicUri );
       
   300         
       
   301         /**
       
   302         * Handle a bearer event
       
   303         * @param TMsgBearerEvent The type of the event
       
   304         */
       
   305         void HandleBearerEventL( TBool aAuthoritativeClose,
       
   306                                  TMsgBearerEvent aBearerEvent );
       
   307 
       
   308     private:  //Data
       
   309         
       
   310         TInt                                     iIdleTimeout;
       
   311         TInt                                     iAccessPoint;
       
   312         TInt                                     iImsResolverError;
       
   313         TBool                                    iSuspend;
       
   314         TBool                                    iCacheUsage;
       
   315         TBool                                    iTransferMediaOpen;
       
   316         TBool                                    iSimRequestPending;
       
   317         HBufC*                                   iRootUri;
       
   318         HBufC8*                                  iPublicId;
       
   319         RXcapCache                               iCacheClient;
       
   320         CXdmEngine*                              iXdmEngine;
       
   321         CXdmDocument*                            iCapabilities;
       
   322         CXdmLogWriter*                           iLogWriter;
       
   323         TXcapAuthType                            iAuthType;
       
   324         CXdmXmlParser*                           iXmlParser;
       
   325         CXcapEarlyIms*                           iImsResolver;
       
   326         TXdmCredentials                          iCredentials;
       
   327         MMsgConnManager*                         iConnectionManager;
       
   328         CXdmShutdownTimer*                       iIdleTimer;
       
   329         CXcapHttpTransport*                      iHttpTransport;
       
   330         const CXdmProtocolInfo*                  iProtocolInfo;
       
   331         TBuf8<KXdmMaxUserNameLength>             iUserName;
       
   332         RPointerArray<CXcapDocument>             iNotifyeeQueue;
       
   333     };
       
   334 
       
   335 #endif      //__XCAPPROTOCOL__
       
   336             
       
   337 // End of File