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