IPPacket Event

Fired whenever a packet is received.

Syntax

ANSI (Cross Platform)
virtual int FireIPPacket(IPMonitorIPPacketEventParams *e);
typedef struct {
const char *SourceAddress;
int SourcePort;
const char *DestinationAddress;
int DestinationPort;
int IPVersion;
int TOS;
int Id;
int Flags;
int Offset;
int TTL;
int Checksum;
int IPProtocol;
const char *Payload; int lenPayload;
int64 Timestamp; int reserved; } IPMonitorIPPacketEventParams; Unicode (Windows) virtual INT FireIPPacket(IPMonitorIPPacketEventParams *e);
typedef struct {
LPCWSTR SourceAddress;
INT SourcePort;
LPCWSTR DestinationAddress;
INT DestinationPort;
INT IPVersion;
INT TOS;
INT Id;
INT Flags;
INT Offset;
INT TTL;
INT Checksum;
INT IPProtocol;
LPCSTR Payload; INT lenPayload;
LONG64 Timestamp; INT reserved; } IPMonitorIPPacketEventParams;
- (void)onIPPacket:(NSString*)sourceAddress :(int)sourcePort :(NSString*)destinationAddress :(int)destinationPort :(int)IPVersion :(int)TOS :(int)id :(int)flags :(int)offset :(int)TTL :(int)checksum :(int)IPProtocol :(NSData*)payload :(long long)timestamp;
#define EID_IPMONITOR_IPPACKET 3

virtual INT IPWORKS_CALL FireIPPacket(LPSTR &lpszSourceAddress, INT &iSourcePort, LPSTR &lpszDestinationAddress, INT &iDestinationPort, INT &iIPVersion, INT &iTOS, INT &iId, INT &iFlags, INT &iOffset, INT &iTTL, INT &iChecksum, INT &iIPProtocol, LPSTR &lpPayload, INT &lenPayload, LONG64 &lTimestamp);

Remarks

When Active is True or ParsePcapFile is called, the class will listen for network traffic or parse the provided file, respectively. For each packet sent across the interface in LocalHost, the class will parse the packet and fire an IPPacket event with the header fields and payload. The parameters are defined as follows:

SourceAddressThe IP address of the originating host in IP dotted format.
DestinationAddressThe IP address of the destination host in IP dotted format.
IPVersionThe IP protocol version being used by this packet.
TOSThe type of service being used by this packet.
IdThe packet id used to identify and track packets.
FlagsFlags relating to the status of the packet and desired responses.
OffsetThe fragment offset of this packet in relation to larger data.
TTLThe time to live for this packet.
IPProtocolThe IP protocol used in the payload.
PayloadThe data field of the IP packet. This field may contain extra IP headers, depending upon the IP protocol used to create it.
TimestampThis is the number of microseconds from the UNIX Epoch (1977-01-01). This is only available when parsing files.

TOS

Bit 0, 1, 2Precedence (see below)
Bit 3Delay (0 = Normal, 1 = Low)
Bit 4Throughput (0 = Normal, 1 = High)
Bit 5Reliability (0 = Normal, 1 = High)

Precedence

000Routine
001Priority
010Immediate
011Flash
100Flash Override
101CRITIC/ECP
110Internetwork Control
111Network Control

Flags

Bit 0Always zero
Bit 1Don't Fragment (0 = May Fragment, 1 = Don't Fragment)
Bit 2More Fragments (0 = Last Fragment, 1 = More Fragments)

IPProtocol - for a full list, visit www.iana.org.

1ICMP
2IGMP
4IP
6TCP
17UDP

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 C++ Edition - Version 20.0 [Build 8161]