diff -r 78fbd574edf4 -r da856f45b798 zeroconf/cachemanager/inc/cmdnscachemap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zeroconf/cachemanager/inc/cmdnscachemap.h Thu Jun 24 19:09:47 2010 +0530 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef CMDNSCACHEMAP_H_ +#define CMDNSCACHEMAP_H_ + +#include +#include "cserviceinfo.h" + + +class CMDNSCacheMap : public CBase + { + public: + + static CMDNSCacheMap* NewL(TUint aMaxCacheEntries); + static CMDNSCacheMap* NewLC(TUint aMaxCacheEntries); + + + void UpdateL(const TDesC8& aName, CServiceInfo* aEntry); + CServiceInfo* Find(const TDesC8& aServiceInstanceName); + void FindEntries(const TDesC8& aName,RPointerArray & aEntries); + /*?? Do I require this method??*/void AuthoritativeRecordsL(RPointerArray & aEntries); + TInt DeleteL(const TDesC8& aServiceInstanceName); + void DeleteAllEntries(); + + TUint32 NumberOfEntries(); + + void DumpCacheL(); + + //Used to trace the entire Cache, return number of cache activities + CServiceInfo* NextStaleEntry(TBool aActiveCacheMgmtEnabled,TBool aIteratorReset); + + ~CMDNSCacheMap(); + + + private: + + /*What to do if the number of entries in Hash Table exceed 200?? + * Delete a entries, based on Least Recently Used + * Need to keep track of unused entries/ least recently used + * in the cache ; to delete them and make room for new entries*/ + + //Algorithm to keep track of the Least Recently Used Records + TBool DeleteLeastRecentlyUsed(); + + + void ConstructL(); + CMDNSCacheMap(TUint aMaxCacheEntries); + + private: + + RHashMap iCacheEntries; + + THashMapIter iterate; + + TUint iMaxCacheEntries; + + /** + FLOGGER debug trace member variable. + */ + __FLOG_DECLARATION_MEMBER; + + }; + + +#endif /*CMDNSCACHEMAP_H_*/