|
1 /** @file |
|
2 * Copyright (c) 2005-2006 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: Implements the CUpnpGenaMessage class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "upnpgenamessage.h" |
|
21 #include "upnphttpheader.h" |
|
22 #include "upnpcommonupnplits.h" |
|
23 #include "upnplist.h" |
|
24 |
|
25 using namespace UpnpGENA; |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CUpnpGenaMessage::CUpnpGenaMessage |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 EXPORT_C CUpnpGenaMessage::CUpnpGenaMessage():CUpnpHttpMessage() |
|
37 { |
|
38 |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CUpnpGenaMessage::NewL |
|
43 // Two-phased constructor. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 EXPORT_C CUpnpGenaMessage* CUpnpGenaMessage::NewL( const TInetAddr& aAddr ) |
|
47 { |
|
48 CUpnpGenaMessage* self = CUpnpGenaMessage::NewLC(aAddr); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CUpnpGenaMessage::NewLC |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CUpnpGenaMessage* CUpnpGenaMessage::NewLC( const TInetAddr& aAddr ) |
|
59 { |
|
60 CUpnpGenaMessage* self = new (ELeave) CUpnpGenaMessage(); |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL(aAddr); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CUpnpGenaMessage::~CUpnpGenaMessage |
|
68 // Destructor |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C CUpnpGenaMessage::~CUpnpGenaMessage() |
|
72 { |
|
73 |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CUpnpGenaMessage::ConstructL |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CUpnpGenaMessage::ConstructL( TInetAddr aSender) |
|
82 { |
|
83 CUpnpHttpMessage::ConstructL(aSender, NewSessionIdL()); |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CUpnpGenaMessage::Nt |
|
88 // |
|
89 // (other items were commented in a header). |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 EXPORT_C TDesC8& CUpnpGenaMessage::Nt() |
|
93 { |
|
94 CUpnpHttpHeader* hdr = iHeaderList->First(); |
|
95 |
|
96 while ( hdr ) |
|
97 { |
|
98 if ( hdr->Name().CompareF( UpnpSSDP::KHdrSearchTarget ) == 0 ) |
|
99 { |
|
100 return hdr->Value(); |
|
101 } |
|
102 hdr = iHeaderList->Next( hdr ); |
|
103 } |
|
104 |
|
105 return (TDesC8&) KNoHeader; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CUpnpGenaMessage::Nts |
|
110 // |
|
111 // (other items were commented in a header). |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TDesC8& CUpnpGenaMessage::Nts() |
|
115 { |
|
116 CUpnpHttpHeader* hdr = iHeaderList->First(); |
|
117 |
|
118 while ( hdr ) |
|
119 { |
|
120 if ( hdr->Name().CompareF( UpnpSSDP::KHdrNotificationType ) == 0 ) // NTS |
|
121 { |
|
122 return hdr->Value(); |
|
123 } |
|
124 hdr = iHeaderList->Next( hdr ); |
|
125 } |
|
126 |
|
127 return (TDesC8&) KNoHeader; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CUpnpGenaMessage::Sid |
|
132 // |
|
133 // (other items were commented in a header). |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C TDesC8& CUpnpGenaMessage::Sid() |
|
137 { |
|
138 CUpnpHttpHeader* hdr = iHeaderList->First(); |
|
139 |
|
140 while ( hdr ) |
|
141 { |
|
142 if ( hdr->Name().CompareF( UpnpGENA::KSid ) == 0 ) |
|
143 { |
|
144 return hdr->Value(); |
|
145 } |
|
146 hdr = iHeaderList->Next( hdr ); |
|
147 } |
|
148 |
|
149 return (TDesC8&) KNoHeader; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CUpnpGenaMessage::Timeout |
|
154 // |
|
155 // (other items were commented in a header). |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 EXPORT_C TDesC8& CUpnpGenaMessage::Timeout() |
|
159 { |
|
160 CUpnpHttpHeader* hdr = iHeaderList->First(); |
|
161 |
|
162 while ( hdr ) |
|
163 { |
|
164 if ( hdr->Name().CompareF( UpnpGENA::KTimeout) == 0 ) |
|
165 { |
|
166 return hdr->Value(); |
|
167 } |
|
168 hdr = iHeaderList->Next( hdr ); |
|
169 } |
|
170 |
|
171 return (TDesC8&) KNoHeader; |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CUpnpGenaMessage::Callback |
|
176 // |
|
177 // (other items were commented in a header). |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 EXPORT_C TDesC8& CUpnpGenaMessage::Callback() |
|
181 { |
|
182 CUpnpHttpHeader* hdr = iHeaderList->First(); |
|
183 |
|
184 while ( hdr ) |
|
185 { |
|
186 if ( hdr->Name().CompareF( KCallback ) == 0 ) |
|
187 { |
|
188 return hdr->Value(); |
|
189 } |
|
190 hdr = iHeaderList->Next( hdr ); |
|
191 } |
|
192 |
|
193 return (TDesC8&) KNoHeader; |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CUpnpGenaMessage::Seq |
|
198 // |
|
199 // (other items were commented in a header). |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 EXPORT_C const TDesC8& CUpnpGenaMessage::Seq() |
|
203 { |
|
204 CUpnpHttpHeader* hdr = iHeaderList->First(); |
|
205 |
|
206 while ( hdr ) |
|
207 { |
|
208 if ( hdr->Name().CompareF( KSeq ) == 0 ) |
|
209 { |
|
210 return hdr->Value(); |
|
211 } |
|
212 hdr = iHeaderList->Next( hdr ); |
|
213 } |
|
214 |
|
215 return (TDesC8&) KNoHeader; |
|
216 } |
|
217 |
|
218 // End of File |