|
1 /* |
|
2 * Copyright (c) 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 |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CTcSIPConnectionContainer.h" |
|
19 #include "SIPConstants.h" |
|
20 #include "TCmdFetchRegistrations.h" |
|
21 |
|
22 #include <sipclienttransaction.h> |
|
23 #include <sipfromheader.h> |
|
24 #include <siprequestelements.h> |
|
25 #include <siptoheader.h> |
|
26 #include <uri8.h> |
|
27 |
|
28 /** |
|
29 * INPUT: |
|
30 * Headers: To |
|
31 * Parameters: - |
|
32 * IDs: ConnectionId* |
|
33 * |
|
34 * OUTPUT: |
|
35 * Parameters: - |
|
36 * IDs: TransactionId |
|
37 */ |
|
38 void TCmdFetchRegistrations::ExecuteL() |
|
39 { |
|
40 // -- Setup --------------------------------------------------------------- |
|
41 |
|
42 // Select connection; either default or user specified (and existing) |
|
43 CSIPConnection& connection = SelectConnectionL().Connection(); |
|
44 |
|
45 // Extract remote URI |
|
46 CUri8* uri = ExtractRemoteURILC(); |
|
47 |
|
48 // Create SIP request elements, giving remote URI away |
|
49 CSIPRequestElements* reqElements = CSIPRequestElements::NewL( uri ); |
|
50 CleanupStack::Pop( iPushed ); //possibly uri |
|
51 iPushed = 0; |
|
52 |
|
53 CleanupStack::PushL( reqElements ); |
|
54 |
|
55 // Extract required headers |
|
56 CSIPToHeader* toHeader = ExtractToHeaderLC(); |
|
57 |
|
58 // Create a From header from the value of To header |
|
59 CSIPFromHeader* fromHeader = CSIPFromHeader::NewLC( *toHeader ); |
|
60 reqElements->SetFromHeaderL( fromHeader ); |
|
61 CleanupStack::Pop( fromHeader ); |
|
62 |
|
63 CleanupStack::PopAndDestroy( iPushed ); //possibly toHeader |
|
64 iPushed = 0; |
|
65 |
|
66 // -- Execution ----------------------------------------------------------- |
|
67 |
|
68 // Start a SIP Register transaction |
|
69 CSIPClientTransaction* transaction = |
|
70 connection.FetchRegistrationsL( reqElements ); |
|
71 CleanupStack::Pop( reqElements ); |
|
72 |
|
73 // -- Response creation --------------------------------------------------- |
|
74 |
|
75 AddIdResponseL( KTransactionId, transaction ); |
|
76 } |
|
77 |
|
78 TBool TCmdFetchRegistrations::Match( const TTcIdentifier& aId ) |
|
79 { |
|
80 return TTcSIPCommandBase::Match( aId, _L8("FetchRegistrations") ); |
|
81 } |
|
82 |
|
83 TTcCommandBase* TCmdFetchRegistrations::CreateL( MTcTestContext& aContext ) |
|
84 { |
|
85 return new( ELeave ) TCmdFetchRegistrations( aContext ); |
|
86 } |