# marina-cast-ro/operredespi architecture

> Architecture diagram of the GitHub repository marina-cast-ro/operredespi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marina-cast-ro/operredespi
- Repository: https://github.com/marina-cast-ro/operredespi

## Overview

El producto es un proyecto académico de redes y sistemas operativos, desarrollado por etapas: la primera recoge y transporta mediciones de sensores; la segunda implementa hosts y routers para comunicar mensajes mediante rutas. El README confirma la captura real o simulada y el objetivo de persistencia de la etapa 1, y describe la etapa 2 como construcción de tablas de enrutamiento. Las relaciones de etapa 2 reflejan las llamadas visibles; varios módulos de etapa 1 y el procesamiento interno de forwarding no fueron muestreados, así que no se fuerza su conexión.

Main entry points: [`Etapa2/main.c`](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/main.c) (Modos de ejecución), [`Etapa2/router/src/router.c`](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/router.c) (Router TCP), [`Etapa2/router/src/mmu.c`](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/mmu.c) (MMU), [`Etapa1/kernel/src/stopAndWait.c`](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/stopAndWait.c) (Stop-and-wait)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Captura de mediciones"]
  node_sensor["Sensor de movimiento<br/>[movementSensor.py]"]
  node_simulator["Simulador de sensor<br/>[simulateSensor.py]"]
  node_storage[("Almacenamiento auxiliar<br/>[storage.py]")]
end

subgraph group_stage1["Transporte Etapa 1"]
  node_kernel_syscalls["Syscalls de protocolo<br/>[syscallModule.c]"]
  node_stop_wait["Stop-and-wait<br/>[stopAndWait.c]"]
  node_kernel_socket["Socket de kernel<br/>[kernelSocket.c]"]
  node_user_server["Servidor emisor<br/>[serverMain.c]"]
  node_file_reader["Lector de archivos<br/>[serverFileReader.c]"]
  node_frame_builder["Constructor de tramas"]
  node_sender["Emisor de datos<br/>[serverSender.c]"]
  node_client["Receptor UDP<br/>[clientUser.c]"]
  node_sensor_output[("Archivo de mediciones")]
end

subgraph group_stage2["Red Etapa 2"]
  node_host_send["Host emisor<br/>[sender.c]"]
  node_host_listen["Host listener<br/>[listener.c]"]
  node_app_main["Modos de ejecución<br/>[main.c]"]
  node_router["Router TCP<br/>[router.c]"]
end

subgraph group_routing["Estado y rutas"]
  node_config["Parser de configuración<br/>[configParser.c]"]
  node_forwarding["Procesador de paquetes<br/>[forwarding.c]"]
  node_routing_table[("Tabla de rutas<br/>[routingTable.c]")]
  node_mmu["MMU<br/>[mmu.c]"]
  node_virtual_memory[("Memoria virtual<br/>[virtualMemory.c]")]
end

node_operator(("Operador"))
node_network_peer(("Router vecino"))
node_host_user(("Usuario de red"))

node_operator -->|"lee movimiento"| node_sensor
node_operator -->|"simula mediciones"| node_simulator
node_kernel_syscalls -->|"envía trama"| node_stop_wait
node_stop_wait -->|"usa socket"| node_kernel_socket
node_client -->|"escribe mediciones"| node_sensor_output
node_app_main -->|"inicia escucha"| node_host_listen
node_app_main -->|"inicia envío"| node_host_send
node_app_main -->|"lee configuración"| node_config
node_app_main -->|"inicializa"| node_mmu
node_app_main -->|"inicializa"| node_virtual_memory
node_app_main -->|"inicia router"| node_router
node_host_user -->|"elige modo"| node_app_main
node_host_listen -->|"conecta y escucha"| node_router
node_host_send -->|"envía mensaje"| node_router
node_router -->|"acepta conexión"| node_network_peer
node_router -->|"registra vecino"| node_routing_table
node_router -->|"procesa trama"| node_forwarding
node_routing_table -->|"lee y escribe bytes"| node_mmu
node_mmu -->|"accede memoria"| node_virtual_memory

click node_sensor "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/sensor/movementSensor.py"
click node_simulator "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/sensor/simulateSensor.py"
click node_storage "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/sensor/storage.py"
click node_kernel_syscalls "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/syscallModule.c"
click node_stop_wait "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/stopAndWait.c"
click node_kernel_socket "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/kernelSocket.c"
click node_user_server "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverMain.c"
click node_file_reader "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverFileReader.c"
click node_frame_builder "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverFrameBuilder.c"
click node_sender "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverSender.c"
click node_client "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/clientUser.c"
click node_host_send "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/host/src/sender.c"
click node_host_listen "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/host/src/listener.c"
click node_app_main "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/main.c"
click node_router "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/router.c"
click node_config "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/configParser.c"
click node_forwarding "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/forwarding.c"
click node_routing_table "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/routingTable.c"
click node_mmu "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/mmu.c"
click node_virtual_memory "https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/virtualMemory.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sensor,node_simulator,node_storage toneBlue
class node_kernel_syscalls,node_stop_wait,node_kernel_socket,node_user_server,node_file_reader,node_frame_builder,node_sender,node_client,node_sensor_output toneAmber
class node_host_send,node_host_listen,node_app_main,node_router,node_network_peer toneMint
class node_config,node_forwarding,node_routing_table,node_mmu,node_virtual_memory toneRose
class node_operator,node_host_user toneIndigo
```

## Components

### Captura de mediciones

- [Sensor de movimiento](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/sensor/movementSensor.py): `Etapa1/sensor/movementSensor.py`
- [Simulador de sensor](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/sensor/simulateSensor.py): `Etapa1/sensor/simulateSensor.py`
- [Almacenamiento auxiliar](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/sensor/storage.py): `Etapa1/sensor/storage.py`

### Transporte Etapa 1

- [Syscalls de protocolo](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/syscallModule.c): `Etapa1/kernel/src/syscallModule.c`
- [Stop-and-wait](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/stopAndWait.c): `Etapa1/kernel/src/stopAndWait.c`
- [Socket de kernel](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/kernel/src/kernelSocket.c): `Etapa1/kernel/src/kernelSocket.c`
- [Servidor emisor](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverMain.c): `Etapa1/user/src/serverMain.c`
- [Lector de archivos](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverFileReader.c): `Etapa1/user/src/serverFileReader.c`
- [Constructor de tramas](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverFrameBuilder.c): `Etapa1/user/src/serverFrameBuilder.c`
- [Emisor de datos](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/serverSender.c): `Etapa1/user/src/serverSender.c`
- [Receptor UDP](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa1/user/src/clientUser.c): `Etapa1/user/src/clientUser.c`
- **Archivo de mediciones**

### Red Etapa 2

- [Host emisor](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/host/src/sender.c): `Etapa2/host/src/sender.c`
- [Host listener](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/host/src/listener.c): `Etapa2/host/src/listener.c`
- [Modos de ejecución](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/main.c): `Etapa2/main.c`
- [Router TCP](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/router.c): `Etapa2/router/src/router.c`

### Estado y rutas

- [Parser de configuración](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/configParser.c): `Etapa2/router/src/configParser.c`
- [Procesador de paquetes](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/forwarding.c): `Etapa2/router/src/forwarding.c`
- [Tabla de rutas](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/routingTable.c): `Etapa2/router/src/routingTable.c`
- [MMU](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/mmu.c): `Etapa2/router/src/mmu.c`
- [Memoria virtual](https://github.com/marina-cast-ro/operredespi/blob/main/Etapa2/router/src/virtualMemory.c): `Etapa2/router/src/virtualMemory.c`

### Other components

- **Operador**
- **Router vecino**
- **Usuario de red**

## Connections

- Operador → Sensor de movimiento: lee movimiento
- Operador → Simulador de sensor: simula mediciones
- Syscalls de protocolo → Stop-and-wait: envía trama
- Stop-and-wait → Socket de kernel: usa socket
- Receptor UDP → Archivo de mediciones: escribe mediciones
- Modos de ejecución → Host listener: inicia escucha
- Modos de ejecución → Host emisor: inicia envío
- Modos de ejecución → Parser de configuración: lee configuración
- Modos de ejecución → MMU: inicializa
- Modos de ejecución → Memoria virtual: inicializa
- Modos de ejecución → Router TCP: inicia router
- Usuario de red → Modos de ejecución: elige modo
- Host listener → Router TCP: conecta y escucha
- Host emisor → Router TCP: envía mensaje
- Router TCP → Router vecino: acepta conexión
- Router TCP → Tabla de rutas: registra vecino
- Router TCP → Procesador de paquetes: procesa trama
- Tabla de rutas → MMU: lee y escribe bytes
- MMU → Memoria virtual: accede memoria
