| EventStudio 2.5 Sequence diagram based system design and modeling | |
#include <Retransmission_Buffer.h> Collaboration diagram for Retransmission_Buffer:

The messages are retransmitted If no ack is received.
The interactions of this object are listed below:
Definition at line 30 of file Retransmission_Buffer.h.
Public Member Functions | |
| Retransmission_Buffer (Protocol_Layer *p_Layer) | |
| The constructor for the class. | |
| void | Add_Packet (const Datagram *p_Packet) |
| Store a packet for possible retransmission in the future. | |
| void | Handle_Received_Ack_Notification (int new_Acknowledged_Sequence_Number) |
| Handle the acknowledgement received from the remote end. | |
| int | Get_Window_Room () const |
| Obtain the total free room available in the window. | |
| void | Handle_Await_Ack_Timeout () |
| This method is invoked when the protocol times out for an acknowlegement from the remote end. | |
|
The constructor for the class. The constructor needs a pointer to the parent layer. The Retransmission Buffer will use this pointer to obtain a pointer to the lower layer.
Definition at line 52 of file Retransmission_Buffer.h. 00052 : m_p_Layer(p_Layer)
00053 {
00054 }
|
|
Store a packet for possible retransmission in the future. This method takes the following actions:
Definition at line 67 of file Retransmission_Buffer.h. 00068 {
00069
00070 m_last_Transmitted_Sequence_Number = p_Packet->Get_Transmit_Sequence_Number();
00071
00072 // Make a copy of the packet for the retransmission buffer
00073 m_p_Pending_Packets[m_last_Transmitted_Sequence_Number] = new Datagram(p_Packet);
00074
00075 // Restart the ack timer. Timer is started if its not running
00076 Restart_Await_Ack_Timer();
00077 }
|
|
Handle the acknowledgement received from the remote end. The following actions are taken on receiving an ack:
Definition at line 91 of file Retransmission_Buffer.h. 00092 {
00093 // Delete the buffers allocted to retransmission buffers
00094 // for all allocated packets.
00095 for (int i=m_last_Acknowledged_Sequence_Number; i != new_Acknowledged_Sequence_Number;
00096 Modulo_Increment(i))
00097 {
00098 delete m_p_Pending_Packets[i];
00099 m_p_Pending_Packets[i] = NULL;
00100 }
00101
00102 // Save the new sequence number as the last acknowledged seq num
00103 m_last_Acknowledged_Sequence_Number = new_Acknowledged_Sequence_Number;
00104
00105 // If all packets have been acknowledged, stop timer
00106 if (m_last_Transmitted_Sequence_Number == m_last_Acknowledged_Sequence_Number)
00107 {
00108 Stop_Await_Ack_Timer();
00109 }
00110 }
|
|
Obtain the total free room available in the window. Return the room in window by determining the current count of messages awaiting acknowledgement.
Definition at line 120 of file Retransmission_Buffer.h. 00121 {
00122 // Return the room in window by determining the current count of messages
00123 // awaiting acknowledgement
00124 return (WINDOW_SIZE -
00125 Modulo_Difference(m_last_Transmitted_Sequence_Number, m_last_Acknowledged_Sequence_Number));
00126 }
|
|
This method is invoked when the protocol times out for an acknowlegement from the remote end. This method will retransmit all the packets that are pending acknowledgement. The sequence of actions is:
Definition at line 137 of file Retransmission_Buffer.h. 00138 {
00139 Datagram *p_Packet;
00140
00141 // Initiate retransmission of all unacknowledged packets by
00142 // looping from the last unacknowledged sequence number to
00143 // the sequence number of the last transmitted message
00144 for (int i=Modulo_Add(m_last_Acknowledged_Sequence_Number, 1);
00145 i != m_last_Transmitted_Sequence_Number; Modulo_Increment(i))
00146 {
00147
00148 // Get the packet corresponding to the sequence number i
00149 p_Packet = m_p_Pending_Packets[i];
00150
00151 // Pass on the message for transmission on the serial port
00152 (m_p_Layer->Get_Lower_Layer())->Transmit(p_Packet);
00153 }
00154
00155 // Now restart the timer
00156 Restart_Await_Ack_Timer();
00157 }
|
1.3.4 | |
| Copyright © 2000-2005 EventHelix.com Inc. All Rights Reserved. |