next up previous
Next: Parameters Up: Data Link Protocol Teaching Previous: The Initialise Procedure

Communications Interface

A number of routines are available to allow the protocol to access the simulated communications channel and the network layer.

The simulated network layer delivers and receives items of type packet from the protocol. These items have no internal structure as far as the protocol writer is concerned, and can be assigned to variables of type packet. The communications channel transmits items of type

    struct frame { . . . };
The user must declare such a struct frame in his file. The user must define the contents of the struct frame, which typically, apart from a packet variable, also contain sequence numbers, acknowledgments, and possible other control fields.

The routines used to communicate between the user's protocol and the simulated network layer and physical layer are listed below. Since the length of the packet is needed to calculate how long its transmission will take, get_packet returns the length, and send_frame uses it. The functions Current_Time and Current_Protocol are available to these routines, and return the current values of the simulated time, and the identity of which end of the communications link is active.



Peter JB King
Thu Feb 19 15:30:56 GMT 1998