zeroconf/cachemanager/inc/mdnscachemgr.h
changeset 14 da856f45b798
equal deleted inserted replaced
12:78fbd574edf4 14:da856f45b798
       
     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 
       
    18 #ifndef MDNSCACHEMGR_H_
       
    19 #define MDNSCACHEMGR_H_
       
    20 
       
    21 
       
    22 #include <e32cmn.h> 
       
    23 #include <mdns/dnsconstants.h>
       
    24 
       
    25 
       
    26 class CDnsResourceData;
       
    27 class CCacheEntry;
       
    28 
       
    29 
       
    30 class MDNSCacheMgr
       
    31 	{
       
    32 	public:
       
    33 
       
    34 	/*Inserts a new entry into the Cache
       
    35 	 @param CDnsResourceData, Resource Record
       
    36 	 @param aAuthoritative indicates whether the record being inserted is authoritative
       
    37 	 @param aSessionId, to indicate to which Session does the entry belong to
       
    38 	 @leave KErrNoMemory if memory could not be allocated to store the copies of Key and Value*/
       
    39 	virtual void UpdateCacheL(CDnsResourceData& aEntry,TBool aAuthoritative,TUint32 aSessionId)=0;
       
    40 	
       
    41 	/*Caters to finding varying types of records, for e.g:- find all the entries
       
    42 	 that correspond to a particular service type or find the host name through the address record
       
    43 	 @param aEntries List of entries that match the search constraint
       
    44 	 @param	aInfo could represent any serach constraint Service Instance Type or the Host Name
       
    45 	 @param aType the desired record type
       
    46 	 */
       
    47 	virtual TInt FindServiceL(RPointerArray <CCacheEntry> & aEntries,const TDesC8& aName,TDnsType aType)const=0;
       
    48 
       
    49 	/*Deletes the specified entry from the Cache
       
    50 	 @param aServiceInstanceName Instance Name , whose entry needs to be deleted 
       
    51 	 @leave KErrNotFound if specified entry is not found
       
    52 	 */
       
    53 	virtual TInt DeleteEntryL(const TDesC8& aServiceInstanceName)=0;
       
    54 
       
    55 	
       
    56 	/*Flush all the entries in the cache
       
    57 		 * 1. On start up
       
    58 		 * 2. On Failure
       
    59 		 * 3. On Topology change
       
    60 		 */
       
    61 	virtual void FlushCache()=0;		
       
    62 	
       
    63 	/*During Iteration, fetches the next stale entry ( entry whose ttl has expired - to be deleted 
       
    64 	  or whose 80% ttl has expired - to be queried on the network)
       
    65 	 @param aActiveCacheMgmtEnabled flag to indicate if Pro-active Cache Mgmt is to be enabled
       
    66 	 */
       
    67 	virtual CCacheEntry* NextStaleEntry(TBool aActiveCacheMgmtEnabled,TBool aIteratorReset)=0;
       
    68 	
       
    69 	/*Returns all the Authoritative Cache En tries for Announcement
       
    70 	@param aEntries Output param ,containing all authoritative entries
       
    71 	*/
       
    72 	virtual void AuthoritativeEntriesL(RPointerArray <CCacheEntry> & aEntries)=0;
       
    73 	
       
    74 	/*Returns the current number of entries in Cache*/
       
    75 	virtual TUint NumberOfEntries()=0;
       
    76 	
       
    77 	/*Dump all the entries in Cache- Debug Purposes*/
       
    78 	virtual void DumpCacheL()=0;
       
    79 	
       
    80 	/*Virtual destructor so that the delete gets called for all the
       
    81 	 Cache Implementation Interfaces*/ 	
       
    82 	virtual ~MDNSCacheMgr(){}
       
    83 		
       
    84 	};
       
    85 
       
    86 
       
    87 
       
    88 #endif /*MDNSCACHEMGR_H_*/