Router Simulation is a program that simulates routers on a network. The program obtains the configuration information via files. Each router is being able to connect communicate with other routers (i.e., same program instantiated multiple times) through UDP sockets.
- Implemented in C language;
- Developed on the Linux platform;
- Uses UDP sockets only;
- Each NODE is executed as a process (multithreaded);
To execute the project, you will initially need to install the following dependencies:
After the installation of the premises, it is necessary to obtain a copy of the project, to do this, clone the project or fork
it through the button located in the upper right corner and then clone it on your machine.
The project is structured as follows:
Folder | Content |
---|---|
app/ | Executable files |
include/ | Header files |
inputs/ | Example input files |
src/ | Source routines files |
To clone and compile the repository you need to:
git clone https://github.com/northy/router-simulation.git
cd router-simulation && mkdir build && cd build && cmake ..
make -j
git clone https://github.com/northy/router-simulation.git
cd router-simulation && mkdir build && cd build && cmake .. -G "Ninja"
ninja
Finally, after following the previous steps, to run the project, in the build folder, execute the following command:
./Router <id>
In the execution folder, there must also contain two configuration files:
In this file, we configure the routers. Each line contains the following:
id port ip
where:
Input | Description | Restriction |
---|---|---|
id | Router's id | id>=1 |
port | UDP socket port to be opened | default port restrictions apply |
ip | IPv4 address of the router | default IPv4 restrictions apply |
In this file, we configure the network bidirectional links. Each line contains the following:
id1 id2 cost
where:
Input | Description | Restriction |
---|---|---|
id1 | Link's first node | id1>=1 |
id2 | Link's second node | id2>=1, id2!=id1 |
cost | Network cost from id1<->id2 | cost>=0 |