# 100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web architecture

> Architecture diagram of the GitHub repository 100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web
- Repository: https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web

## Overview

##### Project type and purpose
- This is a Distributed P2P file-transfer system in C, augmented with an ONC-RPC server and a small Python-based web RPC service.
- Its goals (from README) are:
- Let peers exchange files in a P2P overlay (client.py, server.c, lines.c/h, users.c/h)
- Expose RPC operations via ONC-RPC (print_rpc.x, onc_rpc_server.c)
- Provide a simple web service in Python (ws-time-service.py) with a corresponding client (ws-calc-client.py).

##### File structure
- Top-level Makefile: builds C sources, compiles RPC stubs from print_rpc.x.
- C P2P module:
– server.c: P2P‐server daemon
– client.py: P2P file‐transfer client (Python)
– lines.c/h: file-chunk management
– users.c/h: peer/user authentication & metadata
- RPC module:
– print_rpc.x: RPC interface definition
– onc_rpc_server.c: RPC service implementation
- Web RPC module (Python):
– ws-time-service.py: HTTP time service
– ws-calc-client.py: example client consuming the web service
- Other artifacts: memoria.pdf (project report), README(.md/.txt), autores.txt.

## Diagram (Mermaid)

```mermaid
graph TB
    %% P2P Overlay Layer
    subgraph "P2P Network Layer"
        direction LR
        PeerA["Peer Node A"]:::p2p
        PeerB["Peer Node B"]:::p2p
        ServerDaemon["server.c"]:::p2p
        ClientCLI["client.py"]:::p2p
        FileChunk["lines.c/h"]:::p2p
        UserAuth["users.c/h"]:::p2p
        StorageA["Local Storage"]:::storage
        StorageB["Local Storage"]:::storage
    end

    %% ONC-RPC Layer
    subgraph "ONC-RPC Service Layer"
        printIDL["print_rpc.x"]:::rpc
        RPCStub["RPC Stubs (generated)"]:::rpc
        RPCServer["onc_rpc_server.c"]:::rpc
    end

    %% Web Service Layer
    subgraph "Web Service Layer"
        HTTPClient["ws-calc-client.py"]:::web
        HTTPService["ws-time-service.py"]:::web
    end

    %% Build / Deployment
    Makefile["Makefile"]:::build

    %% Connections
    PeerA <--> PeerB
    PeerA -->|"TCP File Exchange"| PeerB
    PeerA -->|"ONC-RPC Call (print/status)"| RPCServer
    printIDL --> RPCStub
    RPCStub --> RPCServer
    HTTPClient -->|"HTTP GET/POST"| HTTPService
    Makefile --> ServerDaemon
    Makefile --> FileChunk
    Makefile --> UserAuth
    Makefile --> printIDL
    Makefile --> RPCStub
    Makefile --> RPCServer

    %% Click Events
    click ServerDaemon "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/server.c"
    click ClientCLI "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/client.py"
    click FileChunk "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/lines.c"
    click UserAuth "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/users.c"
    click printIDL "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/print_rpc.x"
    click RPCServer "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/onc_rpc_server.c"
    click HTTPService "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/ws-time-service.py"
    click HTTPClient "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/blob/main/ws-calc-client.py"
    click Makefile "https://github.com/100496072/sistema-p2p-distribuido-para-traspaso-de-ficheros-y-servicios-rpc-web/tree/main/Makefile"

    %% Styles
    classDef p2p fill:#cce5ff,stroke:#0066cc,color:#003366
    classDef rpc fill:#d4edda,stroke:#28a745,color:#155724
    classDef web fill:#ffe5cc,stroke:#ff6600,color:#663300
    classDef storage fill:#f8f9fa,stroke:#6c757d,color:#343a40
    classDef build fill:#e2e3e5,stroke:#bcbebf,color:#41464b
```
