vpnengine/sit/inc/eventlogger.h
changeset 0 33413c0669b9
child 22 9f4e37332ce5
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 logger
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // @file eventlogger.h
       
    21 
       
    22 #ifndef __EVENTLOGGER_H__
       
    23 #define __EVENTLOGGER_H__
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <in_sock.h>
       
    27 #include <vpnlogmessages.rsg>
       
    28 
       
    29 #include "eventmediatorapi.h"
       
    30 #include "eventviewer.h"
       
    31 
       
    32 const TInt KMaxIpAddressLength = 64;
       
    33 
       
    34 _LIT8(KUnknownVpnAp, "Unknown VPN access point");
       
    35 _LIT8(KUnknownIap, "Unknown IAP");
       
    36 
       
    37 const TInt R_VPN_MSG_VPN_IAP_ACT_START  = KMaxTInt;
       
    38 const TInt R_VPN_MSG_VPN_IAP_ACT_END    = KMaxTInt - 1;
       
    39 const TInt R_VPN_MSG_VPN_IAP_ACT_CANCEL = KMaxTInt - 2;
       
    40 
       
    41 
       
    42 NONSHARABLE_CLASS(CEventLogger) : CBase
       
    43   	{
       
    44 public:
       
    45     static CEventLogger* NewL(REventMediator& aEventMediator, TUint32 aVpnIapId, TUint32 aRealIapId);
       
    46 	void LogEvent(TUint aMsgId, TAny* aAnyPtr, TInt aStatusCode, TInt aReasonCode);
       
    47     ~CEventLogger();
       
    48 
       
    49 private:
       
    50     CEventLogger(REventMediator& aEventMediator, TUint32 aVpnIapId, TUint32 aRealIapId);
       
    51     void ConstructL();
       
    52     
       
    53     TInt DoLogEvent(TUint aMsgId, TAny* aAnyPtr, TInt aStatusCode, TInt aReasonCode);
       
    54     
       
    55 private:
       
    56     TIapName iVpnApName;
       
    57     TIapName iRealApName;
       
    58     REventMediator& iEventMediator;
       
    59     TUint32 iVpnIapId;
       
    60     TUint32 iRealIapId;
       
    61 	};
       
    62 
       
    63 #define DEFINE_EVENT_LOGGER         CEventLogger* iEventLogger;
       
    64 #define INIT_EVENT_LOGGER(a, b, c)  TRAP_IGNORE(iEventLogger = CEventLogger::NewL(a, b, c););
       
    65 #define RELEASE_EVENT_LOGGER        delete iEventLogger; iEventLogger = NULL;
       
    66 
       
    67 #define LOG_EVENT(a, b, c, d)       if (iEventLogger) iEventLogger->LogEvent(a, b, c, d);
       
    68 
       
    69 #endif // __EVENTLOGGER_H__