The Unrestricted Simplex Protocol
Assuming:
- a (unidirectional) error free channel,
- that the
sender's network layer has unlimited data to send
(being "pushed down" from above), and
- that the receiver's network layer has an infinite buffer
to receive the data (being "pushed up" from below).
- that the functions READ_xxx_LAYER() and WRITE_xxx_LAYER()
block until their actions are complete - they execute synchronously.
In the sender:
FRAME frame;
int len, link = 1;
while( true ) {
READ_NETWORK_LAYER(frame.data, &len);
frame.len = len;
WRITE_PHYSICAL_LAYER(link, &frame, FRAME_SIZE(frame));
}
|
In the receiver:
FRAME frame;
int len, link;
while( true ) {
READ_PHYSICAL_LAYER(&link, &frame, &len);
WRITE_NETWORK_LAYER(frame.data, frame.len);
}
|
Note: when passing an array to a function in C,
as we do for our frame's payloads,
we do not need to place the '&' operator in front of the array's name.
CITS3002 Computer Networks, Lecture 3, Data Link Layer protocols, p4, 13th March 2024.
|