zeroconf/server/inc/cbasehandler.h
changeset 14 da856f45b798
equal deleted inserted replaced
12:78fbd574edf4 14:da856f45b798
       
     1 // Copyright (c) 2008-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 // cbasehandler.h
       
    15 // 
       
    16 //
       
    17 /**
       
    18 @file
       
    19 @internalTechnology
       
    20 */
       
    21 
       
    22 #ifndef __CBASEHANDLER_H__
       
    23 #define __CBASEHANDLER_H__
       
    24 //System include 
       
    25 #include <mdns/cdnsmessage.h>
       
    26 
       
    27 //User include
       
    28 #include "cmessagehandler.h"
       
    29 #include "mdnsdebug.h"
       
    30 
       
    31 class COutStandingQuery : public CBase
       
    32 	{
       
    33 	public :
       
    34 		static COutStandingQuery* NewL(CDnsMessage* aDnsMessage,TInt aTransactionId,TTime aTime, TSockAddr aAddr);
       
    35 		~COutStandingQuery();
       
    36 		 TTime GetAddTime()const;
       
    37 		TInt TransactionId()const ;
       
    38 		TSockAddr SocketAddress()const;
       
    39 		CDnsMessage& DnsMessage()const; 
       
    40 		TInt ClientHandle()const;
       
    41 		void SetClientHandle(TInt aHandle);
       
    42 	private:
       
    43 		void ConstructL();
       
    44 		COutStandingQuery(CDnsMessage* aDnsMessage,TInt aTransactionId,TTime aTime, TSockAddr aAddr);
       
    45 	
       
    46 	
       
    47 	private:
       
    48 	 	TInt iTransactionID;
       
    49 	 	TTime iReviewTime;
       
    50 	 	TSockAddr iSockAddress;
       
    51 	 	CDnsMessage* iDnsMessage;
       
    52 	 	TInt iClientHandle;
       
    53 	 	/**
       
    54 	 	    *FLOGGER debug trace member variable.
       
    55 	 	    */
       
    56 	 	    __FLOG_DECLARATION_MEMBER_MUTABLE;
       
    57 	};
       
    58 
       
    59 /**
       
    60 This is a Baseclass to handle common functionality to both the response and query handler
       
    61 this contains a reference to messagehandler which the derived class can make use of using 
       
    62 the MessageHandler() api
       
    63 
       
    64 A reference to cache entry to be passed in order to build a cache wrapper as cache requires
       
    65 all the records to be present in the CacheEntry variable.
       
    66 
       
    67 Seperate functions are provide to handle address,pointer,text and srv records as , same can 
       
    68 be used by both query and response handler.
       
    69  
       
    70 */
       
    71 class CBaseHandler : public CTimer
       
    72 	{
       
    73 	public :
       
    74 	 	static CBaseHandler* NewL(CMessageHandler& aMessageHandler);
       
    75 	 	virtual ~CBaseHandler();
       
    76 	 	
       
    77 	 	//From CTimer
       
    78 	 	void RunL();
       
    79 	 	void DoCancel();
       
    80 	 	
       
    81 	 	virtual void HandleIncomingPacketL(CDnsMessage& aMessage, const TSockAddr& aAddr);
       
    82 	 	 	
       
    83 	protected:
       
    84 	   	CBaseHandler(CMessageHandler& aMessageHandler);
       
    85 	   	void ConstructL();
       
    86 	   	CMessageHandler& MessageHandler()const;
       
    87 	   
       
    88 	protected:
       
    89 		RPointerArray<COutStandingQuery> iOutStandingQueryArray;
       
    90 		TBool IsLastTruncated;    	
       
    91 	 		 		
       
    92 	private:
       
    93 		CMessageHandler& iMessageHandler; 
       
    94 		/**
       
    95 		    *FLOGGER debug trace member variable.
       
    96 		    */
       
    97 		    __FLOG_DECLARATION_MEMBER_MUTABLE; 
       
    98 	};
       
    99 
       
   100 #endif