# skala13x/libxutils architecture

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

- Interactive diagram: https://gitdiagram.com/skala13x/libxutils
- Repository: https://github.com/skala13x/libxutils

## Overview

libxutils is a cross-platform C runtime library, not a single end-user application. Its central workflow is an application configuring the event-driven networking API, which uses sockets and the event loop to handle protocol traffic and invoke callbacks; HTTP, WebSocket, MDTP, and raw sockets are documented modes. The library also provides independent data, cryptography, and system building blocks. Relationships for unsampled modules are included only where the README or SOURCE INDEX supports them; the excerpts do not expose all networking dispatch details.

Main entry points: [`src/net/api.c`](https://github.com/skala13x/libxutils/blob/main/src/net/api.c) (Network API), [`src/data/json.c`](https://github.com/skala13x/libxutils/blob/main/src/data/json.c) (JSON processing), [`src/crypt/crypt.c`](https://github.com/skala13x/libxutils/blob/main/src/crypt/crypt.c) (Crypto dispatch), [`src/crypt/rsa.c`](https://github.com/skala13x/libxutils/blob/main/src/crypt/rsa.c) (RSA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_net["Networking runtime"]
  node_api["Network API<br/>[api.c]"]
  node_events["Event loop<br/>[event.c]"]
  node_sockets["Socket layer<br/>[sock.c]"]
  node_http["HTTP<br/>[http.c]"]
  node_websocket["WebSocket<br/>[ws.c]"]
  node_mdtp["MDTP<br/>[mdtp.c]"]
  node_address["Address helpers<br/>[addr.c]"]
end

subgraph group_data["Data and containers"]
  node_array["Dynamic arrays<br/>[array.c]"]
  node_buffers["Byte buffers<br/>[buf.c]"]
  node_strings["String utilities<br/>[str.c]"]
  node_json["JSON processing<br/>[json.c]"]
  node_jwt["JWT processing<br/>[jwt.c]"]
  node_containers["Maps and lists"]
end

subgraph group_crypto["Cryptography"]
  node_cryptdispatch["Crypto dispatch<br/>[crypt.c]"]
  node_aes["AES<br/>[aes.c]"]
  node_rsa["RSA<br/>[rsa.c]"]
  node_encoding["Hash and encoding"]
end

subgraph group_system["System utilities"]
  node_filesystem["Filesystem<br/>[xfs.c]"]
  node_monitor["Resource monitoring<br/>[mon.c]"]
  node_logging["Logging<br/>[log.c]"]
  node_cli["CLI helpers<br/>[cli.c]"]
  node_threads["Threading<br/>[thread.c]"]
end

subgraph group_misc["Additional protocols"]
  node_ntp["NTP client<br/>[ntp.c]"]
  node_rtp["RTP helpers<br/>[rtp.c]"]
  node_version["Version helpers<br/>[xver.c]"]
end

node_app(("Native application"))

node_app -->|"configures and uses"| node_api
node_api -->|"multiplexes through"| node_events
node_api -->|"uses shared sockets"| node_sockets
node_api -->|"serves HTTP"| node_http
node_api -->|"serves WebSocket"| node_websocket
node_api -->|"serves MDTP"| node_mdtp
node_api -->|"uses session buffers"| node_buffers
node_json -->|"uses"| node_strings
node_json -->|"uses maps"| node_containers
node_json -->|"uses arrays"| node_array
node_cryptdispatch -->|"dispatches to"| node_aes
node_cryptdispatch -->|"dispatches to"| node_rsa
node_cryptdispatch -->|"dispatches to"| node_encoding
node_rsa -->|"uses"| node_filesystem
node_monitor -->|"reads system files"| node_filesystem
node_threads -.->|"can support workers"| node_api

click node_api "https://github.com/skala13x/libxutils/blob/main/src/net/api.c"
click node_events "https://github.com/skala13x/libxutils/blob/main/src/net/event.c"
click node_sockets "https://github.com/skala13x/libxutils/blob/main/src/net/sock.c"
click node_http "https://github.com/skala13x/libxutils/blob/main/src/net/http.c"
click node_websocket "https://github.com/skala13x/libxutils/blob/main/src/net/ws.c"
click node_mdtp "https://github.com/skala13x/libxutils/blob/main/src/net/mdtp.c"
click node_address "https://github.com/skala13x/libxutils/blob/main/src/net/addr.c"
click node_array "https://github.com/skala13x/libxutils/blob/main/src/data/array.c"
click node_buffers "https://github.com/skala13x/libxutils/blob/main/src/data/buf.c"
click node_strings "https://github.com/skala13x/libxutils/blob/main/src/data/str.c"
click node_json "https://github.com/skala13x/libxutils/blob/main/src/data/json.c"
click node_jwt "https://github.com/skala13x/libxutils/blob/main/src/data/jwt.c"
click node_containers "https://github.com/skala13x/libxutils/tree/main/src/data"
click node_cryptdispatch "https://github.com/skala13x/libxutils/blob/main/src/crypt/crypt.c"
click node_aes "https://github.com/skala13x/libxutils/blob/main/src/crypt/aes.c"
click node_rsa "https://github.com/skala13x/libxutils/blob/main/src/crypt/rsa.c"
click node_encoding "https://github.com/skala13x/libxutils/tree/main/src/crypt"
click node_filesystem "https://github.com/skala13x/libxutils/blob/main/src/sys/xfs.c"
click node_monitor "https://github.com/skala13x/libxutils/blob/main/src/sys/mon.c"
click node_logging "https://github.com/skala13x/libxutils/blob/main/src/sys/log.c"
click node_cli "https://github.com/skala13x/libxutils/blob/main/src/sys/cli.c"
click node_threads "https://github.com/skala13x/libxutils/blob/main/src/sys/thread.c"
click node_ntp "https://github.com/skala13x/libxutils/blob/main/src/net/ntp.c"
click node_rtp "https://github.com/skala13x/libxutils/blob/main/src/net/rtp.c"
click node_version "https://github.com/skala13x/libxutils/blob/main/src/xver.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_api,node_events,node_sockets,node_http,node_websocket,node_mdtp,node_address toneBlue
class node_array,node_buffers,node_strings,node_json,node_jwt,node_containers toneAmber
class node_cryptdispatch,node_aes,node_rsa,node_encoding toneMint
class node_filesystem,node_monitor,node_logging,node_cli,node_threads toneRose
class node_ntp,node_rtp,node_version,node_app toneIndigo
```

## Components

### Networking runtime

- [Network API](https://github.com/skala13x/libxutils/blob/main/src/net/api.c): `src/net/api.c`
- [Event loop](https://github.com/skala13x/libxutils/blob/main/src/net/event.c): `src/net/event.c`
- [Socket layer](https://github.com/skala13x/libxutils/blob/main/src/net/sock.c): `src/net/sock.c`
- [HTTP](https://github.com/skala13x/libxutils/blob/main/src/net/http.c): `src/net/http.c`
- [WebSocket](https://github.com/skala13x/libxutils/blob/main/src/net/ws.c): `src/net/ws.c`
- [MDTP](https://github.com/skala13x/libxutils/blob/main/src/net/mdtp.c): `src/net/mdtp.c`
- [Address helpers](https://github.com/skala13x/libxutils/blob/main/src/net/addr.c): `src/net/addr.c`

### Data and containers

- [Dynamic arrays](https://github.com/skala13x/libxutils/blob/main/src/data/array.c): `src/data/array.c`
- [Byte buffers](https://github.com/skala13x/libxutils/blob/main/src/data/buf.c): `src/data/buf.c`
- [String utilities](https://github.com/skala13x/libxutils/blob/main/src/data/str.c): `src/data/str.c`
- [JSON processing](https://github.com/skala13x/libxutils/blob/main/src/data/json.c): `src/data/json.c`
- [JWT processing](https://github.com/skala13x/libxutils/blob/main/src/data/jwt.c): `src/data/jwt.c`
- [Maps and lists](https://github.com/skala13x/libxutils/tree/main/src/data): `src/data`

### Cryptography

- [Crypto dispatch](https://github.com/skala13x/libxutils/blob/main/src/crypt/crypt.c): `src/crypt/crypt.c`
- [AES](https://github.com/skala13x/libxutils/blob/main/src/crypt/aes.c): `src/crypt/aes.c`
- [RSA](https://github.com/skala13x/libxutils/blob/main/src/crypt/rsa.c): `src/crypt/rsa.c`
- [Hash and encoding](https://github.com/skala13x/libxutils/tree/main/src/crypt): `src/crypt`

### System utilities

- [Filesystem](https://github.com/skala13x/libxutils/blob/main/src/sys/xfs.c): `src/sys/xfs.c`
- [Resource monitoring](https://github.com/skala13x/libxutils/blob/main/src/sys/mon.c): `src/sys/mon.c`
- [Logging](https://github.com/skala13x/libxutils/blob/main/src/sys/log.c): `src/sys/log.c`
- [CLI helpers](https://github.com/skala13x/libxutils/blob/main/src/sys/cli.c): `src/sys/cli.c`
- [Threading](https://github.com/skala13x/libxutils/blob/main/src/sys/thread.c): `src/sys/thread.c`

### Additional protocols

- [NTP client](https://github.com/skala13x/libxutils/blob/main/src/net/ntp.c): `src/net/ntp.c`
- [RTP helpers](https://github.com/skala13x/libxutils/blob/main/src/net/rtp.c): `src/net/rtp.c`
- [Version helpers](https://github.com/skala13x/libxutils/blob/main/src/xver.c): `src/xver.c`

### Other components

- **Native application**

## Connections

- Native application → Network API: configures and uses
- Network API → Event loop: multiplexes through
- Network API → Socket layer: uses shared sockets
- Network API → HTTP: serves HTTP
- Network API → WebSocket: serves WebSocket
- Network API → MDTP: serves MDTP
- Network API → Byte buffers: uses session buffers (evidence: `src/net/api.c`)
- JSON processing → String utilities: uses (evidence: `src/data/json.c`)
- JSON processing → Maps and lists: uses maps (evidence: `src/data/json.c`)
- JSON processing → Dynamic arrays: uses arrays
- Crypto dispatch → AES: dispatches to (evidence: `src/crypt/crypt.c`)
- Crypto dispatch → RSA: dispatches to (evidence: `src/crypt/crypt.c`)
- Crypto dispatch → Hash and encoding: dispatches to (evidence: `src/crypt/crypt.c`)
- RSA → Filesystem: uses (evidence: `src/crypt/rsa.c`)
- Resource monitoring → Filesystem: reads system files (evidence: `src/sys/mon.c`)
- Threading → Network API: can support workers
