# outscale/packetgraph architecture

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

- Interactive diagram: https://gitdiagram.com/outscale/packetgraph
- Repository: https://github.com/outscale/packetgraph

## Overview

##### Main Components

a) Core Components:
- DPDK Integration Layer
- Packet Processing Engine
- Brick Management System
- Graph Management System
- Thread Management System

b) Brick Types (Group by functionality):
- Layer 2 Components (Switch, Hub)
- Virtual Interfaces (TAP, VHOST)
- Security Components (Firewall, Antispoof)
- Tunneling (VTEP)
- Utility Components (Print, Queue, Diode)
- Network Interface (NIC)
- Custom Components (User-dipole, RXTX)

**┌─────────────────────────────────────────────────────────┐**
- Application Layer                      │
- ┤
- Packetgraph Core                      │
- ┬───────────┬────────────┬──────────────────┤
- Graph    │  Brick    │  Thread    │     Packet       │
- Manager   │  Manager  │  Manager   │    Processing    │
- ┴───────────┴────────────┴──────────────────┤
- DPDK Interface                       │
- ┘

##### Component Relationships

- Data flow (→): Show packet movement between bricks
- Dependencies (⇢): Show component dependencies
- Control flow (⇒): Show management operations

##### Brick Components Section

**┌─────────────────── Brick Types ──────────────────┐**
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
- Network │ │Security │ │ Virtual │ │ Utility │ │
- Bricks  │ │ Bricks  │ │ Bricks  │ │ Bricks  │ │
- ┘ └─────────┘ └─────────┘ └─────────┘ │
- ┘

##### Implementation Details

Technical details such as:
- Maximum burst size (64 packets)
- Thread safety boundaries
- Core affinity
- Huge page memory allocation
- DPDK PMD integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Layer
    subgraph Core
        DPDK["DPDK Integration Layer"]:::dpdk
        PacketProc["Packet Processing Engine"]:::core
        BrickMgr["Brick Management System"]:::core
        GraphMgr["Graph Management System"]:::core
        ThreadMgr["Thread Management System"]:::core
    end

    %% Brick Types Layer
    subgraph BrickTypes
        direction TB
        
        subgraph NetworkBricks
            direction TB
            Switch["Switch"]:::network
            Hub["Hub"]:::network
            NIC["NIC"]:::network
        end

        subgraph VirtualBricks
            direction TB
            TAP["TAP"]:::virtual
            VHOST["VHOST"]:::virtual
        end

        subgraph SecurityBricks
            direction TB
            Firewall["Firewall"]:::security
            Antispoof["Antispoof"]:::security
        end

        subgraph TunnelingBricks
            direction TB
            VTEP["VTEP"]:::tunneling
        end

        subgraph UtilityBricks
            direction TB
            Print["Print"]:::utility
            Queue["Queue"]:::utility
            Diode["Diode"]:::utility
        end

        subgraph CustomBricks
            direction TB
            UserDipole["User-dipole"]:::custom
            RXTX["RXTX"]:::custom
        end
    end

    %% Relationships
    DPDK --> PacketProc
    PacketProc --> BrickMgr
    BrickMgr --> GraphMgr
    ThreadMgr --> BrickMgr
    BrickMgr --> NetworkBricks
    BrickMgr --> VirtualBricks
    BrickMgr --> SecurityBricks
    BrickMgr --> TunnelingBricks
    BrickMgr --> UtilityBricks
    BrickMgr --> CustomBricks

    %% Styling
    classDef core fill:#2374ab
    classDef network fill:#57a773
    classDef virtual fill:#ffc857
    classDef security fill:#ef476f
    classDef tunneling fill:#f78c6b
    classDef utility fill:#95a5a6
    classDef custom fill:#8675a9
    classDef dpdk fill:#34495e

    %% Click Events
    click DPDK "https://github.com/outscale/packetgraph/tree/master/3rdparty/dpdk"
    click PacketProc "https://github.com/outscale/packetgraph/blob/master/src/packet.c"
    click BrickMgr "https://github.com/outscale/packetgraph/blob/master/src/brick.c"
    click GraphMgr "https://github.com/outscale/packetgraph/blob/master/src/graph.c"
    click ThreadMgr "https://github.com/outscale/packetgraph/blob/master/src/thread.c"
    click Switch "https://github.com/outscale/packetgraph/blob/master/src/switch.c"
    click Hub "https://github.com/outscale/packetgraph/blob/master/src/hub.c"
    click TAP "https://github.com/outscale/packetgraph/blob/master/src/tap.c"
    click VHOST "https://github.com/outscale/packetgraph/blob/master/src/vhost.c"
    click Firewall "https://github.com/outscale/packetgraph/blob/master/src/firewall.c"
    click Antispoof "https://github.com/outscale/packetgraph/blob/master/src/antispoof.c"
    click VTEP "https://github.com/outscale/packetgraph/blob/master/src/vtep.c"
    click Print "https://github.com/outscale/packetgraph/blob/master/src/print.c"
    click Queue "https://github.com/outscale/packetgraph/blob/master/src/queue.c"
    click Diode "https://github.com/outscale/packetgraph/blob/master/src/diode.c"
    click NIC "https://github.com/outscale/packetgraph/blob/master/src/nic.c"
    click UserDipole "https://github.com/outscale/packetgraph/blob/master/src/user-dipole.c"
    click RXTX "https://github.com/outscale/packetgraph/blob/master/src/rxtx.c"
```
