संदीप गुप्ता Sandeep Gupta - My nerdy side

25.11.07

Essentials of writing a protocol layer

A layer in protocol stack is an interface between its next higher layer and lower layer. It provides interface to send and receive data to and from these layers, generally referred to as Data Entity of the layer. It also provides another interface to manage the layer itself, generally referred to as Management Entity.

To write a layer, there are five major tasks to be handled:
- Initialization
- Cleanup
- Timers
- Data primitives
- Management primitives

Initialization would involve providing initial default values to various parameters related to the layer. This is performed once during the setup of the layer. Some or whole of this may be performed on receiving special management primitive to reset the layer.

Cleanup is freeing up the data which the layer might be using. It might also involve canceling all on-going operations at the layer after informing relevant layers/entities.

A timer handling function would be invoked whenever a timer expires. These timers are either repetitive or one-time. These are set during initialization or while handling data and management primitives. Expiration of timers may indicate erroneous condition, eg. non-receipt of a reply. Timers are set with their 'type' and some meta data. 'Type' is checked to invoke correct handler. Meta data is additional data that might be helpful in handling the timer.

Data primitives are interface functions used as data traverses through different layers. The general data primitives are request, confirm and indication. A request is sent by next higher layer to the layer to send the PDU. A confirm is the answer to this request. An indication is made from the layer to the next higher layer of the peer entity to which PDU has been sent.

Management primitives help in managing the layer. These generally involve getting and setting certain key parameters of the layer. Others could be suspending, resetting or restarting the layer. These primitives are specific to the layer.


[The above is a small article based on my little experience in protocol writing. This is only an overview of the protocol writing. I'll try to update the same if and when I get further experience/time.]

0 Comments:

Post a Comment

<< Home