Packet Sniffer SDK DLL Edition

HNPacket :: Methods :: PktTransportCheckSum

 Previous Next

Counts the TCP and UDP packets checksums.

Syntax:

WORD __stdcall PktTransportCheckSum(LPVOID pPacket, DWORD PacketLen, DWORD Proto, DWORD SrcIP, DWORD DstIP);

Parameters:

pPacket

[in] A pointer to the packet, which the checksum must be counted for.

PacketLen

[in] The packet size.

Proto

[in] Protocol: IPPROTO_TCP or IPPROTO_UDP.

SrcIP

[in] The source IP address.

DstIP

[in] The destination IP address.

Return values:

If the function succeeds, the return value will be the packet checksum, otherwise it returns 0.

Description:

Counts and returns checksums of TCP and UDP packets. Implements the checksums counting, using a "pseudo-header" algorithm (RFC 793, RFC 768). This function may be useful for composing your own packets or verifying received ones.

See also:HNPacket, PktIPGenerate, PktUDPGenerate, PktTCPGenerate