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

The Transmit Protocol Handler receives a packet from the higher layer and transmits it to the lower layer after assigning a sequence number. The packet is also stored in an internal retransmission buffer. The packet is removed from the retransmission queue if the remote end acknowledges the packet. The Transmit Protocol Handler retransmits the packet if it times out for an acknowledgement.
Definition at line 24 of file Transmit_Protocol_Handler.h.
Public Member Functions | |
| Transmit_Protocol_Handler (Protocol_Layer *p_Layer) | |
| The constructor for the class. | |
| void | Handle_Transmit_Request (Datagram *p_Packet) |
| Handle the transmission requests from the higher layer. | |
| void | Handle_Send_Ack_Request (int new_Receive_Sequence_Number) |
| Handle ack transmission requests from the Receive Protocol Handler. | |
| void | Handle_Received_Ack_Notification (int acknowledged_Sequence_Number) |
| Handle acknowledgements that have been received by the Receive Protocol Handler. | |
Private Member Functions | |
| void | Transmit_Packet (Datagram *p_Packet) |
| Transmit a packet to the lower layer. | |
Private Attributes | |
| int | m_next_Transmit_Sequence_Number |
| Transmit sequence number for the next packet. | |
| int | m_next_Receive_Sequence_Number |
| Receive sequence number to be sent in the next packet. | |
| Retransmission_Buffer | m_retransmission_Buffer |
| Retransmission buffer for storing all packets that have been transmitted and are awaiting an acknowledgement from the other end. | |
| Packet_Queue< Datagram > | m_transmit_Queue |
| Packets awaiting transmission to the lower layer. | |
| Protocol_Layer * | m_p_Layer |
| Pointer to the parent layer. | |
|
The constructor for the class. The constructor needs a pointer to the parent layer. The Transmit Protocol Handler will use this pointer to obtain a pointer to the lower layer.
Definition at line 94 of file Transmit_Protocol_Handler.h. 00094 : 00095 m_p_Layer(p_Layer), m_retransmission_Buffer(p_Layer) 00096 { 00097 } |
|
Transmit a packet to the lower layer. This method performs the following steps:
Definition at line 56 of file Transmit_Protocol_Handler.h. 00057 {
00058 // Add header and sequence numbers
00059 p_Packet->Add_Header(L2_HEADER_LENGTH);
00060
00061 p_Packet->Set_Receive_Sequence_Number(m_next_Receive_Sequence_Number);
00062
00063 // Fill the transmit sequence number and inform
00064 // retransmission queue if the packet is not
00065 // an acknowledgement packet
00066 if (p_Packet->GetType() != Datagram::ACKNOWLEDGEMENT)
00067 {
00068 p_Packet->Set_Transmit_Sequence_Number(m_next_Transmit_Sequence_Number);
00069 Modulo_Increment(m_next_Transmit_Sequence_Number);
00070 // Inform retransmission queue about the packet
00071 m_retransmission_Buffer.Add_Packet(p_Packet);
00072 }
00073
00074 // Pass on the message for transmission to the lower layer. A pointer to the lower
00075 // layer is obtained from the parent layer.
00076 Protocol_Layer *p_Lower_Layer = m_p_Layer->Get_Lower_Layer();
00077 if (p_Lower_Layer)
00078 {
00079 p_Lower_Layer->Transmit(p_Packet);
00080 }
00081 }
|
|
Handle the transmission requests from the higher layer. If the window is open, the packet is formed and transmitted to the lower layer. The packet is enqueued if the window is full.
Definition at line 107 of file Transmit_Protocol_Handler.h. 00108 {
00109 // Check for space in window
00110 if (m_retransmission_Buffer.Get_Window_Room() == 0)
00111 {
00112 // No space, window is full. The message waits
00113 // in the queue
00114 m_transmit_Queue.Add(p_Packet);
00115 }
00116 else
00117 {
00118 // If the window is open, transmit packet immediately
00119 Transmit_Packet(p_Packet);
00120 }
00121 }
|
|
Handle ack transmission requests from the Receive Protocol Handler. The Receive Protocol Handler specifies the sequence number that needs to be acknowledged. This method takes the following actions:
Definition at line 134 of file Transmit_Protocol_Handler.h. 00135 {
00136 // Copy the new receive sequence number
00137 // to acknowledge a packet
00138 m_next_Receive_Sequence_Number = new_Receive_Sequence_Number;
00139
00140 // If there are no more pending messages,
00141 // send an explicit acknowledgement message. If messages
00142 // are pending, ack can be piggy backed.
00143 if (m_transmit_Queue.Get_Length() == 0)
00144 {
00145 // No messages are pending transmission.
00146 // Send explicit ack
00147 Transmit_Packet(new Datagram(Datagram::ACKNOWLEDGEMENT));
00148 }
00149 }
|
|
Handle acknowledgements that have been received by the Receive Protocol Handler. The Receive_Protocol_Handler passes the acknowledged sequence number in the message. This method takes the following actions:
Definition at line 164 of file Transmit_Protocol_Handler.h. 00165 {
00166 Datagram *p_Packet;
00167
00168 // Delegate ack processing to Retransmission Buffer
00169 m_retransmission_Buffer.Handle_Received_Ack_Notification(acknowledged_Sequence_Number);
00170
00171 // Check if the transmit window has opened up. If there is is room in
00172 // the window, transmit packets waiting in the transmit queue
00173 int windowRoom = m_retransmission_Buffer.Get_Window_Room();
00174 for (int i=0; i < windowRoom && m_transmit_Queue.Get_Length(); i++)
00175 {
00176 p_Packet = m_transmit_Queue.Remove();
00177 Transmit_Packet(p_Packet);
00178 }
00179 }
|
|
Receive sequence number to be sent in the next packet. This acknowledges packets sent by the other end Definition at line 33 of file Transmit_Protocol_Handler.h. |
1.3.4 | |
| Copyright © 2000-2005 EventHelix.com Inc. All Rights Reserved. |