# tchan0/imekugi architecture

> Architecture diagram of the GitHub repository tchan0/imekugi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tchan0/imekugi
- Repository: https://github.com/tchan0/imekugi

## Overview

##### Main Components

a) Client Side Components:
- WNASPI32.DLL Replacement (Core Component)
- Legacy SCSI Applications
- Configuration System (wnaspi32.cfg)
- Logging System (wnaspi32.log)

b) Server Side Components:
- SCSI Server (scsiserv)
- Server Configuration (scsiserv.cfg)
- SCSI Device Interface
- TCP Communication Layer

##### Specific Elements

a) Component Relationships:
- Legacy apps ↔ WNASPI32.DLL
- WNASPI32.DLL ↔ TCP Layer
- TCP Layer ↔ SCSI Server
- SCSI Server ↔ Physical Devices

- Blue: Client-side components
- Green: Communication layer
- Orange: Server-side components
- Gray: Physical hardware
- Yellow: Configuration elements

##### Technical Details to Highlight

- SCSI command translation (src/srb folder)
- TCP communication stack (src/socket folder)
- Device interfaces (src/scsi folder)
- Utility functions (src/utils folder)

##### Implementation Notes

Callouts showing:
- Support for both Windows and Linux servers
- Virtual machine compatibility
- Multiple transport methods (local SCSI, TCP)
- Configuration options
- Logging capabilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style definitions
    classDef client fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef server fill:#ffd9b3,stroke:#333,stroke-width:2px
    classDef config fill:#ffffb3,stroke:#333,stroke-width:2px
    classDef comm fill:#b3ffb3,stroke:#333,stroke-width:2px
    classDef hardware fill:#e6e6e6,stroke:#333,stroke-width:2px
    classDef utils fill:#d9b3ff,stroke:#333,stroke-width:2px

    %% Client Applications Layer
    subgraph ClientApps
        LegacyApps["Legacy SCSI Applications"]:::client
        VMApps["VM SCSI Applications"]:::client
    end

    %% WNASPI32 Interface Layer
    subgraph WNASPI32Interface
        WNASPI["WNASPI32.DLL Replacement"]:::client
        click WNASPI "https://github.com/Tchan0/iMekugi/blob/main/src/wnaspi32.c"
        Config["wnaspi32.cfg"]:::config
        Logger["Logging System"]:::utils
        click Logger "https://github.com/Tchan0/iMekugi/blob/main/src/utils/logger.c"
        SRB["SRB Processing"]:::client
        click SRB "https://github.com/Tchan0/iMekugi/blob/main/src/srb/srb.c"
    end

    %% Communication Layer
    subgraph CommLayer
        TCP["TCP Communication Layer"]:::comm
        click TCP "https://github.com/Tchan0/iMekugi/blob/main/src/socket/TCPBase.c"
        SRB2TCP["SRB to TCP Converter"]:::comm
        click SRB2TCP "https://github.com/Tchan0/iMekugi/blob/main/src/srb/srb2tcp.c"
        Threading["Threading System"]:::utils
        click Threading "https://github.com/Tchan0/iMekugi/blob/main/src/utils/thread.c"
    end

    %% Server Components
    subgraph ServerComponents
        SCSIServer["SCSI Server (scsiserv)"]:::server
        click SCSIServer "https://github.com/Tchan0/iMekugi/blob/main/src/scsiserv.c"
        ServerConfig["scsiserv.cfg"]:::config
        DeviceMapping["Device Mapping System"]:::server
        SRB2SCSI["SRB to SCSI Converter"]:::server
        click SRB2SCSI "https://github.com/Tchan0/iMekugi/blob/main/src/srb/srb2scsi.c"
    end

    %% Hardware Interface Layer
    subgraph HardwareInterface
        SCSI["SCSI Device Interface"]:::hardware
        click SCSI "https://github.com/Tchan0/iMekugi/blob/main/src/scsi/scsi.c"
        PhysicalDevices["Physical SCSI Devices"]:::hardware
        HostAdapter["Host Adapter Interface"]:::hardware
    end

    %% Relationships
    LegacyApps --> WNASPI
    VMApps --> WNASPI
    WNASPI --> Config
    WNASPI --> Logger
    WNASPI --> SRB
    SRB --> SRB2TCP
    SRB2TCP --> TCP
    TCP --> Threading
    TCP --> SCSIServer
    SCSIServer --> ServerConfig
    SCSIServer --> DeviceMapping
    SCSIServer --> SRB2SCSI
    SRB2SCSI --> SCSI
    SCSI --> PhysicalDevices
    SCSI --> HostAdapter

    %% Legend
    subgraph Legend
        Client["Client Components"]:::client
        Server["Server Components"]:::server
        Configuration["Configuration Files"]:::config
        Communication["Communication Layer"]:::comm
        HW["Hardware Components"]:::hardware
        Utilities["Utility Components"]:::utils
    end
```
