|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Capability |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMUSAVACAPABILITY_H |
|
20 #define CMUSAVACAPABILITY_H |
|
21 |
|
22 |
|
23 #include <e32base.h> // CBase |
|
24 #include <sdpcodecstringconstants.h> |
|
25 #include <sdpcodecstringpool.h> |
|
26 #include <badesca.h> |
|
27 #include "musunittesting.h" |
|
28 #include "mussettingskeys.h" |
|
29 |
|
30 class CMusAvaCapabilityExchange; |
|
31 class CSIPServerTransaction; |
|
32 class CSIPHeaderBase; |
|
33 class CSdpDocument; |
|
34 class CSIPAcceptContactHeader; |
|
35 class CSdpFmtAttributeField; |
|
36 class CSdpAttributeField; |
|
37 class CSdpOriginField; |
|
38 class CSdpMediaField; |
|
39 class RStringF; |
|
40 |
|
41 #define CAPABILITY_CONTAINS( tagSet, tag ) ( tagSet.Find( tag ) >= KErrNone ) |
|
42 _LIT8( KCapabilitySwisFeature, "+g.3gpp.cs-voice"); |
|
43 _LIT8( KCapabilitySwisApplication, "com.gsma.rts"); |
|
44 _LIT8( KCapabilitySDPAttributeNameType, "type"); |
|
45 _LIT8( KCapabilitySDPAttributeType, "videolive"); |
|
46 _LIT8( KCapabilitySDPAttributeCodecH263, "H263-2000" ); |
|
47 _LIT8( KCapabilitySwisFormatList, "98 96" ); |
|
48 _LIT8( KCapabilitySwisFormatListH263Only, "96" ); |
|
49 _LIT8( KCapabilitySDPAttributeCodecH264, "H264" ); |
|
50 _LIT8( KCapabilitySDPAttributeFastMode, "fastmode" ); //a=keywds:fastmode, see RFC 4566 |
|
51 |
|
52 const TUint64 KCapabilitySDPAttributeClockrate = 90000; |
|
53 const TUint64 KCapabilitySDPAttributePayloadType = 96; |
|
54 const TUint64 KCapabilitySDPAttributePayloadTypeH264 = 98; |
|
55 |
|
56 |
|
57 /** |
|
58 * Capability |
|
59 * |
|
60 * @lib musavailabilityplugin.dll |
|
61 */ |
|
62 class CMusAvaCapability : public CBase |
|
63 { |
|
64 |
|
65 public: // constructors and destructor |
|
66 |
|
67 static CMusAvaCapability* NewL( CMusAvaCapabilityExchange& aExchange ); |
|
68 virtual ~CMusAvaCapability(); |
|
69 |
|
70 |
|
71 protected: // constructors |
|
72 |
|
73 CMusAvaCapability( CMusAvaCapabilityExchange& aExchange ); |
|
74 |
|
75 void ConstructL( ); |
|
76 |
|
77 public: // new functions |
|
78 |
|
79 /** |
|
80 * Returns exchance |
|
81 * |
|
82 * @return exchance |
|
83 */ |
|
84 CMusAvaCapabilityExchange& Exchange() const; |
|
85 |
|
86 /** |
|
87 * Returns feature this capability represents |
|
88 * |
|
89 * @return feature this capability represents |
|
90 */ |
|
91 const RStringF& Feature() const; |
|
92 |
|
93 /** |
|
94 * Checks if capability supports feature, found |
|
95 * in Accept-Contact header |
|
96 * |
|
97 * @param acceptContact accept contact |
|
98 * @return ETrue, if there is a match |
|
99 */ |
|
100 virtual TBool Supports( const CSIPAcceptContactHeader& acceptContact ); |
|
101 |
|
102 /** |
|
103 * Uses for conrolling capability |
|
104 * |
|
105 * @return ETrue, if capability is enabled |
|
106 */ |
|
107 TBool& Enabled(); |
|
108 |
|
109 /** |
|
110 * Populates response to query |
|
111 * |
|
112 * @param aQuery query as SIP server transaction |
|
113 * @param aResponseHeaders SIP headers container for response |
|
114 * @param aResponseContent SDP document container for response |
|
115 */ |
|
116 virtual void PopulateResponseL( |
|
117 CSIPServerTransaction& aQuery, |
|
118 RPointerArray<CSIPHeaderBase>& aResponseHeaders, |
|
119 CSdpDocument& aResponseContent ); |
|
120 |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * Populates response to query |
|
126 * |
|
127 * @param aResponseContent SDP document container for response |
|
128 */ |
|
129 void DoPopulateResponseL( CSdpDocument& aResponseContent ); |
|
130 |
|
131 |
|
132 |
|
133 public: //static API |
|
134 |
|
135 |
|
136 /** |
|
137 * Creates SDP document |
|
138 * |
|
139 * @param aQuery received query |
|
140 * @return SDP document |
|
141 */ |
|
142 static CSdpDocument* ResponseContentLC( |
|
143 const CSIPServerTransaction& aQuery ); |
|
144 |
|
145 /** |
|
146 * Finds and resolves the codecs from SDP document |
|
147 * |
|
148 * @return the supported media types |
|
149 */ |
|
150 static CDesCArrayFlat* ResolveCodecsL( CSdpDocument& aSDP ); |
|
151 |
|
152 /** |
|
153 * Finds attribute field from SDP document |
|
154 * |
|
155 * @param aAttribute attribute name |
|
156 * @param aSDP SDP document |
|
157 * @return the attribute |
|
158 */ |
|
159 static const CSdpAttributeField* Attribute( const RStringF& aAttribute, |
|
160 CSdpDocument& aSDP ); |
|
161 |
|
162 /** |
|
163 * Finds attribute field from media part in SDP document |
|
164 * |
|
165 * @param aMedia name of the media |
|
166 * @param aAttribute attribute name |
|
167 * @param aSDP SDP document |
|
168 * @return the attribute |
|
169 */ |
|
170 static const CSdpAttributeField* Attribute( const RStringF& aMedia, |
|
171 const RStringF& aAttribute, |
|
172 CSdpDocument& aSDP ); |
|
173 |
|
174 /** |
|
175 * Finds fast mode value from the SDP document |
|
176 */ |
|
177 static MusSettingsKeys::TFastMode ResolveFastModeL( CSdpDocument& aSdp ); |
|
178 |
|
179 /** |
|
180 * Add fast mode related attribute to SDP, if fast mode is supported |
|
181 */ |
|
182 static void AddFastModeL( CSdpDocument& aSdp ); |
|
183 |
|
184 |
|
185 public://new functions |
|
186 |
|
187 /** |
|
188 * Adds contact header to response of query |
|
189 * |
|
190 * @param aQuery query as SIP server transaction |
|
191 * @param aResponseHeaders SIP headers container for response |
|
192 */ |
|
193 virtual void AddContactHeaderL( |
|
194 CSIPServerTransaction& aQuery, |
|
195 RPointerArray<CSIPHeaderBase>& aResponseHeaders ); |
|
196 |
|
197 /** |
|
198 * Creates origin field for sdp |
|
199 * |
|
200 * @param aNetType net type |
|
201 * @param aLocalHost local host |
|
202 * @param aHostType host type |
|
203 * @return origin field |
|
204 */ |
|
205 static CSdpOriginField* OriginFieldL( const RStringF& aNetType, |
|
206 const TDesC8& aLocalHost, |
|
207 const RStringF& aHostType ); |
|
208 |
|
209 /** |
|
210 * Creates media line |
|
211 * |
|
212 * @param aMedia name of the media |
|
213 * @param aFormatList format list |
|
214 * @return media line |
|
215 */ |
|
216 CSdpMediaField* MediaLineLC( const RStringF& aMedia, |
|
217 const TDesC8& aFormatList ) const; |
|
218 |
|
219 |
|
220 /** |
|
221 * Creates rtpmap line |
|
222 * |
|
223 * @param aCodec name of coded |
|
224 * @param aPayloadType payload type |
|
225 * @param aClockRate clockrate |
|
226 * @param aParams optional params |
|
227 * @return rtpmap line |
|
228 */ |
|
229 static CSdpFmtAttributeField* RtpMapLineLC( const TDesC8& aCodec, |
|
230 const TUint64 aPayloadType, |
|
231 const TUint64 aClockRate, |
|
232 const TDesC8& aParams = KNullDesC8 ); |
|
233 |
|
234 |
|
235 private: |
|
236 |
|
237 CMusAvaCapabilityExchange& iExchange; |
|
238 RStringF iFeature; |
|
239 TBool iIsEnabled; |
|
240 |
|
241 //for unit testing |
|
242 //MUS_UNITTEST ( UT_ ) |
|
243 |
|
244 }; |
|
245 |
|
246 #endif // CMUSAVACAPABILITY_H |