|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "sipconnection.h" |
|
19 #include "sip.h" |
|
20 #include "siperr.h" |
|
21 #include "musunittesting.h" |
|
22 #include "SIPRequestElements.h" |
|
23 #include "SIPClientTransaction.h" |
|
24 #include "CSipSseTestTls.h" |
|
25 |
|
26 CSIPConnection::CSIPConnection(CSIP& aSIP, |
|
27 TUint32 aIapId, |
|
28 MSIPConnectionObserver& aObserver) |
|
29 : iIapId(aIapId), iObserver(aObserver), iState(EActive) |
|
30 { |
|
31 iSIP = &aSIP; |
|
32 } |
|
33 |
|
34 void CSIPConnection::ConstructL() |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 EXPORT_C CSIPConnection* CSIPConnection::NewL(CSIP& aSIP, |
|
40 TUint32 aIapId, |
|
41 MSIPConnectionObserver& aSIPConnectionObserver) |
|
42 { |
|
43 |
|
44 CSIPConnection* self = new(ELeave) CSIPConnection(aSIP, aIapId, aSIPConnectionObserver); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(); |
|
47 CleanupStack::Pop(); |
|
48 return self; |
|
49 |
|
50 } |
|
51 |
|
52 |
|
53 EXPORT_C CSIPConnection::~CSIPConnection() |
|
54 { |
|
55 } |
|
56 |
|
57 EXPORT_C TUint32 CSIPConnection::IapId() const |
|
58 { |
|
59 return iIapId; |
|
60 } |
|
61 |
|
62 EXPORT_C CSIPConnection::TState CSIPConnection::State() const |
|
63 { |
|
64 return iState; |
|
65 } |
|
66 |
|
67 EXPORT_C CSIPClientTransaction* CSIPConnection::SendRequestL( |
|
68 CSIPRequestElements* aElements, |
|
69 const MSIPRegistrationContext& /*aContext*/ ) |
|
70 { |
|
71 CSIPClientTransaction* trx = CSIPClientTransaction::NewL( aElements->Method() ); |
|
72 |
|
73 CSipSseTestTls* tls = CSipSseTestTls::Storage(); |
|
74 if ( tls ) |
|
75 { |
|
76 tls->ClientRequest( aElements ); |
|
77 } |
|
78 else |
|
79 { |
|
80 delete aElements; |
|
81 } |
|
82 |
|
83 return trx; |
|
84 } |
|
85 |
|
86 EXPORT_C void CSIPConnection::GetLocalAddrL(TInetAddr& aAddr)const |
|
87 { |
|
88 _LIT(add,"0.0.0.0"); |
|
89 aAddr.Input(add); |
|
90 } |
|
91 |
|
92 |
|
93 EXPORT_C void CSIPConnection::SetState(TState aState) |
|
94 { |
|
95 iState = aState; |
|
96 } |
|
97 |
|
98 //TODO:Check if these new functions are needed in sip_stub |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CSIPConnection::SIP |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C CSIP* CSIPConnection::SIP() |
|
105 { |
|
106 return iSIP; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CSIPConnection::SIP |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 EXPORT_C const CSIP* CSIPConnection::SIP() const |
|
114 { |
|
115 return iSIP; |
|
116 } |