/* * Paglo Crawler * Copyright (C) 2006-2008 Paglo Labs Inc. All rights reserved. * www.paglo.com * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ //--------------------------------------------------------------------------- #ifndef EventH #define EventH //--------------------------------------------------------------------------- #include "ScanData.h" class TServerCmd; typedef enum { EVT_UNKNOWN, /* unknown -- the default */ EVT_NEW_DEVICE, /* a new device has been discovered */ EVT_SIG_MATCH, /* a signature was matched */ EVT_FINGERPRINT_MATCH, /* a fingerprint was matched */ EVT_SCAN_REQUEST, /* an active scan request */ EVT_SCAN_RESULT, /* results from an active scan */ EVT_OPEN_PORT, EVT_SERVER_CMD, /* a server command */ EVT_ISSUE_MSG /* a message denoting an issue */ } TEventType; //--------------------------------------------------------------------------- class TNetworkDevice; class TPEvent { public: TPEvent(void){ Type = EVT_UNKNOWN; Device = NULL; } TPEvent(TEventType t){ Type = t; } TPEvent(TNetworkDevice *d){ Type = EVT_NEW_DEVICE; Device = d; } TPEvent(TNetworkDevice *d, unsigned short p, unsigned char Proto) { Type = EVT_OPEN_PORT, Device = d; Port = p; Protocol = Proto; } TPEvent(TScanRequest *s){ Type = EVT_SCAN_REQUEST; ScanReq = s; } TPEvent(TScanResult *s){ Type = EVT_SCAN_RESULT; ScanRes = s; } TPEvent(TServerCmd *Command) { Type = EVT_SERVER_CMD; ServerCmd = Command; } TPEvent(std::string &Issue) { Type = EVT_ISSUE_MSG; this->Issue = Issue; } ~TPEvent(void){} TEventType GetType(void){ return Type; } void SetType(TEventType t){ Type = t; } TNetworkDevice *GetDevice(void){ return Device; } void SetDevice(TNetworkDevice *d){ Device = d; } void SetScanReq(TScanRequest *s){ ScanReq = s; } TScanRequest *GetScanReq(void){ return ScanReq; } void SetScanRes(TScanResult *s){ ScanRes = s; } TScanResult *GetScanRes(void){ return ScanRes; } int GetPort(void){ return Port; } int GetProtocol(void){ return Protocol; } TServerCmd *GetServerCmd(void) { return ServerCmd; } std::string GetIssue(void) { return Issue; } /* * Return a description of the event. */ string Description(); private: TEventType Type; TNetworkDevice *Device; TScanRequest *ScanReq; TScanResult *ScanRes; TServerCmd *ServerCmd; int Port; int Protocol; std::string Issue; }; //--------------------------------------------------------------------------- #endif