1 #ifndef PCAPPP_GENERAL_UTILS 2 #define PCAPPP_GENERAL_UTILS 26 std::string
byteArrayToHexString(
const uint8_t* byteArr,
size_t byteArrSize,
int stringSizeLimit = -1);
41 size_t hexStringToByteArray(
const std::string& hexString, uint8_t* resultByteArr,
size_t resultByteArrSize);
52 char*
cross_platform_memmem(
const char* haystack,
size_t haystackLen,
const char* needle,
size_t needleLen);
59 template <
int alignment>
60 static int align(
int number)
63 constexpr
bool isPowerOfTwo = alignment && ((alignment & (alignment - 1)) == 0);
64 static_assert(isPowerOfTwo,
"Alignment must be a power of 2");
65 int mask = alignment - 1;
66 return (number + mask) & ~mask;
70 #endif // PCAPPP_GENERAL_UTILS The main namespace for the PcapPlusPlus lib.
size_t hexStringToByteArray(const std::string &hexString, uint8_t *resultByteArr, size_t resultByteArrSize)
std::string byteArrayToHexString(const uint8_t *byteArr, size_t byteArrSize, int stringSizeLimit=-1)
char * cross_platform_memmem(const char *haystack, size_t haystackLen, const char *needle, size_t needleLen)