Class CSpoofSocket Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: Custom Code in Source After IncludesNext page: m_ConnectedTo    Show member index
Class Declared in:
SpoofSocket.h

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

Copyright (c) 2000 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 Email: barak@komodia.com

Hierarchy Chart Hierarchy Chart

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

Public base class CSpoofBase

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

Protected data sockaddr_in m_ConnectedTo Remote address we are conencted to
Private data CIPOptions * m_IPOptions Our options
Private data BOOL m_Options Do we have options
Private data unsigned char m_Protocol The protocol
Private data BOOL m_Raw Are we raw ?
Private data LPCSTR m_SourceAddress Our source address
Private data SOCKET m_SpoofSocket The actual socket handle
Private data unsigned char m_TTL Time to live

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

Protected constructor

CSpoofSocket( SOCKET sok )

Attach to a socket by constructor
Public constructor

CSpoofSocket()

ctor and dtor

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

Public destructor virtual

~CSpoofSocket()

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

Protected function void

AssignSocket( SOCKET sok, unsigned char ucProtocol=IPPROTO_TCP )

Attach to a socket
Public function virtual BOOL

Bind( LPCSTR lpSourceAddress, int iPort=0 )

Bind to a specific address
Protected function unsigned short

CalculateChecksum( const unsigned short* usBuf, int iSize ) const

Calculate the data checksum
Public function unsigned short

CalculatePseudoChecksum( const char *buf, int BufLength, LPCSTR lpDestinationAddress, int iPacketLength ) const

Calculate the checksum for TCP and UDP
Public function BOOL

CanRead() const

Check if socket if ready for reading
Public function BOOL

CanWrite() const

Check if socket if ready for writing
Protected function BOOL

CheckSocketValid() const

Check this socket is valid
Public function virtual BOOL

Close()

Close the socket
Protected function virtual LPIpHeader

ConstructIPHeader( unsigned char ucProtocol, unsigned short usFragmentationFlags, unsigned char ucTTL, unsigned short usIdentification, unsigned char ucHeaderLength )

Create an IP header
Public function static LPIpHeader

ConstructStaticIPHeader( unsigned char ucProtocol, unsigned short usFragmentationFlags, unsigned char ucTTL, unsigned short usIdentification, unsigned char ucHeaderLength )

Create an IP header
Public function BOOL

Create( int iProtocol )

Create a socket
Protected function virtual void

FinalIPHeader( LPIpHeader lpHead )

Last stop before sending the header
Protected function SOCKET

GetHandle() const

Get the socket handle
Public function CIPOptions *

GetOptions()

Get the IP options
Public function long

GetPeerAddress() const

Get the address of the remote connected system
Public function unsigned short

GetPeerPort() const

Get the port if the remote connected system
Protected function virtual void

InitializeIP()

initialize all the private memebers
Protected function BOOL

isRaw() const

Indication if we are a raw socket
Private function sockaddr_in

pResolveDNS( LPCSTR lpAddress )

Reseolve DNS
Public function virtual int

Receive( char* buf, int bufLen )

Recieve data from remote socket
Public function long

ResolveDNS( LPCSTR lpAddress )

Resolve a DNS entry
Public function virtual BOOL

Send( LPCSTR lpDestinationAddress, const char* buf, int bufLength, unsigned short usDestinationPort=0 )

Send data to a socket
Protected function virtual void

SetIPHeaderAddress( LPIpHeader lpHead, LPCSTR lpSourceAddress, LPCSTR lpDestinationAddress )

Set the address in the IP header
Public function void

SetOptions( BOOL bOptions )

Do we allow options on this socket ?
Protected function void

SetProtocol( int iProtocol )

Set the protocol we are working on
Public function void

SetRaw( BOOL bRaw )

Are we a raw socket ?
Public function void

SetSourceAddress( LPCSTR lpSourceAddress )

Set source address for spoofing
Public function void

SetTTL( unsigned char ucTTL )

Set the packet Time to live
Public function BOOL

Shutdown( SocketShutdown eHow )

Close one way of the socket (receive,send,both)
Public function virtual BOOL

Sniff( BOOL bSniff )

Turn to be a sniffer socket
Public function static BOOL

ValidAddress( LPCSTR lpAddress )

Check if an address is valid
Protected function BOOL

ValidSocket() const

Is our socket valid ?

'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\SpoofSocket.cpp
C:\dev\Komodia\SpoofSocket.h
Header Includes
SpoofBase.h     
Source Includes
stdafx.h     for precompiled header directive
SpoofSocket.h     
Owner
LibV3
Last Modified
27-Jun-01 7:19:26 PM

Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001.