|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef CONNECTIONQUERYSET_H |
|
22 #define CONNECTIONQUERYSET_H |
|
23 |
|
24 #include <metadatabase.h> |
|
25 #include <commsdattypeinfov1_1.h> |
|
26 #include <comms-infras/es_commsdataobject.h> |
|
27 #include <comms-infras/ss_commsdataobject.h> |
|
28 #include <comms-infras/api_ext_list.h> |
|
29 #include <comms-infras/connectionqueryfactory.h> |
|
30 #include <comms-infras/commsdataobjectfactory.h> |
|
31 |
|
32 #include <es_enum_internal.h> |
|
33 |
|
34 const TUint KConnectionQuerySetUid = 0x10282FF4; |
|
35 const TUint KTunnelConnQuerySetUid = 0x10285E07; |
|
36 _LIT(KPanicIllegalLayer, "Illegal layer number"); |
|
37 |
|
38 namespace ESock |
|
39 { |
|
40 class XConnectionQuerySet; |
|
41 class MQueryConnSettingsApiExt; |
|
42 |
|
43 class XConnectionQueryBase : public Meta::SMetaDataECom |
|
44 { |
|
45 |
|
46 public: |
|
47 enum TQueryFlags |
|
48 { |
|
49 ENotAnswered = 0x01, // Either Not Attempted or Failed |
|
50 EAnswered = 0x02, // Answered Successfully |
|
51 EFailed = 0x04, // Attempted and Failed (see error code for reason) |
|
52 ENotAttempted = 0x08, // The query has not been attempted (as in nothing has set failed or answered) |
|
53 }; |
|
54 |
|
55 enum TQueryDataType |
|
56 { |
|
57 ENull = 0, |
|
58 EBool, |
|
59 EInt, |
|
60 EUint, |
|
61 EText8, |
|
62 EText16, |
|
63 }; |
|
64 |
|
65 IMPORT_C static XConnectionQueryBase* LoadL(TPtrC8& aDes); |
|
66 |
|
67 TBool Match(const XConnectionQueryBase& aQuery) const |
|
68 { |
|
69 return iElementId == aQuery.iElementId; |
|
70 } |
|
71 |
|
72 inline CommsDat::TMDBElementId ElementId() const |
|
73 { |
|
74 return iElementId; |
|
75 } |
|
76 |
|
77 inline TQueryDataType Type() const |
|
78 { |
|
79 return iType; |
|
80 } |
|
81 |
|
82 inline TUint32 Flags() const |
|
83 { |
|
84 const TUint KSupportedFlags = (ENotAnswered | EAnswered | EFailed | ENotAttempted); |
|
85 return iQueryFlags & KSupportedFlags; |
|
86 } |
|
87 |
|
88 inline TInt Error() const |
|
89 { |
|
90 return iError; |
|
91 } |
|
92 |
|
93 inline TBool IsQueryAnswered() const |
|
94 { |
|
95 return (iQueryFlags & EAnswered) == EAnswered; |
|
96 } |
|
97 |
|
98 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf) = 0; |
|
99 |
|
100 protected: |
|
101 XConnectionQueryBase() |
|
102 : iQueryFlags(ENotAnswered|ENotAttempted), iError(KErrNone), |
|
103 iElementId(0), iType(XConnectionQueryBase::ENull) |
|
104 { |
|
105 } |
|
106 |
|
107 XConnectionQueryBase(CommsDat::TMDBElementId aElementId, XConnectionQueryBase::TQueryDataType aType) |
|
108 : iQueryFlags(ENotAnswered|ENotAttempted), iError(KErrNone), |
|
109 iElementId(aElementId), iType(aType) |
|
110 { |
|
111 } |
|
112 |
|
113 inline void SetElementId(CommsDat::TMDBElementId aElementId) |
|
114 { |
|
115 iElementId = aElementId; |
|
116 } |
|
117 |
|
118 void SetError(TInt aError); |
|
119 void SetQueryAnswered(); |
|
120 |
|
121 private: |
|
122 void SetFlags(TUint32 aFlags); |
|
123 void ClearFlags(TUint32 aFlags); |
|
124 |
|
125 protected: |
|
126 EXPORT_DATA_VTABLE_AND_FN |
|
127 |
|
128 private: |
|
129 TUint32 iQueryFlags; |
|
130 TInt iError; |
|
131 TQueryDataType iType; |
|
132 CommsDat::TMDBElementId iElementId; |
|
133 }; |
|
134 |
|
135 |
|
136 |
|
137 class XBoolQuery : public XConnectionQueryBase |
|
138 { |
|
139 friend class CConnectionQueryFactory; |
|
140 friend class XConnectionQueryBase; |
|
141 |
|
142 public: |
|
143 static inline XBoolQuery* NewL(CommsDat::TMDBElementId aElementId); |
|
144 static inline XBoolQuery* NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet); |
|
145 |
|
146 IMPORT_C virtual ~XBoolQuery(); |
|
147 |
|
148 inline const TBool Data() const |
|
149 { |
|
150 return iData; |
|
151 } |
|
152 |
|
153 protected: |
|
154 // From XConnectionQueryBase |
|
155 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf); |
|
156 |
|
157 private: |
|
158 inline XBoolQuery() |
|
159 : XConnectionQueryBase(0, XConnectionQueryBase::EBool) |
|
160 { |
|
161 } |
|
162 |
|
163 inline XBoolQuery(CommsDat::TMDBElementId aElementId) |
|
164 : XConnectionQueryBase(aElementId, XConnectionQueryBase::EBool) |
|
165 { |
|
166 } |
|
167 |
|
168 inline void SetData(TBool aData) |
|
169 { |
|
170 iData = aData; |
|
171 } |
|
172 |
|
173 private: |
|
174 EXPORT_DATA_VTABLE_AND_FN |
|
175 |
|
176 private: |
|
177 TBool iData; |
|
178 }; |
|
179 |
|
180 |
|
181 class XUintQuery : public XConnectionQueryBase |
|
182 { |
|
183 friend class CConnectionQueryFactory; |
|
184 friend class XConnectionQueryBase; |
|
185 |
|
186 public: |
|
187 static inline XUintQuery* NewL(CommsDat::TMDBElementId aElementId); |
|
188 static inline XUintQuery* NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet); |
|
189 |
|
190 IMPORT_C virtual ~XUintQuery(); |
|
191 |
|
192 inline const TUint32 Data() const |
|
193 { |
|
194 return iData; |
|
195 } |
|
196 |
|
197 protected: |
|
198 // From XConnectionQueryBase |
|
199 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf); |
|
200 |
|
201 private: |
|
202 inline XUintQuery() |
|
203 : XConnectionQueryBase(0, XConnectionQueryBase::EUint) |
|
204 { |
|
205 } |
|
206 |
|
207 inline XUintQuery(CommsDat::TMDBElementId aElementId) |
|
208 : XConnectionQueryBase(aElementId, XConnectionQueryBase::EUint) |
|
209 { |
|
210 } |
|
211 |
|
212 inline void SetData(TUint32 aData) |
|
213 { |
|
214 iData = aData; |
|
215 } |
|
216 |
|
217 private: |
|
218 EXPORT_DATA_VTABLE_AND_FN |
|
219 |
|
220 private: |
|
221 TUint32 iData; |
|
222 }; |
|
223 |
|
224 |
|
225 |
|
226 class XIntQuery : public XConnectionQueryBase |
|
227 { |
|
228 friend class CConnectionQueryFactory; |
|
229 friend class XConnectionQueryBase; |
|
230 |
|
231 public: |
|
232 static inline XIntQuery* NewL(CommsDat::TMDBElementId aElementId); |
|
233 static inline XIntQuery* NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet); |
|
234 |
|
235 IMPORT_C virtual ~XIntQuery(); |
|
236 |
|
237 inline const TInt Data() const |
|
238 { |
|
239 return iData; |
|
240 } |
|
241 |
|
242 protected: |
|
243 // From XConnectionQueryBase |
|
244 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf); |
|
245 |
|
246 private: |
|
247 inline XIntQuery() |
|
248 : XConnectionQueryBase(0, XConnectionQueryBase::EInt) |
|
249 { |
|
250 } |
|
251 |
|
252 inline XIntQuery(CommsDat::TMDBElementId aElementId) |
|
253 : XConnectionQueryBase(aElementId, XConnectionQueryBase::EInt) |
|
254 { |
|
255 } |
|
256 |
|
257 inline void SetData(TInt aData) |
|
258 { |
|
259 iData = aData; |
|
260 } |
|
261 |
|
262 private: |
|
263 EXPORT_DATA_VTABLE_AND_FN |
|
264 |
|
265 private: |
|
266 TInt iData; |
|
267 }; |
|
268 |
|
269 |
|
270 class XText8Query : public XConnectionQueryBase |
|
271 { |
|
272 friend class CConnectionQueryFactory; |
|
273 friend class XConnectionQueryBase; |
|
274 |
|
275 public: |
|
276 static inline XText8Query* NewL(CommsDat::TMDBElementId aElementId); |
|
277 static inline XText8Query* NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet); |
|
278 |
|
279 IMPORT_C virtual ~XText8Query(); |
|
280 |
|
281 inline const TDesC8& Data() const |
|
282 { |
|
283 return iData; |
|
284 } |
|
285 |
|
286 protected: |
|
287 // From XConnectionQueryBase |
|
288 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf); |
|
289 |
|
290 private: |
|
291 inline XText8Query() |
|
292 : XConnectionQueryBase(0, XConnectionQueryBase::EText8) |
|
293 { |
|
294 } |
|
295 |
|
296 inline XText8Query(CommsDat::TMDBElementId aElementId) |
|
297 : XConnectionQueryBase(aElementId, XConnectionQueryBase::EText8) |
|
298 { |
|
299 } |
|
300 |
|
301 inline void SetData(const TDesC8& aData) |
|
302 { |
|
303 iData.Close(); |
|
304 iData.Create(aData); |
|
305 } |
|
306 |
|
307 private: |
|
308 EXPORT_DATA_VTABLE_AND_FN |
|
309 |
|
310 private: |
|
311 RBuf8 iData; |
|
312 }; |
|
313 |
|
314 |
|
315 class XText16Query : public XConnectionQueryBase |
|
316 { |
|
317 friend class CConnectionQueryFactory; |
|
318 friend class XConnectionQueryBase; |
|
319 |
|
320 public: |
|
321 static inline XText16Query* NewL(CommsDat::TMDBElementId aElementId); |
|
322 static inline XText16Query* NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet); |
|
323 |
|
324 IMPORT_C virtual ~XText16Query(); |
|
325 |
|
326 inline const TDesC16& Data() const |
|
327 { |
|
328 return iData; |
|
329 } |
|
330 |
|
331 protected: |
|
332 // From XConnectionQueryBase |
|
333 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf); |
|
334 |
|
335 private: |
|
336 inline XText16Query() |
|
337 : XConnectionQueryBase(0, XConnectionQueryBase::EText16) |
|
338 { |
|
339 } |
|
340 |
|
341 inline XText16Query(CommsDat::TMDBElementId aElementId) |
|
342 : XConnectionQueryBase(aElementId, XConnectionQueryBase::EText16) |
|
343 { |
|
344 } |
|
345 |
|
346 private: |
|
347 EXPORT_DATA_VTABLE_AND_FN |
|
348 |
|
349 private: |
|
350 RBuf16 iData; |
|
351 }; |
|
352 |
|
353 |
|
354 |
|
355 class TConnectionQueryIter |
|
356 { |
|
357 public: |
|
358 explicit inline TConnectionQueryIter(const Meta::RMetaDataContainer<XConnectionQueryBase>& aQueries, TUint aFilter) |
|
359 : iQueries(aQueries), iFilter(aFilter), iIndex(0) |
|
360 { |
|
361 } |
|
362 |
|
363 inline void SetToLast() |
|
364 { |
|
365 iIndex = iQueries.Count() - 1; |
|
366 } |
|
367 |
|
368 inline XConnectionQueryBase* operator++(TInt /*aInd*/) //-postfix |
|
369 { |
|
370 XConnectionQueryBase* query = Find(iIndex, +1, 1); |
|
371 iIndex++; |
|
372 return query; |
|
373 } |
|
374 |
|
375 inline XConnectionQueryBase* operator++() //-prefix |
|
376 { |
|
377 ++iIndex; |
|
378 return Find(iIndex, +1, 1); |
|
379 } |
|
380 |
|
381 inline XConnectionQueryBase* operator--(TInt /*aInd*/) //-postfix |
|
382 { |
|
383 XConnectionQueryBase* query = Find(iIndex, -1, 1); |
|
384 iIndex--; |
|
385 return query; |
|
386 } |
|
387 |
|
388 inline XConnectionQueryBase* operator[](TInt aInd) |
|
389 { |
|
390 // assuming at present that array indices start from beginning of array |
|
391 // rather than current location of iterator, and array access doesn't |
|
392 // change location of iterator. |
|
393 TInt prevIndex = iIndex; |
|
394 TInt start = 0; |
|
395 XConnectionQueryBase* query = Find(start, +1, aInd + 1); |
|
396 iIndex = prevIndex; |
|
397 return query; |
|
398 } |
|
399 |
|
400 inline XConnectionQueryBase* operator*() |
|
401 { |
|
402 return Find(iIndex, +1, 0); |
|
403 } |
|
404 |
|
405 |
|
406 private: |
|
407 XConnectionQueryBase* Find(TInt& aIndex, TInt aDirection, TInt aCount) |
|
408 { |
|
409 while (aIndex >= 0 && aIndex < iQueries.Count()) |
|
410 { |
|
411 XConnectionQueryBase* query = static_cast<XConnectionQueryBase* const>(iQueries[aIndex]); |
|
412 if ((query->Flags() & iFilter) && (--aCount <= 0)) |
|
413 { |
|
414 iIndex = aIndex; |
|
415 return query; |
|
416 } |
|
417 aIndex += aDirection; |
|
418 } |
|
419 return NULL; |
|
420 } |
|
421 |
|
422 |
|
423 private: |
|
424 const Meta::RMetaDataContainer<XConnectionQueryBase>& iQueries; |
|
425 TUint iFilter; |
|
426 TInt iIndex; |
|
427 }; |
|
428 |
|
429 |
|
430 |
|
431 class CConnectionQuerySet; |
|
432 class XConnectionQuerySet : public XCommsDataObject |
|
433 { |
|
434 friend class CCommsDataObjectFactory; |
|
435 friend class CCommsDataObject<CConnectionQuerySet, XConnectionQuerySet>; |
|
436 friend class CConnectionQueryFactory; |
|
437 |
|
438 private: |
|
439 /** |
|
440 Null query object used internally for finding a query with a particular |
|
441 element id |
|
442 @internalComponent |
|
443 */ |
|
444 class XNullQuery : public XConnectionQueryBase |
|
445 { |
|
446 friend class ESock::CConnectionQueryFactory; |
|
447 friend class ESock::XConnectionQuerySet; |
|
448 |
|
449 public: |
|
450 static inline XNullQuery* NewL(CommsDat::TMDBElementId aElementId) |
|
451 { |
|
452 XNullQuery* query = static_cast<XNullQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::ENull))); |
|
453 query->SetElementId(aElementId); |
|
454 return query; |
|
455 } |
|
456 |
|
457 protected: |
|
458 // From XConnectionQueryBase |
|
459 IMPORT_C virtual void GetSetting(MQueryConnSettingsApiExt* aItfPtr, MPlatsecApiExt* aPlatsecItf); |
|
460 |
|
461 private: |
|
462 XNullQuery() |
|
463 { |
|
464 } |
|
465 |
|
466 XNullQuery(CommsDat::TMDBElementId aElementId) |
|
467 : XConnectionQueryBase(aElementId, XConnectionQueryBase::ENull) |
|
468 { |
|
469 } |
|
470 |
|
471 private: |
|
472 EXPORT_DATA_VTABLE_AND_FN |
|
473 }; |
|
474 |
|
475 public: |
|
476 enum |
|
477 { |
|
478 iUid = KConnectionQuerySetUid |
|
479 }; |
|
480 |
|
481 typedef Meta::RMetaDataContainer<XConnectionQueryBase> RMetaDataQueryContainer; |
|
482 |
|
483 static inline XConnectionQuerySet* NewL() |
|
484 { |
|
485 return static_cast<XConnectionQuerySet*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CCommsDataObjectFactory::iUid, KConnectionQuerySetUid))); |
|
486 } |
|
487 |
|
488 inline TConnectionQueryIter GetQueryIter(TUint aFilter) const |
|
489 { |
|
490 return TConnectionQueryIter(iQueries, aFilter); |
|
491 } |
|
492 |
|
493 inline void AddQueryL(XConnectionQueryBase* const aQuery) |
|
494 { |
|
495 if (!aQuery) |
|
496 { |
|
497 User::Leave(KErrArgument); |
|
498 } |
|
499 |
|
500 iQueries.AppendL(aQuery); |
|
501 } |
|
502 |
|
503 |
|
504 inline void ResetAndDestroy() |
|
505 { |
|
506 iQueries.ResetAndDestroy(); |
|
507 } |
|
508 |
|
509 |
|
510 inline XConnectionQueryBase* FindQuery(CommsDat::TMDBElementId aElementId) const |
|
511 { |
|
512 return FindQuery(XNullQuery(aElementId)); |
|
513 } |
|
514 |
|
515 IMPORT_C XConnectionQueryBase* FindQuery(const XConnectionQueryBase& aQuery) const; |
|
516 |
|
517 IMPORT_C virtual ~XConnectionQuerySet(); |
|
518 |
|
519 // From XCommsDataObject |
|
520 IMPORT_C virtual TProgressAction DispatchL(TAny* aItfPtr, ESock::MPlatsecApiExt* aPlatsecItf); |
|
521 |
|
522 protected: |
|
523 inline XConnectionQuerySet() |
|
524 : XCommsDataObject( |
|
525 (TUint)(XCommsDataObject::EGetSupported | XCommsDataObject::EProgressive), |
|
526 (TUint) MQueryConnSettingsApiExt::KInterfaceId) |
|
527 { |
|
528 } |
|
529 |
|
530 protected: |
|
531 TUint iFilter; |
|
532 |
|
533 private: |
|
534 EXPORT_DATA_VTABLE_AND_FN |
|
535 protected: |
|
536 RMetaDataQueryContainer iQueries; |
|
537 }; |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 class CConnectionQuerySet : public CCommsDataObject<CConnectionQuerySet, XConnectionQuerySet> |
|
543 { |
|
544 protected: |
|
545 inline CConnectionQuerySet(XConnectionQuerySet* aDataObject) |
|
546 : CCommsDataObject<CConnectionQuerySet, XConnectionQuerySet>(aDataObject) |
|
547 { |
|
548 } |
|
549 }; |
|
550 |
|
551 // ---------------- Inline methods ---------------- |
|
552 inline XBoolQuery* XBoolQuery::NewL(CommsDat::TMDBElementId aElementId) |
|
553 { |
|
554 XBoolQuery* self = static_cast<XBoolQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EBool))); |
|
555 self->SetElementId(aElementId); |
|
556 return self; |
|
557 } |
|
558 |
|
559 inline XBoolQuery* XBoolQuery::NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet) |
|
560 { |
|
561 XBoolQuery* self = static_cast<XBoolQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EBool))); |
|
562 self->SetElementId(aElementId); |
|
563 CleanupDeletePushL(self); |
|
564 aQuerySet.AddQueryL(self); |
|
565 CleanupStack::Pop(); |
|
566 return self; |
|
567 } |
|
568 |
|
569 |
|
570 |
|
571 inline XUintQuery* XUintQuery::NewL(CommsDat::TMDBElementId aElementId) |
|
572 { |
|
573 XUintQuery* self = static_cast<XUintQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EUint))); |
|
574 self->SetElementId(aElementId); |
|
575 return self; |
|
576 } |
|
577 |
|
578 inline XUintQuery* XUintQuery::NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet) |
|
579 { |
|
580 XUintQuery* self = static_cast<XUintQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EUint))); |
|
581 self->SetElementId(aElementId); |
|
582 CleanupDeletePushL(self); |
|
583 aQuerySet.AddQueryL(self); |
|
584 CleanupStack::Pop(); |
|
585 return self; |
|
586 } |
|
587 |
|
588 |
|
589 |
|
590 inline XIntQuery* XIntQuery::NewL(CommsDat::TMDBElementId aElementId) |
|
591 { |
|
592 XIntQuery* self = static_cast<XIntQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EInt))); |
|
593 self->SetElementId(aElementId); |
|
594 return self; |
|
595 } |
|
596 |
|
597 inline XIntQuery* XIntQuery::NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet) |
|
598 { |
|
599 XIntQuery* self = static_cast<XIntQuery*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EInt))); |
|
600 self->SetElementId(aElementId); |
|
601 CleanupDeletePushL(self); |
|
602 aQuerySet.AddQueryL(self); |
|
603 CleanupStack::Pop(); |
|
604 return self; |
|
605 } |
|
606 |
|
607 |
|
608 |
|
609 inline XText8Query* XText8Query::NewL(CommsDat::TMDBElementId aElementId) |
|
610 { |
|
611 XText8Query* self = static_cast<XText8Query*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EText8))); |
|
612 self->SetElementId(aElementId); |
|
613 return self; |
|
614 } |
|
615 |
|
616 inline XText8Query* XText8Query::NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet) |
|
617 { |
|
618 XText8Query* self = static_cast<XText8Query*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EText8))); |
|
619 self->SetElementId(aElementId); |
|
620 CleanupDeletePushL(self); |
|
621 aQuerySet.AddQueryL(self); |
|
622 CleanupStack::Pop(); |
|
623 return self; |
|
624 } |
|
625 |
|
626 |
|
627 |
|
628 inline XText16Query* XText16Query::NewL(CommsDat::TMDBElementId aElementId) |
|
629 { |
|
630 XText16Query* self = static_cast<XText16Query*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EText16))); |
|
631 self->SetElementId(aElementId); |
|
632 return self; |
|
633 } |
|
634 |
|
635 inline XText16Query* XText16Query::NewL(CommsDat::TMDBElementId aElementId, XConnectionQuerySet& aQuerySet) |
|
636 { |
|
637 XText16Query* self = static_cast<XText16Query*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CConnectionQueryFactory::iUid, XConnectionQueryBase::EText16))); |
|
638 self->SetElementId(aElementId); |
|
639 CleanupDeletePushL(self); |
|
640 aQuerySet.AddQueryL(self); |
|
641 CleanupStack::Pop(); |
|
642 return self; |
|
643 } |
|
644 |
|
645 |
|
646 class CTunnelConnQuerySet; |
|
647 /** |
|
648 For connection data query in a tunnel comms stack |
|
649 The default constructor is for query on the bottom connection |
|
650 @internalComponent |
|
651 */ |
|
652 class XTunnelConnQuerySet : public XConnectionQuerySet |
|
653 { |
|
654 friend class CCommsDataObject<CTunnelConnQuerySet, XTunnelConnQuerySet>; |
|
655 |
|
656 private: |
|
657 EXPORT_DATA_VTABLE_AND_FN |
|
658 TInt iLayerNum; |
|
659 |
|
660 public: |
|
661 enum TTunnelQuerySpecLayer |
|
662 { |
|
663 EBottomIAPLayer = -1, |
|
664 }; |
|
665 |
|
666 enum TTunnelQueryPanics |
|
667 { |
|
668 ETunnelQueryInvalidLayer = 1, |
|
669 }; |
|
670 |
|
671 public: |
|
672 inline XTunnelConnQuerySet() : iLayerNum(EBottomIAPLayer) |
|
673 { |
|
674 }; |
|
675 |
|
676 // (aLayerNum - 1) means the number of layer(s) be skipped |
|
677 // aLayerNum must be greater than zero |
|
678 inline XTunnelConnQuerySet(TInt aLayerNum) : iLayerNum(aLayerNum) |
|
679 { |
|
680 __ASSERT_ALWAYS(((0 == aLayerNum || aLayerNum < EBottomIAPLayer)), User::Panic(KPanicIllegalLayer, ETunnelQueryInvalidLayer)); |
|
681 }; |
|
682 |
|
683 public: |
|
684 enum |
|
685 { |
|
686 iUid = KTunnelConnQuerySetUid |
|
687 }; |
|
688 // Default one, gets the bottom IAP |
|
689 static inline XTunnelConnQuerySet* NewL() |
|
690 { |
|
691 XTunnelConnQuerySet* self = static_cast<XTunnelConnQuerySet*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CCommsDataObjectFactory::iUid, KTunnelConnQuerySetUid))); |
|
692 return self; |
|
693 }; |
|
694 |
|
695 // Get the aLayerNumTH layer IAP |
|
696 static inline XTunnelConnQuerySet* NewL(TInt aLayerNum) |
|
697 { |
|
698 XTunnelConnQuerySet* self = static_cast<XTunnelConnQuerySet*>(Meta::SMetaDataECom::NewInstanceL(Meta::STypeId::CreateSTypeId(CCommsDataObjectFactory::iUid, KTunnelConnQuerySetUid))); |
|
699 self->SetLayerNum(aLayerNum); |
|
700 return self; |
|
701 }; |
|
702 |
|
703 IMPORT_C virtual TProgressAction DispatchL(TAny *aItfPtr, ESock::MPlatsecApiExt* aPlatsecItf); |
|
704 |
|
705 private: |
|
706 void inline SetLayerNum(TInt aLayerNum) |
|
707 { |
|
708 iLayerNum = aLayerNum; |
|
709 }; |
|
710 }; |
|
711 |
|
712 |
|
713 class CTunnelConnQuerySet : public CCommsDataObject<CTunnelConnQuerySet, XTunnelConnQuerySet> |
|
714 { |
|
715 protected: |
|
716 /** |
|
717 C'tor for the CCommsDataObject class. |
|
718 @param aDataObject A ptr to the data object to take ownership of |
|
719 */ |
|
720 inline CTunnelConnQuerySet(XTunnelConnQuerySet* aDataObject); |
|
721 }; |
|
722 |
|
723 // ---------------- Inline methods ---------------- |
|
724 inline CTunnelConnQuerySet::CTunnelConnQuerySet(XTunnelConnQuerySet* aDataObject) |
|
725 : CCommsDataObject<CTunnelConnQuerySet, XTunnelConnQuerySet>(aDataObject) |
|
726 {}; |
|
727 |
|
728 } // namespace ESock |
|
729 |
|
730 #endif |
|
731 // CONNECTIONQUERYSET_H |
|
732 |
|
733 |