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 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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Transport properties class declaration
18 #ifndef SEN_TRANSPORT_PROPERTIES_H
19 #define SEN_TRANSPORT_PROPERTIES_H
21 #include <SenXmlProperties.h>
22 #include <SenSoapEnvelope.h>
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" );
40 _LIT8( KSenConnectionHeartbeat, "Heartbeat" );
41 _LIT8( KSenConnectionHeartbeatMaxTTL,"MaxTTL" );
42 _LIT8( KSenConnectionHeartbeatMinTTL,"MinTTL" );
43 _LIT8( KSenEndpointResource, "EndpointResource" );
45 _LIT8( KNCIMConsumerKeyId, "ConsumerKeyId" );
46 _LIT8( KNCIMConsumerSecret, "ConsumerSecret" );
47 _LIT8( KNCIMConsumerServiceId, "ConsumerServiceId" );
48 _LIT8( KNCIMEndpoint, "NCIMEndpoint" );
49 _LIT8( KNCIMCountry, "mcc" );
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
57 _LIT8( KSenIAPDoNotPrompt, "IAPDoNotPrompt" );
58 _LIT8( KSenSNAPDoNotPrompt, "SNAPDoNotPrompt" );
60 // Property type attribute's name for HTTP headers:
61 _LIT8( KHttpHeaderType, "HttpHeader" );
62 _LIT8( KAttachmentFileType, "FileAttachment" );
64 class CSenTransportProperties : public CSenXmlProperties
69 * @return a pointer to new CSenTransportProperties class instance.
71 IMPORT_C static CSenTransportProperties* NewL();
74 * @return a pointer to new CSenTransportProperties class instance.
76 IMPORT_C static CSenTransportProperties* NewLC();
81 * @param aParser It is a XML reader
82 * @return a pointer to new CSenTransportProperties class instance.
84 IMPORT_C static CSenTransportProperties* NewL(const TDesC8& aXmlUtf8,
85 CSenXmlReader& aParser);
89 * @param aParser It is a XML reader
90 * @return a pointer to new CSenTransportProperties class instance.
92 IMPORT_C static CSenTransportProperties* NewLC(const TDesC8& aXmlUtf8,
93 CSenXmlReader& aParser);
98 * @return a pointer to new CSenTransportProperties class instance.
100 IMPORT_C static CSenTransportProperties* NewL(const CSenElement& aElement);
104 * @return a pointer to new CSenTransportProperties class instance.
106 IMPORT_C static CSenTransportProperties* NewLC(const CSenElement& aElement);
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,
120 IMPORT_C virtual TInt IntPropertyL(const TDesC8& aName,
122 IMPORT_C virtual TInt SetBoolPropertyL(const TDesC8& aName,
124 IMPORT_C virtual TInt BoolPropertyL(const TDesC8& aName,
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;
135 IMPORT_C virtual ~CSenTransportProperties();
137 IMPORT_C virtual TInt SetPropertyL(const TDesC8& aName,
138 const TDesC8& aValue,
139 const TDesC8& aType);
141 IMPORT_C virtual TInt PropertyL(const TDesC8& aName,
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
159 * KErrNotFound if shortlive connection defined
161 IMPORT_C virtual TInt HeartbeatL(TInt& aDelta);
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.
170 * Together with delta You can also set parameters Min & Max TTL
171 * Long and short connection is set in different way, below guider.
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
178 * To setup shortlive connection:
180 * min TTL : If not specified then the default value of 90 sec will be used
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),
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
194 IMPORT_C virtual TInt SetHeartbeatL(TInt aDelta);
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
203 IMPORT_C virtual TInt IapIdL(TUint32& aCurrentIapId);
207 * @param aIapId is the new IAP ID.
209 IMPORT_C virtual void SetIapIdL(TUint32 aIapId);
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
218 IMPORT_C virtual TInt ProxyPortL(TInt& aProxyPort);
221 * Sets the Proxy Port.
222 * @param aProxyPort is the new Proxy Port.
224 IMPORT_C virtual void SetProxyPortL(TInt aProxyPort);
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
233 IMPORT_C virtual TInt ProxyHostL(TPtrC8& aProxyHost);
236 * Sets the Proxy Host.
237 * @param aProxyHost is the new Proxy Host.
239 IMPORT_C virtual void SetProxyHostL(const TDesC8& aProxyHost);
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
248 IMPORT_C virtual TInt ProxyUsageL(TBool& aProxyUsage);
251 * Sets the Proxy Usage flag.
252 * @param aProxyUsage is the new value for Proxy Usage.
254 IMPORT_C virtual void SetProxyUsageL(TBool aProxyUsage);
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
263 IMPORT_C virtual TInt SecureDialogL(TBool& aSecureDialog);
266 * Sets the flag which controls showing of SecureDialog.
267 * @param aSecureDialog is the new value for SecureDialog flag.
269 IMPORT_C virtual void SetSecureDialogL(TBool aSecureDialog);
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
278 // IMPORT_C virtual TInt IAPDialogL(TBool& aIAPDialog);
281 * Sets the flag which controls showing of IAPDialog.
282 * @param aIAPDialog is the new value for IAPDialog flag.
284 // IMPORT_C virtual void SetIAPDialogL(TBool aIAPDialog);
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
293 IMPORT_C virtual TInt UserAgentL(TPtrC8& aUserAgent);
296 * Sets the UserAgent.
297 * @param aUserAgent is the new User Agent.
299 IMPORT_C virtual void SetUserAgentL(const TDesC8& aUserAgent);
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
308 IMPORT_C virtual TInt DeviceIDL(TPtrC8& aDeviceID);
311 * Sets the Device ID.
312 * @param aDeviceID is the new Device ID.
314 IMPORT_C virtual void SetDeviceIDL(const TDesC8& aDeviceID);
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
323 IMPORT_C virtual TInt SoapActionL(TPtrC8& aAction);
327 * @param aAction is the new Soap Action.
329 IMPORT_C virtual void SetSoapActionL(const TDesC8& aAction);
333 * @param aSoapVersion is the version of Soap (1.1 or 1.2).
335 IMPORT_C virtual void ApplyBindingL(TSOAPVersion aSoapVersion);
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
342 * @return KErrNone if no error, or some of the system
345 IMPORT_C virtual TInt DownloadFolderL(TPtrC8& aDownloadFolder);
348 * Sets download folder for incoming BLOB (binary large objects)
349 * @param aDownloadFolder shared, public folder for downloaded content
351 IMPORT_C virtual void SetDownloadFolderL(const TDesC8& aDownloadFolder);
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
360 IMPORT_C virtual TInt FileAttachmentL(const TDesC8& aCid, HBufC8*& aFileName);
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
369 IMPORT_C virtual TInt SetFileAttachmentL(const TDesC8& aCid, const TDesC8& aFileName);
372 * Gets namespace of Microsoft schema
373 * @param aMwsNamespace - namespace
374 * @return KErrNone if no error, or some of the system
377 IMPORT_C virtual TInt MwsNamespaceL(TPtrC8& aMwsNamespace);
380 * Sets namespace of Microsoft schema
381 * @param aMwsNamespace - namespace
382 * @return KErrNone if no error, or some of the system
385 IMPORT_C virtual void SetMwsNamespaceL(const TDesC8& aMwsNamespace);
390 * @param aMessageId - is the id of the message
391 * @return KErrNone if no error, or some of the system
394 IMPORT_C virtual TInt MessageIdL(TPtrC8& aMessageId);
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
403 IMPORT_C virtual void SetMessageIdL(const TDesC8& aMessageId);
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
412 IMPORT_C virtual TInt OnewayMessageOnOffL(TBool& aOnewayMessageOnOff);
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
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
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.
437 IMPORT_C virtual void SetOnewayMessageOnOffL(TBool aOnewayMessageOnOff);
440 * Sets the (connection) Max TTL for longlive connection.
442 * @see SetHeartbeatL(TInt aDelta)
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
449 IMPORT_C virtual TInt SetMaxTimeToLiveL(TInt aMaxTTL);
452 * Gets the (connection) max TTL property value as int.
454 * @see SetHeartbeatL(TInt aDelta)
456 * @param aMaxTTL A TInt reference to be filled in with the
457 * value of the max TTL (in seconds).
459 * @return KErrNotFound if shortlive connection defined
460 * KErrNone if no error, or some of the system
463 IMPORT_C virtual TInt MaxTimeToLiveL(TInt& aMaxTTL);
466 * Sets the (connection) Min TTL
468 * @see SetHeartbeatL(TInt aDelta)
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
475 IMPORT_C virtual TInt SetMinTimeToLiveL(TInt aMinTTL);
478 * Gets the (connection) min TTL property value as int.
480 * @see SetHeartbeatL(TInt aDelta)
482 * @param aMinTTL A TInt reference to be filled in with the
483 * value of the min TTL (in seconds).
485 * @return KErrNone if no error, or some of the system
488 IMPORT_C virtual TInt MinTimeToLiveL(TInt& aMinTTL);
493 * Sets resource property value for endpoint
496 * @param aEndpointResource - is the suffix for endpoint
498 * @return KErrNone if no error, or some of the system
501 IMPORT_C virtual TInt SetEndpointResourceL(const TDesC8& aEndpointResource);
504 * Gets resource property value for endpoint
507 * @param aEndpointResource - is the suffix for endpoint
510 * @return KErrNone if no error, or some of the system
513 IMPORT_C virtual TInt EndpointResourceL(TPtrC8& aEndpointResource);
516 protected: // base class functions
518 IMPORT_C virtual void BaseConstructL(const TDesC8& aLocalname,
520 CSenXmlReader* aParser = NULL);
522 IMPORT_C virtual void BaseConstructL(const TDesC8& aNamespace,
523 const TDesC8& aLocalname,
525 CSenXmlReader* aParser = NULL);
527 IMPORT_C virtual void BaseConstructL(const TDesC8& aNamespace,
528 const TDesC8& aLocalname,
529 const TDesC8& aQualifiedName,
531 CSenXmlReader* aParser = NULL);
533 IMPORT_C virtual void BaseConstructL(const CSenElement& aElement);
538 * @param aSnapId is the new SNAP ID.
540 IMPORT_C void SetSnapIdL(TUint32 aSnapId);
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
549 IMPORT_C TInt SnapIdL(TUint32& aCurrentSnapId);
554 IMPORT_C CSenTransportProperties();
557 TInt iFileAttachmentNum;
560 #endif // SEN_TRANSPORT_PROPERTIES_H