# openbmc/phosphor-host-ipmid architecture

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

- Interactive diagram: https://gitdiagram.com/openbmc/phosphor-host-ipmid
- Repository: https://github.com/openbmc/phosphor-host-ipmid

## Overview

##### Supporting Subsystems

a) User & Channel Management (Create as a distinct subsystem):
- Channel Layer
- User Layer
- Password Manager
- Cipher Management

b) DBus SDR Integration:
- Sensor Commands
- Storage Commands
- SDR Utils

##### Data Flow and Interfaces

- IPMI message flow from transport layer through handlers
- DBus communication paths
- Host interface interactions
- Sensor data flow
- Storage operations

##### Key Technical Elements to Highlight

- DBus integration points
- Message handling pipeline
- Sensor data flow
- Storage management
- Security components (cipher, user management)

##### Implementation Details Layer

- Library dependencies (boost, sdbusplus, phosphor-logging)
- Configuration components
- Test infrastructure

##### IPMI command flow
Transport → Handlers → Specific Implementation

##### System Integration
Host Interface ↔ IPMI Daemon ↔ DBus Services

##### Management Flow
User/Channel Management → Security Layer → Command Processing

Technical details:
- DBus service interfaces
- IPMI command routing
- Sensor data handling
- Storage management
- Security layer implementation

Keep the abstraction level focused on the architectural components while showing the key relationships between different modules. This will help maintain clarity while preserving the technical depth necessary for understanding the system's operation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core IPMI Service
    subgraph Core
        MainDaemon["Main IPMI Daemon"]:::core
        MessageHandling["Message Handling"]:::core
    end
    click MainDaemon "https://github.com/openbmc/phosphor-host-ipmid/blob/master/ipmid-new.cpp"
    click MessageHandling "https://github.com/openbmc/phosphor-host-ipmid/tree/master/include/ipmid/message/"

    %% Handlers Layer
    subgraph Handlers
        Transport["Transport Handler"]:::handler
        Storage["Storage Handler"]:::handler
        Sensor["Sensor Handler"]:::handler
        Chassis["Chassis Handler"]:::handler
        Global["Global Handler"]:::handler
        DCMI["DCMI Handler"]:::handler
        App["App Handler"]:::handler
    end
    click Transport "https://github.com/openbmc/phosphor-host-ipmid/blob/master/transporthandler.cpp"
    click Storage "https://github.com/openbmc/phosphor-host-ipmid/blob/master/storagehandler.cpp"
    click Sensor "https://github.com/openbmc/phosphor-host-ipmid/blob/master/sensorhandler.cpp"
    click Chassis "https://github.com/openbmc/phosphor-host-ipmid/blob/master/chassishandler.cpp"
    click Global "https://github.com/openbmc/phosphor-host-ipmid/blob/master/globalhandler.cpp"
    click DCMI "https://github.com/openbmc/phosphor-host-ipmid/blob/master/dcmihandler.cpp"
    click App "https://github.com/openbmc/phosphor-host-ipmid/blob/master/apphandler.cpp"

    %% Specialized Services
    subgraph Services
        Watchdog["Watchdog Service"]:::service
        HostCmd["Host Command Manager"]:::service
        HostInterface["Host Interface"]:::service
        SoftPower["Soft Power Off Service"]:::service
    end
    click Watchdog "https://github.com/openbmc/phosphor-host-ipmid/blob/master/app/watchdog_service.cpp"
    click HostCmd "https://github.com/openbmc/phosphor-host-ipmid/blob/master/host-cmd-manager.cpp"
    click HostInterface "https://github.com/openbmc/phosphor-host-ipmid/blob/master/host-interface.cpp"
    click SoftPower "https://github.com/openbmc/phosphor-host-ipmid/blob/master/softoff/softoff.cpp"

    %% User & Channel Management
    subgraph UserChannel
        Channel["Channel Layer"]:::security
        User["User Layer"]:::security
        Password["Password Manager"]:::security
        Cipher["Cipher Management"]:::security
    end
    click Channel "https://github.com/openbmc/phosphor-host-ipmid/blob/master/user_channel/channel_layer.cpp"
    click User "https://github.com/openbmc/phosphor-host-ipmid/blob/master/user_channel/user_layer.cpp"
    click Password "https://github.com/openbmc/phosphor-host-ipmid/blob/master/user_channel/passwd_mgr.cpp"
    click Cipher "https://github.com/openbmc/phosphor-host-ipmid/blob/master/user_channel/cipher_mgmt.cpp"

    %% DBus SDR Integration
    subgraph DBusSDR
        SensorCmd["Sensor Commands"]:::dbus
        StorageCmd["Storage Commands"]:::dbus
        SDRUtils["SDR Utils"]:::dbus
    end
    click SensorCmd "https://github.com/openbmc/phosphor-host-ipmid/blob/master/dbus-sdr/sensorcommands.cpp"
    click StorageCmd "https://github.com/openbmc/phosphor-host-ipmid/blob/master/dbus-sdr/storagecommands.cpp"
    click SDRUtils "https://github.com/openbmc/phosphor-host-ipmid/blob/master/dbus-sdr/sdrutils.cpp"

    %% Supporting Components
    subgraph Support
        SensorData["Sensor Data Handler"]:::support
        SELUtil["SEL Utility"]:::support
        SysInterface["System Interface Commands"]:::support
    end
    click SensorData "https://github.com/openbmc/phosphor-host-ipmid/blob/master/sensordatahandler.cpp"
    click SELUtil "https://github.com/openbmc/phosphor-host-ipmid/blob/master/selutility.cpp"
    click SysInterface "https://github.com/openbmc/phosphor-host-ipmid/blob/master/systemintfcmds.cpp"

    %% Connections
    MainDaemon --> MessageHandling
    MessageHandling --> Transport
    MessageHandling --> Storage
    MessageHandling --> Sensor
    MessageHandling --> Chassis
    MessageHandling --> Global
    MessageHandling --> DCMI
    MessageHandling --> App

    Transport --> HostInterface
    HostInterface --> HostCmd
    HostCmd --> SoftPower
    App --> Watchdog

    MainDaemon --> UserChannel
    UserChannel --> Channel
    UserChannel --> User
    UserChannel --> Password
    UserChannel --> Cipher

    Sensor --> SensorData
    Storage --> SELUtil
    Global --> SysInterface

    DBusSDR --> SensorCmd
    DBusSDR --> StorageCmd
    DBusSDR --> SDRUtils

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef handler fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef dbus fill:#9b59b6,stroke:#8e44ad,color:white
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white
```
