williamr@2: /* williamr@2: * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Http transport properties class declaration williamr@2: * williamr@2: */ williamr@2: williamr@2: #ifndef SEN_HTTP_TRANSPORT_PROPERTIES_H williamr@2: #define SEN_HTTP_TRANSPORT_PROPERTIES_H williamr@2: williamr@2: // INCLUDE williamr@2: #include williamr@2: williamr@2: // CONSTANTS williamr@2: _LIT8(KSenHttpAcceptHeaderDelimiter, ","); williamr@2: williamr@2: // Supported Http properties: williamr@2: williamr@2: //// -- session properties: williamr@2: _LIT8(KHttpMethodLocalName, "HttpMethod"); williamr@2: _LIT8(KHttpVersionLocalName, "HttpVersion"); williamr@2: williamr@2: //// -- HTTP headers names: williamr@2: _LIT8(KContentTypeLocalName, "Content-Type"); williamr@2: _LIT8(KAcceptLocalName, "Accept"); williamr@2: _LIT8(KSlugLocalName, "Slug"); williamr@2: williamr@2: // Supported Http methods: williamr@2: _LIT8(KHttpGet, "Get"); williamr@2: _LIT8(KHttpPost, "Post"); williamr@2: _LIT8(KHttpPut, "Put"); williamr@2: _LIT8(KHttpDelete, "Delete"); williamr@2: williamr@2: // Supported Http versions: williamr@2: _LIT8(KHttp10, "Http1.0"); williamr@2: _LIT8(KHttp11, "Http1.1"); williamr@2: williamr@2: //NOTE: williamr@2: /** In SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties) williamr@2: * or williamr@2: * SubmitL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties, HBufc8*& aResponseTO) williamr@2: * aProperties could be "HTTP GET" or "HTTP DELETE" williamr@2: * aMessage is a soap message or serialized XML. williamr@2: * This scenario is not supported. williamr@2: * williamr@2: * These are the function calls get called during this scenario williamr@2: * iHttpProperties->SetHttpHeaderL(const TDesC8& aHeaderName, const TDesC8& aValue); williamr@2: * iHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpGet); williamr@2: * SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties); williamr@2: **/ williamr@2: williamr@2: // CLASS DECLARATION williamr@2: class CSenHttpTransportProperties : public CSenTransportProperties williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * HttpMethod Enumeration williamr@2: */ williamr@2: enum TSenHttpMethod williamr@2: { williamr@2: ESenHttpPut, williamr@2: ESenHttpDelete, williamr@2: ESenHttpGet, williamr@2: ESenHttpPost williamr@2: }; williamr@2: /** williamr@2: * HttpVersion Enumeration williamr@2: */ williamr@2: enum TSenHttpVersion williamr@2: { williamr@2: ESenHttp10, williamr@2: ESenHttp11 williamr@2: }; williamr@2: /** williamr@2: * Basic constructor. williamr@2: * @return a pointer to new CSenHttpTransportProperties class instance. williamr@2: */ williamr@2: IMPORT_C static CSenHttpTransportProperties* NewL(); williamr@2: /** williamr@2: * Basic constructor. williamr@2: * @return a pointer to new CSenHttpTransportProperties class instance. williamr@2: */ williamr@2: IMPORT_C static CSenHttpTransportProperties* NewLC(); williamr@2: williamr@2: /** williamr@2: * Basic constructor. williamr@2: * @param aXmlUtf8 williamr@2: * @param aParser It is a XML reader williamr@2: * @return a pointer to new CSenHttpTransportProperties class instance. williamr@2: */ williamr@2: IMPORT_C static CSenHttpTransportProperties* NewL(const TDesC8& aXmlUtf8, williamr@2: CSenXmlReader& aParser); williamr@2: williamr@2: /** williamr@2: * Basic constructor. williamr@2: * @param aXmlUtf8 williamr@2: * @param aParser It is a XML reader williamr@2: * @return a pointer to new CSenHttpTransportProperties class instance. williamr@2: */ williamr@2: IMPORT_C static CSenHttpTransportProperties* NewLC(const TDesC8& aXmlUtf8, williamr@2: CSenXmlReader& aParser); williamr@2: williamr@2: /** williamr@2: * Basic constructor. williamr@2: * @param aElement williamr@2: * @return a pointer to new CSenHttpTransportProperties class instance. williamr@2: */ williamr@2: IMPORT_C static CSenHttpTransportProperties* NewL(const CSenElement& aElement); williamr@2: /** williamr@2: * Basic constructor. williamr@2: * @param aElement williamr@2: * @return a pointer to new CSenHttpTransportProperties class instance. williamr@2: */ williamr@2: IMPORT_C static CSenHttpTransportProperties* NewLC(const CSenElement& aElement); williamr@2: williamr@2: /** williamr@2: * Gets the IAP ID. williamr@2: * @param aCurrentIapId A TUint32 reference to be filled in with the williamr@2: * value of the IAP ID. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt IapIdL(TUint32& aCurrentIapId); williamr@2: williamr@2: /** williamr@2: * Sets the IAP ID. williamr@2: * @param aIapId is the new IAP ID. williamr@2: */ williamr@2: virtual void SetIapIdL(TUint32 aIapId); williamr@2: williamr@2: /** williamr@2: * Gets the Proxy Port. williamr@2: * @param aProxyPort A TInt reference to be filled in with the williamr@2: * value of the Proxy Port. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt ProxyPortL(TInt& aProxyPort); williamr@2: williamr@2: /** williamr@2: * Sets the Proxy Port. williamr@2: * @param aProxyPort is the new Proxy Port. williamr@2: */ williamr@2: virtual void SetProxyPortL(TInt aProxyPort); williamr@2: williamr@2: /** williamr@2: * Gets the Proxy Host. williamr@2: * @param aProxyHost A TPtrC8 reference to be filled in with the williamr@2: * value of the Proxy Host. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt ProxyHostL(TPtrC8& aProxyHost); williamr@2: williamr@2: /** williamr@2: * Sets the Proxy Host. williamr@2: * @param aProxyHost is the new Proxy Host. williamr@2: */ williamr@2: virtual void SetProxyHostL(const TDesC8& aProxyHost); williamr@2: williamr@2: /** williamr@2: * Gets the Proxy Usage flag. williamr@2: * @param aProxyUsage A TBool reference to be filled in with the williamr@2: * value of the Proxy Usage. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt ProxyUsageL(TBool& aProxyUsage); williamr@2: williamr@2: /** williamr@2: * Sets the Proxy Usage flag. williamr@2: * @param aProxyUsage is the new value for Proxy Usage. williamr@2: */ williamr@2: virtual void SetProxyUsageL(TBool aProxyUsage); williamr@2: williamr@2: /** williamr@2: * Gets the information if SecureDialog is shown or not. williamr@2: * @param aProxyUsage A TBool reference to be filled in with the williamr@2: * value of the SecureDialog flag. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt SecureDialogL(TBool& aSecureDialog); williamr@2: williamr@2: /** williamr@2: * Sets the flag which controls showing of SecureDialog. williamr@2: * @param aSecureDialog is the new value for SecureDialog flag. williamr@2: */ williamr@2: virtual void SetSecureDialogL(TBool aSecureDialog); williamr@2: williamr@2: /** williamr@2: * Gets the information if IAPDialog is shown or not. williamr@2: * @param aIAPDialog A TBool reference to be filled in with the williamr@2: * value of the IAPDialog flag. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: // virtual TInt IAPDialogL(TBool& aIAPDialog); williamr@2: williamr@2: /** williamr@2: * Sets the flag which controls showing of IAPDialog. williamr@2: * @param aIAPDialog is the new value for IAPDialog flag. williamr@2: */ williamr@2: // virtual void SetIAPDialogL(TBool aIAPDialog); williamr@2: williamr@2: /** williamr@2: * Gets the Content Type. williamr@2: * @param aContentType A TPtrC8 reference to be filled in with the williamr@2: * value of the Content Type. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt ContentTypeL(TPtrC8& aContentType); williamr@2: williamr@2: /** williamr@2: * Sets the Content Type. williamr@2: * @param aContentType is the new Content Type. williamr@2: */ williamr@2: virtual void SetContentTypeL(const TDesC8& aContentType); williamr@2: williamr@2: /** williamr@2: * Gets the SoapAction. williamr@2: * @param aSoapAction A TPtrC8 reference to be filled in with the williamr@2: * value of the SoapAction. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt SoapActionL(TPtrC8& aSoapAction); williamr@2: williamr@2: /** williamr@2: * Sets the Soap Action. williamr@2: * @param aSoapAction is the new Soap Action. williamr@2: */ williamr@2: virtual void SetSoapActionL(const TDesC8& aSoapAction); williamr@2: williamr@2: /** williamr@2: * Gets the UserAgent. williamr@2: * @param aUserAgent A TPtrC8 reference to be filled in with the williamr@2: * value of the UserAgent. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt UserAgentL(TPtrC8& aUserAgent); williamr@2: williamr@2: /** williamr@2: * Sets the UserAgent. williamr@2: * @param aUserAgent is the new User Agent. williamr@2: */ williamr@2: virtual void SetUserAgentL(const TDesC8& aUserAgent); williamr@2: williamr@2: /** williamr@2: * Gets the Accept. williamr@2: * @param aAccept A TPtrC8 reference to be filled in with the williamr@2: * value of the Accept. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt AcceptL(TPtrC8& aAccept); williamr@2: williamr@2: /** williamr@2: * Sets the Accept. williamr@2: * @param aAccept is the new Accept value. williamr@2: */ williamr@2: virtual void SetAcceptL(const TDesC8& aAccept); williamr@2: williamr@2: /** williamr@2: * Gets the Http method. williamr@2: * @param aHttpMethod A TSenHttpMethod reference to be filled in with williamr@2: * the value of the Http method. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt HttpMethodL(TSenHttpMethod& aHttpMethod); williamr@2: williamr@2: /** williamr@2: * Sets the Http method. williamr@2: * @param aHttpMethod is the new Http method. williamr@2: */ williamr@2: virtual void SetHttpMethodL(TSenHttpMethod aHttpMethod); williamr@2: williamr@2: /** williamr@2: * Gets the Http version. williamr@2: * @param aHttpVersion A TSenHttpVersion reference to be filled in with williamr@2: * the value of the Http version. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt HttpVersionL(TSenHttpVersion& aHttpVersion); williamr@2: williamr@2: /** williamr@2: * Sets the Http version. williamr@2: * @param aHttpVersion is the new Http version. williamr@2: */ williamr@2: virtual void SetHttpVersionL(TSenHttpVersion aHttpVersion); williamr@2: williamr@2: /** williamr@2: * Gets the Http header. williamr@2: * @param aHeaderName Name of the Http header. williamr@2: * @param aValue A TPtrC8 reference to be filled in with the williamr@2: * value of the Http header. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt HttpHeaderL(const TDesC8& aHeaderName, TPtrC8& aValue); williamr@2: williamr@2: /** williamr@2: * Sets the Http header. williamr@2: * @param aHeaderName Name of the Http header. williamr@2: * @param aValue Value of the Http header williamr@2: */ williamr@2: virtual void SetHttpHeaderL(const TDesC8& aHeaderName, williamr@2: const TDesC8& aValue); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets the device ID williamr@2: * @param aDeviceID A TPtrC8 reference to be filled in with the williamr@2: * value of the Device ID. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt DeviceIDL(TPtrC8& aDeviceID); williamr@2: williamr@2: /** williamr@2: * Sets the Device ID. williamr@2: * @param aDeviceID is the new Device ID. williamr@2: */ williamr@2: virtual void SetDeviceIDL(const TDesC8& aDeviceID); williamr@2: williamr@2: /** williamr@2: * Gets download folder for incoming BLOB (binary large objects) williamr@2: * @param aDownloadFolder - A TPtrC8 reference to be filled in with the williamr@2: * value of the shared, public folder for downloaded williamr@2: * content williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt DownloadFolderL(TPtrC8& aDownloadFolder); williamr@2: williamr@2: /** williamr@2: * Sets download folder for incoming BLOB (binary large objects) williamr@2: * @param aDownloadFolder - shared, public folder for downloaded content williamr@2: */ williamr@2: virtual void SetDownloadFolderL(const TDesC8& aDownloadFolder); williamr@2: williamr@2: /** williamr@2: * Gets filename of file attachment williamr@2: * @param aCid - cid for filename williamr@2: * @param aFileName - filename of file attachment with current cid williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt FileAttachmentL(const TDesC8& aCid, HBufC8*& aFileName); williamr@2: williamr@2: /** williamr@2: * Sets filename of file attachment williamr@2: * @param aCid - cid for filename williamr@2: * @param aFileName - filename of file attachment with current cid williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt SetFileAttachmentL(const TDesC8& aCid, const TDesC8& aFileName); williamr@2: williamr@2: /** williamr@2: * Apply binding. williamr@2: * @param aSoapVersion is a soap1.2 or soap1.1. williamr@2: */ williamr@2: virtual void ApplyBindingL(TSOAPVersion aSoapVersion); williamr@2: williamr@2: /** williamr@2: * Gets namespace of Microsoft schema williamr@2: * @param aMwsNamespace - namespace williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt MwsNamespaceL(TPtrC8& aMwsNamespace); williamr@2: williamr@2: /** williamr@2: * Sets namespace of Microsoft schema williamr@2: * @param aMwsNamespace - namespace williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual void SetMwsNamespaceL(const TDesC8& aMwsNamespace); williamr@2: williamr@2: // From MSenProperties williamr@2: virtual void SetReader(CSenXmlReader& aReader); williamr@2: virtual TSenPropertiesClassType PropertiesClassType(); williamr@2: virtual void WriteToL(RWriteStream& aWriteStream); williamr@2: virtual void ReadFromL(const TDesC8& aBuffer); williamr@2: virtual HBufC8* AsUtf8L(); williamr@2: virtual HBufC8* AsUtf8LC(); williamr@2: virtual TBool IsSafeToCast(TSenPropertiesClassType aClass); williamr@2: virtual MSenProperties* CloneL() const; williamr@2: williamr@2: virtual TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue); williamr@2: virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue); williamr@2: virtual TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue, const TDesC8& aType); williamr@2: virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue, TPtrC8& aType); williamr@2: virtual TInt SetIntPropertyL(const TDesC8& aName, const TInt aValue); williamr@2: virtual TInt IntPropertyL(const TDesC8& aName, TInt& aValue); williamr@2: virtual TInt SetBoolPropertyL(const TDesC8& aName, const TBool aValue); williamr@2: virtual TInt BoolPropertyL(const TDesC8& aName, TBool& aValue); williamr@2: virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue); williamr@2: virtual TInt RemovePropertyL(const TDesC8& aName); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: virtual ~CSenHttpTransportProperties(); williamr@2: williamr@2: protected: // base class functions williamr@2: williamr@2: virtual void BaseConstructL(const TDesC8& aLocalname, williamr@2: const TDesC8& aXml, williamr@2: CSenXmlReader* aParser = NULL); williamr@2: williamr@2: virtual void BaseConstructL(const TDesC8& aNamespace, williamr@2: const TDesC8& aLocalname, williamr@2: const TDesC8& aXml, williamr@2: CSenXmlReader* aParser = NULL); williamr@2: williamr@2: virtual void BaseConstructL(const TDesC8& aNamespace, williamr@2: const TDesC8& aLocalname, williamr@2: const TDesC8& aQualifiedName, williamr@2: const TDesC8& aXml, williamr@2: CSenXmlReader* aParser = NULL); williamr@2: williamr@2: virtual void BaseConstructL(const CSenElement& aElement); williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Sets the SNAP ID. williamr@2: * @param aSnapId is the new SNAP ID. williamr@2: */ williamr@2: virtual void SetSnapIdL(TUint32 aSnapId); williamr@2: williamr@2: /** williamr@2: * Gets the SNAP ID. williamr@2: * @param aCurrentSnapId A TUint32 reference to be filled in with the williamr@2: * value of the SNAP ID. williamr@2: * @return KErrNone if no error, or some of the system williamr@2: * wide error codes. williamr@2: */ williamr@2: virtual TInt SnapIdL(TUint32& aCurrentSnapId); williamr@2: protected: williamr@2: /** williamr@2: * Constructor. williamr@2: */ williamr@2: CSenHttpTransportProperties(); williamr@2: private: williamr@2: HBufC8* AdaptDblQutesLC(const TDesC8& aValue); williamr@2: }; williamr@2: williamr@2: #endif // SEN_HTTP_TRANSPORT_PROPERTIES_H