# pls-org/cmsc-131-lab1 architecture

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

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

## Overview

renpkt is a small IPv4 base-header utility: its C driver accepts decode or encode commands, while assembly routines perform header bit manipulation and checksum work. The decode path reads and displays a 20-byte header and reports checksum validity; the encode path builds a header from field values and computes its checksum. The excerpts show the driver’s calls, and the README describes encoder-to-checksum use. Assembly implementation details were not sampled, so the graph stays at these documented boundaries.

Main entry points: [`driver.c`](https://github.com/pls-org/cmsc-131-lab1/blob/main/driver.c) (CLI and file driver), [`encode.asm`](https://github.com/pls-org/cmsc-131-lab1/blob/main/encode.asm) (Header encoder), [`checksum.asm`](https://github.com/pls-org/cmsc-131-lab1/blob/main/checksum.asm) (Checksum routine), [`decode.asm`](https://github.com/pls-org/cmsc-131-lab1/blob/main/decode.asm) (Header decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command interface"]
  node_driver["CLI and file driver<br/>[driver.c]"]
end

subgraph group_packet["Header processing"]
  node_decode["Header decoder<br/>[decode.asm]"]
  node_encode["Header encoder<br/>[encode.asm]"]
  node_checksum["Checksum routine<br/>[checksum.asm]"]
end

subgraph group_support["Calling convention"]
  node_cdecl["C calling macros<br/>[cdecl.h]"]
end

node_user(("User"))

node_user -->|"invokes"| node_driver
node_driver -->|"decodes header"| node_decode
node_driver -->|"checks validity"| node_checksum
node_driver -->|"encodes header"| node_encode
node_encode -->|"computes checksum"| node_checksum
node_driver -->|"uses declarations"| node_cdecl

click node_driver "https://github.com/pls-org/cmsc-131-lab1/blob/main/driver.c"
click node_decode "https://github.com/pls-org/cmsc-131-lab1/blob/main/decode.asm"
click node_encode "https://github.com/pls-org/cmsc-131-lab1/blob/main/encode.asm"
click node_checksum "https://github.com/pls-org/cmsc-131-lab1/blob/main/checksum.asm"
click node_cdecl "https://github.com/pls-org/cmsc-131-lab1/blob/main/cdecl.h"

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_decode,node_encode,node_checksum toneAmber
class node_cdecl toneMint
```

## Components

### Command interface

- [CLI and file driver](https://github.com/pls-org/cmsc-131-lab1/blob/main/driver.c): `driver.c`

### Header processing

- [Header decoder](https://github.com/pls-org/cmsc-131-lab1/blob/main/decode.asm): `decode.asm`
- [Header encoder](https://github.com/pls-org/cmsc-131-lab1/blob/main/encode.asm): `encode.asm`
- [Checksum routine](https://github.com/pls-org/cmsc-131-lab1/blob/main/checksum.asm): `checksum.asm`

### Calling convention

- [C calling macros](https://github.com/pls-org/cmsc-131-lab1/blob/main/cdecl.h): `cdecl.h`

### Other components

- **User**

## Connections

- User → CLI and file driver: invokes (evidence: `README.md`)
- CLI and file driver → Header decoder: decodes header (evidence: `driver.c`)
- CLI and file driver → Checksum routine: checks validity (evidence: `driver.c`)
- CLI and file driver → Header encoder: encodes header (evidence: `driver.c`)
- Header encoder → Checksum routine: computes checksum (evidence: `README.md`)
- CLI and file driver → C calling macros: uses declarations (evidence: `driver.c`)
