epoc32/include/networking/packetlogger.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/networking/packetlogger.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,131 +0,0 @@
     1.4 -/**
     1.5 -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 -* All rights reserved.
     1.7 -* This component and the accompanying materials are made available
     1.8 -* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 -* which accompanies this distribution, and is available
    1.10 -* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 -*
    1.12 -* Initial Contributors:
    1.13 -* Nokia Corporation - initial contribution.
    1.14 -*
    1.15 -* Contributors:
    1.16 -*
    1.17 -* Description:
    1.18 -* Networking packet logging utility
    1.19 -* 
    1.20 -*
    1.21 -*/
    1.22 -
    1.23 -
    1.24 -
    1.25 -
    1.26 -
    1.27 -/**
    1.28 - @file
    1.29 -*/
    1.30 -
    1.31 -#ifndef __PACKETLOGGER_H__
    1.32 -#define __PACKETLOGGER_H__
    1.33 -
    1.34 -//this file defines the __FLOG_ACTIVE flag
    1.35 -#include <comms-infras/commsdebugutility.h>
    1.36 -
    1.37 -#if defined __FLOG_ACTIVE
    1.38 -
    1.39 -#include <e32base.h>
    1.40 -#include <es_mbuf.h>
    1.41 -class RFileLogger;
    1.42 -
    1.43 -/**
    1.44 - * Class containing methods for dumping ip
    1.45 - * packets of different formats.
    1.46 - * The output is written to the log file 
    1.47 - * produced by comms debug utility.
    1.48 - * The supported output formats are listed with the 
    1.49 - * TDumpType enum.
    1.50 - * This class cannot be derived from.
    1.51 - * This class should be active only if __FLOG_ACTIVE
    1.52 - * flag is defined. To ensure that use the macros
    1.53 - * defined below. A sample usage would be:
    1.54 - * @code
    1.55 - *   __PACKETLOG_DECLARATION_MEMBER
    1.56 - *   __PACKETLOG_NEWL(aTag, aFileName, aDumpType, aLinkType);
    1.57 - *   ...
    1.58 - *   __PACKETLOG_WRITE_PACKET(aPacket, aDirection);
    1.59 - *   ...
    1.60 - *   __PACKETLOG_DELETE;
    1.61 - * @endcode
    1.62 - * If the __FLOG_ACTIVE flag is not set, the macros map
    1.63 - * to nothing.
    1.64 - */
    1.65 -class CPacketLogger : public CBase
    1.66 -	{
    1.67 -public:
    1.68 -	/** Output dump formats supported by this class */
    1.69 -	enum TDumpType
    1.70 -		{
    1.71 -		/** Produced dump will be in tcp dump format */
    1.72 -		ETcpDump,
    1.73 -		/** Produced dump will be in ppp dump format */
    1.74 -		EPppDump
    1.75 -		};
    1.76 -
    1.77 -public:
    1.78 -	IMPORT_C static CPacketLogger* NewL(const TDesC8& aTag, const TDesC8& aFileName, const TDumpType aDumpType, const TInt aLinkType);
    1.79 -	IMPORT_C ~CPacketLogger();
    1.80 -	IMPORT_C void WritePacket(const RMBufChain& aPacket, const TUint8 aDirection);
    1.81 -	IMPORT_C void WritePacket(const TDesC8& aPacket, const TUint8 aDirection);
    1.82 -	IMPORT_C void WriteText(const TDesC8& aText);
    1.83 -
    1.84 -private:
    1.85 -	void ConstructL(const TDesC8& aTag, const TDesC8& aFileName, const TDumpType aDumpType, const TInt aLinkType);
    1.86 -	CPacketLogger();
    1.87 -
    1.88 -private:
    1.89 -	void WriteTcpDumpHeader(const TInt aLinkType);
    1.90 -	void TcpDumpPacket(const TDesC8& aPacket);
    1.91 -	
    1.92 -	void WritePppDumpHeader();
    1.93 -	void PppDumpPacket(const TDesC8& aPacket, const TUint8 aDirection);
    1.94 -
    1.95 -private:
    1.96 -	/** Specifies the output format for the dumps */
    1.97 -	TDumpType iDumpType;
    1.98 -	/** Marks the start time when the last packet was received for dumping */
    1.99 -	TInt64 iTimeLastPacket;
   1.100 -	/** The time between system ticks, in microseconds. */
   1.101 -	TInt64 iTickPeriod;
   1.102 -	/** Counter for the number of packets successfully dumped */
   1.103 -	TUint32 iPacketCounter;
   1.104 -	/** Internal buffer to optimize memory allocation for WritePacket(const RMBufChain& aPacket, const TUint8 aDirection)*/
   1.105 -	HBufC8* iHBuf;
   1.106 -	/** Used for directing output to comms debug utility */
   1.107 -	__FLOG_DECLARATION_MEMBER;
   1.108 -	};
   1.109 -
   1.110 -#define __PACKETLOG_DECLARATION_MEMBER	   CPacketLogger* __packetLogger__
   1.111 -
   1.112 -#define __PACKETLOG_NEWL(aTag, aFileName, aDumpType, aDumpFormat) __packetLogger__ = CPacketLogger::NewL(aTag, aFileName, aDumpType, aDumpFormat)
   1.113 -
   1.114 -#define __PACKETLOG_DELETE  delete __packetLogger__; __packetLogger__ = NULL
   1.115 -
   1.116 -#define __PACKETLOG_WRITE_PACKET(aPacket, aDirection) __packetLogger__->WritePacket(aPacket, aDirection)
   1.117 -
   1.118 -#define __PACKETLOG_LOG(aText) __packetLogger__->WriteText(aText)
   1.119 -
   1.120 -#else //__FLOG_ACTIVE
   1.121 -
   1.122 -#define __PACKETLOG_DECLARATION_MEMBER   TInt32 __noLogger__
   1.123 -
   1.124 -#define __PACKETLOG_NEWL(aTag, aFileName, aDumpType, aDumpFormat)
   1.125 -
   1.126 -#define __PACKETLOG_DELETE
   1.127 -
   1.128 -#define __PACKETLOG_WRITE_PACKET(aPacket, aDirection)
   1.129 -
   1.130 -#define __PACKETLOG_LOG(aText) __packetLogger__->WriteText(aText)
   1.131 -
   1.132 -#endif //__FLOG_ACTIVE
   1.133 -
   1.134 -#endif // __PACKETLOGGER_H__