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: Transport properties class declaration
21 #ifndef SEN_TRANSPORT_PROPERTIES_H
22 #define SEN_TRANSPORT_PROPERTIES_H
24 #include <SenXmlProperties.h>
25 #include <SenSoapEnvelope.h>
28 _LIT8( KIapIdLocalName, "IapId" );
29 _LIT8( KSnapIdLocalName, "SnapId" );
30 _LIT8( KProxyHostLocalName, "ProxyHost" );
31 _LIT8( KProxyPortLocalName, "ProxyPort" );
32 _LIT8( KProxyUsageLocalName, "ProxyUsage" );
33 _LIT8( KSecureDialogLocalName, "SecureDialog" );
34 _LIT8( KDeviceIDLocalName, "DeviceID" );
35 _LIT8( KSoapActionLocalName, "SOAPAction" );
36 _LIT8( KUserAgentLocalName, "User-Agent" );
37 _LIT8( KDownloadFolderLocalName, "DownloadFolder" );
38 _LIT8( KFileAttachmentsLocalName, "FileAttachments" );
39 _LIT8( KMwsNamespaceLocalName, "MwsNamespace" );
40 _LIT8( KSenClientGeneratedMessageId, "MessageID" );
41 _LIT8( KSenOnewayMessageOnOff, "OneWayMessage" );
43 _LIT8( KSenConnectionHeartbeat, "Heartbeat" );
44 _LIT8( KSenConnectionHeartbeatMaxTTL,"MaxTTL" );
45 _LIT8( KSenConnectionHeartbeatMinTTL,"MinTTL" );
46 _LIT8( KSenEndpointResource, "EndpointResource" );
47 _LIT8( KSenConnectionProxyUrl,"ProxyUrl" );
49 _LIT8( KNCIMConsumerKeyId, "ConsumerKeyId" );
50 _LIT8( KNCIMConsumerSecret, "ConsumerSecret" );
51 _LIT8( KNCIMConsumerServiceId, "ConsumerServiceId" );
52 _LIT8( KNCIMEndpoint, "NCIMEndpoint" );
53 _LIT8( KSenConnectionRetryDelta, "RetryDelta" );
54 _LIT8( KSenConnectionRetryMaxTTL, "RetryMaxTTL");
55 _LIT8( KSenConnectionRetryMinTTL, "RetryMinTTL");
56 _LIT8( KNCIMCountry, "mcc" );
60 * Use Bool property to hold value. You can use convenient methods SetBoolPropertyL/BoolPropertyL.
61 * Value ETrue - means NO dialog. If any problem occurs, then just an error is returned to the application.
62 * Value EFalse - system IAP dialog is shown if any problem occurs
64 _LIT8( KSenIAPDoNotPrompt, "IAPDoNotPrompt" );
65 _LIT8( KSenSNAPDoNotPrompt, "SNAPDoNotPrompt" );
67 // Property type attribute's name for HTTP headers:
68 _LIT8( KHttpHeaderType, "HttpHeader" );
69 _LIT8( KAttachmentFileType, "FileAttachment" );
71 /* Property type attribute's name for Deflate Filters:
72 Set this http transport property for the enabling of
73 http compression.Http data Compression works from
74 server to client side.
76 _LIT8( KWsPropertyValueHttpFilterDeflate, "HttpFilterDeflate" );
78 class CSenTransportProperties : public CSenXmlProperties
83 * @return a pointer to new CSenTransportProperties class instance.
85 IMPORT_C static CSenTransportProperties* NewL();
88 * @return a pointer to new CSenTransportProperties class instance.
90 IMPORT_C static CSenTransportProperties* NewLC();
95 * @param aParser It is a XML reader
96 * @return a pointer to new CSenTransportProperties class instance.
98 IMPORT_C static CSenTransportProperties* NewL(const TDesC8& aXmlUtf8,
99 CSenXmlReader& aParser);
103 * @param aParser It is a XML reader
104 * @return a pointer to new CSenTransportProperties class instance.
106 IMPORT_C static CSenTransportProperties* NewLC(const TDesC8& aXmlUtf8,
107 CSenXmlReader& aParser);
112 * @return a pointer to new CSenTransportProperties class instance.
114 IMPORT_C static CSenTransportProperties* NewL(const CSenElement& aElement);
118 * @return a pointer to new CSenTransportProperties class instance.
120 IMPORT_C static CSenTransportProperties* NewLC(const CSenElement& aElement);
122 // From MSenProperties
123 IMPORT_C virtual void SetReader(CSenXmlReader& aReader);
124 IMPORT_C virtual TSenPropertiesClassType PropertiesClassType();
125 IMPORT_C virtual void WriteToL(RWriteStream& aWriteStream);
126 IMPORT_C virtual void ReadFromL(const TDesC8& aBuffer);
127 IMPORT_C virtual HBufC8* AsUtf8L();
128 IMPORT_C virtual HBufC8* AsUtf8LC();
129 IMPORT_C virtual TInt SetPropertyL(const TDesC8& aName,
130 const TDesC8& aValue);
131 IMPORT_C virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue);
132 IMPORT_C virtual TInt SetIntPropertyL(const TDesC8& aName,
134 IMPORT_C virtual TInt IntPropertyL(const TDesC8& aName,
136 IMPORT_C virtual TInt SetBoolPropertyL(const TDesC8& aName,
138 IMPORT_C virtual TInt BoolPropertyL(const TDesC8& aName,
140 IMPORT_C virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue);
141 IMPORT_C virtual TInt RemovePropertyL(const TDesC8& aName);
142 IMPORT_C virtual TBool IsSafeToCast(TSenPropertiesClassType aClass);
143 IMPORT_C virtual MSenProperties* CloneL() const;
144 IMPORT_C virtual MSenProperties* Clone(TInt& aOkOrError) const;
149 IMPORT_C virtual ~CSenTransportProperties();
151 IMPORT_C virtual TInt SetPropertyL(const TDesC8& aName,
152 const TDesC8& aValue,
153 const TDesC8& aType);
155 IMPORT_C virtual TInt PropertyL(const TDesC8& aName,
160 * Gets the (connection) heartbeat property value as int.
161 * @param aDelta A TInt reference to be filled in with the
162 * value of the heartbeat (in seconds).
163 * Positive value means that a heartbeat
164 * messages are sent to backend, keeping
165 * the socket connection open (longlived
166 * connection). Keeping heartbeat may be
167 * costy, but increases performance in
168 * scenarios, where multiple network
169 * transactions take place within short
170 * period (time window).
171 * @return KErrNone if no error, or some of the system
173 * KErrNotFound if shortlive connection defined
175 IMPORT_C virtual TInt HeartbeatL(TInt& aDelta);
178 * Sets the (connection) heartbeat property value as int.
179 * Note, that with some transports, like vTCP, the heartbeat
180 * can also be used to control connection modes (longlive
181 * vs. shortlive connection).
182 * Hertbeat value is called also as delta.
184 * Together with delta You can also set parameters Min & Max TTL
185 * Long and short connection is set in different way, below guider.
187 * To setup longlive connection:
188 * delta : user defined
189 * min TTL : If not specified then the default value of 90 sec will be used
190 * max TTL : If not specified then the default value 1800 sec will be used
192 * To setup shortlive connection:
194 * min TTL : If not specified then the default value of 90 sec will be used
197 * So, providing a negative value
198 * (-1) can be utilized to disable heartbeat and to switch
199 * the connection mode to a short lived state. With vTCP
200 * transport, if heartbeat of -1 is set, the socket will be
201 * kept open only for effective timeout value (shortlived),
203 * @param aDelta TInt reference to be filled in with
204 * the value of the heartbeat (in seconds)
205 * @return KErrNone if no error, or some of the system
208 IMPORT_C virtual TInt SetHeartbeatL(TInt aDelta);
212 * @param aCurrentIapId A TUint32 reference to be filled in with the
213 * value of the IAP ID.
214 * @return KErrNone if no error, or some of the system
217 IMPORT_C virtual TInt IapIdL(TUint32& aCurrentIapId);
221 * @param aIapId is the new IAP ID.
223 IMPORT_C virtual void SetIapIdL(TUint32 aIapId);
226 * Gets the Proxy Port.
227 * @param aProxyPort A TInt reference to be filled in with the
228 * value of the Proxy Port.
229 * @return KErrNone if no error, or some of the system
232 IMPORT_C virtual TInt ProxyPortL(TInt& aProxyPort);
235 * Sets the Proxy Port.
236 * @param aProxyPort is the new Proxy Port.
238 IMPORT_C virtual void SetProxyPortL(TInt aProxyPort);
241 * Gets the Proxy Host.
242 * @param aProxyHost A TPtrC8 reference to be filled in with the
243 * value of the Proxy Host.
244 * @return KErrNone if no error, or some of the system
247 IMPORT_C virtual TInt ProxyHostL(TPtrC8& aProxyHost);
250 * Sets the Proxy Host.
251 * @param aProxyHost is the new Proxy Host.
253 IMPORT_C virtual void SetProxyHostL(const TDesC8& aProxyHost);
256 * Gets the Proxy Usage flag.
257 * @param aProxyUsage A TBool reference to be filled in with the
258 * value of the Proxy Usage.
259 * @return KErrNone if no error, or some of the system
262 IMPORT_C virtual TInt ProxyUsageL(TBool& aProxyUsage);
265 * Sets the Proxy Usage flag.
266 * @param aProxyUsage is the new value for Proxy Usage.
268 IMPORT_C virtual void SetProxyUsageL(TBool aProxyUsage);
271 * Gets the information if SecureDialog is shown or not.
272 * @param aProxyUsage A TBool reference to be filled in with the
273 * value of the SecureDialog flag.
274 * @return KErrNone if no error, or some of the system
277 IMPORT_C virtual TInt SecureDialogL(TBool& aSecureDialog);
280 * Sets the flag which controls showing of SecureDialog.
281 * @param aSecureDialog is the new value for SecureDialog flag.
283 IMPORT_C virtual void SetSecureDialogL(TBool aSecureDialog);
286 * Gets the information if IAPDialog is shown or not.
287 * @param aIAPDialog A TBool reference to be filled in with the
288 * value of the SecureDialog flag.
289 * @return KErrNone if no error, or some of the system
292 // IMPORT_C virtual TInt IAPDialogL(TBool& aIAPDialog);
295 * Sets the flag which controls showing of IAPDialog.
296 * @param aIAPDialog is the new value for IAPDialog flag.
298 // IMPORT_C virtual void SetIAPDialogL(TBool aIAPDialog);
301 * Gets the UserAgent.
302 * @param aUserAgent A TPtrC8 reference to be filled in with the
303 * value of the UserAgent.
304 * @return KErrNone if no error, or some of the system
307 IMPORT_C virtual TInt UserAgentL(TPtrC8& aUserAgent);
310 * Sets the UserAgent.
311 * @param aUserAgent is the new User Agent.
313 IMPORT_C virtual void SetUserAgentL(const TDesC8& aUserAgent);
317 * @param aDeviceID A TPtrC8 reference to be filled in with the
318 * value of the Device ID.
319 * @return KErrNone if no error, or some of the system
322 IMPORT_C virtual TInt DeviceIDL(TPtrC8& aDeviceID);
325 * Sets the Device ID.
326 * @param aDeviceID is the new Device ID.
328 IMPORT_C virtual void SetDeviceIDL(const TDesC8& aDeviceID);
331 * Gets the Action of message
332 * @param aAction A TPtrC8 reference to be filled in with the
333 * value of the Action.
334 * @return KErrNone if no error, or some of the system
337 IMPORT_C virtual TInt SoapActionL(TPtrC8& aAction);
341 * @param aAction is the new Soap Action.
343 IMPORT_C virtual void SetSoapActionL(const TDesC8& aAction);
347 * @param aSoapVersion is the version of Soap (1.1 or 1.2).
349 IMPORT_C virtual void ApplyBindingL(TSOAPVersion aSoapVersion);
352 * Gets download folder for incoming BLOB (binary large objects)
353 * @param aDownloadFolder - A TPtrC8 reference to be filled in with the
354 * value of the shared, public folder for downloaded
356 * @return KErrNone if no error, or some of the system
359 IMPORT_C virtual TInt DownloadFolderL(TPtrC8& aDownloadFolder);
362 * Sets download folder for incoming BLOB (binary large objects)
363 * @param aDownloadFolder shared, public folder for downloaded content
365 IMPORT_C virtual void SetDownloadFolderL(const TDesC8& aDownloadFolder);
368 * Gets filename of file attachment
369 * @param aCid - cid for filename
370 * @param aFileName - filename of file attachment with current cid
371 * @return KErrNone if no error, or some of the system
374 IMPORT_C virtual TInt FileAttachmentL(const TDesC8& aCid, HBufC8*& aFileName);
377 * Sets filename of file attachment
378 * @param aCid - cid for filename
379 * @param aFileName - filename of file attachment with current cid
380 * @return KErrNone if no error, or some of the system
383 IMPORT_C virtual TInt SetFileAttachmentL(const TDesC8& aCid, const TDesC8& aFileName);
386 * Gets namespace of Microsoft schema
387 * @param aMwsNamespace - namespace
388 * @return KErrNone if no error, or some of the system
391 IMPORT_C virtual TInt MwsNamespaceL(TPtrC8& aMwsNamespace);
394 * Sets namespace of Microsoft schema
395 * @param aMwsNamespace - namespace
396 * @return KErrNone if no error, or some of the system
399 IMPORT_C virtual void SetMwsNamespaceL(const TDesC8& aMwsNamespace);
404 * @param aMessageId - is the id of the message
405 * @return KErrNone if no error, or some of the system
408 IMPORT_C virtual TInt MessageIdL(TPtrC8& aMessageId);
411 * Sets message ID. Typically, this property is set per each message, instead of
412 * applying the same message ID for whole consumer session (service connection)
413 * @param aMessageID - is the ID of the message
414 * @return KErrNone if no error, or some of the system
417 IMPORT_C virtual void SetMessageIdL(const TDesC8& aMessageId);
420 * Gets one-way message mode.
421 * @param aOnewayMsgOnOff A TBool reference to be filled in with the
422 * value of the one-way message mode.
423 * @return KErrNone if no error, or some of the system
426 IMPORT_C virtual TInt OnewayMessageOnOffL(TBool& aOnewayMessageOnOff);
429 * Sets the one-way message mode on/off. Typically, one-way
430 * messages are rarely used by default: instead, a request-
431 * response pair (consumer[request]<->[response]provider)
432 * transaction takes place.
433 * However, if one-way message mode is enabled, sending such
434 * message will typically result immediate callback from
435 * the transport (plug-in) itself. This means, that the
436 * actual service response from the provider is not being
438 * Common use case to enable one-way message is when service
439 * connection is used in transmitting *responses* to notification
440 * request(s) that some remote consumer (from outside device) has
442 * Such notification requests may thus be received via hostlet
443 * connection (hc), and by enabling one-way message, once can reply
444 * via service connection, instead of calling hc->RespondL method.
445 * Furthermore, application might wish to enable one-way message
446 * mode to hostlet connection, if it is not interested of replying
447 * to these two-way notifications via hostlet connection, but wishes
448 * to use service connection instead.
449 * @param aOnewayMessageOnOff is the new value of one-way message mode.
451 IMPORT_C virtual void SetOnewayMessageOnOffL(TBool aOnewayMessageOnOff);
454 * Sets the (connection) Max TTL for longlive connection.
456 * @see SetHeartbeatL(TInt aDelta)
458 * @param aMaxTTL TInt reference to be filled in with
459 * the value of the max TTL (in seconds)
460 * @return KErrNone if no error, or some of the system
463 IMPORT_C virtual TInt SetMaxTimeToLiveL(TInt aMaxTTL);
466 * Gets the (connection) max TTL property value as int.
468 * @see SetHeartbeatL(TInt aDelta)
470 * @param aMaxTTL A TInt reference to be filled in with the
471 * value of the max TTL (in seconds).
473 * @return KErrNotFound if shortlive connection defined
474 * KErrNone if no error, or some of the system
477 IMPORT_C virtual TInt MaxTimeToLiveL(TInt& aMaxTTL);
480 * Sets the (connection) Min TTL
482 * @see SetHeartbeatL(TInt aDelta)
484 * @param aMaxTTL TInt reference to be filled in with
485 * the value of the min TTL (in seconds)
486 * @return KErrNone if no error, or some of the system
489 IMPORT_C virtual TInt SetMinTimeToLiveL(TInt aMinTTL);
492 * Gets the (connection) min TTL property value as int.
494 * @see SetHeartbeatL(TInt aDelta)
496 * @param aMinTTL A TInt reference to be filled in with the
497 * value of the min TTL (in seconds).
499 * @return KErrNone if no error, or some of the system
502 IMPORT_C virtual TInt MinTimeToLiveL(TInt& aMinTTL);
507 * Sets resource property value for endpoint
510 * @param aEndpointResource - is the suffix for endpoint
512 * @return KErrNone if no error, or some of the system
515 IMPORT_C virtual TInt SetEndpointResourceL(const TDesC8& aEndpointResource);
518 * Gets resource property value for endpoint
521 * @param aEndpointResource - is the suffix for endpoint
524 * @return KErrNone if no error, or some of the system
527 IMPORT_C virtual TInt EndpointResourceL(TPtrC8& aEndpointResource);
530 protected: // base class functions
532 IMPORT_C virtual void BaseConstructL(const TDesC8& aLocalname,
534 CSenXmlReader* aParser = NULL);
536 IMPORT_C virtual void BaseConstructL(const TDesC8& aNamespace,
537 const TDesC8& aLocalname,
539 CSenXmlReader* aParser = NULL);
541 IMPORT_C virtual void BaseConstructL(const TDesC8& aNamespace,
542 const TDesC8& aLocalname,
543 const TDesC8& aQualifiedName,
545 CSenXmlReader* aParser = NULL);
547 IMPORT_C virtual void BaseConstructL(const CSenElement& aElement);
552 * @param aSnapId is the new SNAP ID.
554 IMPORT_C void SetSnapIdL(TUint32 aSnapId);
558 * @param aCurrentSnapId A TUint32 reference to be filled in with the
559 * value of the SNAP ID.
560 * @return KErrNone if no error, or some of the system
563 IMPORT_C TInt SnapIdL(TUint32& aCurrentSnapId);
568 IMPORT_C CSenTransportProperties();
571 TInt iFileAttachmentNum;
574 #endif // SEN_TRANSPORT_PROPERTIES_H