|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation of VoIP client resolver for incoming SIP messages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <apacmdln.h> |
|
23 #include "VoIPPlugin.h" |
|
24 #include "EComImplementationProxy.h" |
|
25 #include <SIPHeaderBase.h> |
|
26 #include <e32base.h> |
|
27 #include <e32std.h> |
|
28 #include <in_sock.h> |
|
29 #include <badesca.h> |
|
30 #include <apacmdln.h> |
|
31 |
|
32 // CONSTANTS |
|
33 const TUid KMyApplicationUid = {0x10202870}; |
|
34 |
|
35 // The capabilities defined here are valid, but not in use, since they are defined in reseource file. |
|
36 _LIT8(KCapabilities, |
|
37 //"<SIP_CLIENT ALLOW_STARTING=\"YES\"><SIP_HEADERS><ACCEPT value=\"application/sdp\"/><ACCEPT value=\"\"/></SIP_HEADERS><SDP_LINES><LINE name=\"m\" value=\"audio 0 RTP/AVP 0\"/></SDP_LINES></SIP_CLIENT>"); |
|
38 "<SIP_CLIENT ALLOW_STARTING=\"NO\"><SIP_HEADERS><ACCEPT value=\"application/sdp\"/><ACCEPT value=\"\"/><ALLOW_EVENTS value=\"dialog\"/></SIP_HEADERS><SDP_LINES><LINE name=\"m\" value=\"audio 0 RTP/AVP 96\"/><LINE name=\"m\" value=\"application 0 udp TBCP\"/></SDP_LINES></SIP_CLIENT>" ); |
|
39 |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CVoIPPlugin::CVoIPPlugin |
|
45 // C++ default constructor can NOT contain any code, that |
|
46 // might leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CVoIPPlugin::CVoIPPlugin() |
|
50 { |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CVoIPPlugin::ConstructL |
|
56 // Symbian 2nd phase constructor can leave. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void CVoIPPlugin::ConstructL() |
|
60 { |
|
61 RImplInfoPtrArray infoArray; |
|
62 REComSession::ListImplementationsL( KSIPResolvedClientIFUid, infoArray ); |
|
63 CleanupStack::PushL( TCleanupItem( ResetAndDestroy, &infoArray ) ); |
|
64 |
|
65 TBool found = EFalse; |
|
66 for (TInt i=0; !found && i<infoArray.Count(); i++) |
|
67 { |
|
68 CImplementationInformation* info = infoArray[ i ]; |
|
69 if ( info->ImplementationUid() == KMyApplicationUid ) |
|
70 { |
|
71 TLex8 lex( info->DataType() ); |
|
72 TUint value( 0 ); |
|
73 User::LeaveIfError( lex.Val( value, EHex ) ); |
|
74 iApplicationUID.iUid = value; |
|
75 found = ETrue; |
|
76 } |
|
77 } |
|
78 |
|
79 CleanupStack::PopAndDestroy( 1 ); // infoArray |
|
80 |
|
81 if ( !found ) |
|
82 { |
|
83 User::Leave( KErrNotFound ); |
|
84 } |
|
85 } |
|
86 |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CVoIPPlugin::NewL |
|
90 // Two-phased constructor. |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CVoIPPlugin* CVoIPPlugin::NewL() |
|
94 { |
|
95 CVoIPPlugin* self = new( ELeave ) CVoIPPlugin; |
|
96 |
|
97 CleanupStack::PushL( self ); |
|
98 self->ConstructL(); |
|
99 CleanupStack::Pop(); |
|
100 |
|
101 return self; |
|
102 } |
|
103 |
|
104 |
|
105 // Destructor |
|
106 CVoIPPlugin::~CVoIPPlugin() |
|
107 { |
|
108 } |
|
109 |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CVoIPPlugin::ChannelL |
|
113 // Implementation of ChannelL |
|
114 // (other items were commented in a header). |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TUid CVoIPPlugin::ChannelL( RStringF /*aMethod*/, |
|
118 const TDesC8& /*aRequestUri*/, |
|
119 const RPointerArray<CSIPHeaderBase>& /*aHeaders*/, |
|
120 const TDesC8& /*aContent*/, |
|
121 const CSIPContentTypeHeader* /*aContentType*/) |
|
122 { |
|
123 const TUid KServerUid3 = {0x1020E4C7}; |
|
124 return KServerUid3; |
|
125 |
|
126 //return iApplicationUID; |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // ChannelL::ConnectL |
|
132 // ConnectL, does nothing |
|
133 // (other items were commented in a header). |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CVoIPPlugin::ConnectL( TUid /*aUid*/ ) |
|
137 { |
|
138 } |
|
139 |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CVoIPPlugin::Capabilities |
|
143 // Returns application capabilities if not defined in rss-file |
|
144 // (other items were commented in a header). |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 const TDesC8& CVoIPPlugin::Capabilities() |
|
148 { |
|
149 return KCapabilities; |
|
150 } |
|
151 |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CVoIPPlugin::ResetAndDestroy |
|
155 // Implementation of ResetAndDestroy |
|
156 // (other items were commented in a header). |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 void CVoIPPlugin::ResetAndDestroy( TAny* anArray ) |
|
160 { |
|
161 RImplInfoPtrArray* array = reinterpret_cast<RImplInfoPtrArray*>( anArray ); |
|
162 if (array) |
|
163 { |
|
164 array->ResetAndDestroy(); |
|
165 } |
|
166 } |
|
167 |
|
168 // End of File |
|
169 |
|
170 |
|
171 |