diff --git a/.gitignore b/.gitignore index 1bdd080..6bfb72b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build*/ compile_commands.json *.o doxygen_out/ +/tags diff --git a/src/UDPC.h b/src/UDPC.h index 728d914..c921c90 100644 --- a/src/UDPC.h +++ b/src/UDPC.h @@ -182,6 +182,14 @@ typedef struct UDPC_EXPORT UDPC_PacketInfo { * - 0x8: Is a packet that was re-sent */ uint32_t flags; + /*! + * \brief The packet's id. + * + * Packets start with id = 0, and will wrap around. + * This can be used to determine specifically how out of order a packet may + * be. + */ + uint32_t id; /*! * \brief The size in bytes of the received packet's data inside the \ref data * pointer member variable. diff --git a/src/UDPConnection.cpp b/src/UDPConnection.cpp index 85aa9a6..a00f157 100644 --- a/src/UDPConnection.cpp +++ b/src/UDPConnection.cpp @@ -1719,6 +1719,7 @@ void UDPC::Context::update_impl() { recPktInfo.sender.port = ntohs(receivedData.sin6_port); recPktInfo.receiver.port = ntohs(socketInfo.sin6_port); recPktInfo.rtt = durationToMS(iter->second.rtt); + recPktInfo.id = seqID; std::lock_guard receivedPktsLock(receivedPktsMutex); receivedPkts.push_back(recPktInfo); @@ -1739,6 +1740,7 @@ void UDPC::Context::update_impl() { recPktInfo.sender.port = ntohs(receivedData.sin6_port); recPktInfo.receiver.port = ntohs(socketInfo.sin6_port); recPktInfo.rtt = durationToMS(iter->second.rtt); + recPktInfo.id = seqID; std::lock_guard receivedPktsLock(receivedPktsMutex); receivedPkts.push_back(recPktInfo); @@ -1858,6 +1860,7 @@ UDPC_PacketInfo UDPC::get_empty_pinfo() { return UDPC_PacketInfo { 0, // data (ptr) 0, // flags + 0, // id 0, // dataSize 0, // rtt { // sender