# yomaruichi/cmsc-131-lab1 architecture

> Architecture diagram of the GitHub repository yomaruichi/cmsc-131-lab1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yomaruichi/cmsc-131-lab1
- Repository: https://github.com/yomaruichi/cmsc-131-lab1

## Overview

renpkt is a small IPv4 base-header utility: its C driver handles command-line options and file I/O, while assembly routines perform header decoding, encoding, and checksum work. The principal workflows are decoding a 20-byte header and reporting its fields/checksum status, or building a header from validated options and writing it out. The README documents the assembly routines’ roles and their checksum relationship; sampled driver excerpts show the calls. Other source details were not sampled.

Main entry points: [`driver.c`](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/driver.c) (CLI and File Driver), [`decode.asm`](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/decode.asm) (Header Decoder), [`encode.asm`](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/encode.asm) (Header Encoder), [`checksum.asm`](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/checksum.asm) (Checksum Routine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command Interface"]
  node_driver["CLI and File Driver<br/>[driver.c]"]
end

subgraph group_packet["IPv4 Processing"]
  node_decoded["Decoded Header Fields"]
  node_decoder["Header Decoder<br/>[decode.asm]"]
  node_checksum["Checksum Routine<br/>[checksum.asm]"]
  node_encoder["Header Encoder<br/>[encode.asm]"]
end

node_user(("User"))
node_input["Header Input File"]
node_output["Encoded Header File"]
node_report["Field and Validity Report"]

node_user -->|"invokes"| node_driver
node_input -->|"reads bytes"| node_driver
node_driver -->|"calls decode"| node_decoder
node_driver -->|"checks header"| node_checksum
node_decoder -->|"extracts fields"| node_decoded
node_driver -->|"prints fields"| node_report
node_user -->|"supplies options"| node_driver
node_driver -->|"calls encode"| node_encoder
node_encoder -->|"computes checksum"| node_checksum
node_driver -->|"writes header"| node_output

click node_driver "https://github.com/yomaruichi/cmsc-131-lab1/blob/main/driver.c"
click node_decoder "https://github.com/yomaruichi/cmsc-131-lab1/blob/main/decode.asm"
click node_checksum "https://github.com/yomaruichi/cmsc-131-lab1/blob/main/checksum.asm"
click node_encoder "https://github.com/yomaruichi/cmsc-131-lab1/blob/main/encode.asm"

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_driver,node_user toneBlue
class node_decoded,node_decoder,node_checksum,node_encoder toneAmber
class node_input,node_output,node_report toneIndigo
```

## Components

### Command Interface

- [CLI and File Driver](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/driver.c): `driver.c`

### IPv4 Processing

- **Decoded Header Fields**
- [Header Decoder](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/decode.asm): `decode.asm`
- [Checksum Routine](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/checksum.asm): `checksum.asm`
- [Header Encoder](https://github.com/yomaruichi/cmsc-131-lab1/blob/main/encode.asm): `encode.asm`

### Other components

- **User**
- **Header Input File**
- **Encoded Header File**
- **Field and Validity Report**

## Connections

- User → CLI and File Driver: invokes (evidence: `README.md`)
- Header Input File → CLI and File Driver: reads bytes (evidence: `driver.c`)
- CLI and File Driver → Header Decoder: calls decode (evidence: `driver.c`)
- CLI and File Driver → Checksum Routine: checks header (evidence: `driver.c`)
- Header Decoder → Decoded Header Fields: extracts fields (evidence: `README.md`)
- CLI and File Driver → Field and Validity Report: prints fields (evidence: `driver.c`)
- User → CLI and File Driver: supplies options (evidence: `README.md`)
- CLI and File Driver → Header Encoder: calls encode (evidence: `driver.c`)
- Header Encoder → Checksum Routine: computes checksum (evidence: `README.md`)
- CLI and File Driver → Encoded Header File: writes header (evidence: `driver.c`)
