# ebiggers/wimlib architecture

> Architecture diagram of the GitHub repository ebiggers/wimlib, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ebiggers/wimlib
- Repository: https://github.com/ebiggers/wimlib

## Overview

##### Main Components

a. Core Library Components:
- Compression Engine (src/compress*)
- Decompression Engine (src/decompress*)
- File System Handlers
- Windows Implementation
- UNIX Implementation
- NTFS-3G Implementation
- WIM Format Handler (src/wim.c)
- XML Processing (src/xml*)

b. External Interfaces:
- Public API (include/wimlib.h)
- Command-line Interface (wimlib-imagex)
- FUSE Mount Interface
- NTFS-3G Interface

##### Component Relationships

**[Applications/Tools Layer]**
- wimlib-imagex (CLI) | External Programs
- ↓
**[Public API Layer]**
- wimlib.h Interface
- ↓
**[Core Processing Layer]**
- ┌─────────────────────────────────────┐
- WIM Format Handler                  │
- ↓                 ↓              │
- Compression    Decompression        │
- (LZX/XPRESS/LZMS)                  │
- ┘
- ↓
**[Platform Abstraction Layer]**
- ┌─────────────┬────────────┬──────────┐
- Windows     │ UNIX       │ NTFS-3G  │
- Implementation│ Implementation│ Support│
- ┴────────────┴──────────┘
- ↓
**[Operating System Layer]**
- Windows | Linux | macOS | FreeBSD

##### Important Elements to Highlight

a. Compression Features:
- Multiple compression formats (LZX, XPRESS, LZMS)
- Parallel compression support
- Solid compression mode

b. Cross-Platform Support:
- Windows-specific features
- UNIX-specific features
- NTFS-specific handling

c. File System Operations:
- Capture
- Apply
- Mount
- Update
- Extract

##### Special Notes

- Separation between platform-specific and platform-independent code
- Relationship with external dependencies (FUSE, NTFS-3G)
- Test coverage paths
- API stability boundaries

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef external fill:#2ecc71,stroke:#27ae60,color:white
    classDef platform fill:#f1c40f,stroke:#f39c12,color:black
    classDef os fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef compression fill:#9b59b6,stroke:#8e44ad,color:white

    %% Applications Layer
    subgraph Applications
        CLI["Command Line Interface<br/>(wimlib-imagex)"]
        ExtPrograms["External Programs"]
    end

    %% Public API Layer
    subgraph API
        PublicAPI["Public API<br/>(wimlib.h)"]
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        WIMHandler["WIM Format Handler"]
        XMLProc["XML Processing"]
        CompEngine["Compression Engine<br/>(LZX/XPRESS/LZMS)"]
        DecompEngine["Decompression Engine"]
        SecurityHandler["Security Handling"]
        FSOperations["File System Operations"]
    end

    %% Platform Layer
    subgraph PlatformLayer
        WinImpl["Windows Implementation"]
        UnixImpl["UNIX Implementation"]
        NTFSImpl["NTFS-3G Implementation"]
        MountInterface["FUSE Mount Interface"]
    end

    %% OS Layer
    subgraph OSLayer
        Windows["Windows"]
        Linux["Linux"]
        MacOS["macOS"]
        FreeBSD["FreeBSD"]
    end

    %% Relationships
    CLI --> PublicAPI
    ExtPrograms --> PublicAPI
    PublicAPI --> WIMHandler
    WIMHandler --> XMLProc
    WIMHandler --> CompEngine
    WIMHandler --> DecompEngine
    WIMHandler --> SecurityHandler
    WIMHandler --> FSOperations
    FSOperations --> WinImpl
    FSOperations --> UnixImpl
    FSOperations --> NTFSImpl
    FSOperations --> MountInterface
    WinImpl --> Windows
    UnixImpl --> Linux
    UnixImpl --> MacOS
    UnixImpl --> FreeBSD
    NTFSImpl --> Linux
    MountInterface --> Linux

    %% Click events for component mapping
    click CLI "https://github.com/ebiggers/wimlib/blob/master/programs/imagex.c"
    click PublicAPI "https://github.com/ebiggers/wimlib/blob/master/include/wimlib.h"
    click WIMHandler "https://github.com/ebiggers/wimlib/blob/master/src/wim.c"
    click XMLProc "https://github.com/ebiggers/wimlib/blob/master/src/xml.c"
    click CompEngine "https://github.com/ebiggers/wimlib/blob/master/src/compress.c"
    click DecompEngine "https://github.com/ebiggers/wimlib/blob/master/src/decompress.c"
    click SecurityHandler "https://github.com/ebiggers/wimlib/blob/master/src/security.c"
    click FSOperations "https://github.com/ebiggers/wimlib/blob/master/src/scan.c"
    click WinImpl "https://github.com/ebiggers/wimlib/blob/master/src/win32_common.c"
    click UnixImpl "https://github.com/ebiggers/wimlib/blob/master/src/unix_capture.c"
    click NTFSImpl "https://github.com/ebiggers/wimlib/blob/master/src/ntfs-3g_capture.c"
    click MountInterface "https://github.com/ebiggers/wimlib/blob/master/src/mount_image.c"

    %% Style applications
    class CLI,ExtPrograms external
    class PublicAPI external
    class WIMHandler,XMLProc,FSOperations core
    class CompEngine,DecompEngine compression
    class WinImpl,UnixImpl,NTFSImpl,MountInterface platform
    class Windows,Linux,MacOS,FreeBSD os
```
