# c4gerges/projet_service_reseaux architecture

> Architecture diagram of the GitHub repository c4gerges/projet_service_reseaux, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/c4gerges/projet_service_reseaux
- Repository: https://github.com/c4gerges/projet_service_reseaux

## Overview

This is a command-line packet analyzer: a user selects a live interface or pcap file, may supply a capture filter and verbosity, and the program captures packets for protocol decoding and printed summaries. The visible code shows IPv4 dispatch to transport/control protocols; the tree also contains Ethernet, IPv6, ARP/RARP, BOOTP/DHCP, DNS, and TCP application analyzers. The README is empty, and several dispatchers were not excerpted, so links between those modules are omitted rather than inferred.

Main entry points: [`ip.c`](https://github.com/c4gerges/projet_service_reseaux/blob/main/ip.c) (IPv4 and IPv6), [`main.c`](https://github.com/c4gerges/projet_service_reseaux/blob/main/main.c) (CLI and capture), [`icmp.c`](https://github.com/c4gerges/projet_service_reseaux/blob/main/icmp.c) (ICMP and ICMPv6), [`ethernet.c`](https://github.com/c4gerges/projet_service_reseaux/blob/main/ethernet.c) (Ethernet decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture"]
  node_cli["CLI and capture<br/>[main.c]"]
end

subgraph group_network["Network decoding"]
  node_ethernet["Ethernet decoder<br/>[ethernet.c]"]
  node_ip["IPv4 and IPv6<br/>[ip.c]"]
  node_arp["ARP and RARP<br/>[arp.c]"]
  node_icmp["ICMP and ICMPv6<br/>[icmp.c]"]
end

subgraph group_transport["Transport decoding"]
  node_tcp["TCP decoder<br/>[tcp.c]"]
  node_udp["UDP decoder<br/>[udp.c]"]
end

subgraph group_applications["Application protocols"]
  node_bootp["BOOTP and DHCP<br/>[bootp.c]"]
  node_bootpdefs["BOOTP definitions<br/>[bootp.h]"]
  node_dns["DNS decoder<br/>[dns.c]"]
  node_ftp["FTP decoder<br/>[ftp.c]"]
  node_http["HTTP decoder<br/>[http.c]"]
  node_smtp["SMTP decoder<br/>[smtp.c]"]
  node_imap["IMAP decoder<br/>[imap.c]"]
  node_pop["POP3 decoder<br/>[pop.c]"]
  node_telnet["Telnet decoder<br/>[telnet.c]"]
end

node_user(("User"))
node_packets(("Packet source"))
node_pcap["libpcap"]

node_user -->|"configures capture"| node_cli
node_packets -->|"supplies packets"| node_pcap
node_cli -->|"opens and filters"| node_pcap
node_pcap -->|"dispatches packets"| node_ethernet
node_ip -->|"dispatches IPv4"| node_tcp
node_ip -->|"dispatches IPv4"| node_udp
node_ip -->|"dispatches IPv4"| node_icmp
node_ip -.->|"dispatches IPv6"| node_icmp

click node_cli "https://github.com/c4gerges/projet_service_reseaux/blob/main/main.c"
click node_ethernet "https://github.com/c4gerges/projet_service_reseaux/blob/main/ethernet.c"
click node_ip "https://github.com/c4gerges/projet_service_reseaux/blob/main/ip.c"
click node_arp "https://github.com/c4gerges/projet_service_reseaux/blob/main/arp.c"
click node_icmp "https://github.com/c4gerges/projet_service_reseaux/blob/main/icmp.c"
click node_tcp "https://github.com/c4gerges/projet_service_reseaux/blob/main/tcp.c"
click node_udp "https://github.com/c4gerges/projet_service_reseaux/blob/main/udp.c"
click node_bootp "https://github.com/c4gerges/projet_service_reseaux/blob/main/bootp.c"
click node_bootpdefs "https://github.com/c4gerges/projet_service_reseaux/blob/main/bootp.h"
click node_dns "https://github.com/c4gerges/projet_service_reseaux/blob/main/dns.c"
click node_ftp "https://github.com/c4gerges/projet_service_reseaux/blob/main/ftp.c"
click node_http "https://github.com/c4gerges/projet_service_reseaux/blob/main/http.c"
click node_smtp "https://github.com/c4gerges/projet_service_reseaux/blob/main/smtp.c"
click node_imap "https://github.com/c4gerges/projet_service_reseaux/blob/main/imap.c"
click node_pop "https://github.com/c4gerges/projet_service_reseaux/blob/main/pop.c"
click node_telnet "https://github.com/c4gerges/projet_service_reseaux/blob/main/telnet.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_cli,node_user toneBlue
class node_ethernet,node_ip,node_arp,node_icmp toneAmber
class node_tcp,node_udp toneMint
class node_bootp,node_bootpdefs,node_dns,node_ftp,node_http,node_smtp,node_imap,node_pop,node_telnet toneRose
class node_packets,node_pcap toneIndigo
```

## Components

### Capture

- [CLI and capture](https://github.com/c4gerges/projet_service_reseaux/blob/main/main.c): `main.c`

### Network decoding

- [Ethernet decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/ethernet.c): `ethernet.c`
- [IPv4 and IPv6](https://github.com/c4gerges/projet_service_reseaux/blob/main/ip.c): `ip.c`
- [ARP and RARP](https://github.com/c4gerges/projet_service_reseaux/blob/main/arp.c): `arp.c`
- [ICMP and ICMPv6](https://github.com/c4gerges/projet_service_reseaux/blob/main/icmp.c): `icmp.c`

### Transport decoding

- [TCP decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/tcp.c): `tcp.c`
- [UDP decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/udp.c): `udp.c`

### Application protocols

- [BOOTP and DHCP](https://github.com/c4gerges/projet_service_reseaux/blob/main/bootp.c): `bootp.c`
- [BOOTP definitions](https://github.com/c4gerges/projet_service_reseaux/blob/main/bootp.h): `bootp.h`
- [DNS decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/dns.c): `dns.c`
- [FTP decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/ftp.c): `ftp.c`
- [HTTP decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/http.c): `http.c`
- [SMTP decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/smtp.c): `smtp.c`
- [IMAP decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/imap.c): `imap.c`
- [POP3 decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/pop.c): `pop.c`
- [Telnet decoder](https://github.com/c4gerges/projet_service_reseaux/blob/main/telnet.c): `telnet.c`

### Other components

- **User**
- **Packet source**
- **libpcap**

## Connections

- User → CLI and capture: configures capture (evidence: `main.c`)
- Packet source → libpcap: supplies packets
- CLI and capture → libpcap: opens and filters (evidence: `main.c`)
- libpcap → Ethernet decoder: dispatches packets
- IPv4 and IPv6 → TCP decoder: dispatches IPv4 (evidence: `ip.c`)
- IPv4 and IPv6 → UDP decoder: dispatches IPv4 (evidence: `ip.c`)
- IPv4 and IPv6 → ICMP and ICMPv6: dispatches IPv4 (evidence: `ip.c`)
- IPv4 and IPv6 → ICMP and ICMPv6: dispatches IPv6
