epoc32/include/mw/sentransportproperties.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Transport properties class declaration     
    15 *
    16 */
    17 
    18 #ifndef SEN_TRANSPORT_PROPERTIES_H
    19 #define SEN_TRANSPORT_PROPERTIES_H
    20 
    21 #include <SenXmlProperties.h>
    22 #include <SenSoapEnvelope.h>
    23 
    24 // CONSTANTS
    25 _LIT8( KIapIdLocalName,              "IapId"            );
    26 _LIT8( KSnapIdLocalName,              "SnapId"            );
    27 _LIT8( KProxyHostLocalName,          "ProxyHost"        );
    28 _LIT8( KProxyPortLocalName,          "ProxyPort"        );
    29 _LIT8( KProxyUsageLocalName,         "ProxyUsage"       );
    30 _LIT8( KSecureDialogLocalName,       "SecureDialog"     );
    31 _LIT8( KDeviceIDLocalName,           "DeviceID"         );
    32 _LIT8( KSoapActionLocalName,         "SOAPAction"       );
    33 _LIT8( KUserAgentLocalName,          "User-Agent"       );
    34 _LIT8( KDownloadFolderLocalName,     "DownloadFolder"   );
    35 _LIT8( KFileAttachmentsLocalName,    "FileAttachments"  );
    36 _LIT8( KMwsNamespaceLocalName,       "MwsNamespace"     );
    37 _LIT8( KSenClientGeneratedMessageId, "MessageID"        );
    38 _LIT8( KSenOnewayMessageOnOff,       "OneWayMessage"    );
    39 
    40 _LIT8( KSenConnectionHeartbeat,      "Heartbeat"        );
    41 _LIT8( KSenConnectionHeartbeatMaxTTL,"MaxTTL"           );
    42 _LIT8( KSenConnectionHeartbeatMinTTL,"MinTTL"           );
    43 _LIT8( KSenEndpointResource,         "EndpointResource" );
    44 
    45 _LIT8( KNCIMConsumerKeyId,      "ConsumerKeyId"         );
    46 _LIT8( KNCIMConsumerSecret,     "ConsumerSecret"        );
    47 _LIT8( KNCIMConsumerServiceId,  "ConsumerServiceId"     );
    48 _LIT8( KNCIMEndpoint,				"NCIMEndpoint"     );
    49 _LIT8( KNCIMCountry,				"mcc"     );
    50 
    51 
    52 /*
    53 * Use Bool property to hold value. You can use convenient methods SetBoolPropertyL/BoolPropertyL.
    54 * Value ETrue  - means NO dialog. If any problem occurs, then just an error is returned to the application. 
    55 * Value EFalse - system IAP dialog is shown if any problem occurs
    56 */
    57 _LIT8( KSenIAPDoNotPrompt,           "IAPDoNotPrompt"   );
    58 _LIT8( KSenSNAPDoNotPrompt,           "SNAPDoNotPrompt"   );
    59 
    60 // Property type attribute's name for HTTP headers:
    61 _LIT8( KHttpHeaderType,              "HttpHeader"       );
    62 _LIT8( KAttachmentFileType,          "FileAttachment"   );
    63 
    64 class CSenTransportProperties : public CSenXmlProperties
    65     {
    66     public:
    67         /**
    68         * Basic constructor.
    69         * @return a pointer to new CSenTransportProperties class instance.
    70         */
    71         IMPORT_C static CSenTransportProperties* NewL();
    72         /**
    73         * Basic constructor.
    74         * @return a pointer to new CSenTransportProperties class instance.
    75         */
    76         IMPORT_C static CSenTransportProperties* NewLC();
    77 
    78         /**
    79         * Basic constructor.
    80 		* @param aXmlUtf8 
    81     	* @param aParser It is a XML reader        
    82         * @return a pointer to new CSenTransportProperties class instance.
    83         */
    84         IMPORT_C static CSenTransportProperties* NewL(const TDesC8& aXmlUtf8,
    85                                                           CSenXmlReader& aParser);
    86         /**
    87         * Basic constructor.
    88 		* @param aXmlUtf8 
    89     	* @param aParser It is a XML reader        
    90         * @return a pointer to new CSenTransportProperties class instance.
    91         */
    92         IMPORT_C static CSenTransportProperties* NewLC(const TDesC8& aXmlUtf8,
    93                                                            CSenXmlReader& aParser);
    94 
    95         /**
    96         * Basic constructor.
    97 		* @param aElement
    98         * @return a pointer to new CSenTransportProperties class instance.
    99         */
   100         IMPORT_C static CSenTransportProperties* NewL(const CSenElement& aElement);
   101         /**
   102         * Basic constructor.
   103 		* @param aElement
   104         * @return a pointer to new CSenTransportProperties class instance.
   105         */
   106         IMPORT_C static CSenTransportProperties* NewLC(const CSenElement& aElement);
   107     
   108         // From MSenProperties
   109         IMPORT_C virtual void SetReader(CSenXmlReader& aReader);
   110         IMPORT_C virtual TSenPropertiesClassType PropertiesClassType();
   111         IMPORT_C virtual void WriteToL(RWriteStream& aWriteStream);
   112         IMPORT_C virtual void ReadFromL(const TDesC8& aBuffer);
   113         IMPORT_C virtual HBufC8* AsUtf8L();
   114         IMPORT_C virtual HBufC8* AsUtf8LC();
   115         IMPORT_C virtual TInt SetPropertyL(const TDesC8& aName,
   116                                            const TDesC8& aValue);
   117         IMPORT_C virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue);
   118         IMPORT_C virtual TInt SetIntPropertyL(const TDesC8& aName,
   119                                               const TInt aValue);
   120         IMPORT_C virtual TInt IntPropertyL(const TDesC8& aName,
   121                                            TInt& aValue);
   122         IMPORT_C virtual TInt SetBoolPropertyL(const TDesC8& aName,
   123                                                const TBool aValue);        
   124         IMPORT_C virtual TInt BoolPropertyL(const TDesC8& aName,
   125                                                 TBool& aValue);
   126         IMPORT_C virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue);
   127         IMPORT_C virtual TInt RemovePropertyL(const TDesC8& aName);
   128         IMPORT_C virtual TBool IsSafeToCast(TSenPropertiesClassType aClass);
   129         IMPORT_C virtual MSenProperties* CloneL() const;
   130         IMPORT_C virtual MSenProperties* Clone(TInt& aOkOrError) const;
   131 
   132        /**
   133         * Destructor.
   134         */
   135         IMPORT_C virtual ~CSenTransportProperties();
   136         
   137         IMPORT_C virtual TInt SetPropertyL(const TDesC8& aName,
   138                                            const TDesC8& aValue,
   139                                            const TDesC8& aType);
   140 
   141         IMPORT_C virtual TInt PropertyL(const TDesC8& aName,
   142                                         TPtrC8& aValue,
   143                                         TPtrC8& aType);
   144                                         
   145         /**
   146         * Gets the (connection) heartbeat property value as int.
   147         * @param aDelta     A TInt reference to be filled in with the
   148         *                       value of the heartbeat (in seconds).
   149         *                       Positive value means that a heartbeat
   150         *                       messages are sent to backend, keeping
   151         *                       the socket connection open (longlived
   152         *                       connection). Keeping heartbeat may be
   153         *                       costy, but increases performance in
   154         *                       scenarios, where multiple network
   155         *                       transactions take place within short
   156         *                       period (time window).
   157         * @return             KErrNone if no error, or some of the system
   158         *                       wide error codes.
   159         *                     KErrNotFound if shortlive connection defined
   160         */
   161         IMPORT_C virtual TInt HeartbeatL(TInt& aDelta);
   162 
   163         /**
   164         * Sets the (connection) heartbeat property value as int.
   165         * Note, that with some transports, like vTCP, the heartbeat
   166         * can also be used to control connection modes (longlive
   167         * vs. shortlive connection). 
   168         * Hertbeat value is called also as delta.
   169         * 
   170         * Together with delta You can also set parameters Min & Max TTL
   171         * Long and short connection is set in different way, below guider.
   172         *
   173         * To setup longlive connection:
   174         *   delta   : user defined
   175         *   min TTL : If not specified then the default value of 90 sec will be used
   176         *   max TTL : If not specified then the default value 1800 sec will be used
   177         *
   178         * To setup shortlive connection:
   179         *   delta   : -1
   180         *   min TTL : If not specified then the default value of 90 sec will be used
   181         *   max TTL : ignored
   182         *
   183         * So, providing a negative value
   184         * (-1) can be utilized to disable heartbeat and to switch
   185         * the connection mode to a short lived state. With vTCP
   186         * transport, if heartbeat of -1 is set, the socket will be
   187         * kept open only for effective timeout value (shortlived), 
   188         * 
   189         * @param aDelta    TInt reference to be filled in with 
   190         *                      the value of the heartbeat (in seconds)
   191         * @return              KErrNone if no error, or some of the system
   192         *                      wide error codes.
   193         */
   194         IMPORT_C virtual TInt SetHeartbeatL(TInt aDelta);
   195         
   196         /**
   197         * Gets the IAP ID.
   198         * @param aCurrentIapId  A TUint32 reference to be filled in with the
   199         *                       value of the IAP ID.
   200         * @return               KErrNone if no error, or some of the system
   201         *                       wide error codes.
   202         */
   203         IMPORT_C virtual TInt IapIdL(TUint32& aCurrentIapId);
   204 
   205         /**
   206         * Sets the IAP ID.
   207         * @param aIapId is the new IAP ID.
   208         */
   209         IMPORT_C virtual void SetIapIdL(TUint32 aIapId);
   210 
   211         /**
   212         * Gets the Proxy Port.
   213         * @param aProxyPort  A TInt reference to be filled in with the
   214         *                    value of the Proxy Port.
   215         * @return            KErrNone if no error, or some of the system
   216         *                    wide error codes.
   217         */
   218         IMPORT_C virtual TInt ProxyPortL(TInt& aProxyPort);
   219 
   220         /**
   221         * Sets the Proxy Port.
   222         * @param aProxyPort is the new Proxy Port.
   223         */
   224         IMPORT_C virtual void SetProxyPortL(TInt aProxyPort);
   225 
   226         /**
   227         * Gets the Proxy Host.
   228         * @param aProxyHost  A TPtrC8 reference to be filled in with the
   229         *                    value of the Proxy Host.
   230         * @return            KErrNone if no error, or some of the system
   231         *                    wide error codes.
   232         */
   233         IMPORT_C virtual TInt ProxyHostL(TPtrC8& aProxyHost);
   234 
   235         /**
   236         * Sets the Proxy Host.
   237         * @param aProxyHost is the new Proxy Host.
   238         */
   239         IMPORT_C virtual void SetProxyHostL(const TDesC8& aProxyHost);
   240         
   241         /**
   242         * Gets the Proxy Usage flag.
   243         * @param aProxyUsage A TBool reference to be filled in with the
   244         *                    value of the Proxy Usage.
   245         * @return            KErrNone if no error, or some of the system
   246         *                    wide error codes.
   247         */
   248         IMPORT_C virtual TInt ProxyUsageL(TBool& aProxyUsage);
   249 
   250         /**
   251         * Sets the Proxy Usage flag.
   252         * @param aProxyUsage is the new value for Proxy Usage.
   253         */
   254         IMPORT_C virtual void SetProxyUsageL(TBool aProxyUsage);
   255 
   256         /**
   257         * Gets the information if SecureDialog is shown or not.
   258         * @param aProxyUsage A TBool reference to be filled in with the
   259         *                    value of the SecureDialog flag.
   260         * @return            KErrNone if no error, or some of the system
   261         *                    wide error codes.
   262         */
   263         IMPORT_C virtual TInt SecureDialogL(TBool& aSecureDialog);
   264 
   265         /**
   266         * Sets the flag which controls showing of SecureDialog.
   267         * @param aSecureDialog is the new value for SecureDialog flag.
   268         */
   269         IMPORT_C virtual void SetSecureDialogL(TBool aSecureDialog);
   270         
   271         /**
   272         * Gets the information if IAPDialog is shown or not.
   273         * @param aIAPDialog A TBool reference to be filled in with the
   274         *                   value of the SecureDialog flag.
   275         * @return           KErrNone if no error, or some of the system
   276         *                   wide error codes.
   277         */
   278 //        IMPORT_C virtual TInt IAPDialogL(TBool& aIAPDialog);
   279 
   280         /**
   281         * Sets the flag which controls showing of IAPDialog.
   282         * @param aIAPDialog is the new value for IAPDialog flag.
   283         */
   284 //        IMPORT_C virtual void SetIAPDialogL(TBool aIAPDialog);
   285 
   286         /**
   287         * Gets the UserAgent.
   288         * @param aUserAgent  A TPtrC8 reference to be filled in with the
   289         *                    value of the UserAgent.
   290         * @return            KErrNone if no error, or some of the system
   291         *                    wide error codes.
   292         */
   293         IMPORT_C virtual TInt UserAgentL(TPtrC8& aUserAgent);
   294         
   295         /**
   296         * Sets the UserAgent.
   297         * @param aUserAgent is the new User Agent.
   298         */
   299         IMPORT_C virtual void SetUserAgentL(const TDesC8& aUserAgent);
   300         
   301         /**
   302         * Gets the device ID
   303         * @param aDeviceID  A TPtrC8 reference to be filled in with the
   304         *                    value of the Device ID.
   305         * @return            KErrNone if no error, or some of the system
   306         *                    wide error codes.
   307         */
   308         IMPORT_C virtual TInt DeviceIDL(TPtrC8& aDeviceID);
   309 
   310         /**
   311         * Sets the Device ID.
   312         * @param aDeviceID is the new Device ID.
   313         */
   314         IMPORT_C virtual void SetDeviceIDL(const TDesC8& aDeviceID);
   315         
   316         /**
   317         * Gets the Action of message
   318         * @param aAction A TPtrC8 reference to be filled in with the
   319         *                    value of the Action.
   320         * @return            KErrNone if no error, or some of the system
   321         *                    wide error codes.
   322         */
   323         IMPORT_C virtual TInt SoapActionL(TPtrC8& aAction);
   324         
   325         /**
   326         * Sets the Action.
   327         * @param aAction is the new Soap Action.
   328         */
   329         IMPORT_C virtual void SetSoapActionL(const TDesC8& aAction);
   330         
   331         /**
   332         * Apply binding.
   333         * @param aSoapVersion is the version of Soap (1.1 or 1.2).
   334         */
   335         IMPORT_C virtual void ApplyBindingL(TSOAPVersion aSoapVersion);
   336 
   337         /**
   338         * Gets download folder for incoming BLOB (binary large objects)
   339         * @param aDownloadFolder - A TPtrC8 reference to be filled in with the
   340         *                    value of the shared, public folder for downloaded 
   341         *                    content
   342         * @return            KErrNone if no error, or some of the system
   343         *                    wide error codes.
   344         */
   345         IMPORT_C virtual TInt DownloadFolderL(TPtrC8& aDownloadFolder);
   346         
   347         /**
   348         * Sets download folder for incoming BLOB (binary large objects)
   349         * @param aDownloadFolder shared, public folder for downloaded content
   350         */
   351         IMPORT_C virtual void SetDownloadFolderL(const TDesC8& aDownloadFolder);
   352         
   353         /**
   354         * Gets filename of file attachment
   355         * @param aCid - cid for filename
   356         * @param aFileName - filename of file attachment with current cid
   357         * @return            KErrNone if no error, or some of the system
   358         *                    wide error codes.
   359         */
   360         IMPORT_C virtual TInt FileAttachmentL(const TDesC8& aCid, HBufC8*& aFileName);
   361         
   362         /**
   363         * Sets filename of file attachment
   364         * @param aCid - cid for filename
   365         * @param aFileName - filename of file attachment with current cid
   366         * @return            KErrNone if no error, or some of the system
   367         *                    wide error codes.
   368         */
   369         IMPORT_C virtual TInt SetFileAttachmentL(const TDesC8& aCid, const TDesC8& aFileName);
   370 
   371         /**
   372         * Gets namespace of Microsoft schema
   373         * @param aMwsNamespace - namespace
   374         * @return            KErrNone if no error, or some of the system
   375         *                    wide error codes.
   376         */
   377         IMPORT_C virtual TInt MwsNamespaceL(TPtrC8& aMwsNamespace);
   378         
   379         /**
   380         * Sets namespace of Microsoft schema
   381         * @param aMwsNamespace - namespace
   382         * @return            KErrNone if no error, or some of the system
   383         *                    wide error codes.
   384         */
   385         IMPORT_C virtual void SetMwsNamespaceL(const TDesC8& aMwsNamespace);
   386 
   387 
   388         /**
   389         * Gets message ID
   390         * @param aMessageId - is the id of the message
   391         * @return            KErrNone if no error, or some of the system
   392         *                    wide error codes.
   393         */
   394         IMPORT_C virtual TInt MessageIdL(TPtrC8& aMessageId);
   395 
   396         /**
   397         * Sets message ID. Typically, this property is set per each message, instead of
   398         * applying the same message ID for whole consumer session (service connection)
   399         * @param aMessageID - is the ID of the message
   400         * @return            KErrNone if no error, or some of the system
   401         *                    wide error codes.
   402         */
   403         IMPORT_C virtual void SetMessageIdL(const TDesC8& aMessageId);
   404 
   405         /**
   406         * Gets one-way message mode.
   407         * @param aOnewayMsgOnOff A TBool reference to be filled in with the
   408         *                    value of the one-way message mode.
   409         * @return            KErrNone if no error, or some of the system
   410         *                    wide error codes.
   411         */
   412         IMPORT_C virtual TInt OnewayMessageOnOffL(TBool& aOnewayMessageOnOff);
   413 
   414         /**
   415         * Sets the one-way message mode on/off. Typically, one-way
   416         * messages are rarely used by default: instead, a request-
   417         * response pair (consumer[request]<->[response]provider)
   418         * transaction takes place.
   419         * However, if one-way message mode is enabled, sending such
   420         * message will typically result immediate callback from
   421         * the transport (plug-in) itself. This means, that the
   422         * actual service response from the provider is not being
   423         * waited. 
   424         * Common use case to enable one-way message is when service
   425         * connection is used in transmitting *responses* to notification
   426         * request(s) that some remote consumer (from outside device) has 
   427         * sent earlier.
   428         * Such notification requests may thus be received via hostlet 
   429         * connection (hc), and by enabling one-way message, once can reply
   430         * via service connection, instead of calling hc->RespondL method.
   431         * Furthermore, application might wish to enable one-way message
   432         * mode to hostlet connection, if it is not interested of replying
   433         * to these two-way notifications via hostlet connection, but wishes
   434         * to use service connection instead.
   435         * @param aOnewayMessageOnOff is the new value of one-way message mode.
   436         */
   437         IMPORT_C virtual void SetOnewayMessageOnOffL(TBool aOnewayMessageOnOff);
   438 
   439         /**
   440         * Sets the (connection) Max TTL for longlive connection.
   441         *
   442         * @see SetHeartbeatL(TInt aDelta)
   443         *
   444         * @param aMaxTTL      TInt reference to be filled in with 
   445         *                      the value of the max TTL (in seconds)
   446         * @return              KErrNone if no error, or some of the system
   447         *                       wide error codes.
   448         */
   449         IMPORT_C virtual TInt SetMaxTimeToLiveL(TInt aMaxTTL);
   450         
   451         /**
   452         * Gets the (connection) max TTL property value as int.
   453         *
   454         * @see SetHeartbeatL(TInt aDelta)
   455         *
   456         * @param aMaxTTL       A TInt reference to be filled in with the
   457         *                       value of the max TTL (in seconds).
   458         *
   459         * @return           KErrNotFound if shortlive connection defined
   460         *                   KErrNone if no error, or some of the system
   461         *                       wide error codes.
   462         */
   463         IMPORT_C virtual TInt MaxTimeToLiveL(TInt& aMaxTTL);
   464 
   465         /**
   466         * Sets the (connection) Min TTL
   467         *
   468         * @see SetHeartbeatL(TInt aDelta)
   469         *
   470         * @param aMaxTTL      TInt reference to be filled in with 
   471         *                      the value of the min TTL (in seconds)
   472         * @return              KErrNone if no error, or some of the system
   473         *                       wide error codes.
   474         */
   475         IMPORT_C virtual TInt SetMinTimeToLiveL(TInt aMinTTL);
   476 
   477         /**
   478         * Gets the (connection) min TTL property value as int.
   479         *
   480         * @see SetHeartbeatL(TInt aDelta)
   481         *
   482         * @param aMinTTL     A TInt reference to be filled in with the
   483         *                       value of the min TTL (in seconds).
   484         *
   485         * @return           KErrNone if no error, or some of the system
   486         *                       wide error codes.
   487         */
   488         IMPORT_C virtual TInt MinTimeToLiveL(TInt& aMinTTL);
   489 
   490 
   491 
   492         /**
   493         * Sets resource property value  for endpoint
   494         *
   495         *
   496         * @param aEndpointResource - is the suffix for endpoint
   497         *                      
   498         * @return              KErrNone if no error, or some of the system
   499         *                       wide error codes.
   500         */
   501         IMPORT_C virtual TInt SetEndpointResourceL(const TDesC8& aEndpointResource);
   502 
   503         /**
   504         * Gets resource property value for endpoint
   505         *
   506         *
   507         * @param aEndpointResource - is the suffix for endpoint
   508         *                      
   509         *
   510         * @return           KErrNone if no error, or some of the system
   511         *                       wide error codes.
   512         */
   513         IMPORT_C virtual TInt EndpointResourceL(TPtrC8& aEndpointResource);
   514 
   515 
   516     protected: // base class functions
   517 
   518         IMPORT_C virtual void BaseConstructL(const TDesC8& aLocalname, 
   519                                     const TDesC8& aXml,
   520                                     CSenXmlReader* aParser = NULL);
   521 
   522         IMPORT_C virtual void BaseConstructL(const TDesC8& aNamespace, 
   523                                     const TDesC8& aLocalname, 
   524                                     const TDesC8& aXml,
   525                                     CSenXmlReader* aParser = NULL);
   526 
   527         IMPORT_C virtual void BaseConstructL(const TDesC8& aNamespace, 
   528                                     const TDesC8& aLocalname, 
   529                                     const TDesC8& aQualifiedName, 
   530                                     const TDesC8& aXml,
   531                                     CSenXmlReader* aParser = NULL);
   532 
   533         IMPORT_C virtual void BaseConstructL(const CSenElement& aElement);
   534         
   535 	public:
   536         /**
   537         * Sets the SNAP ID.
   538         * @param aSnapId is the new SNAP ID.
   539         */
   540         IMPORT_C void SetSnapIdL(TUint32 aSnapId); 
   541 
   542         /**
   543         * Gets the SNAP ID.
   544         * @param aCurrentSnapId  A TUint32 reference to be filled in with the
   545         *                       value of the SNAP ID.
   546         * @return               KErrNone if no error, or some of the system
   547         *                       wide error codes.
   548         */
   549         IMPORT_C TInt SnapIdL(TUint32& aCurrentSnapId); 
   550     protected:
   551         /**
   552         * Constructor.
   553         */
   554         IMPORT_C CSenTransportProperties();
   555         
   556     private:
   557         TInt iFileAttachmentNum;        
   558     };
   559 
   560 #endif // SEN_TRANSPORT_PROPERTIES_H