Class CTCPPortScanner Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: Custom Code in Source After IncludesNext page: m_aCurrentPair    Show member index
Class Declared in:
TCPPortScanner.h

'Overview' icon -- Shortcut to top of page. Overview

Copyright (c) 2000-2003 Barak Weichselbaum <barak@komodia.com> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Contact info:

Site:                  http://www.komodia.com Main contact:          barak@komodia.com For custom projects, consulting, or other paid services:         sales@komodia.com

Hierarchy Chart Hierarchy Chart

'Base Classes' icon -- Shortcut to top of page. Base Classes

Public base class CErrorHandler

'Data Items' icon -- Shortcut to top of page. Data Items

Private data ScanPair m_aCurrentPair Current pair we are working on
Private data PortsList m_aPortAnswers List of all answers
Private data PortsList m_aPortList Our answered ports list
Private data DataMap m_aPortsData The ports data map
Private data PortsVector m_aPortsToScan Our ports to scan
Private data IP m_aTarget Our target
Private data BOOL m_bDone Are we done ?
Private data BOOL m_bError Did we have an error
Private data BOOL m_bFinished Did we finish (not for user indication)
Private data DWORD m_dwTimeout Timeout
Private data int m_iActiveSockets Number of active sockets
Private data int m_iConnectionTimeout Connection timeout
Private data int m_iMaxSockets Number of max sockets
Private data int m_iReceiveData Do we receive data
Private data CGenericCriticalSection * m_pCSection Our CS
Private data CGenericCriticalSection * m_pCSectionDone Done CS

'Constructors' icon -- Shortcut to top of page. Constructors

Private constructor

CTCPPortScanner( const CTCPPortScanner& rScanner )

No copy Ctor
Public constructor

CTCPPortScanner()

Ctor and Dtor
Private constructor

CTCPScanner::CTCPScanner( CTCPPortScanner* pFather, unsigned short usPort, int iDataSize, DWORD dwTimeout )

'Destructors' icon -- Shortcut to top of page. Destructors

Public destructor virtual

~CTCPPortScanner()

Private destructor

CTCPScanner::~CTCPScanner()

'Functions' icon -- Shortcut to top of page. Functions

Public function void

AddPorts( unsigned short usFromPort, unsigned short usToPort )

Add ports to scan
Protected function int

AdjustNumberOfSockets( int iIncrement )

Adjust the number of sockets
Protected function virtual CTCPSocketAsync *

AllocateSocket( unsigned short usPort ) const

Actual a new socket Derived class should override this for their sockets
Protected function BOOL

CanScan()

Do we have something to scan
Private function BOOL

CTCPScanner::OnSocketClose( int iErrorCode )

Private function BOOL

CTCPScanner::OnSocketConnect( int iErrorCode )

Private function BOOL

CTCPScanner::OnSocketReceive( int iErrorCode )

Private function BOOL

CTCPScanner::OnSocketTimeout()

Protected function void

DeletePortsMap()

Delete the ports map
Protected function virtual void

DestroySocket( CTCPSocketAsync* pSocket ) const

Unallocate the socket
Private function static DWORD

DoneThread( LPVOID lpData )

Our thread
Public function int

GetConnectionTimeout() const

Public function const char *

GetData( unsigned short usPort ) const

Get the data for the port
Public function char *

GetDataForModify( unsigned short usPort ) const

Get the data for the port
Public function int

GetMaxSockets() const

Protected function unsigned short

GetNextPort()

Get the next port
Public function const PortsList &

GetPortList() const

Get the ports list
Public function int

GetReceiveDataSize() const

Public function DWORD

GetReceiveDataTimeout() const

Protected function IP

GetTarget() const

Public function BOOL

IsDone() const

Status of the scanner
Public function BOOL

IsError() const

Protected function BOOL

IsFinished() const

Are we finished (before done, for internal uses)
Protected function BOOL

NewSocket()

Create a new socket
Protected function virtual void

OnPort( unsigned short usPort, BOOL bConnected )

Events for user to override Port status usPort - The port bConnected - Did we manager to connect?
Protected function virtual void

OnPortData( unsigned short usPort, const char* pData, int iDataSize )

Port status with data (port sent data) usPort - The port pData - The data iDataSize - The data size
Private function CTCPPortScanner &

operator =( const CTCPPortScanner& rScanner )

No copy operator
Protected function virtual void

PortScanned( unsigned short usPort )

Port was scanned (no resolution yet, for lib to overide)
Protected function void

ResetData()

Reset the data
Protected function void

ResetPair()

Reset pair data
Protected function void

ResetSocketCount()

Reset the socket count
Public function virtual BOOL

Scan( const std::string& rDestinationAddress )=0

Do the scan
Public function virtual BOOL

Scan( IP aTarget )=0

Protected function void

ScanDone( BOOL bError, BOOL bSpawnThread=TRUE )

We are done
Public function void

SetConnectionTimeout( int iMS )

Set/get the connection timeout
Protected function void

SetDone( BOOL bDone )

Set the done flag
Protected function void

SetError( BOOL bError )

Set there's an error
Public function void

SetMaxSockets( int iMaxSockets )

Set/get max sockets
Public function void

SetReceiveData( int iMaxDataSize, DWORD dwTimeout )

Set/get we can receive data (0 for none)
Protected function void

SetTarget( IP aTarget )

Set/get the target address
Protected function void

SocketDone( unsigned short usPort, BOOL bConnected )

When socket is done
Protected function void

SocketDone( unsigned short usPort, char* pData, int iDataSize )

Socket done and received data
Public function virtual BOOL

StopScan()

Stop the scan
Protected function virtual void

TCPScanDone( BOOL bError )

Scan is done (for user to override)
Protected function virtual void

TCPScanDoneLib( BOOL bError )

Scan is done (for library)

'Friends' icon -- Shortcut to top of page. Friends

CTCPScanner

'Custom Code' icon -- Shortcut to top of page. Custom Code

'Implementation Details' icon -- Shortcut to top of page. Implementation Details

File(s)
C:\dev\Komodia\KomodiaIPUtils\TCPPortScanner.cpp
C:\dev\Komodia\KomodiaIPUtils\TCPPortScanner.h
Header Includes
TCPSocketAsync.h     
deque     
map     
set     
Source Includes
stdafx.h     for precompiled header directive
TCPPortScanner.h     
ErrorHandlerMacros.h     
OSManager.h     
GenericCriticalSection.h     
ThreadPool.h     
GenericThread.h     
Owner
tcpip4
Last Modified
19/02/2003 18:14:21 PM

Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.