PcapPlusPlus  Next
PacketUtils.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Packet.h"
4 #include "IpAddress.h"
5 
7 
10 namespace pcpp
11 {
13  template <typename T> struct ScalarBuffer
14  {
16  T* buffer;
17 
19  size_t len;
20  };
21 
26  uint16_t computeChecksum(ScalarBuffer<uint16_t> vec[], size_t vecSize);
27 
36  uint16_t computePseudoHdrChecksum(uint8_t* dataPtr, size_t dataLen, IPAddress::AddressType ipAddrType,
37  uint8_t protocolType, IPAddress srcIPAddress, IPAddress dstIPAddress);
38 
44  uint32_t fnvHash(ScalarBuffer<uint8_t> vec[], size_t vecSize);
45 
50  uint32_t fnvHash(uint8_t* buffer, size_t bufSize);
51 
58  uint32_t hash5Tuple(Packet* packet, bool const& directionUnique = false);
59 
64  uint32_t hash2Tuple(Packet* packet);
65 } // namespace pcpp
Definition: IpAddress.h:276
AddressType
An enum representing the address type: IPv4 or IPv6.
Definition: IpAddress.h:280
Definition: Packet.h:22
The main namespace for the PcapPlusPlus lib.
uint32_t hash2Tuple(Packet *packet)
uint32_t hash5Tuple(Packet *packet, bool const &directionUnique=false)
uint16_t computePseudoHdrChecksum(uint8_t *dataPtr, size_t dataLen, IPAddress::AddressType ipAddrType, uint8_t protocolType, IPAddress srcIPAddress, IPAddress dstIPAddress)
uint16_t computeChecksum(ScalarBuffer< uint16_t > vec[], size_t vecSize)
uint32_t fnvHash(ScalarBuffer< uint8_t > vec[], size_t vecSize)
A struct that represent a single buffer.
Definition: PacketUtils.h:14
T * buffer
The pointer to the buffer.
Definition: PacketUtils.h:16
size_t len
Buffer length.
Definition: PacketUtils.h:19