vpnengine/vpnmanager/inc/eventlogger.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003-2009 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: Event logging.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __EVENTLOGGER_H__
       
    21 #define __EVENTLOGGER_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <in_sock.h>
       
    25 #include <vpnlogmessages.rsg>
       
    26 
       
    27 #include "eventmediatorapi.h"
       
    28 
       
    29 class CPolicyStore;
       
    30 
       
    31 class CEventLogger : CBase
       
    32   	{
       
    33 public:
       
    34     static CEventLogger* NewL(CPolicyStore& aPolicyStore);
       
    35 	void LogEvent(TUint aMsgId, const TDesC* aDes1, const TDesC8* aDes2, TInt aInt1, TInt aInt2);
       
    36     void LogEvent(TUint aMsgId, const TDesC8* aDes1, const TDesC8* aDes2, TInt aInt1, TInt aInt2);
       
    37     ~CEventLogger();
       
    38 
       
    39 private:
       
    40     CEventLogger(CPolicyStore& aPolicyStore);
       
    41     void ConstructL();
       
    42     
       
    43     void LogEventL(TUint aMsgId, const TDesC* aDes1, const TDesC8* aDes2, TInt aInt1, TInt aInt2);
       
    44     HBufC8* CertSubjectNameL(const TDesC8& aCertData);
       
    45     
       
    46     
       
    47 private:
       
    48     REventMediator iEventMediator;
       
    49     CPolicyStore& iPolicyStore;    
       
    50 	};
       
    51 
       
    52 #define DEFINE_EVENT_LOGGER         CEventLogger* iEventLogger;
       
    53 #define INIT_EVENT_LOGGER(a)        TRAP_IGNORE(iEventLogger = CEventLogger::NewL(a););
       
    54 #define RELEASE_EVENT_LOGGER        delete iEventLogger; iEventLogger = NULL;
       
    55 
       
    56 #define LOG_EVENT(a, b, c, d, e)    if (iEventLogger) iEventLogger->LogEvent(a, b, c, d, e);
       
    57 #define LOG_EVENT_2(a, b, c, d, e)  if (iVpnApiServant->iEventLogger) iVpnApiServant->iEventLogger->LogEvent(a, b, c, d, e);
       
    58 #define LOG_EVENT_2B(a, b, c, d, e) if (iVpnApiServant.iEventLogger) iVpnApiServant.iEventLogger->LogEvent(a, b, c, d, e);
       
    59 #define LOG_EVENT_3(a, b, c, d, e)  if (VpnApiServant()->iEventLogger) VpnApiServant()->iEventLogger->LogEvent(a, b, c, d, e);
       
    60 
       
    61 #endif // __EVENTLOGGER_H__