DEV Community

Cover image for Utopian Simplex Protocol
Kareim Tarek AbdelAzeem
Kareim Tarek AbdelAzeem

Posted on

Utopian Simplex Protocol

Introduction

This is the first post in a series explaining various simple network protocols in the data link layer using the book: "Computer Networks Book by Andrew S. Tanenbaum" 5th edition.

The protocol consists of two procedures, a sender and a receiver. The sender runs in the data link layer of the source machine, and the receiver runs in the data link layer of the destination machine.

Protocol properties:

  • Data are transmitted in one direction only
  • the transmitting and receiving network layers are always ready.
  • Processing time can be ignored.
  • Infinite buffer space is available.
  • the communication channel (link) between the data link layers never damages or loses frames.
  • No sequence numbers or acknowledgements are used, so MAXSEQ is not needed.
  • The only event type possible is frame arrival (i.e., the arrival of an undamaged frame).

The Sender

The sender is in an infinite while loop just pumping data out onto the line as fast as it can.
The body of the loop consists of three actions:

  • Fetch a packet from the network layer (which is always available).
  • construct an outbound frame using the variable s.
  • send the frame on its way. Only the info field of the frame is used by this protocol, because the other fields have to do with error and flow control and there are no errors or flow control restrictions here.

The Receiver

  • Initially, it waits for something to happen, the only possibility being the arrival of an undamaged frame. so no if condition is used.
  • Eventually, the frame arrives and the procedure wait for event returns, with event set to frame arrival (which is ignored anyway).
  • The call to from physical layer removes the newly arrived frame from the hardware buffer and puts it in the variable r, where the receiver code can get at it.
  • Finally, the data portion is passed on to the network layer, and the data link layer settles back to wait for the next frame, effectively suspending itself until the frame arrives.

Implementation

/* Protocol 1 (Utopia) provides for data transmission in one direction only, from
sender to receiver. The communication channel is assumed to be error free
and the receiver is assumed to be able to process all the input infinitely quickly.
Consequently, the sender just sits in a loop pumping data out onto the line as
fast as it can. */

typedef enum {frame arrival} event type;

#include "protocol.h"

void sender1(void)
{
  frame s; /* buffer for an outbound frame */
  packet buffer; /* buffer for an outbound packet */
  while (true) {
    from network layer(&buffer); /* go get something to send */
    s.info = buffer; /* copy it into s for transmission */
    to physical layer(&s); /* send it on its way */
  }
}

void receiver1(void){
  frame r;
  event type event; /* filled in by wait, but not used here */
  while (true) {
  wait for event(&event); /* only possibility is frame arrival */
  from physical layer(&r); /* go get the inbound frame */
  /* pass the data to the network layer */
  to network layer(&r.info);
  }
}

Enter fullscreen mode Exit fullscreen mode

Conclusion

The utopia protocol is unrealistic because it does not handle either flow control or error correction. Its processing is close to that of an unacknowledged connectionless service that relies on higher layers to solve these problems, though even an unacknowledged connectionless service would do some error detection.

Reference and Credits

  • "Computer Networks Book by Andrew S. Tanenbaum" 5th edition.

Discussion (0)