// ============================================================================
//	Tabber.h
// ============================================================================
//	Copyright (c) WildPackets, Inc. 2000-2001. All rights reserved.
//	Copyright (c) AG Group, Inc. 1998-2000. All rights reserved.

#pragma once

#include "PlugBase.h"

#define kAttributes			(kPluginAttr_ProcessPackets | \
								kPluginAttr_GetPacketString | \
								kPluginAttr_HandlesSelection | \
								kPluginAttr_HandlesSummaries | \
								kPluginAttr_Filters | \
								kPluginAttr_NameTableUpdates | \
								kPluginAttr_ProvidesAnalysis )
#define kSupportedActions	(kPluginAction_Display | kPluginAction_Notify )
#define kDefaultActions		(kPluginAction_Display )

#define kSumStatsGroupName	_T("TCP Analysis")
#define kTCPSynCount		_T("TCP SYN")
#define kTCPFinCount		_T("TCP FIN")


typedef struct
{
	PluginCaptureContext	captureContext;
	UInt64					SynCount;
	UInt64					FinCount;
	LPUNKNOWN				pTabControl;
	HWND					hTabWnd;
	bool					bDoAnalysis;
} STabberPluginContext;


class CTabberPlugin : public CPeekPlugin
{
protected:
	static PluginID		s_ID;
	static UInt32		s_ParentArray[];
	static UInt32		s_ParentCount;
	static WNDCLASSEX	s_WndClass;
	static bool			s_bRegistered;

	virtual void	GetName( TCHAR* outName ) const;
	virtual void	GetID( PluginID* outID ) const { *outID = s_ID; }
	virtual UInt16	GetAttributes() const { return kAttributes; }
	virtual UInt16	GetSupportedActions() const { return kSupportedActions; }
	virtual UInt16	GetDefaultActions() const { return kDefaultActions; }
	virtual void	GetSupportedProtoSpecs( UInt32* outNumProtoSpecs,
						UInt32** outProtoSpecs ) const;

	virtual int		CreateContext( PluginCreateContextParam* ioParams );
	virtual int		DisposeContext( PluginDisposeContextParam* ioParams );
	virtual int		ProcessPacket( PluginProcessPacketParam* ioParams );
	virtual int		GetPacketString( PluginGetPacketStringParam* ioParams );
	virtual int		GetPacketAnalysis( PluginGetPacketStringParam* ioParams );
	virtual int		Reset( PluginResetParam* ioParams );
	virtual int		Summary( PluginSummaryParam* ioParams );
	virtual int		Apply( PluginApplyParam* ioParams );
	virtual int		Select( PluginSelectParam* ioParams );
	virtual	int		Filter( PluginFilterParam* ioParams );
	virtual int		About();
	virtual int		NameTableUpdate( PluginNameTableUpdateParam* ioParams );

	static BOOL CALLBACK	AboutDialogProc( HWND inDialogHandle,
								UINT inMessage, WPARAM inWParam, LPARAM inLParam );
	static LRESULT CALLBACK	MyWndProc( HWND inWnd, 
								UINT inMessage, WPARAM inWParam, LPARAM inLParam );
};
