14
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 |
|
|
19 |
CMDnsParamSetBase* CMDnsParamSetBase::NewL ( RParameterFamily& aFamily, TMDnsParamSetFamily aFamilyType )
|
|
20 |
{
|
|
21 |
STypeId typeId;
|
|
22 |
typeId = STypeId::CreateSTypeId( KMDnsParamsFactoryUid, aFamilyType );
|
|
23 |
CMDnsParamSetBase* self = static_cast < CMDnsParamSetBase* > ( CSubConParameterSet::NewL( typeId ) );
|
|
24 |
TBool containerValue = aFamily.IsNull();
|
|
25 |
if(!containerValue)
|
|
26 |
{
|
|
27 |
CleanupStack::PushL ( self );
|
|
28 |
aFamily.AddParameterSetL ( self, RParameterFamily::ERequested );
|
|
29 |
CleanupStack::Pop ( self );
|
|
30 |
}
|
|
31 |
return self;
|
|
32 |
}
|
|
33 |
CMDnsParamSetBase::CMDnsParamSetBase ()
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
|
37 |
// ------------------------------------------
|
|
38 |
CMDnsQueryRequestParamSet* CMDnsQueryRequestParamSet::NewL ( RParameterFamily& aFamily )
|
|
39 |
{
|
|
40 |
return static_cast < CMDnsQueryRequestParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMDnsDiscoverRequestParamSet ) );
|
|
41 |
}
|
|
42 |
|
|
43 |
void CMDnsQueryRequestParamSet::SetInstanceNameL ( const TDesC8& aName )
|
|
44 |
{
|
|
45 |
iInstanceName.Close ();
|
|
46 |
iInstanceName.CreateL(aName);
|
|
47 |
}
|
|
48 |
|
|
49 |
const TDesC8& CMDnsQueryRequestParamSet::InstanceName () const
|
|
50 |
{
|
|
51 |
return iInstanceName;
|
|
52 |
}
|
|
53 |
|
|
54 |
void CMDnsQueryRequestParamSet::SetQueryTypeL(TInt aQueryType)
|
|
55 |
{
|
|
56 |
iQueryType = aQueryType;
|
|
57 |
}
|
|
58 |
|
|
59 |
TInt CMDnsQueryRequestParamSet::QueryType()const
|
|
60 |
{
|
|
61 |
return iQueryType;
|
|
62 |
}
|
|
63 |
|
|
64 |
void CMDnsQueryRequestParamSet::SetProtocol(TInt aProtocol)
|
|
65 |
{
|
|
66 |
iProtocol = aProtocol;
|
|
67 |
}
|
|
68 |
|
|
69 |
TInt CMDnsQueryRequestParamSet::Protocol() const
|
|
70 |
{
|
|
71 |
return iProtocol;
|
|
72 |
}
|
|
73 |
|
|
74 |
void CMDnsQueryRequestParamSet::SetServiceTypeL(const TDesC8& aServiceType)
|
|
75 |
{
|
|
76 |
iServiceType.Close();
|
|
77 |
iServiceType.CreateL(aServiceType);
|
|
78 |
}
|
|
79 |
|
|
80 |
const TDesC8& CMDnsQueryRequestParamSet::ServiceType()const
|
|
81 |
{
|
|
82 |
return iServiceType;
|
|
83 |
}
|
|
84 |
|
|
85 |
CMDnsQueryRequestParamSet::~CMDnsQueryRequestParamSet ()
|
|
86 |
{
|
|
87 |
iInstanceName.Close ();
|
|
88 |
iServiceType.Close ();
|
|
89 |
}
|
|
90 |
|
|
91 |
// -------------------------------------------------------------------------
|
|
92 |
|
|
93 |
|
|
94 |
CMDnsPtrParamSet* CMDnsPtrParamSet::NewL(RParameterFamily& aFamily)
|
|
95 |
{
|
|
96 |
return static_cast < CMDnsPtrParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsPtrParamset ) );
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
void CMDnsPtrParamSet::SetInstanceNameL(const TDesC8& aName)
|
|
101 |
{
|
|
102 |
iInstanceName.Close ();
|
|
103 |
iInstanceName.CreateL(aName);
|
|
104 |
}
|
|
105 |
|
|
106 |
|
|
107 |
const TDesC8& CMDnsPtrParamSet::InstanceName()const
|
|
108 |
{
|
|
109 |
return iInstanceName;
|
|
110 |
}
|
|
111 |
|
|
112 |
|
|
113 |
void CMDnsPtrParamSet::SetDomainNameL(const TDesC8& aDomainName)
|
|
114 |
{
|
|
115 |
iDomainName.Close ();
|
|
116 |
iDomainName.CreateL(aDomainName);
|
|
117 |
}
|
|
118 |
|
|
119 |
|
|
120 |
const TDesC8& CMDnsPtrParamSet::DomainName() const
|
|
121 |
{
|
|
122 |
return iDomainName;
|
|
123 |
}
|
|
124 |
|
|
125 |
void CMDnsPtrParamSet::SetTtlL(TInt aTtl)
|
|
126 |
{
|
|
127 |
iTtl = aTtl;
|
|
128 |
}
|
|
129 |
|
|
130 |
TInt CMDnsPtrParamSet::Ttl() const
|
|
131 |
{
|
|
132 |
return iTtl;
|
|
133 |
}
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
CMDnsPtrParamSet::~CMDnsPtrParamSet()
|
|
138 |
{
|
|
139 |
iInstanceName.Close();
|
|
140 |
iDomainName.Close();
|
|
141 |
}
|
|
142 |
|
|
143 |
|
|
144 |
//----------------------------------------------------------------------------------------
|
|
145 |
CMDnsSrvParamSet* CMDnsSrvParamSet::NewL(RParameterFamily& aFamily)
|
|
146 |
{
|
|
147 |
return static_cast < CMDnsSrvParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsSrvParamset ) );
|
|
148 |
}
|
|
149 |
|
|
150 |
void CMDnsSrvParamSet::SetDomainNameL(const TDesC8& aDomainName)
|
|
151 |
{
|
|
152 |
iDomainName.Close ();
|
|
153 |
iDomainName.CreateL(aDomainName);
|
|
154 |
}
|
|
155 |
|
|
156 |
const TDesC8& CMDnsSrvParamSet::DomainName() const
|
|
157 |
{
|
|
158 |
return iDomainName;
|
|
159 |
}
|
|
160 |
|
|
161 |
void CMDnsSrvParamSet::SetTargetL(const TDesC8& aTarget)
|
|
162 |
{
|
|
163 |
iTarget.Close ();
|
|
164 |
iTarget.CreateL(aTarget);
|
|
165 |
}
|
|
166 |
|
|
167 |
const TDesC8& CMDnsSrvParamSet::Target() const
|
|
168 |
{
|
|
169 |
return iTarget;
|
|
170 |
}
|
|
171 |
|
|
172 |
void CMDnsSrvParamSet::SetPriority(TUint16 aPriority)
|
|
173 |
{
|
|
174 |
iPrio = aPriority;
|
|
175 |
}
|
|
176 |
|
|
177 |
TUint16 CMDnsSrvParamSet::Priority()const
|
|
178 |
{
|
|
179 |
return iPrio;
|
|
180 |
}
|
|
181 |
|
|
182 |
void CMDnsSrvParamSet::SetWeight(TUint16 aWeight)
|
|
183 |
{
|
|
184 |
iWeight = aWeight;
|
|
185 |
}
|
|
186 |
|
|
187 |
TUint16 CMDnsSrvParamSet::Weight()const
|
|
188 |
{
|
|
189 |
return iWeight;
|
|
190 |
}
|
|
191 |
|
|
192 |
|
|
193 |
void CMDnsSrvParamSet::SetPort(TUint16 aPort)
|
|
194 |
{
|
|
195 |
iPort = aPort;
|
|
196 |
}
|
|
197 |
|
|
198 |
TUint16 CMDnsSrvParamSet::Port()const
|
|
199 |
{
|
|
200 |
return iPort;
|
|
201 |
}
|
|
202 |
|
|
203 |
|
|
204 |
CMDnsSrvParamSet::~CMDnsSrvParamSet()
|
|
205 |
{
|
|
206 |
iTarget.Close();
|
|
207 |
iDomainName.Close();
|
|
208 |
}
|
|
209 |
|
|
210 |
//--------------------------------------------------------------------------------
|
|
211 |
|
|
212 |
CMDnsAddrParamSet* CMDnsAddrParamSet::NewL(RParameterFamily& aFamily)
|
|
213 |
{
|
|
214 |
return static_cast < CMDnsAddrParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsAddrParamset ) );
|
|
215 |
}
|
|
216 |
|
|
217 |
void CMDnsAddrParamSet::SetDomainNameL(const TDesC8& aDomainName)
|
|
218 |
{
|
|
219 |
iDomainName.Close ();
|
|
220 |
iDomainName.CreateL(aDomainName);
|
|
221 |
}
|
|
222 |
|
|
223 |
const TDesC8& CMDnsAddrParamSet::DomainName() const
|
|
224 |
{
|
|
225 |
return iDomainName;
|
|
226 |
}
|
|
227 |
void CMDnsAddrParamSet::SetAddress(TInetAddr aAddr)
|
|
228 |
{
|
|
229 |
iAddr = aAddr;
|
|
230 |
}
|
|
231 |
|
|
232 |
TInetAddr CMDnsAddrParamSet::Address()const
|
|
233 |
{
|
|
234 |
return iAddr;
|
|
235 |
}
|
|
236 |
|
|
237 |
CMDnsAddrParamSet::~CMDnsAddrParamSet()
|
|
238 |
{
|
|
239 |
iDomainName.Close();
|
|
240 |
}
|
|
241 |
|
|
242 |
//-----------------------------------------------------------------------------------
|
|
243 |
CMDnsTxtParamSet* CMDnsTxtParamSet::NewL(RParameterFamily& aFamily)
|
|
244 |
{
|
|
245 |
return static_cast < CMDnsTxtParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsTxtParamset ) );
|
|
246 |
}
|
|
247 |
void CMDnsTxtParamSet::SetDomainNameL(const TDesC8& aDomainName)
|
|
248 |
{
|
|
249 |
iDomainName.Close ();
|
|
250 |
iDomainName.CreateL(aDomainName);
|
|
251 |
}
|
|
252 |
|
|
253 |
const TDesC8& CMDnsTxtParamSet::DomainName() const
|
|
254 |
{
|
|
255 |
return iDomainName;
|
|
256 |
}
|
|
257 |
|
|
258 |
void CMDnsTxtParamSet::AppendTxtData(TDesC8& aData)
|
|
259 |
{
|
|
260 |
_LIT8(KNewLine,"\n");
|
|
261 |
RBuf8 temp;
|
|
262 |
temp.Create(iTxtData.Length() + aData.Length() + KNewLine().Length());
|
|
263 |
temp.Append(iTxtData);
|
|
264 |
temp.Append(aData);
|
|
265 |
temp.Append(KNewLine);
|
|
266 |
iTxtData.Close();
|
|
267 |
iTxtData.Create(temp);
|
|
268 |
temp.Close();
|
|
269 |
}
|
|
270 |
void CMDnsTxtParamSet::TxtDataL(RArray<RBuf8>& aTxtArray)
|
|
271 |
{
|
|
272 |
TokenizeStringL(iTxtData,aTxtArray,'\n');
|
|
273 |
}
|
|
274 |
|
|
275 |
void CMDnsTxtParamSet::TokenizeStringL(RBuf8& aString, RArray<RBuf8>& aList, TChar aSeparator)
|
|
276 |
{
|
|
277 |
TLex8 lexer(aString);
|
|
278 |
|
|
279 |
while(!lexer.Eos())
|
|
280 |
{
|
|
281 |
lexer.SkipSpaceAndMark();
|
|
282 |
|
|
283 |
while(!lexer.Eos() && lexer.Get() != aSeparator)
|
|
284 |
{
|
|
285 |
}
|
|
286 |
|
|
287 |
if(!lexer.Eos())
|
|
288 |
{
|
|
289 |
lexer.UnGet(); // Do not include trailing ','
|
|
290 |
}
|
|
291 |
RBuf8 temp;
|
|
292 |
temp.Create(lexer.MarkedToken());
|
|
293 |
aList.Append(temp);
|
|
294 |
lexer.Inc();
|
|
295 |
}
|
|
296 |
}
|
|
297 |
CMDnsTxtParamSet::~CMDnsTxtParamSet()
|
|
298 |
{
|
|
299 |
iDomainName.Close();
|
|
300 |
iTxtData.Close();
|
|
301 |
}
|
|
302 |
|
|
303 |
//-----------------------------------------------------------------------------------
|
|
304 |
CMDnsPublishResponseParamSet* CMDnsPublishResponseParamSet::NewL(RParameterFamily& aFamily)
|
|
305 |
{
|
|
306 |
return static_cast < CMDnsPublishResponseParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsSrvParamset ) );
|
|
307 |
}
|
|
308 |
void CMDnsPublishResponseParamSet::SetDomainNameL(const TDesC8& aDomainName)
|
|
309 |
{
|
|
310 |
iDomainName.Close ();
|
|
311 |
iDomainName.CreateL(aDomainName);
|
|
312 |
}
|
|
313 |
|
|
314 |
const TDesC8& CMDnsPublishResponseParamSet::DomainName() const
|
|
315 |
{
|
|
316 |
return iDomainName;
|
|
317 |
}
|
|
318 |
|
|
319 |
void CMDnsPublishResponseParamSet::SetError(TInt aError)
|
|
320 |
{
|
|
321 |
iError = aError;
|
|
322 |
}
|
|
323 |
TInt CMDnsPublishResponseParamSet::Error()const
|
|
324 |
{
|
|
325 |
return iError;
|
|
326 |
}
|
|
327 |
|
|
328 |
CMDnsPublishResponseParamSet::~CMDnsPublishResponseParamSet()
|
|
329 |
{
|
|
330 |
iDomainName.Close();
|
|
331 |
|
|
332 |
}
|
|
333 |
//----------------------------------------------------------------------------------------------------------------------------
|
|
334 |
|
|
335 |
CMDnsRegisterNotifyParamSet* CMDnsRegisterNotifyParamSet::NewL(RParameterFamily& aFamily)
|
|
336 |
{
|
|
337 |
return static_cast < CMDnsRegisterNotifyParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsRegisterNotifyParamset ) );
|
|
338 |
}
|
|
339 |
|
|
340 |
void CMDnsRegisterNotifyParamSet::SetInstanceNameL(const TDesC8& aDomainName)
|
|
341 |
{
|
|
342 |
iInstanceName.Close ();
|
|
343 |
iInstanceName.CreateL(aDomainName);
|
|
344 |
}
|
|
345 |
|
|
346 |
const TDesC8& CMDnsRegisterNotifyParamSet::InstanceName() const
|
|
347 |
{
|
|
348 |
return iInstanceName;
|
|
349 |
}
|
|
350 |
|
|
351 |
CMDnsRegisterNotifyParamSet::~CMDnsRegisterNotifyParamSet()
|
|
352 |
{
|
|
353 |
iInstanceName.Close();
|
|
354 |
}
|
|
355 |
//-----------------------------------------------------------------------------------
|
|
356 |
CMDnsPublishParamSet* CMDnsPublishParamSet::NewL(RParameterFamily& aFamily)
|
|
357 |
{
|
|
358 |
return static_cast < CMDnsPublishParamSet* > ( CMDnsParamSetBase::NewL( aFamily, EMdnsPublishParamset ) );
|
|
359 |
}
|
|
360 |
void CMDnsPublishParamSet::SetPublishUpdate(TBool aFlag)
|
|
361 |
{
|
|
362 |
isPublish = aFlag;
|
|
363 |
}
|
|
364 |
|
|
365 |
TBool CMDnsPublishParamSet::PublishUpdate()const
|
|
366 |
{
|
|
367 |
return isPublish;
|
|
368 |
}
|
|
369 |
|
|
370 |
CMDnsPublishParamSet::~CMDnsPublishParamSet()
|
|
371 |
{
|
|
372 |
|
|
373 |
}
|
|
374 |
//----------------------------------------------------------------------------------------------------------------------------
|