# openbmc/phosphor-net-ipmid architecture

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

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

## Overview

##### Main Components

a) Core Service Components:
- IPMI Network Daemon (Main Service)
- Session Management System
- Message Handling System
- Command Processing System
- SOL (Serial Over LAN) Subsystem
- Event Loop Handler

b) Protocol Components:
- RMCP (Remote Management Control Protocol) Layer
- Authentication System
- Cryptography System
- Integrity Checking System

c) External Dependencies (shown from subprojects):
- D-Bus Interface
- Logging System
- Host IPMI Daemon
- CLI11 (Command Line Interface)

##### Component Relationships

**Top Level (External Interface):**
- Socket Channel Interface
- D-Bus Interface

**Middle Level (Core Processing):**
- Message Handler
- Session Manager
- Command Table
- SOL Manager

**Bottom Level (Protocol Implementation):**
- Authentication Algorithms
- Cryptography Algorithms
- Integrity Algorithms
- RMCP Protocol

##### Key Relationships to Highlight

- How the Socket Channel interfaces with the Message Handler
- Relationship between Session Manager and Authentication/Cryptography
- Command flow from Message Handler through Command Table to specific command implementations
- How SOL Manager interfaces with the console buffer and main service

##### Implementation Details

- SD Event Loop as the central event handling mechanism
- Command hierarchy (payload, session, SOL commands)
- RMCP protocol stack layers
- Security pipeline (auth_algo → crypt_algo → integrity_algo)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Interface Layer"
        Socket["Socket Channel Interface"]:::network
        DBus["D-Bus Interface"]:::external
    end

    subgraph "Core Processing Layer"
        MainService["IPMI Network Daemon"]:::core
        EventLoop["SD Event Loop"]:::core
        MsgHandler["Message Handler"]:::core
        SessionMgr["Session Manager"]:::management
        CmdTable["Command Table"]:::core
        SOLMgr["SOL Manager"]:::management
        CommModule["Communication Module"]:::core
    end

    subgraph "Protocol Layer"
        RMCP["RMCP Protocol"]:::protocol
        Auth["Authentication System"]:::security
        Crypto["Cryptography System"]:::security
        Integrity["Integrity System"]:::security
    end

    subgraph "Command Components"
        direction TB
        ChanAuth["Channel Authentication"]:::command
        SessCmds["Session Commands"]:::command
        SOLCmds["SOL Commands"]:::command
        PayloadCmds["Payload Commands"]:::command
        RAKPCmds["RAKP Commands"]:::command
    end

    subgraph "SOL Components"
        direction TB
        ConBuf["Console Buffer"]:::sol
        SOLCtx["SOL Context"]:::sol
    end

    %% Relationships
    Socket --> CommModule
    CommModule --> MsgHandler
    MsgHandler --> SessionMgr
    MsgHandler --> CmdTable
    SessionMgr --> Auth
    SessionMgr --> Crypto
    SessionMgr --> Integrity
    CmdTable --> ChanAuth
    CmdTable --> SessCmds
    CmdTable --> SOLCmds
    CmdTable --> PayloadCmds
    CmdTable --> RAKPCmds
    SOLMgr --> ConBuf
    SOLMgr --> SOLCtx
    MainService --> EventLoop
    EventLoop --> MsgHandler
    RMCP --> CommModule

    %% Click Events
    click MainService "https://github.com/openbmc/phosphor-net-ipmid/blob/master/main.cpp"
    click SessionMgr "https://github.com/openbmc/phosphor-net-ipmid/blob/master/sessions_manager.cpp"
    click MsgHandler "https://github.com/openbmc/phosphor-net-ipmid/blob/master/message_handler.cpp"
    click CmdTable "https://github.com/openbmc/phosphor-net-ipmid/blob/master/command_table.cpp"
    click SOLMgr "https://github.com/openbmc/phosphor-net-ipmid/blob/master/sol/sol_manager.cpp"
    click EventLoop "https://github.com/openbmc/phosphor-net-ipmid/blob/master/sd_event_loop.cpp"
    click RMCP "https://github.com/openbmc/phosphor-net-ipmid/blob/master/rmcp.hpp"
    click Auth "https://github.com/openbmc/phosphor-net-ipmid/blob/master/auth_algo.cpp"
    click Crypto "https://github.com/openbmc/phosphor-net-ipmid/blob/master/crypt_algo.cpp"
    click Integrity "https://github.com/openbmc/phosphor-net-ipmid/blob/master/integrity_algo.cpp"
    click ChanAuth "https://github.com/openbmc/phosphor-net-ipmid/blob/master/command/channel_auth.cpp"
    click SessCmds "https://github.com/openbmc/phosphor-net-ipmid/blob/master/command/session_cmds.cpp"
    click SOLCmds "https://github.com/openbmc/phosphor-net-ipmid/blob/master/command/sol_cmds.cpp"
    click PayloadCmds "https://github.com/openbmc/phosphor-net-ipmid/blob/master/command/payload_cmds.cpp"
    click RAKPCmds "https://github.com/openbmc/phosphor-net-ipmid/blob/master/command/rakp12.cpp"
    click CommModule "https://github.com/openbmc/phosphor-net-ipmid/blob/master/comm_module.cpp"
    click Socket "https://github.com/openbmc/phosphor-net-ipmid/blob/master/socket_channel.hpp"
    click ConBuf "https://github.com/openbmc/phosphor-net-ipmid/blob/master/sol/console_buffer.hpp"
    click SOLCtx "https://github.com/openbmc/phosphor-net-ipmid/blob/master/sol/sol_context.cpp"

    %% Styling
    classDef core fill:#f9f,stroke:#333,stroke-width:2px
    classDef network fill:#99f,stroke:#333,stroke-width:2px
    classDef external fill:#gray,stroke:#333,stroke-width:2px
    classDef management fill:#ff9,stroke:#333,stroke-width:2px
    classDef protocol fill:#f96,stroke:#333,stroke-width:2px
    classDef security fill:#9f9,stroke:#333,stroke-width:2px
    classDef command fill:#69f,stroke:#333,stroke-width:2px
    classDef sol fill:#fc9,stroke:#333,stroke-width:2px
```
