2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Http transport properties class declaration
18 #ifndef SEN_HTTP_TRANSPORT_PROPERTIES_H
19 #define SEN_HTTP_TRANSPORT_PROPERTIES_H
22 #include <SenTransportProperties.h>
25 _LIT8(KSenHttpAcceptHeaderDelimiter, ",");
27 // Supported Http properties:
29 //// -- session properties:
30 _LIT8(KHttpMethodLocalName, "HttpMethod");
31 _LIT8(KHttpVersionLocalName, "HttpVersion");
33 //// -- HTTP headers names:
34 _LIT8(KContentTypeLocalName, "Content-Type");
35 _LIT8(KAcceptLocalName, "Accept");
36 _LIT8(KSlugLocalName, "Slug");
38 // Supported Http methods:
39 _LIT8(KHttpGet, "Get");
40 _LIT8(KHttpPost, "Post");
41 _LIT8(KHttpPut, "Put");
42 _LIT8(KHttpDelete, "Delete");
44 // Supported Http versions:
45 _LIT8(KHttp10, "Http1.0");
46 _LIT8(KHttp11, "Http1.1");
49 /** In SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties)
51 * SubmitL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties, HBufc8*& aResponseTO)
52 * aProperties could be "HTTP GET" or "HTTP DELETE"
53 * aMessage is a soap message or serialized XML.
54 * This scenario is not supported.
56 * These are the function calls get called during this scenario
57 * iHttpProperties->SetHttpHeaderL(const TDesC8& aHeaderName, const TDesC8& aValue);
58 * iHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpGet);
59 * SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties);
63 class CSenHttpTransportProperties : public CSenTransportProperties
67 * HttpMethod Enumeration
77 * HttpVersion Enumeration
86 * @return a pointer to new CSenHttpTransportProperties class instance.
88 IMPORT_C static CSenHttpTransportProperties* NewL();
91 * @return a pointer to new CSenHttpTransportProperties class instance.
93 IMPORT_C static CSenHttpTransportProperties* NewLC();
98 * @param aParser It is a XML reader
99 * @return a pointer to new CSenHttpTransportProperties class instance.
101 IMPORT_C static CSenHttpTransportProperties* NewL(const TDesC8& aXmlUtf8,
102 CSenXmlReader& aParser);
107 * @param aParser It is a XML reader
108 * @return a pointer to new CSenHttpTransportProperties class instance.
110 IMPORT_C static CSenHttpTransportProperties* NewLC(const TDesC8& aXmlUtf8,
111 CSenXmlReader& aParser);
116 * @return a pointer to new CSenHttpTransportProperties class instance.
118 IMPORT_C static CSenHttpTransportProperties* NewL(const CSenElement& aElement);
122 * @return a pointer to new CSenHttpTransportProperties class instance.
124 IMPORT_C static CSenHttpTransportProperties* NewLC(const CSenElement& aElement);
128 * @param aCurrentIapId A TUint32 reference to be filled in with the
129 * value of the IAP ID.
130 * @return KErrNone if no error, or some of the system
133 virtual TInt IapIdL(TUint32& aCurrentIapId);
137 * @param aIapId is the new IAP ID.
139 virtual void SetIapIdL(TUint32 aIapId);
142 * Gets the Proxy Port.
143 * @param aProxyPort A TInt reference to be filled in with the
144 * value of the Proxy Port.
145 * @return KErrNone if no error, or some of the system
148 virtual TInt ProxyPortL(TInt& aProxyPort);
151 * Sets the Proxy Port.
152 * @param aProxyPort is the new Proxy Port.
154 virtual void SetProxyPortL(TInt aProxyPort);
157 * Gets the Proxy Host.
158 * @param aProxyHost A TPtrC8 reference to be filled in with the
159 * value of the Proxy Host.
160 * @return KErrNone if no error, or some of the system
163 virtual TInt ProxyHostL(TPtrC8& aProxyHost);
166 * Sets the Proxy Host.
167 * @param aProxyHost is the new Proxy Host.
169 virtual void SetProxyHostL(const TDesC8& aProxyHost);
172 * Gets the Proxy Usage flag.
173 * @param aProxyUsage A TBool reference to be filled in with the
174 * value of the Proxy Usage.
175 * @return KErrNone if no error, or some of the system
178 virtual TInt ProxyUsageL(TBool& aProxyUsage);
181 * Sets the Proxy Usage flag.
182 * @param aProxyUsage is the new value for Proxy Usage.
184 virtual void SetProxyUsageL(TBool aProxyUsage);
187 * Gets the information if SecureDialog is shown or not.
188 * @param aProxyUsage A TBool reference to be filled in with the
189 * value of the SecureDialog flag.
190 * @return KErrNone if no error, or some of the system
193 virtual TInt SecureDialogL(TBool& aSecureDialog);
196 * Sets the flag which controls showing of SecureDialog.
197 * @param aSecureDialog is the new value for SecureDialog flag.
199 virtual void SetSecureDialogL(TBool aSecureDialog);
202 * Gets the information if IAPDialog is shown or not.
203 * @param aIAPDialog A TBool reference to be filled in with the
204 * value of the IAPDialog flag.
205 * @return KErrNone if no error, or some of the system
208 // virtual TInt IAPDialogL(TBool& aIAPDialog);
211 * Sets the flag which controls showing of IAPDialog.
212 * @param aIAPDialog is the new value for IAPDialog flag.
214 // virtual void SetIAPDialogL(TBool aIAPDialog);
217 * Gets the Content Type.
218 * @param aContentType A TPtrC8 reference to be filled in with the
219 * value of the Content Type.
220 * @return KErrNone if no error, or some of the system
223 virtual TInt ContentTypeL(TPtrC8& aContentType);
226 * Sets the Content Type.
227 * @param aContentType is the new Content Type.
229 virtual void SetContentTypeL(const TDesC8& aContentType);
232 * Gets the SoapAction.
233 * @param aSoapAction A TPtrC8 reference to be filled in with the
234 * value of the SoapAction.
235 * @return KErrNone if no error, or some of the system
238 virtual TInt SoapActionL(TPtrC8& aSoapAction);
241 * Sets the Soap Action.
242 * @param aSoapAction is the new Soap Action.
244 virtual void SetSoapActionL(const TDesC8& aSoapAction);
247 * Gets the UserAgent.
248 * @param aUserAgent A TPtrC8 reference to be filled in with the
249 * value of the UserAgent.
250 * @return KErrNone if no error, or some of the system
253 virtual TInt UserAgentL(TPtrC8& aUserAgent);
256 * Sets the UserAgent.
257 * @param aUserAgent is the new User Agent.
259 virtual void SetUserAgentL(const TDesC8& aUserAgent);
263 * @param aAccept A TPtrC8 reference to be filled in with the
264 * value of the Accept.
265 * @return KErrNone if no error, or some of the system
268 virtual TInt AcceptL(TPtrC8& aAccept);
272 * @param aAccept is the new Accept value.
274 virtual void SetAcceptL(const TDesC8& aAccept);
277 * Gets the Http method.
278 * @param aHttpMethod A TSenHttpMethod reference to be filled in with
279 * the value of the Http method.
280 * @return KErrNone if no error, or some of the system
283 virtual TInt HttpMethodL(TSenHttpMethod& aHttpMethod);
286 * Sets the Http method.
287 * @param aHttpMethod is the new Http method.
289 virtual void SetHttpMethodL(TSenHttpMethod aHttpMethod);
292 * Gets the Http version.
293 * @param aHttpVersion A TSenHttpVersion reference to be filled in with
294 * the value of the Http version.
295 * @return KErrNone if no error, or some of the system
298 virtual TInt HttpVersionL(TSenHttpVersion& aHttpVersion);
301 * Sets the Http version.
302 * @param aHttpVersion is the new Http version.
304 virtual void SetHttpVersionL(TSenHttpVersion aHttpVersion);
307 * Gets the Http header.
308 * @param aHeaderName Name of the Http header.
309 * @param aValue A TPtrC8 reference to be filled in with the
310 * value of the Http header.
311 * @return KErrNone if no error, or some of the system
314 virtual TInt HttpHeaderL(const TDesC8& aHeaderName, TPtrC8& aValue);
317 * Sets the Http header.
318 * @param aHeaderName Name of the Http header.
319 * @param aValue Value of the Http header
321 virtual void SetHttpHeaderL(const TDesC8& aHeaderName,
322 const TDesC8& aValue);
327 * @param aDeviceID A TPtrC8 reference to be filled in with the
328 * value of the Device ID.
329 * @return KErrNone if no error, or some of the system
332 virtual TInt DeviceIDL(TPtrC8& aDeviceID);
335 * Sets the Device ID.
336 * @param aDeviceID is the new Device ID.
338 virtual void SetDeviceIDL(const TDesC8& aDeviceID);
341 * Gets download folder for incoming BLOB (binary large objects)
342 * @param aDownloadFolder - A TPtrC8 reference to be filled in with the
343 * value of the shared, public folder for downloaded
345 * @return KErrNone if no error, or some of the system
348 virtual TInt DownloadFolderL(TPtrC8& aDownloadFolder);
351 * Sets download folder for incoming BLOB (binary large objects)
352 * @param aDownloadFolder - shared, public folder for downloaded content
354 virtual void SetDownloadFolderL(const TDesC8& aDownloadFolder);
357 * Gets filename of file attachment
358 * @param aCid - cid for filename
359 * @param aFileName - filename of file attachment with current cid
360 * @return KErrNone if no error, or some of the system
363 virtual TInt FileAttachmentL(const TDesC8& aCid, HBufC8*& aFileName);
366 * Sets filename of file attachment
367 * @param aCid - cid for filename
368 * @param aFileName - filename of file attachment with current cid
369 * @return KErrNone if no error, or some of the system
372 virtual TInt SetFileAttachmentL(const TDesC8& aCid, const TDesC8& aFileName);
376 * @param aSoapVersion is a soap1.2 or soap1.1.
378 virtual void ApplyBindingL(TSOAPVersion aSoapVersion);
381 * Gets namespace of Microsoft schema
382 * @param aMwsNamespace - namespace
383 * @return KErrNone if no error, or some of the system
386 virtual TInt MwsNamespaceL(TPtrC8& aMwsNamespace);
389 * Sets namespace of Microsoft schema
390 * @param aMwsNamespace - namespace
391 * @return KErrNone if no error, or some of the system
394 virtual void SetMwsNamespaceL(const TDesC8& aMwsNamespace);
396 // From MSenProperties
397 virtual void SetReader(CSenXmlReader& aReader);
398 virtual TSenPropertiesClassType PropertiesClassType();
399 virtual void WriteToL(RWriteStream& aWriteStream);
400 virtual void ReadFromL(const TDesC8& aBuffer);
401 virtual HBufC8* AsUtf8L();
402 virtual HBufC8* AsUtf8LC();
403 virtual TBool IsSafeToCast(TSenPropertiesClassType aClass);
404 virtual MSenProperties* CloneL() const;
406 virtual TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue);
407 virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue);
408 virtual TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue, const TDesC8& aType);
409 virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue, TPtrC8& aType);
410 virtual TInt SetIntPropertyL(const TDesC8& aName, const TInt aValue);
411 virtual TInt IntPropertyL(const TDesC8& aName, TInt& aValue);
412 virtual TInt SetBoolPropertyL(const TDesC8& aName, const TBool aValue);
413 virtual TInt BoolPropertyL(const TDesC8& aName, TBool& aValue);
414 virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue);
415 virtual TInt RemovePropertyL(const TDesC8& aName);
420 virtual ~CSenHttpTransportProperties();
422 protected: // base class functions
424 virtual void BaseConstructL(const TDesC8& aLocalname,
426 CSenXmlReader* aParser = NULL);
428 virtual void BaseConstructL(const TDesC8& aNamespace,
429 const TDesC8& aLocalname,
431 CSenXmlReader* aParser = NULL);
433 virtual void BaseConstructL(const TDesC8& aNamespace,
434 const TDesC8& aLocalname,
435 const TDesC8& aQualifiedName,
437 CSenXmlReader* aParser = NULL);
439 virtual void BaseConstructL(const CSenElement& aElement);
444 * @param aSnapId is the new SNAP ID.
446 virtual void SetSnapIdL(TUint32 aSnapId);
450 * @param aCurrentSnapId A TUint32 reference to be filled in with the
451 * value of the SNAP ID.
452 * @return KErrNone if no error, or some of the system
455 virtual TInt SnapIdL(TUint32& aCurrentSnapId);
460 CSenHttpTransportProperties();
462 HBufC8* AdaptDblQutesLC(const TDesC8& aValue);
465 #endif // SEN_HTTP_TRANSPORT_PROPERTIES_H