EventHelix.com: CASE Tools; Real-time and Embedded System Design; Object Oriented Design EventStudio 2.0: System Engineering CASE ToolEventStudio 2.5
Sequence diagram based system design and modeling
Home   What's New   EventStudio 2.5   Real-time Mantra   Thought Projects   Contact Us
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Receive_Protocol_Handler Class Reference

#include <Receive_Protocol_Handler.h>

Collaboration diagram for Receive_Protocol_Handler:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Receive Protocol Handler pattern is implemented by just one class.

This class receives the packets from the other end and performs the following operations:

See also:
Receive Protocol Handler Design Pattern

Definition at line 20 of file Receive_Protocol_Handler.h.

Public Member Functions

void Handle_Received_Packet (Datagram *p_Packet)
 The Handle Receive Packet method completely handles the receive side processing of the protocol messages.

 Receive_Protocol_Handler (Protocol_Layer *p_Layer)
 The constructor for the class.


Private Attributes

int m_next_Expected_Sequence_Number
 Transmit sequence number expected for the next packet.

int m_last_Acknowledged_Sequence_Number
 Receive sequence number from the last packet.

Transmit_Protocol_Handlerm_p_Transmit_Protocol_Handler
 Pointer to the associated Transmit Protocol Handler.

Protocol_Layerm_p_Layer
 Pointer to the parent layer. Used to obtain a pointer to the upper layer.


Constructor & Destructor Documentation

Receive_Protocol_Handler::Receive_Protocol_Handler Protocol_Layerp_Layer  ) [inline]
 

The constructor for the class.

The constructor needs a pointer to the parent layer. The Receive Protocol Handler will use this pointer to obtain a pointer to to the upper layer.

Parameters:
p_Layer Pointer to the parent layer.
See also:
Receive Protocol Handler Design Pattern

Definition at line 107 of file Receive_Protocol_Handler.h.

00107                                                       :
00108     m_p_Layer(p_Layer)
00109     {
00110     }
};


Member Function Documentation

void Receive_Protocol_Handler::Handle_Received_Packet Datagram * p_Packet  ) [inline]
 

The Handle Receive Packet method completely handles the receive side processing of the protocol messages.

This method takes the following actions:

  • Extract the header corresponding to this layer (See Protocol_Packet).
  • Compare the packet's transmit sequence number with the expected sequence number.
  • If the sequence number matches, take the following actions:
    • Request Transmit Sequence Handler to acknowledge the just received packet.
    • Add the message to the receive queue
    • Modulo increment the next expected sequence number
  • Compare the packet's receive sequence number with the last acknowledged sequence number. (Change in sequence number implies that an acknowledgement has been received from the other end).
  • If a change is detected in the received sequence number, the following action is taken:
    • Store the new receive sequence number as the last acknowledged sequence number.
    • Inform the Transmit Protocol Handler about the acknowledgements received from the other end

Parameters:
p_Packet Pointer to the packet passed by the lower layer.
See also:
Receive Protocol Handler Design Pattern

Definition at line 58 of file Receive_Protocol_Handler.h.

00059     {
00060         // Extract the header needed by this layer
00061         p_Packet->Extract_Header(L2_HEADER_LENGTH);
00062 
00063         // Compare the packet's transmit sequence number with 
00064         // the expected sequence number
00065         if (p_Packet->Get_Transmit_Sequence_Number() == m_next_Expected_Sequence_Number)
00066         {  
00067             // Request Transmit Sequence Handler to acknowledge 
00068             // the just received packet
00069             m_p_Transmit_Protocol_Handler->Handle_Send_Ack_Request(m_next_Expected_Sequence_Number);
00070 
00071             // Pass the message to the higher layer. The message is passed only if the upper layer
00072             // has been specified.
00073             Protocol_Layer *p_Upper_Layer = m_p_Layer->Get_Upper_Layer();
00074             if (p_Upper_Layer)
00075             {
00076                 p_Upper_Layer->Handle_Receive(p_Packet);
00077             }
00078 
00079             // Modulo increment the next expected sequence number
00080             Modulo_Increment(m_next_Expected_Sequence_Number);
00081         }
00082 
00083         // Compare the packet's receive sequence number with the 
00084         // last acknowledged sequence number. (Change in sequence number 
00085         // implies that an acknowledgement has been received from the other end)
00086         if (p_Packet->Get_Receive_Sequence_Number() != m_last_Acknowledged_Sequence_Number)
00087         {
00088             // Update the last acknowledged sequence number
00089             m_last_Acknowledged_Sequence_Number = p_Packet->Get_Receive_Sequence_Number();
00090 
00091             // Inform the Transmit Protocol Handler about the 
00092             // acknowledgements received from the other end
00093             m_p_Transmit_Protocol_Handler->Handle_Received_Ack_Notification(
00094                 m_last_Acknowledged_Sequence_Number);      
00095         }
00096     }


Member Data Documentation

int Receive_Protocol_Handler::m_last_Acknowledged_Sequence_Number [private]
 

Receive sequence number from the last packet.

Change in the receive sequence number means that the other end is acknowledging some packets

Definition at line 30 of file Receive_Protocol_Handler.h.


The documentation for this class was generated from the following file:
Generated on Sun Feb 13 21:30:36 2005 for Object Oriented Design Examples by doxygen 1.3.4
 Home   What's New   EventStudio 2.5   Real-time Mantra   Thought Projects   Contact Us
Copyright © 2000-2005 EventHelix.com Inc. All Rights Reserved.