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