Commit 017561c1 authored by Robert Ricci's avatar Robert Ricci

Add a few important features:

When we detect that we've lost packets in libpcap, compensate by
making some dummy packets to cover the sequence range we missed. Use
a constant to guess how much header we missed. Only flag missed
packets as errors if we miss a lot of them.

Allow for ACKs of partial packets - this is important with the above,
since the fake packets can be larger than the real packets that we

Mark SACKed packets so we can avoid double-counting them - future
SACKs or ACKs can cover those packets, but, in fact, are not really
ACKing them.

Most of the time spent working on this was dealing with STL semantics.
The more I use the STL, the less respect I have for it.
parent 692368fc
This diff is collapsed.
......@@ -25,6 +25,9 @@ protected:
virtual void localSend(PacketInfo * packet);
virtual void localAck(PacketInfo * packet);
struct SentPacket;
std::list<SentPacket> unacked;
typedef std::list<SentPacket>::iterator SentPacketIterator;
struct SentPacket
......@@ -37,18 +40,40 @@ private:
Time timestamp;
// Has this packet been retransmitted?
bool retransmitted;
// Has this packet already been SACKed?
bool sacked;
// Was this a fake record we generated due to packet loss in libpcap?
bool fake;
// Split one sent packet into two at the sequence number indicated. The
// WARNING: Due to STL lameness, your iterator is invalid after this
// call!
static void
splitPacket(SentPacketIterator, unsigned int, std::list<SentPacket> *);
typedef std::pair<uint32_t, uint32_t> rangepair;
typedef std::list<rangepair> rangelist;
* We use this to keep track of the ranges being ACKed and SACKed
struct Range
Range(unsigned int, unsigned int, bool);
unsigned int start;
unsigned int end;
bool from_sack;
typedef std::list<Range> rangelist;
int ackedSize;
Time ackedSendTime;
std::list<SentPacket> unacked;
SentPacket globalSequence;
bool isRetransmit;
StateSensor const * state;
// Typically, 4% of a packet is header. It's more, though, if the packet is
// less than 1500 bytes
static const float SUPERMAGIC_PACKET_MULTIPLIER = 1.04;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment