1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sipdialog.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,252 @@
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 : sipdialog.h
1.19 +* Part of : SIP Client
1.20 +* Interface : SDK API, SIP Client API
1.21 +* Version : 1.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +#ifndef CSIPDIALOG_H
1.29 +#define CSIPDIALOG_H
1.30 +
1.31 +// INCLUDES
1.32 +#include <e32base.h>
1.33 +#include <stringpool.h>
1.34 +#include "_sipcodecdefs.h"
1.35 +
1.36 +// FORWARD DECLARATIONS
1.37 +class CSIPConnection;
1.38 +class CSIPConnectionImplementation;
1.39 +class MSIPRegistrationContext;
1.40 +class CSIPDialogAssocBase;
1.41 +class CSIPFromHeader;
1.42 +class CSIPToHeader;
1.43 +class CSIPCallIDHeader;
1.44 +class CUri8;
1.45 +class CSIPDialogImplementation;
1.46 +
1.47 +// CLASS DECLARATION
1.48 +
1.49 +/**
1.50 +* @publishedAll
1.51 +* @released
1.52 +*
1.53 +* Class for managing SIP dialogs.
1.54 +* It provides services querying dialog state, obtaining the dialog related
1.55 +* SIP headers and getting all dialog associations.
1.56 +*
1.57 +* The user of the class cannot instantiate this class.
1.58 +* @lib sipclient
1.59 +*/
1.60 +
1.61 +class CSIPDialog: public CBase
1.62 + {
1.63 + public:
1.64 + /** Dialog states */
1.65 + enum TState
1.66 + {
1.67 + /** Initiliazed state */
1.68 + EInit,
1.69 + /** Early state */
1.70 + EEarly,
1.71 + /** Confirmed state */
1.72 + EConfirmed,
1.73 + /** Terminated state */
1.74 + ETerminated
1.75 + };
1.76 +
1.77 + public: //New functions
1.78 + /**
1.79 + * Gets dialog state
1.80 + * @return dialog state
1.81 + */
1.82 + IMPORT_C CSIPDialog::TState State() const;
1.83 +
1.84 + /**
1.85 + * Gets all dialog associations.
1.86 + * @return All dialog associations. Ownership of the array or the items
1.87 + * inside it, is not transferred.
1.88 + */
1.89 + IMPORT_C const RPointerArray<CSIPDialogAssocBase>&
1.90 + SIPDialogAssociations() const;
1.91 +
1.92 + /**
1.93 + * Gets used registration context for this dialog
1.94 + * @return associated registration or 0-pointer otherwise.
1.95 + * Ownership is not transferred.
1.96 + */
1.97 + IMPORT_C const MSIPRegistrationContext* RegistrationContext() const;
1.98 +
1.99 + /**
1.100 + * Checks if the dialog association belongs to this dialog
1.101 + * @param aDialogAssoc a dialog association
1.102 + * @return ETrue if belongs, EFalse otherwise
1.103 + */
1.104 + IMPORT_C TBool
1.105 + IsAssociated(const CSIPDialogAssocBase& aDialogAssoc) const;
1.106 +
1.107 + /**
1.108 + * Gets the SIP connection used for this dialog
1.109 + * @return SIP connection used for the dialog, or 0-pointer if the
1.110 + * connection has been deleted. Ownership isn't transferred.
1.111 + */
1.112 + IMPORT_C CSIPConnection* Connection();
1.113 +
1.114 + /**
1.115 + * Gets the SIP connection used for this dialog.
1.116 + * @return SIP connection used for the dialog, or 0-pointer if the
1.117 + * connection has been deleted. Ownership isn't transferred.
1.118 + */
1.119 + IMPORT_C const CSIPConnection* Connection() const;
1.120 +
1.121 + /**
1.122 + * Gets originator's address
1.123 + * @return originator's address (From-header)
1.124 + */
1.125 + IMPORT_C const CSIPFromHeader& FromHeader() const;
1.126 +
1.127 + /**
1.128 + * Gets recipient's address
1.129 + * @return recipient's address (To-header)
1.130 + */
1.131 + IMPORT_C const CSIPToHeader& ToHeader() const;
1.132 +
1.133 + /**
1.134 + * Gets remote-uri used during dialog creation
1.135 + * @return Remote target uri
1.136 + */
1.137 + IMPORT_C const CUri8& RemoteURI() const;
1.138 +
1.139 + /**
1.140 + * Gets Call-ID of SIP dialog
1.141 + * @pre State()==CSIPDialog::EEarly || State()==CSIPDialog::EConfirmed
1.142 + * @return Call-ID of SIP dialog
1.143 + * @leave KErrSIPInvalidDialogState if dialog doesn't yet have a Call-ID
1.144 + */
1.145 + IMPORT_C const CSIPCallIDHeader& CallIdL() const;
1.146 +
1.147 + /**
1.148 + * Compares this object to another object
1.149 + * @param aDialog CSIPDialog object to compare
1.150 + * @returns ETrue if the objects are equal, otherwise EFalse
1.151 + */
1.152 + IMPORT_C TBool operator==(const CSIPDialog& aDialog) const;
1.153 +
1.154 + /**
1.155 + * Sets the dialog to state to CSIPDialog::EInit.
1.156 + * The local dialog identifier data
1.157 + * (Call-ID, CSeq and From-header's tag) will be reused.
1.158 + * After calling this function, the dialog that was already terminated
1.159 + * can be used for sending the dialog initiating request such as
1.160 + * INVITE or SUBSCRIBE reusing the stored Call-ID and From-header's tag
1.161 + * and the stored CSeq incremented by one.
1.162 + * @pre State()==CSIPDialog::ETerminated
1.163 + * @returns KErrNone if succesful and KErrNoMemory if the memory is low.
1.164 + */
1.165 + IMPORT_C TInt ReuseInitialRequestData();
1.166 +
1.167 + public: //Constructors and destructor, for internal use
1.168 + /**
1.169 + * Two-phased constructor.
1.170 + * This constructor should be used if the user has received
1.171 + * SIP request that creates a SIP dialog association.
1.172 + *
1.173 + * @param aConnImplementation Implementation of the used SIP connection
1.174 + * @return New object, ownership is transferred.
1.175 + */
1.176 + static CSIPDialog*
1.177 + NewL(CSIPConnectionImplementation& aConnImplementation);
1.178 +
1.179 + /**
1.180 + * Two-phased constructor
1.181 + * This constructor should be used if the user has received
1.182 + * SIP request that creates a SIP dialog association.
1.183 + *
1.184 + * @param aConnImplementation Implementation of the used SIP connection
1.185 + * @return New object, ownership is transferred.
1.186 + */
1.187 + static CSIPDialog*
1.188 + NewLC(CSIPConnectionImplementation& aConnImplementation);
1.189 +
1.190 + /**
1.191 + * Two-phased constructor
1.192 + * This constructor should be used if the user has received
1.193 + * SIP request that creates a SIP dialog association.
1.194 + *
1.195 + * @param aConnImplementation Implementation of the used SIP connection
1.196 + * @param aContext Registration context whose outbound proxy and other
1.197 + * parameters are to be used.
1.198 + * @return New object, ownership is transferred.
1.199 + */
1.200 + static CSIPDialog*
1.201 + NewL(CSIPConnectionImplementation& aConnImplementation,
1.202 + const MSIPRegistrationContext& aContext);
1.203 +
1.204 + /**
1.205 + * Two-phased constructor
1.206 + * This constructor should be used if the user has received
1.207 + * SIP request that creates a SIP dialog association.
1.208 + *
1.209 + * @param aConnImplementation Implementation of the used SIP connection
1.210 + * @param aContext Registration context whose outbound proxy and other
1.211 + * parameters are to be used.
1.212 + * @return New object, ownership is transferred.
1.213 + */
1.214 + static CSIPDialog*
1.215 + NewLC(CSIPConnectionImplementation& aConnImplementation,
1.216 + const MSIPRegistrationContext& aContext);
1.217 +
1.218 + /**
1.219 + * Destructor
1.220 + */
1.221 + ~CSIPDialog();
1.222 +
1.223 + public: // New functions, for internal use
1.224 +
1.225 + /**
1.226 + * Returns the CSIPDialogImplementation.
1.227 + * @return CSIPDialogImplementation
1.228 + */
1.229 + CSIPDialogImplementation& Implementation();
1.230 +
1.231 + private: // Constructors
1.232 +
1.233 + CSIPDialog();
1.234 +
1.235 + void ConstructL(CSIPConnectionImplementation& aConnImplementation);
1.236 +
1.237 + void ConstructL(CSIPConnectionImplementation& aConnImplementation,
1.238 + const MSIPRegistrationContext& aContext);
1.239 +
1.240 +private: // Data
1.241 +
1.242 + //Implementation instance, CSIPDialog doesn't own it
1.243 + CSIPDialogImplementation* iImplementation;
1.244 +
1.245 +private: // For testing purposes
1.246 +
1.247 + UNIT_TEST(CSIP_Test)
1.248 + UNIT_TEST(CSIPInviteDialogAssoc_Test)
1.249 + UNIT_TEST(CSIPSubscribeDialogAssoc_Test)
1.250 + UNIT_TEST(CSIPReferDialogAssoc_Test)
1.251 +
1.252 + __DECLARE_TEST;
1.253 + };
1.254 +
1.255 +#endif