zeroconf/cachemanager/inc/cserviceinfo.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 #ifndef CSERVICEINFO_H_
       
    18 #define CSERVICEINFO_H_
       
    19 
       
    20 
       
    21 #include "mdnsrecordinfo.h"
       
    22 #include "mdnsdebug.h"
       
    23 #include <mdns/crdtypea.h>
       
    24 #include <mdns/crdtypetxt.h>
       
    25 #include <mdns/crdtypesrv.h>
       
    26 #include <mdns/crdtypeptr.h>
       
    27 
       
    28 using namespace HashInfo;
       
    29 
       
    30 
       
    31 class CServiceInfo : public CBase
       
    32 	{
       
    33 	public:
       
    34 
       
    35 	static CServiceInfo* NewL();
       
    36 	static CServiceInfo* NewLC();
       
    37 
       
    38 	TBool IsAuthoritative()const;
       
    39 	void SetAuthoritative(TBool aAuthoritative);
       
    40 
       
    41 	const TTime& LastAccessTime()const;
       
    42 	void SetAccessTime(TTime aTime);
       
    43 
       
    44 	TUint32 SessionId()const;
       
    45 	void SetSessionId(TUint32 aSessionId);
       
    46 
       
    47 	void SetAddressRecord(CRdTypeA* aAddressRecord);
       
    48 	void SetServiceRecord(CRdTypeSrv* aServiceRecord);
       
    49 	void SetPtrRecord(CRdTypePtr* aPtrRecord);
       
    50 	void SetTxtRecord(CRdTypeTxt* aTxtRecord);	
       
    51 	
       
    52 	const TTime& EntryTime(TCacheEntryType aType)const;
       
    53 	const TTime& ExpiryTime(TCacheEntryType aType)const;
       
    54 	
       
    55 	void SetEntryTime(TCacheEntryType aType);
       
    56 	void SetExpiryTime(TCacheEntryType aType);
       
    57 	
       
    58 	void SetKeyL(const TDesC8& aKey);
       
    59 	const TDesC8& Key()const;
       
    60 	
       
    61 	CRdTypeA* AddressRecord()const;
       
    62 	CRdTypeSrv* ServiceRecord()const;
       
    63 	CRdTypePtr* PtrRecord()const;
       
    64 	CRdTypeTxt* TxtRecord()const;
       
    65 	
       
    66 	TBool EntryExpired();
       
    67 	
       
    68 	TBool EntryToBeQueried();
       
    69 	
       
    70 	CServiceInfo* CloneL()const;
       
    71 	
       
    72 	//Mark the entry as expired if ttl has become zero
       
    73 	TBool StaleEntry();
       
    74 
       
    75 	~CServiceInfo();
       
    76 
       
    77 	private:			
       
    78 
       
    79 	void ConstructL();
       
    80 	CServiceInfo();
       
    81 
       
    82 	private:	
       
    83 
       
    84 	CRdTypeA* iAddressRecord;
       
    85 	CRdTypeSrv* iServiceRecord;
       
    86 	CRdTypePtr* iPtrRecord;
       
    87 	CRdTypeTxt* iTxtRecord;
       
    88 
       
    89 	TTime iLastAccessTime;
       
    90 	TBool iAuthoritative;
       
    91 	TUint32 iSessionId;
       
    92 	
       
    93 	RBuf8 iKey;
       
    94 	
       
    95 	//Entries are Indexed by TCacheEntryType
       
    96 	RArray <TTime> iEntryTime;
       
    97 	
       
    98 	//Entries are Indexed by TCacheEntryType
       
    99 	RArray <TTime> iExpiryTime;
       
   100 
       
   101 	TBool iEntryExpired;
       
   102 	
       
   103 	};
       
   104 	
       
   105 	
       
   106 #endif /*CSERVICEINFO_H_*/