#include <SendWindow.h>
Inheritance diagram for SendWindow::
Public Methods | |
SendWindow (int size, SAR *sar) | |
~SendWindow () | |
Destroy the SendWindow. More... | |
TimeValue | getRtt () |
Get the average round trip time for the send window. More... | |
int | reliableSend (u_char *data, int dataLength) |
Send a queue of packets. More... | |
void | onAckRecvd (int numAcked, int credits, bool retrans) |
This function is called by the SAR when an ACK packet is received. More... | |
void | end () |
Used to clear the send window. More... | |
virtual void | toStream (std::ostream &out) |
Print out the state of the sliding window. More... | |
Private Methods | |
void | removePacket (int seqNum) |
Delete the packet from the buffer and free its memory. More... | |
int | addPacket (TpPacket *packet) |
Add a packet to the buffer. More... | |
ThreadMessageQueue< Packet > * | initialSegmentation () |
Segment up to a WINDOW_SIZE full of packets. More... | |
TpPacket * | segment () |
Segment one packet size of data. More... | |
void | sendEmptyPacket () |
This is used when the receive window credits go to zero. More... | |
bool | windowFull () |
Returns true if a packet can be added to the send window. More... | |
void | sentPacketTimeoutImpl (WindowPosition) |
A callback that gets executed if we havent yet received an ACK for a packet within the required timeout. More... | |
void | computeEffectiveWindow () |
This needs to be called every time m_credits, m_lastPacketSent, or m_lastAckRecv changes. More... | |
void | dumpDebug () |
Dump the table to debug output. More... | |
Static Private Methods | |
void * | sentPacketTimeout (void *arg) |
A wrapper around sentPacketTimeoutImpl. More... | |
Private Attributes | |
u_char * | m_data |
a pointer to the data we are sending. More... | |
int | m_dataLength |
the amount of data we are sending. More... | |
int | m_currentPosition |
how much data we have sent already. More... | |
CallbackTimer | m_packetTimeoutCallbackTimer |
A callback timer to timeout sent packets that havent been acked. More... | |
vector< bool *> | m_needSend |
whether the packet in the corresponding position in the window needs to be sent. More... | |
vector< TimeValue > | m_timeStamp |
when the packet in the corresponding position in the window was sent. More... | |
vector< int > | m_retries |
indicates how many retries this packet has had. More... | |
SAR * | m_sar |
a pointer back to our container. More... | |
WindowPosition | m_lastAckRecv |
location in the send window where the last ACK was received. More... | |
WindowPosition | m_lastPacketSent |
location in the send window where the last packet was sent. More... | |
WindowPosition | m_firstPacketSent |
remember the sequence number of the first packet that was sent. More... | |
Counter | m_packetSequenceNum |
A counter for the packet sequence number. More... | |
int | m_effectiveWindow |
How many packets we are allowed to send right now. More... | |
bool | m_sending |
true while executing the "addSend" function. More... | |
bool | m_end |
marked true when the "end" function is called, signifies that the object is being destroyed. More... | |
int | m_credits |
The last reported credits from the other side of the end-to-end connection. More... | |
TimeValue | m_rtt |
average round trip time for all packets in send window. More... | |
Condition | m_terminate |
used to signal to the destructor that other parts of the object have been destroyed. More... | |
Condition | m_ackSignal |
Signal when an ACK is received. More... | |
int | m_size |
the size of the sliding window. More... | |
Mutex | m_sendWindowLock |
a lock for the window while doing stuff to it. More... | |
vector< TpPacket *> | m_window |
The array that stores all the packets. More... |
Definition at line 20 of file SendWindow.h.
|
Definition at line 19 of file SendWindow.cpp. |
|
Destroy the SendWindow.
Definition at line 50 of file SendWindow.cpp. |
|
Add a packet to the buffer. This removes any packet that was in the position that the packet wants to go in.
Definition at line 72 of file SendWindow.cpp. Referenced by reliableSend().
|
|
This needs to be called every time m_credits, m_lastPacketSent, or m_lastAckRecv changes.
Definition at line 265 of file SendWindow.cpp. Referenced by onAckRecvd(), and reliableSend().
|
|
Dump the table to debug output.
Definition at line 502 of file SendWindow.cpp. Referenced by onAckRecvd(), and reliableSend().
|
|
Used to clear the send window. Marks all packets as "not needed to be sent". Definition at line 287 of file SendWindow.cpp. Referenced by SAR::connectionClosed(), and ~SendWindow().
|
|
Get the average round trip time for the send window.
Definition at line 278 of file SendWindow.cpp. Referenced by SAR::getAverageRtt().
|
|
Segment up to a WINDOW_SIZE full of packets. Creates a queue of segmented packets. The caller of this function has the responsibility of deleting the returned memory. Definition at line 463 of file SendWindow.cpp. Referenced by reliableSend().
|
|
This function is called by the SAR when an ACK packet is received. The positions of the ACKed packet(s) in the buffer are freed up so more data can be added. Definition at line 375 of file SendWindow.cpp. Referenced by SAR::receivePacket().
|
|
Send a queue of packets. This function blocks until all the packets have been sent.
Definition at line 108 of file SendWindow.cpp. Referenced by SAR::reliableSend().
|
|
Delete the packet from the buffer and free its memory.
Definition at line 87 of file SendWindow.cpp. Referenced by addPacket(), and onAckRecvd().
|
|
Segment one packet size of data. Side-effects: modifies m_currentPosition, m_packetSequenceNum.
Definition at line 486 of file SendWindow.cpp. Referenced by initialSegmentation(), and reliableSend().
|
|
This is used when the receive window credits go to zero. This will send an empty data packet to the receive window in hopes that it might ACK us with credits that are larger than zero. Definition at line 248 of file SendWindow.cpp. Referenced by reliableSend().
|
|
A wrapper around sentPacketTimeoutImpl.
Definition at line 310 of file SendWindow.cpp. |
|
A callback that gets executed if we havent yet received an ACK for a packet within the required timeout. It tries to send the packet and waits for the ACK. Definition at line 325 of file SendWindow.cpp. Referenced by sentPacketTimeout().
|
|
Print out the state of the sliding window.
Reimplemented from BasicObject. Definition at line 515 of file SendWindow.cpp. |
|
Returns true if a packet can be added to the send window.
Definition at line 440 of file SendWindow.cpp. Referenced by reliableSend().
|
|
Signal when an ACK is received.
Definition at line 100 of file SendWindow.h. |
|
The last reported credits from the other side of the end-to-end connection.
Definition at line 91 of file SendWindow.h. |
|
how much data we have sent already.
Definition at line 52 of file SendWindow.h. |
|
a pointer to the data we are sending.
Definition at line 46 of file SendWindow.h. |
|
the amount of data we are sending.
Definition at line 49 of file SendWindow.h. |
|
How many packets we are allowed to send right now.
Definition at line 82 of file SendWindow.h. |
|
marked true when the "end" function is called, signifies that the object is being destroyed.
Definition at line 88 of file SendWindow.h. |
|
remember the sequence number of the first packet that was sent.
Definition at line 76 of file SendWindow.h. |
|
location in the send window where the last ACK was received.
Definition at line 70 of file SendWindow.h. |
|
location in the send window where the last packet was sent.
Definition at line 73 of file SendWindow.h. |
|
whether the packet in the corresponding position in the window needs to be sent.
Definition at line 58 of file SendWindow.h. |
|
A counter for the packet sequence number.
Definition at line 79 of file SendWindow.h. |
|
A callback timer to timeout sent packets that havent been acked.
Definition at line 55 of file SendWindow.h. |
|
indicates how many retries this packet has had.
Definition at line 64 of file SendWindow.h. |
|
average round trip time for all packets in send window.
Definition at line 94 of file SendWindow.h. |
|
a pointer back to our container.
Definition at line 67 of file SendWindow.h. |
|
a lock for the window while doing stuff to it.
Definition at line 106 of file SendWindow.h. |
|
true while executing the "addSend" function.
Definition at line 85 of file SendWindow.h. |
|
the size of the sliding window.
Definition at line 103 of file SendWindow.h. |
|
used to signal to the destructor that other parts of the object have been destroyed.
Definition at line 97 of file SendWindow.h. |
|
when the packet in the corresponding position in the window was sent.
Definition at line 61 of file SendWindow.h. |
|
The array that stores all the packets.
Definition at line 109 of file SendWindow.h. |