2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipdialogassocbase.h
16 * Part of : SIP Client
17 * Interface : SDK API, SIP Client API
24 #ifndef CSIPDIALOGASSOCBASE_H
25 #define CSIPDIALOGASSOCBASE_H
28 #include <stringpool.h>
30 // FORWARD DECLARATIONS
31 class CSIPMessageElements;
32 class CSIPClientTransaction;
35 class CSIPServerTransaction;
36 class CSIPDialogAssocImplementation;
44 * Base class for SIP dialog associations. It provides services for getting
45 * associated SIP dialog, actual dialog association type and for sending non
46 * target refresh requests within the dialog association.
49 class CSIPDialogAssocBase : public CBase
57 virtual ~CSIPDialogAssocBase();
59 public: // New functions
62 * Gets the dialog this dialog association belongs to
63 * @return associated dialog
65 IMPORT_C const CSIPDialog& Dialog() const;
68 * Gets dialog this dialog association belongs to
69 * @return associated dialog
71 IMPORT_C CSIPDialog& Dialog();
74 * Creates SIP request and sends it to the remote target.
75 * This function should be used for sending SIP extension
76 * requests within dialog assocation that do not cause
77 * sip dialog associations to be created. In SIP terms
78 * this request is non target refresh request.
79 * @pre SIPDialog().State() != CSIPDialog::EInit &&
80 * SIPDialog().State() != CSIPDialog::ETerminated
81 * @pre Dialog().Connection().State() == EActive
82 * @pre aMethod != "REGISTER" |"INVITE" | "BYE" | "CANCEL" | "ACK" |
83 * "SUBSCRIBE" | "NOTIFY" | "UPDATE" | "PRACK" | "REFER"
84 * @param aElements contains optional SIP message headers and body.
85 * Ownership is transferred.
86 * @return SIP extension client transaction. Ownership is transferred.
87 * @leave KErrSIPInvalidDialogState If dialog's state is not correct
88 * @leave KErrArgument if invalid value has been set to aMethod
89 * @leave KErrSIPResourceNotAvailable if a required SIP Client API
90 * object has been deleted
91 * @capability NetworkServices
93 IMPORT_C virtual CSIPClientTransaction*
94 SendNonTargetRefreshRequestL(RStringF aMethod,
95 CSIPMessageElements* aElements);
98 * Gets dialog association type.
100 * @return dialog association type e.g. "INVITE", "SUBSCRIBE" etc...
102 IMPORT_C RStringF Type() const;
105 * Tests if the request is a non target refresh request
106 * @param aMethod a method to test
107 * @return ETrue if is non target refresh request; EFalse otherwise
109 IMPORT_C TBool IsNonTargetRefreshRequest(RStringF aMethod) const;
111 public: // New functions, for internal use
114 * Returns the implementation instance.
115 * @return CSIPDialogAssocImplementation
117 CSIPDialogAssocImplementation& Implementation();
120 * Searches for a refresh with the matching id. Default implementation
121 * returns NULL. Those classes derived from CSIPDialogAssocBase, which
122 * can contain refreshes must implement this function for searching the
125 * @return CSIPRefresh if found, NULL otherwise.
126 * The ownership is not transferred.
129 virtual CSIPRefresh* FindRefresh(TUint32 aRefreshId);
134 virtual void DeletingRefresh(CSIPRefresh& aRefresh, TUint32 aRefreshId);
136 protected: // Constructors, for internal use
141 CSIPDialogAssocBase();
143 void ConstructL(RStringF aType, CSIPDialog& aDialog);
144 void ConstructL(RStringF aType,
146 CSIPServerTransaction& aTransaction);
151 * Implementation instance, CSIPDialogAssocBase owns it
154 CSIPDialogAssocImplementation* iImplementation;
156 private: // For testing purposes
158 friend class CSIPInviteDialogAssoc_Test;
160 void __DbgTestInvariant() const;