# vector35/binaryninja-api architecture

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

- Interactive diagram: https://gitdiagram.com/vector35/binaryninja-api
- Repository: https://github.com/vector35/binaryninja-api

## Overview

##### Main Components

a. Core Components:
- Binary Ninja Core (closed-source component)
- API Layer (C++, Python, and Rust interfaces)
- Architecture Plugins System
- Binary View Types System
- Platform Support System
- Debug Information System

b. Language Bindings:
- C++ API Interface
- Python API Interface
- Rust API Interface

c. Plugin Systems:
- Architecture Plugins (x86, ARM64, ARMv7, PPC, MIPS, RISC-V, MSP430)
- Binary View Types (Mach-O, ELF, PE/COFF/TE, MD1Rom)
- Platform Plugins (Windows, Linux, macOS, FreeBSD, Decree, EFI)
- Debug Info Plugins (DWARF, PDB, IDB)

##### Relationships and Data Flow

**[Binary Ninja Core]**
- ↑↓
**[API Layer (C++/Python/Rust Bindings)]**
- ↑↓
**[Plugin Systems]**
- [Architecture Plugins]
- [Binary View Types]
- [Platform Plugins]
- [Debug Info Plugins]

##### Detailed Component Breakdown

For each major component, show:
- Input/Output interfaces
- Dependencies between components
- Communication channels
- Extension points

**[Architecture System]**
- Disassembly Engine
- IL (Intermediate Language) System
- Architecture-specific Features

**[Analysis Pipeline]**
- Linear Disassembly
- Recursive Descent
- Type Analysis
- Cross References

##### Integration Points

Integration with:
- UI Components (if not headless)
- External Tools
- Debug Information Sources
- Plugin Extension Points

##### Notes for Implementation

- Use double lines for primary data flow paths
- Version compatibility notes
- Headless vs. UI-dependent components

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        BNCore[Binary Ninja Core]:::core
        APILayer[API Layer]:::api
        click APILayer "https://github.com/Vector35/binaryninja-api/blob/dev/binaryninjaapi.cpp"
    end

    subgraph "Language Bindings"
        CPP[C++ API]:::binding
        Python[Python API]:::binding
        Rust[Rust API]:::binding
        click CPP "https://github.com/Vector35/binaryninja-api/blob/dev/binaryninjaapi.h"
        click Python "https://github.com/Vector35/binaryninja-api/tree/dev/python/"
        click Rust "https://github.com/Vector35/binaryninja-api/tree/dev/rust/"
    end

    subgraph "Plugin Systems"
        ArchSystem[Architecture System]:::plugin
        BVSystem[Binary View Types System]:::plugin
        PlatformSystem[Platform Support System]:::plugin
        DebugSystem[Debug Information System]:::plugin
        click ArchSystem "https://github.com/Vector35/binaryninja-api/tree/dev/arch/"
        click BVSystem "https://github.com/Vector35/binaryninja-api/tree/dev/view/"
        click PlatformSystem "https://github.com/Vector35/binaryninja-api/tree/dev/platform/"
        click DebugSystem "https://github.com/Vector35/binaryninja-api/blob/dev/debuginfo.cpp"
    end

    subgraph "Architecture Plugins"
        x86[x86]:::arch
        ARM64[ARM64]:::arch
        ARMv7[ARMv7]:::arch
        PPC[PowerPC]:::arch
        MIPS[MIPS]:::arch
        RISCV[RISC-V]:::arch
        MSP430[MSP430]:::arch
        click x86 "https://github.com/Vector35/binaryninja-api/tree/dev/arch/x86/"
        click ARM64 "https://github.com/Vector35/binaryninja-api/tree/dev/arch/arm64/"
        click ARMv7 "https://github.com/Vector35/binaryninja-api/tree/dev/arch/armv7/"
        click PPC "https://github.com/Vector35/binaryninja-api/tree/dev/arch/powerpc/"
        click MIPS "https://github.com/Vector35/binaryninja-api/tree/dev/arch/mips/"
        click RISCV "https://github.com/Vector35/binaryninja-api/tree/dev/arch/riscv/"
        click MSP430 "https://github.com/Vector35/binaryninja-api/tree/dev/arch/msp430/"
    end

    subgraph "Binary View Types"
        PE["PE/COFF/TE"]:::bview
        MachO[Mach-O]:::bview
        ELF[ELF]:::bview
        MD1Rom[MD1Rom]:::bview
        click PE "https://github.com/Vector35/binaryninja-api/tree/dev/view/pe/"
        click MachO "https://github.com/Vector35/binaryninja-api/tree/dev/view/macho/"
        click ELF "https://github.com/Vector35/binaryninja-api/tree/dev/view/elf/"
        click MD1Rom "https://github.com/Vector35/binaryninja-api/tree/dev/view/md1rom/"
    end

    subgraph "Platform Support"
        Windows[Windows]:::platform
        Linux[Linux]:::platform
        macOS[macOS]:::platform
        FreeBSD[FreeBSD]:::platform
        EFI[EFI]:::platform
        Decree[Decree]:::platform
        click Windows "https://github.com/Vector35/binaryninja-api/tree/dev/platform/windows/"
        click Linux "https://github.com/Vector35/binaryninja-api/tree/dev/platform/linux/"
        click macOS "https://github.com/Vector35/binaryninja-api/tree/dev/platform/mac/"
        click FreeBSD "https://github.com/Vector35/binaryninja-api/tree/dev/platform/freebsd/"
        click EFI "https://github.com/Vector35/binaryninja-api/tree/dev/platform/efi/"
        click Decree "https://github.com/Vector35/binaryninja-api/tree/dev/platform/decree/"
    end

    subgraph "Debug Info"
        DWARF[DWARF]:::debug
        PDB[PDB]:::debug
        IDB[IDB]:::debug
        click DWARF "https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/dwarf/"
        click PDB "https://github.com/Vector35/binaryninja-api/tree/dev/plugins/pdb-ng/"
    end

    subgraph "Type System"
        TypeLib[Type Library]:::type
        TypeParser[Type Parser]:::type
        TypeContainer[Type Container]:::type
        TypeArchive[Type Archive]:::type
        click TypeLib "https://github.com/Vector35/binaryninja-api/blob/dev/typelibrary.cpp"
        click TypeParser "https://github.com/Vector35/binaryninja-api/blob/dev/typeparser.cpp"
        click TypeContainer "https://github.com/Vector35/binaryninja-api/blob/dev/typecontainer.cpp"
        click TypeArchive "https://github.com/Vector35/binaryninja-api/blob/dev/typearchive.cpp"
    end

    BNCore --> APILayer
    APILayer --> CPP & Python & Rust
    APILayer --> ArchSystem & BVSystem & PlatformSystem & DebugSystem

    ArchSystem --> x86 & ARM64 & ARMv7 & PPC & MIPS & RISCV & MSP430
    BVSystem --> PE & MachO & ELF & MD1Rom
    PlatformSystem --> Windows & Linux & macOS & FreeBSD & EFI & Decree
    DebugSystem --> DWARF & PDB & IDB

    APILayer --> TypeLib
    TypeLib --> TypeParser
    TypeParser --> TypeContainer
    TypeContainer --> TypeArchive

    classDef core fill:#2374ab
    classDef api fill:#48a9a6
    classDef binding fill:#4ad66d
    classDef plugin fill:#e4572e
    classDef arch fill:#f3a712
    classDef bview fill:#a8c686
    classDef platform fill:#9c89b8
    classDef debug fill:#f46036
    classDef type fill:#2e5077

    subgraph Legend
        L1[Core Components]:::core
        L2[API Components]:::api
        L3[Language Bindings]:::binding
        L4[Plugin Systems]:::plugin
        L5[Architecture]:::arch
        L6[Binary Views]:::bview
        L7[Platforms]:::platform
        L8[Debug Info]:::debug
        L9[Type System]:::type
    end
```
