IPktXAdapter Interface Reference
[PacketX]

Adapter class default interface. More...

List of all members.

Public Member Functions

HRESULT SendPacket ([in] VARIANT Buffer,[in, optional] VARIANT lNumWrites)
 Send raw network frames.

Properties

BSTR * Device [get]
 Network interface name.
BSTR * Description [get]
 Network interface description.
LONG * BuffMinToCopy [get]
 Minimum number of bytes to copy from capture buffer.
LONG * BuffSize [get]
 Kernel mode capture buffer size in bytes.
PktXPacketTypeHWFilter [get]
 Hardware filter flags.
BSTR * BPFilter [get]
 Berkley packet filter string.
LONG * BPFSnapLen [get]
 Berkley packet filter snap length.
PktXModeMode [get]
 Working mode .
LONG * ReadTimeout [get]
 Read timeout.
PktXLinkTypeLinkType [get]
 Network link type .
LONG * LinkSpeed [get]
 Network link speed.
BSTR * NetIP [get]
 Network IP address.
BSTR * NetMask [get]
 Network mask.
LONG * PacketsRecv [get]
 Total number of packets received.
LONG * PacketsLost [get]
 Total number of packets lost.
BSTR * HWAddress [get]
 Adapter MAC address.
IDispatch ** Clone [get]
 Clone adapter.
LONG * IsGood [get]
 Test network interface.


Detailed Description

Adapter class default interface.

This interface groups different kind of settings related to one network interface.


Member Function Documentation

HRESULT IPktXAdapter::SendPacket ( [in] VARIANT  Buffer,
[in, optional] VARIANT  lNumWrites 
)

Send raw network frames.

Sends buffer contents by specified number of times.

Parameters:
Buffer an array of VARINAT's or BYTE's.
lNumWrites a number of times to repeat the send.
Example:
 '// Create variant array and fill it
 Dim oPacket(n)
 oPacket(0)=1
 oPacket(1)=2
 oPacket(2)=3
 ...
 
 '// Create PacketX instance
 Set oPktX = CreateObject("PktX.PacketX")

 '// Send packet by reference (VT_BYREF|VT_VARIANT) as array of variants
 oPktX.Adapter.SendPacket oPacket, 1
 
 '// Send packet by value (VT_BYREF|VT_VARIANT|VT_ARRAY) as array of variants
 oPktX.Adapter.SendPacket(oPacket)
 
 '// Send packet directly (VT_VARIANT|VT_ARRAY) as array of variants
 oPktX.Adapter.SendPacket Array(1,2,3)
   
 '// Send packet directly (VT_VARIANT|VT_ARRAY) as array of variants, repeat 100 times
 oPktX.Adapter.SendPacket _
 Array(&hFF, &hFF, &hFF, &hFF, &hFF, &hFF, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, _
       &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, _
       &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00), 100 
Returns:
HRESULT error code.


Property Documentation

HRESULT IPktXAdapter::Device [get]

Network interface name.

Network interface is represented by unique device name assigned by operating system.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::Description [get]

Network interface description.

The device description string contains manufacturer and model related information about the physical network adapter.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::BuffMinToCopy [get]

Minimum number of bytes to copy from capture buffer.

The minimum amount of data in the kernel buffer that will cause the WinPcap driver to release a read in progress.

Note:
In presence of a large value for this variable, the kernel waits for the arrival of several packets before copying the data to the user.
Returns:
HRESULT error code.

HRESULT IPktXAdapter::BuffSize [get]

Kernel mode capture buffer size in bytes.

Kernel buffer is used store network frames before they are passed to user mode application.

This parameter affects heavily the perfomance of the capture process. Therefore we discourage to set this parameter to very low or very high values. The optimal buffer size depends on the amount of network traffic in LAN segment and amount of RAM installed on your computer.

Note:
The recommended size of the buffer is 1MB in most cases.
Returns:
HRESULT error code.

HRESULT IPktXAdapter::HWFilter [get]

Hardware filter flags.

Hardware filter is a combination of PacketType flags.

If hardware filter is defined only network frames passing the filter will be returned to user mode application.

Example:
 '// Create PacketX
 Set oPktX = CreateObject("PktX.PacketX")
 ...
 '// All network frames
 oPktX.Adapter.HWFilter = PktXPacketTypePromiscuous
 ...
 '// Packets sent/received by this computer only
 oPktX.Adapter.HWFilter = PktXPacketTypeDirected Or PktXPacketTypeAllLocal 
Returns:
HRESULT error code.

HRESULT IPktXAdapter::BPFilter [get]

Berkley packet filter string.

Berkley packet filter (BPF) uses same syntax as tcpdump filter expression.

If packet filter is defined only network frames passing the filter will be returned to user mode application.

Example:
 '// Create PacketX
 Set oPktX = CreateObject("PktX.PacketX")
 ...
 '// To capture all packets arriving at or departing from sun down
 oPktX.Adapter.BPFilter = "host sundown"
 ...
 '// To capture traffic between helios and either hot or ace
 oPktX.Adapter.BPFilter = "host helios and ( hot or ace )"
 ...
 '// To capture all IP packets between ace and any host except helios
 oPktX.Adapter.BPFilter = "ip host ace and not helios"
 ...
 '// To capture all traffic between local hosts and hosts at Berkeley
 oPktX.Adapter.BPFilter = "net ucb-ether"
 ...
 '// To capture all ftp traffic
 oPktX.Adapter.BPFilter = "port ftp or ftp-data"
 ...
 '// To capture traffic neither sourced from nor destined for local hosts (if you gateway to one other net, this stuff should never make it onto your local net)
 oPktX.Adapter.BPFilter = "ip and not net localnet"
 ...
 '// To capture the start and end packets (the SYN and FIN  packets) of each TCP conversation
 oPktX.Adapter.BPFilter = "tcp[13] & (0x02|0x04) != 0"
 ...
 '// To capture IP packets longer than 576 bytes
 oPktX.Adapter.BPFilter = "ip[2:2] > 576"
 ...
 '// To capture IP broadcast or multicast packets that were not sent via ethernet broadcast or multicast
 oPktX.Adapter.BPFilter = "ether[0] & 1 = 0 and ip[16] >= 224"
 ...
 '// To capture all ICMP packets that are not echo requests/replies (i.e., not ping packets)
 oPktX.Adapter.BPFilter = "icmp[0] != 8 and icmp[0] != 0" 
Returns:
HRESULT error code.

HRESULT IPktXAdapter::BPFSnapLen [get]

Berkley packet filter snap length.

The snap length defines the maximum number of frame bytes to be captured.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::Mode [get]

Working mode .

Returns adapter working mode .

The working mode determines type of data the PacketX will capture.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::ReadTimeout [get]

Read timeout.

The read timeout determines how long one read request can be pending.

Note:
In statistics mode the read timeout value determines time interval between two _IPktXPacketXEvents::OnStatistics events.
Returns:
HRESULT error code.

HRESULT IPktXAdapter::LinkType [get]

Network link type .

The link type identifies the underlying network technology used transmit network frames.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::LinkSpeed [get]

Network link speed.

Returns link speed in bps.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::NetIP [get]

Network IP address.

Returns network IP address in dotted format.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::NetMask [get]

Network mask.

Returns network mask in dotted format.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::PacketsRecv [get]

Total number of packets received.

This value reflects total number of packets processed during the last capture session.

Note:
This property will be updated automatically at the end of capture session.
Returns:
HRESULT error code.

HRESULT IPktXAdapter::PacketsLost [get]

Total number of packets lost.

This value reflects total number of packets lost during the last capture session.

Note:
This property will be updated automatically at the end of capture session.
Returns:
HRESULT error code.

HRESULT IPktXAdapter::HWAddress [get]

Adapter MAC address.

Returns network adapter MAC address.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::Clone [get]

Clone adapter.

Creates exact copy of the adapter object.

Returns:
HRESULT error code.

HRESULT IPktXAdapter::IsGood [get]

Test network interface.

Probes adapter by issuing open and close request to network interface. The returned boolean value indicates success or failure of the operations perfomed.

Note:
Some Windows 98 computers may have bogus registry entries that are sometimes listed as real network adapters. This propery can be used to test the adapter before starting the real packet capture.
Returns:
HRESULT error code.


The documentation for this interface was generated from the following file:

Copyright © 2000-2007 beeSync. All rights reserved.