This project went around the development of a data link protocol and the provision of a reliable data communication service between two systems connected by a transmission medium - in this case, a serial cable.
The development environment was established with the LINUX operating system, the C Programming Language and the RS-232 Serial Ports (asynchronous communication), as well as the respective Drivers and API functions provided by the operating system.
Our project follows a module-based organization structure. The interfaces and their implementations are clearly distinguished and can be found inside the src folder. The former correspond to the header files, allowing to create a higher layer of abstraction and to provide its users only the necessary blocks of code, which are in the source files, in an inner model that works like a black box.
The data link layer encompasses most of the available modules:
- The
datalink.hmodule, that contains the main functions listed -llopen , llwrite , llread and llclose. sframe.handiframe.hmodules, which represent the state machines associated with the evaluation of the frames with supervision and information format, respectively.utils.hmodule, that includes some auxiliary functions, configuration constants and the main data structures used by the other modules.
The application layer includes the other modules, which use the functions provided by the previous modules:
- The
sender.hmodule, that, besides providing the user interface for sending the data, also contains the functions for creating and sending the control packets and data packages. - The
receiver.hmodule, which in addition to providing the user interface for receiving data, also contains the functions for receiving and confirming control packets and data packets.
To experiment with the virtual serial port provided by socat and the Stop & Wait ARQ mechanism developed, run the following commands:
docker build -t ubuntu:socat .docker run -d --name stopwait ubuntu:socatdocker exec -it stopwait /bin/bash
Inside the docker container
./tests.shfor exchanging the files inside thetestfolder between the sender and the receiver./diff.shfor checking if every file was sent without errors
Testing means exchanging files on the virtual wire simulated by socat. These files are sent by the sender process and received and acknowledged by the receiver process.
Real simulations were made on a real serial port, between 2 computers, with some more noise and reliability tests, to ensure the ARQ mechanism reacted to error frames as expected.
The tests folder contains some files that can be used to test this protocol.
The full report with the logs and data collected can be found here.
- Eduardo Brito, @edurbrito
- Pedro Ferreira, @pdff2000