2 * Copyright (c) 2007-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 : sipresolvedclient2.h
16 * Part of : SIP Client Resolver API
23 #ifndef CSIPRESOLVEDCLIENT2_H
24 #define CSIPRESOLVEDCLIENT2_H
27 #include <sipacceptcontactheader.h>
28 #include <sipeventheader.h>
29 #include <stringpool.h>
31 #include <sipheaderbase.h>
32 #include <sipcontenttypeheader.h>
35 // FORWARD DECLARATIONS
39 /** Interface UID of this ECOM interface*/
40 const TUid KSIPResolvedClient2IFUid = { 0x10282EE5 };
47 * Interface that SIP stack's clients must realize
48 * in order to be able to receive incoming SIP requests outside SIP dialogs.
49 * Note that channel UIDs must be unique accross all SIP clients
50 * e.g. clients may use UIDs assigned for binaries.
52 * SIP stack utilizes the plug-ins that implement
53 * this interface in the following manner:
55 * 1) If the SIP request does not contain Accept-Contact-header(s), go to step 2.
56 * SIP stack calls CSIPResolvedClient2::MatchAcceptContactsL
57 * for all the plug-ins and applies the following logic:
58 * a) None of the clients match -> go to step 2
59 * b) One client matches -> the SIP request is routed to the matching client
60 * c) Several clients match -> go to step 2
62 * 2) If the SIP request does not contain Event-header, go to step 3.
63 * SIP stack calls CSIPResolvedClient2::MatchEventL
64 * for all the plug-ins and applies the following logic:
65 * a) None of the clients match -> go to step 3
66 * b) One client matches -> the SIP request is routed to the matching client
67 * c) Several clients match -> go to step 3
69 * 3) SIP stack calls CSIPResolvedClient2::MatchRequestL for all the plug-ins.
70 * a) None of the clients match -> SIP generates an error response
71 * b) One client matches -> the SIP request is routed to the matching client
72 * c) Several clients match ->
73 * SIP picks one of these clients randomly and routes the request to it.
74 * The ROM-based clients are preferred.
76 class CSIPResolvedClient2 : public CBase
83 inline ~CSIPResolvedClient2();
85 public: // Abstract methods
88 * Matches the Accept-Contact-headers
89 * to the client(s) represented by this plug-in.
90 * This function is called for an incoming SIP request
91 * if it contains Accept-Contact-header(s).
92 * @param aMethod the method of the SIP request
93 * @param aRequestUri the request-URI of the SIP request
94 * @param aHeaders all the headers in the SIP request
95 * @param aContent SIP request body;
96 * zero-length descriptor if not present
97 * @param aContentType the content-type of the SIP request.
98 * Zero-pointer if body is not present.
99 * @param aClientUid indicates client's UID for
100 * SIP e.g. the one passed as a parameter to CSIP::NewL().
101 * @return ETrue, if the Accept-Contact-headers match to the client
102 * represented by this plug-in, otherwise EFalse.
104 virtual TBool MatchAcceptContactsL(
106 const CUri8& aRequestUri,
107 const RPointerArray<CSIPHeaderBase>& aHeaders,
108 const TDesC8& aContent,
109 const CSIPContentTypeHeader* aContentType,
110 TUid& aClientUid) = 0;
113 * Matches the Event-header to the client(s) represented by this plug-in.
114 * This function is called for an incoming SIP request,
115 * if it contains an Event-header and
116 * MatchAcceptContactsL returned EFalse.
117 * @param aMethod the method of the SIP request
118 * @param aRequestUri the request-URI of the SIP request
119 * @param aHeaders all the headers in the SIP request
120 * @param aContent SIP request body;
121 * zero-length descriptor if not present
122 * @param aContentType the content-type of the SIP request.
123 * Zero-pointer if body is not present.
124 * @param aClientUid indicates client's UID for
125 * SIP e.g. the one passed as a parameter to CSIP::NewL().
126 * @return ETrue, if the Event-header matches to the client
127 * represented by this plug-in, otherwise EFalse.
129 virtual TBool MatchEventL(
131 const CUri8& aRequestUri,
132 const RPointerArray<CSIPHeaderBase>& aHeaders,
133 const TDesC8& aContent,
134 const CSIPContentTypeHeader* aContentType,
135 TUid& aClientUid) = 0;
138 * Matches the whole SIP request to the client(s)
139 * represented by this plug-in.
140 * This function is called if the SIP request does not contain
141 * Accept- or Event-headers or
142 * MatchAcceptContactsL and MatchEventL returned EFalse.
143 * @param aMethod the method of the SIP request
144 * @param aRequestUri the request-URI of the SIP request
145 * @param aHeaders all the headers in the SIP request
146 * @param aContent SIP request body;
147 * zero-length descriptor if not present
148 * @param aContentType the content-type of the SIP request.
149 * Zero-pointer if body is not present.
150 * @param aClientUid indicates client's UID for
151 * SIP e.g. the one passed as a parameter to CSIP::NewL().
152 * @return ETrue, if the request can be handled by the client
153 * represented by this plug-in, otherwise EFalse.
155 virtual TBool MatchRequestL(
157 const CUri8& aRequestUri,
158 const RPointerArray<CSIPHeaderBase>& aHeaders,
159 const TDesC8& aContent,
160 const CSIPContentTypeHeader* aContentType,
161 TUid& aClientUid) = 0;
164 * Indicates whether the plug-in implements CSIPResolvedClient2::ConnectL
165 * and by calling CSIPResolvedClient2::ConnectL
166 * SIP stack is able to force the client to connect to SIP stack.
167 * @return ETrue, if the plug-in supports
168 * CSIPResolvedClient2::ConnectL, otherwise EFalse.
170 virtual TBool ConnectSupported() = 0;
173 * Requests the client to connect to SIP with
174 * the resolved UID in case there's no client connection with the UID.
175 * @param aClientUid previously resolved client UID
177 virtual void ConnectL(const TUid& aClientUid) = 0;
180 * Cancels a ConnectL request for a client.
181 * Is called when for example a CANCEL for an INVITE is received
182 * before the client connects to SIP stack.
183 * @param aClientUid a UID for which ConnectL was previously called
185 virtual void CancelConnect(const TUid& aClientUid) = 0;
188 * Gets all the SIP message content types supported by the client.
189 * @return 0..n SIP Content-Type-headers.
190 * The ownership of the headers is transferred.
192 virtual RPointerArray<CSIPContentTypeHeader>
193 SupportedContentTypesL() = 0;
196 * Gets all the SDP media-fields supported by the client.
197 * @return 0..n SDP media-fields describing the client's media support.
198 * The ownership of the media-fields is transferred.
200 virtual RPointerArray<CSdpMediaField>
201 SupportedSdpMediasL() = 0;
205 * Adds client specific SIP-headers for the 200 OK for OPTIONS.
206 * Each plug-in must check that the header to be added
207 * is not yet in the array. For example when adding header
208 * "Allow: INVITE" the client must check that
209 * the header is not already present in the array.
210 * @param aHeaders headers to be added to 200 OK for OPTIONS.
211 * The ownership of the added headers is transferred to the caller.
213 virtual void AddClientSpecificHeadersForOptionsResponseL(
214 RPointerArray<CSIPHeaderBase>& aHeaders) = 0;
218 /// Unique key for implementations of this interface.
221 TUid iImplementationUid;
223 protected: // Constructors:
225 inline CSIPResolvedClient2();
228 #include "sipresolvedclient2.inl"
230 #endif // CSIPRESOLVEDCLIENT2_H