williamr@2: /* williamr@2: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: This is the superclass interface for wider set of williamr@2: * concrete WSF message classes. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef M_SEN_MESSAGE_H williamr@2: #define M_SEN_MESSAGE_H williamr@2: williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CSenElement; williamr@2: class CSenXmlReader; williamr@2: williamr@2: //using namespace SenContext; williamr@2: williamr@2: // CONSTANTS williamr@2: //namespace SenContext // consider whether or not to declare new SenMessage c++ namespace williamr@2: // { williamr@2: // // Message class type enumeration for class casting: williamr@2: // } williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class MSenMessageContext; williamr@2: class MSenProperties; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * This is abstract interface defines set of WSF message classes, providing williamr@2: * convenience for other components, which typically cast this to some williamr@2: * subclass via IsSafeToCast() method. williamr@2: * @lib SenMessages.lib williamr@2: * @since Series60 4.0 williamr@2: */ williamr@2: class MSenMessage williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Class Enumeration williamr@2: */ williamr@2: enum TClass williamr@2: { williamr@2: EMessageBase = 0, williamr@2: EHttpGetMsg = 1, williamr@2: EHttpPostMsg = 2, williamr@2: EHttpPutMsg = 3, williamr@2: EHttpDeleteMsg = 4, williamr@2: ESoapEnvelope = 5, williamr@2: ESoapMessage = 6, williamr@2: ESoapEnvelope2 = 7, williamr@2: ESoapMessage2 = 8, williamr@2: ESoapMessageDom2 = 9, williamr@2: EAtomMessage = 10 williamr@2: }; williamr@2: /** williamr@2: * Direction Enumeration williamr@2: */ williamr@2: enum TDirection williamr@2: { williamr@2: EOutbound = 0, williamr@2: EInbound = 1 williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Gets the Message Type williamr@2: */ williamr@2: virtual TClass Type() = 0; williamr@2: /** williamr@2: * Gets the Message Direction williamr@2: */ williamr@2: virtual TDirection Direction() = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: * Sets message context for this message. If context already williamr@2: * exists, it is discarded and replaced by this context williamr@2: * (context reset is performed). williamr@2: * @param apNotOwnedContext is the context. williamr@2: * Ownership is NOT transferred to this message. williamr@2: * @return williamr@2: * KErrNone on success williamr@2: * KErrArgument if apOwnedContext == NULL williamr@2: * or system-wide errorcode otherwise. williamr@2: */ williamr@2: virtual TInt SetContext(MSenMessageContext* apNotOwnedContext) = 0; williamr@2: williamr@2: /** williamr@2: * Getter for message's context williamr@2: * @return message context, if this message relates to williamr@2: * (has associated with) such context, or NULL. williamr@2: */ williamr@2: virtual MSenMessageContext* Context() = 0; williamr@2: williamr@2: /** williamr@2: * Sets properties for this message. Most typical use case williamr@2: * is to set message spesific transport properties. williamr@2: * @param apOwnedProperties pointer to the properties, which williamr@2: * ownership is transferred to this class. This is performed williamr@2: * in two different manners: williamr@2: * williamr@2: * 1. If message has context, the properties are (re)set into that context, williamr@2: * discarding any pre-existing properties. williamr@2: * williamr@2: * 2. If context is NOT available, properties will be directly owned by williamr@2: * this message. williamr@2: * @return williamr@2: * KErrNone on success williamr@2: * KErrArgument if apOwnedProperties == NULL williamr@2: * or system-wide errorcode otherwise. williamr@2: */ williamr@2: virtual TInt SetProperties(MSenProperties* apOwnedProperties) = 0; williamr@2: williamr@2: /** williamr@2: * Getter for message specific (transport) properties williamr@2: * @return (transport) properties of this message, williamr@2: * if such have been applied to this message williamr@2: * or NULL otherwise. williamr@2: */ williamr@2: virtual MSenProperties* Properties() = 0; williamr@2: williamr@2: virtual TBool IsSafeToCast(TClass aType) = 0; williamr@2: /** williamr@2: * Getter for transaction ID of this message. williamr@2: * In case of receiving a response message from williamr@2: * service provider, this transaction ID may be williamr@2: * used to map the response with request that williamr@2: * the service consumer sent via service connection. williamr@2: * In such case, the consumer can store return williamr@2: * value from SendL method that was invoked in williamr@2: * order maintain this mapping. williamr@2: * @return the transaction ID of this message williamr@2: */ williamr@2: virtual TInt TxnId() = 0; williamr@2: williamr@2: /** williamr@2: * Clone method that duplicates this message williamr@2: * -- including all member data in the message. williamr@2: * For the service consumers, a typical use case williamr@2: * for cloning the message is when there is need williamr@2: * to preserve the received response beyond the williamr@2: * life time of a transaction. Normally, the williamr@2: * response messages, that are owned by service williamr@2: * connection are de-allocated after execution williamr@2: * returns from MSenServiceConsumer interface's williamr@2: * HandleMessageL or HandleErrorL method, back williamr@2: * to the service connection. williamr@2: * @return a pointer to a new message class instance, williamr@2: * which ownership IS transferred to a caller. Note williamr@2: * that caller is expected to cast this pointer to williamr@2: * a proper subclass via the use of IsSafeToCast williamr@2: * method. In case of responses, the message type williamr@2: * is normally equal with the type of the request williamr@2: * message that was sent by the consumer. williamr@2: */ williamr@2: virtual MSenMessage* CloneL() = 0; williamr@2: }; williamr@2: williamr@2: #endif // M_SEN_MESSAGE_H williamr@2: williamr@2: // End of File williamr@2: williamr@2: