1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sipservertransaction.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,190 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Name : sipservertransaction.h
1.19 +* Part of : SIP Client
1.20 +* Interface : SDK API, SIP API
1.21 +* Version : 1.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +#ifndef CSIPSERVERTRANSACTION_H
1.28 +#define CSIPSERVERTRANSACTION_H
1.29 +
1.30 +// INCLUDES
1.31 +#include "siptransactionbase.h"
1.32 +
1.33 +// FORWARD DECLARATIONS
1.34 +class CSIPRequestElements;
1.35 +class MSIPResponseSender;
1.36 +class CSIPConnection;
1.37 +class CSIPDialogImplementation;
1.38 +
1.39 +// CLASS DECLARATION
1.40 +
1.41 +/**
1.42 +* @publishedAll
1.43 +* @released
1.44 +*
1.45 +* Class for managing SIP server transactions.
1.46 +* It provides services for creating, ending
1.47 +* and getting SIP transaction parameters.
1.48 +* Client cannot instantiate this class.
1.49 +*
1.50 +* @lib sipclient
1.51 +*/
1.52 +class CSIPServerTransaction: public CSIPTransactionBase
1.53 + {
1.54 + public: // Destructor
1.55 +
1.56 + /**
1.57 + * Destructor
1.58 + */
1.59 + IMPORT_C ~CSIPServerTransaction();
1.60 +
1.61 + public: // New functions
1.62 +
1.63 + /**
1.64 + * Sends response and ends the transaction;
1.65 + * The user must not send 100 Trying response. Leaves on failure.
1.66 + * @pre aElements!=0
1.67 + * @pre State()==ETrying || State()==EProceeding
1.68 + * @pre CSIPConnection::State()==EActive
1.69 + * @pre ResponseAllowed()==ETrue
1.70 + * @param aElements contains Status Code, optional Reason Phrase and
1.71 + * optional SIP message headers and body. Ownership is transferred.
1.72 + * @leave KErrArgument if aElements == NULL
1.73 + * @leave KErrGeneral if ResponseAllowed() == EFalse
1.74 + * @leave KErrSIPInvalidTransactionState if State()!=ETrying and
1.75 + * State()!=EProceeding
1.76 + * @leave KErrSIPInvalidDialogState if sending response to a request
1.77 + * within dialog, and the dialog is in terminated state.
1.78 + * @leave KErrSIPResourceNotAvailable if a required SIP Client API
1.79 + * object has been deleted
1.80 + * @capability NetworkServices
1.81 + */
1.82 + IMPORT_C void SendResponseL(CSIPResponseElements *aElements);
1.83 +
1.84 + /**
1.85 + * Gets the request elements
1.86 + * @return Request elements. Ownership is not transferred.
1.87 + */
1.88 + IMPORT_C const CSIPRequestElements* RequestElements() const;
1.89 +
1.90 + /**
1.91 + * Checks if the response sending is allowed for this server
1.92 + * transaction. For instance response is not allowed in ACK transaction.
1.93 + * @return ETrue if response sending is allowed, EFalse otherwise
1.94 + */
1.95 + IMPORT_C TBool ResponseAllowed() const;
1.96 +
1.97 + public: // New functions, for internal use
1.98 +
1.99 + /**
1.100 + * Sets a new respose sender, replacing the current sender.
1.101 + *
1.102 + * @param aSender Response sender to be used from now on. Ownership is
1.103 + * transferred.
1.104 + */
1.105 + void SetResponseSender(MSIPResponseSender* aSender);
1.106 +
1.107 + /**
1.108 + * If the request was received inside a dialog, returns the dialog.
1.109 + *
1.110 + * @return CSIPDialogImplementation* The dialog inside which the request
1.111 + * was received, or NULL. Ownership is not transferred.
1.112 + */
1.113 + CSIPDialogImplementation* Dialog() const;
1.114 +
1.115 + /**
1.116 + * Obtains the associated CSIPConnection instance. If connection can't
1.117 + * be accessed anymore, this function leaves.
1.118 + *
1.119 + * @return CSIPConnection
1.120 + */
1.121 + CSIPConnection& SIPConnectionL();
1.122 +
1.123 + /**
1.124 + * Update the MTransactionAssociation to point to aAssociation.
1.125 + *
1.126 + * @param aAssociation Associated object
1.127 + */
1.128 + void ReAssociateL(MTransactionAssociation& aAssociation);
1.129 +
1.130 + /**
1.131 + * Removes, but does not delete, request elements from
1.132 + * aServerTransaction.
1.133 + *
1.134 + * @param aServerTransaction Server transaction from which response
1.135 + * elements are removed. Ownership is not transferred.
1.136 + */
1.137 + static void DetachRequestElements(TAny* aServerTransaction);
1.138 +
1.139 + public: // Constructors, for internal use
1.140 + /**
1.141 + * Creates a server transaction.
1.142 + *
1.143 + * @param aRequestId RequestId for the transaction to use
1.144 + * @param aAssociation Object with which the transaction is associated
1.145 + * @param aElements Request elements. Ownership is transferred.
1.146 + * @return New object. Ownership is transferred.
1.147 + */
1.148 + static CSIPServerTransaction*
1.149 + NewL(TUint32 aRequestId,
1.150 + MTransactionAssociation& aAssociation,
1.151 + CSIPRequestElements* aElements);
1.152 +
1.153 + /**
1.154 + * Creates a server transaction and pushes it to cleanup stack.
1.155 + *
1.156 + * @param aRequestId RequestId for the transaction to use
1.157 + * @param aAssociation Object with which the transaction is associated
1.158 + * @param aElements Request elements. Ownership is transferred.
1.159 + * @return New object. Ownership is transferred.
1.160 + */
1.161 + static CSIPServerTransaction*
1.162 + NewLC(TUint32 aRequestId,
1.163 + MTransactionAssociation& aAssociation,
1.164 + CSIPRequestElements* aElements);
1.165 +
1.166 + private: // Constructors
1.167 + CSIPServerTransaction(TUint32 aRequestId,
1.168 + MTransactionAssociation& aAssociation);
1.169 +
1.170 + /**
1.171 + * Second phase constructor.
1.172 + *
1.173 + * @pre aElements!=0
1.174 + * @param aElements Request elements. Ownership is transferred.
1.175 + */
1.176 + void ConstructL(CSIPRequestElements* aElements);
1.177 +
1.178 + private: // Data
1.179 + CSIPRequestElements* iRequestElements;
1.180 +
1.181 + //This interface is used for sending the response.
1.182 + //CSIPServerTransaction owns iResponseSender.
1.183 + MSIPResponseSender* iResponseSender;
1.184 +
1.185 + private: // For testing purposes
1.186 +
1.187 + UNIT_TEST(CSIPServerTransaction_Test)
1.188 + UNIT_TEST(CSIP_Test)
1.189 +
1.190 + __DECLARE_TEST;
1.191 + };
1.192 +
1.193 +#endif