ncdengine/provider/protocol/inc/ncdrequestbase.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   CNcdRequest declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CNCDREQUESTBASE_HH
       
    20 #define CNCDREQUESTBASE_HH
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include "ncdrequestconstants.h"
       
    26 #include "ncdprotocoltypes.h"
       
    27 #include "ncdprotocolutils.h"
       
    28 #include "ncdprotocolwords.h"
       
    29 
       
    30 class CNcdRequestConfigurationData;
       
    31 class MNcdConfigurationProtocolDetail;
       
    32 class MNcdConfigurationProtocolCookie;
       
    33 class MNcdConfigurationProtocolQueryResponse;
       
    34 
       
    35 class CNcdRequestBase : public CBase
       
    36     {
       
    37 
       
    38 public:
       
    39     /**
       
    40      * Request body generation.
       
    41      * Returns NULL if all required fields are not set.
       
    42      * At least namespace must be set explicitly.
       
    43      * @return The request serialized into 8-bit buffer or NULL.
       
    44      */
       
    45     virtual HBufC8* CreateRequestL();
       
    46         
       
    47     /**
       
    48      * Configuration object getter.
       
    49      * The ownership is NOT transferred outside RequestBase
       
    50      * @return Configuration object.
       
    51      */
       
    52     CNcdRequestConfigurationData* Configuration();
       
    53 
       
    54     /**
       
    55      * Configuration object setter.
       
    56      * RequestBase takes ownership of the object.
       
    57      * @param aConfiguration Configuration object
       
    58      */
       
    59     void SetConfigurationL( 
       
    60         CNcdRequestConfigurationData* configuration);
       
    61     
       
    62     /**
       
    63      * Adds a query response to the request.
       
    64      * @param aResponse The response object to add.
       
    65      */
       
    66     void AddQueryResponseL(
       
    67         MNcdConfigurationProtocolQueryResponse* aResponse);
       
    68 
       
    69     
       
    70     /**
       
    71      * Adds cookie element to the request.
       
    72      * RequestBase takes ownership of the object.
       
    73      * @param aCookie Pointer to the cookie object
       
    74      */
       
    75     void AddCookieL(
       
    76         MNcdConfigurationProtocolCookie* aCookie);
       
    77 
       
    78     // response root element attribute setters
       
    79     void SetRequestIdL(TInt aId);
       
    80     void SetProtocolVersionL(const TDesC8& aVersion);
       
    81     void SetSessionL(const TDesC& aSession);
       
    82     void SetNamespaceL(const TDesC& aNamespace);
       
    83 
       
    84     HBufC* IdLC() const;
       
    85     HBufC* SessionLC() const;
       
    86     HBufC* NamespaceLC() const;
       
    87     
       
    88 public:
       
    89     ~CNcdRequestBase();
       
    90 
       
    91 protected:
       
    92     static CNcdRequestBase* NewL();
       
    93     static CNcdRequestBase* NewLC();
       
    94 
       
    95     CNcdRequestBase();
       
    96 
       
    97     virtual void ConstructL( const TDesC8& aRootName );
       
    98 
       
    99     TXmlEngElement GetCookiesElementL( const TDesC8& aPrefix );
       
   100     TXmlEngElement GetQueryResponsesElementL( const TDesC8& aPrefix );
       
   101     TXmlEngElement GetDetailsElementL( const TDesC8& aPrefix );
       
   102 
       
   103     HBufC8* ExternalizeL();
       
   104 
       
   105 private:
       
   106     void InitializeDocumentL();
       
   107 
       
   108 protected:
       
   109 #ifdef RD_XML_ENGINE_API_CHANGE
       
   110     RXmlEngDOMImplementation iDomImplementation;
       
   111 #endif
       
   112     RXmlEngDocument iDocument;
       
   113     TXmlEngElement  iRoot;
       
   114 
       
   115     TXmlEngNamespace iCdpNamespace;
       
   116     TXmlEngNamespace iXsNamespace;
       
   117     TXmlEngNamespace iXsiNamespace;
       
   118 
       
   119     // element used for the actual request
       
   120     TXmlEngElement  iRequestElement;
       
   121 
       
   122     // these can change according to the request type
       
   123     // (preminetRequest / configurationRequest)    
       
   124     TXmlEngString iId;
       
   125     TXmlEngString iVersion;
       
   126     HBufC8* iRootName;
       
   127     
       
   128     // response root attributes
       
   129     TXmlEngString iSession;
       
   130     TXmlEngString iNamespace;
       
   131 
       
   132     // owned: client and network configuration data
       
   133     CNcdRequestConfigurationData* iConfiguration;
       
   134     
       
   135 private:
       
   136     
       
   137     TXmlEngString iPrefix;    
       
   138     
       
   139     RPointerArray<MNcdConfigurationProtocolCookie> iCookies;
       
   140     RPointerArray<MNcdConfigurationProtocolQueryResponse> iQueryResponses;
       
   141     };
       
   142 
       
   143 #endif //CNCDREQUESTBASE_HH
       
   144