13#ifndef MIDDLEBOX_BYTESTREAMMAINTAINER_HH
14#define MIDDLEBOX_BYTESTREAMMAINTAINER_HH
16#include <click/config.h>
17#include <click/glue.hh>
18#include <clicknet/tcp.h>
44 inline void reinit() {
53 uint32_t
mapAck(uint32_t position);
59 uint32_t
mapSeq(uint32_t position);
79 void prune(uint32_t position);
110 inline uint16_t getLastPayloadLength();
168 inline void setMSS(uint16_t mss);
193 inline void setIpSrc(uint32_t ipSrc);
203 inline void setIpDst(uint32_t ipDst);
235 void insertInAckTree(uint32_t position,
int offset);
241 void insertInSeqTree(uint32_t position,
int offset);
248 void insertInTree(
rb_red_blk_tree* tree, uint32_t position,
int offset);
253 uint32_t pruneCounter;
257 bool lastAckReceivedSet;
259 uint32_t lastAckSent;
260 uint32_t lastSeqSent;
261 uint32_t lastAckReceived;
263 uint16_t windowScale;
266 uint64_t congestionWindow;
269 uint16_t lastPayloadLength;
280 if(!lastAckSentSet || SEQ_GT(ackNumber, lastAckSent))
281 lastAckSent = ackNumber;
283 lastAckSentSet =
true;
289 click_chatter(
"Error: Last ack sent not defined");
298 if(!lastSeqSentSet || SEQ_GT(seqNumber, lastSeqSent))
299 lastSeqSent = seqNumber;
301 lastSeqSentSet =
true;
306 lastPayloadLength = payload;
312 click_chatter(
"Error: Last sequence sent not defined");
317uint16_t ByteStreamMaintainer::getLastPayloadLength()
319 return lastPayloadLength;
324 return lastAckSentSet;
329 return lastSeqSentSet;
334 this->windowSize = windowSize;
364 this->portSrc = portSrc;
374 this->portDst = portDst;
384 this->windowScale = windowScale;
394 this->useWindowScale = useWindowScale;
399 return useWindowScale;
419 this->dupAcks = dupAcks;
424 return congestionWindow;
429 this->congestionWindow = congestionWindow;
439 this->ssthresh = ssthresh;
Class used to manage a flow. Stores the modifications in the flow (bytes removed or inserted) as well...
Definition bytestreammaintainer.hh:31
uint32_t getIpDst()
Return the IP address of the destination.
Definition bytestreammaintainer.hh:357
bool getUseWindowScale()
Return a boolean indicating whether the connection uses the window scale option.
Definition bytestreammaintainer.hh:397
void setIpDst(uint32_t ipDst)
Set the IP address of the destination.
Definition bytestreammaintainer.hh:352
uint32_t mapSeq(uint32_t position)
Map a sequence number.
Definition bytestreammaintainer.cc:109
void setWindowScale(uint16_t windowScale)
Set the window scale factor of the source.
Definition bytestreammaintainer.hh:382
uint16_t getWindowSize()
Return the window size of the source (will be used as the receiver's windows size by the other side o...
Definition bytestreammaintainer.hh:337
void setCongestionWindowSize(uint64_t congestionWindow)
Set the size of the congestion window for this side of the connection.
Definition bytestreammaintainer.hh:427
uint32_t getLastSeqSent()
Return the value of the "last seq sent" by this side of the connection.
Definition bytestreammaintainer.hh:309
void setLastSeqSent(uint32_t seqNumber)
Set the value of the "last seq sent" by this side of the connection.
Definition bytestreammaintainer.hh:294
uint16_t getPortSrc()
Return the port number of the source.
Definition bytestreammaintainer.hh:367
bool isLastAckSentSet()
Indicate whether the "last ack sent" value has been set.
Definition bytestreammaintainer.hh:322
uint32_t mapAck(uint32_t position)
Map an ack number.
Definition bytestreammaintainer.cc:61
uint16_t getPortDst()
Return the port number of the destination.
Definition bytestreammaintainer.hh:377
void initialize(RBTManager *rbtManager, uint32_t flowStart)
Initialize the ByteStreamMaintainer (required before beging use)
Definition bytestreammaintainer.cc:41
uint32_t getLastAckSent()
Return the value of the last ack sent by this side of the connection.
Definition bytestreammaintainer.hh:286
bool isLastSeqSentSet()
Indicate whether the "last seq sent" value has been set.
Definition bytestreammaintainer.hh:327
void prune(uint32_t position)
Prune the trees.
Definition bytestreammaintainer.cc:180
uint64_t getSsthresh()
Return the ssthreshold (slow start threshold) for this side of the connection.
Definition bytestreammaintainer.hh:432
void setLastPayloadLength(uint16_t payload)
Set the size of the last packet payload, allows to compute next seq.
Definition bytestreammaintainer.hh:304
uint32_t getIpSrc()
Return the IP address of the source.
Definition bytestreammaintainer.hh:347
void setUseWindowScale(bool useWindowScale)
Indicate whether the connection uses the window scale option.
Definition bytestreammaintainer.hh:392
uint64_t getCongestionWindowSize()
Return the size of the congestion window for this side of the connection.
Definition bytestreammaintainer.hh:422
~ByteStreamMaintainer()
Destruct a ByteStreamMaintainer.
Definition bytestreammaintainer.cc:255
int lastOffsetInAckTree()
Return the offset corresponding to the last modification in the ack tree.
Definition bytestreammaintainer.cc:244
void setWindowSize(uint16_t windowSize)
Set the window size of the source (will be used as the receiver's windows size by the other side of t...
Definition bytestreammaintainer.hh:332
void setIpSrc(uint32_t ipSrc)
Set the IP address of the source.
Definition bytestreammaintainer.hh:342
void setPortSrc(uint16_t portSrc)
Set the port number of the source.
Definition bytestreammaintainer.hh:362
ByteStreamMaintainer()
Construct a ByteStreamMaintainer ByteStreamMaintainer must be initialized before being used.
Definition bytestreammaintainer.cc:18
void setDupAcks(uint8_t dupAcks)
Set the number of consecutive duplicate ACKs currently observed.
Definition bytestreammaintainer.hh:417
void printTrees()
Print the ACK and SEQ trees in the console.
Definition bytestreammaintainer.cc:171
uint8_t getDupAcks()
Return the number of consecutive duplicate ACKs currently observed.
Definition bytestreammaintainer.hh:412
void setLastAckSent(uint32_t ackNumber)
Sets the value of the last ack sent by this side of the connection.
Definition bytestreammaintainer.hh:276
void setPortDst(uint16_t portDst)
Set the port number of the destination.
Definition bytestreammaintainer.hh:372
uint16_t getMSS()
Return the MSS of the source.
Definition bytestreammaintainer.hh:402
void setMSS(uint16_t mss)
Set the MSS of the source.
Definition bytestreammaintainer.hh:407
void setSsthresh(uint64_t ssthresh)
Set the ssthreshold (slow start threshold) for this side of the connection.
Definition bytestreammaintainer.hh:437
uint16_t getWindowScale()
Return the window scale factor of the source.
Definition bytestreammaintainer.hh:387
Class used to store the modifications performed in a packet's structure.
Definition modificationlist.hh:41
RBTManager that uses memory pools to allocate memory and compares the keys as sequence numbers.
Definition rbt.hh:173