|
1 /* |
|
2 * Copyright (c) 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: Holds transiently one TURN server item. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "turnserveritem.h" |
|
22 #include "natfwdefaults.h" |
|
23 #include "wpnatfwdebug.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CWPTurnServerItem::CWPTurnServerItem |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CWPTurnServerItem::CWPTurnServerItem() |
|
32 { |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CWPTurnServerItem::ConstructL |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 void CWPTurnServerItem::ConstructL() |
|
40 { |
|
41 DBG_PRINT( "CWPTurnServerItem::ConstructL - begin" ); |
|
42 // Set default values. |
|
43 iTurnSrvAddr = HBufC8::NewL( 0 ); |
|
44 iTurnSrvPort = KDefaultSTUNPort; |
|
45 iTurnUsername = HBufC8::NewL( 0 ); |
|
46 iTurnPassword = HBufC8::NewL( 0 ); |
|
47 DBG_PRINT( "CWPTurnServerItem::ConstructL - end" ); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CWPTurnServerItem::NewL |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CWPTurnServerItem* CWPTurnServerItem::NewL() |
|
55 { |
|
56 CWPTurnServerItem* self = CWPTurnServerItem::NewLC(); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CWPTurnServerItem::NewLC |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CWPTurnServerItem* CWPTurnServerItem::NewLC() |
|
66 { |
|
67 CWPTurnServerItem* self = new( ELeave ) CWPTurnServerItem; |
|
68 CleanupStack::PushL( self ); |
|
69 self->ConstructL(); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CWPTurnServerItem::~CWPTurnServerItem |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CWPTurnServerItem::~CWPTurnServerItem() |
|
78 { |
|
79 DBG_PRINT( "CWPTurnServerItem::~CWPTurnServerItem - begin" ); |
|
80 delete iTurnSrvAddr; |
|
81 delete iTurnUsername; |
|
82 delete iTurnPassword; |
|
83 DBG_PRINT( "CWPTurnServerItem::~CWPTurnServerItem - end" ); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CWPTurnServerItem::SetTurnSrvAddrL |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CWPTurnServerItem::SetTurnSrvAddrL( const TDesC8& aTurnSrvAddr ) |
|
91 { |
|
92 delete iTurnSrvAddr; |
|
93 iTurnSrvAddr = NULL; |
|
94 iTurnSrvAddr = aTurnSrvAddr.AllocL(); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CWPTurnServerItem::SetTurnSrvPort |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CWPTurnServerItem::SetTurnSrvPort( TInt aTurnSrvPort ) |
|
102 { |
|
103 iTurnSrvPort = aTurnSrvPort; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CWPTurnServerItem::SetTurnUsernameL |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CWPTurnServerItem::SetTurnUsernameL( const TDesC8& aUsername ) |
|
111 { |
|
112 delete iTurnUsername; |
|
113 iTurnUsername = NULL; |
|
114 iTurnUsername = aUsername.AllocL(); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CWPTurnServerItem::SetTurnPasswordL |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CWPTurnServerItem::SetTurnPasswordL( const TDesC8& aPassword ) |
|
122 { |
|
123 delete iTurnPassword; |
|
124 iTurnPassword = NULL; |
|
125 iTurnPassword = aPassword.AllocL(); |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // CWPTurnServerItem::TurnSrvAddr |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 const TDesC8& CWPTurnServerItem::TurnSrvAddr() const |
|
133 { |
|
134 return *iTurnSrvAddr; |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CWPTurnServerItem::TurnSrvPort |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 TInt CWPTurnServerItem::TurnSrvPort() const |
|
142 { |
|
143 return iTurnSrvPort; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CWPTurnServerItem::TurnUsername |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 const TDesC8& CWPTurnServerItem::TurnUsername() const |
|
151 { |
|
152 return *iTurnUsername; |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CWPTurnServerItem::TurnPassword |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 const TDesC8& CWPTurnServerItem::TurnPassword() const |
|
160 { |
|
161 return *iTurnPassword; |
|
162 } |
|
163 |