tcpiputils/dnd/inc/demon.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2004-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 // demon.h - API between main (ui) and engine for daemons
       
    15 //
       
    16 
       
    17 #ifndef __DEMON_H
       
    18 #define __DEMON_H
       
    19 
       
    20 #include <e32base.h>
       
    21 /**
       
    22 @file demon.h
       
    23 DNS main
       
    24 @internalComponent	Domain Name Resolver
       
    25 */
       
    26 
       
    27 /**
       
    28 // Services offered by the appication main to the engine.
       
    29 //
       
    30 // A bare bones API definition which allows to write
       
    31 // the DND <b>engine</b> part without a need to make two versions
       
    32 // if daemon application is with, or without the user interface.
       
    33 */
       
    34 class MDemonMain
       
    35 	{
       
    36 public:
       
    37 	/**
       
    38 	// Write message to the log device.
       
    39 	//
       
    40 	// @param aText	to be written
       
    41 	*/
       
    42 	virtual void Write(const TDesC &aText) = 0;
       
    43 	/*
       
    44 	// Write message with format to the log device
       
    45 	//
       
    46 	// @param aFmt	the format string to be applied
       
    47 	// @param aList	the parameters to the format string
       
    48 	*/
       
    49 	virtual void WriteList(const TDesC &aFmt, VA_LIST aList) = 0;
       
    50 	/**
       
    51 	// Write message, if error
       
    52 	//
       
    53 	// Just a convenience method to make it easy to write code
       
    54 	// which is "mostly silent" until exceptional situations
       
    55 	// occur.
       
    56 	//
       
    57 	// @param aText	to be written, if aResult != KErrNone
       
    58 	// @param aResult	is the result code to be tested
       
    59 	//
       
    60 	// @return	aResult (always)
       
    61 	*/
       
    62 	TInt virtual CheckResult(const TDesC &aText, TInt aResult) = 0;
       
    63 	};
       
    64 
       
    65 /**
       
    66 // Services offered by the engine to the application main.
       
    67 */
       
    68 class MDemonEngine
       
    69 	{
       
    70 public:
       
    71 	// Allow delete via M-class pointer
       
    72 	virtual ~MDemonEngine() {}
       
    73 	// Allow ConstructL via M-class pointer
       
    74 	virtual void ConstructL() = 0;
       
    75 	// Handle commands from the user
       
    76 	virtual void HandleCommandL(TInt aCommand) = 0;
       
    77 	// Create the real engine instance [there can be only one]
       
    78 	static MDemonEngine *NewL(MDemonMain &aMain);
       
    79 	};
       
    80 
       
    81 #endif