williamr@2: /* williamr@2: * Copyright (c) 2002-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@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: Hostlet call back interface williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef M_SEN_HOSTLET_H williamr@2: #define M_SEN_HOSTLET_H williamr@2: williamr@2: // INCLUDES williamr@2: #include // for CBase williamr@2: #include williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARE williamr@2: williamr@2: // CLASS DECLARATION williamr@2: class MSenHostlet williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Main method for receiving incoming messages, which are typically SOAP / XML, williamr@2: * and for providing service for these requests. williamr@2: * @param aRequestUtf8 the request that needs to be be processed by the williamr@2: * hostlet application (local service provider). williamr@2: * @param aResponse is where response data is to be set. williamr@2: * CSenHostletConnection::ResponsdL should be called williamr@2: * in order to send the response back to the requester williamr@2: * (service consumer). williamr@2: */ williamr@2: virtual TInt ServiceL(MSenHostletRequest& aRequest, MSenHostletResponse& aResponse) = 0; williamr@2: williamr@2: /** williamr@2: * Defines the service endpoint for this hostlet williamr@2: * @return endpoint that this hostlet has specified. If hostlet williamr@2: * implementation does not wish to define any endpoint, but to williamr@2: * use contract only, it should return KNullDesC8 (zero-length descriptor). williamr@2: * In such case, CSenHostletConnection constructor will attempt to resolve williamr@2: * secure identifier (UID3) of the application, and use that to generate williamr@2: * a locally unique endpoint. If the UID3 is not available, then the williamr@2: * constructor of CSenHostletConnection will leave with the following williamr@2: * error code: KErrSenNoContractNoEndPoint williamr@2: * williamr@2: * Note: Hostlets, which don't provide endpoint and don't have UID3, cannot williamr@2: * create hostlet connection: instead, CSenHostletConnection constructor williamr@2: * will leave with the following code: KErrSenNoContractNoEndPoint williamr@2: * williamr@2: * If endpoint is not specified, hostlet connection itself williamr@2: * will generate an endpoint from applications secure ID (UID3) if such is available, williamr@2: * and consumers can invoke the service via the provided contract ("service type" williamr@2: * identifier). williamr@2: * williamr@2: */ williamr@2: virtual TPtrC8 Endpoint() const = 0; williamr@2: williamr@2: /** williamr@2: * Defines the service constract URI for this hostlet williamr@2: * @return the URI identifier for the provided service, for example williamr@2: * "urn:liberty:id-sis-pp:2003-08". Note that there might be multiple williamr@2: * hostlets (local service providers) which all share common service williamr@2: * type, that is, they all have same service contract URI. williamr@2: * williamr@2: * Note: Hostlets, which don't provide endpoint and don't have UID3, cannot williamr@2: * create hostlet connection: instead, CSenHostletConnection constructor williamr@2: * will leave with the following error code: KErrSenNoContractNoEndPoint williamr@2: */ williamr@2: virtual TPtrC8 Contract() const = 0; williamr@2: williamr@2: /** williamr@2: * Defines the framework for this hostlet. williamr@2: * @return the framework ID. Default inline implementation williamr@2: * returns RESTful service invocation framework ID, williamr@2: * KDefaultRestServicesFrameworkID, as defined in SenServiceConnection.h williamr@2: */ williamr@2: inline virtual TPtrC8 FrameworkId() const { return KDefaultRestServicesFrameworkID(); } williamr@2: williamr@2: /** williamr@2: * Each Hostlet implementation may further describes its service via this callback. williamr@2: * @param aSD is the description, where service specific attributes can be defined. williamr@2: * Default, inline implementation sets the endpoint, contract and framework ID williamr@2: * by calling the other, more simple callbacks. williamr@2: * williamr@2: * It is mandatory for each hostlet to define either endpoint or contract. williamr@2: * Otherwise, the constuctor of CSenHostletConnection will leave with the williamr@2: * following error code: williamr@2: * KErrSenNoContractNoEndPoint - neither endpoint or contract was williamr@2: * specified. This is illegal, since the service would lack an identifier. williamr@2: * williamr@2: * @param aSD is the service description into which this hostlet may further williamr@2: * define other service specific information, like facets. Note that this williamr@2: * call back is "stronger" than Endpoint() and Contract(), and thus any williamr@2: * value specified in this method will be in effect for the hostlet connection. williamr@2: */ williamr@2: inline virtual void DescribeServiceL(CSenXmlServiceDescription& aSD) williamr@2: { williamr@2: aSD.SetEndPointL(Endpoint()); williamr@2: aSD.SetContractL(Contract()); williamr@2: aSD.SetFrameworkIdL(FrameworkId()); williamr@2: } williamr@2: williamr@2: /** williamr@2: * This callback function is invoked each time when any hostlet connection's williamr@2: * asynchronous RespondL is completed. Method can be used to trigger the williamr@2: * release of some response releated system resources, as it is invoked williamr@2: * after the response has been delivered to the consumer (application williamr@2: * may wish to close handles to reserved file or memory). williamr@2: * williamr@2: * @param aTxnId identifies what transaction (service message) was completed williamr@2: * @param aCompletionCode indicates whether transaction completed ok (KErrNone) williamr@2: * or not (error code). williamr@2: * @param aDesc may provide additional information about completed transaction, williamr@2: * typically this description is provided, if an error has occured. williamr@2: * It is optional for hostlet implementation to implement this method. williamr@2: */ williamr@2: inline virtual void OnServiceCompleteL(TInt /* aTxnId */, williamr@2: TInt /* aCompletionCode */, williamr@2: const TDesC8& /* aDesc*/ ) { ; } williamr@2: williamr@2: /** williamr@2: * Hostlet connection calls this method several times, passing a different williamr@2: * UID per each call. If application wants to provide particular interface williamr@2: * to hostlet connection (web services stack), it needs to return a pointer williamr@2: * to such M-class as a return value of this method. For any interface, that williamr@2: * application has not implemented, it is supposed to return NULL. williamr@2: * @param aUID is the unique identifier of some interface williamr@2: * @return value should be a valid (void) pointer to any interface implemented williamr@2: * by the application. NULL signalizes that application does not provide interface williamr@2: * for give UID. williamr@2: */ williamr@2: inline virtual TAny* GetInterfaceByUid( TUid /* aUID */ ) { return NULL; }; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // M_SEN_HOSTLET_H williamr@2: williamr@2: // End of File