|
1 /* |
|
2 * Copyright (c) 2010 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 #ifndef CMDNSCACHEMAP_H_ |
|
18 #define CMDNSCACHEMAP_H_ |
|
19 |
|
20 #include <e32hashtab.h> |
|
21 #include "cserviceinfo.h" |
|
22 |
|
23 |
|
24 class CMDNSCacheMap : public CBase |
|
25 { |
|
26 public: |
|
27 |
|
28 static CMDNSCacheMap* NewL(TUint aMaxCacheEntries); |
|
29 static CMDNSCacheMap* NewLC(TUint aMaxCacheEntries); |
|
30 |
|
31 |
|
32 void UpdateL(const TDesC8& aName, CServiceInfo* aEntry); |
|
33 CServiceInfo* Find(const TDesC8& aServiceInstanceName); |
|
34 void FindEntries(const TDesC8& aName,RPointerArray <const CServiceInfo> & aEntries); |
|
35 /*?? Do I require this method??*/void AuthoritativeRecordsL(RPointerArray <const CServiceInfo> & aEntries); |
|
36 TInt DeleteL(const TDesC8& aServiceInstanceName); |
|
37 void DeleteAllEntries(); |
|
38 |
|
39 TUint32 NumberOfEntries(); |
|
40 |
|
41 void DumpCacheL(); |
|
42 |
|
43 //Used to trace the entire Cache, return number of cache activities |
|
44 CServiceInfo* NextStaleEntry(TBool aActiveCacheMgmtEnabled,TBool aIteratorReset); |
|
45 |
|
46 ~CMDNSCacheMap(); |
|
47 |
|
48 |
|
49 private: |
|
50 |
|
51 /*What to do if the number of entries in Hash Table exceed 200?? |
|
52 * Delete a entries, based on Least Recently Used |
|
53 * Need to keep track of unused entries/ least recently used |
|
54 * in the cache ; to delete them and make room for new entries*/ |
|
55 |
|
56 //Algorithm to keep track of the Least Recently Used Records |
|
57 TBool DeleteLeastRecentlyUsed(); |
|
58 |
|
59 |
|
60 void ConstructL(); |
|
61 CMDNSCacheMap(TUint aMaxCacheEntries); |
|
62 |
|
63 private: |
|
64 |
|
65 RHashMap<TPtrC8,CServiceInfo*> iCacheEntries; |
|
66 |
|
67 THashMapIter<TPtrC8,CServiceInfo*> iterate; |
|
68 |
|
69 TUint iMaxCacheEntries; |
|
70 |
|
71 /** |
|
72 FLOGGER debug trace member variable. |
|
73 */ |
|
74 __FLOG_DECLARATION_MEMBER; |
|
75 |
|
76 }; |
|
77 |
|
78 |
|
79 #endif /*CMDNSCACHEMAP_H_*/ |