For TCP/IP analysis I use PcapPlusPlus lib. This is how I read TCP header flags:
timeval tm; gettimeofday(&tm, NULL); pcpp::RawPacket pawPacket((uint8_t*)