PcapPlusPlus  23.09
PacketUtils.h
Go to the documentation of this file.
1 #ifndef PACKETPP_PACKET_UTILS
2 #define PACKETPP_PACKET_UTILS
3 
4 #include "Packet.h"
5 #include "IpAddress.h"
6 
8 
13 namespace pcpp
14 {
18  template<typename T>
19  struct ScalarBuffer
20  {
24  T* buffer;
25 
29  size_t len;
30  };
31 
38  uint16_t computeChecksum(ScalarBuffer<uint16_t> vec[], size_t vecSize);
39 
50  uint16_t computePseudoHdrChecksum(uint8_t *dataPtr, size_t dataLen,
51  IPAddress::AddressType ipAddrType, uint8_t protocolType,
52  IPAddress srcIPAddress, IPAddress dstIPAddress);
53 
61  uint32_t fnvHash(ScalarBuffer<uint8_t> vec[], size_t vecSize);
62 
69  uint32_t fnvHash(uint8_t* buffer, size_t bufSize);
70 
79  uint32_t hash5Tuple(Packet* packet, bool const& directionUnique = false);
80 
87  uint32_t hash2Tuple(Packet* packet);
88 
89 } // namespace pcpp
90 
91 #endif /* PACKETPP_PACKET_UTILS */
The main namespace for the PcapPlusPlus lib.
AddressType
Definition: IpAddress.h:327
Definition: Packet.h:26
size_t len
Definition: PacketUtils.h:29
uint32_t fnvHash(ScalarBuffer< uint8_t > vec[], size_t vecSize)
uint16_t computePseudoHdrChecksum(uint8_t *dataPtr, size_t dataLen, IPAddress::AddressType ipAddrType, uint8_t protocolType, IPAddress srcIPAddress, IPAddress dstIPAddress)
Definition: PacketUtils.h:19
T * buffer
Definition: PacketUtils.h:24
uint32_t hash2Tuple(Packet *packet)
Definition: IpAddress.h:321
uint16_t computeChecksum(ScalarBuffer< uint16_t > vec[], size_t vecSize)
uint32_t hash5Tuple(Packet *packet, bool const &directionUnique=false)